query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102 values |
|---|---|---|---|---|---|---|
Delete Microsoft Teams messages contained in an eDiscovery search. You can collect and purge the following categories of Teams content: Teams 1:1 chats Chat messages, posts, and attachments shared in a Teams conversation between two people. Teams 1:1 chats are also called conversations. Teams group chats Chat messages, posts, and attachments shared in a Teams conversation between three or more people. Also called 1:N chats or group conversations. Teams channels Chat messages, posts, replies, and attachments shared in a standard Teams channel. Private channels Message posts, replies, and attachments shared in a private Teams channel. Shared channels Message posts, replies, and attachments shared in a shared Teams channel. For more information about purging Teams messages, see: eDiscovery solution series: Data spillage scenario Search and purge eDiscovery (Premium) workflow for content in Microsoft Teams | def post(body, request_configuration=nil)
raise StandardError, 'body cannot be null' if body.nil?
request_info = self.to_post_request_information(
body, request_configuration
)
error_mapping = Hash.new
error_mapping["4XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
error_mapping["5XX"] = lambda {|pn| MicrosoftGraph::Models::ODataErrorsODataError.create_from_discriminator_value(pn) }
return @request_adapter.send_async(request_info, nil, error_mapping)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_delete(token, channel_id, messages = [])\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/messages/bulk_delete\",\n { messages: messages }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def destroy\n @home_searches_mess... | [
"0.6224203",
"0.6218484",
"0.6158605",
"0.6158472",
"0.60588366",
"0.601287",
"0.600896",
"0.60047174",
"0.59894377",
"0.5931288",
"0.58702606",
"0.5869037",
"0.5860077",
"0.5793889",
"0.5793889",
"0.5768133",
"0.57549363",
"0.5718225",
"0.5711568",
"0.5711568",
"0.5708272",
... | 0.0 | -1 |
Delete Microsoft Teams messages contained in an eDiscovery search. You can collect and purge the following categories of Teams content: Teams 1:1 chats Chat messages, posts, and attachments shared in a Teams conversation between two people. Teams 1:1 chats are also called conversations. Teams group chats Chat messages, posts, and attachments shared in a Teams conversation between three or more people. Also called 1:N chats or group conversations. Teams channels Chat messages, posts, replies, and attachments shared in a standard Teams channel. Private channels Message posts, replies, and attachments shared in a private Teams channel. Shared channels Message posts, replies, and attachments shared in a shared Teams channel. For more information about purging Teams messages, see: eDiscovery solution series: Data spillage scenario Search and purge eDiscovery (Premium) workflow for content in Microsoft Teams | def to_post_request_information(body, request_configuration=nil)
raise StandardError, 'body cannot be null' if body.nil?
request_info = MicrosoftKiotaAbstractions::RequestInformation.new()
request_info.url_template = @url_template
request_info.path_parameters = @path_parameters
request_info.http_method = :POST
unless request_configuration.nil?
request_info.add_headers_from_raw_object(request_configuration.headers)
request_info.add_request_options(request_configuration.options)
end
request_info.set_content_from_parsable(@request_adapter, "application/json", body)
return request_info
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def bulk_delete(token, channel_id, messages = [])\n request(\n __method__,\n :post,\n \"#{api_base}/channels/#{channel_id}/messages/bulk_delete\",\n { messages: messages }.to_json,\n Authorization: token,\n content_type: :json\n )\n end",
"def destroy\n @home_searches_mess... | [
"0.6224203",
"0.6218484",
"0.6158605",
"0.6158472",
"0.60588366",
"0.601287",
"0.600896",
"0.60047174",
"0.59894377",
"0.5931288",
"0.58702606",
"0.5869037",
"0.5860077",
"0.5793889",
"0.5793889",
"0.5768133",
"0.57549363",
"0.5718225",
"0.5711568",
"0.5711568",
"0.5708272",
... | 0.0 | -1 |
GET /orders/1 GET /orders/1.json | def show
@order = Order.find(params[:id])
@net_total = 0
@gross_total = 0
@order.line_item.each do |line|
@net_total += line.product.price
end
@gross_total = @net_total + @net_total * ::Rails.application.config.vat.to_d
respond_to do |format|
format.html # show.html.erb
format.json { render :json => { :order => @order, :line_items => @order.line_item, :net => @net_total, :gross => @gross_total } }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def index\n @orders = Order.order(\"id\").all\n\n resp... | [
"0.75541574",
"0.7488339",
"0.7475185",
"0.7377694",
"0.73708034",
"0.7341382",
"0.73380613",
"0.73162127",
"0.73021704",
"0.72915435",
"0.72915435",
"0.72915435",
"0.72915435",
"0.72914135",
"0.7281102",
"0.7266549",
"0.72492564",
"0.7228431",
"0.7213597",
"0.71825826",
"0.7... | 0.0 | -1 |
GET /orders/new GET /orders/new.json | def new
@order = Order.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @order }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @order = Order.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @order }\n end\n end",
"def new\n @path = '/orders'\n @method = 'post'\n @order = Order.new\n @bundles = Bundle.all\n\n respond_to do |format|\n format.html # ne... | [
"0.7949203",
"0.79032564",
"0.7840862",
"0.7822019",
"0.77941996",
"0.77778167",
"0.773388",
"0.74842054",
"0.7483639",
"0.7427913",
"0.72704005",
"0.72664636",
"0.7265858",
"0.72648495",
"0.7250548",
"0.7250548",
"0.7235224",
"0.7225517",
"0.72159165",
"0.7198694",
"0.718327... | 0.7956708 | 15 |
POST /orders POST /orders.json | def create
@order = Order.new(params[:order])
respond_to do |format|
if User.exists?(params[:order][:user_id])
if @order.save
format.html { redirect_to @order, notice: 'Order was successfully created.' }
format.json { render json: @order, status: :created, location: @order }
else
format.html { render action: "new" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
else
format.html { render action: "new" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def orders\n authenticated_post(\"orders\").body\n end",
"def orders\n authenticated_post(\"auth/r/orders\").body\n end",
"def create\n order = Order.create(order_params)\n render json: order\nend",
"def submit_order()\n\tputs \"Submitting order\"\n\tdata = create_order()\n\tresponse = ... | [
"0.75886714",
"0.7490972",
"0.7488501",
"0.74664384",
"0.72739846",
"0.7195349",
"0.7063682",
"0.69745994",
"0.6910657",
"0.68880194",
"0.68747663",
"0.685004",
"0.6840204",
"0.6838178",
"0.6838178",
"0.6838178",
"0.6838178",
"0.682244",
"0.6790037",
"0.67793274",
"0.6779247"... | 0.0 | -1 |
PUT /orders/1 PUT /orders/1.json | def update
@order = Order.find(params[:id])
respond_to do |format|
if @order.update_attributes(params[:order])
format.html { redirect_to @order, notice: 'Order was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_content\n else\n render json: @order.errors, status: :unprocessable_entity\n end\n end",
"def update\n @order = Order.find(params[:id])\n\n if @order.update(order_params)\n head :no_conte... | [
"0.6894482",
"0.6894482",
"0.680481",
"0.66316754",
"0.66230804",
"0.661799",
"0.6603682",
"0.6577292",
"0.6577292",
"0.6543601",
"0.6540103",
"0.65316814",
"0.6520171",
"0.650758",
"0.65062475",
"0.6491979",
"0.64841974",
"0.6436091",
"0.6424726",
"0.6417646",
"0.6415472",
... | 0.6553004 | 31 |
DELETE /orders/1 DELETE /orders/1.json | def destroy
@order = Order.find(params[:id])
# @order.destroy
respond_to do |format|
format.html { redirect_to @order, notice: 'Deletion of orders not allowed.' }
format.json { render json: @order.errors, status: :method_not_allowed }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n\n head :no_content\n end",
"def destroy\n @order1 = Order1.find(params[:id])\n @order1.destroy\n\n respond_to do |format|\n format.html { redirect_to order1s_url }\n format.json { head :no_content }\n end\... | [
"0.7590849",
"0.747398",
"0.74286",
"0.73708075",
"0.73703325",
"0.73698306",
"0.7356173",
"0.7356173",
"0.7356173",
"0.7356173",
"0.7356173",
"0.7346293",
"0.7346293",
"0.7346293",
"0.7346293",
"0.7346293",
"0.7346293",
"0.7346293",
"0.7346293",
"0.7346293",
"0.7346293",
"... | 0.0 | -1 |
GET /orders/1/place GET /orders/1/place.json | def place
@order = Order.find(params[:id])
if(@order.status == "DRAFT")
if(LineItem.where(:order_id => params[:id]).count > 0)
@order.status = "PLACED"
respond_to do |format|
if @order.save
format.html { redirect_to @order, notice: 'Order was successfully upgraded to PLACED.' }
format.json { render json: @order, status: :accepted, location: @order }
else
format.html { render action: "new" }
format.json { render json: @order.errors, status: :unprocessable_entity }
end
end
else
respond_to do |format|
format.html { redirect_to @order, notice: 'You must have a single line item in this order first.' }
format.json { render json: @order.errors, status: :method_not_allowed }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @place = Place.find(params[:id])\n render json: @place\n end",
"def show\n place = Place.find(params[:id])\n\n render json: place\n end",
"def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @... | [
"0.7444841",
"0.73956746",
"0.71724457",
"0.71724457",
"0.71724457",
"0.71674013",
"0.7072788",
"0.704947",
"0.70300436",
"0.7016436",
"0.7007374",
"0.6955768",
"0.6921959",
"0.6853333",
"0.684218",
"0.6831925",
"0.6794288",
"0.6778926",
"0.67473364",
"0.6732802",
"0.67262685... | 0.0 | -1 |
GET /orders/1/cancel GET /orders/1/cancel.json remember a note parameter must be passed with this request (e.g., /orders/1/cancel/?note=test) | def cancel
@order = Order.find(params[:id])
if((@order.status == "DRAFT" || @order.status == "PLACED") && params.has_key?(:note))
@order.cancel_note = params[:note]
@order.status = "CANCELLED"
if @order.save
respond_to do |format|
format.html { redirect_to @order, notice: 'Cancelled!'}
format.json { render json: @order, status: :accepted, location: @order }
end
end
else
respond_to do |format|
format.html { redirect_to @order, notice: 'You must have a note param and either be in draft or placed mode.' }
format.json { render json: @order.errors, status: :method_not_allowed }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancel(params)\n request(Resources::RESOURCE_CANCEL, HTTP_METHOD_POST, params)\n end",
"def cancel(params={})\n self.request(__method__, params)\n end",
"def cancel\n order = current_user.customer.orders.find(params[:id])\n order.update(status: 9)\n render json: {is_success... | [
"0.74228567",
"0.7092439",
"0.69464535",
"0.68763286",
"0.6772356",
"0.6710119",
"0.65814155",
"0.65803593",
"0.64887506",
"0.64772916",
"0.64544433",
"0.6453141",
"0.64417225",
"0.6382091",
"0.6382091",
"0.6366752",
"0.6331679",
"0.62915486",
"0.6282797",
"0.6276153",
"0.627... | 0.80827737 | 0 |
GET /orders/1/pay GET /orders/1/pay.json | def pay
@order = Order.find(params[:id])
if(@order.status == "PLACED")
@order.status = "PAID"
if @order.save
respond_to do |format|
format.html { redirect_to @order, notice: 'Paid!'}
format.json { render json: @order, status: :accepted, location: @order }
end
end
else
respond_to do |format|
format.html { redirect_to @order, notice: 'Order must first be placed before being paid.' }
format.json { render json: @order.errors, status: :method_not_allowed }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pay\n @order = Order.find(params[:id])\n end",
"def show\n @pay = Pay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pay }\n end\n end",
"def show\n @payments = Payment.find(params[:id]) \n render json: @payments\n end... | [
"0.72882515",
"0.6926362",
"0.6490118",
"0.6449872",
"0.64464885",
"0.643709",
"0.6404963",
"0.62971634",
"0.627812",
"0.62639016",
"0.6215126",
"0.61929584",
"0.61878437",
"0.6183852",
"0.61521167",
"0.6151737",
"0.6108971",
"0.6103535",
"0.6101567",
"0.6051177",
"0.6051177"... | 0.69251996 | 2 |
Create a deployment manifest (initially for AWS only) | def create_deployment_manifest
cloud_properties = { "instance_type" => "m1.small", "availability_zone" => "us-east-1e" }
cloud_properties["persistent_disk"] = flags[:disk] if flags[:disk]
cloud_properties["static_ips"] = ip_addresses
manifest = Bosh::Gen::Models::DeploymentManifest.new(name, director_uuid, release_properties, cloud_properties)
manifest.jobs = job_manifests
create_file manifest_file_name, manifest.to_yaml, :force => flags[:force]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_deployment_manifest\n cloud_properties = {\n \"instance_type\" => \"m1.small\",\n }\n cloud_properties[\"persistent_disk\"] = flags[:disk] if flags[:disk]\n cloud_properties[\"static_ips\"] = ip_addresses\n director_uuid = Bosh::Gen::Models::BoshConfig.new.tar... | [
"0.82224447",
"0.6431784",
"0.64210236",
"0.63673073",
"0.6306414",
"0.6198516",
"0.60902333",
"0.60780704",
"0.60432297",
"0.60331005",
"0.6028615",
"0.6024294",
"0.5991769",
"0.5985003",
"0.59678775",
"0.5953389",
"0.5912079",
"0.59018546",
"0.58889157",
"0.5806116",
"0.578... | 0.82858497 | 0 |
Whether +name+ contains .yml suffix or nor, returns a .yml filename for manifest to be generated | def manifest_file_name
basename = name.gsub(/\.yml/, '') + ".yml"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def manifest_file_name\n basename = \"#{name}.yml\"\n end",
"def manifest_name(name, type)\n return name if File.extname(name.to_s).empty?\n\n File.basename(name, type)\n end",
"def manifest_name(name, pack_type)\n return name if File.extname(name.to_s).empty?\n File.basename... | [
"0.78180194",
"0.6748234",
"0.6631062",
"0.6631062",
"0.66275173",
"0.64387393",
"0.63893795",
"0.63122404",
"0.6267875",
"0.62355494",
"0.61685336",
"0.61416733",
"0.61275667",
"0.6125846",
"0.61069953",
"0.6059352",
"0.60551053",
"0.60381323",
"0.6034736",
"0.60092545",
"0.... | 0.802029 | 0 |
Return list of job names | def detect_jobs
release_detector.latest_dev_release_job_names
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def job_names\n @nodes.keys\n end",
"def jobs\n command('.jobs').split(\"\\n\")\n end",
"def names_list\n backend.queue_names\n end",
"def job_items\n job_arguments(1)\n end",
"def list_jobs(args)\n Morpheus::Cli::BackupJobsCommand.new.list(args)\n end",
"def job_grep name='.'\n re... | [
"0.76036364",
"0.7409595",
"0.7022217",
"0.6957284",
"0.6929985",
"0.67825466",
"0.659639",
"0.6587585",
"0.6562242",
"0.65453494",
"0.6497673",
"0.6486111",
"0.6485549",
"0.647718",
"0.6473285",
"0.64258707",
"0.6390483",
"0.6387652",
"0.63443875",
"0.6315985",
"0.62975943",... | 0.61682564 | 26 |
The "release" aspect of the manifest, which has two keys: name, version | def release_properties
release_detector.latest_dev_release_properties
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def release_manifest_name\n \"#{name}-release-manifest\"\n end",
"def release_name\n return nil unless @data['name'] && @data['version']\n [ dashed_name, @data['version'] ].join('-')\n end",
"def release_metadata\n @release_metadata ||= {\n package: {\n name: name,\n ... | [
"0.78892446",
"0.7040838",
"0.6902158",
"0.6544243",
"0.6469421",
"0.6433281",
"0.6424208",
"0.64108175",
"0.6274178",
"0.6260653",
"0.6237225",
"0.618807",
"0.6161508",
"0.6149678",
"0.6108881",
"0.60965866",
"0.6076818",
"0.60500747",
"0.6041651",
"0.5958193",
"0.59431094",... | 0.5736138 | 40 |
Use callbacks to share common setup or constraints between actions. | def set_standupdesk
@standupdesk = Standupdesk.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6165152",
"0.60463154",
"0.59467196",
"0.5917112",
"0.5890387",
"0.58345735",
"0.57773316",
"0.56991524",
"0.56991524",
"0.565454",
"0.5622282",
"0.54232633",
"0.54119074",
"0.54119074",
"0.54119074",
"0.53937256",
"0.53801376",
"0.5358599",
"0.53412294",
"0.5340814",
"0.5... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def standupdesk_params
params.require(:standupdesk).permit(:desklocation, :deskwant)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
I worked on this challenge with Ian Wudarski. I spent 2 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented. 0. Pseudocode What is the input? An Array of numbers of strings. What is the output? An array of the most frequent values. What are the steps needed to solve the problem? =begin Iterate through the array and count the instance of each object. create a new Hash add each object in the array as a key add one to the value of the key if it repeats Identify the largest value or values. Create an array from the values of the most occurring object or objects. Return said array. =end 1. Initial Solution | def mode (array)
newhash=Hash.new
array.each do |x|
newhash[x] = newhash[x].to_i + 1
end
modevalue = newhash.values.max
modearray= Array.new
newhash.each do |x, y|
if y == modevalue
modearray.push(x)
end
end
return modearray
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_most_frequent_integer(arr)\n #1. Create hash variable with default 0 value.\n hashld = Hash.new 0\n \n #2. Loop through each array element, count them, and insert the final key/value combo into the hashld hash.\n arr.each do |ele|\n \t hashld[ele] += 1\n end\n \n #3. H... | [
"0.7803973",
"0.7765087",
"0.7738651",
"0.76785",
"0.76529264",
"0.76350033",
"0.76212525",
"0.75524485",
"0.7514413",
"0.75000226",
"0.74984944",
"0.74865216",
"0.74851894",
"0.7462243",
"0.746068",
"0.7454032",
"0.74509585",
"0.7426969",
"0.7350484",
"0.733441",
"0.7324112"... | 0.0 | -1 |
Scrape information across all relevant records. | def scrape
(2..tot_rec).collect do |row|
aggregate_col_data(row)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_info\n\t\tpage = fetch\n\t\tscrape(page)\n\tend",
"def scrape()\n scrapeForCurrentData\n end",
"def scrape_details\n unscraped.each do |item|\n item.scrape_detail\n item.save!\n end\n end",
"def scrape\n end",
"def scrape_table(page)\n page.css('.listing_con... | [
"0.70556396",
"0.67155397",
"0.6482333",
"0.6392706",
"0.6258947",
"0.6258947",
"0.6199773",
"0.6165487",
"0.61499983",
"0.61499983",
"0.61499983",
"0.61499983",
"0.6079358",
"0.6079358",
"0.60717297",
"0.6057071",
"0.6057071",
"0.60419285",
"0.6037121",
"0.6027765",
"0.59982... | 0.6846094 | 1 |
Collect column information, formatting the first row. | def aggregate_col_data(row)
data_cols = (1..NUM_COL).reject{|i| REJECT.include?(i)}.compact
format_first_col(row)
.concat(
data_cols.collect do |col|
text = doc.css('div.games-fullcol').css('table').css('tr')[row].css('td')[col].text
col == 2 ? format_team_owner(text) : text
end).join(",")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_column\n @first_column ||= first_last_row_col[:first_column]\n end",
"def _prepare_format #:nodoc:\n fmstr = nil\n fmt = []\n each_column { |c, i|\n ## trying a zero for hidden columns\n ## worked but an extra space is added below and the sep\n w = c.wid... | [
"0.67120844",
"0.6414379",
"0.6374562",
"0.61509955",
"0.6100733",
"0.60851765",
"0.6078367",
"0.60381794",
"0.5964711",
"0.5912359",
"0.59041226",
"0.5895161",
"0.58906543",
"0.5875549",
"0.58743805",
"0.58648825",
"0.58225244",
"0.58215815",
"0.58215815",
"0.58215815",
"0.5... | 0.61947817 | 3 |
show the embed chart if the id was provided and can be decoded and parsed into hash id base64 encoded string of a hash of parameters | def embed
@missing = true
pars = embed_params
sid = pars[:id]
type = pars[:type]
is_static = type == "static"
gon.tp = pars[:c]
if sid.present?
shr = ShortUri.by_sid(sid, is_static ? :embed_static : :explore)
if shr.present? && shr.other.present? && (shr.other == 0 || shr.other == 1)
gon.is_donation = shr.other == 0
if (gon.is_donation ? ["a", "b"] : ["a"]).index(gon.tp).present?
gon.data = is_static ? shr.pars : ((gon.is_donation ? Donor : Dataset).explore(shr.pars, "co" + gon.tp, true))
@missing = false
end
end
end
respond_to do |format|
format.html { render :layout => 'embed' }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n url = params[:url]\n width = params[:maxwidth] || '100%'\n height = params[:maxheight] || '100%'\n format = request.query_parameters[:format]\n\n if (width =~ /^[0-9]+(%|px)?$/) == nil\n raise ActionController::RoutingError.new('Incorrect width')\n end\n if (height =~ /^[0-9]+(... | [
"0.5884109",
"0.58626586",
"0.58090925",
"0.572748",
"0.5635104",
"0.5616314",
"0.5520968",
"0.55078644",
"0.5434764",
"0.54001236",
"0.53902465",
"0.5390185",
"0.5378951",
"0.53740484",
"0.5338497",
"0.533755",
"0.53353953",
"0.5296625",
"0.52937067",
"0.5293194",
"0.5275872... | 0.6111621 | 0 |
WARNINGGGGGGGGGG Fira sans regular and book should be installed on server pc | def export_highchart(id, chart, data, is_donation, file_type = "png", return_url = true)
ok = true
image_stream = nil
file_type = "png" if ["png","jpeg","svg","pdf"].index(file_type).nil?
is_pdf = file_type == "pdf"
is_base64 = file_type != "svg"
image_name = "#{id}#{chart}.#{file_type}"
image_rel_dir = "/system/share_images/#{is_donation ? 'donation' : 'finance'}/#{I18n.locale}"
image_abs_dir = "#{Rails.root}/public#{image_rel_dir}"
image_rel_path = "#{image_rel_dir}/#{image_name}"
image_abs_path = "#{image_abs_dir}/#{image_name}"
uri = URI.parse("http://127.0.0.1:3003/")
headers = { 'Content-Type' => 'application/json' }
jsn = highchart_options_by_type(is_donation ? :bar : :column, file_type)
k = ("c#{chart}").to_sym
jsn["infile"].gsub!("_title_", data[k][:title])
if is_donation
jsn["infile"].gsub!("_bg_", chart == "a" ? "#EBE187" : "#B8E8AD")
jsn["infile"].gsub!("_subtitle_", data[k][:subtitle])
jsn["infile"].gsub!("_series_", data[k][:series].to_s)
jsn["infile"].gsub!("_width_", "1200")
jsn["infile"].gsub!("_height_", "628")
else
cats = data[k][:categories]
jsn["infile"].gsub!("_categories_", cats.to_json.to_s)
jsn["infile"].gsub!("_series_", data[k][:series].to_json.to_s)
rotated = cats[0].class == Hash && cats[0].dig(:categories).present? && cats[0].dig(:categories).length > 1
cat_max_len = 0
if rotated
cats[0].dig(:categories).each { |cat|
cat_max_len = cat.length if cat_max_len < cat.length
}
end
jsn["infile"].gsub!("_grouped_options_", !rotated ? "[]" : "[{ \"rotation\": 0 }, { \"rotation\": -90 }]")
jsn["infile"].gsub!("_rotation_", (!rotated ? "0" : "-90"))
jsn["infile"].gsub!("_width_", rotated && cats[0].dig(:categories).length > 6 ? "2400" : "1200")
jsn["infile"].gsub!("_height_", (628 + cat_max_len*9).to_s)
end
tmp_path = "#{Rails.root}/tmp/assets/#{image_name}"
jsn["outfile"] = tmp_path if is_pdf
# Rails.logger.fatal("fatal----------------------#{jsn}")
# jsn["width"] = 1200 if return_url
# FileUtils.mkdir_p(image_abs_dir) unless File.directory?(image_abs_dir)
http = Net::HTTP.new(uri.host, uri.port)
http.request_post(uri.path, jsn.to_json, headers) {|response|
if is_pdf
if File.file?(tmp_path)
image_stream = IO.read(tmp_path)
File.unlink(tmp_path)
end
else
image_stream = is_base64 ? Base64.urlsafe_decode64(response.body) : response.body
end
}
rescue => e
# Rails.logger.fatal("fatal----------------------#{e}")
ok = false
image_stream = nil
ensure
return { ok: ok, data: image_stream }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_book_availability_in_library\n\t\tputs \"To check availability of book,\"\n\t\tprint \" Enter Book Id :\"\n\t\ttarget_book_id=gets.to_i\n\t\tif is_book_exist_in_library?(target_book_id)\tthen\n\t\t\tif is_book_available_in_library?(target_book_id) then\n\t\t\t\tputs \"\\tBook is available\"\n\t\t\telse\n... | [
"0.5601701",
"0.54670036",
"0.5399369",
"0.5388134",
"0.5368289",
"0.5339636",
"0.53297746",
"0.52554375",
"0.52132463",
"0.5205334",
"0.5160486",
"0.5134441",
"0.5130876",
"0.5116449",
"0.511315",
"0.507904",
"0.5068172",
"0.5058622",
"0.5053462",
"0.50359917",
"0.5028619",
... | 0.0 | -1 |
def name Person.find(donor_id) end Permissions | def create_permitted?
acting_user.administrator?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def donor_username\n d = object.donor \n d.username\n end",
"def name\n person_name\n end",
"def donor\n user\n end",
"def get_permission_name(permission)\n case permission\n when Footprint32::PRIVATE\n return \"Private\"\n when Footprint32::FRIENDS\n return \"Friend... | [
"0.6904968",
"0.6593578",
"0.6542392",
"0.6394369",
"0.63738436",
"0.6243499",
"0.6239394",
"0.62022823",
"0.62022823",
"0.6181635",
"0.6130399",
"0.6120799",
"0.60875773",
"0.60605955",
"0.6059484",
"0.6024886",
"0.60199606",
"0.5956698",
"0.5941235",
"0.59390235",
"0.592898... | 0.0 | -1 |
projecteuler::problem4 A palindromic number reads teh same both ways. The largest palindrome made from teh product of two 2digit numbers is 9009 = 91 x 99. Find the largest palindrome made from the product of the 3digit numbers. | def is_palindrome?(x)
x.to_s == x.to_s.reverse ? true : false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def problem_4\n num1 = 999\n largest_pal = 0\n\n while num1 > 99\n num2 = num1 - 1\n while num2 > 99\n product = num1 * num2\n if is_palindrome?(product) && product > largest_pal\n largest_pal = product\n end\n num2 -= 1\n end\n num1 -= 1\n end\n\n return largest_pal\nen... | [
"0.842651",
"0.83863574",
"0.82265794",
"0.8226439",
"0.8223764",
"0.8211778",
"0.81758034",
"0.8162218",
"0.8140379",
"0.813723",
"0.80869967",
"0.8075961",
"0.8046546",
"0.7993986",
"0.79265016",
"0.7920063",
"0.78999317",
"0.78678054",
"0.78632396",
"0.78426534",
"0.779117... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_dbedt_upload
@dbedt_upload = DbedtUpload.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a trusted parameter "white list" through. | def dbedt_upload_params
params.require(:dbedt_upload).permit(:filename)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def expected_permitted_parameter_names; end",
"def param_whitelist\n [:role, :title]\n end",
"def default_param_whitelist\n [\"mode\"]\n end",
"def permitir_parametros\n \t\tparams.permit!\n \tend",
"def permitted_params\n []\n end",
... | [
"0.7121987",
"0.70541996",
"0.69483954",
"0.6902367",
"0.6733912",
"0.6717838",
"0.6687021",
"0.6676254",
"0.66612333",
"0.6555296",
"0.6527056",
"0.6456324",
"0.6450841",
"0.6450127",
"0.6447226",
"0.6434961",
"0.64121825",
"0.64121825",
"0.63913447",
"0.63804525",
"0.638045... | 0.0 | -1 |
Applies the mutation, :update points first then :re_apply points. Accepts an option, nil means apply all, :update means apply only update mutations points, :re_apply means apply on re_apply points, :force_update means apply all but turn re_apply points into update points. | def apply(option=nil)
updates, re_applies = @points.partition { |pt| pt.type == :update }
points = updates + re_applies
points.each { |pt| pt.apply(@dboard, option) }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @points = args[:points] if args.key?(:points)\n end",
"def points_update\n command = Goal::GoalPointsUpdateCommand.new(params)\n run(command)\n end",
"def update!(**args)\n @point_indices = args[:point_indices] if args.key?(:point_indices)\n @point... | [
"0.59140414",
"0.59044755",
"0.5802166",
"0.562154",
"0.5605067",
"0.5558084",
"0.5539476",
"0.5529141",
"0.5529141",
"0.5529141",
"0.5513493",
"0.54353195",
"0.54353195",
"0.5409568",
"0.5402883",
"0.53843534",
"0.5347074",
"0.53333074",
"0.53333074",
"0.53333074",
"0.533330... | 0.7238692 | 0 |
Look for mutation points in an expression and its children. | def walk(fexp, tree)
ftree = Ruote.compact_tree(@ps.current_tree(fexp))
if ftree[0] != tree[0] || ftree[1] != tree[1]
#
# if there is anything different between the current tree and the
# desired tree, let's force a re-apply
register(MutationPoint.new(fexp.fei, tree, :re_apply))
elsif ftree[2] == tree[2]
#
# else, if the tree children are the same, exit, there is nothing to do
return
else
register(MutationPoint.new(fexp.fei, tree, :update))
#
# NOTE: maybe a switch for this mutation not to be added would
# be necessary...
if fexp.is_concurrent?
#
# concurrent expressions follow a different heuristic
walk_concurrence(fexp, ftree, tree)
else
#
# all other expressions are considered sequence-like
walk_sequence(fexp, ftree, tree)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk_sequence(fexp, ftree, tree)\n\n i = fexp.child_ids.first\n\n ehead = ftree[2].take(i)\n ecurrent = ftree[2][i]\n etail = ftree[2].drop(i + 1)\n head = tree[2].take(i)\n current = tree[2][i]\n tail = tree[2].drop(i + 1)\n\n if ehead != head\n #\n # if t... | [
"0.5028328",
"0.49640143",
"0.48538098",
"0.47838336",
"0.46897966",
"0.4638811",
"0.45218676",
"0.44956675",
"0.4485954",
"0.44776696",
"0.44717583",
"0.44601083",
"0.44572666",
"0.44524154",
"0.44496927",
"0.44210798",
"0.4416428",
"0.4397993",
"0.43959162",
"0.43831673",
"... | 0.58861315 | 0 |
Look for mutation points in a concurrent expression (concurrence or concurrentiterator). | def walk_concurrence(fexp, ftree, tree)
if ftree[2].size != tree[2].size
#
# that's lazy, but why not?
#
# we could add/apply a new child...
register(MutationPoint.new(fexp.fei, tree, :re_apply))
else
#
# if there is a least one child that replied and whose
# tree must be changes, then re-apply the whole concurrence
#
# else try to re-apply only the necessary branch (walk them)
branches = ftree[2].zip(tree[2]).each_with_object([]) { |(ft, t), a|
#
# match child expressions (if not yet replied) with current tree (ft)
# and desired tree (t)
#
cfei = fexp.children[a.size]
cexp = cfei ? @ps.fexp(cfei) : nil
a << [ cexp, ft, t ]
#
}.select { |cexp, ft, t|
#
# only keep diverging branches
#
ft != t
}
branches.each do |cexp, ft, t|
next if cexp
# there is at least one branch that replied,
# this forces re-apply for the whole concurrence
register(MutationPoint.new(fexp.fei, tree, :re_apply))
return
end
branches.each do |cexp, ft, t|
#
# we're left with divering branches that haven't yet replied,
# let's walk to register the mutation point deep into it
walk(cexp, t)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def findIntersectedPositions(moves)\n moves.inject([[0,0,'N'], [[0,0]].to_set, []]) do |acc, m|\n p = moveToNextPosition acc[0], m\n puts \"p = \" + p.to_s\n newPosition = [p[0], p[1]]\n visitedPositions = acc[1]\n puts \"vp = \" + visitedPositions.size.to_s\n crossedPositions = acc[2]\n if (... | [
"0.4975293",
"0.4906038",
"0.47372845",
"0.4634953",
"0.45757815",
"0.45754692",
"0.4554886",
"0.4543445",
"0.45216128",
"0.45161575",
"0.45077872",
"0.44626227",
"0.44606608",
"0.43842688",
"0.43796545",
"0.43765974",
"0.4356536",
"0.43546215",
"0.4345447",
"0.43407696",
"0.... | 0.535477 | 0 |
Look for mutation points in any nonconcurrent expression. | def walk_sequence(fexp, ftree, tree)
i = fexp.child_ids.first
ehead = ftree[2].take(i)
ecurrent = ftree[2][i]
etail = ftree[2].drop(i + 1)
head = tree[2].take(i)
current = tree[2][i]
tail = tree[2].drop(i + 1)
if ehead != head
#
# if the name and/or attributes of the exp are supposed to change
# then we have to reapply it
#
register(MutationPoint.new(fexp.fei, tree, :re_apply))
return
end
if ecurrent != current
#
# if the child currently applied is supposed to change, let's walk
# it down
#
walk(@ps.fexp(fexp.children.first), current)
end
#if etail != tail
# #
# # if elements are added at the end of the sequence, let's register
# # a mutation that simply changes the tree (no need to re-apply)
# #
# register(MutationPoint.new(fexp.fei, tree, :update))
#end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_diffs\n mutations.select { |mutation| mutation.source.eql?(example.source) }\n end",
"def positions_not_to_check\n @positions_not_to_check ||= begin\n positions = []\n positions.concat(do_not_check_block_arg_pipes)\n positions.concat(do_not_check_p... | [
"0.5755983",
"0.53273314",
"0.50230354",
"0.49841377",
"0.4904098",
"0.48797786",
"0.4826175",
"0.47587332",
"0.47541755",
"0.471018",
"0.47002035",
"0.46677542",
"0.46179837",
"0.46113363",
"0.46088618",
"0.45980018",
"0.45906025",
"0.4566664",
"0.45606157",
"0.45577773",
"0... | 0.0 | -1 |
Metodo para calcular el determinante de una matriz | def det
if (@nFil == @mCol)
det = @matriz[0][0]
aux = Matriz.new(@matriz)
for k in 0...@nFil do
l = k+1
for i in l...@mCol do
for j in l...@mCol do
aux.matriz[i][j] = (aux.matriz[k][k] * aux.matriz[i][j] - aux.matriz[k][j] * aux.matriz[i][k])/ aux.matriz[k][k]
end
end
det = det * aux.matriz[k][k]
end
else
det = "ERROR, la matriz no es cuadrada"
end
det
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def det\n if (@nFil == @mCol)\n det = @matriz[0][0]\n aux = MatrizDensa.new(@matriz)\n for k in 0...@nFil do\n l = k+1\n for i in l...@mCol do\n for j in l...@mCol do\n aux.matriz[i][j] = (aux.matriz[k][k] * aux.matriz[i][j] - aux.matriz[k][j] * aux.matriz[i][k])/ aux.matriz[k... | [
"0.70764804",
"0.6891471",
"0.66725844",
"0.6642275",
"0.65906614",
"0.652938",
"0.64234287",
"0.6359657",
"0.62518805",
"0.6232034",
"0.6208302",
"0.6081332",
"0.6030435",
"0.59678113",
"0.5953506",
"0.5925404",
"0.5899323",
"0.58752614",
"0.5862235",
"0.58551264",
"0.584024... | 0.71308255 | 0 |
Metodo para multiplicar una matriz por un escalar | def x(escalar)
maux=Array.new(@nFil) { Array.new(@mCol) }
(@nFil).times do |i|
(@mCol).times do |j|
maux[i][j] = @matriz[i][j]
end
end
aux = Matriz.new(maux)
for i in 0...@nFil do
for j in 0...@mCol do
aux.matriz[i][j] = @matriz[i][j] * escalar
end
end
aux
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mult(a)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j]=@A[i][j]*a\n end\n end\n c\n end",
"def multiplicar(matrizc)\n\n \t\tmatRes = Array.new(matriz.size - 1,0)\n\n\t\tfor fil in 0...matriz[0].size\n\n\t\t\tmatRes[fil] = Array.new(mat... | [
"0.77362204",
"0.7654004",
"0.7490298",
"0.6893661",
"0.6885476",
"0.6879959",
"0.6867468",
"0.68557864",
"0.6813482",
"0.67841315",
"0.6760968",
"0.67546684",
"0.6738139",
"0.6718631",
"0.669704",
"0.66790015",
"0.66705775",
"0.66678435",
"0.6666401",
"0.66619354",
"0.665661... | 0.67623985 | 10 |
Metodo para sumar dos matrices | def +(mat)
if (mat.nFil == @nFil && mat.mCol == @mCol)
maux=Array.new(@nFil) { Array.new(@mCol) }
(@nFil).times do |i|
(@mCol).times do |j|
maux[i][j] = @matriz[i][j]
end
end
aux = Matriz.new(maux)
(@nFil).times do |i|
(@mCol).times do |j|
aux.matriz[i][j] = @matriz[i][j] + mat.matriz[i][j]
end
end
else
aux = 0
end
aux
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix_addition_reloaded(*matrices)\n height = matrices[0].size\n width = matrices[0][0].size\n return nil if matrices.select {|m| m.size == height && m[0].size == width}.count != matrices.count\n \n sum = Array.new(height) {|i| Array.new(width, 0)}\n\n (0...height).each do |h|\n (0...... | [
"0.761791",
"0.7463322",
"0.7446287",
"0.7377676",
"0.7311686",
"0.72755665",
"0.72681737",
"0.7220712",
"0.7137369",
"0.7127241",
"0.71159106",
"0.7095725",
"0.7092067",
"0.7090543",
"0.7035081",
"0.7025463",
"0.7017542",
"0.69905937",
"0.6963541",
"0.69531006",
"0.694126",
... | 0.7033361 | 15 |
Metodo para restar dos matrices | def -(mat)
if (mat.nFil == @nFil && mat.mCol == @mCol)
maux=Array.new(@nFil) { Array.new(@mCol) }
(@nFil).times do |i|
(@mCol).times do |j|
maux[i][j] = @matriz[i][j]
end
end
aux = Matriz.new(maux)
(@nFil).times do |i|
(@mCol).times do |j|
aux.matriz[i][j] = @matriz[i][j] - mat.matriz[i][j]
end
end
else
aux = 0
end
aux
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matrix\n end",
"def matrix_addition_reloaded(*matrices)\n\nend",
"def matrix_addition_reloaded(*matricies)\n addition = matricies[0]\n \n i = 1\n while i < matricies.length\n return nil if matricies[i].length != addition.length\n addition = matrix_addition(addition, matricies[i])... | [
"0.7420795",
"0.7144719",
"0.6859957",
"0.6842278",
"0.68326116",
"0.6832463",
"0.67523926",
"0.6697485",
"0.661081",
"0.6587723",
"0.6579307",
"0.65712035",
"0.6562897",
"0.65437424",
"0.6536058",
"0.64858484",
"0.6476088",
"0.6472412",
"0.6468496",
"0.6467361",
"0.64430696"... | 0.620445 | 31 |
Metodo para multiplicar dos matrices | def *(mat)
if (@mCol == mat.nFil)
result = Array.new
(@nFil).times do |i|
result[i] = Array.new
(mat.mCol).times do |j|
if(@matriz[i][j].class==Fraccion)
result[i][j] = Fraccion.new(0,1)
else
result[i][j] = 0
end
end
end
aux = Matriz.new(result)
(@nFil).times do |i|
(mat.mCol).times do |j|
(@mCol).times do |z|
aux.matriz[i][j] += @matriz[i][z] * mat.matriz[z][j]
end
end
end
else
aux = 0
end
aux
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mult(a)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j]=@A[i][j]*a\n end\n end\n c\n end",
"def multiply(first_matrix, second_matrix)\n x = first_matrix[0][0] * second_matrix[0][0] + first_matrix[0][1] * second_matrix[1][0]; \n y = f... | [
"0.75649035",
"0.72462416",
"0.712182",
"0.70948285",
"0.7021552",
"0.69874597",
"0.6981093",
"0.6975448",
"0.6954421",
"0.6935829",
"0.692853",
"0.6894844",
"0.6871286",
"0.68438876",
"0.68392235",
"0.68261766",
"0.6769494",
"0.67486763",
"0.6731185",
"0.6696882",
"0.6679784... | 0.0 | -1 |
Metodo para comparar la igualdad de dos matrices | def ==(mat)
if ((@mCol == mat.mCol)&&(@nFil == mat.nFil))
for i in 0...@nFil do
for j in 0...@mCol do
if ((@matriz[i][j] == mat.matriz[i][j])==false)
return false
end
end
end
else
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def igual (mat)\n end",
"def ==(other)\n return false unless Matrix === other\n \n other.compare_by_row_vectors(@rows)\n end",
"def == (other)\n iguales = true\n @filas.times do |i|\n @columnas.times do |j|\n if @elementos[i][j] != other.at(i,j)\n iguale... | [
"0.7530192",
"0.6959381",
"0.66813326",
"0.65107685",
"0.65058386",
"0.6410561",
"0.6385345",
"0.6385345",
"0.637278",
"0.6249778",
"0.6224424",
"0.61948305",
"0.6156411",
"0.6134711",
"0.60726744",
"0.6004553",
"0.58949095",
"0.5883778",
"0.5871188",
"0.5863032",
"0.58626246... | 0.68621004 | 2 |
Returns count of number of orders for a particular country | def number_of_orders
sql = "SELECT COUNT(*) as count "
sql << "FROM orders "
sql << "INNER JOIN order_addresses ON ( "
sql << " order_addresses.country_id = #{self.id} AND order_addresses.id = orders.shipping_address_id "
sql << ");"
Order.count_by_sql(sql)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def country_counts(opts={ })\n unless (leftovers = opts.keys - VALID_COUNT_OPTIONS).empty?\n raise \"Invalid keys: #{leftovers.join(', ')}\"\n end\n\n params = []\n clauses = []\n sql = \"SELECT country, SUM(install_count), SUM(update_count) FROM reports\"\n\n if opts[:from]\n ... | [
"0.6673672",
"0.63683826",
"0.6357323",
"0.62660813",
"0.623631",
"0.62268215",
"0.61948514",
"0.6163525",
"0.6102441",
"0.6043712",
"0.60426515",
"0.5981951",
"0.59667706",
"0.5949211",
"0.59348804",
"0.58183247",
"0.5808176",
"0.57969666",
"0.5784962",
"0.57681626",
"0.5743... | 0.7642466 | 0 |
Should find a hero to fight against threat. Append that one in the batles | def release(threat)
hero = Hero.find_to_batle(threat.rank)
if hero
# TODO add more one hero
batle = Batle.create(threat: threat, heroes: [hero])
@batles.append(batle)
else
# run release again in a thread mode
Thread.new do
Rails.application.executor.wrap do
# waits 10 seconds
sleep(30)
release(threat)
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def hero_add (fwt, owner_id, hero_id, rating_id)\n\n\town_hero = false\n\t\tfwt.execute(\"SELECT heros_id FROM acquisitions WHERE owners_id=?\",[owner_id]).each do |value|\n\t\t\tif value[0] == hero_id\n\t\t\t\tputs \"\\n\\nYou already own this hero!\"\n\t\t\t\town_hero = true\n\t\t\tend\n\t\tend\n\n\tif own_hero ... | [
"0.6619536",
"0.6416011",
"0.63749695",
"0.6328689",
"0.6266054",
"0.6224077",
"0.6188326",
"0.6150375",
"0.60659486",
"0.60075927",
"0.60075927",
"0.5991556",
"0.5973991",
"0.5973471",
"0.596981",
"0.5956465",
"0.5943797",
"0.5943622",
"0.5940115",
"0.59194857",
"0.59087265"... | 0.0 | -1 |
def auto_complete_for_ttx_group_title end GET /items GET /items.xml | def index
unless params[:type]
@page = Page.find_by_permalink("production", :order => "position ASC")
#@page_ids = []
else
@page = Page.find_by_permalink("accessories", :order => "position ASC")
#@items = Item.find_by_page_id(params[:page_id])
end
#respond_to do |wants|
# wants.html # index.html.erb
# # wants.xml { render :xml => @items }
# end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_complete_for_journal_title\n # Don't search on blank query.\n query = params['rft.jtitle']\n search_type = params[\"umlaut.title_search_type\"] || \"contains\"\n unless ( query.blank? )\n (context_objects, total_count) = find_by_title\n @titles = context_objects.collect do |co|\n ... | [
"0.6163128",
"0.59985924",
"0.5966603",
"0.5940773",
"0.5939429",
"0.5900986",
"0.57387614",
"0.57221216",
"0.5693845",
"0.5664657",
"0.56337833",
"0.5633362",
"0.5631914",
"0.5605618",
"0.56022465",
"0.55933535",
"0.55933535",
"0.55933535",
"0.55521554",
"0.5495915",
"0.5476... | 0.0 | -1 |
GET /items/1 GET /items/1.xml | def show
respond_to do |wants|
wants.html # show.html.erb
wants.xml { render :xml => @item }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @request = Request.find(params[:id])\n @items = @request.items\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @request }\n end\n end",
"def show\n @item = Item.find(params[:id])\n\n respond_to do |format|\n format.html # show.h... | [
"0.678745",
"0.67821956",
"0.67821956",
"0.67821956",
"0.67821956",
"0.67821956",
"0.67821956",
"0.6725394",
"0.6717308",
"0.66033036",
"0.6591751",
"0.65765375",
"0.65546113",
"0.64771855",
"0.64768195",
"0.6447563",
"0.6427009",
"0.63991284",
"0.6367221",
"0.63387835",
"0.6... | 0.6151696 | 37 |
GET /items/new GET /items/new.xml | def new
@item = Item.create(:published => false, :page_id => params[:page_id])
#@item.page = Page.find(params[:page_id]) if params[:page_id]
#@item.page.ttxes.count.times do @item.item_ttxes.build end
#3.times do
@item.gallery_photos.build
#5.times do
@item.colour_photos.build(:color => "ffffff")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @item = Item.factory('local')\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item }\n end\n end",
"def new\n @item = Item.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item... | [
"0.7750405",
"0.7721567",
"0.7721567",
"0.7721567",
"0.7721567",
"0.7721567",
"0.7721567",
"0.7721567",
"0.7721567",
"0.7674057",
"0.7650397",
"0.7624482",
"0.7310945",
"0.7224427",
"0.7214633",
"0.71571666",
"0.7152413",
"0.71524066",
"0.71524066",
"0.71524066",
"0.71524066"... | 0.0 | -1 |
POST /items POST /items.xml | def create
@item = Item.new(params[:item])
respond_to do |wants|
if @item.save
flash[:notice] = 'Item was successfully created.'
wants.html { redirect_to(admin_items_url) }
wants.xml { render :xml => @item, :status => :created, :location => @item }
else
wants.html { render :action => "new" }
wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n @item = Item.new(params[:item])\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to(items_path) }\n format.xml { render :xml => @item, :status => :created... | [
"0.6878987",
"0.68121386",
"0.6461912",
"0.6385658",
"0.63709396",
"0.63393664",
"0.63393664",
"0.6333269",
"0.6326739",
"0.6326739",
"0.6207085",
"0.617964",
"0.61328024",
"0.6087989",
"0.60817254",
"0.60677546",
"0.60674924",
"0.6064618",
"0.6062312",
"0.6056173",
"0.604606... | 0.62712324 | 10 |
PUT /items/1 PUT /items/1.xml | def update
respond_to do |wants|
if @item.update_attributes(params[:item])
flash[:notice] = 'Item was successfully updated.'
wants.html { redirect_to(admin_items_path) }
wants.xml { head :ok }
else
wants.html { render :action => "edit" }
wants.xml { render :xml => @item.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end",
"def update\n @item = Item.find(params[:id])\n\n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to(@item)}\n f... | [
"0.6631222",
"0.6629836",
"0.66213",
"0.6536519",
"0.6495193",
"0.6495193",
"0.6495193",
"0.6462979",
"0.6444372",
"0.6438877",
"0.6438877",
"0.64248157",
"0.63908964",
"0.6354812",
"0.63242704",
"0.63229805",
"0.6300457",
"0.62652194",
"0.62466425",
"0.6228893",
"0.62224233"... | 0.62116754 | 22 |
DELETE /items/1 DELETE /items/1.xml | def destroy
@item.destroy
respond_to do |wants|
wants.html { redirect_to(admin_items_url) }
wants.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { redirect_to(items_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @item = Item.find(params[:id])\n @item.destroy\n\n respond_to do |format|\n format.html { r... | [
"0.70774895",
"0.70774895",
"0.70774895",
"0.70774895",
"0.70774895",
"0.70774895",
"0.70688236",
"0.70301396",
"0.689336",
"0.68701774",
"0.683731",
"0.68249005",
"0.6819569",
"0.68018186",
"0.67970824",
"0.6779381",
"0.6778662",
"0.6771514",
"0.6748655",
"0.67484534",
"0.67... | 0.6738314 | 20 |
If you want to add new category, please make new method | def check_config
data = merge_yaml_data(@@config_dir)
@rule_data = merge_yaml_data(@@rule_config_dir)
actual = make_key_chain(data)
expect = make_key_chain(@rule_data)
diff = diff_arr(expect, actual)
make_message(diff)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_category\n end",
"def uhook_create_category\n category = ::Category.new(params[:category])\n category.locale = current_locale\n category\n end",
"def add_category params\n cat = validate_and_store :category, params\n cat ? category_key(cat) : nil\n en... | [
"0.8053537",
"0.77390367",
"0.7692365",
"0.75559205",
"0.7553034",
"0.7442568",
"0.7413503",
"0.7392762",
"0.7377145",
"0.732621",
"0.7304141",
"0.72734666",
"0.7242457",
"0.7212821",
"0.7212821",
"0.7208786",
"0.71838903",
"0.7177043",
"0.7136694",
"0.7134516",
"0.7131486",
... | 0.0 | -1 |
Merge yaml in target directory. | def merge_yaml_data(dir)
data_output = {}
file_sort_hierarchy(dir).each do |file|
data = load_yaml(file)
data_output.merge!(data) unless data.empty?
end
data_output.any? ? data_output : (raise StandardError, "No key! please check the directory existence [#{dir}]")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_config\n if File.directory?(yolo_dir) and File.exist?(yaml_path)\n @yaml = YAML::load_file yaml_path\n update_yaml_setting(@yaml, \"deployment\", \"api_token\", \"example\")\n update_yaml_setting(@yaml, \"deployment\", \"team_token\", \"example\")\n end\n en... | [
"0.6416915",
"0.6357454",
"0.6100214",
"0.5926936",
"0.57638",
"0.5687588",
"0.5603746",
"0.5502539",
"0.54596484",
"0.54596484",
"0.5407498",
"0.5375737",
"0.5253319",
"0.5253319",
"0.5253319",
"0.5246575",
"0.52388936",
"0.52383316",
"0.5229091",
"0.52086496",
"0.5208271",
... | 0.6406922 | 1 |
You have a panoramic view in front of you, but you only can take a picture of two landmarks at a time (your camera is small). You want to capture every pair of landmarks that are next to each other. Define a method that, given an array of landmarks, returns an array of every adjacent pair from left to right. Assume the panorama wraps around. | def panoramics(landmarks)
result = []
landmarks.each_with_index do |landmark, idx|
next_landmark = landmarks[idx + 1] || landmarks[0]
result << [landmark, next_landmark]
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def panoramic_pairs(landmarks)\n n = landmarks.length - 1\n pairs = []\n\n (0...n).each do |i|\n pairs << [landmarks[i], landmarks[i + 1]]\n end\n\n pairs << [landmarks[-1], landmarks[0]]\n pairs\nend",
"def panoramic_pairs(landmarks)\n #make a new array for pairs of landmarks\n #starting with first l... | [
"0.7715019",
"0.76393974",
"0.76331586",
"0.52761304",
"0.5212838",
"0.5177703",
"0.51370716",
"0.50811213",
"0.49836102",
"0.49793318",
"0.49764058",
"0.49764058",
"0.49691415",
"0.49393016",
"0.49117616",
"0.49117616",
"0.48952052",
"0.48743293",
"0.48636356",
"0.4853828",
... | 0.8125142 | 0 |
Set the bterm to half width | def unfullscreen_height
return unless @window
@window.decorated = true
@window.set_resizable(true)
# Resize the width of the window
width = @window.screen.width
height = @window.screen.height
# We need to change the minimum size of the window
min_width = width / 4
min_height = height / 4
@window.set_size_request(min_width, min_height)
#puts "height: #{width} / #{height}"
@window.unfullscreen
# then we can resize to a smaller size
new_height = height / 2
@window.move(0, 0)
@window.resize(width, new_height)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fw; self.fixed_width = true; self; end",
"def set_character_width_narrow\n set_print_mode 1\n set_linefeed_rate 40\n end",
"def width=(_); end",
"def width=(_); end",
"def my_width \n 0.75\n end",
"def width(val); @width = val; self; end",
"def setlinewidth(*)\n super\n end... | [
"0.61330074",
"0.6052642",
"0.6025214",
"0.6025214",
"0.59762245",
"0.59625757",
"0.5883933",
"0.58233356",
"0.58233356",
"0.58118",
"0.5809252",
"0.580705",
"0.5781642",
"0.57262594",
"0.5705119",
"0.56784034",
"0.5667397",
"0.566446",
"0.566446",
"0.566446",
"0.566446",
"... | 0.0 | -1 |
Set the bterm to half height | def unfullscreen_width
return unless @window
@window.decorated = true
@window.set_resizable(true)
# Resize the width of the window
width = @window.screen.width
height = @window.screen.height
# We need to change the minimum size of the window
min_width = width / 4
min_height = height / 4
@window.set_size_request(min_width, min_height)
#puts "width : #{width} / #{height}"
@window.unfullscreen
# then we can resize to a smaller size
new_width = width / 2
@window.move(0, 0)
@window.resize( new_width , height)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def base_height; 24; end",
"def base_height; 24; end",
"def adjust_height\n self.height = fitting_height(1 + @max_lines)\n end",
"def terminal_height; end",
"def terminal_height; end",
"def setcharheight(*)\n super\n end",
"def initialize\n\t\t@height = 5\n\tend",
"def height=(height) @si... | [
"0.6235749",
"0.6235749",
"0.6040844",
"0.6012444",
"0.6012444",
"0.5987575",
"0.59422666",
"0.59336895",
"0.5923101",
"0.58007324",
"0.57415164",
"0.5737822",
"0.5711745",
"0.5711745",
"0.56730956",
"0.56730956",
"0.56730956",
"0.5638921",
"0.56002283",
"0.5599227",
"0.55992... | 0.0 | -1 |
Restore fullwidth for bterm | def fullscreen
return unless @window
# Restore the original dimensions and fullscreen
@window.set_default_size(-1, -1)
@window.move(0,0)
@window.fullscreen
@window.decorated = false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_character_width_normal\n set_print_mode 0\n set_linefeed_rate 55\n end",
"def set_character_width_normal\r\n set_print_mode 0\r\n set_linefeed_rate 55\r\n end",
"def set_character_width_narrow\n set_print_mode 1\n set_linefeed_rate 40\n end",
"def fw; self.fixed_width = true; s... | [
"0.6385343",
"0.63474363",
"0.62461656",
"0.59402126",
"0.5895237",
"0.5821676",
"0.5791077",
"0.5791077",
"0.5711419",
"0.56973046",
"0.5614492",
"0.5605553",
"0.5602575",
"0.5565293",
"0.5446268",
"0.5434023",
"0.5422502",
"0.5422502",
"0.5396127",
"0.5389353",
"0.5366721",... | 0.5193306 | 31 |
choose random private stream and make sure not to choose two times the same for the same user | def create_private_stream user
type = ""
if @rand.uniform > @probabilities[:facebook_twitter_stream_probabillity].to_f
type = "User::Authentication::Twitter"
else
type = "User::Authentication::Facebook"
end
if user.authentications.first && user.authentications.first._type == "User::Authentication::Twitter"
type = "User::Authentication::Facebook"
end
if user.authentications.first && user.authentications.first._type == "User::Authentication::Facebook"
type = "User::Authentication::Twitter"
end
authentications = user.authentications.to_a
if type == "User::Authentication::Facebook"
access_token = "access_token_facebook_#{@uuid}"
authentications << User::Authentication::Facebook.new({
"uid" => @uuid,
"access_token" => access_token,
"fetch" => true,
"expires_at" => Time.now+ 4.weeks,
"last_fetched_at" => 4.weeks.ago
})
BenchmarkStreamServer::Cache.instance.add_stream :url => "#{STREAM_SERVER}/facebook/#{access_token}", :length => 100, :id => access_token, :type => :facebook
else
access_token = "access_token_twitter_#{@uuid}"
authentications << User::Authentication::Twitter.new({
"uid" => @uuid,
"access_token" => access_token,
"fetch" => true,
"expires_at" => Time.now+ 4.weeks,
"last_fetched_at" => 4.weeks.ago,
"access_secret" => "abcedefewfwe"
})
BenchmarkStreamServer::Cache.instance.add_stream :url => "#{STREAM_SERVER}/twitter/#{access_token}", :length => 200, :id => access_token, :type => :twitter
end
user.authentications = authentications
@stream_counter += 1
@uuid += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pick_random(stream)\n stream.chars.uniq.sample\nend",
"def randomStream\n Stream::ImplicitStream.new { |s|\n\t s.set_to_begin_proc = proc {srand 1234}\n\t s.at_end_proc = proc {false}\n\t s.forward_proc = proc {rand}\n\t}\nend",
"def get_random_user\n $user_keys.sample()\nend",
"def gen_uniq_rand(l... | [
"0.68680674",
"0.6742204",
"0.6254884",
"0.6064002",
"0.58591825",
"0.58431154",
"0.58306",
"0.58177215",
"0.5814763",
"0.5789193",
"0.57784504",
"0.57784504",
"0.5738883",
"0.5667197",
"0.5629166",
"0.5629166",
"0.5629166",
"0.5629166",
"0.5586183",
"0.558515",
"0.5581464",
... | 0.6067243 | 3 |
logs the last played code and hits | def new_hits(code, hits)
@log << {code: code, hits: hits}
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_log\n puts \"Nr | Codes #{\"-\" * (@code_length * 4 - 9)} | white hit | black hit |\"\n count = @max_rounds\n @max_rounds.times do\n count -= 1\n if count >= @log.length\n puts \"#{sprintf('%02d', count + 1)} |#{\" |\" * (@code_length)} | |\"\n else\n ... | [
"0.6126116",
"0.61000323",
"0.6067652",
"0.58857936",
"0.5847424",
"0.5847424",
"0.58336335",
"0.5765687",
"0.57568127",
"0.5699881",
"0.56858563",
"0.5628003",
"0.5612835",
"0.5602555",
"0.5580907",
"0.55758446",
"0.5527876",
"0.5520096",
"0.5518483",
"0.5477998",
"0.5449921... | 0.62700665 | 0 |
prints the game in the console | def print_log
puts "Nr | Codes #{"-" * (@code_length * 4 - 9)} | white hit | black hit |"
count = @max_rounds
@max_rounds.times do
count -= 1
if count >= @log.length
puts "#{sprintf('%02d', count + 1)} |#{" |" * (@code_length)} | |"
else
row = @log[count]
code = row[:code].join(' | ')
puts sprintf('%02d | %s | %d | %d |', count + 1, code, row[:hits][:white], row[:hits][:black])
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_games\n puts Rainbow(\"------------------------------\").red\n puts MyCliProject::Game.all.last.description\n puts Rainbow(\"------------------------------\").red\n continue_or_exit\n end",
"def print_out_start_of_game\n\n puts \"Welcome to a new version of the 2 Player ... | [
"0.7869802",
"0.74473923",
"0.73977685",
"0.73401177",
"0.72766817",
"0.72702223",
"0.72324866",
"0.71924686",
"0.71866906",
"0.71852225",
"0.71230876",
"0.71095747",
"0.7100547",
"0.7095642",
"0.70690566",
"0.7032311",
"0.7030552",
"0.7025613",
"0.7000439",
"0.696729",
"0.69... | 0.0 | -1 |
Retrieves a code from either the Codemaker or the code Codebreaker | def new_code(person)
code = []
loop do
code = person.input_code
inval_code = @code_maker.invalid_code_msg(code)
break if inval_code.nil?
puts inval_code
end
code
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @code ||= @codes.first\n end",
"def getCode()\n return @code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code\n @code\n end",
"def code()\n return @code.clone()... | [
"0.73643976",
"0.73643976",
"0.73378664",
"0.7306806",
"0.72132003",
"0.72132003",
"0.7126507",
"0.68411267",
"0.68225634",
"0.682148",
"0.6765226",
"0.67139196",
"0.6702224",
"0.66820264",
"0.66804284",
"0.66804284",
"0.66782457",
"0.66406953",
"0.6638965",
"0.66127247",
"0.... | 0.0 | -1 |
Handles parsing RFC3339 time string | def parse_time_string(time_string)
time_string ? Time.parse(time_string) : nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def timeparse time\n tt ||= Time.rfc2822(time) rescue nil\n tt ||= Time.iso8601(time) rescue nil\n tt ||= Time.strptime(time, \"%Y-%m-%d %T %z\") rescue nil\n\n if !tt\n if $base_time\n begin\n # base_time has been set so try parsing a relative time\n # todo: I should be a lot stricter ab... | [
"0.7585522",
"0.7453506",
"0.7416698",
"0.72167873",
"0.71446925",
"0.71446925",
"0.7139991",
"0.7139991",
"0.7139991",
"0.70803285",
"0.70590293",
"0.70383817",
"0.7013638",
"0.6932127",
"0.6925738",
"0.68583983",
"0.6848777",
"0.6839743",
"0.68381286",
"0.6821729",
"0.68057... | 0.6984776 | 29 |
User validation web service for edit and signup forms | def validate
only_provides :json
@event = Event.new(params[event])
@event.user = current_user
@event.title = nil if @event.title.blank?
@event.finish = nil if @event.finish.blank?
# ignore timeline_event since its fields are optional now
display @event.valid? || @event.errors_as_params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appctrl_ensure_user_is_valid\n edit_user = if @current_user.try( :invalid? )\n view_context.apphelp_flash( :error, :provide_account_details, ApplicationController )\n true\n elsif @current_user.try( :must_reset_password? )\n view_context.apphelp_flash( :warning, :must_reset_password, Appli... | [
"0.6514632",
"0.65083987",
"0.647919",
"0.6377082",
"0.6363155",
"0.6363155",
"0.63613397",
"0.6358674",
"0.6352912",
"0.62247676",
"0.62046915",
"0.6192589",
"0.61915326",
"0.6172483",
"0.61429745",
"0.61429745",
"0.61429745",
"0.61429745",
"0.61373276",
"0.6115037",
"0.6110... | 0.0 | -1 |
create a new timeline event association, with options to create the event and first source comment from scratch N.B. handles both create and update calls TODO. should be checking if save succeeds | def create
@timeline_event = TimelineEvent.find(timeline_event[:id]) || TimelineEvent.new(params[:timeline_event])
@event = Event.find(timeline_event[:event_id])
if @event.nil?
# create event
@event = Event.new(params[:event])
@event.user = current_user
@event.title = nil if @event.title.blank? # fix optional fields
@event.finish = nil if @event.finish.blank?
@event.save || raise("Could not save event #{@event}")
# # create source comment (if exists)... should have more explicit
# if event_comment && !event_comment[:text].empty?
# @event_comment = EventComment.new(event_comment)
# @event_comment.event = @event
# @event_comment.user = current_user
# @event_comment.user_ip = request.remote_ip
# @event_comment.save # validation required
# end
end
# tie timeline entry to event
@timeline_event.id = nil if @timeline_event.id.blank?
@timeline_event.event = @event
@timeline_event.interpretation = timeline_event[:interpretation]
@timeline_event.save || raise("Could not save #{@timeline_event}: #{@timeline_event.errors.join(', ')}")
@timeline = @timeline_event.timeline
redirect_to resource(@timeline.user, @timeline, :cue => @event.id), :message => { :notice => 'Updated your event entry' }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n respond_to do |format|\n build_event\n if save_event_and_timeline\n format.html { redirect_to_event_or_timeline }\n format.json { render action: 'show', status: :created, location: @event }\n else\n format.html { render action: 'new' }\n format.json { rend... | [
"0.6376828",
"0.6338077",
"0.6225694",
"0.61485136",
"0.61115104",
"0.6054261",
"0.6051299",
"0.6044304",
"0.5968706",
"0.59630054",
"0.59408003",
"0.59196395",
"0.5893929",
"0.5892642",
"0.5828306",
"0.58242583",
"0.58183265",
"0.5799335",
"0.5798154",
"0.57953775",
"0.57781... | 0.77653253 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_shift
@shift = Shift.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def shift_params
params.require(:shift).permit(:assignment_id, :date, :status, :start_time, :end_time, :notes, job_ids: [])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
GET /user GET /user.json | def index
params[:id] = session_user_id
show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end",
"def get \n render :json => User.find(params[:id])\n end",
"def show\n user = User.find(params[:id])\n ... | [
"0.7747033",
"0.77319795",
"0.7724842",
"0.7716754",
"0.7713406",
"0.7693864",
"0.76856244",
"0.76856244",
"0.76856244",
"0.76856244",
"0.76856244",
"0.76856244",
"0.76856244",
"0.76796955",
"0.76796955",
"0.76796955",
"0.76796955",
"0.76796955",
"0.76796955",
"0.76796955",
"... | 0.0 | -1 |
GET /user/1 GET /user/1.json | def show
if check_user_read_access
respond_to do |format|
format.html { render :show }
format.json { render json: user || {} }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ... | [
"0.7686378",
"0.76058596",
"0.75289893",
"0.7445196",
"0.73769677",
"0.7370753",
"0.73654354",
"0.7356639",
"0.7352479",
"0.7345809",
"0.73406947",
"0.7334447",
"0.7290761",
"0.72809815",
"0.72809815",
"0.72809815",
"0.72809815",
"0.72809815",
"0.72809815",
"0.72809815",
"0.7... | 0.0 | -1 |
PUT /user/1 PUT /user/1.json | def update
if check_user_write_access
respond_to do |format|
if user.update_attributes(params[:user])
format.html { redirect_to user, notice: 'User was successfully updated.' }
format.json { head :no_content }
else
format.html { render :edit }
format.json { render json: user.errors, status: :unprocessable_entity }
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put user_id, options={}, headers={}\n @connection.put \"users/#{user_id}.json\", options, headers\n end",
"def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end",
"def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end",... | [
"0.73455113",
"0.73446214",
"0.73364615",
"0.7214033",
"0.7098887",
"0.7086871",
"0.70202243",
"0.698461",
"0.6980588",
"0.696262",
"0.69532824",
"0.69461435",
"0.69405437",
"0.68969226",
"0.68201804",
"0.68201494",
"0.67679197",
"0.6765442",
"0.67514455",
"0.6744225",
"0.671... | 0.0 | -1 |
DELETE /user/1 DELETE /user/1.json | def destroy
if check_user_write_access
user.destroy
respond_to do |format|
format.html { redirect_to :root }
format.json { head :no_content }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end",
"def delete\n render json: User.delete(params[\"id\"])\n end",
"def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end",
"def delete\n @user.destroy\n respond_to do |form... | [
"0.7690093",
"0.7593447",
"0.73640305",
"0.7345832",
"0.7345277",
"0.73258495",
"0.73258495",
"0.7278566",
"0.72723216",
"0.726289",
"0.7262046",
"0.7252789",
"0.7229248",
"0.72095776",
"0.71988076",
"0.7183531",
"0.7183378",
"0.71713036",
"0.7166104",
"0.71507317",
"0.713673... | 0.0 | -1 |
Used in the Precinct show | def precinctsShowLink
"#{firstname} #{lastname}, #{office.name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_first_unique()\n \n end",
"def show\n # TODO put computation here for displaying alternate values?\n end",
"def displayed?; end",
"def show \r\n end",
"def tool_tip\n\t\treturn \"Delimited list of custodian and path of each duplicate of a given item.\"\n\tend",
"def show\n... | [
"0.65407723",
"0.62932587",
"0.6099658",
"0.59757185",
"0.5920199",
"0.57752395",
"0.5759011",
"0.569821",
"0.5683073",
"0.5683073",
"0.5683073",
"0.5683073",
"0.56808054",
"0.5669916",
"0.5622271",
"0.56201625",
"0.5600334",
"0.5600334",
"0.5600334",
"0.5585531",
"0.55808395... | 0.5435073 | 40 |
Call a JavaScript function: proxy.myFunction('arg1').call | def call(method = nil, &block)
if @crumbs.empty?
raise "No method provided"
end
string = to_s
string << "()" unless string.last == ")"
Bowline::Desktop::JS.eval(
@window,
"Bowline.invokeJS(#{string.inspect});",
method,
&block
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_as_function(ctx,object,thisObject,argumentCount,arguments,exception)\n JS::Lib.JSObjectCallAsFunction(ctx,object,thisObject,argumentCount,arguments,exception)\n end",
"def js_call(obj, *args)\n js_apply(obj,args)\n end",
"def call(context, scope, this, args)\n args = args.to_a #... | [
"0.65428954",
"0.6345606",
"0.62751395",
"0.6176062",
"0.61174107",
"0.60070527",
"0.59175843",
"0.59175843",
"0.59175843",
"0.5837486",
"0.5837486",
"0.5722605",
"0.55574095",
"0.5532517",
"0.5524574",
"0.5524103",
"0.55171025",
"0.5511863",
"0.5510786",
"0.5503727",
"0.5467... | 0.51191896 | 48 |
Return the JavaScript that is to be evaluated | def to_s
(@crumbs || []).inject([]) do |arr, (method, args)|
str = method
if args.any?
str << "(" + args.to_json[1..-2] + ")"
end
arr << str
end.join(".")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def j(javascript); end",
"def javascript\n if @js_output_file\n file_js = File.read(@js_output_file) rescue ''\n ([file_js] + @javascript).join nil\n else\n @javascript.join nil\n end\n end",
"def eval(js_code)\n full_cmd = @cmd % [escape_js(js_code)]\n ... | [
"0.7037622",
"0.67272514",
"0.669885",
"0.6546468",
"0.64927936",
"0.64354724",
"0.64269394",
"0.6333323",
"0.62840813",
"0.62794304",
"0.62790096",
"0.6270115",
"0.6235626",
"0.622848",
"0.6186857",
"0.6173779",
"0.61698043",
"0.6156506",
"0.6121771",
"0.61055005",
"0.606230... | 0.0 | -1 |
GET /cattle_ids/1 GET /cattle_ids/1.xml | def show
@cattle_id = CattleId.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @cattle_id }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end",
"def show\n @clenum = Clenum.find(params[:ids])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @clenum }\n ... | [
"0.6187639",
"0.603138",
"0.5885424",
"0.5859145",
"0.5821323",
"0.56640404",
"0.55595297",
"0.5527944",
"0.55165344",
"0.54872257",
"0.5451889",
"0.5448276",
"0.5448276",
"0.5446519",
"0.5443534",
"0.53496903",
"0.53216296",
"0.52771664",
"0.5257281",
"0.52514046",
"0.523334... | 0.70049953 | 0 |
GET /cattle_ids/new GET /cattle_ids/new.xml | def new
@cattle_id = CattleId.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @cattle_id }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @cattle_id = CattleId.new(params[:cattle_id])\n\n respond_to do |format|\n if @cattle_id.save\n format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully created.') }\n format.xml { render :xml => @cattle_id, :status => :created, :location => @cattle_id }\n ... | [
"0.69000083",
"0.6189207",
"0.61854494",
"0.61854494",
"0.6083155",
"0.6023298",
"0.5991507",
"0.5971991",
"0.593537",
"0.59060246",
"0.5893964",
"0.5855239",
"0.5799521",
"0.5794669",
"0.57671845",
"0.5765086",
"0.57640314",
"0.57567173",
"0.57349324",
"0.5724168",
"0.570094... | 0.7421669 | 0 |
POST /cattle_ids POST /cattle_ids.xml | def create
@cattle_id = CattleId.new(params[:cattle_id])
respond_to do |format|
if @cattle_id.save
format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully created.') }
format.xml { render :xml => @cattle_id, :status => :created, :location => @cattle_id }
else
format.html { render :action => "new" }
format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end",
"def identifiers\n request[:ids]\n end",
"def create\n #@incident = @quote.incidents.new(inc... | [
"0.5561473",
"0.53918487",
"0.52918005",
"0.516522",
"0.5145279",
"0.5108013",
"0.5066391",
"0.50253975",
"0.5004684",
"0.49882695",
"0.49149573",
"0.48990613",
"0.48935995",
"0.48564246",
"0.48366874",
"0.48346892",
"0.48316315",
"0.48136714",
"0.47802246",
"0.47463432",
"0.... | 0.6074255 | 0 |
PUT /cattle_ids/1 PUT /cattle_ids/1.xml | def update
@cattle_id = CattleId.find(params[:id])
respond_to do |format|
if @cattle_id.update_attributes(params[:cattle_id])
format.html { redirect_to(@cattle_id, :notice => 'Cattle was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @cattle_id.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @cattle_id = CattleId.find(params[:id])\n @cattle_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(cattle_ids_url) }\n format.xml { head :ok }\n end\n end",
"def create\n @cattle_id = CattleId.new(params[:cattle_id])\n\n respond_to do |format|\n i... | [
"0.5976889",
"0.58678615",
"0.58644557",
"0.571639",
"0.55510354",
"0.5513215",
"0.538994",
"0.5369293",
"0.5346908",
"0.5341737",
"0.5271538",
"0.52299356",
"0.5194838",
"0.5134592",
"0.5110783",
"0.5110783",
"0.5108735",
"0.50597715",
"0.5040271",
"0.50361943",
"0.5013634",... | 0.6805595 | 0 |
DELETE /cattle_ids/1 DELETE /cattle_ids/1.xml | def destroy
@cattle_id = CattleId.find(params[:id])
@cattle_id.destroy
respond_to do |format|
format.html { redirect_to(cattle_ids_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end",
"def delete_by_id id, opts = {}\n update opts.merge(:data => xml.delete_by_id(id))\n end",
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \... | [
"0.67052555",
"0.6548932",
"0.64589727",
"0.645614",
"0.6213299",
"0.6184873",
"0.61804336",
"0.6166453",
"0.6165071",
"0.61151034",
"0.6085725",
"0.6080698",
"0.6031887",
"0.60253733",
"0.5967029",
"0.596064",
"0.5934148",
"0.5932685",
"0.5932685",
"0.5888405",
"0.5848522",
... | 0.746578 | 0 |
methods are defined using the "def" keyword | def double(val)
val * 5
# the return is te result of the last expression
val * 2
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods() end",
"def methods; end",
"def methods; end",
"def methods; end",
"def methods; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end",
"def method; end... | [
"0.7989375",
"0.7905343",
"0.7905343",
"0.7905343",
"0.7905343",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.7480328",
"0.725143",
"0.72214293",
"0.7200614",
"0.7200614",
"... | 0.0 | -1 |
The workhorse generate method. Defaults to one id, but up to 255 can be requested. | def generate(n=1, idspace=0)
failures ||= 0
if failures > 0
disconnect
connect
elsif @socket.nil?
connect
end
request_id(n, idspace)
fetch_id(n)
rescue Errno::ETIMEDOUT, Errno::ECONNREFUSED, Errno::EPIPE
failures += 1
retry if failures < MAX_RETRIES
raise
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_id \n end",
"def id_generator; end",
"def generate_id\n id_generator.call\n end",
"def generate_new_id()\n\t\tbegin\n\t\t\t(id = rand(9000)+1000)\n\t\tend while @objects[id]\n\t\treturn id\n\tend",
"def generate_id()\n return nil unless @name and @represents\n @id ||... | [
"0.74072343",
"0.71567",
"0.70265627",
"0.6996201",
"0.67886555",
"0.6742302",
"0.6718515",
"0.66472465",
"0.66318536",
"0.66259426",
"0.662002",
"0.6593436",
"0.6578619",
"0.65540904",
"0.65482944",
"0.65365094",
"0.6515059",
"0.6501585",
"0.64746726",
"0.64668524",
"0.64668... | 0.0 | -1 |
initialize runs whenever a new instance method has been initialized | def initialize()
puts "Initializing new puppy instance ..."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize\n initialize!\n end",
"def initialize\n initialize!\n end",
"def initialize() end",
"def initialize\n puts \"constructor is automatically called when we create object\"\n end",
"def on_initialize\n end",
"def initialize\n\n\n\n end",
"def post_initialize\n en... | [
"0.78692746",
"0.78692746",
"0.7742165",
"0.7662575",
"0.76623636",
"0.76442194",
"0.7637747",
"0.76287776",
"0.7622394",
"0.76196456",
"0.7611271",
"0.7609795",
"0.7588874",
"0.7588874",
"0.7588874",
"0.7588874",
"0.7572814",
"0.7572814",
"0.7572814",
"0.75631857",
"0.756262... | 0.0 | -1 |
class Dancer TEST CODE dancer = Dancer.new dancer.flip dancer.spin | def loop_into_data_structure(number_of_instances)
array_moves = []
n = 0
while n < number_of_instances
array_moves[n] = Dancer.new
n += 1
end
p array_moves
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trader; end",
"def make_it_swim(duck)\n duck.swim\nend",
"def test_can_create_instance_of_class_via_bang_method \n cars = Lumberjack.construct do\n vehicle :name => 'Prius (are owned by rich hippies)' do\n person! 'Ryan' do # i so put my foot in here, i'm not a rich hippy!\n age ... | [
"0.6045489",
"0.603592",
"0.60065",
"0.59862375",
"0.58820945",
"0.5873176",
"0.5770947",
"0.56854844",
"0.56636184",
"0.56503296",
"0.5643422",
"0.56414646",
"0.5614625",
"0.55851483",
"0.5565934",
"0.556436",
"0.5536615",
"0.55321133",
"0.55316037",
"0.55274624",
"0.5521608... | 0.0 | -1 |
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: split argument string into individual items add items to a hash and add a quantity set default quantity to 1 print the list to the console [can you use one of your other methods here?] output: hash of items and quantities Method to add an item to a list input: item name and quantity and list steps: add the item and quantity to the list output: updated list with new item and quantity Method to remove an item from the list input: item name and list steps: remove the item and its quantity from the list output: updated list with item removed Method to update the quantity of an item input: item name and new quantity and list steps: update item's quantity with new quantity output: updated list with updated quantity Method to print a list and make it look pretty input: list hash steps: printing out the list output: printed list | def create_list(items)
list = {}
items = items.split(' ')
items.each do |item|
list[item] = 1
end
print_list(list)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_item(list, item, quantity=1)\r\n# input: item name and optional quantity\r\n# steps: \r\n # Use shopping list as input\r\n # Use the item to be added as 2nd input\r\n # Use the item quantity as a 3rd input (look up whether optional input is possible)\r\n # Add the item and quantity to the shopping list... | [
"0.8167329",
"0.7865558",
"0.78439903",
"0.78076077",
"0.773816",
"0.77037245",
"0.7603531",
"0.7583702",
"0.75516015",
"0.754918",
"0.7519986",
"0.750515",
"0.7387811",
"0.73566127",
"0.73363376",
"0.7333697",
"0.7318244",
"0.7307333",
"0.726541",
"0.72204775",
"0.71956116",... | 0.0 | -1 |
GET /dests GET /dests.json | def index
@current_date = Date.today
dated_params = {}
@dests = Dest.all
if params[:search].present?
@dests = @dests.search(params[:search])
end
if params[:closed] != 'true'
@dests = @dests.non_closed
end
if params[:dest_type].present?
@dests = @dests.where(dest_type: params[:dest_type])
end
case params[:provisional]&.to_sym
when :exclude
@dests = @dests.where(provisional: false)
when :only
@dests = @dests.where(provisional: true)
end
if params[:company_id].present?
@dests = @dests.where(company_id: params[:company_id])
end
if params[:prefecture].present?
@dests = @dests.where(prefecture: params[:prefecture])
end
if params[:area_id].present?
dated_params[:area_id] = params[:area_id]
end
# @dests = @dests.eager_load(:dest_dated_values)
@dests = @dests.with_dated_values(@current_date, dated_params) if dated_params.present?
@dests = @dests.page(params[:page])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n local_var_path = '/destinations'\n\n # query parameters\n query_params = {}... | [
"0.6765999",
"0.6590646",
"0.6536768",
"0.62608045",
"0.6174211",
"0.6096379",
"0.60765",
"0.6011723",
"0.5873201",
"0.5846921",
"0.58293825",
"0.5818351",
"0.57498866",
"0.57114655",
"0.57114655",
"0.5612621",
"0.56081426",
"0.55852884",
"0.5585032",
"0.5548711",
"0.5530836"... | 0.56140816 | 15 |
GET /dests/1 GET /dests/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_destinations_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DataExportDestinationsApi.get_destinations ...'\n end\n # resource path\n local_var_path = '/destinations'\n\n # query parameters\n query_params = {}... | [
"0.6643287",
"0.6525208",
"0.6348897",
"0.6179377",
"0.6146276",
"0.6146276",
"0.6044886",
"0.5998754",
"0.58969504",
"0.586379",
"0.58577955",
"0.5857759",
"0.5842001",
"0.58083284",
"0.5764811",
"0.57331073",
"0.5726444",
"0.5722374",
"0.5722374",
"0.5704181",
"0.5652182",
... | 0.0 | -1 |
POST /dests POST /dests.json | def create
@dest = Dest.new(dest_params)
respond_to do |format|
if @dest.save
format.html { redirect_to dests_path, notice: 'Dest was successfully created.' }
format.json { render :show, status: :created, location: @dest }
else
format.html { render :new }
format.json { render json: @dest.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @destination = Destination.new(destination_params)\n @destination.save\n set_destinations\n end",
"def copy_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir]... | [
"0.6195165",
"0.6031813",
"0.595281",
"0.576659",
"0.5741007",
"0.56920004",
"0.56241846",
"0.56241846",
"0.55799353",
"0.5574252",
"0.55714935",
"0.5569744",
"0.55631393",
"0.5545139",
"0.5515064",
"0.5505855",
"0.54479957",
"0.54451716",
"0.54272777",
"0.541588",
"0.5393549... | 0.6768958 | 0 |
PATCH/PUT /dests/1 PATCH/PUT /dests/1.json | def update
respond_to do |format|
if @dest.update(dest_params)
format.html { redirect_to dests_path, notice: 'Dest was successfully updated.' }
format.json { render :show, status: :ok, location: @dest }
else
format.html { render :edit }
format.json { render json: @dest.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(**args)\n @api = args[:api] if args.key?(:api)\n @destination = args[:destination] if args.key?(:destination)\n @extensions = args[:extensions] if args.key?(:extensions)\n @origin = args[:origin] if args.key?(:origin)\n @request = args[:request] if args.key?... | [
"0.6093074",
"0.5898304",
"0.5767967",
"0.5717068",
"0.56472415",
"0.5610437",
"0.56104255",
"0.5605689",
"0.5605689",
"0.55785733",
"0.5573259",
"0.55660874",
"0.5552558",
"0.5551255",
"0.5551255",
"0.5536443",
"0.5478745",
"0.547578",
"0.547578",
"0.5465432",
"0.5432136",
... | 0.67242706 | 0 |
DELETE /dests/1 DELETE /dests/1.json | def destroy
@dest.destroy
respond_to do |format|
format.html { redirect_to dests_url, notice: 'Dest was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @copy_target = CopyTarget.find(params[:id])\n @copy_target.destroy\n\n redirect_to \"/conf\"\n # respond_to do |format|\n # format.html { redirect_to copy_targets_url }\n # format.json { head :no_content }\n # end\n end",
"def destroy\n @destination = Destination.find(param... | [
"0.64783543",
"0.6445285",
"0.6445285",
"0.6445285",
"0.6373907",
"0.6275123",
"0.6247192",
"0.61848915",
"0.61848915",
"0.61848915",
"0.6163547",
"0.6156051",
"0.61313045",
"0.61017483",
"0.61013377",
"0.60666144",
"0.605708",
"0.60276604",
"0.601256",
"0.59772736",
"0.59750... | 0.71047074 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_dest
@dest = Dest.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def dest_params
params.require(:dest).permit(Dest::REGISTRABLE_ATTRIBUTES)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def allowed_params\n ALLOWED_PARAMS\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end",
"def param_whitelist\n [:role, :title]\... | [
"0.69497335",
"0.6812623",
"0.6803639",
"0.6795365",
"0.67448795",
"0.67399913",
"0.6526815",
"0.6518771",
"0.64931697",
"0.6430388",
"0.6430388",
"0.6430388",
"0.63983387",
"0.6356042",
"0.63535863",
"0.63464934",
"0.63444513",
"0.6337208",
"0.6326454",
"0.6326454",
"0.63264... | 0.0 | -1 |
Set the margins of this object. | def margins=(value)
raise TypeError, ':margins option must be a Margins instance or respond to #to_hash or #to_h' unless value.respond_to?(:to_hash) || value.respond_to?(:to_h)
@margins = if value.is_a?(Margins)
value
else
value = value.to_hash rescue value.to_h
Margins.new(value)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_margins(margin)\n set_margin_left(margin)\n set_margin_right(margin)\n set_margin_top(margin)\n set_margin_bottom(margin)\n end",
"def setMargins(top, right, bottom, left)\n setMarginTop(top)\n setMarginRight(right)\n setMarginBottom(bottom)\n setM... | [
"0.8128346",
"0.7953358",
"0.78715336",
"0.7405558",
"0.7360262",
"0.73598665",
"0.7358993",
"0.7176381",
"0.7155382",
"0.7155382",
"0.71191967",
"0.7077468",
"0.694905",
"0.66403484",
"0.660119",
"0.660119",
"0.660119",
"0.642252",
"0.63279414",
"0.6320947",
"0.6300903",
"... | 0.7130398 | 10 |
GET /matches GET /matches.json | def find_matches
@match_distances = Match.find_match(current_user, "Any", nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end",
"def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end",
"def index\n @matches = @current_user.matches.include... | [
"0.752813",
"0.7394124",
"0.730342",
"0.7210067",
"0.72072196",
"0.7200118",
"0.7068271",
"0.7068271",
"0.7068271",
"0.7068271",
"0.7068271",
"0.70285064",
"0.69965607",
"0.69690144",
"0.69647396",
"0.6962711",
"0.6949953",
"0.69074726",
"0.6834273",
"0.6762692",
"0.6753257",... | 0.6246667 | 46 |
the controller for partial view of carousel which is appended on find_matches.html.erb via ajax | def carousel
@match_distances = Match.find_match(current_user, params[:match_type], params[:after].to_date)
render :partial => 'carousel', :content_type => 'text/html', :locals => {:match_distances => @match_distances}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @matches = search_all(Match)\n @advert = Advert.random('matches_list')\n respond_to do |format|\n format.html # index.html.erb\n format.js { render :partial => @matches }\n end\n end",
"def list_view\n\t\t# render the partial page with js to show the list view\n\t\trespond_to d... | [
"0.67551714",
"0.6187608",
"0.6107076",
"0.60643417",
"0.60030216",
"0.5984738",
"0.5920643",
"0.58966625",
"0.5892846",
"0.58756423",
"0.58517945",
"0.5830084",
"0.5823043",
"0.57839847",
"0.5769814",
"0.5743563",
"0.5731979",
"0.57098424",
"0.5690597",
"0.56584513",
"0.5658... | 0.7224609 | 0 |
GET /matches/1 GET /matches/1.json | def show
@conversation = Conversation.find_by_id(@match.conversation_id)
@messages = @conversation.messages
@message = Message.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(id)\r\n self.get(\"/matches/#{id}\")\r\n end",
"def index\n @matches = Match.all\n @recent = Match.recent\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @matches }\n end\n end",
"def index\n @matches = Match.where(\"player2_id IS N... | [
"0.76179665",
"0.747113",
"0.7408183",
"0.72241014",
"0.7158438",
"0.71064603",
"0.7097788",
"0.6979289",
"0.69566995",
"0.6949862",
"0.69414395",
"0.69414395",
"0.69414395",
"0.69414395",
"0.69414395",
"0.6835067",
"0.68285567",
"0.6806905",
"0.6789736",
"0.6748504",
"0.6724... | 0.0 | -1 |
POST /matches POST /matches.json | def create
@match = Match.new(match_params)
@match.player1_id = current_user.id
@match.end = @match.end_date
# Create a conversation for match.
conv = Conversation.new
conv.match_id = @match.id
conv.save!
@match.conversation_id = conv.id
respond_to do |format|
if @match.save
format.html { redirect_to @match, notice: ['Match was successfully created.', "alert alert-dismissible alert-success"] }
else
format.html { render action: 'new' }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @match = Match.new(params[:match])\n\n respond_to do |format|\n if @match.save\n format.html { redirect_to @match, :notice => 'Match was successfully created.' }\n format.json { render :json => @match, :status => :created, :location => @match }\n else\n format.html... | [
"0.70272964",
"0.70107347",
"0.6944617",
"0.6944617",
"0.6933998",
"0.6931489",
"0.6931489",
"0.6931489",
"0.6931489",
"0.6931489",
"0.6931489",
"0.6931427",
"0.6931427",
"0.6931427",
"0.6930626",
"0.68569237",
"0.68431115",
"0.6746942",
"0.6663972",
"0.66263044",
"0.6600143"... | 0.5683172 | 80 |
PATCH/PUT /matches/1 PATCH/PUT /matches/1.json | def update
@match.assign_attributes(match_params)
@match.end = @match.end_date
respond_to do |format|
if @match.save
format.html { redirect_to @match, notice: ['Match was successfully updated.', "alert alert-dismissible alert-success"] }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @match.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n match = Match.find_by(id: match_params[:id])\n\n match.update match_params\n if match.valid?\n render json: { match: match}, status: :created\n else\n render json: { errors: match.errors.full_messages }, status: :not_accepted\n end\n end",
... | [
"0.7097369",
"0.67878073",
"0.6784116",
"0.6765547",
"0.6757647",
"0.6743928",
"0.67202103",
"0.6686816",
"0.66761553",
"0.66006404",
"0.6593729",
"0.6593729",
"0.6593729",
"0.6593729",
"0.6593729",
"0.6593729",
"0.6593729",
"0.6593729",
"0.6593729",
"0.6593729",
"0.65932953"... | 0.5607702 | 79 |
join or leave match | def join
pids = get_player_list(@match).map{|p| p.try(:id)} # list of player ids
status = false
if can_join(pids) #if possible, join
status = join_now(@match, current_user.id)
done = ["joined", "success"]
elsif pids.include?(current_user.id) #if already joined, then leave
status = leave_now(@match, current_user.id, @host)
done = ["left", "warning"]
if !get_player_list(@match).any? #if there is no more players in match, then destroy
destroy
return
end
end
respond_to do |format|
if status and @match.save
format.html { redirect_to @match, notice: ['You have succesfully ' + done[0] + ' the match.', "alert alert-dismissible alert-" + done[1]] }
else
format.html { redirect_to @match, notice: ['Sorry, your request could not be processed.', "alert alert-dismissible alert-danger"] }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def join(*) end",
"def full_join(other, *exps)\n join(other, *exps, join_type: :full)\n end",
"def join; end",
"def unjoin(&block)\n @objs.find(&block)\n end",
"def join!(other_entry)\n raise \"Cannot be joined\" unless joinable?(other_entry)\n\n o_accts, o_nonaccts = other_entry.... | [
"0.6254337",
"0.6191731",
"0.61108476",
"0.6023713",
"0.58929896",
"0.57704884",
"0.5713556",
"0.56528234",
"0.5608979",
"0.54569805",
"0.54124427",
"0.5351181",
"0.53285927",
"0.53168476",
"0.5312828",
"0.52872753",
"0.5266655",
"0.5259483",
"0.524402",
"0.5202691",
"0.52011... | 0.4955277 | 47 |
host can kick people out of match | def kick
status = false
pid = params[:match][:pid].to_i
# find and kick player out by setting foreign key to nil
if (@match.player2_id == pid) then @match.player2_id = nil; status = true
elsif (@match.player3_id == pid) then @match.player3_id = nil; status = true
elsif (@match.player4_id == pid) then @match.player4_id = nil; status = true
end
respond_to do |format|
if status and @match.save
format.html { redirect_to @match, notice: ['Player have been successfully kicked out.', "alert alert-dismissible alert-success" ] }
else
format.html { redirect_to @match, notice: ['Sorry, your request could not be processed.', "alert alert-dismissible alert-danger"] }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def kill_everybody! why\n\t\t\tModel::Instance.live_on_host(host).each { |i| kill i, why }\n\t\tend",
"def leave_lobby\n if lobby\n game = lobby\n if game.player_count == 1\n game.destroy!\n elsif game.host == self\n game.player(self).destroy\n Player.where(game: game).firs... | [
"0.6057796",
"0.5888233",
"0.58694094",
"0.5862972",
"0.58392763",
"0.5825796",
"0.58088505",
"0.57993275",
"0.57777536",
"0.57258165",
"0.5702344",
"0.5681475",
"0.56562567",
"0.5639832",
"0.55717254",
"0.553291",
"0.5532185",
"0.5525365",
"0.5517782",
"0.548014",
"0.5477276... | 0.5206732 | 68 |
DELETE /matches/1 DELETE /matches/1.json | def destroy
@match.destroy
respond_to do |format|
format.html { redirect_to @match, notice: ['You have succesfully left the match.', "alert alert-dismissible alert-warning"]}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n format.html { redirect_to matches_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @match = Match.find(params[:id])\n @match.destroy\n\n respond_to do |format|\n ... | [
"0.7725601",
"0.7725601",
"0.7725601",
"0.7714915",
"0.7679225",
"0.7675409",
"0.75533676",
"0.7499803",
"0.7478338",
"0.7476574",
"0.7439347",
"0.7407539",
"0.7407539",
"0.7407539",
"0.7407539",
"0.7407539",
"0.7407539",
"0.7407539",
"0.7407539",
"0.7407539",
"0.7407539",
... | 0.64375997 | 62 |
Use callbacks to share common setup or constraints between actions. | def set_match
@match = Match.find(params[:id])
@host = false
if current_user and current_user.id == @match.player1_id
@host = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def match_params
params.require(:match).permit(:start, :duration_hours, :duration_days, :court, :desc, :match_type, :pid, :country, :postcode, :after)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Adds connection to registry. | def add(channel_name, stream_name, connection)
@mutex.synchronize do
subscribers[channel_name][stream_name].push(connection)
connection
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(name, connection)\n @connections.store(name, connection)\n end",
"def add_connection(connection)\n self.connections[connection.id] = connection\n end",
"def connection(name, params = {})\n Celluloid::Logger.info \"Registering connection '#{name}'...\"\n self.connection... | [
"0.73868203",
"0.7200651",
"0.641041",
"0.64012283",
"0.62663186",
"0.618856",
"0.6158942",
"0.6058691",
"0.60495335",
"0.60487205",
"0.60311264",
"0.5960618",
"0.5952973",
"0.5943147",
"0.5921314",
"0.57941055",
"0.5726427",
"0.56905174",
"0.5681155",
"0.5628591",
"0.5610981... | 0.6054567 | 8 |
Removes connection from registry. | def remove(channel_name, stream_name, connection)
@mutex.synchronize do
subscribers[channel_name][stream_name].delete(connection)
subscribers[channel_name].delete(stream_name) if subscribers[channel_name][stream_name].empty?
connection
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_and_close(connection)\n @connections.delete(connection)\n close_connection(connection)\n end",
"def remove_connection(connection)\n self.connections.delete(connection.id)\n end",
"def unbind\n puts \"connection #{@connection.id.to_s} unbound\"\n begin\n unless !@registe... | [
"0.7282421",
"0.68719095",
"0.6791724",
"0.6747273",
"0.6622707",
"0.6603567",
"0.65898085",
"0.65682554",
"0.65450084",
"0.653657",
"0.6466049",
"0.6461736",
"0.64568275",
"0.64500415",
"0.6425565",
"0.641191",
"0.6401252",
"0.63956743",
"0.636758",
"0.63664097",
"0.6335865"... | 0.0 | -1 |
Return all connections from all channels when `channel_name` omitted. Return all connections from channel when `stream_name` omitted. Return connections from channel stream when `channel_name` and `stream_name` provided. | def find(channel_name = nil, stream_name = nil)
@mutex.synchronize do
return subscribers.values.map(&:values).flatten if channel_name.nil?
return subscribers[channel_name].values.flatten if stream_name.nil?
subscribers[channel_name][stream_name]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def channels\r\n return for_context(nil, false) { |c| c.channels }\r\n end",
"def channels \n debug [query[\"channels\"], \" are registered channels\"]\n @channels ||= query[\"channels\"].collect(&:strip).reject(&:empty?) \n @channels[0] ||= nil # Every user shou... | [
"0.633454",
"0.60956794",
"0.59331185",
"0.59165126",
"0.58937556",
"0.5835396",
"0.5834562",
"0.5637086",
"0.560203",
"0.5535989",
"0.55326",
"0.5522645",
"0.5521402",
"0.5517922",
"0.5468858",
"0.54467934",
"0.54044443",
"0.53646654",
"0.53612685",
"0.5339611",
"0.5328954",... | 0.5920967 | 3 |
The main command loop | def main_loop()
setup()
finished = false
while !finished
print ":) "
line = gets.chomp
if line == 'Q'
finished = true
else
parse_command(line)
end
end
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loop\n end",
"def loop\n end",
"def loop\n end",
"def run_loop\n end",
"def run!\n while @commands.length > 0\n command = @commands.shift\n puts command\n @run_success = run command unless @dry_run\n end \n end",
"def main\n loop do\n unless @conte... | [
"0.7266236",
"0.7255659",
"0.7255659",
"0.72381294",
"0.7225912",
"0.70664",
"0.70106673",
"0.6919402",
"0.6919402",
"0.6919402",
"0.69075453",
"0.6906838",
"0.6906626",
"0.6838003",
"0.678883",
"0.6764842",
"0.67495894",
"0.670526",
"0.66695315",
"0.6663981",
"0.6663489",
... | 0.730992 | 1 |
:new_articles_count, :last_sync_at def new_articles_count This is a chained criteria, not method call object.shinchyaku.count end | def name
object.merchant.name
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count; end",
"def count; end",
"def count; end",
"def count\n # implement in subclasses\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n @count\n end",
"def count\n ... | [
"0.67849255",
"0.67849255",
"0.67849255",
"0.67697257",
"0.6685441",
"0.6685441",
"0.6685441",
"0.6667741",
"0.66437775",
"0.66437775",
"0.66437775",
"0.6635947",
"0.6635947",
"0.6553508",
"0.63973993",
"0.63850015",
"0.63789105",
"0.636141",
"0.6346396",
"0.6343944",
"0.6341... | 0.0 | -1 |
GET /reviews GET /reviews.json | def index
if params[:search]
@products = Product.search(params[:keyword]).filter(params[:filter])
@categories = Category.all
@new_path = new_product_path
@product_a = Product.new #for modal partial rendering
else
@products = Product.all.order("Created_at DESC")
@categories = Category.all
@new_path = new_product_path
@product_a = Product.new #for modal partial rendering
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n en... | [
"0.8128604",
"0.76803666",
"0.76803666",
"0.76768506",
"0.7594319",
"0.7533078",
"0.75313497",
"0.75313497",
"0.7528348",
"0.7404546",
"0.7360395",
"0.7340902",
"0.7319881",
"0.73067623",
"0.7281126",
"0.72661823",
"0.721507",
"0.7189025",
"0.7180426",
"0.71802807",
"0.711558... | 0.0 | -1 |
GET /reviews/1 GET /reviews/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end",
"def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reviews }\n en... | [
"0.78798026",
"0.751587",
"0.751587",
"0.7503942",
"0.7390879",
"0.7352559",
"0.73425764",
"0.7342495",
"0.7331215",
"0.7331215",
"0.7281798",
"0.7159771",
"0.71292806",
"0.71292806",
"0.71292806",
"0.71292806",
"0.71292806",
"0.7086854",
"0.7068903",
"0.7065639",
"0.70534414... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.