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 |
|---|---|---|---|---|---|---|
Push a dummy item into the database for deletion. | def sample_for_delete(src = :delete_example)
current = delete_id && Manifest.find_by(id: delete_id)
return current if current && (src == :delete_example)
current&.delete
new_record(src).tap do |record|
self.delete_id = record.id if record.save!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def push_one(item)\n # we're expecting item to be a single item so simply normalize it\n payload = normalize_item(item)\n\n # if successfully persisted to redis return this item's `jid`\n pushed = false\n pushed = raw_push([payload]) if payload\n pushed ? payload[:jid] : nil\n end"... | [
"0.6120168",
"0.5845558",
"0.582659",
"0.5825308",
"0.5810055",
"0.5746025",
"0.5686832",
"0.5680498",
"0.56800956",
"0.56773967",
"0.56297016",
"0.56222445",
"0.5617759",
"0.558543",
"0.55832416",
"0.5570692",
"0.5544447",
"0.5540853",
"0.5540178",
"0.5538233",
"0.5534716",
... | 0.0 | -1 |
Generate a new nonpersisted item to support new item creation. | def new_record(src = :example)
fields = src.is_a?(Hash) ? src : manifests(src.to_sym).fields.except(:id)
Manifest.new(fields)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_new_item_object\n @new_item = Flight.new\n insert_required_params_into_new_item_object\n insert_default_params_into_new_item_object\n insert_optional_params_into_new_item_object(self)\n return @new_item\n end",
"def generate_item(item)\n item\n end",
"def new\n @item = I... | [
"0.7529151",
"0.72482246",
"0.68332684",
"0.6802242",
"0.6689233",
"0.6689233",
"0.6689233",
"0.6677101",
"0.66756624",
"0.6667993",
"0.65620685",
"0.6537957",
"0.6517223",
"0.651614",
"0.64403445",
"0.6434871",
"0.639221",
"0.6378375",
"0.6372539",
"0.63625383",
"0.63178396"... | 0.0 | -1 |
The default :index action redirects to :list_own. | def index_redirect(**opt, &blk)
opt[:dst] ||= :list_own
super(**opt, &blk)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n redirect_to :action => :list\n end",
"def index; redirect_to :action => 'list'; end",
"def index\n \n redirect_to ( :action => \"list\")\n end",
"def index\r\n list\r\n render_action 'list'\r\n end",
"def index\n redirect_to :action => \"list\"\n end",
"def list\n redir... | [
"0.76742846",
"0.76470894",
"0.76353633",
"0.7585238",
"0.7564474",
"0.75561965",
"0.7550536",
"0.7527054",
"0.7463064",
"0.7463064",
"0.7463064",
"0.7463064",
"0.7463064",
"0.7463064",
"0.7463064",
"0.7336836",
"0.7267865",
"0.7203472",
"0.7202553",
"0.7202553",
"0.7040145",... | 0.75753075 | 4 |
Force signout to prevent CSRF attacks | def handle_unverified_request
sign_out
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sign_out\n send_request('sign_out', :delete) do |req|\n req.body = { auth_token: @auth_token }\n end\n end",
"def sign_out\n @logout = true\n authenticate_api_user\n @logout = false\n revoke_access if @current_user\n head :no_content\n end",
"def signout\n self.curren... | [
"0.7990691",
"0.795871",
"0.7952228",
"0.79445994",
"0.78763884",
"0.7876381",
"0.7868531",
"0.7860046",
"0.78420556",
"0.78404874",
"0.7815438",
"0.7809765",
"0.77826566",
"0.7777522",
"0.7751172",
"0.77506804",
"0.7739338",
"0.7729812",
"0.7703439",
"0.7691625",
"0.7683685"... | 0.76823664 | 42 |
this tehnique is named Churn coding from Alonzo Churn | def to_integer(proc)
proc[-> n { n + 1 }][0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def king_richard_iii; end",
"def tongue_twister; end",
"def jack_handey; end",
"def unusual_sport; end",
"def gluck_italian; end",
"def mozart_italian; end",
"def schumann; end",
"def buzzword; end",
"def buzzword; end",
"def enchantment; end",
"def england\n end",
"def suivre; end",
"def ... | [
"0.6842622",
"0.6817791",
"0.6642832",
"0.6488478",
"0.64117503",
"0.6385262",
"0.63291734",
"0.61931515",
"0.61931515",
"0.61806667",
"0.61672366",
"0.6149288",
"0.6127394",
"0.6127394",
"0.61216104",
"0.6104279",
"0.610197",
"0.60889363",
"0.60889363",
"0.60579634",
"0.6053... | 0.0 | -1 |
Determine the content type of this response. | def content_type
@content_type ||= MediaTypeIdentifier.load(headers['Content-Type']).freeze
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type\n self.class.response_content_type\n end",
"def response_content_type\n @response_headers[\"Content-Type\"]\n end",
"def content_type\n @response['content-type'].nil? ? 'text/plain' : @response['content-type']\n end",
"def content_type\n @response_h... | [
"0.87119704",
"0.84737366",
"0.8371222",
"0.83615685",
"0.8321415",
"0.83125424",
"0.82908624",
"0.82908624",
"0.8267949",
"0.82212627",
"0.8217966",
"0.82106715",
"0.8189702",
"0.8164805",
"0.8115792",
"0.80967236",
"0.80967236",
"0.8042968",
"0.80057585",
"0.8004172",
"0.79... | 0.78912973 | 23 |
Set the content type for this response. | def content_type=(identifier)
@content_type = nil
headers['Content-Type'] = MediaTypeIdentifier.load(identifier).to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type=(ctype)\n @response_headers[\"Content-Type\"] = ctype\n end",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def content_type=( type )\n\t\treturn self.headers.content_type = type\n\tend",
"def set_content_type(content_type)\n set_header 'Content-T... | [
"0.83725953",
"0.8277831",
"0.8277831",
"0.82478136",
"0.82333577",
"0.8197323",
"0.8109925",
"0.8109925",
"0.8066963",
"0.78812015",
"0.78800833",
"0.7842265",
"0.76480687",
"0.7617693",
"0.7602949",
"0.7597154",
"0.74637187",
"0.7462034",
"0.7462034",
"0.74441314",
"0.74383... | 0.7889698 | 9 |
Determine an appropriate default content_type for this part given the preferred handler_name, if possible. Considers any predefined set of values on the content_type attributge of the headers. | def derive_content_type(handler_name)
possible_values = if content_type.match 'text/plain'
_, content_type_attribute = headers_attribute&.attributes&.find { |k, _v| k.to_s =~ /^content[-_]{1}type$/i }
if content_type_attribute&.options&.key?(:values)
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def content_type(default = nil)\n content_type = self['content-type']\n if content_type && content_type.length > 0\n\tcontent_type.strip.split(/\\s*;\\s*/)[0].downcase\n else\n\tif block_given?\n yield\n else\n default\n end\n end\n end",
"def select_header_... | [
"0.7304743",
"0.7156809",
"0.7156809",
"0.7156809",
"0.7156809",
"0.7156809",
"0.7120444",
"0.6933178",
"0.68840533",
"0.6844385",
"0.67338663",
"0.67338663",
"0.6731005",
"0.66794074",
"0.6663946",
"0.6662653",
"0.66532624",
"0.6640804",
"0.6621769",
"0.6599732",
"0.65698117... | 0.8057873 | 0 |
Using the Ruby language, have the function PermutationStep(num) take the num parameter being passed and return the next number greater than num using the same digits. For example: if num is 123 return 132, if it's 12453 return 12534. If a number has no greater permutations, return 1 (ie. 999). Solution : | def PermutationStep(num)
possibilities = []
possibilities = num.to_s.chars.map(&:to_i).permutation.to_a
possibilities.reject! {|comb| comb.join.to_i <= num}
possibilities.map! {|comb| comb.join.to_i}
possibilities.empty? ? -1 : possibilities.min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def permutation_step(num)\r\n perms = num.to_s.chars.map {|x| x.to_i}.permutation.to_a.map do |perm_arr|\r\n perm_arr.map {|x| x.to_s}.join.to_i\r\n end\r\n\r\n perms.select {|n| n > num}.min.nil? ? -1 : perms.select {|n| n > num}.min\r\nend",
"def permuted_nums()\r\n\t# *2...*6 must have the same digits (... | [
"0.82925403",
"0.7570942",
"0.70358175",
"0.69701785",
"0.6922972",
"0.69050306",
"0.67102915",
"0.67004454",
"0.6698715",
"0.6690966",
"0.6689813",
"0.66769",
"0.6653578",
"0.66481245",
"0.66466343",
"0.65591025",
"0.64937377",
"0.6445115",
"0.64262277",
"0.6419542",
"0.6409... | 0.84150493 | 0 |
waiting alert. Raise error if alert didn't appear | def wait_alert_accept_if_exist
sleep 1.5 #should wait animation
wait_true(timeout: 30, message: 'waiting alert dialog via wait_alert_accept_until_display_alert') {
execute_script('$.mainApp().alert().buttons().length > 0')
}
alert_accept_if_exist
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ok\n wait_for_exists\n @alert.accept\n @browser.after_hooks.run\n end",
"def tap_alert_if_exist(text)\n sleep 1.5 # wait for animation\n if wait_true(timeout: 30, message: \"failed to wait #{text} on alert with timeout\") {\n execute_script('$.mainApp().alert().buttons().length >... | [
"0.755776",
"0.7004235",
"0.6984317",
"0.6984317",
"0.6945711",
"0.6736976",
"0.67306715",
"0.6701585",
"0.6619941",
"0.65267813",
"0.6486626",
"0.64675474",
"0.6425176",
"0.6425176",
"0.6425176",
"0.6425176",
"0.6425176",
"0.6425176",
"0.6425176",
"0.6425176",
"0.6405648",
... | 0.7877397 | 0 |
ignore raise error when waiting alert ... | def ignore_wait_alert_accept_if_exist
begin
wait_alert_accept_if_exist
rescue
# nothing
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wait_alert_accept_if_exist\n sleep 1.5 #should wait animation\n wait_true(timeout: 30, message: 'waiting alert dialog via wait_alert_accept_until_display_alert') {\n execute_script('$.mainApp().alert().buttons().length > 0')\n }\n alert_accept_if_exist\n end",
"def prevent_unhandled_alert_e... | [
"0.70374864",
"0.6762501",
"0.65912175",
"0.63372827",
"0.6322605",
"0.63130105",
"0.63130105",
"0.62574434",
"0.62574434",
"0.6251515",
"0.62501276",
"0.6205443",
"0.6197369",
"0.6186813",
"0.61818236",
"0.6177687",
"0.6177687",
"0.6177687",
"0.61759543",
"0.61740136",
"0.61... | 0.8019101 | 0 |
tap particular text if exist | def tap_alert_if_exist(text)
sleep 1.5 # wait for animation
if wait_true(timeout: 30, message: "failed to wait #{text} on alert with timeout") {
execute_script('$.mainApp().alert().buttons().length > 0') }
execute_script("$.mainApp().alert().buttons()['#{text}'].tap();")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def has_text?; end",
"def contains_text(target)\r\n #puts \"Text to match is : #{match_text}\"\r\n #puts \"Html is : #{self.text}\"\r\n if target.kind_of? Regexp\r\n self.text.match(target)\r\n elsif target.kind_of? String\r\n self.text.in... | [
"0.59602886",
"0.5658554",
"0.5621736",
"0.5557035",
"0.5541468",
"0.5540106",
"0.5492703",
"0.5490735",
"0.54734594",
"0.5435085",
"0.5416751",
"0.54148066",
"0.5414388",
"0.53821737",
"0.53795403",
"0.5358076",
"0.53477156",
"0.5341077",
"0.53379637",
"0.5318547",
"0.531480... | 0.6189245 | 0 |
GET /mm_teams GET /mm_teams.xml | def index
@mm_teams = MmTeam.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @mm_teams }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end",
"def index\n @teams = Team.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @teams }\n end\n end",
"def show\n @mm_team = MmTeam.find(params... | [
"0.74479705",
"0.7182759",
"0.7161323",
"0.7161323",
"0.7001284",
"0.6917228",
"0.69001895",
"0.68829894",
"0.68112653",
"0.66924447",
"0.66699475",
"0.6645098",
"0.66433483",
"0.6628065",
"0.6595753",
"0.6595753",
"0.65868294",
"0.65835184",
"0.65823466",
"0.6533654",
"0.653... | 0.7673596 | 0 |
GET /mm_teams/1 GET /mm_teams/1.xml | def show
@mm_team = MmTeam.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @mm_team }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @mm_teams = MmTeam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mm_teams }\n end\n end",
"def index\n @mm_teams = MmTeam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @m... | [
"0.7532837",
"0.7532837",
"0.71761423",
"0.7011103",
"0.68423665",
"0.68423665",
"0.6758185",
"0.6739356",
"0.6711224",
"0.66793925",
"0.66777563",
"0.66433775",
"0.66037524",
"0.6543548",
"0.6491002",
"0.645266",
"0.645266",
"0.6403588",
"0.6399033",
"0.63720214",
"0.6363300... | 0.7253587 | 3 |
GET /mm_teams/new GET /mm_teams/new.xml | def new
@mm_team = MmTeam.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @mm_team }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
"def new\n @team = Team.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @team }\n end\n end",
... | [
"0.7761263",
"0.7761263",
"0.77517515",
"0.76881784",
"0.76237154",
"0.743046",
"0.74114126",
"0.73973364",
"0.7329145",
"0.7298661",
"0.72511154",
"0.7149667",
"0.7123644",
"0.71067137",
"0.71067137",
"0.71067137",
"0.71067137",
"0.71067137",
"0.71067137",
"0.71067137",
"0.7... | 0.7861019 | 0 |
POST /mm_teams POST /mm_teams.xml | def create
@mm_team = MmTeam.new(params[:mm_team])
respond_to do |format|
if @mm_team.save
format.html { redirect_to(@mm_team, :notice => 'Mm team was successfully created.') }
format.xml { render :xml => @mm_team, :status => :created, :location => @mm_team }
else
format.ht... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_teams\r\n response = HTTParty.get('https://www.balldontlie.io/api/v1/teams')[\"data\"]\r\n response.each do |i|\r\n team = Team.new\r\n \r\n team.full_name = i[\"full_name\"]\r\n team.division = i[\"division\"]\r\n team.conference = i[\"conference\"]\r\n\r\... | [
"0.6474527",
"0.62883806",
"0.6187078",
"0.6169901",
"0.6159931",
"0.61290336",
"0.60756",
"0.6056318",
"0.6056318",
"0.6053097",
"0.6023303",
"0.59754616",
"0.59754616",
"0.5930646",
"0.5873639",
"0.586996",
"0.58640903",
"0.58531874",
"0.58450705",
"0.582524",
"0.58102095",... | 0.6658273 | 0 |
PUT /mm_teams/1 PUT /mm_teams/1.xml | def update
@mm_team = MmTeam.find(params[:id])
respond_to do |format|
if @mm_team.update_attributes(params[:mm_team])
format.html { redirect_to(@mm_team, :notice => 'Mm team was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @mm_team = MmTeam.find(params[:id])\n\n respond_to do |format|\n if @mm_team.update_attributes(params[:mm_team])\n format.html { redirect_to(admin_mm_teams_url, :notice => 'Mm team was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { rend... | [
"0.6528916",
"0.6474579",
"0.64556503",
"0.64473844",
"0.64242876",
"0.63199085",
"0.62821686",
"0.62751323",
"0.6217408",
"0.6171228",
"0.6148633",
"0.6148611",
"0.6139624",
"0.6137795",
"0.61200804",
"0.61191213",
"0.61191213",
"0.6117422",
"0.61100227",
"0.61100227",
"0.61... | 0.6684959 | 0 |
DELETE /mm_teams/1 DELETE /mm_teams/1.xml | def destroy
@mm_team = MmTeam.find(params[:id])
@mm_team.destroy
respond_to do |format|
format.html { redirect_to(mm_teams_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @mm_team = MmTeam.find(params[:id])\n @mm_team.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_mm_teams_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sim_team = SimTeam.find(params[:id])\n @sim_team.destroy\n\n respond_to do |fo... | [
"0.72928864",
"0.70668197",
"0.70158625",
"0.6984515",
"0.6984515",
"0.6984515",
"0.6984515",
"0.6984515",
"0.6783283",
"0.67797565",
"0.67070806",
"0.67019486",
"0.6687384",
"0.6668676",
"0.6612591",
"0.6581935",
"0.655711",
"0.6487232",
"0.647881",
"0.64274937",
"0.64188266... | 0.7339277 | 0 |
Sets flash message to be a warning | def flash_warning(warning)
flash[:warning] = warning
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_failure_notice\n if request.format == :html\n flash[:alert] ||= error_messages.presence || flash_message(:failure)\n end\n end",
"def flash_notice=(message=\"Successfully processed.\")\n @flash_notice = message\n end",
"def warning(message)\n write_message message, 'warning'\n ... | [
"0.73717904",
"0.7292351",
"0.7240257",
"0.723107",
"0.7190747",
"0.7130265",
"0.7086886",
"0.7061561",
"0.7061561",
"0.70001566",
"0.69334",
"0.6925391",
"0.69060844",
"0.6897814",
"0.6883862",
"0.6878829",
"0.68487006",
"0.6847768",
"0.680469",
"0.6786892",
"0.67835796",
... | 0.87157834 | 0 |
Takes in multiple flash messages | def flash_messages(messages)
messages.each do |key, value|
flash[:password] = value if key == :password_hash
flash[key] = value
end
session[:error_fields] = params
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flash_messages\n if params[:message]\n message params[:message]\n end\n\n flash_message_keys.each do |key|\n if params[key]\n message.send(key, params[key])\n end\n end\n\n render(:template => 'shared/flash_messages', :layout => false)\n end",
"def flash_msgs(status, mes... | [
"0.802258",
"0.79645216",
"0.79022634",
"0.78420687",
"0.78319293",
"0.7806489",
"0.7786755",
"0.7745045",
"0.77291125",
"0.7656912",
"0.7632782",
"0.7616028",
"0.7598435",
"0.7511461",
"0.7511461",
"0.7511461",
"0.7511461",
"0.7511461",
"0.7511461",
"0.74841493",
"0.74811023... | 0.7421559 | 28 |
GET /dashboards GET /dashboards.json | def index
@dashboards = Dashboard.all
@dashboards = Dashboard.paginate(page: params[:page], per_page: 8) if current_user.admin.present?
# From Website index to DashBoard
# instance to index to valid? a new link
# @website_new = params[:website]
# this needs to be the last line as it is dou... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dashboards\n @dash_service.get_dashboards\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards... | [
"0.84424907",
"0.7766317",
"0.7766317",
"0.7766317",
"0.7766317",
"0.7472048",
"0.724003",
"0.7208619",
"0.71722186",
"0.70109075",
"0.69438976",
"0.687781",
"0.6856367",
"0.6606646",
"0.6605429",
"0.65251815",
"0.6521165",
"0.650346",
"0.6493168",
"0.6493168",
"0.6431371",
... | 0.0 | -1 |
GET /dashboards/1 GET /dashboards/1.json | def show
@dashboard = Dashboard.find_by(:website_id => params[:id]) || Dashboard.find(params[:id])# this show gets the params when there is not ID ( websites/index => dashbaord_new)
# @dashboard = Dashboard.find(params[:id]) if params[:id].blank? # gets ID when the params is created with an ID
find_params_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_dashboards\n @dash_service.get_dashboards\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards = Dashboard.all\n end",
"def index\n @dashboards... | [
"0.76852626",
"0.7571133",
"0.7571133",
"0.7571133",
"0.7571133",
"0.7455056",
"0.7354721",
"0.7228398",
"0.70155984",
"0.6975706",
"0.6947698",
"0.6885013",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.68410456",
"0.67870796",
"0.672... | 0.61293626 | 63 |
POST /dashboards POST /dashboards.json | def create
@dashboard = Dashboard.new(dashboard_params)
respond_to do |format|
if @dashboard.save
format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }
format.json { render :show, status: :created, location: @dashboard }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @dashboard = Dashboard.new(params[:dashboard])\n\n respond_to do |format|\n if @dashboard.save\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully created.' }\n format.json { render json: @dashboard, status: :created, location: @dashboard }\n else\... | [
"0.7265817",
"0.7244173",
"0.7244173",
"0.7244173",
"0.71877474",
"0.6956436",
"0.6955404",
"0.6865361",
"0.68240076",
"0.67642015",
"0.67642015",
"0.67642015",
"0.67642015",
"0.67110205",
"0.6607064",
"0.6574946",
"0.65296805",
"0.6394187",
"0.63500106",
"0.6340707",
"0.6327... | 0.6397201 | 17 |
PATCH/PUT /dashboards/1 PATCH/PUT /dashboards/1.json | def update
respond_to do |format|
if @dashboard.update(dashboard_params )
format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }
format.json { render :show, status: :ok, location: @dashboard }
else
format.html { render :edit }
format.json {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @dashboard = Dashboard.find(params[:id])\n\n respond_to do |format|\n if @dashboard.update_attributes(params[:dashboard])\n format.html { redirect_to @dashboard, notice: 'Dashboard was successfully updated.' }\n format.json { head :no_content }\n else\n format.html... | [
"0.7354554",
"0.71356934",
"0.71356934",
"0.71356934",
"0.71356934",
"0.71356934",
"0.69338286",
"0.6919879",
"0.6857498",
"0.6808663",
"0.63930357",
"0.6292235",
"0.62819976",
"0.6156014",
"0.60504466",
"0.6013491",
"0.5963964",
"0.5915414",
"0.588989",
"0.5844118",
"0.58439... | 0.6383846 | 11 |
DELETE /dashboards/1 DELETE /dashboards/1.json | def destroy
@dashboard.destroy
respond_to do |format|
format.html { redirect_to dashboards_url, notice: 'Dashboard was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dashboard = Dashboard.find(params[:id])\n @dashboard.destroy\n\n respond_to do |format|\n format.html { redirect_to dashboards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @dashboard.destroy\n respond_to do |format|\n format.html { redirec... | [
"0.81469935",
"0.81236327",
"0.7844121",
"0.7672268",
"0.758656",
"0.75475657",
"0.7434507",
"0.73045635",
"0.72261155",
"0.72126704",
"0.69942296",
"0.6982992",
"0.694223",
"0.69223076",
"0.6921324",
"0.6920898",
"0.67587215",
"0.67527986",
"0.6746765",
"0.6721643",
"0.67088... | 0.79263234 | 7 |
Use callbacks to share common setup or constraints between actions. | def set_dashboard
@dashboard = Dashboard.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 dashboard_params
params.require(:dashboard).permit(:calls, :clicks, :searches, :cost, :budget, :smartphones, :tablets, :computers, :website_id)
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.69780594",
"0.678054",
"0.6742781",
"0.67387927",
"0.67346025",
"0.6590683",
"0.6501642",
"0.6495788",
"0.6479752",
"0.64763314",
"0.645457",
"0.6437739",
"0.6377168",
"0.6372484",
"0.6363871",
"0.63179374",
"0.62981373",
"0.6297456",
"0.62916917",
"0.6290227",
"0.628954",... | 0.0 | -1 |
self should be the verifying user | def verify(candy, claiming_user_id)
bcc = BrainCandyCompletion.find_by_brain_candy_id_and_user_id(candy.id, claiming_user_id)
bcc.update_column :verifying_user_id, self.id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_verified?; end",
"def user_verification?; end",
"def user_verification; end",
"def user_verified=(_arg0); end",
"def user_verified; end",
"def verify\r\n self.verified = true\r\n end",
"def rc_user(active_user)\n p \"self: #{self}\"\n active_user.check_candidate(self.class)\n e... | [
"0.7236812",
"0.7215814",
"0.7138928",
"0.71112716",
"0.70988655",
"0.67707247",
"0.66901803",
"0.6631744",
"0.6630881",
"0.6610446",
"0.6592305",
"0.6589602",
"0.65218866",
"0.64446384",
"0.6439558",
"0.6439558",
"0.6396959",
"0.6396959",
"0.6394715",
"0.6356921",
"0.6305146... | 0.0 | -1 |
Write your code here. | def dictionary
{
:hello => "hi",
:to => "2",
:two => "2",
:too => "2",
:for => "4",
:four => "4",
:be => "b",
:you => "u",
:at => "@",
:and => "&"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def code; end",
"def run\n \n end",
"def run\n \n end",
"def method\n\t\t# code code\n\tend",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"def run; end",
"... | [
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.7117752",
"0.6527089",
"0.6527089",
"0.6524399",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.64633006",
"0.6418008",
"0.6343... | 0.0 | -1 |
1. What is a method that returns the first character in a string? string = "hello" return string[0] Commit 2 & 3 Initial Solution | def drive_thru
attendant_array = ["That comes with hash browns or fries.", "do you want cheese on that?", "Do you want to supersize that?"]
puts "Welcome to Ruby Burger. We have specials on Hamburgers, Fish Filet and Cookies for a dollar. Can I take your order?"
response = gets.chomp
while response != respon... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first(string)\n return string[0]\nend",
"def first_char word\n word[0].downcase\nend",
"def first_char word\n word[0].downcase\nend",
"def first_char(word)\n word[0].downcase\nend",
"def first_char(word)\n word[0].downcase\nend",
"def first_char(word)\n word[0].downcase\nend",
"def first_char... | [
"0.8366896",
"0.761176",
"0.761176",
"0.7584381",
"0.7584381",
"0.7584381",
"0.7584381",
"0.7583055",
"0.754745",
"0.7529227",
"0.75119966",
"0.7342822",
"0.7332697",
"0.73181266",
"0.7220838",
"0.7184737",
"0.70862716",
"0.7071792",
"0.70238763",
"0.6976387",
"0.6966503",
... | 0.0 | -1 |
TODO working on creating stats by standards On the CUR section you were able to view how many times a specific type of breach occurred, could we have the same feature but rather than the breach, have it be a tally of the standards that happened in a conference for each individual kid? | def standards_counts
standards = {}
standards.default(0)
self.breaches.each do |b|
standards[b.subject] += 1
end
return standards
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def offense_counts; end",
"def offense_counts; end",
"def agency_abv; end",
"def claim_type_weight\n is_industry_code_configured = facility.industry_code_configured?\n remark_codes = []\n rcc = ReasonCodeCrosswalk.new(payer, nil, client, facility)\n if claim_level_eob?\n crosswalked_codes = ... | [
"0.6038592",
"0.6038592",
"0.58638287",
"0.578923",
"0.57156575",
"0.57022625",
"0.5670867",
"0.5622374",
"0.56183827",
"0.55914897",
"0.55914897",
"0.55860835",
"0.5577528",
"0.5575387",
"0.5566044",
"0.54943866",
"0.54881686",
"0.54694885",
"0.54676867",
"0.54676867",
"0.54... | 0.6319341 | 0 |
Compare operator compare the base 10 values | def <=>(other)
other.value <=> value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compare(left, right)\n left_right = left.to_s + right.to_s\n right_left = right.to_s + left.to_s\n left_right.to_i > right_left.to_i\nend",
"def compare(register, value)\n val = read(value)\n base = read(register)\n write(:comparison, base - val)\n nil\n end",
"def pal_b10?(num)\n... | [
"0.6551951",
"0.60871506",
"0.60391295",
"0.59096295",
"0.58789647",
"0.5857071",
"0.5815814",
"0.57890123",
"0.57159674",
"0.5705426",
"0.56807923",
"0.56610954",
"0.56497216",
"0.5642826",
"0.56373787",
"0.5633315",
"0.56255305",
"0.560015",
"0.55949396",
"0.55821717",
"0.5... | 0.0 | -1 |
Calculates the sum of base 10 values for the array of genes. | def value
genes.inject(0){ |memo, g| memo += g.to_i(16) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def summing_method\n @summed_array = @single_digit_array.sum\n end",
"def digit_sum(array)\n array.map { |n| n >= 10 ? n / 10 + n % 10 : n }\n end",
"def sum_digits(array)\n return array.inject(:+) #explanation? combines all elements of array by applying binary operation, same as reduce\n # arra... | [
"0.63401365",
"0.6296024",
"0.62741977",
"0.62360036",
"0.6226445",
"0.61473167",
"0.61224365",
"0.6120568",
"0.6109902",
"0.6061272",
"0.6049901",
"0.6040603",
"0.6031908",
"0.6031908",
"0.6027577",
"0.60133135",
"0.6011054",
"0.6011054",
"0.6007087",
"0.60033435",
"0.600330... | 0.6541297 | 0 |
creates a random set of genes | def randomize!(genecount = 10)
genecount.times.each { self << Chromosome.rand_hex }
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate\n index = (rand * length).floor\n genes[index] = Chromosome.rand_hex\n end",
"def init_population\n (0...@pop_size).each do\n chromosome = Chromosome.new\n (0...@num_genes).each do |_i|\n gene = rand 0..1\n chromosome << gene\n end\n evaluate_chromosome chro... | [
"0.65486884",
"0.64634794",
"0.6325759",
"0.63248587",
"0.6254843",
"0.6181959",
"0.6160793",
"0.6160654",
"0.6158539",
"0.61347336",
"0.6102743",
"0.60942733",
"0.60533535",
"0.605256",
"0.60499024",
"0.6039959",
"0.6027821",
"0.60214657",
"0.6014378",
"0.60094374",
"0.59888... | 0.6884084 | 0 |
gene at the supplied index value | def [](index)
genes[index]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def []=(index, value)\n genes[index] = value\n end",
"def set_gene\n @gene = Gene.find(params[:id])\n end",
"def index\n @genes = Gene.all\n end",
"def show_casilla(i)\n return @genes[i]\n end",
"def get_gene(ensembl_version=55) \n if self.source_name == \"ENSEMBLGENE\"\n ... | [
"0.6590914",
"0.6437992",
"0.61174613",
"0.605805",
"0.6039434",
"0.60034424",
"0.59042007",
"0.5827186",
"0.5759952",
"0.57573724",
"0.5709889",
"0.56982857",
"0.56726027",
"0.56357455",
"0.5597725",
"0.5581546",
"0.5579161",
"0.55735004",
"0.5557028",
"0.55306375",
"0.55212... | 0.7307105 | 0 |
length represents the length of the gene array. | def length
genes.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length\n end",
"def length\n @length\n end",
"def length\n @length\n end",
"def length\n @length\n end",
"def length\n array.first.size\n end",
"def length() end",
"def length() end",
"def length() end",
"def length() end",
"def length\n end",
"def leng... | [
"0.73411345",
"0.7326865",
"0.7326865",
"0.7326865",
"0.7294303",
"0.7286409",
"0.7286409",
"0.7286409",
"0.7286409",
"0.7279179",
"0.72556233",
"0.72556233",
"0.72556233",
"0.72556233",
"0.72556233",
"0.72556233",
"0.72556233",
"0.723392",
"0.72093",
"0.71747494",
"0.7174749... | 0.7982763 | 0 |
set the gene at the supplied index value | def []=(index, value)
genes[index] = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(index, val)\n \n end",
"def set(index, value)\n @local_index.set(index, value)\n end",
"def set_index(index)\n @index = index\n end",
"def set_value(new_value, index)\n update_tag(index, new_value)\n end",
"def set(index, element)\n node_at_index = get(index)\n n... | [
"0.7067346",
"0.70020044",
"0.6986593",
"0.68473876",
"0.6816075",
"0.6815801",
"0.67974645",
"0.6689706",
"0.6641058",
"0.6620467",
"0.6593373",
"0.6526477",
"0.65237904",
"0.65115124",
"0.65029806",
"0.6496822",
"0.6419641",
"0.637152",
"0.63591653",
"0.63331527",
"0.630424... | 0.7622192 | 0 |
Exchange genetic material with another chromosome. The strategy is to loop through the gene arrays of this and the other chromosome and randomly exchange at the gene level | def reproduce_with(other)
c = Chromosome.new
self.length.times do |i|
c << ((rand > 0.5) ? self[i] : other[i])
end
c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mutate_matingpool\n (0...@mating_pool.size).each do |i|\n j = rand 0...@num_genes\n chromosome = @mating_pool[i].clone\n gene = chromosome[j]\n gene = gene.zero? ? 1 : 0\n chromosome[j] = gene\n @new_generation << chromosome\n end\n end",
"def mixgenes( mgenes, sgenes ) ... | [
"0.65686566",
"0.6516943",
"0.642419",
"0.6380645",
"0.5997079",
"0.59407234",
"0.5830158",
"0.58297867",
"0.5818945",
"0.5756339",
"0.5724635",
"0.5712562",
"0.5705083",
"0.5697461",
"0.56702685",
"0.5662818",
"0.5589546",
"0.5585593",
"0.55790585",
"0.55641615",
"0.5537081"... | 0.66407454 | 0 |
Change one of the genes to a random value. | def mutate
index = (rand * length).floor
genes[index] = Chromosome.rand_hex
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random= rnd\n @sampling.random = rnd\n end",
"def random= rnd \n @random = rnd\n @codon.random = rnd\n end",
"def random= rnd \n @random = rnd\n @codon.random = rnd\n end",
"def random= rnd \n @random = rnd\n @codon.random = rnd\n end",
"def mutation(chromosome)... | [
"0.6990259",
"0.69720846",
"0.69720846",
"0.690572",
"0.6827114",
"0.67467755",
"0.67407465",
"0.67106867",
"0.67106867",
"0.67106867",
"0.67106867",
"0.6684861",
"0.6684861",
"0.6562858",
"0.65436316",
"0.6499886",
"0.6462156",
"0.6436556",
"0.64318913",
"0.64318913",
"0.641... | 0.7344187 | 0 |
Restituisce l'utente attualmente loggato | def current_user
if (user_id = session[:user_id])
@current_user ||= User.find(user_id)
elsif (user_id = cookies.signed[:user_id])
user = User.find(user_id)
if user && user.authenticated?(:remember, cookies[:remember_token])
log_in user
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def loggin_opc(puser, pcontroller, paction, pcomment)\n #para que no haga logging de clicks de navegacion\n if pcontroller == 'home'\n\t\treturn\n else\n\t logmodel = Logeclubapi.new\n\t logmodel.login = puser.login\n\t logmodel.username = puser.name\n\t logmodel.log_option = pcontroller\n\t logmod... | [
"0.60975677",
"0.59247863",
"0.5774334",
"0.574943",
"0.5733063",
"0.55882007",
"0.5538579",
"0.5514979",
"0.55121255",
"0.54797035",
"0.54797035",
"0.5474335",
"0.5461849",
"0.54432255",
"0.54248244",
"0.5416945",
"0.5412211",
"0.5401857",
"0.5399291",
"0.53779155",
"0.53652... | 0.0 | -1 |
Elimina le informazioni sull'utente loggato | def log_out
session.delete(:user_id)
@current_user = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_log\n unless UserSession.find == nil\n Log.create(user_id: UserSession.find.user.id, message: \n \"#{UserSession.find.user.name} har slettet rollen: #{self.name}\",\n logtype_id: 3)\n end\n end",
"def destroy\n if autenticacion == \"admin\"\n @log_pelea_guilty = LogPeleaGuilty.f... | [
"0.61295867",
"0.6045504",
"0.59359175",
"0.5900821",
"0.58913726",
"0.5843151",
"0.58091146",
"0.57788163",
"0.5775362",
"0.574453",
"0.57403296",
"0.5710064",
"0.5599074",
"0.5572647",
"0.55385494",
"0.55343515",
"0.553053",
"0.55250406",
"0.55101687",
"0.5499783",
"0.54975... | 0.0 | -1 |
Memorizza l'utente in una sessione permanente | def remember(user)
user.remember
cookies.permanent.signed[:user_id] = user.id
cookies.permanent[:remember_token] = user.remember_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup\n session[:user_id]=1\n end",
"def iniciarSesion (email,nombre,apellido,id)\n session[:email] = email\n session[:nombre] = nombre\n session[:apellido] = apellido\n session[:id] = id\n @persona = Persona.find(id)\n if !(@persona.empleados_id.nil?)\n session[:rol] = @persona.em... | [
"0.6707288",
"0.6632033",
"0.64855826",
"0.6439575",
"0.6417751",
"0.6417495",
"0.6370589",
"0.63674754",
"0.6344193",
"0.6266765",
"0.6247271",
"0.6238225",
"0.61961615",
"0.61724496",
"0.6167029",
"0.61597484",
"0.61597484",
"0.61597484",
"0.61597484",
"0.6143345",
"0.61427... | 0.0 | -1 |
Cancella la sessione permanente memorizzata in precedenza | def forget(user)
user.forget
cookies.delete(:user_id)
cookies.delete(:remember_token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def abandon!\n @user = nil\n session.clear\n end",
"def cancelar_hipoteca\n @hipotecada = false\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def abandon!\n @user = nil\n session.delete\n end",
"def canceladd\n @session['groupcluster']=nil\n... | [
"0.6695105",
"0.6608125",
"0.65657866",
"0.65657866",
"0.62843823",
"0.62676615",
"0.6245159",
"0.624498",
"0.624498",
"0.61749893",
"0.61749893",
"0.61749893",
"0.6096864",
"0.6093329",
"0.6093329",
"0.6093329",
"0.6093329",
"0.6093329",
"0.6093329",
"0.6093329",
"0.6093329"... | 0.0 | -1 |
Memorizza l'ultimo messaggio letto da un utente, in modo da caricare nel gruppo solo i messaggi nuovi | def set_last_message_read(group, time)
cookies.permanent[create_last_message_key(current_user, group)] = time
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mess\r\n\t\t@usr_mess\r\n\tend",
"def message_body from_user\n if from_user.musician?\n message_body = \"#{from_user.name} desea unirse al grupo.\"\n message_body += \"<br><br>\"\n message_body += \"Si deseas añadirle al grupo pulsa en el siguiente botón:\"\n message_body += \"<br><br>... | [
"0.651272",
"0.65032125",
"0.6384986",
"0.6267416",
"0.60008717",
"0.5947176",
"0.5912612",
"0.5906519",
"0.59058595",
"0.5898302",
"0.5862303",
"0.58393115",
"0.5832842",
"0.5802736",
"0.57391506",
"0.57350606",
"0.5731936",
"0.57227093",
"0.5706821",
"0.5693512",
"0.5682876... | 0.0 | -1 |
Restituisce il DateTime dell'ultimo messaggio letto Se non esiste alcun cookie, restituisce ieri come ultimo messaggio letto | def get_last_message_read(group)
unless cookies[create_last_message_key(current_user, group)].nil?
cookies[create_last_message_key(current_user, group)].to_datetime
else
DateTime.now - 1.day
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_last_message_cookies(user, group, time)\n cookies[user.id.to_s + group.uuid] = time\n end",
"def date_time\n @message[:date_time]\n end",
"def set_last_message_read(group, time)\n cookies.permanent[create_last_message_key(current_user, group)] = time\n end",
"def date_sent\n (@da... | [
"0.62131566",
"0.6176919",
"0.5873104",
"0.5858792",
"0.58168846",
"0.57718915",
"0.56284416",
"0.561186",
"0.5579605",
"0.5560515",
"0.55459774",
"0.553615",
"0.553615",
"0.547279",
"0.54715246",
"0.5458631",
"0.5455195",
"0.5447533",
"0.5447533",
"0.5426061",
"0.5423169",
... | 0.61078125 | 2 |
Crea la chiave per il cookie del last message read | def create_last_message_key(user, group)
user.id.to_s + group.uuid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_last_message_cookies(user, group, time)\n cookies[user.id.to_s + group.uuid] = time\n end",
"def set_last_message_read(group, time)\n cookies.permanent[create_last_message_key(current_user, group)] = time\n end",
"def get_last_message_read(group)\n unless cookies[create_last_messag... | [
"0.7035098",
"0.68186355",
"0.63802284",
"0.6346313",
"0.6346313",
"0.6346313",
"0.62430996",
"0.61113924",
"0.60501033",
"0.6032395",
"0.59942234",
"0.5986277",
"0.5976898",
"0.592441",
"0.59222895",
"0.58662844",
"0.5860737",
"0.584489",
"0.583803",
"0.5828093",
"0.58244044... | 0.0 | -1 |
Verifica che un utente sia effettivamente loggato | def logged_in_user
unless logged_in?
store_location
flash[:danger] = "Per compiere quest'azione è necessario effettuare login"
redirect_to login_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged?; false end",
"def logged?; false end",
"def ha_accedido?\n\t\t!usuario_actual.nil?\n\tend",
"def logado?\n !admin_atual.nil?\n end",
"def logged_in?\n !current_utente.nil?\n end",
"def logado?\n !current_user.nil?\n end",
"def session_check\n return if (t_last = last_operat... | [
"0.6204271",
"0.6204271",
"0.6123889",
"0.6080432",
"0.6072455",
"0.5954905",
"0.5924252",
"0.5860549",
"0.58492064",
"0.58391607",
"0.58352697",
"0.58006954",
"0.5775477",
"0.5747104",
"0.5714905",
"0.5677557",
"0.56674165",
"0.56399095",
"0.56287956",
"0.56219983",
"0.56116... | 0.0 | -1 |
Memorizzo l'URL richiesta: in questo modo, posso fare una friendly forwarding | def store_location
session[:forwarding_url] = request.original_fullpath if request.get?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generic_url_rewriter \n env = Request.new(:method => :get, :url => Steam.config[:request_url]).env\n UrlRewriter.new(ActionController::Request.new(env), {})\n end",
"def generic_url_rewriter \n env = Request.env_for('http://localhost')\n UrlRewriter.new(ActionContro... | [
"0.69822425",
"0.68868935",
"0.68540156",
"0.67181605",
"0.67181605",
"0.67181605",
"0.67181605",
"0.67181605",
"0.67181605",
"0.67181605",
"0.66971457",
"0.66247886",
"0.6585272",
"0.65739733",
"0.6543573",
"0.65197486",
"0.6474503",
"0.6466216",
"0.64558226",
"0.6450072",
"... | 0.0 | -1 |
Confronta user con l'utente corrente | def current_user?(user)
user == current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_usuario\n \n end",
"def connect\n \t\t#Se sigue la convencion para la identificacion del usuario\n \t\t#y buscamos alusuario que se intenta conectar\n \t\tself.current_user = find_user\n \tend",
"def set_user; end",
"def convidar\n @compra = Compra.find(params[:compra_id])\n\n if param... | [
"0.71331203",
"0.6984941",
"0.6936377",
"0.65930265",
"0.6572009",
"0.65605134",
"0.6524337",
"0.6499261",
"0.6471225",
"0.646882",
"0.6456631",
"0.64539886",
"0.6443625",
"0.6405726",
"0.63933426",
"0.6353266",
"0.63493305",
"0.63278496",
"0.6321842",
"0.62977237",
"0.629457... | 0.0 | -1 |
Verifica che l'utente loggato sia effettivamente il bersaglio dell'azione Vogliamo impedire che un altro utente modifichi senza permessi informazioni di utenti diversi tramite url create ad hoc | def correct_user(id)
@user = User.find(id)
unless current_user? @user
flash[:danger] = "Azione non autorizzata"
redirect_to groups_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def con_obra?(url)\n # los /obra/new tienen una obra que todavía no existe seteada\n if @obra.try :persisted?\n obra_path(@obra) + url\n else\n url\n end\n end",
"def logado?\n !admin_atual.nil?\n end",
"def user_logged_in_sin_hogar\n\n\t\t redirect_to new_direccion_path if logged_i... | [
"0.62087405",
"0.5612872",
"0.56060445",
"0.56057626",
"0.559262",
"0.54977494",
"0.5439935",
"0.5432846",
"0.53981197",
"0.5375816",
"0.53278744",
"0.53258014",
"0.5315352",
"0.5268464",
"0.5266913",
"0.52004176",
"0.5199422",
"0.5195389",
"0.5141695",
"0.51394105",
"0.51373... | 0.0 | -1 |
Verifica che l'utente loggato sia un membro del gruppo | def is_member_in(group)
unless group.members.include? current_user
flash[:danger] = "Devi essere un membro per accedere ad un gruppo ed alle sue informazioni"
redirect_to groups_path
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in?\n !current_utente.nil?\n end",
"def ldap_agrega_membresia(ldap, nusuario, grupos, prob)\n grupos.each do |g|\n dn=\"cn=#{g},#{Rails.application.config.x.jn316_basegrupos}\"\n unless ldap.add_attribute(dn, 'memberUid', nusuario)\n prob << ldap.get_operation_result.co... | [
"0.62041926",
"0.6160863",
"0.6127466",
"0.61096674",
"0.6109031",
"0.60799986",
"0.6004037",
"0.5933424",
"0.5927213",
"0.589841",
"0.5878735",
"0.58002603",
"0.577059",
"0.5768853",
"0.5758362",
"0.572083",
"0.57101035",
"0.57097894",
"0.57092226",
"0.5684554",
"0.56791097"... | 0.6146911 | 2 |
Verifica che l'utente loggato sia un amministratore del gruppo | def is_admin_in(group)
unless group.admins.include? current_user
flash[:danger] = "Devi essere un amministratore per eseguire questa azione"
redirect_to group_path(uuid: group.uuid)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def logged_in?\n !current_utente.nil?\n end",
"def logado?\n !admin_atual.nil?\n end",
"def isRegistado?\n if session[:perm] == 0\n return true;\n else\n return false;\n end\n end",
"def gadz_ans\n (user.gadz_proms_principale.to_i - 1800).to_s\n end",
"def should_register_go... | [
"0.5596975",
"0.558649",
"0.5503173",
"0.549595",
"0.5476473",
"0.54469085",
"0.53271645",
"0.53125477",
"0.53060216",
"0.5304613",
"0.52636135",
"0.5254157",
"0.5253452",
"0.5231022",
"0.52033216",
"0.51889056",
"0.51582634",
"0.5153388",
"0.5109893",
"0.51095736",
"0.510750... | 0.0 | -1 |
Verifica che l'utente loggato sia il fondatore del gruppo | def is_super_admin_in(group)
unless group.super_admin == current_user
flash[:danger] = "Devi essere il fondatore per eseguire questa azione"
redirect_to group_path(uuid: group.uuid)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verifica_logado\n sleep(3)\n if @browser.table(:class, \"f\").exist? == true\n if @browser.table(:class, \"f\").contains_text(\"©2011 Google\")\n @browser.text_field(:name, 'Email').set($login_user)\n if ENV['FIREWATIR']\n @browser.text_field(:name, \"Passwd\").set($password_user)\n ... | [
"0.6105704",
"0.59041756",
"0.58937883",
"0.58601195",
"0.5814968",
"0.5657856",
"0.54973066",
"0.5462465",
"0.54437244",
"0.5424535",
"0.54087627",
"0.5408424",
"0.53983027",
"0.5379986",
"0.5379945",
"0.5364513",
"0.53516024",
"0.532176",
"0.531829",
"0.53063047",
"0.530626... | 0.0 | -1 |
notice it needs to be called after the general authenticate_user! method. | def authenticate_admin!
unless current_user.admin?
flash[:danger] = "Sorry, you don't have premissions for this action."
redirect_to root_path
else
true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def successful_authentication(user)\n set_brute_force_counter(user, 0)\n super\n end",
"def after_custom_authentication; end",
"def after_custom_authentication\n\n end",
"def authenticate_user\n render_403 'Invalid user.' if @user.blank? || !@user.active?\n end",
"def authenticate_user!... | [
"0.7652696",
"0.74794596",
"0.72862375",
"0.71898115",
"0.71844804",
"0.7164362",
"0.71605986",
"0.7096344",
"0.7090032",
"0.704602",
"0.7039026",
"0.70214397",
"0.6971312",
"0.6943818",
"0.6924584",
"0.6920136",
"0.6920091",
"0.69106483",
"0.6894601",
"0.68941426",
"0.688921... | 0.0 | -1 |
Class method to get the sidebar items from this module, in the context of the given controller instance. | def get_sidebar_items(controller)
return [] unless sidebar_proc
controller.instance_exec(&sidebar_proc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sidebar_items\n @sidebar_items ||= []\n end",
"def add_sidebar_widgets\n view_context.render \"shared/widgets\", :context => 'mainlist', :position => 'sidebar'\n end",
"def sidebar\n @sidebar ||= find_page('Sidebar', :with_redirect => false)\n end",
"def sidebar(&block)\n content_for :side... | [
"0.70728564",
"0.60267514",
"0.59802157",
"0.58734345",
"0.5841159",
"0.56100804",
"0.55875564",
"0.55654603",
"0.5527614",
"0.5526238",
"0.55232203",
"0.550863",
"0.5466576",
"0.5440007",
"0.5399544",
"0.5386898",
"0.5380368",
"0.5369669",
"0.53598404",
"0.5349182",
"0.53449... | 0.8397493 | 0 |
Class method to get the settings items from this module, in the context of the given controller instance. | def get_settings_items(controller)
return [] unless settings_proc
controller.instance_exec(&settings_proc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def settings\n @settings_manager\n end",
"def get_settings\n settings.get\n end",
"def management_interface_settings\r\n ManagementInterfaceSettingsController.instance\r\n end",
"def alert_settings\r\n AlertSettingsController.instance\r\n end",
"def index\n get_se... | [
"0.66919667",
"0.6666536",
"0.6546497",
"0.65318674",
"0.6504905",
"0.6504847",
"0.6498531",
"0.6498531",
"0.64883995",
"0.64883995",
"0.6487721",
"0.6481671",
"0.6461068",
"0.64137363",
"0.6405918",
"0.6367647",
"0.63062334",
"0.62630284",
"0.6252634",
"0.62461776",
"0.62233... | 0.81751704 | 0 |
Defines a default doctype string that should be at the top of most plist files. Useful if we need to modify an invalid doctype string in memory. I'm looking at you, /System/Library/LaunchDaemons/org.ntp.ntpd.plist, you bastard. | def plist_xml_doctype
'<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def doctype(name, pub_sys, long_name, uri)\r\n # Don't care about doctypes\r\n end",
"def doctype; end",
"def doctype_to_format(doctype)\n { \"ar\" => \"Article\",\n \"bk\" => \"Book\",\n \"bz\" => \"Article\",\n \"re\" => \"Article\", # most of what scopus labels 'Report' s... | [
"0.5713454",
"0.5536912",
"0.54024744",
"0.53220624",
"0.5211661",
"0.5125789",
"0.5111313",
"0.5026645",
"0.49701154",
"0.48963806",
"0.48643208",
"0.48498905",
"0.4840156",
"0.4792355",
"0.4724929",
"0.46811715",
"0.4671736",
"0.46526912",
"0.46309578",
"0.46309176",
"0.460... | 0.60574186 | 0 |
Read a plist, whether its format is XML or in Apple's "binary1" format, using the CFPropertyList gem. | def read_plist_file(file_path)
bad_xml_doctype = /^.*<!DOCTYPE plist PUBLIC -\/\/Apple Computer.*$/
# We can't really read the file until we know the source encoding in
# Ruby 1.9.x, so we use the magic number to detect it.
# NOTE: We need to use IO.read to be Ruby 1.8.x compatib... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_plist(bundle, path)\n data = bundle.storage.open(path, &:read)\n plist = CFPropertyList::List.new(data: data)\n CFPropertyList.native_types(plist.value)\n end",
"def parse_plist(path)\n plist_file_path = self.plist(path)\n if plist_file_path.present?\n Plist.parse_xm... | [
"0.737727",
"0.67061955",
"0.6431006",
"0.6402337",
"0.6172027",
"0.61197037",
"0.59752244",
"0.5917939",
"0.581365",
"0.57488704",
"0.57410353",
"0.5629543",
"0.5560199",
"0.55025196",
"0.54901886",
"0.54852724",
"0.5441831",
"0.5441348",
"0.5437416",
"0.53337735",
"0.521716... | 0.75629526 | 0 |
This method will write a plist file using a specified format (or XML by default) | def write_plist_file(plist, file_path, format='xml')
if format == 'xml'
plist_format = CFPropertyList::List::FORMAT_XML
else
plist_format = CFPropertyList::List::FORMAT_BINARY
end
begin
plist_to_save = CFPropertyList::List.new
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_plist(path)\n File.open(path, 'w') do |file|\n file.puts \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\"?>\"\n file.puts \"<!DOCTYPE plist PUBLIC \\\"-//Apple//DTD PLIST 1.0//EN\\\" \\\"http://www.apple.com/DTDs/PropertyList-1.0.dtd\\\">\"\n file.puts \"<plist version=\\\"1.... | [
"0.7376579",
"0.69030017",
"0.69030017",
"0.6894645",
"0.6151582",
"0.6051728",
"0.604617",
"0.58017224",
"0.5765694",
"0.570076",
"0.5629095",
"0.562008",
"0.5572782",
"0.55335194",
"0.55214137",
"0.55013114",
"0.54828155",
"0.5482699",
"0.5479473",
"0.54778576",
"0.5470292"... | 0.85347927 | 0 |
The currently logged in user, or nil if there is no user logged in. | def current_user
@current_user ||= User.find_by_id(session[:user_id]) if session[:user_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_user\n if session[:user_id]\n User.find(session[:user_id])\n else\n nil\n end\n end",
"def current_user\n if session[:user_id]\n return @user ||= User.find(session[:user_id]['$oid'])\n else\n return nil\n end\n end",
"def current_user\... | [
"0.88651514",
"0.8851025",
"0.87287164",
"0.8656433",
"0.85934186",
"0.85934186",
"0.85934186",
"0.85934186",
"0.85355806",
"0.84999645",
"0.8477338",
"0.84188217",
"0.84188217",
"0.8406229",
"0.84039915",
"0.8399874",
"0.838559",
"0.83810246",
"0.83658427",
"0.8338377",
"0.8... | 0.8219784 | 59 |
Determine if a user is currently logged in. | def signed_in?
!!current_user
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user_is_logged_in()\n user = get_user()\n if user != nil\n true\n else\n false\n end\n end",
"def logged_in?\n return session['current_user']\n end",
"def logged_in?\n current_user.present?\n end",
"def logged_in?\n\t\t\tcurrent_user.is_a? User\n\t\tend",
"def... | [
"0.86326355",
"0.85376924",
"0.8399596",
"0.83991915",
"0.83858144",
"0.8360282",
"0.8328057",
"0.8328057",
"0.8312069",
"0.8312069",
"0.83086514",
"0.83086514",
"0.82998055",
"0.8282226",
"0.8278931",
"0.82780474",
"0.8276238",
"0.82694954",
"0.8249515",
"0.8249515",
"0.8249... | 0.0 | -1 |
load some recent test runs on dashboard page | def testrun_summary(from_time = nil, only_schedules = false, root_url = '', current_date_time = nil)
content = ''
if from_time.nil?
if current_date_time.nil?
runs = Run.order(updated_at: :desc).limit(5)
else
current_date_time_start = current_date_time.in_time_zone.beginning_of_day
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @test_runs = TestRun.accessible_by(current_ability).order(\"updated_at DESC\").page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @test_runs }\n end\n end",
"def homepage_load(count=1)\n \tfor i in 0..count\n\t puts \"#Tr... | [
"0.64771897",
"0.6458586",
"0.64025015",
"0.6399877",
"0.6319979",
"0.6244606",
"0.6164898",
"0.6142764",
"0.6057122",
"0.6052883",
"0.59751743",
"0.5967456",
"0.59168166",
"0.59082997",
"0.59054834",
"0.5878836",
"0.5864031",
"0.5830424",
"0.58302945",
"0.5813905",
"0.581066... | 0.0 | -1 |
GET /foo13s or /foo13s.json | def index
@foo13s = Foo13.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def get_aos_version_by_name(args = {}) \n... | [
"0.60390604",
"0.59212595",
"0.5886825",
"0.5852177",
"0.58390486",
"0.5815525",
"0.57485265",
"0.5628399",
"0.55995196",
"0.5595044",
"0.5590858",
"0.5561233",
"0.55483884",
"0.55371606",
"0.55325013",
"0.5509428",
"0.54914033",
"0.5488988",
"0.5473289",
"0.5459243",
"0.5459... | 0.0 | -1 |
GET /foo13s/1 or /foo13s/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def get(pa... | [
"0.6290361",
"0.6201034",
"0.60682875",
"0.5932247",
"0.5872188",
"0.5799527",
"0.5747892",
"0.5668366",
"0.5658343",
"0.5648623",
"0.56353366",
"0.56353366",
"0.56016666",
"0.560164",
"0.55494916",
"0.5546047",
"0.55407053",
"0.5539256",
"0.5520664",
"0.5511358",
"0.5492316"... | 0.0 | -1 |
POST /foo13s or /foo13s.json | def create
@foo13 = Foo13.new(foo13_params)
respond_to do |format|
if @foo13.save
format.html { redirect_to @foo13, notice: "Foo13 was successfully created." }
format.json { render :show, status: :created, location: @foo13 }
else
format.html { render :new, status: :unprocess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, **args); end",
"def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend",
"def api_gateway_post(path, params)\n api_gateway_body_fwd = params.to_json\n rack_input = StringIO.new(api_gateway_body_fwd)\n\n post path,... | [
"0.6349352",
"0.5899584",
"0.5834412",
"0.5826504",
"0.58209556",
"0.58120596",
"0.5798987",
"0.5752936",
"0.57469904",
"0.57463974",
"0.57391745",
"0.5738888",
"0.5734732",
"0.57332766",
"0.56903195",
"0.5689421",
"0.5673383",
"0.56512976",
"0.56499046",
"0.56434846",
"0.564... | 0.57146084 | 14 |
PATCH/PUT /foo13s/1 or /foo13s/1.json | def update
respond_to do |format|
if @foo13.update(foo13_params)
format.html { redirect_to @foo13, notice: "Foo13 was successfully updated." }
format.json { render :show, status: :ok, location: @foo13 }
else
format.html { render :edit, status: :unprocessable_entity }
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end",
"def update\n respond_to do |format|\n if @foo83.update(foo83_params)\n format.html { redirect_to @foo83, notice: \"Foo83 was successfully updated.\" }\n format.json { render :show, status: :ok, locati... | [
"0.62916225",
"0.6268305",
"0.6248729",
"0.62403613",
"0.622347",
"0.62072736",
"0.6204161",
"0.6181859",
"0.61401623",
"0.6133358",
"0.61246115",
"0.6117025",
"0.6104386",
"0.6104171",
"0.60974836",
"0.609065",
"0.6085722",
"0.60833955",
"0.6077451",
"0.6066147",
"0.6065607"... | 0.63217425 | 0 |
DELETE /foo13s/1 or /foo13s/1.json | def destroy
@foo13.destroy
respond_to do |format|
format.html { redirect_to foo13s_url, notice: "Foo13 was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(*rest) end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def destroy\n @foo54.destro... | [
"0.710079",
"0.65810776",
"0.64725584",
"0.64391196",
"0.6395963",
"0.6394577",
"0.63762504",
"0.6362284",
"0.6335567",
"0.63192433",
"0.6318444",
"0.6311996",
"0.6297733",
"0.6289503",
"0.6289503",
"0.6289182",
"0.62863123",
"0.62846977",
"0.62821865",
"0.62775654",
"0.62661... | 0.6408342 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_foo13
@foo13 = Foo13.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def foo13_params
params.require(:foo13).permit(:foo1, :foo2, :foo3, :foo4, :foo5)
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 |
Regresa un numero de cuenta si exite dentro del string y nil en el caso contrario. | def existencia_number(string)
if /(\d{4})-(\d{3})-(\d{3})$/ =~ string
p string
else
nil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def number_or_nil(string)\n num = string.to_i\n num if num.to_s == string\n end",
"def number_acount(string)\r\n \"Número de cuenta: #{string}\" if string =~ /\\d{4}-?\\d{3}-?\\d{3}/\r\nend",
"def num_to_nil(string)\n Integer(string || '')\n return nil\n rescue ArgumentError\n return ... | [
"0.6673569",
"0.64142805",
"0.63842833",
"0.62351424",
"0.5848202",
"0.57417953",
"0.5690582",
"0.56798977",
"0.56474316",
"0.56337655",
"0.5614369",
"0.55707425",
"0.5557182",
"0.5498285",
"0.54388297",
"0.54297495",
"0.5426007",
"0.541938",
"0.5417547",
"0.5404255",
"0.5394... | 0.5441801 | 14 |
a simplified version of the fucked up shit that allows you to call instance methods as though they were class methods in ActionMailer. TS | def method_missing(method_name, *args)
if public_instance_methods.include? method_name
new.send(method_name, *args)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Method\n ClassMailer.Method\n end",
"def method_missing(method, *args, &block)\n if instance_methods.include?(method)\n mailer = new\n mailer.send(method, *args, &block)\n mailer\n else\n super\n end\n end",
"def method_missi... | [
"0.72179484",
"0.68394285",
"0.64598507",
"0.6399273",
"0.6190056",
"0.61266756",
"0.610574",
"0.5968154",
"0.5860745",
"0.58589107",
"0.5836505",
"0.5813185",
"0.5765965",
"0.5744433",
"0.5743037",
"0.5734175",
"0.57104665",
"0.5684",
"0.5661548",
"0.5660205",
"0.563908",
... | 0.0 | -1 |
Return all the guard squads which is not yet annihilated or escaped. | def active_guard_squads
active_guard_squads = Array.new
guard_mission.squads.each do |squad|
active_guard_squads << squad if squad.entried and not squad.annihilated? and not squad.retreated_from_fortress
end
return active_guard_squads
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trial_guard_squads\n guard_squads = Array.new\n trial_squads.each do |trial_squad|\n guard_squads << trial_squad unless trial_squad.intruder_flg\n end\n guard_squads\n end",
"def active_squads\n return active_guard_squads + active_intruder_squads\n end",
"def active_intruder_squads\n ... | [
"0.7154978",
"0.63167673",
"0.6116607",
"0.59962606",
"0.5632953",
"0.5568331",
"0.54895973",
"0.5461422",
"0.54522276",
"0.5427155",
"0.5397761",
"0.53409046",
"0.53148586",
"0.52959484",
"0.5249789",
"0.52343625",
"0.5222573",
"0.5218262",
"0.52032423",
"0.51943296",
"0.518... | 0.70744836 | 1 |
Return all the intruder squads which is not yet annihilated or escaped. | def active_intruder_squads
active_intruder_squads = Array.new
intruder_mission.squads.each do |squad|
active_intruder_squads << squad if squad.entried and not squad.annihilated? and not squad.retreated_from_fortress
end
return active_intruder_squads
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trial_intruder_squads\n intruder_squads = Array.new\n trial_squads.each do |trial_squad|\n intruder_squads << trial_squad if trial_squad.intruder_flg\n end\n intruder_squads\n end",
"def active_squads\n return active_guard_squads + active_intruder_squads\n end",
"def trial_guard_squad... | [
"0.7285239",
"0.6757351",
"0.6641635",
"0.6237035",
"0.5421609",
"0.5358137",
"0.52820927",
"0.5248065",
"0.5149953",
"0.5133203",
"0.51108664",
"0.5094777",
"0.50335",
"0.50260186",
"0.5025469",
"0.5025469",
"0.5025469",
"0.5017028",
"0.4985681",
"0.49555877",
"0.49327096",
... | 0.75652105 | 0 |
Return all the squads which is not yet annihilated or escaped. | def active_squads
return active_guard_squads + active_intruder_squads
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def trial_guard_squads\n guard_squads = Array.new\n trial_squads.each do |trial_squad|\n guard_squads << trial_squad unless trial_squad.intruder_flg\n end\n guard_squads\n end",
"def active_intruder_squads\n active_intruder_squads = Array.new\n intruder_mission.squads.each do |squad|\n ... | [
"0.64437634",
"0.6322927",
"0.6301739",
"0.6226295",
"0.5752037",
"0.5635277",
"0.5631884",
"0.5530993",
"0.5482723",
"0.54687154",
"0.54626083",
"0.5461458",
"0.5459453",
"0.5459453",
"0.54555357",
"0.5449467",
"0.5425093",
"0.5405241",
"0.53473467",
"0.5320959",
"0.5315891"... | 0.6482934 | 0 |
Return all the guard squads from TrialSquad. | def trial_guard_squads
guard_squads = Array.new
trial_squads.each do |trial_squad|
guard_squads << trial_squad unless trial_squad.intruder_flg
end
guard_squads
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_guard_squads\n active_guard_squads = Array.new\n guard_mission.squads.each do |squad|\n active_guard_squads << squad if squad.entried and not squad.annihilated? and not squad.retreated_from_fortress\n end\n return active_guard_squads\n end",
"def trial_intruder_squads\n intruder_s... | [
"0.7882383",
"0.70591027",
"0.662957",
"0.6495939",
"0.64670545",
"0.58733094",
"0.56038606",
"0.5470687",
"0.54618657",
"0.5355092",
"0.52676237",
"0.5209061",
"0.51360476",
"0.50829667",
"0.5070965",
"0.5054307",
"0.5043807",
"0.5023976",
"0.5018392",
"0.4915903",
"0.490039... | 0.78773373 | 1 |
Return all the guard squads from TrialSquad. | def trial_intruder_squads
intruder_squads = Array.new
trial_squads.each do |trial_squad|
intruder_squads << trial_squad if trial_squad.intruder_flg
end
intruder_squads
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_guard_squads\n active_guard_squads = Array.new\n guard_mission.squads.each do |squad|\n active_guard_squads << squad if squad.entried and not squad.annihilated? and not squad.retreated_from_fortress\n end\n return active_guard_squads\n end",
"def trial_guard_squads\n guard_squads ... | [
"0.78823537",
"0.7878121",
"0.6626518",
"0.6495058",
"0.6463965",
"0.5871778",
"0.5601093",
"0.5472525",
"0.54598093",
"0.5353319",
"0.52696115",
"0.52081054",
"0.51360047",
"0.5080907",
"0.5070634",
"0.5052169",
"0.5041873",
"0.5020733",
"0.50175846",
"0.49177742",
"0.489813... | 0.7058999 | 2 |
Set max hp and max sp to hp and sp of trial mobs. | def initialize_trial_squads_status
trial_squads.each do |trial_squad|
trial_squad.trial_mobs.each do |trial_mob|
trial_mob.hp = trial_mob.max_hp
trial_mob.sp = trial_mob.max_sp
trial_mob.save
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(item, max)\n @item = item\n @max = max\n @number = 1\n refresh\n end",
"def set_max(max)\n self[:max] = (max > 0 ? max : 1)\n end",
"def init_tb_vals\n @tb_player_info = {} # info used when resetting player movement\n @tb_unit_range = Unit_Range.new # has shortest ... | [
"0.5630963",
"0.5359234",
"0.5243855",
"0.52190787",
"0.51690114",
"0.51392394",
"0.513584",
"0.5085158",
"0.5085158",
"0.5085158",
"0.5085158",
"0.5085158",
"0.5085158",
"0.5085158",
"0.5085158",
"0.5085158",
"0.5062702",
"0.50400686",
"0.5012782",
"0.5005879",
"0.50042456",... | 0.58167034 | 0 |
Return all the squads status from the latest TrialBattleTurn. | def update_trial_squads_status(trial_move_turn_id)
p trial_move_turn_id
trial_move_turns.reverse.each do |turn|
# p turn.id
# Seeking the latest trial_battle_set.
next if trial_move_turn_id < turn.id
next if turn.trial_battle_sets.blank?
# p turn
# Set hp and sp.
turn.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_week_statuses\n bools = []\n current_week_reports.each do |report|\n statuses = report.statuses\n statuses.each do |status|\n if status.goal_id == self.id\n bools << status.status\n end\n end\n end\n bools\n end",
"def active_guard_squads\n active... | [
"0.6163239",
"0.6068968",
"0.57692295",
"0.5741371",
"0.5702146",
"0.5655072",
"0.55304533",
"0.5401529",
"0.5357169",
"0.535315",
"0.5349891",
"0.5287519",
"0.52657986",
"0.52596164",
"0.52553934",
"0.5217903",
"0.5208082",
"0.5187191",
"0.5182204",
"0.5181344",
"0.51537734"... | 0.6739406 | 0 |
Return squads which were sorted by dex. | def dex_sorted_squads
return Tools.sort_by_dex(active_squads)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sort\n # Find a cycle in the move graph and pick a register to spill to break it.\n spillee = nil\n each_strongly_connected_component do |component|\n if component.size > 1\n fail if spillee # There is one cycle with 3 registers.\n spillee = component.first.src\n ... | [
"0.5420375",
"0.5356799",
"0.53025955",
"0.5276676",
"0.5256234",
"0.5207273",
"0.5203382",
"0.51964825",
"0.51870245",
"0.51753163",
"0.515902",
"0.51249063",
"0.51064557",
"0.5097649",
"0.5096037",
"0.50915617",
"0.50863546",
"0.50474006",
"0.5045938",
"0.5042029",
"0.50382... | 0.8788732 | 0 |
Return fortress x size. | def fortress_x_size
return FortressCell.where("mini_map_id=?", mini_map.id).maximum('x')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fortress_y_size\n return FortressCell.where(\"mini_map_id=?\", mini_map.id).maximum('y')\n end",
"def size\n 4\n end",
"def size\n\t\t7500\n\tend",
"def fleet\n @all_ships.each_with_index.map { |x, i| [i, x.len] }\n end",
"def size\n (@x2-@x1)*(@y2-@y1)\n end",
"def num_points\n... | [
"0.63743764",
"0.61233914",
"0.6068728",
"0.6038533",
"0.60036033",
"0.6001059",
"0.5935449",
"0.592269",
"0.59102845",
"0.59015363",
"0.58370143",
"0.5834539",
"0.58295536",
"0.58189976",
"0.58176106",
"0.58176106",
"0.5808066",
"0.5797847",
"0.5767746",
"0.57597715",
"0.575... | 0.72856736 | 0 |
Return fortress y size. | def fortress_y_size
return FortressCell.where("mini_map_id=?", mini_map.id).maximum('y')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n dimensions()[:y]\n end",
"def height\n @dimensions.y\n end",
"def sizeY()\n return @device.sizeY() ;\n end",
"def height\n @y1 - @y0\n end",
"def ydim\n @ydim || xdim\n end",
"def ydim\n @ydim || xdim\n end",
"def height(y = @y)\n height = [y]\n re... | [
"0.7381962",
"0.728452",
"0.70696676",
"0.676221",
"0.6738485",
"0.6738485",
"0.66064245",
"0.6554238",
"0.6547828",
"0.65297323",
"0.65297323",
"0.64864904",
"0.64864904",
"0.647312",
"0.641163",
"0.6355692",
"0.6355692",
"0.63491315",
"0.63268185",
"0.6321179",
"0.63075817"... | 0.84383136 | 0 |
Return center point of fortress. | def fortress_center_point
return Point.new((fortress_x_size / 2).truncate, (fortress_y_size / 2).truncate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def center\r\n Point.from_x_y((lower_corner.x + upper_corner.x)/2,(lower_corner.y + upper_corner.y)/2)\r\n end",
"def center\n Point.new(x: @x, y: @y)\n end",
"def centre\n @centre ||= world.point(x_min + width/2.0, y_min + height/2.0)\n end",
"def get_center\n abs_size = get... | [
"0.75820374",
"0.7470252",
"0.7460464",
"0.7410759",
"0.7406851",
"0.7342874",
"0.72650915",
"0.72172606",
"0.72172606",
"0.7204367",
"0.7003564",
"0.69590366",
"0.6949757",
"0.685076",
"0.6801823",
"0.67726845",
"0.6770632",
"0.6770632",
"0.6770632",
"0.6755554",
"0.67489445... | 0.8907244 | 0 |
Return random inside cell of fortress. | def fortress_random_point
FortressCell.where("mini_map_id=? and symbol=?", mini_map.id, :concrete.to_s).sample
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_cell\n\t\trow = rand(@rows)\n\t\tcolumn = rand(@grid[row].count)\n\t\tself[row, column]\n\tend",
"def randomize_cells!\n @life.height.times do |y|\n @life.width.times do |x|\n @life.set_cell_alive! x, y if rand > 0.5\n end\n end\n end",
"def random_cell(array)\n cell_sel ... | [
"0.7560965",
"0.69967353",
"0.67341006",
"0.6681575",
"0.662416",
"0.6581369",
"0.6568145",
"0.65092105",
"0.6467563",
"0.64672965",
"0.6460545",
"0.64568704",
"0.63931787",
"0.63556606",
"0.6345913",
"0.630612",
"0.62354755",
"0.61688966",
"0.6163664",
"0.6140276",
"0.612750... | 0.78286207 | 0 |
Return fortress goal point. | def fortress_goal_point
trial_fortress_cells.each do |cell|
return Point.new(cell.x, cell.y) if cell.goal_flg
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goal_points\n self[:goal]\n end",
"def goal\n 28\n end",
"def get_point()\n bearing = rand(@bearing)\n distance = rand(@max_distance)\n Vincenty.destination(@origin[:lat], @origin[:long], bearing, distance)\n end",
"def main_goal()\n # TODO: replace naive implemen... | [
"0.7079904",
"0.6366185",
"0.63479435",
"0.6098014",
"0.5927841",
"0.5927841",
"0.59015715",
"0.5886947",
"0.5831039",
"0.5818143",
"0.5780444",
"0.5780026",
"0.577515",
"0.5748393",
"0.56913215",
"0.566076",
"0.5647882",
"0.5630898",
"0.5611092",
"0.5599971",
"0.5589298",
... | 0.83539164 | 0 |
Return exit cells of fortress. | def fortress_exit_cells
FortressCell.where("mini_map_id = ? and (x = 0 or y = 0 or x = ? or y = ?) and symbol = ? and squad_id is null", mini_map.id, fortress_x_size, fortress_y_size, :concrete.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def actual_cells\n @cells.compact\n end",
"def unassigned_cells\n grid.cells.to_a.reject { |cell| cell.value }\n end",
"def get_other_col_cells cell\n\t\treturn get_col_cells(get_col cell) - [cell]\n\tend",
"def occupied_positions\n cells.select {|cell| cell.occupied?}\n end",
"... | [
"0.61110103",
"0.60087585",
"0.58765286",
"0.5810468",
"0.5786589",
"0.57620615",
"0.5717664",
"0.5717664",
"0.5636181",
"0.56117094",
"0.55693954",
"0.55693954",
"0.5511796",
"0.5499548",
"0.54848725",
"0.5479372",
"0.543984",
"0.5423284",
"0.5420334",
"0.5400224",
"0.538776... | 0.7793981 | 0 |
Return squads which were sorted by dex. | def nearest_fortress_exit_point(point)
nearest_fortress_exit_cell = nil
nearest_distance = MAX_DISTANCE
fortress_exit_cells.each do |exit_cell|
distance = Tools.calc_distance(point, exit_cell)
if distance < nearest_distance
nearest_distance = distance
nearest_fortress_exit_cell =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def dex_sorted_squads\n return Tools.sort_by_dex(active_squads)\n end",
"def sort\n # Find a cycle in the move graph and pick a register to spill to break it.\n spillee = nil\n each_strongly_connected_component do |component|\n if component.size > 1\n fail if spillee # There is... | [
"0.8789068",
"0.54197925",
"0.5356794",
"0.5301207",
"0.5275893",
"0.52552193",
"0.52065045",
"0.5203125",
"0.5196988",
"0.5184884",
"0.517595",
"0.5159749",
"0.51248515",
"0.5107245",
"0.50981003",
"0.5095397",
"0.5092348",
"0.5086523",
"0.5046641",
"0.50464",
"0.5041374",
... | 0.0 | -1 |
Return trap which is deployed in this cell. | def fortress_cell_trap(point)
cell = FortressCell.where("mini_map_id=? and x=? and y=?", mini_map.id, point.x, point.y)
if cell.blank?
return nil
else
cell.first.trap
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def value()\n \t\t@stack.last\n end",
"def value\n \t@calc_stack[-1]\n end",
"def current_tranch_slot_index\n return nil unless @tranches && current_tranch\n\n current_tranch.find_index(nil)\n end",
"def get_min()\n return self.min_stack[-1]\n end",
"def get_elem cell\n\t\t... | [
"0.5290463",
"0.5223104",
"0.5076321",
"0.5023",
"0.49271205",
"0.4912661",
"0.4872171",
"0.48615098",
"0.48185202",
"0.48179495",
"0.48009807",
"0.4799174",
"0.4782825",
"0.47822785",
"0.47802165",
"0.47758326",
"0.4761373",
"0.4746806",
"0.47427163",
"0.4738737",
"0.4714797... | 0.5994565 | 0 |
Return true if guard squad is existing on goal cell. | def goal_cell_guarded?
guard_mission.squads.each do |squad|
return true if squad.current_point.equal?(fortress_goal_point)
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guard_defeated?\n return true if @goal_was_occupied\n guard_mission.squads.each do |squad|\n return false if not squad.annihilated? and not squad.retreated_from_fortress and squad.entried\n end\n return true\n end",
"def safe?\n #Check the curr room hazard free \n if !hazardRo... | [
"0.68467253",
"0.6099575",
"0.6022411",
"0.5983627",
"0.59804946",
"0.5914712",
"0.5879093",
"0.58363086",
"0.58072454",
"0.57916266",
"0.5753405",
"0.57319605",
"0.5672484",
"0.5671246",
"0.56587774",
"0.5636192",
"0.5635295",
"0.56335115",
"0.56232095",
"0.5622269",
"0.5619... | 0.79868734 | 0 |
Return true if all of guard squads are retreated or annihilated. | def guard_defeated?
return true if @goal_was_occupied
guard_mission.squads.each do |squad|
return false if not squad.annihilated? and not squad.retreated_from_fortress and squad.entried
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def goal_cell_guarded?\n guard_mission.squads.each do |squad|\n return true if squad.current_point.equal?(fortress_goal_point)\n end\n return false\n end",
"def any_mines_detonated?\n flag = false\n @grid.each do |row|\n flag = true if row.any? { |cell | cell.uncovered == true && !cell.... | [
"0.69541234",
"0.64308035",
"0.6328808",
"0.62534136",
"0.62224346",
"0.61033577",
"0.6058135",
"0.6036747",
"0.60273236",
"0.60125357",
"0.6002852",
"0.6002852",
"0.5976023",
"0.5948155",
"0.59365654",
"0.5933468",
"0.59091973",
"0.590422",
"0.5890099",
"0.58822745",
"0.5874... | 0.6827473 | 1 |
Return true if all of intruder squads are retreated or annihilated. | def intruder_defeated?
intruder_mission.squads.each do |squad|
return false if not squad.annihilated? and not squad.retreated_from_fortress and squad.entried
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def active_intruder_squads\n active_intruder_squads = Array.new\n intruder_mission.squads.each do |squad|\n active_intruder_squads << squad if squad.entried and not squad.annihilated? and not squad.retreated_from_fortress\n end\n return active_intruder_squads\n end",
"def any_mines_detonated?\n... | [
"0.64137703",
"0.6232396",
"0.6156289",
"0.5999075",
"0.5978679",
"0.59525466",
"0.59141994",
"0.5910497",
"0.5893938",
"0.5893393",
"0.58483016",
"0.5828909",
"0.5783747",
"0.5761509",
"0.5739223",
"0.5735523",
"0.57195854",
"0.571767",
"0.5704401",
"0.5683251",
"0.5682707",... | 0.7367787 | 0 |
GET /foo38s or /foo38s.json | def index
@foo38s = Foo38.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def list_all_aos_versions(args = {}) \n get(\"/aosversions.json/all\", args)\nend",
"def GET; end",
"def get(path, **args); end",
"def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\n... | [
"0.5910736",
"0.57700425",
"0.575738",
"0.57052535",
"0.56690496",
"0.56187266",
"0.5614032",
"0.5593559",
"0.5588429",
"0.5572204",
"0.55680335",
"0.5529265",
"0.552432",
"0.55225927",
"0.55184746",
"0.54909384",
"0.5486363",
"0.5469122",
"0.5462829",
"0.5438385",
"0.5394213... | 0.5363626 | 21 |
GET /foo38s/1 or /foo38s/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend",
"def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend",
"def get(pa... | [
"0.61073637",
"0.60296524",
"0.59851646",
"0.5875674",
"0.572986",
"0.5692777",
"0.5674211",
"0.5647928",
"0.56461066",
"0.56427354",
"0.56078213",
"0.56052184",
"0.5590321",
"0.5590321",
"0.5564894",
"0.55610275",
"0.55502576",
"0.55468315",
"0.5527761",
"0.5509716",
"0.5505... | 0.0 | -1 |
POST /foo38s or /foo38s.json | def create
@foo38 = Foo38.new(foo38_params)
respond_to do |format|
if @foo38.save
format.html { redirect_to @foo38, notice: "Foo38 was successfully created." }
format.json { render :show, status: :created, location: @foo38 }
else
format.html { render :new, status: :unprocess... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post(path, **args); end",
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def post endpoint, data\n do_request :post, endpoint, data\n end",
"def POST; end",
"def api_post(action, data)\n api_request(action, data, 'POST')\n end",
"def... | [
"0.60651094",
"0.5721004",
"0.56920195",
"0.5633561",
"0.56016004",
"0.5575352",
"0.5574585",
"0.5558182",
"0.55533326",
"0.5543981",
"0.5538776",
"0.5532795",
"0.5513691",
"0.5509315",
"0.5505684",
"0.54997385",
"0.549662",
"0.54783905",
"0.5469635",
"0.5468857",
"0.54667294... | 0.5900499 | 1 |
PATCH/PUT /foo38s/1 or /foo38s/1.json | def update
respond_to do |format|
if @foo38.update(foo38_params)
format.html { redirect_to @foo38, notice: "Foo38 was successfully updated." }
format.json { render :show, status: :ok, location: @foo38 }
else
format.html { render :edit, status: :unprocessable_entity }
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend",
... | [
"0.6344962",
"0.6262368",
"0.61973083",
"0.6179472",
"0.6117174",
"0.61125255",
"0.6108055",
"0.6083297",
"0.60512745",
"0.60326946",
"0.60215175",
"0.6012434",
"0.5991938",
"0.5978341",
"0.59751534",
"0.5956722",
"0.5955499",
"0.5943449",
"0.5933506",
"0.5933231",
"0.5928293... | 0.6304987 | 1 |
DELETE /foo38s/1 or /foo38s/1.json | def destroy
@foo38.destroy
respond_to do |format|
format.html { redirect_to foo38s_url, notice: "Foo38 was successfully destroyed." }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete(*rest) end",
"def cmd_delete argv\n setup argv\n uuid = @hash['uuid']\n response = @api.delete(uuid)\n msg response\n return response\n end",
"def delete_json(path)\n url... | [
"0.7042308",
"0.65833014",
"0.6565226",
"0.6523222",
"0.64192456",
"0.6351911",
"0.63436764",
"0.63291174",
"0.63250893",
"0.63220614",
"0.63219905",
"0.63190275",
"0.6297435",
"0.6291449",
"0.62875795",
"0.6286641",
"0.6286514",
"0.6286514",
"0.6280156",
"0.6278343",
"0.6269... | 0.64238685 | 4 |
Use callbacks to share common setup or constraints between actions. | def set_foo38
@foo38 = Foo38.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.6163443",
"0.604317",
"0.5943409",
"0.59143174",
"0.5887026",
"0.58335453",
"0.57738566",
"0.5701527",
"0.5701527",
"0.56534666",
"0.5618685",
"0.54237175",
"0.5407991",
"0.5407991",
"0.5407991",
"0.5394463",
"0.5376582",
"0.5355932",
"0.53376216",
"0.5337122",
"0.5329516"... | 0.0 | -1 |
Only allow a list of trusted parameters through. | def foo38_params
params.require(:foo38).permit(:foo1, :foo2, :foo3, :foo4, :foo5)
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 |
Adds CORRECT_POSITION pegs and returns positions that were guessed correctly | def feedback_position(guess)
correct_positions = Array.new(PEG_SPACES)
guess.each.with_index do |peg, slot|
if peg.eql? @answer[slot]
@guesses[@turns_passed].add_feedback_peg CORRECT_POSITION
guess[slot] = EMPTY
correct_positions[slot] = CORRECT_POSITION
end
end
corre... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def correct_positions\n @matches = Array.new(4) { 'O' }\n temp_player_input = Array.new(1) { @code_breaker_input }.flatten\n temp_secret_code = Array.new(1) { @secret_code_row }.flatten\n temp_secret_code.each_with_index do |_item, index|\n next unless temp_secret_code[index] == temp_player_input[... | [
"0.6430631",
"0.64069265",
"0.63507074",
"0.622923",
"0.615096",
"0.6109986",
"0.6071357",
"0.59799415",
"0.59705186",
"0.5960832",
"0.5952107",
"0.58782035",
"0.58357376",
"0.5823636",
"0.5789479",
"0.5776047",
"0.576284",
"0.5756951",
"0.57549995",
"0.57425714",
"0.57306385... | 0.7425042 | 0 |
Returns the given query's query_mode (!lg/!lm) without looking at subqueries. | def query_mode
node_text(node_tagged(:querymode, :exclude => :subquery))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subquery(from_mode, to_mode, query)\n if from_mode == :none\n return query\n else\n return ['in', 'certname',\n ['extract', 'certname',\n [\"select_#{to_mode}\", query]]]\n end\n end",
"def get_mode()\n end",
"def mode\n modes(false)[0]\n end",
"def mod... | [
"0.57314754",
"0.53974545",
"0.5273049",
"0.5273049",
"0.52609384",
"0.5243128",
"0.5243128",
"0.5167138",
"0.50957716",
"0.5094064",
"0.5074056",
"0.5070416",
"0.50650054",
"0.50506747",
"0.5046227",
"0.5046227",
"0.5032053",
"0.50230587",
"0.5003258",
"0.49927172",
"0.49670... | 0.7619945 | 1 |
Find all subqueries immediately under the current query, i.e. no subsubqueries. | def immediate_subqueries
my_nodes_tagged(:subquery)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subquery\n subqueries.\n compact.\n inject(&:merge)\n end",
"def subqueries\n [\n select_distinct_on,\n # default filters -- all scopes have them\n filter_by_subscription_or_topics,\n filter_by_start_date,\n ... | [
"0.7063856",
"0.5862605",
"0.5764686",
"0.5764089",
"0.5675363",
"0.5594591",
"0.55529535",
"0.54208434",
"0.54113257",
"0.53654134",
"0.52675253",
"0.52651834",
"0.5239068",
"0.5183866",
"0.51632065",
"0.5157109",
"0.51402634",
"0.51395315",
"0.51354986",
"0.5129992",
"0.512... | 0.76070404 | 1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.