query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Callback from Omniauth failures | def failure
origin_locale = get_origin_locale(request, available_locales())
I18n.locale = origin_locale if origin_locale
error_message = params[:error_reason] || "login error"
kind = request.env["omniauth.error.strategy"].name.to_s || "Facebook"
flash[:error] = t("devise.omniauth_callbacks.failure",... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fail\n render :text => request.env[\"omniauth.auth\"].to_yaml\n end",
"def on_failure!(response)\n session.authentication.errors.clear!\n session.authentication.errors.add(:openid, 'OpenID verification failed, maybe the provider is down? Or the session timed out')\n nil\n ... | [
"0.72447765",
"0.69695884",
"0.68047315",
"0.6513187",
"0.65073943",
"0.6391501",
"0.6367987",
"0.63227403",
"0.62982416",
"0.62861043",
"0.6266558",
"0.6257491",
"0.62568986",
"0.62526715",
"0.62526095",
"0.6170803",
"0.61645913",
"0.61423445",
"0.6131171",
"0.61293465",
"0.... | 0.7093228 | 1 |
same as onstatechange_register, but autounregisters if the block returns true | def onstatechange_register_once
handle = onstatechange_register { |st|
onstatechange_unregister(handle) if yield(st)
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_state(state, &block)\n end",
"def on_actuator_state(&block)\n\t\t\t@on_actuator_state = block\n\t\tend",
"def register_state_handler(state, &block)\n register(state_key(state), &block)\n end",
"def register_state_handler(state, &block)\n register(\"state_#{state}\", &block)\n end",
... | [
"0.66989094",
"0.6476662",
"0.62296855",
"0.619848",
"0.60056406",
"0.5990404",
"0.59616053",
"0.59616053",
"0.5945412",
"0.5945412",
"0.59400636",
"0.59400636",
"0.5933006",
"0.59223443",
"0.58912086",
"0.586281",
"0.58574593",
"0.5852536",
"0.5852536",
"0.5852188",
"0.57215... | 0.79283726 | 1 |
return true if the argument is under the cursor | def at_cursor?(obj)
same_pos?(obj, cursor)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def needs_cursor?\n\t\ttrue\n\tend",
"def needs_cursor?\n\t\ttrue\n\tend",
"def cursor_left?\r\n @item_window.index % 2 == 0\r\n end",
"def needs_cursor?; end",
"def needs_cursor?\r\n \ttrue\r\n \t end",
"def needs_cursor?\n true\n end",
"def needs_cursor?\n true\n end",
"def n... | [
"0.6748322",
"0.6748322",
"0.67130995",
"0.66899663",
"0.6686582",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.66680133",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.6663039",
"0.66532105",
"0.664... | 0.7357218 | 1 |
returns true if both arguments are at the same x/y/z | def same_pos?(pos1, pos2)
pos1 = pos1.pos if pos1.respond_to?(:pos)
pos2 = pos2.pos if pos2.respond_to?(:pos)
pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def Point3dEqual(arg0, arg1)\n ret = _invoke(1610743875, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end",
"def ==(c) \n (@x == c.x) && (@y == c.y)\n end",
"def == point\t\n\t\t@x == point.x && @y == point.y\t\n\tend",
"def isEqual(p)\n ... | [
"0.69228035",
"0.67688966",
"0.6671872",
"0.66445565",
"0.6627033",
"0.66072893",
"0.66033715",
"0.65441424",
"0.6525725",
"0.65117407",
"0.650433",
"0.641483",
"0.63972193",
"0.6378879",
"0.6365862",
"0.6334743",
"0.6315819",
"0.6298482",
"0.6279416",
"0.6261196",
"0.6256398... | 0.70263106 | 1 |
try to match a userspecified name to one from the raws uses caseswitching and substring matching eg match_rawname('coal', ['COAL_BITUMINOUS', 'BAUXITE']) => 'COAL_BITUMINOUS' | def match_rawname(name, rawlist)
rawlist.each { |r| return r if name == r }
rawlist.each { |r| return r if name.downcase == r.downcase }
may = rawlist.find_all { |r| r.downcase.index(name.downcase) }
may.first if may.length == 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_name?(gotten_name, requested_name)\n gotten_name.text.strip.downcase == requested_name.downcase\n end",
"def proper_name(name)\n return name if name =~ /[[:upper:]]/\n\n name.gsub(/\\b[[:alpha:]]+/) { |w| w =~ PARTICLE_REGEX ? w : w.capitalize }\n end",
"def origName(name)\n\t\tretur... | [
"0.7314645",
"0.6519375",
"0.64724416",
"0.6466073",
"0.6461452",
"0.64281964",
"0.64281315",
"0.64148",
"0.6413963",
"0.6401176",
"0.63648754",
"0.63614166",
"0.6334101",
"0.63312757",
"0.6298522",
"0.6288812",
"0.6278815",
"0.6278449",
"0.6250826",
"0.6248937",
"0.6245844",... | 0.7954118 | 1 |
Returns true if the version is in the range of this VersionRange object. Uses OSGi versioning rules to determine if the version is in range. | def in_range(version)
return in_range(version.min) && (version.max_infinite ? true : in_range(version.max)) if version.is_a?(VersionRange)
result = min_inclusive ? min <= version : min < version
if (!max_infinite)
result &= max_inclusive ? max >= version : max > version
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match?(version)\n return false if version < lower_bound\n return include_lower_bound? if version == lower_bound\n return true if upper_bound.nil?\n return false if version > upper_bound\n return include_upper_bound? if version == upper_bound\n true\n end",
"def in_range?\n return self.r... | [
"0.6728251",
"0.6130454",
"0.6048944",
"0.60476685",
"0.60186523",
"0.6000444",
"0.59901667",
"0.59349054",
"0.5924388",
"0.5917354",
"0.5915489",
"0.5898391",
"0.5898391",
"0.5890496",
"0.5881358",
"0.58742887",
"0.5874032",
"0.5818609",
"0.57542723",
"0.5750041",
"0.569864"... | 0.7289303 | 0 |
Below code is used in show and edit_task to get lawyer details. | def lawyer_details(notes)
@allowed_ids=[]
lawyer = Employee.find_by_user_id(notes.assigned_by_employee_user_id, :include => [:company => :employees])
lawyer.company.employees.each do |employee|
@allowed_ids << employee.user_id
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_lawyer\n end",
"def find_lawyer\n @lawyer = Lawyer.find(params[:id])\n end",
"def display_resource(buyer)\n buyer.full_name\n end",
"def show_lawyer_list\n authorize!(:show_lawyer_list,current_user) unless current_user.role?:secretary\n #session[:verified_secretary_id1] = params[:serv... | [
"0.7035812",
"0.6722092",
"0.650128",
"0.6281326",
"0.6265311",
"0.6115404",
"0.60529023",
"0.60156167",
"0.5943066",
"0.5914389",
"0.58577037",
"0.5847701",
"0.5845466",
"0.5815475",
"0.5815475",
"0.58088773",
"0.5803934",
"0.58010787",
"0.5788795",
"0.576335",
"0.5759148",
... | 0.69658023 | 1 |
Searches enquiries based on agents or agencies. | def enquiries_search(opts = {})
data, _status_code, _headers = enquiries_search_with_http_info(opts)
data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enquiries_search_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'\n end\n # resource path\n local_var_path = '/v1/enquiries'\n\n # query parameters\n query_params = {}\n query... | [
"0.62912035",
"0.5943017",
"0.5818383",
"0.5763571",
"0.55510765",
"0.5463672",
"0.5458465",
"0.54349744",
"0.54203886",
"0.53927994",
"0.5341064",
"0.53291506",
"0.53019464",
"0.5286",
"0.52757335",
"0.5264768",
"0.5256553",
"0.5240246",
"0.5238153",
"0.5225142",
"0.51921916... | 0.68223643 | 0 |
Searches enquiries based on agents or agencies. | def enquiries_search_with_http_info(opts = {})
if @api_client.config.debugging
@api_client.config.logger.debug 'Calling API: EnquiriesApi.enquiries_search ...'
end
# resource path
local_var_path = '/v1/enquiries'
# query parameters
query_params = {}
query_params[:'agen... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enquiries_search(opts = {})\n data, _status_code, _headers = enquiries_search_with_http_info(opts)\n data\n end",
"def all_search\n @results ||= []\n feat_keyword ||= {:name_contains => params[:q]}\n reward_keyword ||= {:partner_business_name_contains => params[:q]}\n\n Feat.search(f... | [
"0.68223643",
"0.5943017",
"0.5818383",
"0.5763571",
"0.55510765",
"0.5463672",
"0.5458465",
"0.54349744",
"0.54203886",
"0.53927994",
"0.5341064",
"0.53291506",
"0.53019464",
"0.5286",
"0.52757335",
"0.5264768",
"0.5256553",
"0.5240246",
"0.5238153",
"0.5225142",
"0.51921916... | 0.62912035 | 1 |
Use this method to tell the server this plugin defines additional HTTP methods. This method is passed a uri. It should only return HTTP methods that are available for the specified uri. | def http_methods(_path)
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def http_methods\n reload if executed_requests['GET'].nil? || executed_requests['GET']['headers'].nil? || executed_requests['GET']['headers'].empty?\n (executed_requests['GET']['headers']['Allow'] || \"GET\").split(/,\\s*/)\n end",
"def parse_http_methods!(req)\n if (method = req.params['_method'... | [
"0.6038416",
"0.5975979",
"0.58222145",
"0.5746334",
"0.57386875",
"0.57345146",
"0.57337415",
"0.5721152",
"0.57161534",
"0.57161534",
"0.56956637",
"0.56931037",
"0.56319016",
"0.5613789",
"0.5595842",
"0.55587375",
"0.55545336",
"0.55020386",
"0.5484724",
"0.54841757",
"0.... | 0.6450332 | 0 |
Returns a bunch of metadata about the plugin. Providing this information is optional, and is mainly displayed by the Browser plugin. The description key in the returned array may contain html and will not be sanitized. | def plugin_info
{
'name' => plugin_name,
'description' => nil,
'link' => nil
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generates HTML indexes and debug information for your sabre/dav server',\n 'link' => 'http://sabre.io/dav/browser-plugin/'\n }\n end",
"def plugin_info\n {\n 'n... | [
"0.731031",
"0.6975837",
"0.6779127",
"0.671048",
"0.66537756",
"0.6532279",
"0.6531967",
"0.6520701",
"0.64915174",
"0.63981205",
"0.6397866",
"0.63945514",
"0.63911355",
"0.6344642",
"0.6331503",
"0.6317602",
"0.6305746",
"0.62706506",
"0.62706506",
"0.62682104",
"0.6258005... | 0.7458092 | 0 |
use in auth_rules(examquestion) return [programme_id] for academician | def lecturers_programme
mypost = Position.find(:first, :conditions => ['staff_id=?',staff_id])
myunit = mypost.unit
postbasics=['Pengkhususan', 'Pos Basik', 'Diploma Lanjutan']
post_prog=Programme.find(:all, :conditions => ['course_type IN(?)', postbasics])
dip_prog=Programme.find(:all, :conditions ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def academic_program\n ::HubEdos::StudentApi::V2::AcademicPolicy::AcademicProgram.new(@data['academicProgram']) if @data['academicProgram']\n end",
"def commonsubject_lecturer_programmeid_list\n unit = Login.current_login.staff.position.unit\n current_lecturer = Login.current_login.staf... | [
"0.6532166",
"0.6142319",
"0.59872055",
"0.56526065",
"0.56071657",
"0.55580777",
"0.5554242",
"0.5437931",
"0.5424791",
"0.54119337",
"0.5396182",
"0.5383893",
"0.53590107",
"0.53560513",
"0.5354479",
"0.5353185",
"0.5343918",
"0.53414756",
"0.5298971",
"0.5289248",
"0.52789... | 0.66381055 | 0 |
maps a score to 3 rgb values | def scoreToColor(score, minVal, maxVal)
maxColor = 230.0
minColor = 10.0
norm = (((score.to_f - minVal ) / (maxVal - minVal ) ) * (maxColor - minColor)) + minColor
norm = [maxColor, norm].min
return [minColor, norm, norm]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_3f; return [red, green, blue].map {|i| i / 255.0}; end",
"def scores\n {\n 'a' => 1, 'e' => 1, 'i' => 1, 'o' => 1,\n 'u' => 1, 'l' => 1, 'n' => 1, 'r' => 1,\n 's' => 1, 't' => 1, 'd' => 2, 'g' => 2,\n 'b' => 3, 'c' => 3, 'm' => 3, 'p' => 3,\n 'f' => 4, 'h' => 4, 'v' => 4, 'w' => 4,\n 'y... | [
"0.6585143",
"0.64540607",
"0.64525515",
"0.6397052",
"0.6172393",
"0.6146491",
"0.61367965",
"0.61096257",
"0.60897267",
"0.59990287",
"0.5975819",
"0.59694016",
"0.59386694",
"0.5934119",
"0.58882684",
"0.5876459",
"0.5805941",
"0.5764289",
"0.5736834",
"0.5735293",
"0.5707... | 0.69518447 | 0 |
Find parts that are definitely required and should raise an error if they're not present | def __required_parts
required = []
required << 'body' if (@spec['body'] && @spec['body']['required'])
# Get required variables from paths:
req_variables = __path_variables.inject(:&) # find intersection
required << req_variables unless req_variables.empty?
required.flatt... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_required!\n validate_nil_attributes\n\n validate_rubygems_version\n\n validate_required_attributes\n\n validate_name\n\n validate_require_paths\n\n @specification.keep_only_files_and_directories\n\n validate_non_files\n\n validate_self_inclusion_in_files_list\n\n validate_sp... | [
"0.63505703",
"0.626776",
"0.6202635",
"0.61618435",
"0.61610097",
"0.6106957",
"0.60681283",
"0.60567874",
"0.6025397",
"0.5999005",
"0.59525275",
"0.59384006",
"0.5915372",
"0.59115845",
"0.5898733",
"0.5857568",
"0.5852387",
"0.58411586",
"0.58411586",
"0.58411586",
"0.583... | 0.70998764 | 0 |
Set locales and regions | def set(locales = nil, regions = nil)
@Locales = locales unless locales.nil?
@Regions = regions unless regions.nil?
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set(locales = nil, regions = nil, types = nil)\n @Locales = locales unless locales.nil?\n @Regions = regions unless regions.nil?\n @Types = types unless types.nil?\n self\n end",
"def available_locales=(locales); end",
"def set_locale\n end",
"def confi... | [
"0.70689005",
"0.6920386",
"0.68463564",
"0.65672755",
"0.6469948",
"0.6411923",
"0.6411923",
"0.6380237",
"0.63767344",
"0.6287042",
"0.6249324",
"0.62423474",
"0.62423474",
"0.6151886",
"0.61494565",
"0.6144181",
"0.61401325",
"0.6130125",
"0.6124334",
"0.6116401",
"0.61141... | 0.75364214 | 1 |
If child_id is not set, then link_url is used to find/create a Shadow and set the shadow_id | def create_shadow_if_needed
if self.link_url.present?
self.shadow = Shadow.special_find_or_create_by_web_url( self.link_url )
if( self.shadow.errors.empty? )
write_attribute(:shadow_id, self.shadow.id)
return true
else
errors.add_to_base( self.shadow.errors.fu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_permalink\n if parent_id.nil?\n self.permalink = name.to_url if permalink.blank?\n else\n parent_taxon = Taxon.find(parent_id)\n self.permalink = [parent_taxon.permalink, (permalink.blank? ? name.to_url : permalink.split('/').last)].join('/')\n end\n end",
"def upda... | [
"0.5394538",
"0.53615135",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.5252497",
"0.52043587",
"0.51849407",
"0.51461846",
"0.51452243",
"0.5120769",
"0.51141423",
"0.51141423",
"0.5099782",
"0.509213... | 0.59551823 | 0 |
This method is used to generate the token from UAA server by providing the UAA url and usename and password. | def get_access_token()
if @api_url[4] != "s"
temp = @api_url[10..@api_url.length]
@uaa_target = "https://uaa#{temp}"
else
temp=@api_url[11..@api_url.length]
@uaa_target = "https://uaa#{temp}"
end
Dir.chdir @home_directory
FileUtils.rm_rf(".uaac.yml")
system("uaac target #{@uaa_target} --skip-ssl-validatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end",
"def create_sandbox_user\n body = { \"providerCallbackHost\": @host }\n @url = 'https://ericssonbasicapi2.azure-api.net/v1_0/apiuser'\n response = Faraday.post(@url) do |req|\n req.headers['Content-T... | [
"0.6511591",
"0.6506689",
"0.6370539",
"0.6330441",
"0.6314617",
"0.6314173",
"0.6268256",
"0.6267854",
"0.6247867",
"0.62304616",
"0.62201935",
"0.62063366",
"0.6200999",
"0.6170968",
"0.613957",
"0.6134499",
"0.6124009",
"0.61170065",
"0.6107336",
"0.6098177",
"0.60938376",... | 0.7330301 | 0 |
This method is used to prompt for getting api url and return the api url. | def get_api_url()
print "Enter the API URL(include http:// or https://)::".yellow
@api_url = gets.chomp
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def api_url\n @api_url ||=\"#{base_url}#{@options['api_url']}\"\n end",
"def api_url\n authentication_credentials_provided? ? \"https://api.gowalla.com\" : \"http://api.gowalla.com\"\n end",
"def api_url\n @api_url || DEFAULT_API_URL\n end",
"def api_url\n @api_url ||= \"... | [
"0.7048653",
"0.6941984",
"0.6929423",
"0.68975925",
"0.68714154",
"0.6847141",
"0.6720983",
"0.6614052",
"0.65354437",
"0.6501432",
"0.64943826",
"0.6483023",
"0.64439386",
"0.6411442",
"0.6397988",
"0.6387811",
"0.6387811",
"0.63397723",
"0.63294625",
"0.63226765",
"0.62843... | 0.81253964 | 0 |
GET /sysconfigs/1 GET /sysconfigs/1.json | def show
@sysconfig = Sysconfig.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @sysconfig }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @sysconfigs = Sysconfig.order(created_at: :desc).page(params[:page])\n end",
"def index\n @sys_configs = @system.sys_configs.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @sys_configs.to_xml }\n end\n end",
"def get_serv_con... | [
"0.7215372",
"0.71492386",
"0.70465827",
"0.6918086",
"0.6900202",
"0.68822014",
"0.6855901",
"0.6722509",
"0.6722509",
"0.6695499",
"0.6690279",
"0.6644363",
"0.6605443",
"0.65996766",
"0.6530625",
"0.6389129",
"0.6339807",
"0.63157856",
"0.625954",
"0.62510806",
"0.61336136... | 0.76873696 | 0 |
GET /sysconfigs/new GET /sysconfigs/new.json | def new
@sysconfig = Sysconfig.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @sysconfig }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @system_config = SystemConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @system_config }\n end\n end",
"def create\n @sysconfig = Sysconfig.new(params[:sysconfig])\n\n respond_to do |format|\n if @sysconfig.save\n f... | [
"0.7235673",
"0.7187315",
"0.7100649",
"0.6810288",
"0.67672145",
"0.6504352",
"0.64832616",
"0.64733607",
"0.63627243",
"0.63515973",
"0.6278042",
"0.61392987",
"0.6070879",
"0.6056347",
"0.60154986",
"0.59992707",
"0.5959088",
"0.59567565",
"0.59228665",
"0.59183276",
"0.59... | 0.80483764 | 0 |
POST /sysconfigs POST /sysconfigs.json | def create
@sysconfig = Sysconfig.new(params[:sysconfig])
respond_to do |format|
if @sysconfig.save
format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }
format.json { render json: @sysconfig, status: :created, location: @sysconfig }
else
form... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @sysconfig = Sysconfig.new(sysconfig_params)\n\n respond_to do |format|\n if @sysconfig.save\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully created.' }\n format.json { render :show, status: :created, location: @sysconfig }\n else\n form... | [
"0.74242145",
"0.7006661",
"0.6665303",
"0.651607",
"0.6507566",
"0.6473905",
"0.63871545",
"0.63316214",
"0.6199562",
"0.61874706",
"0.59439105",
"0.58492786",
"0.5767599",
"0.57276773",
"0.5714163",
"0.56336147",
"0.56314445",
"0.5597371",
"0.55625254",
"0.55252385",
"0.552... | 0.74121094 | 1 |
PUT /sysconfigs/1 PUT /sysconfigs/1.json | def update
@sysconfig = Sysconfig.find(params[:id])
respond_to do |format|
if @sysconfig.update_attributes(params[:sysconfig])
format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @sysconfig.update(sysconfig_params)\n format.html { redirect_to @sysconfig, notice: 'Sysconfig was successfully updated.' }\n format.json { render :show, status: :ok, location: @sysconfig }\n else\n format.html { render :edit }\n for... | [
"0.739974",
"0.7163445",
"0.69778836",
"0.67551184",
"0.66523504",
"0.6626705",
"0.6618349",
"0.6481555",
"0.6279338",
"0.62287104",
"0.61434656",
"0.6092519",
"0.60168856",
"0.5936552",
"0.59056824",
"0.5903177",
"0.58864784",
"0.5867259",
"0.5821404",
"0.57741857",
"0.57499... | 0.7398427 | 1 |
DELETE /sysconfigs/1 DELETE /sysconfigs/1.json | def destroy
@sysconfig = Sysconfig.find(params[:id])
@sysconfig.destroy
respond_to do |format|
format.html { redirect_to sysconfigs_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sys_config = SysConfig.find(params[:id])\n @sys_config.destroy\n\n respond_to do |format|\n format.html { redirect_to user_system_sys_configs_url }\n format.xml { head :ok }\n end\n end",
"def destroy\n @sysconfig.destroy\n respond_to do |format|\n format.html { ... | [
"0.74785835",
"0.7477476",
"0.73887104",
"0.7311788",
"0.70314854",
"0.68435985",
"0.6732241",
"0.6670511",
"0.663053",
"0.6564886",
"0.6539986",
"0.6514842",
"0.64910066",
"0.64798516",
"0.64489335",
"0.6424096",
"0.6368141",
"0.63643223",
"0.63249904",
"0.63144207",
"0.6311... | 0.77282345 | 0 |
GET /defenses GET /defenses.json | def index
@defenses = Defense.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expenses = find_expenses.all\n render json: @expenses\n end",
"def index\n @expenses = Expense.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @expenses }\n end\n end",
"def index\n @defense_responses = DefenseResponse.all\n ... | [
"0.75221795",
"0.72220296",
"0.6945406",
"0.6941673",
"0.6874378",
"0.6774466",
"0.6745395",
"0.6710029",
"0.6680765",
"0.66717875",
"0.66627014",
"0.66261905",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65643096",
"0.65557337",
"0.6550464",
"0.64772576",
"0.6... | 0.780192 | 0 |
POST /defenses POST /defenses.json | def create
@defense = Defense.new(defense_params)
respond_to do |format|
if @defense.save
format.html { redirect_to @defense, notice: 'Defense was successfully created.' }
format.json { render :show, status: :created, location: @defense }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @expense = Expense.new(expense_params)\n\n if @expense.save\n render json: @expense\n else\n render json: @expense.errors, status: :unprocessable_entity\n end\n end",
"def create\n # Get the variables passed in from params on create\n @expense = Expense.new(expense_param... | [
"0.6828333",
"0.66891485",
"0.6661024",
"0.6627724",
"0.6517853",
"0.64565474",
"0.6436841",
"0.6415493",
"0.638892",
"0.63604337",
"0.6293899",
"0.6290302",
"0.6284612",
"0.61891246",
"0.61451745",
"0.61402446",
"0.60999316",
"0.60911024",
"0.60643226",
"0.6062161",
"0.60494... | 0.7049325 | 0 |
Closes the open remote shell session. This method can be called multiple times, even if there is no open session. | def close
return if shell.nil?
service.close_shell(shell)
@shell = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_ssh_session(session)\n session.close\n session = nil\n true\n end",
"def close\n @registry[:transport][:session].close if @open\n @open = false\n end",
"def close\n return if shell.nil?\n\n service.close_shell(shell)\n remove_finalizer\n @shell = nil\n... | [
"0.71057767",
"0.6981516",
"0.6890663",
"0.6773836",
"0.6758684",
"0.6731146",
"0.6715928",
"0.66963744",
"0.667177",
"0.6646758",
"0.66439974",
"0.65966713",
"0.6543056",
"0.65326804",
"0.6523264",
"0.65212005",
"0.64516383",
"0.6413949",
"0.63993376",
"0.6396554",
"0.638908... | 0.69855636 | 1 |
Opens a remote shell session for reuse. The maxiumum commandpershell threshold is also determined the first time this method is invoked and cached for later invocations. | def open
close
@shell = service.open_shell
@command_count = 0
determine_max_commands unless max_commands
shell
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open\n close\n retryable(service.retry_limit, service.retry_delay) do\n @shell = service.open_shell(codepage: code_page)\n end\n add_finalizer(shell)\n @command_count = 0\n shell\n end",
"def request_shell\n @state = :shell\n @channel.send_req... | [
"0.6251886",
"0.57624686",
"0.5740671",
"0.57309824",
"0.56949246",
"0.567466",
"0.56519455",
"0.56013155",
"0.5541296",
"0.55361515",
"0.5464457",
"0.54332954",
"0.5430686",
"0.54252017",
"0.541093",
"0.5410368",
"0.5410368",
"0.5395123",
"0.538147",
"0.53743464",
"0.5351741... | 0.6636245 | 0 |
Determines the safe maximum number of commands that can be executed on a remote shell session by interrogating the remote host. | def determine_max_commands
os_version = run_powershell_script(PS1_OS_VERSION).stdout.chomp
@max_commands = os_version < "6.2" ? LEGACY_LIMIT : MODERN_LIMIT
@max_commands -= 2 # to be safe
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def max_command_length; end",
"def remote_maximum_packet_size; end",
"def _unix_max_line_length\n # Based on autoconf's arg_max calculator, see\n # http://www.in-ulm.de/~mascheck/various/argmax/autoconf_check.html\n calc_line_max = 'i=0 max= new= str=abcd; \\\n while (test \"X\"`echo \"X$str\" 2>... | [
"0.63175696",
"0.61611533",
"0.57459944",
"0.56649756",
"0.5626086",
"0.55016613",
"0.54920995",
"0.5425902",
"0.5343629",
"0.5341369",
"0.5330872",
"0.5321345",
"0.53138965",
"0.53011936",
"0.528496",
"0.52069306",
"0.52038836",
"0.5191957",
"0.51918805",
"0.51796687",
"0.51... | 0.6916242 | 0 |
GET /families/new GET /families/new.json | def new
@family = Family.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @family }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @family_member }\n end\n end",
"def new\n @family_member = FamilyMember.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ... | [
"0.71695906",
"0.71695906",
"0.71391577",
"0.7129296",
"0.71064544",
"0.7022028",
"0.68648344",
"0.67930543",
"0.67314255",
"0.6726343",
"0.66926026",
"0.6654322",
"0.66194683",
"0.65615916",
"0.6561281",
"0.6548845",
"0.65236",
"0.65201026",
"0.6514795",
"0.6457378",
"0.6347... | 0.78264546 | 0 |
Lazy read the contact information | def contact
@contact ||= get_contact(@data_object.user_contact)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch_contact_info\n lambda {\n user.vet360_contact_info\n }\n end",
"def contact\n response[\"contact\"]\n end",
"def display_one_contact\n contact = retrieve_contact_by_email\n end",
"def get_contact\n if self.contact_id\n return self.contact\n end... | [
"0.70533556",
"0.69931376",
"0.69071925",
"0.68375194",
"0.6806678",
"0.680625",
"0.680625",
"0.680625",
"0.680625",
"0.680625",
"0.66355497",
"0.65883356",
"0.65800035",
"0.6558589",
"0.6556369",
"0.65496105",
"0.6538455",
"0.65359867",
"0.64843047",
"0.64710087",
"0.6471008... | 0.69959927 | 1 |
put this user's stuff into a hash | def add_to_hash(hash)
super
contact.add_to_hash(hash)
hash['user_over_13'] = @user_over_13 || !@new_user
hash['last_logged_in'] = fmt_date_time(@data_object.user_last_logged_in)
hash['first_logged_in'] = fmt_date_time(@data_object.user_first_logged_in)
# aff_opts = Affiliate.options
hash
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_entourage_user_hashes\n User.find_each do |user|\n email_hashes[hash(user.email)] = user.id\n phone_hashes[hash(user.phone)] = user.id\n end\n end",
"def as_hash(add_ins = {})\n hash = {\n :id => self.id,\n :name => self.name,\n :user_id => self.user_id,... | [
"0.6760082",
"0.67248976",
"0.6709168",
"0.66285336",
"0.66162926",
"0.65451276",
"0.65352595",
"0.64493",
"0.63894325",
"0.63856786",
"0.6376628",
"0.6345046",
"0.6326804",
"0.63162816",
"0.63107544",
"0.63063264",
"0.62908846",
"0.6230938",
"0.6158729",
"0.61488956",
"0.614... | 0.6772971 | 0 |
log to the UserHistory table | def log(notes)
@uh_log ||= UserHistory.new
@uh_log.log(self, notes)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def history\n\t\t@user.show_log\n\tend",
"def set_user_history_record\n @user_history_record = UserHistoryRecord.find(params[:id])\n end",
"def index\n @user = User.find(current_user.id)\n @history_logs = @user.history_logs\n end",
"def history_log (event, options={})\n\n source = options.d... | [
"0.7338501",
"0.6987412",
"0.67164034",
"0.66679794",
"0.640545",
"0.6390004",
"0.63898313",
"0.6293106",
"0.62419516",
"0.61407214",
"0.6101616",
"0.6068252",
"0.5948694",
"0.5944313",
"0.5932673",
"0.59128094",
"0.58401424",
"0.58326113",
"0.5818913",
"0.5818301",
"0.581830... | 0.7131456 | 1 |
Lazy load an affiliate | def affiliate
@affiliate || Affiliate.with_id(@data_object.user_affiliate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliate\n self.affiliate_class && affiliate_id && self.affiliate_class.find(affiliate_id)\n end",
"def affiliate_affiliations\n @affiliate_affiliations ||= Affiliation.find_by_uid(uid)\n end",
"def affiliation\n affiliations.try(:first)\n end",
"def set_affiliate\n @affiliate... | [
"0.7576979",
"0.71180224",
"0.7006972",
"0.6971306",
"0.6971306",
"0.69453984",
"0.6767858",
"0.64777255",
"0.6450353",
"0.643987",
"0.62531483",
"0.61321",
"0.6087326",
"0.60826844",
"0.60661167",
"0.6044205",
"0.60323656",
"0.60002416",
"0.594913",
"0.59291613",
"0.5860109"... | 0.7796084 | 0 |
record the fact that this user is registered in an affiliate | def register_affiliate_role
Role.set_user_role(@data_object.user_id,
user_affiliate,
nil,
RoleNameTable::REGISTERED,
TargetTable::AFFILIATE,
user_affiliate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliate\n @affiliate || Affiliate.with_id(@data_object.user_affiliate)\n end",
"def affiliate\n self.affiliate_class && affiliate_id && self.affiliate_class.find(affiliate_id)\n end",
"def set_affiliate\n if affiliate.present?\n account.affiliate_id = affiliate.id\n account.affiliate... | [
"0.7254574",
"0.6769462",
"0.6681267",
"0.6371687",
"0.6345233",
"0.62661225",
"0.62661225",
"0.61951137",
"0.6160961",
"0.6010346",
"0.59804493",
"0.5948432",
"0.5932091",
"0.5894587",
"0.5877874",
"0.5870102",
"0.5861741",
"0.5842778",
"0.579431",
"0.5734288",
"0.57342726",... | 0.68785167 | 1 |
Affiliate stuff. A user has one primary and any number of secondary affiliates. Is this user associated with the given affiliate? | def associated_with_affiliate?(aff_id)
(aff_id == @data_object.user_affiliate) ||
role_assoc_with_affiliate?(aff_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def affiliate\n self.affiliate_class && affiliate_id && self.affiliate_class.find(affiliate_id)\n end",
"def using_affiliate?(account_type)\n affiliate_account_types.include?(account_type.to_s.classify)\n end",
"def advised?\n advisor_company_affiliations.with_access.present?\n end",
"def affilia... | [
"0.7297416",
"0.6931425",
"0.68783474",
"0.6763197",
"0.67038536",
"0.6652632",
"0.66468024",
"0.6244003",
"0.61868554",
"0.6166042",
"0.6155807",
"0.6136479",
"0.6134123",
"0.6115355",
"0.61036",
"0.60620564",
"0.59963477",
"0.59873384",
"0.59723717",
"0.59443974",
"0.592568... | 0.79458284 | 0 |
renvoie un tableau de cases contenant les erreurs qu'il y a dans la grille (lorsque la case est VIDE, ce n'est pas une erreur) | def casesIncorrect
newStatutVide = StatutVide.new(VIDE)
newStatutArbre = StatutArbre.new(ARBRE)
tabCasesErr = Array.new
grille=@grille.grille
for i in 0..grille.length-1
for j in 0..grille.length-1
tabCasesErr.unshift(grille[i][j]) if (grille[i][j].statutVisible != grille[i][j].statu... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nbCasesIncorrect\n nbErr = 0\n newStatutVide = StatutVide.new(VIDE)\n newStatutArbre = StatutArbre.new(ARBRE)\n @grille.grille.each do | ligne |\n ligne.each do | cases |\n #######################################################################################################\n #... | [
"0.7001326",
"0.61590487",
"0.5765501",
"0.5721783",
"0.56755805",
"0.55608517",
"0.54557705",
"0.54555565",
"0.5453489",
"0.544602",
"0.53431416",
"0.5324971",
"0.53057474",
"0.52836895",
"0.527121",
"0.52535266",
"0.5220627",
"0.51910824",
"0.51883185",
"0.51841956",
"0.517... | 0.74725395 | 0 |
before_action :authenticate_admin! GET /smsloans GET /smsloans.json | def index
@smsloans = Smsloan.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n #before_action :authenticate_user\n #if current_user.admin?\n @users = User.all\n render json: @users, status: :ok\n #else\n # render json: [], status: :unauthorized\n #end\n end",
"def set_smsloan\n @smsloan = Smsloan.find(params[:id])\n end",
"def ... | [
"0.6084872",
"0.5992685",
"0.5950224",
"0.59073937",
"0.5903932",
"0.58968395",
"0.58879375",
"0.5825045",
"0.5772475",
"0.576563",
"0.5746611",
"0.57387006",
"0.5721227",
"0.56883454",
"0.56805146",
"0.56682664",
"0.5631794",
"0.56197107",
"0.56016666",
"0.5594652",
"0.55607... | 0.64864254 | 0 |
PATCH/PUT /smsloans/1 PATCH/PUT /smsloans/1.json | def update
respond_to do |format|
if @smsloan.update(smsloan_params)
format.html { redirect_to @smsloan, notice: 'Smsloan was successfully updated.' }
format.json { render :show, status: :ok, location: @smsloan }
else
format.html { render :edit }
format.json { render json... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @sms_based.update(sms_based_params)\n format.html { redirect_to @sms_based, notice: 'Sms based was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json... | [
"0.6421635",
"0.6216744",
"0.6213252",
"0.59553605",
"0.59518427",
"0.5942802",
"0.5936722",
"0.5927721",
"0.585977",
"0.581588",
"0.5805377",
"0.5790092",
"0.5775165",
"0.576854",
"0.5754301",
"0.5706977",
"0.5704834",
"0.5699056",
"0.56953347",
"0.5671421",
"0.5667156",
"... | 0.657055 | 0 |
DELETE /smsloans/1 DELETE /smsloans/1.json | def destroy
@smsloan.destroy
respond_to do |format|
format.html { redirect_to smsloans_url, notice: 'Smsloan was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @sms_based.destroy\n respond_to do |format|\n format.html { redirect_to sms_baseds_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @sms = Sms.find(params[:id])\n @sms.destroy\n\n respond_to do |format|\n format.html { redirect_to(sms_url) }\n ... | [
"0.72519684",
"0.7122071",
"0.7115706",
"0.69583005",
"0.6849772",
"0.67845243",
"0.6767632",
"0.6757643",
"0.6752234",
"0.6733571",
"0.6725113",
"0.67103755",
"0.67067367",
"0.67014",
"0.66567254",
"0.6650135",
"0.66413534",
"0.66385674",
"0.66344535",
"0.6616824",
"0.660829... | 0.73421055 | 0 |
GET /image_groups/1 GET /image_groups/1.json | def show
@image_group = ImageGroup.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @image_group }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @groups = current_user.groups\n @groups = @groups.where('name LIKE ?', \"%#{params[:q]}%\") if params[:q].present?\n @groups = current_user.groups_sorted_by_admin_state_and_name(@groups)\n @groups_pictures = Group.group_images_hash_for_groups @groups\n\n respond_to do |format|\n for... | [
"0.7065757",
"0.7058672",
"0.6788443",
"0.67826885",
"0.6775769",
"0.6639864",
"0.6638153",
"0.65698034",
"0.65435266",
"0.65393406",
"0.65324646",
"0.65324646",
"0.65247214",
"0.64920074",
"0.6470677",
"0.6450721",
"0.6435345",
"0.6422137",
"0.64169836",
"0.64140195",
"0.638... | 0.777888 | 0 |
PUT /image_groups/1 PUT /image_groups/1.json | def update
puts params[:image_group]
puts params[:image_group][:promoted]
p ">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
if !params[:images][:removed].blank?
puts "removed images" + params[:images][:removed]
removedImages = Image.where(" id in (?)", params[:images][:removed].split(','))
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def UpdateGroup params = {}\n \n APICall(path: 'groups.json',method: 'PUT',payload: params.to_json)\n \n end",
"def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_cont... | [
"0.7013699",
"0.68939674",
"0.667842",
"0.6663909",
"0.64881104",
"0.64502144",
"0.64501834",
"0.64057434",
"0.6402101",
"0.63756186",
"0.6371995",
"0.63506645",
"0.6320838",
"0.63092995",
"0.62939984",
"0.62604725",
"0.6259761",
"0.6257047",
"0.62176615",
"0.6217387",
"0.621... | 0.710447 | 0 |
DELETE /image_groups/1 DELETE /image_groups/1.json | def destroy
@image_group = ImageGroup.find(params[:id])
@image_group.destroy
respond_to do |format|
format.html { redirect_to image_groups_url }
format.json { head :no_content }
format.js {}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @image_gallery_group = ImageGalleryGroup.find(params[:id])\n @image_gallery_group.destroy\n\n respond_to do |format|\n format.html { redirect_to( admin_image_gallery_groups_url ) }\n format.xml { head :ok }\n end\n end",
"def DeleteGroup id\n \n APICall(path: \... | [
"0.74013877",
"0.738562",
"0.7370603",
"0.7204914",
"0.7173223",
"0.71466416",
"0.71245694",
"0.7096107",
"0.7073777",
"0.7062585",
"0.70428175",
"0.703515",
"0.7033367",
"0.70323575",
"0.7032046",
"0.702627",
"0.702627",
"0.7019601",
"0.7019601",
"0.7019601",
"0.7019601",
... | 0.7752952 | 0 |
Get the build numbers for this Windows, e.g. 5.2.3790. | def get_build
if defined?(@major) and defined?(@minor) and defined?(@build) then
return @major, @minor, @build
else
@major, @minor, @build = nil
end
search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')
ntdlls = Dir.glob(search, File::FNM_CASEFOLD)
if ntdll... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def windows_version_parts\n version = self.version\n if version\n # windows-server-* -> windows-*\n if version.split(\"-\", 2)[0] == \"server\"\n version = version.split(\"-\", 2)[1]\n end\n\n if version =~ /^(\\d+)(r\\d+)?(sp... | [
"0.66530526",
"0.66465837",
"0.65124017",
"0.62614083",
"0.62261355",
"0.6211239",
"0.61503816",
"0.6042835",
"0.5937323",
"0.5921345",
"0.5920215",
"0.58979684",
"0.58693236",
"0.58668524",
"0.57175726",
"0.5705238",
"0.56817204",
"0.56814253",
"0.5673897",
"0.56664485",
"0.... | 0.75695336 | 0 |
Create a description string for this version of Windows. | def get_winstring
if defined?(@description) then return @description else @description = nil end
get_build if not @major
if @major < 6 # Vista and up use install.wim
version = "#{@major}.#{@minor}"
releases = {
'5.0' => { 2195 => 'Windows 2000' },
'5.1' => { 2600 =>... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def name\n return \"New Firmware\" if !id\n version + \" (\" + description.to_s + \") \" +\n \" (\" + (for_external ? \"internal\" : \"external\") + \")\"\n end",
"def create_description_string(name, host, status, description, bracket)\n output = \"```\\n============\\n#{name}\\n============\\n```... | [
"0.6339469",
"0.62865597",
"0.6123622",
"0.60091484",
"0.5989196",
"0.59707993",
"0.5931438",
"0.5895481",
"0.58368516",
"0.5825027",
"0.5809383",
"0.58090514",
"0.5797265",
"0.57905775",
"0.5771442",
"0.5733858",
"0.5726541",
"0.57140833",
"0.56912464",
"0.5685428",
"0.56816... | 0.6885968 | 0 |
Dump [1].xml from a Windows install image. | def get_xmlinfo
def do_xmlget(imagepath)
xmlinfo = %x{imagex info --xml #{imagepath}}
@xmlinfo = REXML::Document.new xmlinfo
return @xmlinfo
end
if defined?(@xmlinfo) then return @xmlinfo else @xmlinfo = nil end
search = File.join(@path, 'sources/install.wim')
wimag... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_manifest_file\n render_template(resource_path(\"AppxManifest.xml.erb\"),\n destination: \"#{windows_safe_path(project.install_dir)}/AppxManifest.xml\",\n variables: {\n name: project.package_name,\n friendly_name: project.friendly_name,\n version: windows_pac... | [
"0.5216315",
"0.50499356",
"0.5045947",
"0.5040317",
"0.5033626",
"0.5018816",
"0.49743646",
"0.49232647",
"0.49208415",
"0.48411864",
"0.48012644",
"0.47731215",
"0.475118",
"0.47468966",
"0.47458598",
"0.47255158",
"0.47167185",
"0.46811822",
"0.46618703",
"0.4641244",
"0.4... | 0.5748545 | 0 |
localhost:3000/addresses/5/edit http method :GET pathedit_address_path roles and responsibilities | def edit
@address=Address.new
@address=Address.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def edit\n\t\t@address = current_user.addresses.find(params[:id])\n\tend",
"def edit\n @addresses = @user.addresses\n end",
"def edit\n @user = User.find(params[:id])\n @address = @user.address || @user.build_address\n end",
"def edit\n# @postalAddress = PostalAddress.find(params[:id])\n ... | [
"0.7930331",
"0.7466074",
"0.7127007",
"0.71117216",
"0.69689214",
"0.69334215",
"0.6909133",
"0.6888436",
"0.6828675",
"0.6812284",
"0.6775288",
"0.67679226",
"0.6715734",
"0.6707032",
"0.6700996",
"0.6684866",
"0.6684866",
"0.6684866",
"0.6684866",
"0.6684866",
"0.6684866",... | 0.74751925 | 1 |
EPIC TWEET GEN takes a user hashtag and how many tweets to gen returns the total rating | def generate_tweets(hashtag, how_many)
total_stars = 0
how_many.times do
stars = rand(5)+1
total_stars += stars
Tweet.create(
user_handle: Faker::Lorem.words(2).join('_'),
user_display: Faker::Name.name,
feedback: Faker::Lorem.sentences(2).join << " #{stars}star #doha ##{hashtag} #dmk... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tweet_score\n end",
"def tweet_score(favorite_count, retweet_count)\n return favorite_count + (retweet_count * 2)\n end",
"def index\n number_tweets = if params[\"count\"] then params[\"count\"].to_i else 10 end\n tweet_ids = []\n if @user.interests\n for i in 1..number_tweets\n ... | [
"0.68224704",
"0.6513439",
"0.62277913",
"0.6095222",
"0.6057707",
"0.60108143",
"0.59993434",
"0.5982066",
"0.59727305",
"0.5964091",
"0.59188235",
"0.5901227",
"0.5891925",
"0.58751523",
"0.5863254",
"0.5826423",
"0.5814737",
"0.58095044",
"0.5809347",
"0.5746908",
"0.57029... | 0.7060241 | 0 |
GET /empleadobitacoras/1 GET /empleadobitacoras/1.xml | def show
@empleadobitacora = Empleadobitacora.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @empleadobitacora }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @empleadosautorizado }\n end\n end",
"def download_xml\n\t\turi = URI.parse(\"http://www.esmadrid.com/opendata/tiendas_v1_es.xml\")\n... | [
"0.6690581",
"0.650327",
"0.64298296",
"0.6412495",
"0.63517797",
"0.63387704",
"0.6338752",
"0.6316721",
"0.6310457",
"0.6295037",
"0.62946427",
"0.6285195",
"0.6281537",
"0.62468046",
"0.6231396",
"0.6227623",
"0.62251335",
"0.62229425",
"0.6218563",
"0.62143284",
"0.620982... | 0.7056976 | 0 |
GET /empleadobitacoras/new GET /empleadobitacoras/new.xml | def new
@empleadobitacora = Empleadobitacora.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @empleadobitacora }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @empleadosautorizado = Empleadosautorizado.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @empleadosautorizado }\n end\n end",
"def new\n @estabelecimento = Estabelecimento.new\n\n respond_to do |format|\n format.html # new.html... | [
"0.7451674",
"0.7325657",
"0.7292314",
"0.7291293",
"0.72706664",
"0.7242996",
"0.71869254",
"0.71869254",
"0.717484",
"0.7161069",
"0.71473974",
"0.71384805",
"0.71382827",
"0.71374106",
"0.71200883",
"0.7095082",
"0.7088232",
"0.70869154",
"0.70827115",
"0.70690966",
"0.706... | 0.7533226 | 0 |
POST /empleadobitacoras POST /empleadobitacoras.xml | def create
@empleadobitacora = Empleadobitacora.new(params[:empleadobitacora])
respond_to do |format|
if @empleadobitacora.save
format.html { redirect_to(@empleadobitacora, :notice => 'Empleadobitacora was successfully created.') }
format.xml { render :xml => @empleadobitacora, :status =... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @empleadosautorizado = Empleadosautorizado.new(params[:empleadosautorizado])\n\n respond_to do |format|\n if @empleadosautorizado.save\n format.html { redirect_to(@empleadosautorizado, :notice => 'Empleadosautorizado was successfully created.') }\n format.xml { render :xml =>... | [
"0.6181944",
"0.6055266",
"0.60118765",
"0.59468913",
"0.59388566",
"0.59319675",
"0.59261525",
"0.59180355",
"0.59166557",
"0.5904606",
"0.59009385",
"0.5896469",
"0.5874492",
"0.5858113",
"0.5833539",
"0.5826745",
"0.5803622",
"0.58018875",
"0.57831913",
"0.5769799",
"0.576... | 0.6678962 | 0 |
PUT /empleadobitacoras/1 PUT /empleadobitacoras/1.xml | def update
@empleadobitacora = Empleadobitacora.find(params[:id])
respond_to do |format|
if @empleadobitacora.update_attributes(params[:empleadobitacora])
format.html { redirect_to(@empleadobitacora, :notice => 'Empleadobitacora was successfully updated.') }
format.xml { head :ok }
... | {
"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 @estagio = Estagio.find(params[:id])\n\n respond_to do |format|\n if @estagio.update_attributes(params[:estagio])\n flash[:notice] = 'Estagio was su... | [
"0.64717865",
"0.6093532",
"0.6090856",
"0.60785913",
"0.60334915",
"0.59933466",
"0.59698045",
"0.5966531",
"0.596525",
"0.59421456",
"0.5915886",
"0.58759004",
"0.587027",
"0.5851336",
"0.5830085",
"0.5815557",
"0.58107173",
"0.5792293",
"0.57915837",
"0.5786026",
"0.577174... | 0.6343366 | 1 |
DELETE /empleadobitacoras/1 DELETE /empleadobitacoras/1.xml | def destroy
@empleadobitacora = Empleadobitacora.find(params[:id])
@empleadobitacora.destroy
respond_to do |format|
format.html { redirect_to(empleadobitacoras_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n @empleadosautorizado.destroy\n\n respond_to do |format|\n format.html { redirect_to(empleadosautorizados_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n RestClient.delete \"#{REST_API_URI}/conten... | [
"0.6800261",
"0.6773849",
"0.67611444",
"0.67357093",
"0.6704638",
"0.66955584",
"0.6689398",
"0.66782993",
"0.66698104",
"0.66680396",
"0.6651149",
"0.66473156",
"0.6627883",
"0.66221476",
"0.66168123",
"0.6615853",
"0.6615599",
"0.6584773",
"0.65734327",
"0.65613747",
"0.65... | 0.7031792 | 0 |
Check that a domain exists | def verify_domain(domain)
begin
Socket.gethostbyname(domain)
rescue SocketError
return false
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def exist?(domain)\n Domain.all(:name => domain).any?\n end",
"def a_domain_we_care_about?(url)\n begin\n !@domains.select { |domain| URI.parse(url).host == domain.host }.empty?\n rescue\n !@domains.select { |domain| url.gsub(/https*:\\/\\//,'').starts_with?(domain.host) }.empty?\n ... | [
"0.7785723",
"0.76860976",
"0.7485511",
"0.74388176",
"0.74388176",
"0.74005896",
"0.73079014",
"0.73079014",
"0.7281119",
"0.7251366",
"0.71842253",
"0.71311045",
"0.71124214",
"0.70819384",
"0.7062265",
"0.7054427",
"0.70375437",
"0.7022726",
"0.70078486",
"0.6969562",
"0.6... | 0.77154535 | 1 |
Check that every element of an array is an integer | def int_array_check(arr)
arr.each do |element|
Integer(element) != nil rescue return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_integer_array? array\n\t\treturn array.all? {|a| a.is_a? Integer}\n\tend",
"def expect_array_of_integers(value, field, subfield)\n return false unless expect_array(value, field, subfield)\n error_count = 0\n value.each_with_index do |v, i|\n error_count += 1 unless expect_integer(v, field, \... | [
"0.8201035",
"0.7545777",
"0.74823475",
"0.7456256",
"0.72058266",
"0.71517855",
"0.69280845",
"0.68447506",
"0.67445415",
"0.67261976",
"0.67191446",
"0.6716126",
"0.67059094",
"0.67059094",
"0.66723394",
"0.6657722",
"0.65783113",
"0.65762496",
"0.6320197",
"0.63043535",
"0... | 0.78944993 | 1 |
Returns an array of DomainInfo objects from each row of the worksheet | def fetch_certs_from_worksheet(worksheet) # class method
domain_infos = Array.new
(2..worksheet.num_rows).each do |row| # first row is header
domain = worksheet[row, DOMAIN_COL]
days_to_notify = fetch_csv_array(worksheet[row, DAYS_COL])
# Don't use row if it is invalid
if domain.emp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) d... | [
"0.5899116",
"0.58338934",
"0.5830932",
"0.5611918",
"0.5611415",
"0.5598804",
"0.558254",
"0.5574978",
"0.5567311",
"0.5497265",
"0.5456864",
"0.54358953",
"0.5430412",
"0.5346233",
"0.53373265",
"0.5312618",
"0.53106946",
"0.5273791",
"0.52662134",
"0.525596",
"0.5255676",
... | 0.73706734 | 0 |
Expecting string: "A1:hit B10:miss" Processes the result, marks the field appropriately, changes the sequence of shots accordingly. | def process_shot_result(shot_result)
shot_result.split(/:|\s/).each_slice(2) do |location, result|
field[location] = result.to_sym
has_hit(location) if field[location] == :hit
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_protein_hit(str, desc, query_hits)\n data = str.split(\",\")\n ProteinHitFloatIndicies.each do |index|\n data[index] = data[index].to_f\n end\n data << desc\n data << query_hits\n \n ProteinHit.new(*data)\n end",
"def parse_grimm(grimm_outp... | [
"0.5447488",
"0.5336484",
"0.5196144",
"0.5193202",
"0.5172869",
"0.5167905",
"0.5144815",
"0.514023",
"0.5099147",
"0.50526416",
"0.5049992",
"0.4988325",
"0.49721697",
"0.49398422",
"0.49225911",
"0.49178684",
"0.49163556",
"0.49040356",
"0.4890102",
"0.488303",
"0.48752442... | 0.7211474 | 0 |
::new Application with parameters. Parses options Sets loglevel | def initialize(*args)
parse_options(*args)
set_log_level
@@application = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(appname = nil)\n @appname = appname\n @log = Logger.new(STDERR)\n @log.progname = @appname\n @level = @log.level\n end",
"def initialize app, logger: nil\n @app = app\n @logger = logger\n end",
"def app\n # TODO: set logging level shouldn't be a... | [
"0.6818112",
"0.64594615",
"0.63585734",
"0.6309242",
"0.6167207",
"0.6148861",
"0.6115978",
"0.6098042",
"0.60679907",
"0.6032628",
"0.6032628",
"0.5980173",
"0.5972524",
"0.59556144",
"0.59317595",
"0.5912391",
"0.59084064",
"0.5893129",
"0.58828133",
"0.5879854",
"0.586496... | 0.80029 | 0 |
Add Examiner to report on. The report will output results for all added examiners. | def add_examiner(examiner)
@total_smell_count += examiner.smells_count
@examiners << examiner
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def report_learner\n # I'm using the ! here so we can track down errors faster if there is an issue making\n # the report_learner\n super || create_report_learner!\n end",
"def add_report\n # TODO: should traverse listener queue for conditions and callbacks\n if @rain == :warning or @rain == :imm... | [
"0.5348647",
"0.52574337",
"0.5132551",
"0.5118087",
"0.5097503",
"0.509313",
"0.5079046",
"0.5067479",
"0.50552934",
"0.503946",
"0.4997131",
"0.49837166",
"0.49324992",
"0.49324992",
"0.49324992",
"0.49324992",
"0.49324992",
"0.49136785",
"0.49005815",
"0.48933992",
"0.4859... | 0.7533612 | 0 |
Builds a function that return a list of fitnesses for a list of genotypes. Since Parallel runs in separate fork, this overload is needed to fetch out the training set before returning the fitness to the optimizer | def gen_fit_fn type, ntrials: ntrials_per_ind
return super unless type.nil? || type == :parallel
nprocs = Parallel.processor_count - 1 # it's actually faster this way
puts "Running in parallel on #{nprocs} processes"
-> (genotypes) do
print "Fits: "
fits, parall_infos = Parallel.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gen_fit_fn type, ntrials: nil\n type ||= :parallel\n case type\n # SEQUENTIAL ON SINGLE ENVIRONMENT\n # => to catch problems with `Parallel` env spawning\n when :sequential_single\n -> (genotypes) { genotypes.map &method(:fitness_one) }\n # SEQUENTIAL ON MULTIPLE ENVIRONMEN... | [
"0.73316866",
"0.5610868",
"0.55328923",
"0.5483374",
"0.5483374",
"0.5461839",
"0.542036",
"0.5326921",
"0.5294536",
"0.5168102",
"0.49848086",
"0.4983288",
"0.4887613",
"0.48796126",
"0.48698297",
"0.48691118",
"0.47602278",
"0.47268122",
"0.47265217",
"0.4715118",
"0.46916... | 0.7254702 | 1 |
Return an action for an encoded observation The neural network is activated on the code, then its output is interpreted as a corresponding action | def action_for code
output = net.activate code
nans = output.isnan
# this is a pretty reliable bug indicator
raise "\n\n\tNaN network output!!\n\n" if nans.any?
# action = output[0...6].max_index # limit to 6 actions
action = output.max_index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_for observation\n # TODO: continuous actions (checked at `init_env`)\n input = observation.tolist.to_a\n # TODO: probably a function generator here would be notably more efficient\n # TODO: the normalization range depends on the net's activation function!\n output = net.activate... | [
"0.73423195",
"0.6029049",
"0.57453024",
"0.56295407",
"0.55935466",
"0.55935466",
"0.55935466",
"0.55935466",
"0.5586722",
"0.535108",
"0.53325653",
"0.53325653",
"0.53325653",
"0.53325653",
"0.5329259",
"0.5329259",
"0.5329259",
"0.5329259",
"0.53101176",
"0.5266695",
"0.52... | 0.7457633 | 0 |
GET /tasks_translations/1 GET /tasks_translations/1.xml | def show
@tasks_translation = TasksTranslation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @tasks_translation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tasks_translation = TasksTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def translations(lang... | [
"0.6161382",
"0.60855395",
"0.60156786",
"0.6014239",
"0.5986636",
"0.59794897",
"0.59421444",
"0.5916029",
"0.5911339",
"0.5886465",
"0.5881313",
"0.58089095",
"0.5805754",
"0.57732743",
"0.57634354",
"0.5756552",
"0.57557786",
"0.5734326",
"0.5657179",
"0.5623847",
"0.56137... | 0.7059508 | 0 |
GET /tasks_translations/new GET /tasks_translations/new.xml | def new
@tasks_translation = TasksTranslation.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @tasks_translation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re... | [
"0.695351",
"0.681781",
"0.681781",
"0.681781",
"0.681781",
"0.6811606",
"0.68010306",
"0.67411697",
"0.66611695",
"0.6659251",
"0.6552536",
"0.65156525",
"0.6451627",
"0.64503384",
"0.6429063",
"0.6428584",
"0.64077604",
"0.6402117",
"0.63208574",
"0.63081473",
"0.62978756",... | 0.76929295 | 0 |
POST /tasks_translations POST /tasks_translations.xml | def create
@tasks_translation = TasksTranslation.new(params[:tasks_translation])
respond_to do |format|
if @tasks_translation.save
format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }
format.xml { render :xml => @tasks_transla... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_translations\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def create\n @events_translation = EventsTranslation.new(params[:events_translation])\n\n respond_to do |format|\n if @events_translation.save\n format.html { redir... | [
"0.67565733",
"0.5894751",
"0.5811457",
"0.57417226",
"0.5655364",
"0.56385374",
"0.5638287",
"0.5601117",
"0.55633235",
"0.55541253",
"0.55426544",
"0.55190897",
"0.5487896",
"0.54401577",
"0.54032",
"0.5394314",
"0.5340205",
"0.5333159",
"0.53139836",
"0.5313373",
"0.531119... | 0.66660917 | 1 |
PUT /tasks_translations/1 PUT /tasks_translations/1.xml | def update
@tasks_translation = TasksTranslation.find(params[:id])
respond_to do |format|
if @tasks_translation.update_attributes(params[:tasks_translation])
format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully updated.') }
format.xml { he... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n\r\n data = params.except(:action, :controller, :options)\r\n options = params[:options]\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{options[\"locale\"]}/#{APP_SID}.po\"))\r\n\r\n # Find translation\r\n\r\n @locale = translations.find { |t| t.comment == d... | [
"0.59877926",
"0.585553",
"0.582672",
"0.58142734",
"0.580088",
"0.5783669",
"0.577683",
"0.57681143",
"0.5725884",
"0.57240653",
"0.5716707",
"0.57111347",
"0.57111347",
"0.56954956",
"0.5636602",
"0.5621261",
"0.5614721",
"0.5599098",
"0.5580927",
"0.55802065",
"0.55754143"... | 0.6670991 | 0 |
DELETE /tasks_translations/1 DELETE /tasks_translations/1.xml | def destroy
@tasks_translation = TasksTranslation.find(params[:id])
@tasks_translation.destroy
respond_to do |format|
format.html { redirect_to(admin_tasks_translations_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_translations\n end",
"def delete_translations\n TranslationKey.find_by(name: description_translation_key).try(:destroy)\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html ... | [
"0.72990125",
"0.6736443",
"0.6604033",
"0.65872294",
"0.64097464",
"0.6369544",
"0.63376635",
"0.63249373",
"0.6318398",
"0.63169014",
"0.6302202",
"0.6277306",
"0.6277306",
"0.6277306",
"0.6277306",
"0.62321115",
"0.6225642",
"0.6221018",
"0.6177301",
"0.61757106",
"0.61618... | 0.74211144 | 0 |
GET /contentareas/1 GET /contentareas/1.json | def show
@contentarea = Contentarea.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @contentarea }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end",
"def index\n @core_areas = Core::Area.find_mine(params).paginate(page: params[:page])\n\n ... | [
"0.6896688",
"0.67522126",
"0.6700889",
"0.65714943",
"0.6499365",
"0.6494538",
"0.6450973",
"0.6408846",
"0.63800746",
"0.63278615",
"0.6327422",
"0.6306175",
"0.6303182",
"0.630316",
"0.6285437",
"0.6242746",
"0.6236289",
"0.61805433",
"0.6167691",
"0.6108322",
"0.60960263"... | 0.7496818 | 0 |
GET /contentareas/new GET /contentareas/new.json | def new
@contentarea = Contentarea.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @contentarea }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end",
"def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ar... | [
"0.7594549",
"0.737397",
"0.737397",
"0.73288965",
"0.71919423",
"0.71270627",
"0.70101136",
"0.69096786",
"0.68503803",
"0.6825309",
"0.67825854",
"0.6714131",
"0.67098624",
"0.6695262",
"0.6695262",
"0.66949016",
"0.6694842",
"0.66306186",
"0.6622167",
"0.6621261",
"0.66148... | 0.8025531 | 0 |
POST /contentareas POST /contentareas.json | def create
@contentarea = Contentarea.new(params[:contentarea])
respond_to do |format|
if @contentarea.save
format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }
format.json { render json: @contentarea, status: :created, location: @contentarea }
e... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render j... | [
"0.676901",
"0.6386255",
"0.62644666",
"0.59451544",
"0.58977705",
"0.5799224",
"0.5799224",
"0.5781559",
"0.5684307",
"0.56748056",
"0.5647956",
"0.5618514",
"0.56175065",
"0.5572897",
"0.5566222",
"0.5551608",
"0.5539072",
"0.5535006",
"0.552705",
"0.55235976",
"0.5517436",... | 0.6968393 | 0 |
PUT /contentareas/1 PUT /contentareas/1.json | def update
@contentarea = Contentarea.find(params[:id])
respond_to do |format|
if @contentarea.update_attributes(params[:contentarea])
format.html { redirect_to @contentarea, notice: 'Contentarea was successfully updated.' }
format.json { head :no_content }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n if @question_content_area.update_attributes(params[:question_content_area])\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully updated.' }\n ... | [
"0.65948105",
"0.6158481",
"0.6158481",
"0.6158481",
"0.60637283",
"0.59376276",
"0.59227276",
"0.5866951",
"0.58296347",
"0.5743351",
"0.57418835",
"0.5712889",
"0.56902057",
"0.5688713",
"0.56774104",
"0.5653293",
"0.5653293",
"0.5646075",
"0.56446224",
"0.5625076",
"0.5595... | 0.7002027 | 0 |
DELETE /contentareas/1 DELETE /contentareas/1.json | def destroy
@contentarea = Contentarea.find(params[:id])
@contentarea.destroy
respond_to do |format|
format.html { redirect_to contentareas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @question_content_area = QuestionContentArea.find(params[:id])\n @question_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to question_content_areas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_area.destroy\n respo... | [
"0.7327646",
"0.71997595",
"0.7021301",
"0.7021301",
"0.7021301",
"0.69308525",
"0.6893276",
"0.68679726",
"0.68096644",
"0.67741394",
"0.67741394",
"0.67516667",
"0.6697249",
"0.6693985",
"0.6692189",
"0.66753334",
"0.66482323",
"0.66410965",
"0.66374415",
"0.66193974",
"0.6... | 0.786855 | 0 |
POST /embed_code_universities POST /embed_code_universities.json | def create
@embed_code_university = EmbedCodeUniversity.new(embed_code_university_params)
if params[:contact_id]
contact = params.require(:contact_id)
@embed_code_university.university_contacts << UniversityContact.find(contact)
end
respond_to do |format|
if @embed_code_university.save
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.update(embed_code_university_params)\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @embed_code_university... | [
"0.6561654",
"0.6505931",
"0.64317286",
"0.6308491",
"0.60532117",
"0.55457324",
"0.549462",
"0.5350438",
"0.53497",
"0.5296971",
"0.5296971",
"0.5277536",
"0.5271339",
"0.5269633",
"0.52593035",
"0.5210479",
"0.5209481",
"0.5188841",
"0.5183995",
"0.515444",
"0.51502603",
... | 0.68230885 | 0 |
PATCH/PUT /embed_code_universities/1 PATCH/PUT /embed_code_universities/1.json | def update
respond_to do |format|
if @embed_code_university.update(embed_code_university_params)
format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }
format.json { render :show, status: :ok, location: @embed_code_university }
else
format.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { respond_with_bip(@university) }\n else\n format.html { render :edit }\n format.json { res... | [
"0.6673092",
"0.63839614",
"0.635037",
"0.635037",
"0.62727827",
"0.6161661",
"0.6011112",
"0.5980833",
"0.59548396",
"0.5923257",
"0.5909905",
"0.5896523",
"0.58769166",
"0.5851674",
"0.58383316",
"0.5838162",
"0.58330756",
"0.5827918",
"0.578646",
"0.571788",
"0.5713672",
... | 0.76467544 | 0 |
DELETE /embed_code_universities/1 DELETE /embed_code_universities/1.json | def destroy
@embed_code_university.destroy
respond_to do |format|
format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @university = University.find(params[:id])\n @university.destroy\n\n respond_to do |format|\n format.html { redirect_to universities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @university = University.find(params[:id])\n @university.destroy\n\... | [
"0.73060924",
"0.73060924",
"0.7090322",
"0.7089909",
"0.68064755",
"0.6706084",
"0.6702609",
"0.66959804",
"0.6657496",
"0.66157734",
"0.66149294",
"0.66105574",
"0.65992403",
"0.65505385",
"0.65489465",
"0.6540941",
"0.65293753",
"0.65212345",
"0.65010345",
"0.6481699",
"0.... | 0.782282 | 0 |
Asks the user to select a player to get a card from and a rank to ask for calls add_and_reaveal and returns true if the player gets the card and calls | def try_getting_cards_from_player(selected_rank)
selected_player = select_other_player
selected_player_id = game.get_player_index(selected_player)
if game.players[selected_player_id].has_card_with_rank?(selected_rank)
add_and_reveal(game.players[selected_player_id].remove_cards_with_rank(selected_rank... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_for_cards_until_go_fish_and_get_last_requested_rank\n while true\n selected_rank = player.select_rank\n if !try_getting_cards_from_player(selected_rank)\n return selected_rank\n end\n end\n end",
"def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = ... | [
"0.7087192",
"0.68060803",
"0.6471887",
"0.6410753",
"0.63691777",
"0.6340101",
"0.63045573",
"0.627193",
"0.624135",
"0.6214965",
"0.6193872",
"0.61796653",
"0.6175372",
"0.61695784",
"0.6155624",
"0.61397594",
"0.61391777",
"0.6135714",
"0.6131522",
"0.6106471",
"0.60844505... | 0.7425027 | 0 |
Lets the user ask for cards unitl they don't get a card with the rank they ask for. Returns the last requested rank. | def ask_for_cards_until_go_fish_and_get_last_requested_rank
while true
selected_rank = player.select_rank
if !try_getting_cards_from_player(selected_rank)
return selected_rank
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank_of_card_at (num)\n cards.fetch(num, \"Index #{num} is out of bounds.\")\n end",
"def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end",
"def rank(response)\n rank = response.to_i\n if rank >= 1 && rank <= 5\n @current_listen.rank = rank\n else\... | [
"0.6651997",
"0.6469888",
"0.63968843",
"0.63383466",
"0.6257167",
"0.6227293",
"0.6101071",
"0.6099209",
"0.602198",
"0.6011953",
"0.5976888",
"0.59071684",
"0.5869691",
"0.5789175",
"0.5785682",
"0.572977",
"0.5724424",
"0.5667923",
"0.5659634",
"0.56245595",
"0.5622125",
... | 0.78995335 | 0 |
Adds a card to the player's hand. Announces it to other players, but doesn't show what card got added | def add_card_without_revealing_details(card)
player.add_card_to_hand(card)
message = "#{player.name} drew a card from the center."
game.players.each {|player| player.send_message_to_user(message)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_card(card)\n @addhand = @addhand + card\n end",
"def addCardToHand(card)\n @hand << card\n end",
"def add(card)\n\t\t@hand_contents.push(card)\n\tend",
"def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to thi... | [
"0.8352869",
"0.81945187",
"0.81460637",
"0.8036714",
"0.8004742",
"0.7983781",
"0.7936867",
"0.7925681",
"0.7921334",
"0.7882519",
"0.7870291",
"0.78693336",
"0.78693336",
"0.7858476",
"0.7805674",
"0.77728564",
"0.77636373",
"0.7740002",
"0.7717491",
"0.766325",
"0.76440233... | 0.8249915 | 1 |
GET /alco_drinks GET /alco_drinks.json | def index
@alco_drinks = AlcoDrink.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drinks\n top_drinks = Drink.top.limit(5)\n exclude_drink_ids = top_drinks.map(&:id)\n top_gin_drinks = Drink.top(Ingredient.gin_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_gin_drinks.map(&:id)\n top_vodka_drinks = Drink.top(Ingredient.vodka_canonical_id, exclude_drink_id... | [
"0.6568109",
"0.61779475",
"0.6090409",
"0.6040155",
"0.6032922",
"0.598778",
"0.59847236",
"0.5946186",
"0.59275955",
"0.592282",
"0.5868661",
"0.58345133",
"0.5808626",
"0.5778309",
"0.5769778",
"0.5703969",
"0.5690444",
"0.5667428",
"0.56601036",
"0.563854",
"0.559185",
... | 0.71127003 | 0 |
POST /alco_drinks POST /alco_drinks.json | def create
@alco_drink = AlcoDrink.new(alco_drink_params)
respond_to do |format|
if @alco_drink.save
format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully created.' }
format.json { render :show, status: :created, location: @alco_drink }
else
format.html... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alco_drink_params\n params.require(:alco_drink).permit(:title, :price, :type, :size, :url, :alko_id)\n end",
"def create\n @order = Order.new(order_params)\n @drink = Drink.where(drink: @order.drink).first\n if @drink.nil?\n respond_to do |format|\n format.json { render json: {},... | [
"0.6683482",
"0.61139476",
"0.609797",
"0.60717994",
"0.59599084",
"0.595412",
"0.58226043",
"0.57504964",
"0.5657172",
"0.5572373",
"0.5543805",
"0.5514553",
"0.54904985",
"0.54771066",
"0.5451169",
"0.538125",
"0.53686506",
"0.53679967",
"0.53570217",
"0.534887",
"0.534887"... | 0.7058279 | 0 |
PATCH/PUT /alco_drinks/1 PATCH/PUT /alco_drinks/1.json | def update
respond_to do |format|
if @alco_drink.update(alco_drink_params)
format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully updated.' }
format.json { render :show, status: :ok, location: @alco_drink }
else
format.html { render :edit }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n en... | [
"0.6167763",
"0.6046127",
"0.6044238",
"0.5989092",
"0.5945421",
"0.5919465",
"0.59105194",
"0.59084517",
"0.5903114",
"0.590088",
"0.5900537",
"0.5887939",
"0.5875218",
"0.5873801",
"0.5873735",
"0.5869736",
"0.58584195",
"0.58469945",
"0.58451927",
"0.5841187",
"0.58302134"... | 0.6719919 | 0 |
DELETE /alco_drinks/1 DELETE /alco_drinks/1.json | def destroy
@alco_drink.destroy
respond_to do |format|
format.html { redirect_to alco_drinks_url, notice: 'Alco drink was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]... | [
"0.6863395",
"0.673317",
"0.6686762",
"0.6623346",
"0.6570386",
"0.654684",
"0.64999276",
"0.6485959",
"0.6480546",
"0.64771634",
"0.6456781",
"0.6456781",
"0.6456781",
"0.6456781",
"0.64176786",
"0.6416048",
"0.6409534",
"0.6387968",
"0.6387438",
"0.63845104",
"0.63646704",
... | 0.7240925 | 0 |
Con un objeto de tipo MenuUsuarioTipo, arma el item del menu | def mostrar_item(menu)
# Si el item tiene url, controlador o accion, arma link, sino solo label
if (menu.controller != '') or (menu.action != '') or (menu.url != '')
if menu.url != ''
link_to menu.nombre, menu.url
else
link_to menu.nombre, :controller => menu.controller, :action => menu.action
end... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cargar_menu\n\t\tif session[:usuario]\n\t\t\t@opciones = Menu.find(:all, :order => 'padre, orden')\n\t\telse\n\t\t\t@opciones = []\n\t\tend\n\tend",
"def set_menu_item\n @menu_item = Menu::Item.find(params[:id])\n end",
"def getMenu(menu)\n end",
"def get_minimenu_item(minimenu, selection_type... | [
"0.6422874",
"0.62731093",
"0.62680507",
"0.6233922",
"0.6194415",
"0.61502635",
"0.61484414",
"0.61484414",
"0.61484414",
"0.60961294",
"0.608925",
"0.60805655",
"0.60748905",
"0.6038914",
"0.6038914",
"0.59662557",
"0.5921124",
"0.58893704",
"0.5887467",
"0.58720475",
"0.58... | 0.67245966 | 0 |
any character existing in remove must be deleted from str. eg "Battle of the Vowels: Hawaii vs. Grozny" and remove "aeiou" => "Bttl f th Vwls: Hw vs. Grzny" Ruby | def remove_str(str, remove)
original = str.split(//)
deleted = remove.split(//)
deleted.each {|char| original.delete(char)}
return original.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_vowels str\n str.delete \"aeiouAEIOU\"\nend",
"def disemvowel(str)\n str = str.delete 'AEIOUaeiou'\nend",
"def disemvowel(str)\n str.delete(\"aAeEiIoOuU\")\nend",
"def remove(str, char)\n output = \"\"\n i = 0\n while i < str.length\n if str[i] != char\n output ... | [
"0.73357683",
"0.71370786",
"0.7132476",
"0.7121308",
"0.71005595",
"0.7092973",
"0.7079901",
"0.70628387",
"0.7058515",
"0.70107335",
"0.70107335",
"0.7001405",
"0.69934356",
"0.69853026",
"0.6936308",
"0.6925361",
"0.6925285",
"0.69170123",
"0.6890742",
"0.68784535",
"0.686... | 0.7808549 | 0 |
GET /early_pregnancies/1 GET /early_pregnancies/1.json | def show
@early_pregnancy = EarlyPregnancy.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @early_pregnancy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end",
"def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early... | [
"0.6607259",
"0.5896155",
"0.5757807",
"0.5686196",
"0.5648688",
"0.5601559",
"0.5581479",
"0.5526163",
"0.55183405",
"0.54334307",
"0.5431434",
"0.53846765",
"0.53814524",
"0.5350196",
"0.5338833",
"0.5335959",
"0.53309476",
"0.53258055",
"0.52821755",
"0.5280087",
"0.527724... | 0.7305416 | 0 |
GET /early_pregnancies/new GET /early_pregnancies/new.json | def new
@early_pregnancy = EarlyPregnancy.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @early_pregnancy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :cre... | [
"0.71642154",
"0.6592127",
"0.658093",
"0.6579997",
"0.6573371",
"0.65501714",
"0.64037865",
"0.63793546",
"0.63466704",
"0.63428956",
"0.63062537",
"0.63062537",
"0.6297843",
"0.62836426",
"0.62761027",
"0.6255826",
"0.62323004",
"0.6222083",
"0.62170804",
"0.62131166",
"0.6... | 0.7544288 | 0 |
POST /early_pregnancies POST /early_pregnancies.json | def create
@early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])
respond_to do |format|
if @early_pregnancy.save
format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }
format.json { render json: @early_pregnancy, status: :created, locat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end",
"def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html... | [
"0.64132714",
"0.5656938",
"0.5608786",
"0.5480234",
"0.5391715",
"0.5363662",
"0.52588636",
"0.52548546",
"0.52204686",
"0.521578",
"0.5165906",
"0.511465",
"0.511465",
"0.509548",
"0.5047906",
"0.50300527",
"0.49915105",
"0.4983485",
"0.49808344",
"0.49736133",
"0.49634275"... | 0.71314317 | 0 |
PUT /early_pregnancies/1 PUT /early_pregnancies/1.json | def update
@early_pregnancy = EarlyPregnancy.find(params[:id])
respond_to do |format|
if @early_pregnancy.update_attributes(params[:early_pregnancy])
format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }
format.json { head :no_content }
el... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :cre... | [
"0.6239597",
"0.5926131",
"0.5761822",
"0.5761411",
"0.57360405",
"0.56143844",
"0.555663",
"0.555663",
"0.55200493",
"0.54148245",
"0.5318787",
"0.5304119",
"0.51861477",
"0.51332426",
"0.5127757",
"0.51260257",
"0.5119609",
"0.50711143",
"0.5069658",
"0.5047927",
"0.5038554... | 0.706012 | 0 |
DELETE /early_pregnancies/1 DELETE /early_pregnancies/1.json | def destroy
@early_pregnancy = EarlyPregnancy.find(params[:id])
@early_pregnancy.destroy
respond_to do |format|
format.html { redirect_to early_pregnancies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to pregnancies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: ... | [
"0.70484656",
"0.67547834",
"0.6423742",
"0.63645214",
"0.6359939",
"0.6349028",
"0.6336078",
"0.6322436",
"0.6320436",
"0.6317159",
"0.6317159",
"0.63131094",
"0.63129115",
"0.6296011",
"0.6293658",
"0.6290253",
"0.6281394",
"0.62769383",
"0.6272711",
"0.6268596",
"0.6263143... | 0.7691479 | 0 |
The main view. This method builds the layout and returns the root view. | def view
unless is_parent_layout?
return parent_layout.view
end
@view ||= build_view
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n ... | [
"0.696131",
"0.6337119",
"0.6249508",
"0.60417897",
"0.60375375",
"0.6011281",
"0.600083",
"0.5982055",
"0.59603757",
"0.592674",
"0.5913294",
"0.58889717",
"0.58214444",
"0.5812093",
"0.57851976",
"0.57821167",
"0.57670414",
"0.57340527",
"0.5695982",
"0.5666105",
"0.5666105... | 0.71861297 | 0 |
Checks if the layout has been built yet or not. | def built?
!@view.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_in_layout?\n !(asset_file? || yaml_file? || no_layout?)\n end",
"def layout_available?\n if !@_layout_available\n @_layout_available = @site.layouts.include? @layout\n end\n @_layout_available\n end",
"def place_in_layout?\n !(asset_file? || no_layout?)\n end"... | [
"0.6809192",
"0.67895335",
"0.6743891",
"0.65651697",
"0.65258586",
"0.6502042",
"0.6496876",
"0.6496876",
"0.6353048",
"0.6342761",
"0.6309128",
"0.6240439",
"0.61594933",
"0.6091123",
"0.6071223",
"0.5975046",
"0.5949774",
"0.59473664",
"0.589373",
"0.5857565",
"0.5817412",... | 0.734391 | 0 |
just in case Assign a view to act as the 'root' view for this layout. This method can only be called once, and must be called before `add` is called for the first time (otherwise `add` will create a default root view). This method must be called from inside `layout`, otherwise you should just use `create`. You can also... | def root(element, element_id=nil, &block)
if @view
raise ContextConflictError.new("Already created the root view")
end
unless @assign_root
raise InvalidRootError.new("You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)")
end
@assign... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_element(elem, element_id)\n if elem.is_a?(Class) && elem < TreeLayout\n layout = elem.new\n elem = layout.view\n elsif elem.is_a?(Class)\n elem = elem.new\n elsif elem.is_a?(TreeLayout)\n layout = elem\n elem = elem.view\n end\n\n if layout... | [
"0.67284423",
"0.5926831",
"0.59161115",
"0.5851478",
"0.5749565",
"0.56178254",
"0.556424",
"0.5561739",
"0.5547552",
"0.55419034",
"0.5516469",
"0.5512008",
"0.5414251",
"0.5414251",
"0.5381627",
"0.53578526",
"0.5327044",
"0.5322114",
"0.53206384",
"0.53086996",
"0.5288341... | 0.8038992 | 0 |
Calls the style method of all objects in the view hierarchy that are part of this layout. The views in a child layout are not styled, but those layouts will receive a `reapply!` message if no root is specified. | def reapply!
root ||= self.view
@layout_state = :reapply
run_reapply_blocks
@child_layouts.each do |child_layout|
child_layout.reapply!
end
@layout_state = :initial
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout()\n layout_children()\n end",
"def style_and_context(element, element_id, &block)\n style_method = \"#{element_id}_style\"\n if parent_layout.respond_to?(style_method) || block_given?\n parent_layout.context(element) do\n if parent_layout.respond_to?(style_method)... | [
"0.5456927",
"0.53594893",
"0.5162902",
"0.5130848",
"0.51273304",
"0.50704503",
"0.48461854",
"0.48304355",
"0.47790796",
"0.47399643",
"0.46746725",
"0.46544686",
"0.46487",
"0.4647446",
"0.46388987",
"0.46213907",
"0.46047938",
"0.45974174",
"0.45681214",
"0.45681214",
"0.... | 0.715275 | 0 |
Just like `last`, but if `last` returns a Layout, this method returns the layout's view. | def last_view(element_id)
element = last(element_id)
if element.is_a?(Layout)
element = element.view
end
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def find\n self.class.find(@view.layout)\n end",
"def layout\n lookup_layout\n end",
"def layout \n return @layout\n end",
"def _\n\t\tviewStack = s... | [
"0.73148465",
"0.70989007",
"0.65639526",
"0.6493659",
"0.6479423",
"0.6402021",
"0.6356232",
"0.63348323",
"0.62675834",
"0.6239946",
"0.6193393",
"0.6181329",
"0.61765033",
"0.61596245",
"0.61401516",
"0.61368835",
"0.6056468",
"0.60201174",
"0.59620094",
"0.594193",
"0.585... | 0.74260455 | 0 |
Returns all the elements with a given element_id | def all(element_id)
unless is_parent_layout?
return parent_layout.all(element_id)
end
@elements[element_id] || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_element id\n @elements[id.to_s]\n end",
"def element(id, params = {})\n get \"elements/#{id}\", {query: params}\n end",
"def find_all_by_id(id)\n find_all_by(:id, id)\n end",
"def element_by_id(elem_id)\r\n @web_browser.element_by_id(elem_id)\r\n end",
"def element_by_id... | [
"0.6787612",
"0.6639251",
"0.65340084",
"0.6308503",
"0.62612784",
"0.61858505",
"0.6075681",
"0.60415745",
"0.59866464",
"0.59804946",
"0.5970512",
"0.5881137",
"0.5876568",
"0.5869331",
"0.58307356",
"0.58008057",
"0.5800154",
"0.5800154",
"0.57604736",
"0.57374907",
"0.571... | 0.6994673 | 0 |
Just like `nth`, but if `nth` returns a Layout, this method returns the layout's view. | def nth_view(element_id, index)
element = nth(element_id)
if element.is_a?(Layout)
element = element.view
end
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find\n self.class.find(@view.layout)\n end",
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.v... | [
"0.6847427",
"0.6807654",
"0.63781375",
"0.6239731",
"0.6131137",
"0.59874547",
"0.58707976",
"0.5802285",
"0.56963944",
"0.56713474",
"0.5628221",
"0.56259525",
"0.55989623",
"0.55948174",
"0.5575403",
"0.5530654",
"0.54947513",
"0.5482559",
"0.54551005",
"0.5448186",
"0.544... | 0.7683796 | 0 |
This searches for the "nearest" view with a given id. First, all child views are checked. Then the search goes up to the parent view, and its child views are checked. This means any view that is in the parent view's hierarchy is considered closer than a view in a grandparent's hierarchy. This is a "depthfirst" search, ... | def nearest(element_id)
nearest(element_id, from: target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(id)\n sort() unless @sorted\n @tree.bsearch { |x| x.id == id }\n end",
"def find(id)\n each_descendant(false).detect {|op| op.id == id}\n end",
"def closest_parent(type, this_view = nil)\n this_view ||= view_or_self.superview\n while this_view != nil do\n retu... | [
"0.6051466",
"0.57747096",
"0.5398215",
"0.5309833",
"0.53007185",
"0.5266479",
"0.52470285",
"0.523239",
"0.523239",
"0.52228904",
"0.52208805",
"0.5209493",
"0.51327574",
"0.5075573",
"0.50686324",
"0.5068311",
"0.50654376",
"0.4990059",
"0.49706864",
"0.49682602",
"0.49465... | 0.63626915 | 0 |
Removes a view from the list of elements this layout is "tracking", but leaves it in the view hierarchy. Returns the views that were removed. | def forget(element_id)
unless is_parent_layout?
return parent_layout.remove(element_id)
end
removed = nil
context(self.view) do
removed = all(element_id)
@elements[element_id] = nil
end
removed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end",
"def forget_tree(element_id, view)\n removed = forget_view(element_id, view)\n if view.subviews\n view.subviews.each do | sub |\n if (sub_ids = sub.motion_kit_meta[:motion_kit_ids])\n sub... | [
"0.66157573",
"0.5968465",
"0.5898754",
"0.5719658",
"0.5623492",
"0.5612306",
"0.5410967",
"0.5232013",
"0.513814",
"0.5111841",
"0.50762504",
"0.50626093",
"0.5020968",
"0.50082934",
"0.50068396",
"0.49651092",
"0.4945815",
"0.4918972",
"0.48925567",
"0.4891927",
"0.4890746... | 0.6103588 | 1 |
This method builds the layout and returns the root view. | def build_view
# Only in the 'layout' method will we allow default container to be
# created automatically (when 'add' is called)
@assign_root = true
prev_should_run = @should_run_deferred
@should_run_deferred = true
layout
unless @view
if @assign_root
create_... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def layout\n @layout\n end",
"def root\n blk = self.class.has_widgets_blocks or raise \"Please setup a widget tree using has_widgets()\"\n @root ||= Apotomo::... | [
"0.7210227",
"0.63595414",
"0.6343041",
"0.6262489",
"0.6257939",
"0.62497544",
"0.6186043",
"0.618303",
"0.6124064",
"0.610619",
"0.6065549",
"0.5998523",
"0.59898144",
"0.5923627",
"0.58750683",
"0.58750683",
"0.58321255",
"0.5807749",
"0.57807946",
"0.57748705",
"0.5741783... | 0.7055751 | 1 |
Calls the `_style` method with the element as the context, and runs the optional block in that context. This is usually done immediately after `initialize_element`, except in the case of `add`, which adds the item to the tree before styling it. | def style_and_context(element, element_id, &block)
style_method = "#{element_id}_style"
if parent_layout.respond_to?(style_method) || block_given?
parent_layout.context(element) do
if parent_layout.respond_to?(style_method)
parent_layout.send(style_method)
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(element, element_id=nil, options={}, &block)\n # make sure we have a target - raises NoContextError if none exists\n self.target\n\n unless @context\n create_default_root_context\n end\n\n # We want to be sure that the element has a supeview or superlayer before\n # the... | [
"0.58125013",
"0.5554899",
"0.5544672",
"0.5485018",
"0.5391613",
"0.5356065",
"0.5098809",
"0.5097967",
"0.49983513",
"0.49909022",
"0.4780992",
"0.4774864",
"0.47722697",
"0.4732404",
"0.47293657",
"0.47261757",
"0.47047907",
"0.4697932",
"0.46967188",
"0.4684911",
"0.46620... | 0.7057737 | 0 |
returns the open and close times for the specified date or an empty array if closed on that date | def open_close_times(date)
open_close = @open_close[as_string(date)] || @open_close[as_sym(date)] || @default_open_close
open_close.collect { |h| Time.parse("#{as_string(date)} #{h}") }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_next_open(date)\n closed_at = open_close_times(date).last\n date = next_day(date)\n while open_close_times(date) == CLOSED\n date = next_day(date)\n end\n open_at = open_close_times(date).first\n open_at - closed_at\n end",
"def time_already_open(date)\n open = open_close_t... | [
"0.64534926",
"0.6409739",
"0.63603306",
"0.6299311",
"0.6200742",
"0.61581165",
"0.6029236",
"0.5951282",
"0.5842453",
"0.5797058",
"0.5791879",
"0.57281333",
"0.5622623",
"0.55761486",
"0.55488986",
"0.5543903",
"0.54923105",
"0.5436157",
"0.54332745",
"0.5417022",
"0.54121... | 0.82159126 | 0 |
the length of time available during a specified day to do work e.g., there are 6 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 9:00 AM there are 5 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 10:00 AM | def work_time(date)
open, closed = open_close_times(date)
closed - open - time_already_open(date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end",
"def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end",
"def min_available_talks_time_in_a_day\n 6*60\n end",
"def length\... | [
"0.6979938",
"0.68157035",
"0.68014127",
"0.6740032",
"0.6679813",
"0.6666197",
"0.65870154",
"0.6526906",
"0.65135354",
"0.6505848",
"0.647279",
"0.6434604",
"0.63763",
"0.6364804",
"0.636263",
"0.63397336",
"0.63150114",
"0.63057137",
"0.6286855",
"0.62328106",
"0.6227468",... | 0.6992688 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.