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 |
|---|---|---|---|---|---|---|
POST /backend/conf_activities POST /backend/conf_activities.json | def create
@backend_conf_activity = Conf::Activity.new(backend_conf_activity_params)
respond_to do |format|
if @backend_conf_activity.save
format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully created.' }
format.json { render... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backend_conf_activity_params\n params.require(:conf_activity).permit(:attendee_id, :event_id, :happened_at)\n end",
"def index\n @backend_conf_activities = Conf::Activity.all\n end",
"def activities=(value)\n @activities = value\n end",
... | [
"0.6811024",
"0.6766937",
"0.63630164",
"0.6263741",
"0.6192873",
"0.6184391",
"0.60916066",
"0.60900486",
"0.6074553",
"0.60535264",
"0.59931517",
"0.59700567",
"0.5950243",
"0.59490144",
"0.5913923",
"0.586265",
"0.58443826",
"0.5834276",
"0.5823087",
"0.5748127",
"0.573898... | 0.73101914 | 0 |
PATCH/PUT /backend/conf_activities/1 PATCH/PUT /backend/conf_activities/1.json | def update
respond_to do |format|
if @backend_conf_activity.update(backend_conf_activity_params)
format.html { redirect_to backend_conf_activity_path(@backend_conf_activity), notice: 'Conf activity was successfully updated.' }
format.json { render :show, status: :ok, location: backend_conf_act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n @activity.status = Activity::SETTED if @activity.setting?\n if @activity.update(activity_params)\n format.html { redirect_to activities_url, notice: 'Activity was successfully updated.' }\n format.json { head :no_content }\n else\n format... | [
"0.6343709",
"0.6178252",
"0.61266",
"0.6083994",
"0.6046057",
"0.59535855",
"0.5950184",
"0.5949612",
"0.5922814",
"0.58745855",
"0.5852685",
"0.58491933",
"0.58481866",
"0.5836546",
"0.5828746",
"0.5822278",
"0.5822278",
"0.5822278",
"0.5822278",
"0.5822278",
"0.5818107",
... | 0.7072661 | 0 |
DELETE /backend/conf_activities/1 DELETE /backend/conf_activities/1.json | def destroy
@backend_conf_activity.destroy
respond_to do |format|
format.html { redirect_to backend_conf_activities_url, notice: 'Conf activity was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @dev_activity.destroy\n respond_to do |format|\n format.html { redirect_to dev_activities_url }\n format.json { head :no_content }\n end\n end",
"def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend",
"def destroy\n @conf = Con... | [
"0.6913661",
"0.67800796",
"0.67069674",
"0.6680008",
"0.66371924",
"0.65827173",
"0.65827173",
"0.65827173",
"0.65827173",
"0.65827173",
"0.6514017",
"0.65045214",
"0.64559835",
"0.6423752",
"0.6423752",
"0.6419196",
"0.64056045",
"0.64056045",
"0.64015996",
"0.63698447",
"0... | 0.7667125 | 0 |
Returns a flat array containing all the possible child terms for this given ontology term | def all_child_terms
get_all_child_lists
return @all_child_terms
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_children( node=self )\n sql = <<-SQL\n select\n subject_term.identifier as child_identifier,\n subject_term.term_name as child_term,\n predicate_term.term_name as relation,\n object_term.identifier as parent_identifier,\n object_term.term_name as parent_te... | [
"0.71345043",
"0.70961",
"0.65151185",
"0.62965214",
"0.61568606",
"0.6139526",
"0.61349463",
"0.61024165",
"0.6081994",
"0.60605055",
"0.60132635",
"0.6008063",
"0.60002565",
"0.59987664",
"0.59987664",
"0.59987664",
"0.59980315",
"0.59953696",
"0.59926134",
"0.5988252",
"0.... | 0.7743936 | 0 |
Helper function to query the OLS database and grab the full details of the ontology term. | def get_term_details
# This query ensures we look at the most recent fully loaded ontologies
sql = <<-SQL
select term.*
from term
join ontology on ontology.ontology_id = term.ontology_id
where term.identifier = ?
order by ontology.fully_loaded desc, ontology.load_date asc
SQL
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_term_from_synonym\n sql = <<-SQL\n select term.*\n from term\n join ontology on ontology.ontology_id = term.ontology_id\n join term_synonym on term.term_pk = term_synonym.term_pk\n where term_synonym.synonym_value = ?\n order by ontology.fully_loaded desc, ontology.load_dat... | [
"0.68499243",
"0.6329367",
"0.6329367",
"0.62658453",
"0.62274903",
"0.61576813",
"0.6092739",
"0.59762514",
"0.5881532",
"0.58179694",
"0.5768398",
"0.57119757",
"0.5704081",
"0.5704081",
"0.5675916",
"0.5651722",
"0.55973685",
"0.5560954",
"0.5536284",
"0.5526757",
"0.54803... | 0.8191284 | 0 |
Helper function to try to find an ontology term via a synonym. | def get_term_from_synonym
sql = <<-SQL
select term.*
from term
join ontology on ontology.ontology_id = term.ontology_id
join term_synonym on term.term_pk = term_synonym.term_pk
where term_synonym.synonym_value = ?
order by ontology.fully_loaded desc, ontology.load_date asc
SQ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_synonyms(synonyms)\n return self.find_helper(@start_node, synonyms)\n end",
"def get_synonym(property, key)\n return unless property[:synonyms] && property[:synonyms].include?(key)\n property[:synonyms][key]\n end",
"def find_glossary_term!\n @glossary_term = find... | [
"0.63477594",
"0.6241856",
"0.59999985",
"0.5946214",
"0.588208",
"0.584254",
"0.5829018",
"0.57326806",
"0.5687308",
"0.5675328",
"0.5636151",
"0.5636151",
"0.56210554",
"0.5585503",
"0.55471754",
"0.5498107",
"0.5492347",
"0.5476299",
"0.54601806",
"0.5453996",
"0.5452583",... | 0.73792243 | 0 |
Recursive function to query the OLS database and collect all of the child objects and build up a tree of OntologyTerm's. | def get_children( node=self )
sql = <<-SQL
select
subject_term.identifier as child_identifier,
subject_term.term_name as child_term,
predicate_term.term_name as relation,
object_term.identifier as parent_identifier,
object_term.term_name as parent_term
fro... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_all_child_lists\n child_check\n \n if @all_child_terms.nil? and @all_child_names.nil?\n @all_child_terms = []\n @all_child_names = []\n \n self.children.each do |child|\n @all_child_terms.push( child.term )\n @all_child_terms.push( child.all_child_terms )\n ... | [
"0.644452",
"0.6351324",
"0.57664204",
"0.564825",
"0.56353563",
"0.56243473",
"0.56204253",
"0.5588224",
"0.55802494",
"0.5546854",
"0.5520916",
"0.54795843",
"0.5453274",
"0.5447956",
"0.54171306",
"0.53714335",
"0.5342707",
"0.5337988",
"0.53153515",
"0.5310372",
"0.528808... | 0.6723604 | 0 |
Helper function to check whether the children have already been found or not. | def child_check
if @children.nil? or @children.empty?
get_children unless @already_fetched_children
@already_fetched_children = true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def have_children?\n children.count != 0\n end",
"def children_exist?\n\tend",
"def has_children?\n children.size > 0\n end",
"def has_children?\n children.size > 0\n end",
"def has_children?\n !children.empty?\n end",
"def check_if_has_children\n self.lookups.count == 0\n ... | [
"0.7792547",
"0.7750983",
"0.77417713",
"0.77417713",
"0.7729542",
"0.7724229",
"0.7707363",
"0.7707363",
"0.76941514",
"0.76941514",
"0.76425475",
"0.7638289",
"0.7638289",
"0.7638289",
"0.7638289",
"0.7638189",
"0.7626998",
"0.7626998",
"0.7626998",
"0.7626998",
"0.76057714... | 0.8091491 | 0 |
Helper function to produce the flat lists of all the child terms and names. | def get_all_child_lists
child_check
if @all_child_terms.nil? and @all_child_names.nil?
@all_child_terms = []
@all_child_names = []
self.children.each do |child|
@all_child_terms.push( child.term )
@all_child_terms.push( child.all_child_terms )
@all_child_nam... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def all_child_terms\n get_all_child_lists\n return @all_child_terms\n end",
"def all_child_names\n get_all_child_lists\n return @all_child_names\n end",
"def children_names; @children.keys; end",
"def descendent_names\n self_and_descendents.map(&:name).flatten \n end",
"def get_child_nam... | [
"0.7798765",
"0.710421",
"0.66812056",
"0.6411084",
"0.6400847",
"0.63181674",
"0.6286913",
"0.6132601",
"0.6062827",
"0.605796",
"0.60351855",
"0.60266215",
"0.5994999",
"0.59936947",
"0.5935",
"0.5894351",
"0.5881827",
"0.5881827",
"0.5877281",
"0.58642775",
"0.5859277",
... | 0.79793257 | 0 |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Write message vbs script on host | def write_msg_to_target(message)
print_status("Writting message script on host...")
location = session.sys.config.getenv('TEMP')
msgvbs = "#{location}\\messenger.vbs"
mg = @client.fs.file.new(msgvbs, "wb")
mg.write("msgbox(\"#{message}\")")
mg.close
return msgvbs
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def send_message(text)\n end",
"def send_message(msg); end",
"def send_message(message, wparam = 0, lparam = 0)\n with_handle { User32.SendMessage(@handle, User32::EditMessage[message], wparam, lparam) }\n end",
"def send_message(message); end",
"def send_message(message); end",
"def remote_ms... | [
"0.57655805",
"0.5720912",
"0.5712792",
"0.56096125",
"0.56096125",
"0.545295",
"0.5438206",
"0.5435702",
"0.5426623",
"0.5412409",
"0.5395258",
"0.53720206",
"0.5353252",
"0.5350981",
"0.5300604",
"0.52930784",
"0.52925056",
"0.5282761",
"0.5280771",
"0.52484435",
"0.5237092... | 0.8221114 | 0 |
Override answered? to ensure last answer was not the user resetting the selection to the default unselected state. | def answered?
if answers.length == 0
return false
end
if answers.last.rationale_choices.size > 0
#
# The last answer is a list containing only one item, and it
# does not contain a key for :choice_id. This is the answer we
# generated in the case of unselecting a ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_yes_no_question\n answer = %w[Yes No].sample\n @user.session[:last_answer] = answer\n say answer\n end",
"def selected?; false; end",
"def selected?; false; end",
"def touch_multi_choice_answer\n touch if question_type == \"MultiChoiceQuestion\"\n end",
"def answered?\n return @... | [
"0.61158395",
"0.6039257",
"0.6039257",
"0.58651316",
"0.58648473",
"0.58588004",
"0.58179134",
"0.58179134",
"0.5811476",
"0.5802728",
"0.5781643",
"0.57788855",
"0.5752496",
"0.5738389",
"0.57280004",
"0.5725222",
"0.57241035",
"0.5646508",
"0.56231046",
"0.55913544",
"0.55... | 0.7103728 | 0 |
POST /ocorrencias POST /ocorrencias.json | def create
@ocorrencia = Ocorrencia.new(ocorrencia_params)
respond_to do |format|
if @ocorrencia.save
format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully created.' }
format.json { render action: 'show', status: :created, location: @ocorrencia }
else
f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @osoba = Osoba.new(params[:osoba])\n\n if @osoba.save\n render json: @osoba, status: :created, location: @osoba\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def create\n @ocupacion = Ocupacion.new(ocupacion_params)\n\n respond_to do |... | [
"0.69658506",
"0.64515084",
"0.64445317",
"0.6438216",
"0.6412335",
"0.638665",
"0.63558",
"0.63437164",
"0.63252586",
"0.6308761",
"0.6301593",
"0.6300208",
"0.62985927",
"0.6287717",
"0.62838745",
"0.626511",
"0.62568045",
"0.62283695",
"0.6221246",
"0.6209818",
"0.62061137... | 0.66312194 | 1 |
PATCH/PUT /ocorrencias/1 PATCH/PUT /ocorrencias/1.json | def update
respond_to do |format|
if @ocorrencia.update(ocorrencia_params)
format.html { redirect_to @ocorrencia, notice: 'Ocorrencia was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json { render json: @ocorr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @osoba = Osoba.find(params[:id])\n\n if @osoba.update(params[:osoba])\n head :no_content\n else\n render json: @osoba.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @resto.update(resto_params)\n format.html { redire... | [
"0.65316164",
"0.6483392",
"0.6450348",
"0.64107937",
"0.6378865",
"0.6342928",
"0.63359034",
"0.63143235",
"0.63059163",
"0.6296044",
"0.6295954",
"0.62866074",
"0.6278884",
"0.62715554",
"0.62698233",
"0.6269008",
"0.62531286",
"0.6251403",
"0.6248422",
"0.624783",
"0.62463... | 0.6542112 | 0 |
def aggregate_schema(type, write: false) end | def aggregate_schema(type, write: false)
in_dir, out_dir = get_dirs(type)
jsons = aggregate(in_dir)
schema = Convert.jsons_to_schema(jsons)
if write
path = "#{out_dir}/schema-#{Time.current.strftime('%s%2N')}.json"
File.write(path, JSON.pretty_generate(schema))
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_schema(name, type, options={})\n raise NotImplementedError\n end",
"def aggregate_db_storage_type; end",
"def schema_composite_type(db_type)\n @row_schema_types[db_type] || super\n end",
"def aggregate op, type = :fixnum\n check_closed\n\n aggregation_impl op, type\n ... | [
"0.6682754",
"0.6608514",
"0.640476",
"0.6218906",
"0.61200637",
"0.6013572",
"0.59346664",
"0.58826214",
"0.58818483",
"0.5806435",
"0.58062404",
"0.58002096",
"0.57946223",
"0.57759094",
"0.57142127",
"0.57091665",
"0.5708315",
"0.5666738",
"0.565325",
"0.56480676",
"0.5627... | 0.80117494 | 0 |
Walk environment S and look up value of U, if present. | def walk(u, s)
if var?(u)
pr = assp(-> (v) { u == v }, s)
pr ? walk(cdr(pr), s) : u
else
u
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eval_prog env\n\t\tresults = env.select { |pair| pair[0] == @s }\n\t\tif results.length > 0\n=begin\n for i in 0..results.length-1\n puts results[i][0]\n puts results[i][1]\n puts \"\\n\"\n end\n=end\n results[0][1]\n\t\telse\n\t\t\trais... | [
"0.5306887",
"0.5068697",
"0.48224854",
"0.48092902",
"0.47228032",
"0.47023335",
"0.46932405",
"0.462838",
"0.46265164",
"0.46179718",
"0.46034986",
"0.4601371",
"0.45819363",
"0.4556256",
"0.45244116",
"0.4500404",
"0.44843635",
"0.44218725",
"0.44159862",
"0.44086206",
"0.... | 0.6504468 | 0 |
Call function f with a fresh variable. | def call_fresh(f)
-> (s_c) {
c = cdr(s_c)
f.call(var(c)).call(cons(car(s_c), c + 1))
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def f\n 1\n end",
"def f1(x, x); end",
"def f\n end",
"def f() 1 end",
"def f\n x = 3\n b = binding()\n b\nend",
"def call(f)\n CAS::Help.assert(f, Hash)\n\n -1.0 * @x.call(f)\n end",
"def f\n g\n end",
"def f\n 0\n end",
"def f2(x, x=0); end",... | [
"0.5863297",
"0.5788108",
"0.57575756",
"0.5741883",
"0.5687574",
"0.567119",
"0.5655669",
"0.5622544",
"0.5584153",
"0.55774474",
"0.55583775",
"0.5495838",
"0.5484879",
"0.5452233",
"0.5452233",
"0.54283416",
"0.5380214",
"0.53436005",
"0.53393865",
"0.53299165",
"0.5317281... | 0.67358845 | 0 |
Create a response processor | def create_response_value_processor(endpoint_response)
response_type = endpoint_response.type
if response_type == TYPE_ARRAY
processor_for_values = create_processor_for_type('Response', endpoint_response.items, false)
Sinatra::SwaggerExposer::Processing::SwaggerArrayValueProcessor.ne... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_response( &block )\n @postprocessor = block\n end",
"def create_response(request)\n response = Response.new\n end",
"def response_parser; end",
"def process_response(obj)\n end",
"def response_factory(data)\n\t\t\t\t\t\treturn Response.new(data)\n\t\t\t\t\tend",
"def call( env ... | [
"0.6662526",
"0.6638015",
"0.6591317",
"0.6546623",
"0.6494686",
"0.641557",
"0.63104904",
"0.6251861",
"0.6226066",
"0.61979103",
"0.61979103",
"0.6036747",
"0.60179055",
"0.6012466",
"0.5982507",
"0.5955824",
"0.5943462",
"0.5943462",
"0.591904",
"0.5898638",
"0.5893349",
... | 0.7114406 | 0 |
Create a parameter processor for a parameter | def create_parameter_value_processor(parameter)
type_name = parameter.type
if type_name == TYPE_ARRAY
if PRIMITIVE_TYPES.include? parameter.items
processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(
parameter.name,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n ... | [
"0.673584",
"0.66540295",
"0.64762616",
"0.62489116",
"0.6186723",
"0.6050488",
"0.60457397",
"0.59999305",
"0.5952087",
"0.59322613",
"0.5931921",
"0.58731824",
"0.5825732",
"0.58170843",
"0.5816643",
"0.5796295",
"0.577737",
"0.57695746",
"0.57695746",
"0.5745455",
"0.57418... | 0.7743246 | 0 |
Create a type parameter processor for a type parameter | def create_processor_for_type(parameter_name, parameter_type, parameter_required)
attributes_processors = create_attributes_processors_for_type(parameter_type)
Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(
parameter_name,
parameter_required,
attributes... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_preprocessor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_preprocessors = create_attributes_preprocessors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValuePreprocessor.new(\n parameter_name,\n parameter_requi... | [
"0.69013447",
"0.68304664",
"0.61616504",
"0.61616504",
"0.61616504",
"0.61616504",
"0.61616504",
"0.60246724",
"0.59889245",
"0.5960109",
"0.5960109",
"0.5891081",
"0.5813403",
"0.5799338",
"0.5670359",
"0.56024855",
"0.56024855",
"0.56024855",
"0.56024855",
"0.56024855",
"0... | 0.74645126 | 0 |
Get attributes processor for a type | def create_attributes_processors_for_type(type_name)
type = @types[type_name]
attributes_processors = []
type.properties.each_pair do |property_name, property|
attributes_processors <<
create_processor_for_property(
property_name,
property,
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_attributes_preprocessors_for_type(type_name)\n type = @types[type_name]\n attributes_preprocessors = []\n type.properties.each_pair do |property_name, property|\n attributes_preprocessors <<\n create_preprocessor_for_property(\n property_name,\... | [
"0.66234607",
"0.6392467",
"0.62843263",
"0.62843263",
"0.62843263",
"0.61374766",
"0.6047604",
"0.5946742",
"0.58670545",
"0.5860231",
"0.58024645",
"0.5683741",
"0.5634317",
"0.5620199",
"0.5611769",
"0.5598919",
"0.5570774",
"0.5521515",
"0.55020857",
"0.547216",
"0.546899... | 0.734431 | 0 |
Create a processor for a type property | def create_processor_for_property(name, type_property, required)
property_type = type_property.type
if property_type == TYPE_ARRAY
if PRIMITIVE_TYPES.include? type_property.items
processor_for_values = Sinatra::SwaggerExposer::Processing::SwaggerPrimitiveValueProcessor.new(
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_processor_for_type(parameter_name, parameter_type, parameter_required)\n attributes_processors = create_attributes_processors_for_type(parameter_type)\n Sinatra::SwaggerExposer::Processing::SwaggerTypeValueProcessor.new(\n parameter_name,\n parameter_required,\n ... | [
"0.7112839",
"0.6958294",
"0.6858634",
"0.6238908",
"0.6230018",
"0.6227938",
"0.6150707",
"0.6118763",
"0.6111717",
"0.60464376",
"0.60255194",
"0.59862924",
"0.59661144",
"0.5879526",
"0.57871073",
"0.5760827",
"0.56870794",
"0.56554484",
"0.5640617",
"0.56213623",
"0.56211... | 0.80070204 | 0 |
Translate cell index into point [x,y] | def point(index)
return [index % Grid::MaxCol, index / Grid::MaxCol]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cell_at_point(x, y)\n [x / Entity::WIDTH, y / Entity::HEIGHT ]\n end",
"def translate_index_to_grid_position(index)\n @grid_positions[index]\nend",
"def at(cell_x, cell_y)\n assert_ok_coords(cell_x, cell_y)\n @grid[cell_x - 1][cell_y - 1]\n end",
"def index_for(x, y, coordinate_system=:row_... | [
"0.73571724",
"0.70152014",
"0.6968396",
"0.67127645",
"0.66602886",
"0.6650141",
"0.6579846",
"0.65721875",
"0.6539108",
"0.6531649",
"0.65258586",
"0.65044814",
"0.64949375",
"0.64486504",
"0.6445936",
"0.64458525",
"0.64177966",
"0.64177966",
"0.6416286",
"0.6414701",
"0.6... | 0.7227134 | 1 |
Simply check if the value is out of bound | def out_of_bound?(value, min, max)
return value > max || value < min
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def out_of_range?\n value < 1 || value > 12\n end",
"def out_of_range?(v)\n v < 1 || v > 12\n end",
"def check_bounds(value)\n return value >= self.bound.lower_bound && value <= self.bound.upper_bound\n end",
"def check_value\n if var == \"limit\" && value.to_i < 1\n raise... | [
"0.79258496",
"0.75973123",
"0.7396919",
"0.7321022",
"0.726353",
"0.7210668",
"0.71527046",
"0.71438575",
"0.7141677",
"0.70944566",
"0.7036176",
"0.703582",
"0.69669616",
"0.69613254",
"0.693714",
"0.69370985",
"0.6927298",
"0.68954843",
"0.6887002",
"0.6816876",
"0.6781704... | 0.7941162 | 0 |
PUT /locks/ or /locks/serial/ This endpoint is used in both lock commissioning and lock status sync | def update
return if params_missing([ :id, :lock_serial ], params, true)
lock = Lock.get_active_else_not(params)
return render_error_modelname(404, :MISSING_RECORD, Lock) if !lock
# Only the owner can update the lock record
return render_error(403, :NOT_BELONGING, Lock) if lock.user_id != @current... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lock!(resource, uuid, *lock_names)\n build_locks(resource, lock_names, uuid).each(&:save!)\n end",
"def update\n @lock = Lock.find(params[:id])\n\n respond_to do |format|\n if @lock.update_attributes(params[:lock])\n format.html { redirect_to(@lock, :notice => 'Lock was successf... | [
"0.6438926",
"0.638817",
"0.6372884",
"0.6192568",
"0.6182837",
"0.61411536",
"0.6133996",
"0.6118145",
"0.60949516",
"0.6094413",
"0.60875386",
"0.59839696",
"0.5950648",
"0.5851559",
"0.5809771",
"0.5778173",
"0.5745517",
"0.57191896",
"0.5697143",
"0.5671702",
"0.5633515",... | 0.6523756 | 0 |
GET /locks/credentials/:id or /locks/credentials/serial/:lock_serial Fetches the signed account/user_device id and key id data for the lock's keys. | def get_credentials
return if params_missing([ :id, :lock_serial ], params, true)
return if !get_lock_id(params)
lock = @lock || Lock.find(params[:lock_id])
if !lock
render_error_modelname(404, :MISSING_RECORD, Lock)
return
end
json = {
users_devices: {}, # All users_devices u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_credentials\n# send_auth(@user_device)\n get(:get_credentials, id: @lock.id)\n end",
"def walletlock\n @api.request 'walletlock'\n end",
"def get_locks\n HTTParty.get(\"#{$base_url}/partners/#{$partner_id}/locks\", {headers: $headers}).parsed_response['locks']\nend",
"def lo... | [
"0.6995523",
"0.5909355",
"0.5744872",
"0.55626684",
"0.55594015",
"0.5401579",
"0.53726274",
"0.5347928",
"0.5343468",
"0.5321471",
"0.5265953",
"0.5177778",
"0.5132749",
"0.510948",
"0.5108607",
"0.50841296",
"0.50753945",
"0.50723815",
"0.50701135",
"0.5069112",
"0.5059473... | 0.7722878 | 0 |
Decommission and send notifications. Returns false on error. | def do_decommission(lock, revoker = nil)
if !lock.do_decommission(revoker, request.uuid)
check_save_failure(lock)
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_delete_package\n @requests = Requests.get_requests_delete_package(cookies[:user_id])\n @packages = Packages.get_all_packages\n flag = true\n if( @requests != nil && @packages != nil )\n @packages.each do |t|\n @requests.each do |s|\n if( ( s.senders_id == cookies[:user_... | [
"0.5755877",
"0.55715036",
"0.55484104",
"0.55355686",
"0.5498741",
"0.54483086",
"0.53579867",
"0.5280377",
"0.52636576",
"0.5240284",
"0.52268386",
"0.51789796",
"0.51755357",
"0.5158131",
"0.51303345",
"0.51301324",
"0.51266146",
"0.51001096",
"0.5098089",
"0.50893545",
"0... | 0.58220977 | 0 |
GET /workphases GET /workphases.json | def view
@workphases = Workphase.search_by_phase(params[:search])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @project_phases = ProjectPhase.all\n end",
"def index\n @phases = Phase.where(project_id: params[:project_id])\n end",
"def index\n @phases = Phase.all\n end",
"def get_work_json\n client.make_request('/get-work-json', 'post', params: {})\n end",
"def phases(wod)\n op... | [
"0.6677245",
"0.65292525",
"0.6423285",
"0.63378274",
"0.62039244",
"0.61108154",
"0.61048543",
"0.6091999",
"0.6053289",
"0.60315424",
"0.60214865",
"0.60214",
"0.58047926",
"0.5759363",
"0.5732642",
"0.5666867",
"0.56643647",
"0.5657214",
"0.56477696",
"0.5609534",
"0.55594... | 0.68513757 | 0 |
POST /workphases POST /workphases.json | def create
@workphase = Workphase.new(workphase_params)
respond_to do |format|
if @workphase.save
format.html { redirect_to @workphase, notice: 'Workphase was successfully created.' }
format.json { render :show, status: :created, location: @workphase }
else
format.html { ren... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def workphase_params\n params.require(:workphase).permit(:worknote, :dateChanged, \n :product_id, :phase_id, :employee_id,\n :adminNote, :totalMade, :totalToMake,\n :dateComplete)\n end",
"def create\n @work_plan = WorkPlan.find(params[:work... | [
"0.6466669",
"0.6334753",
"0.6290922",
"0.6250835",
"0.61476487",
"0.61150706",
"0.6030995",
"0.60242885",
"0.6008771",
"0.5931299",
"0.5915848",
"0.5899364",
"0.5852997",
"0.58372986",
"0.5802952",
"0.57927865",
"0.5780055",
"0.57152224",
"0.5694496",
"0.5674357",
"0.5668656... | 0.71624374 | 0 |
PATCH/PUT /workphases/1 PATCH/PUT /workphases/1.json | def update
respond_to do |format|
if @workphase.update(workphase_params)
format.json { respond_with_bip(@workphase) } #this is added as best_in_place update wasn't holding
format.html { redirect_to @workphase, notice: 'Workphase was successfully updated.' }
#format.json { render :show,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @work_step.update(work_step_params)\n format.html { redirect_to @work_plan, notice: 'Work step was successfully updated.' }\n format.json { render :show, status: :ok, location: @work_plan }\n else\n format.html { render :edit }\n for... | [
"0.6750996",
"0.6471228",
"0.6376904",
"0.6364787",
"0.6357176",
"0.6345471",
"0.633668",
"0.63190407",
"0.62776226",
"0.6256711",
"0.6248621",
"0.6243154",
"0.6240256",
"0.6227785",
"0.61877036",
"0.61834425",
"0.6164427",
"0.6164427",
"0.6164427",
"0.6164427",
"0.61388904",... | 0.6745728 | 1 |
DELETE /workphases/1 DELETE /workphases/1.json | def destroy
Workphase.find(params[:id]).destroy
#@workphase.destroy
respond_to do |format|
format.html { redirect_to workphases_url, notice: 'Workphase was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @project_phase = ProjectPhase.find(params[:id])\n @project_phase.destroy\n\n respond_to do |format|\n format.html { redirect_to project_phases_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @exercise_execution.destroy\n respond_to do |format|\n ... | [
"0.7165512",
"0.69539744",
"0.69392157",
"0.6895234",
"0.684572",
"0.6843697",
"0.6832605",
"0.6788403",
"0.67702824",
"0.67443514",
"0.67420965",
"0.6740847",
"0.6736868",
"0.67111576",
"0.67104536",
"0.6676311",
"0.66761434",
"0.66761434",
"0.66761434",
"0.66761434",
"0.667... | 0.7459516 | 0 |
GET /people/1/contributions GET .people/1/contributions.json | def index
@contributions = @person.contributions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n user = User.find_by(id: params[:user_id])\n return respond_with contributions: [], status: :not_found if user.nil?\n contributions = user.contributions\n respond_with contributions: contributions, status: :ok\n end",
"def index\n @contributions = Contribution.all\n\n respond_to do ... | [
"0.75771564",
"0.7078139",
"0.66454154",
"0.65114063",
"0.6270358",
"0.62547076",
"0.6238534",
"0.6173667",
"0.61654156",
"0.61460084",
"0.61370933",
"0.6009422",
"0.5957173",
"0.5831093",
"0.5772077",
"0.5753856",
"0.57238215",
"0.56874496",
"0.5684164",
"0.56696355",
"0.566... | 0.7270595 | 1 |
POST people/1/contributions POST people/1/contributions.json | def create
@contribution = Contribution.new(contribution_params)
@contribution.contributable_type = "Book"
@contribution.person = @person
respond_to do |format|
if @contribution.save
format.html { redirect_to person_contributions_path(@person), notice: 'Contribution was successfull... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @contribution = Contribution.new(params[:contribution])\n\n respond_to do |format|\n if @contribution.save\n format.html { redirect_to @contribution, notice: 'Contribution was successfully created.' }\n format.json { render json: @contribution, status: :created, location: @con... | [
"0.6558725",
"0.6516483",
"0.651311",
"0.62787557",
"0.62748885",
"0.6204882",
"0.6200626",
"0.61977834",
"0.61608875",
"0.61483693",
"0.61468655",
"0.6089625",
"0.6071447",
"0.60704553",
"0.6063227",
"0.6063227",
"0.60567325",
"0.6051911",
"0.604626",
"0.6031415",
"0.5992902... | 0.667459 | 0 |
A user cannot leave more than one review per product. | def must_not_be_a_duplicate_review
dup_reviews = Review.where(user: user, product: product)
if new_record?
if dup_reviews.length > 0
errors.add(:product, "already has a review from this user.")
end
elsif dup_reviews.length > 0 && !dup_reviews.include?(self)
errors.add(:product, "al... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prevent_multiple_feedback_reviews\n @feedback_review = @review.feedback_reviews.find_by(user_id: @current_api_user)\n if @feedback_review.present?\n invalid_resource!(@feedback_review)\n end\n end",
"def user_already_reviewed(movie)\n \t@user_already_reviewed = -1\n \tif ... | [
"0.6972179",
"0.62275386",
"0.6121825",
"0.61167115",
"0.6060643",
"0.59608644",
"0.5849173",
"0.58219284",
"0.5819048",
"0.58135027",
"0.5694305",
"0.5658769",
"0.5636665",
"0.56277484",
"0.5624664",
"0.56120497",
"0.55964833",
"0.5588114",
"0.55828565",
"0.55782783",
"0.556... | 0.7584058 | 0 |
Return an alignment which match columns. The originating sequences should have methods 'empty_copy' and '<<' | def columns_where &block
seqs = []
rows.each do | seq |
new_seq = seq.empty_copy
seq.each_with_index do | e,i |
new_seq << e if block.call(columns[i])
end
seqs << new_seq
end
Alignment.new(seqs)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def align\n [:owner, :group, :size].each do |field|\n current = @alignment[field]\n @buffer.each do |line|\n new = line[field].length\n current = new if current < new\n end\n @alignment[field] = current\n end\n end",
"def aligned_sequence \n ... | [
"0.62100065",
"0.6182961",
"0.605207",
"0.6010754",
"0.59405696",
"0.58625257",
"0.5855632",
"0.5836319",
"0.58100814",
"0.58100814",
"0.58078563",
"0.5795865",
"0.57522017",
"0.5722302",
"0.5717905",
"0.5706427",
"0.5706427",
"0.5607617",
"0.5606497",
"0.54501295",
"0.539733... | 0.6533839 | 0 |
POST start new game Takes a body with comma separated string of names /new_game | def new_game
params_check(params[:player_names]) {
@game = Game.create
params[:player_names].split(",").each do |player_name|
player = Player.create(name: player_name, game: @game)
10.times do |i|
i == 10 ? Frame.create!(game: @game, player: player, position: i, final... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n positions = JSON.parse(params['positions'])\n\n # Fill in body to initialize the game and return a 200 response\n\n render plain: \"OK\"\n end",
"def new_game\n\tresponse\n\tif params[\"difficulty\"]\n\t\tdifficulty = params[\"difficulty\"]\n\t\tsettings.game_data = Ben::Game.new( Integer ... | [
"0.7047248",
"0.67517865",
"0.66579497",
"0.66527337",
"0.66527337",
"0.66527337",
"0.66527337",
"0.66527337",
"0.66468465",
"0.6646828",
"0.66052276",
"0.6605084",
"0.656704",
"0.65412307",
"0.65325063",
"0.6528704",
"0.6519139",
"0.6519139",
"0.6519139",
"0.6519139",
"0.651... | 0.6784502 | 1 |
GET /clubs/1 GET /clubs/1.json | def show
@club = Club.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @club }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @club = Club.find(params[:id])\n\n render json: @club\n end",
"def index\n @clubs = Club.all\n render json: @clubs\n end",
"def show\n @club = Club.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @club }\n en... | [
"0.83942306",
"0.81019014",
"0.8078959",
"0.7889925",
"0.7877483",
"0.786315",
"0.78516775",
"0.75047773",
"0.74475837",
"0.74475837",
"0.74475837",
"0.7375221",
"0.72653127",
"0.7220348",
"0.72018844",
"0.71983624",
"0.7168892",
"0.7067452",
"0.70564526",
"0.7014342",
"0.691... | 0.82158464 | 1 |
PUT /clubs/1 PUT /clubs/1.json | def update
@club = Club.find(params[:id])
respond_to do |format|
if @club.update_attributes(params[:club])
format.html { redirect_to @club, notice: 'Club was successfully updated.' }
format.json { head :ok }
else
format.html { render action: "edit" }
format.json { re... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @club = Club.find(params[:id])\n\n if @club.update_attributes(params[:club])\n head :no_content\n else\n render json: @club.errors, status: :unprocessable_entity\n end\n end",
"def update\n @club = Club.find(params[:id])\n @club.update_attributes(club_params)\n respond_w... | [
"0.7922199",
"0.7636222",
"0.7607505",
"0.74574715",
"0.7454791",
"0.7451092",
"0.7451092",
"0.7451092",
"0.7451092",
"0.7451092",
"0.7314734",
"0.7314734",
"0.7270194",
"0.72480816",
"0.7220248",
"0.72081",
"0.7191481",
"0.7191481",
"0.7191481",
"0.7191481",
"0.7191481",
"... | 0.7666208 | 1 |
construct the quote list for querying the stock information | def get_quote_list(portfolio = Array.new)
quote_list = Array.new
portfolio.each do |p|
quote_list << p['stock']
end
return quote_list.join(',')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stock_details_for_list(symbol_list)\n\t\t\tsymbol_list = symbol_list.collect { |symbol| sanitize_symbol(symbol) }\n\n return [] if symbol_list.blank?\n\n\t\t\tfield_mappings = {\n\t\t\t\tname: 'n',\n\t\t\t\tsymbol: 's',\n\t\t\t\task: 'a',\n\t\t\t\task_realtime: 'b2',\n\t\t\t\tbid: 'b',\n\t\t\t\tbid_realti... | [
"0.72118294",
"0.67459303",
"0.6700682",
"0.6614101",
"0.64037806",
"0.6401939",
"0.6378696",
"0.6295769",
"0.62820554",
"0.6278724",
"0.62717307",
"0.61913687",
"0.61412877",
"0.61094344",
"0.60995346",
"0.6049173",
"0.6044426",
"0.6010329",
"0.5967269",
"0.59656614",
"0.594... | 0.6761247 | 1 |
calculates profit for the given portfolio | def calculate_portfolio(portfolio = Array.new)
qs = get_quote_info(get_quote_list(portfolio))
portfolio.each do |p|
p['info'] = qs[p['stock']]
value_orderd = p['amount']*p['price']
value_now = p['amount']*p['info'].lastTrade
p['profit_amount'] = value_now - value_orderd
end
return portfolio
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profit\n revenue - total_costs\n end",
"def profit\n profit = 0\n if self.is_open?\n if market_value != position_cost\n return (self.is_buy? ? 1 : -1) * (market_value - position_cost)\n else\n return 0\n end\n else\n self.open_trade_records.each do |open_tra... | [
"0.7213182",
"0.7061496",
"0.701109",
"0.6988421",
"0.6951452",
"0.69466364",
"0.69259554",
"0.6866281",
"0.6866281",
"0.6836347",
"0.68163925",
"0.6774613",
"0.6749828",
"0.6741579",
"0.6726193",
"0.67137694",
"0.670878",
"0.67030215",
"0.667781",
"0.6673643",
"0.66636664",
... | 0.731144 | 0 |
printing the actual portfolio | def print_portfolio(portfolio = Array.new)
template=<<EOT
STOCK:\tLASTTRADE €
\tAMOUNT @ PRICE € -> PROFIT €
EOT
money = portfolio.reduce(0) do |memo, p|
t = template.dup
t.sub!('STOCK', p['stock'])
t.sub!('LASTTRADE', "#{p['info'].lastTrade}")
t.sub!('AMOUNT', p['amount'].to_s)
t.sub!('PRICE', p['price'].t... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def portfolios_listing\n portfolios.each_index do |index|\n puts \"Portfolio (#{index}) : #{portfolios.to_s}\"\n end\n end",
"def report\n @portfolios = Portfolio.where(user_id: session[:user_id]).decorate\n Portfolio.transaction do\n Portfolio.refresh_costs(@portfolios, current_user)\n ... | [
"0.7330122",
"0.6453931",
"0.6446693",
"0.6423939",
"0.6417934",
"0.63664246",
"0.6340547",
"0.6330982",
"0.62902427",
"0.62661624",
"0.6234746",
"0.61986446",
"0.61781317",
"0.61781317",
"0.61764026",
"0.6153178",
"0.6116161",
"0.60833263",
"0.60818964",
"0.60787785",
"0.601... | 0.7698567 | 0 |
PATCH/PUT /seasons/1 PATCH/PUT /seasons/1.json | def update
respond_with @season.update(season_params)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n if @season.update(season_params)\n render :show, status: :ok\n else\n render json: @season.errors, status: :unprocessable_entity\n end\n end",
"def update\n respond_to do |format|\n if @season.update(season_params)\n format.html { redirect_to @season, notice: 'Seas... | [
"0.7574825",
"0.7466397",
"0.73731536",
"0.7247074",
"0.72115296",
"0.7066464",
"0.6906128",
"0.67000747",
"0.6453101",
"0.6453101",
"0.6453101",
"0.6453101",
"0.63932765",
"0.6279933",
"0.6277337",
"0.6263373",
"0.625206",
"0.62090826",
"0.62006545",
"0.6170269",
"0.61466616... | 0.753143 | 1 |
GET /user_logins GET /user_logins.json | def index
@user_logins = UserLogin.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n @users = User.all\n render json: User.all\n end",
"def index\n @log_ins = LogIn.all\n end",
"def index\n @logins = Login.all\n end",
"def auto_login\n render json: logged_in_user\n end",
"def index\n # @logins = Login.all\n end",
"def index\n @users = ... | [
"0.6986181",
"0.67032623",
"0.6487264",
"0.64824224",
"0.64675814",
"0.6439693",
"0.6426158",
"0.64258075",
"0.6420787",
"0.6420787",
"0.63225",
"0.6283208",
"0.6228691",
"0.616576",
"0.615551",
"0.6132131",
"0.6101082",
"0.60807973",
"0.60769",
"0.6069716",
"0.6058729",
"0... | 0.69305927 | 1 |
GET /sign_ups GET /sign_ups.json | def index
@sign_ups = SignUp.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @signups = Signup.all\n end",
"def index\n @signups = Signup.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end",
"def index\n @sign_ups = SignUp.all\n\t@referer = request.env['HTTP_REFERER']\n end",
"def index\n @pushups = current_user.push... | [
"0.7269794",
"0.66862106",
"0.66491365",
"0.65528953",
"0.64501303",
"0.64501303",
"0.6369708",
"0.6369708",
"0.6357562",
"0.6316043",
"0.62663263",
"0.6149291",
"0.6113419",
"0.60685915",
"0.60685915",
"0.60259974",
"0.5973351",
"0.5962522",
"0.5952868",
"0.592961",
"0.58843... | 0.73521084 | 0 |
so I can have require_remote 'require' a javascript filename over the internet, asynchronously, so you'll have to delay before using. Should be fine if typed by hand but if scripted add delay | def require_js(*urls, &block)
# used to use this, but don't want to depend on opal-jquery
# Element.find("head").append("<script src='#{js_filename}' type='text/javascript'></script>")
promises = []
opts = urls.last.is_a?(Hash) ? urls.pop : {}
clear_promises = lambda do
promises.each do |promise|
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def require_js_sync(url)\n %x|\n var r = new XMLHttpRequest();\n r.open(\"GET\", url, false);\n r.send('');\n window.eval(r.responseText)\n |\n nil\nend",
"def script_load(script); end",
"def eval_into(module_scope, &block)\n $RUBYJS__MODULE_SCOPE = module_scope\n $RUBYJS__LOADED ||= [] # ... | [
"0.74813884",
"0.6236208",
"0.61593425",
"0.6039022",
"0.59898525",
"0.57902706",
"0.57902706",
"0.5725385",
"0.5614496",
"0.56113774",
"0.54029435",
"0.5354368",
"0.5261745",
"0.52484024",
"0.5235225",
"0.5234575",
"0.52263355",
"0.522507",
"0.52242696",
"0.522086",
"0.52176... | 0.6757367 | 1 |
Fetches the complete octodex | def completeOctodex
cURL($baseURL)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def oct2_hex()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Oct2Hex::Oct2HexRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def set_ox\n @ox = Ox.find(params[:id])\n end",
"def hex2_oct()\n ... | [
"0.5476673",
"0.5442733",
"0.541492",
"0.5413605",
"0.534361",
"0.52974963",
"0.52036357",
"0.51653326",
"0.50661594",
"0.504089",
"0.50351775",
"0.502217",
"0.4955309",
"0.49524063",
"0.493911",
"0.49295998",
"0.48251978",
"0.4809872",
"0.48084632",
"0.47958818",
"0.4783845"... | 0.6259944 | 0 |
Fetches a random octocat | def randomOctocat
cURL($baseURL+"?random")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random\n random_card = self.class.get('/cards/random')\n end",
"def pick\n @gommis_count = Gommi.count\n @gommis = Gommi.offset(rand(Gommi.count)).first\nend",
"def random\n Client.get(\"/patterns/random\")\n end",
"def random\n Client.get(\"/colors/random\")\n end",
"def ... | [
"0.6274286",
"0.6140578",
"0.6108216",
"0.609113",
"0.6041395",
"0.60179037",
"0.5908919",
"0.58842474",
"0.58652323",
"0.58652323",
"0.58604074",
"0.58505964",
"0.57990134",
"0.5766338",
"0.5766338",
"0.57383543",
"0.5732337",
"0.5732314",
"0.572656",
"0.569993",
"0.5697186"... | 0.8122879 | 0 |
Fetches an octocat by its number | def numberedOctocat (number)
cURL($baseURL+"?number=#{number}")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_octal_char(c)\n r = c.ord - '0'.ord\n if !nextoct?\n return r\n end\n\n r = (r << 3) | (readc.ord - '0'.ord)\n if !nextoct?\n return r\n end\n\n (r << 3) | (readc.ord - '0'.ord)\n end",
"def set_oct\n @oct = Oct.find(params[:id... | [
"0.6242975",
"0.6045589",
"0.6024554",
"0.6020457",
"0.5884812",
"0.587131",
"0.5823518",
"0.5818513",
"0.5387058",
"0.5349889",
"0.53414613",
"0.53032297",
"0.52596337",
"0.51465577",
"0.5131537",
"0.5122498",
"0.5090959",
"0.5068637",
"0.5067946",
"0.50619936",
"0.505893",
... | 0.65900767 | 0 |
POST /rests POST /rests.json | def create
@rest = Rest.new(rest_params)
@rest.owners << current_owner
respond_to do |format|
if @rest.save
format.html { redirect_to @rest, notice: 'Rest was successfully created.' }
format.json { render :show, status: :created, location: @rest }
else
format.html { rende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create(url, data)\n RestClient.post ENV['APIBASE']+url, data, :content_type => :json\nend",
"def add_weather_by_rest(auth,weather_json)\n rest_agent=RestClient::Resource.new(\"http://#{auth[:host]}:#{auth[:port]}/#{auth[:reststr]}/ry/weather\")\n rest_agent.post(weather_json, :content_type=>\"applicat... | [
"0.61397886",
"0.6026522",
"0.6021422",
"0.6014175",
"0.59473485",
"0.59293044",
"0.5900913",
"0.58330417",
"0.5823481",
"0.5804615",
"0.5804615",
"0.58033496",
"0.57480234",
"0.57329416",
"0.566821",
"0.5667403",
"0.56503373",
"0.5609959",
"0.56051517",
"0.55629534",
"0.5562... | 0.6640577 | 0 |
PATCH/PUT /rests/1 PATCH/PUT /rests/1.json | def update
respond_to do |format|
if @rest.update(rest_params)
format.html { redirect_to @rest, notice: 'Rest was successfully updated.' }
format.json { render :show, status: :ok, location: @rest }
else
format.html { render :edit }
format.json { render json: @rest.errors,... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rest_patch(base_uri,json_payload,params)\n begin\n @response = RestClient.patch(base_uri,json_payload,params)\n rescue => e\n puts @response.code\n end\n return @response\n end",
"def patch options\n rest_request({ method: :patch }.merge(options))\n end",
"def patch options\n... | [
"0.6803028",
"0.67416245",
"0.67416245",
"0.6635341",
"0.6599856",
"0.6599856",
"0.6581939",
"0.6520609",
"0.6495032",
"0.6442611",
"0.63919777",
"0.63912296",
"0.6261466",
"0.6203461",
"0.61574394",
"0.61506456",
"0.6123332",
"0.609927",
"0.60703343",
"0.60681707",
"0.599675... | 0.687671 | 0 |
DELETE /rests/1 DELETE /rests/1.json | def destroy
@rest.destroy
respond_to do |format|
format.html { redirect_to rests_url, notice: 'Rest was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @rest_api.destroy\n respond_to do |format|\n format.html { redirect_to rest_apis_url }\n format.json { head :no_content }\n end\n end",
"def delete\n RestClient.delete(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end",
"def delete(path)\n... | [
"0.7464244",
"0.74373174",
"0.73622584",
"0.73408127",
"0.7227154",
"0.7200991",
"0.7155777",
"0.710573",
"0.710573",
"0.70631737",
"0.70460635",
"0.70373535",
"0.6969877",
"0.6969877",
"0.6969877",
"0.6969877",
"0.69666564",
"0.6963404",
"0.6944766",
"0.6933575",
"0.6933575"... | 0.7719696 | 0 |
set attribute (field) obtained from matching pattern in raw_line | def raw_setter xfield,pattern
field = "@#{xfield}"
m = self.raw_line.match pattern
return false if m.nil?
#p "#{field} => #{m.inspect}"
if BOOL_ATTRIBUTES.include? xfield
self.instance_variable_set(field, true)
return true
end
if STR_ATTRIBUTES.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_raw_line opts = OPTS_REGEX.keys\n self.raw_line.chomp!\n opts.each do |xfield|\n pattern = OPTS_REGEX[xfield]\n did_set = raw_setter xfield, pattern\n #puts did_set\n end\n end",
"def initialize line\n\n attributes = [:icao, :latitude, :longi... | [
"0.6869467",
"0.64021534",
"0.61670434",
"0.5938252",
"0.59255666",
"0.5875563",
"0.58038706",
"0.571091",
"0.56636614",
"0.5631684",
"0.55693185",
"0.55450433",
"0.5472618",
"0.5461977",
"0.5458264",
"0.5452722",
"0.54318404",
"0.54274374",
"0.5390945",
"0.5384219",
"0.53838... | 0.72973573 | 0 |
Returns true if request fully finished reading | def finished_reading?; @finished_read; end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def finished?\n\t\t\t\t@finished && @body.length >= @headers['CONTENT_LENGTH']\n\t\t\tend",
"def stream_is_done?\n @stream.nil? || @stream.closed? || @stream.eof?\n end",
"def finished?\n @buffer.size == @size\n end",
"def end_of_stream?\n @next_chunk.nil?\n end",
"def eof?\n\t\t\t\tfil... | [
"0.78803635",
"0.7597073",
"0.75940007",
"0.74053127",
"0.7373751",
"0.7369345",
"0.7369345",
"0.7309881",
"0.7180534",
"0.7158285",
"0.7150497",
"0.7103735",
"0.70994383",
"0.70994383",
"0.70994383",
"0.70451105",
"0.7036706",
"0.7036706",
"0.7036706",
"0.7036706",
"0.703670... | 0.765932 | 1 |
Returns the body, if a block is given, the body is streamed to the block as the chunks become available, until the body has been read. If no block is given, the entire body will be read from the connection into the body buffer and then returned. | def body
raise "no connection given" unless @connection
if block_given?
# Callback from the http_parser will be calling add_body directly
@on_body = Proc.new
# clear out body buffered so far
yield read_from_body(nil) if @body
until finished_reading?
@conn... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def read_body(socket, block)\n return unless socket\n if tc = self['transfer-encoding']\n case tc\n when /chunked/io then read_chunked(socket, block)\n else raise ::WEBrick::HTTPStatus::NotImplemented, \"Transfer-Encoding: #{tc}.\"\n end\n elsif self['content-length']... | [
"0.73344934",
"0.7266433",
"0.72579336",
"0.6999749",
"0.69008255",
"0.68755084",
"0.6628932",
"0.6619886",
"0.6606487",
"0.65947163",
"0.6581602",
"0.6529572",
"0.64907265",
"0.64597875",
"0.6440008",
"0.6425902",
"0.63898945",
"0.6268007",
"0.622951",
"0.6202733",
"0.617501... | 0.78568524 | 0 |
Returns the own video service id | def id
case self.service
when :youtube then parse_video_id_for_youtube
when :vimeo then parse_video_id_for_vimeo
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def video_id_public\n if video\n video.id_public\n end\n end",
"def video_id\n values[:video_id]\n end",
"def service_url\n begin\n return video.url\n rescue\n nil\n end\n end",
"def set_video_id\n send(\"#{provider}_video_id\")\n end",
"def avId\n begin... | [
"0.6972197",
"0.6930654",
"0.68147475",
"0.6795659",
"0.65848464",
"0.65729535",
"0.6571735",
"0.6541422",
"0.65072626",
"0.64860314",
"0.6455446",
"0.64406645",
"0.6383935",
"0.62886703",
"0.6279221",
"0.6240653",
"0.6212364",
"0.62025154",
"0.60879457",
"0.60879457",
"0.608... | 0.8061878 | 0 |
Returns the URL for this video embedded === Parameters options Configuration for the embedded URL. === Options :autoplay Autoplay on or off (default on) | def embedded(options={})
autoplay = options[:autoplay].nil? ? true : options[:autoplay]
autoplay = !!autoplay ? '1' : '0'
embeded_template = case self.service
when :youtube then YOUTUBE_EMBEDDED_TEMPLATE
when :vimeo then VIMEO_EMBEDDED_TEMPLATE
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def embeddable_url\n\t\turl.sub('watch?v=', 'embed/')\n\tend",
"def embedded_video_url\n self.video_url.sub 'watch?v=', 'embed/'\n end",
"def youtube_embed_url\n VideoInfo.new(self.video_url).embed_url if self.video_url?\n end",
"def video_url(source, options = T.unsafe(nil)); end",
"def oembed_url... | [
"0.67662454",
"0.67657304",
"0.6668847",
"0.6600432",
"0.65870035",
"0.6400546",
"0.63416594",
"0.6239008",
"0.6233421",
"0.6227325",
"0.62022215",
"0.617299",
"0.6156925",
"0.6082928",
"0.60553336",
"0.60360926",
"0.6003414",
"0.5906813",
"0.5864534",
"0.5864097",
"0.5839515... | 0.7060799 | 0 |
Set video_id for a given regexp and index of match result | def parse_video_id_for_regexp_and_index(regexp, index)
match_result = self.url.match(regexp)
return match_result[index] if !!match_result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_video_id_for_vimeo\n parse_video_id_for_regexp_and_index(VIMEO_REGEXP, 4)\n end",
"def parse_video_id_for_youtube\n parse_video_id_for_regexp_and_index(YOUTUBE_REGEXP, 6)\n end",
"def set_url_video_id\r\n # Get the URL and put in this variable that will be filtered\r\n # down to... | [
"0.6204636",
"0.6068198",
"0.59581155",
"0.55719334",
"0.55719334",
"0.55719334",
"0.55719334",
"0.55719334",
"0.55665135",
"0.55393314",
"0.5427567",
"0.54152787",
"0.53871983",
"0.5354115",
"0.5343699",
"0.523123",
"0.5214084",
"0.5203008",
"0.5164026",
"0.5155969",
"0.5152... | 0.7568799 | 0 |
Parse the youtube video_id and set it in self | def parse_video_id_for_youtube
parse_video_id_for_regexp_and_index(YOUTUBE_REGEXP, 6)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def youtube_video_id\n video_id = link.match(/\\?v=/) ? link.split('?v=')[1] : link.split('/').last\n video_id = video_id.split('&')[0] if video_id =~ /&/\n self.vid = video_id\n end",
"def youtube_video_id\t\t\n\t\tif self.video_url.nil?\n\t\t\tnil\n\t\telse\n\t\t\tself.video_url.rpartit... | [
"0.84349173",
"0.77813375",
"0.77654135",
"0.7209885",
"0.7189224",
"0.7165815",
"0.71282816",
"0.7084522",
"0.7032639",
"0.69501424",
"0.6938494",
"0.6924599",
"0.68363214",
"0.68337727",
"0.6763516",
"0.67557114",
"0.671982",
"0.6702886",
"0.6670562",
"0.66660714",
"0.66604... | 0.82028997 | 1 |
Parse the vimeo video_id and set it in self | def parse_video_id_for_vimeo
parse_video_id_for_regexp_and_index(VIMEO_REGEXP, 4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def vimeo_video_id\n self.vid = link.split('/').last\n end",
"def youtube_video_id\n video_id = link.match(/\\?v=/) ? link.split('?v=')[1] : link.split('/').last\n video_id = video_id.split('&')[0] if video_id =~ /&/\n self.vid = video_id\n end",
"def initialize id, vimeo\n ... | [
"0.84515035",
"0.72542953",
"0.70958865",
"0.69669414",
"0.67937887",
"0.67703974",
"0.66919595",
"0.6685938",
"0.6685938",
"0.6685938",
"0.6685938",
"0.6685938",
"0.6631221",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.6560581",
"0.656058... | 0.8058369 | 1 |
Returns number of gems | def gems_count
@gems_count ||= gems.count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gems_count\n Recommendable.config.ratable_classes.inject(0) do |sum, klass|\n sum + gemd_count_for(klass)\n end\n end",
"def gems_used\n tree = repository.repo.lookup(revision).tree\n gemfile = tree.select{|blob| blob[:name] == 'Gemfile'}.first\n return 0 if !gemfil... | [
"0.78801644",
"0.7844472",
"0.675362",
"0.67533034",
"0.63811404",
"0.63425595",
"0.6255015",
"0.61621636",
"0.6152294",
"0.6152294",
"0.6152294",
"0.6140528",
"0.60733366",
"0.6068115",
"0.60059845",
"0.5995317",
"0.59810305",
"0.5902619",
"0.5865549",
"0.5857041",
"0.585404... | 0.87557924 | 0 |
Fetches data for each gem | def fetch_gems_data
puts "Fetching data for..."
# slice 100 to avoid too many requests on RubyGems and GitHub APIs
gems.each_slice(100) do |batch|
each_concurrently(batch) do |gem|
begin
retries ||= 0
# set verbose to true to stdout the gem name
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prefetch gems\n end",
"def find_gems\n @gems = RubygemsApi.call :all\n end",
"def prefetch reqs\n names = reqs.map { |r| r.dependency.name }\n needed = names.find_all { |d| !@data.key?(d) }\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::R... | [
"0.68294436",
"0.6725108",
"0.6156221",
"0.6070934",
"0.5985889",
"0.5914395",
"0.58899057",
"0.5846923",
"0.5840874",
"0.5831891",
"0.5726342",
"0.5714451",
"0.5713304",
"0.57059944",
"0.5692749",
"0.5676398",
"0.5673906",
"0.5651266",
"0.5651266",
"0.5643925",
"0.5622125",
... | 0.8024932 | 0 |
Starts a thread to process the given gem | def gem_thread(gem)
Thread.new do
begin
retries ||= 0
# set verbose to true to stdout the gem name
gem.prepare_data(verbose: true)
# rescue SocketError, Faraday::ConnectionFailed...
rescue StandardError
(retries += 1) <= RETRIES ? ret... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end",
"def start!\n start\n blocking_thread.join\n end",
"def start\n return if @thread\n @thread = Thread.new do\n loop do\n sleep\n load_files\n ... | [
"0.5795017",
"0.5713603",
"0.5627765",
"0.5621165",
"0.5576527",
"0.550631",
"0.54878664",
"0.54672587",
"0.5458609",
"0.54413325",
"0.54413325",
"0.54413325",
"0.5439998",
"0.543228",
"0.539618",
"0.5371561",
"0.53276306",
"0.531175",
"0.5305174",
"0.5288762",
"0.52602357",
... | 0.75423545 | 0 |
Remove the resource from given parent | def remove_from_parent
@change_set = ChangeSet.for(resource)
parent_resource = find_resource(parent_resource_params[:id])
authorize! :update, parent_resource
parent_change_set = ChangeSet.for(parent_resource)
current_member_ids = parent_resource.member_ids
parent_change_set.member_ids = current... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def removeFromParent\n @parent.remove(self) if @parent\n end",
"def remove_parent(parent)\n ActsAsDAG::HelperMethods.unlink(parent, self)\n return parent\n end",
"def remove_parent\n # has to go from parent to child\n self.parent.remove_child(self)\n end",
"def remove_item\n... | [
"0.79112875",
"0.7698963",
"0.76058424",
"0.7474343",
"0.7474127",
"0.71848273",
"0.71057445",
"0.6984999",
"0.6908093",
"0.6870487",
"0.67646116",
"0.6731585",
"0.6704699",
"0.65822965",
"0.6566884",
"0.65444684",
"0.6538078",
"0.6490064",
"0.64868987",
"0.6461714",
"0.64612... | 0.7830073 | 1 |
The activesupport to_query extension doesn't escape the = character as it's meant for a primary query string | def to_query(params)
params.to_query.gsub("=", "%3D").gsub("&", "%26")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringToQuery (val)\n\t\t\n\tend",
"def to_query(key)\n \"#{CGI.escape(key.to_param)}=#{CGI.escape(to_param.to_s)}\"\n end",
"def to_query(params)\n params.map do |key,value|\n \"#{CGI.escape(key.to_s)}=#{CGI.escape(value.to_s)}\"\n end * '&'\n end",
"def to_query(params)\... | [
"0.7703351",
"0.74878",
"0.73181206",
"0.7265",
"0.7253914",
"0.7204443",
"0.71720487",
"0.71463305",
"0.7111515",
"0.70547235",
"0.7051908",
"0.70347655",
"0.6945585",
"0.6938111",
"0.6905837",
"0.6905837",
"0.688844",
"0.68221706",
"0.67786735",
"0.67511123",
"0.67496675",
... | 0.77410597 | 0 |
Method for sending mail notifying signatures are complete | def send_signature_complete_mail(document)
DocumentMailer.with(email: document.user.email,
document: document).signing_complete.deliver_later
DocumentEvent.create!(document: document, message: "Varsel om ferdig signering sendt til #{document.user.email} ")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def completed\n SignaturesMailer.completed\n end",
"def notify\n ActionMailer::Base.mail(:from => \"edgar-garcia@northwestern.edu\", :to => \"digitalcollections@northwestern.edu\", :cc => \"edgar-garcia@northwestern.edu\", :subject => \"DIL Upload permission request - \" + current_user.uid, :body => \"Use... | [
"0.6952288",
"0.6925116",
"0.6554835",
"0.6492871",
"0.6489387",
"0.6475009",
"0.64749724",
"0.6465613",
"0.6453635",
"0.6434189",
"0.6397043",
"0.6321912",
"0.6308923",
"0.6290171",
"0.62781715",
"0.62780416",
"0.6263897",
"0.6260927",
"0.6233106",
"0.6228436",
"0.6227088",
... | 0.7214326 | 0 |
Method for making a viable ActiveStorage blob from attachment | def attachment
mail.attachments.map do |attachment|
blob = ActiveStorage::Blob.create_after_upload!(
io: StringIO.new(attachment.decoded),
filename: attachment.filename,
content_type: attachment.content_type
)
return blob
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blob\n generate\n storage.get(path).body\n end",
"def save_to_storage\n if save_attachment?\n object = self.class.bucket.objects.build(full_filename)\n\n object.content_type = content_type\n object.acl = attachment_options[:acl]\n object.content = t... | [
"0.7118034",
"0.682665",
"0.67741495",
"0.67528325",
"0.67528325",
"0.6704198",
"0.66375333",
"0.66314626",
"0.66031206",
"0.64447635",
"0.6307627",
"0.6277796",
"0.6250707",
"0.62150043",
"0.6202388",
"0.617266",
"0.6167845",
"0.6167845",
"0.6167845",
"0.6167845",
"0.6167845... | 0.69095224 | 1 |
Retrieve email_token from mail | def email_token
recipient = mail.recipients.find { |r| MATCHER.match?(r) }
recipient[MATCHER, 1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def extract_token_from_email(token_name)\n mail_body = last_email.body.to_s\n mail_body[/#{token_name.to_s}_token=([^\"]+)/, 1]\n end",
"def extract_token_from_email(token_name)\n mail_body = last_email.to_s\n mail_body[/#{token_name.to_s}_token=([^\"\\n\\r]+)/, 1]\n end",
"def read_user_emailtok... | [
"0.7751956",
"0.770032",
"0.73534673",
"0.71477175",
"0.69954956",
"0.6732436",
"0.6707616",
"0.67053014",
"0.6529971",
"0.64795786",
"0.6404596",
"0.6400369",
"0.63746166",
"0.6369599",
"0.63327336",
"0.63007706",
"0.6294674",
"0.6222821",
"0.6216576",
"0.6200276",
"0.619840... | 0.82676584 | 0 |
Creates a new SlimcdGateway The gateway requires that valid credentials be passed in the +options+ hash. ==== Options :client_id Assigned by the Slim CD administrator. (REQUIRED) :site_id Assigned by the Slim CD administrator. (REQUIRED) :price_id Assigned by the Slim CD administrator. (REQUIRED) :password Plaintext pa... | def initialize(options = {})
requires!(options, :client_id, :site_id, :price_id, :password, :key)
@options = options
super
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(client_id, client_secret, options = {})\n @client_id = client_id.to_s\n @client_secret = client_secret.to_s\n\n options = {\n :self_key => 'WePay',\n :hash_algo => 'sha512',\n }.merge(options)\n\n @self_key = options[:self_key].to_s\n @hash_algo = options... | [
"0.6130195",
"0.5729571",
"0.5636998",
"0.5613266",
"0.55797356",
"0.5565636",
"0.5554126",
"0.5524659",
"0.55031383",
"0.54439574",
"0.5438366",
"0.54274815",
"0.53963387",
"0.53900474",
"0.53895235",
"0.53841865",
"0.53803444",
"0.53724813",
"0.5343282",
"0.5324289",
"0.532... | 0.6456997 | 0 |
Credit an account. This transaction is also referred to as a Refund and indicates to the gateway that money should flow from the merchant to the customer. ==== Parameters money The amount to be credited to the customer. Either an Integer value in cents or a Money object. identification The ID of the original transactio... | def credit(money, identification, options = {})
post = { :gateid => identification }
commit('CREDIT', money, post)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credit(money, identification_or_credit_card, options = {}) \n if reference_transaction?(identification_or_credit_card)\n # Referenced credit: refund of a settled transaction\n perform_reference_credit(money, identification_or_credit_card, options)\n else # must be a credi... | [
"0.813205",
"0.78354686",
"0.7818792",
"0.7759083",
"0.7637752",
"0.76291376",
"0.7576386",
"0.74380124",
"0.7097683",
"0.7074614",
"0.6963055",
"0.69241565",
"0.68987834",
"0.6822871",
"0.66994894",
"0.66994894",
"0.6695116",
"0.6693651",
"0.66687053",
"0.6605151",
"0.655881... | 0.8146303 | 0 |
return pointer for use with pack('L') | def str_to_ptr(v)
[v].pack('p*').unpack('L')[0]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pack(p0) end",
"def unpack_pointer(packed_pointer)\n if is_64bit\n # Assume little endian\n packed_pointer.unpack('Q<')[0]\n else\n packed_pointer.unpack('V')[0]\n end\n end",
"def p32(*address)\n\treturn address.pack(\"L*\")\nend",
"def ret_s\n result = ''\n func = get... | [
"0.6726432",
"0.65648407",
"0.64998645",
"0.64528",
"0.62805027",
"0.62515354",
"0.62072206",
"0.6075672",
"0.60337585",
"0.5845405",
"0.5845405",
"0.5845405",
"0.5845405",
"0.5845405",
"0.5783891",
"0.5777143",
"0.5731012",
"0.57200515",
"0.570562",
"0.5607328",
"0.5537669",... | 0.66304564 | 1 |
Delivers integer of sum number of equipments owned by character instance | def total_items
items = Inventory.where(character_id: self.id)
items.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pool_acts_equip_mod\n return 0 if battler.nil? || !battler.is_a?(Game_Actor)\n battler.equips.inject(0) do |sum,e| \n mod = e.nil? ? 0 : (e.pool_acts_mod ||= 0)\n sum += mod\n end\n end",
"def character_weight\n total_weight = 0\n items = Inventory.where(character_id: self.i... | [
"0.6859731",
"0.68530625",
"0.65938455",
"0.6434458",
"0.6389056",
"0.6367064",
"0.62905943",
"0.62845594",
"0.62666035",
"0.62512994",
"0.62505794",
"0.6243097",
"0.62177783",
"0.62088156",
"0.6208674",
"0.619741",
"0.6176754",
"0.6137139",
"0.6111489",
"0.61032027",
"0.6096... | 0.6991001 | 0 |
GET /bestgames/1 GET /bestgames/1.json | def show
@bestgame = Bestgame.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @bestgame }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def index\n @games = Game.all\n\n respond_to do |format|\n format... | [
"0.75343937",
"0.7344581",
"0.726822",
"0.7268165",
"0.7268165",
"0.7268165",
"0.7207151",
"0.71713203",
"0.71511453",
"0.71043414",
"0.7099059",
"0.69591147",
"0.6954685",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.6949844",
"0.69472194"... | 0.7781176 | 0 |
POST /bestgames POST /bestgames.json | def create
@bestgame = Bestgame.new(params[:bestgame])
respond_to do |format|
if @bestgame.save
format.html { redirect_to @bestgame, notice: 'Bestgame was successfully created.' }
format.json { render json: @bestgame, status: :created, location: @bestgame }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end",
"def create\n game = @current_user.games.create!(game_params)\n render json: { game: game }\n end",
"def create\n @new_game = Game.create(game_params)\n render json: @new_game\n\n end",
"def... | [
"0.7068596",
"0.68883044",
"0.68633133",
"0.6773922",
"0.662005",
"0.6604422",
"0.653616",
"0.6505623",
"0.6488154",
"0.6471678",
"0.6464274",
"0.645424",
"0.64496934",
"0.64488995",
"0.6444146",
"0.6435989",
"0.6425111",
"0.6406201",
"0.63908786",
"0.63902277",
"0.63902277",... | 0.7362521 | 0 |
PUT /bestgames/1 PUT /bestgames/1.json | def update
@bestgame = Bestgame.find(params[:id])
respond_to do |format|
if @bestgame.update_attributes(params[:bestgame])
format.html { redirect_to @bestgame, notice: 'Bestgame was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end",
"def update\n\n @game.turn = params[:game][:turn]\n @game.finished = params[:game][:finished]\n @game.winner = params[:game][... | [
"0.68059254",
"0.6749593",
"0.6680789",
"0.6541481",
"0.6424901",
"0.641676",
"0.6412682",
"0.64113194",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.6409816",
"0.63943595",
"0.6390868",
"0.6361885",
"0.635334",
"0.6353",
"0.63510776",
"0... | 0.7373703 | 0 |
DELETE /bestgames/1 DELETE /bestgames/1.json | def destroy
@bestgame = Bestgame.find(params[:id])
@bestgame.destroy
respond_to do |format|
format.html { redirect_to bestgames_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @game.destroy\n respond_to do |format|\n format.html { redirect_to contest_games_path }\n format.json { head :no_content }\n end\n end",
"def destroy\n # @g... | [
"0.7487991",
"0.74776",
"0.7429544",
"0.74243677",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.7400176",
"0.73951095",
"0.73951095",
"0.73706836",
"0.73706836",
"0.73706836",... | 0.7804282 | 0 |
Returns an Array containing the segments of a constant path. | def constant_segments(node)
segments = []
if node.children[0]
segments.concat(constant_segments(node.children[0]))
end
segments << node.children[1].to_s
return segments
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def segments_from_path(path)\n # Remove leading ^ and trailing $ from each segment (left-overs from regexp joining)\n strip = proc { |str| str.gsub(/^\\^/, '').gsub(/\\$$/, '') }\n segments = []\n while match = (path.match(SEGMENT_REGEXP))\n segments << strip[match.pre_match] u... | [
"0.73867816",
"0.7174711",
"0.66963434",
"0.66170824",
"0.620103",
"0.61622316",
"0.6158511",
"0.61437505",
"0.6074302",
"0.6015535",
"0.60024714",
"0.5941801",
"0.5906851",
"0.5896547",
"0.58913326",
"0.586919",
"0.58139795",
"0.58119565",
"0.5810146",
"0.5738162",
"0.573709... | 0.7640927 | 0 |
Don't do fill setup | def fill_setup(_gc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fill_setup(gc)\n end",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend",
"def setup\n # noop\n end",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n\t\t# Do nothing\n\tend",
"def setup\n self.setup! unless self.setup?\n ... | [
"0.75280595",
"0.7078427",
"0.7078427",
"0.6971083",
"0.6915514",
"0.6915514",
"0.6868871",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6612044",
"0.6563023",
"0.650687",
"0.6501948",
"0.6470721",
"0.6460074",
"0.6424137",
"0.6386713",
"... | 0.75122476 | 1 |
GET /hacks/1 GET /hacks/1.json | def show
@hack = Hack.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @hack }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @hacker = Hacker.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @hacker }\n end\n end",
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\... | [
"0.70416176",
"0.66230714",
"0.6590241",
"0.6540019",
"0.6310924",
"0.6310924",
"0.6264245",
"0.624627",
"0.624627",
"0.61146516",
"0.59942466",
"0.59170043",
"0.5821667",
"0.5821667",
"0.5814296",
"0.5772688",
"0.57704675",
"0.5751515",
"0.5737273",
"0.5715793",
"0.5705145",... | 0.7400066 | 0 |
GET /hacks/new GET /hacks/new.json | def new
@hack = Hack.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @hack }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @hack = Hack.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hack }\n end\n end",
"def new\n @hacker = Hacker.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @hacker }\n end\n end"... | [
"0.8059126",
"0.77401054",
"0.77401054",
"0.6790309",
"0.6655544",
"0.6633469",
"0.657953",
"0.6504488",
"0.64509076",
"0.6442616",
"0.6442448",
"0.64174134",
"0.6407759",
"0.6379512",
"0.63743067",
"0.63493705",
"0.63493705",
"0.63412446",
"0.6297349",
"0.629451",
"0.6217404... | 0.8019836 | 1 |
PUT /hacks/1 PUT /hacks/1.json | def update
@hack = Hack.find(params[:id])
respond_to do |format|
if @hack.update_attributes(params[:hack])
format.html { redirect_to @hack, :notice => 'Hack was successfully updated.' }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.jso... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @hack = Hack.find(params[:id])\n\n respond_to do |format|\n if @hack.update_attributes(params[:hack])\n format.html { redirect_to @hack, notice: 'Hack was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.7111815",
"0.68478435",
"0.6722511",
"0.659202",
"0.659202",
"0.6347484",
"0.60263634",
"0.59213746",
"0.5888474",
"0.5802053",
"0.579233",
"0.57616717",
"0.57616717",
"0.565767",
"0.5615698",
"0.556979",
"0.55583864",
"0.5544215",
"0.5538186",
"0.55355215",
"0.55355215",
... | 0.7141757 | 0 |
DELETE /hacks/1 DELETE /hacks/1.json | def destroy
@hack = Hack.find(params[:id])
@hack.destroy
respond_to do |format|
format.html { redirect_to hacks_url }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @hack = Hack.find(params[:id])\n @hack.destroy\n\n respond_to do |format|\n format.html { redirect_to hacks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @hacker = Hacker.find(params[:id])\n @hacker.destroy\n\n respond_to do |format|\n fo... | [
"0.7742959",
"0.7297151",
"0.7268553",
"0.690549",
"0.66731745",
"0.65752196",
"0.655937",
"0.654154",
"0.6390018",
"0.632456",
"0.627344",
"0.62694347",
"0.62603915",
"0.6252997",
"0.62400734",
"0.6210805",
"0.6210805",
"0.6210805",
"0.6210805",
"0.62079275",
"0.6195012",
... | 0.77715 | 0 |
Show news content + 2 GT links "next" and "previous" | def show
@news = News.find(params[:id])
@next = News.where("publication_date <= ? AND id != ?", @news.publication_date, @news.id).order("publication_date DESC").first;
@previous = News.where("publication_date >= ? AND id != ?", @news.publication_date, @news.id).order("publication_date DESC").last;
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @previous_blog = @blog.previous\n @next_blog = @blog.next\n end",
"def publish_front_page\n\t\tfirst = (@current_page - 1) * 3\n\t\tlast = (first + 3) - 1\n\t\tpage = first..last\n\t\t@post[page].each do |each_post|\n\t\t\tputs \"#{each_post.title} #{each_post.date}\"\n\t\t\tputs \"#{each_post.... | [
"0.64494765",
"0.63321674",
"0.6331142",
"0.6284424",
"0.6270019",
"0.6252723",
"0.6249508",
"0.62449545",
"0.6211686",
"0.619979",
"0.60810107",
"0.6050475",
"0.5995736",
"0.5990199",
"0.5949574",
"0.59228194",
"0.5919695",
"0.59050727",
"0.5903859",
"0.5888443",
"0.58654964... | 0.6763704 | 0 |
Method to set a translation engine +translator+ Instance of translation engine. Refer to `engines/aws` for example ==== Raises `InvalidInputException` when the argument `translator` is not an instance of Translator class | def set_translator(translator)
if translator && !(translator.is_a? Translator)
raise InvalidInputException.new("Argument is not an instance of Translator")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_translator\n @translator = Translator.find(params[:id])\n end",
"def set_translator\n @translator = Translator.find(params[:id])\n end",
"def translator\n @translator ||= Translator.new\n end",
"def configure(&block)\n unless provider\n raise 'Translation provider ... | [
"0.6233308",
"0.6233308",
"0.60803765",
"0.55349505",
"0.5384758",
"0.5176296",
"0.5095139",
"0.49945453",
"0.49788138",
"0.49754748",
"0.494479",
"0.49301872",
"0.4921156",
"0.4905077",
"0.48527458",
"0.4826315",
"0.48260474",
"0.48055702",
"0.478637",
"0.47804967",
"0.47587... | 0.7462785 | 0 |
Method to translate the caption from one language to another +src_lang+ can be inferred using infer_language method +target_lang+ Target 2 letter ISO language code to which the source needs to be translated in to. +output_file+ Output file. Can be a fully qualified path or just file name ==== Raises InvalidInputExcepti... | def translate(src_lang, target_lang, output_file)
# Check if a non empty output file is present and error out to avoid
# the danger or overwriting some important file !!
if File.exists?(output_file) && File.size(output_file) > 0
raise InvalidInputException.new("Output file #{output_file} is not empty.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(input_text, src_lang, target_lang)\n raise \"Not Implemented. Class #{self.class.name} doesn't implement translate\"\n end",
"def convert\n # TODO: implementation\n output_file = choose_output\n return if output_file.nil?\n Converter.translate(@file, output_file)\n log(\"File con... | [
"0.62928003",
"0.61206913",
"0.6045052",
"0.6026681",
"0.59488124",
"0.571821",
"0.5589105",
"0.5477882",
"0.538116",
"0.52734816",
"0.5264656",
"0.5199831",
"0.5198509",
"0.5108316",
"0.5067594",
"0.50415075",
"0.49992803",
"0.49937707",
"0.49720055",
"0.4959468",
"0.4955963... | 0.827195 | 0 |
Method to convert from one caption type to other types. If the src_lang is not provided then all source languages will be converted to target types. For example, if a ttml file has "en" and "es" and target_type is vtt and no src_lang is provided 2 vtt files would be created one per language in the source. if a target_l... | def transform_to(types, src_lang, target_lang, output_dir)
if (types - supported_transformations).size != 0
raise InvalidInputException.new("Unknown types provided for conversion in input #{types}")
end
unless File.directory?(output_dir)
FileUtils.mkdir_p(output_dir)
end
# Basic validati... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def translate(src_lang, target_lang, output_file)\n # Check if a non empty output file is present and error out to avoid\n # the danger or overwriting some important file !!\n if File.exists?(output_file) && File.size(output_file) > 0\n raise InvalidInputException.new(\"Output file #{output_file} is ... | [
"0.645276",
"0.51610065",
"0.51556504",
"0.5090777",
"0.50742704",
"0.4923128",
"0.4892049",
"0.48383597",
"0.47344825",
"0.4706987",
"0.46942037",
"0.46891785",
"0.4681737",
"0.46329215",
"0.4613695",
"0.4571641",
"0.45504057",
"0.44888973",
"0.44713172",
"0.4471253",
"0.446... | 0.6803488 | 0 |
Method to report on the supported transformations. Each implementor is free to return the types to which it can convert itself to ==== Returns An array of one or more types defined as +TYPE_+ constants here | def supported_transformations
raise "Not Implemented. Class #{self.class.name} doesn't implement supported_transformations"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def types\n trans = ChessMoves::Transformations[@type]\n trans ? [@type, trans.first] : [@type]\n end",
"def cast_types; end",
"def transforms\n @transforms ||= [\n NullTransform, NormalizationTransform, CasingTransform,\n NamedTransform, BreakInternalTransform... | [
"0.6083852",
"0.58313733",
"0.5753641",
"0.574344",
"0.574344",
"0.574344",
"0.574344",
"0.574344",
"0.56845313",
"0.5650447",
"0.5531124",
"0.5522686",
"0.5522366",
"0.5462688",
"0.5385095",
"0.5371676",
"0.5352404",
"0.5289835",
"0.5285845",
"0.5265506",
"0.5255417",
"0.5... | 0.64704716 | 0 |
GET /pashiris GET /pashiris.json | def index
@pashiris = Pashiri.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @pizzas = Pizza.all\n render json: @pizzas\n end",
"def index\n @iphs = Iph.paginate(:page => params[:page], :per_page => 10).order('created_at desc')\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @iphs }\n end\n end",
"def index\n ... | [
"0.6671753",
"0.6513453",
"0.64613706",
"0.63841903",
"0.6178173",
"0.6176981",
"0.61122996",
"0.610425",
"0.60990757",
"0.6095957",
"0.6080021",
"0.60766923",
"0.6062933",
"0.6061838",
"0.6060596",
"0.6040236",
"0.60252005",
"0.6023783",
"0.6017991",
"0.60085934",
"0.6004138... | 0.6998126 | 0 |
POST /pashiris POST /pashiris.json | def create
@pashiri = Pashiri.new(pashiri_params)
respond_to do |format|
if @pashiri.save
format.html { redirect_to @pashiri, notice: 'Pashiri was successfully created.' }
format.json { render :show, status: :created, location: @pashiri }
else
format.html { render :new }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @pai = Pai.new(pai_params)\n\n respond_to do |format|\n if @pai.save\n format.html { redirect_to pais_path, notice: 'Pais creado existosamente.' }\n format.json { render :index, status: :created, location: @pai }\n else\n format.html { render :new }\n format... | [
"0.6159259",
"0.60890347",
"0.60772866",
"0.6008758",
"0.6002866",
"0.5978132",
"0.5931346",
"0.59150285",
"0.587966",
"0.5879078",
"0.5857598",
"0.5850426",
"0.584057",
"0.5800717",
"0.57987875",
"0.57905346",
"0.5789546",
"0.57742184",
"0.5723724",
"0.5700369",
"0.56997633"... | 0.68317336 | 0 |
+list_ids+ array +paras+ must contain: :is_double_opt_in => 0 or 1 :contacts => array of hashes, required elements: :contact_email => string | def add_list_contacts(list_ids, params = {})
contact_params = params[:contacts].each_with_object({}).with_index do |(value, hash), index|
hash[index.to_s.to_sym] = value
end
request = @request.post(self_path, {
list_ids: list_ids.join(','),
contact: contact_params,
**pa... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ffcrm_list_ids\n config.mailchimp_list_fields.map{ |f| f.settings['list_id'] }\n end",
"def list_ids params={}\n @nimble.get \"contacts/ids\", params\n end",
"def get_list(access_token, list_id)\n url = Util::Config.get('endpoints.base_url') + sprintf(Util::Config.get('endpoints.li... | [
"0.6537701",
"0.6409986",
"0.6314376",
"0.6202293",
"0.61447304",
"0.6133586",
"0.61107796",
"0.6053742",
"0.6023222",
"0.6004759",
"0.5993043",
"0.5913859",
"0.58669436",
"0.585816",
"0.58186555",
"0.5792634",
"0.57781297",
"0.577165",
"0.5749327",
"0.5745986",
"0.573956",
... | 0.70998883 | 0 |
Eager load the inclusions for the provided documents. | def eager_load(docs)
criteria.inclusions.reject! do |metadata|
metadata.eager_load(eager_loaded_ids(docs, metadata)) if !docs.empty?
end
self.eager_loaded = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eager_load(docs)\n docs.tap do |d|\n if eager_loadable?\n preload(criteria.inclusions, d)\n end\n end\n end",
"def preload(associations, docs)\n assoc_map = associations.group_by(&:inverse_class_name)\n docs_map = {}\n queue = [ klass.to_s ... | [
"0.7961708",
"0.7189925",
"0.71194655",
"0.67525935",
"0.6457974",
"0.5974804",
"0.5782307",
"0.57713246",
"0.5672247",
"0.56202644",
"0.5588762",
"0.5567512",
"0.5559808",
"0.5550628",
"0.5550299",
"0.54679507",
"0.5458448",
"0.5411506",
"0.5410671",
"0.53934044",
"0.5354763... | 0.7825022 | 1 |
Get the ids that to be used to eager load documents. | def eager_loaded_ids(docs, metadata)
if metadata.stores_foreign_key?
docs.flat_map{ |doc| doc.send(metadata.foreign_key) }
else
docs.map(&:id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ids\n pluck(:id)\n end",
"def ids\n @ids ||= []\n end",
"def list_ids\n @documents.keys\n end",
"def ids; @docs.keys end",
"def ids_reader\n if loaded?\n target.pluck(reflection.association_primary_key)\n elsif !target.empty?\n loa... | [
"0.7399233",
"0.71266544",
"0.69960755",
"0.69870645",
"0.6968951",
"0.68956256",
"0.6885342",
"0.6851249",
"0.6733995",
"0.6733995",
"0.66956615",
"0.6689642",
"0.66720366",
"0.66556054",
"0.6654067",
"0.664867",
"0.66382426",
"0.66186136",
"0.6565304",
"0.6548871",
"0.65374... | 0.82438326 | 0 |
Is this context able to be eager loaded? | def eager_loadable?
!eager_loaded && !criteria.inclusions.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eager_load; end",
"def eager_load; end",
"def eager_load; end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def eager_load!; end",
"def eagerly_apply_sideload?(sideload)\n # TODO: Maybe handle this in graphiti-rails\n if defined?(::Rails) && (app = :... | [
"0.7394642",
"0.7394642",
"0.7394642",
"0.7300624",
"0.7300624",
"0.7300624",
"0.7300624",
"0.72637445",
"0.7181542",
"0.7149233",
"0.7087576",
"0.70119905",
"0.69184154",
"0.6863344",
"0.6618614",
"0.66065854",
"0.6516241",
"0.6482455",
"0.6482455",
"0.648157",
"0.64795446",... | 0.7465128 | 0 |
If the provided document exists, eager load its dependencies or return nil. | def with_eager_loading(document)
selecting do
return nil unless document
doc = Factory.from_db(klass, document, criteria.object_id)
eager_load([ doc ]) if eager_loadable?
doc
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def eager_load(docs)\n docs.tap do |d|\n if eager_loadable?\n preload(criteria.inclusions, d)\n end\n end\n end",
"def eager_load(docs)\n criteria.inclusions.reject! do |metadata|\n metadata.eager_load(eager_loaded_ids(docs, metadata)) if !docs.empt... | [
"0.6579142",
"0.6222745",
"0.5713307",
"0.5503678",
"0.5422323",
"0.54137653",
"0.54137653",
"0.54137653",
"0.54137653",
"0.5335207",
"0.53014153",
"0.5300445",
"0.52242017",
"0.52242017",
"0.52242017",
"0.51282054",
"0.51129645",
"0.51118416",
"0.5066751",
"0.5036758",
"0.50... | 0.7237734 | 0 |
Delete all the result data for this competition. Note: only works for Time Results and External Results.... (Judged events do not work). | def destroy_all_results
authorize @competition
results = @competition.scoring_helper.all_competitor_results
if results.present?
Competition.transaction do
results.each(&:destroy)
end
flash[:notice] = "Deleted all data for this competition"
else
flash[:alert] = "No result... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @external_result.destroy\n\n respond_to do |format|\n format.html { redirect_to competition_external_results_path(@competition) }\n format.json { head :no_content }\n end\n end",
"def destroy\n @time_result.destroy\n\n respond_to do |format|\n format.html { redirect_t... | [
"0.66776633",
"0.6654998",
"0.6604729",
"0.652609",
"0.650969",
"0.6457385",
"0.62956434",
"0.62074876",
"0.6196466",
"0.6192479",
"0.61584574",
"0.61348474",
"0.6123614",
"0.6123006",
"0.611536",
"0.611536",
"0.61077696",
"0.61077696",
"0.60713124",
"0.60713124",
"0.60713124... | 0.7805588 | 0 |
Link to user's page ('users/1') By default, their login is used as link text and link title (tooltip) Takes options :content_text => 'Content text in place of user.login', escaped with the standard h() function. :content_method => :user_instance_method_to_call_for_content_text :title_method => :user_instance_method_to_... | def link_to_user(user, options={})
raise "Invalid user" unless user
options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname
content_text = options.delete(:content_text)
content_text ||= user.send(options.delete(:content_method))
options[:title] ||= user... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_user(user, options={})\n raise I18n.t(\"Invalid user\", :default => \"Invalid user\") unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.dele... | [
"0.82731956",
"0.76458555",
"0.7575097",
"0.7575097",
"0.7575097",
"0.7501613",
"0.7118422",
"0.69058424",
"0.69058424",
"0.69058424",
"0.69058424",
"0.69058424",
"0.6853651",
"0.68350726",
"0.66663975",
"0.66597277",
"0.6569704",
"0.6567823",
"0.65475714",
"0.65009093",
"0.6... | 0.83703524 | 0 |
Link to the current user's page (using link_to_user) or to the login page (using link_to_login_with_IP). | def link_to_current_user(options={})
if logged_in?
link_to_user current_user, options
else
content_text = options.delete(:content_text) || 'not signed in'
# kill ignored options from link_to_user
[:content_method, :title_method].each{|opt| options.delete(opt)}
link_to_login_with_I... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def link_to_current_user(options={})\n if current_user\n link_to_user current_user, options\n else\n content_text = options.delete(:content_text) || I18n.t(\"not signed in\", :default => \"not signed in\")\n # kill ignored options from link_to_user\n [:content_method, :title_method].each{... | [
"0.80740875",
"0.8023548",
"0.8023548",
"0.8023548",
"0.75909233",
"0.7460318",
"0.74271417",
"0.7180359",
"0.7107796",
"0.7106657",
"0.7106657",
"0.7106657",
"0.7071415",
"0.69571424",
"0.6945969",
"0.6923482",
"0.691113",
"0.691113",
"0.691113",
"0.691113",
"0.691113",
"0... | 0.80252796 | 1 |
Get the top / header line of a function definition file, and get function name and swapped form | def getTopLine(text)
functionName = text.match(/(?<=function )([^\(]+)/)[0]
swapped = "#{functionName}: #{text.gsub(/(?<=function) [^\(]+/, '')}"
return({:name => functionName, :swap => swapped})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def function_header\n if token_is_not? :def\n return nil\n end\n require :def\n method_name = require :id\n require :open_parentheses\n argument_list = argument_list()\n require :close_parentheses\n { method_name: method_name.content, argument_list: argument_list }\n ... | [
"0.7030817",
"0.6795978",
"0.6788353",
"0.6640568",
"0.660048",
"0.6465643",
"0.62303877",
"0.6204543",
"0.6111567",
"0.61023253",
"0.60288215",
"0.6012504",
"0.58947355",
"0.5858136",
"0.5806586",
"0.57749474",
"0.5772479",
"0.57703614",
"0.57703614",
"0.57703614",
"0.577036... | 0.7294665 | 0 |
Must be: (a) an expanding parameter, and (b) a singleton already (i.e. doesn't respond to :each) | def expandable_singleton?(p, arg)
self.class.expanding_parameters.include?(p) && !arg.respond_to?(:each)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def expand\n end",
"def double_collections_by_parameter_name; end",
"def double_collections_by_parameter_name; end",
"def expanded; end",
"def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end",
"def my_inject(arg = nil)\n\... | [
"0.5670332",
"0.55736846",
"0.55736846",
"0.5334335",
"0.5330755",
"0.53165853",
"0.5289883",
"0.5279621",
"0.52580595",
"0.5232545",
"0.5201416",
"0.51912737",
"0.5169503",
"0.5152025",
"0.5152025",
"0.5133091",
"0.51196957",
"0.5116818",
"0.5108777",
"0.50890464",
"0.505195... | 0.72003657 | 0 |
For each parameter/attribute foo we try to invoke a validate_foo | def validate
self.class.parameters.each do |param, default|
method = "validate_#{param}"
if self.respond_to? method
attribute = "@#{param}"
val = instance_variable_get(attribute)
if val.respond_to? :each
new_val = val.map.with_index{ |v, i| send(method, v, i) }
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def validate_params\n validate_size\n validate_mine_density\n validate_first_click\n type_specific_checks\n end",
"def validate_command_attrs\n self.class.validation_logics.each do |attr, logics|\n val = self.instance_variable_get(\"@#{attr}\".to_sym)\n logics.each do |l|\n ... | [
"0.6917412",
"0.6889291",
"0.6879437",
"0.67552453",
"0.6426025",
"0.63697535",
"0.63275874",
"0.63139665",
"0.6313552",
"0.6290666",
"0.6276874",
"0.6274135",
"0.624592",
"0.618856",
"0.616144",
"0.6161068",
"0.6160548",
"0.6153382",
"0.6152803",
"0.6128364",
"0.61013705",
... | 0.7319916 | 0 |
Return the deck's configuration | def deck_conf
@deck.conf
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def config\n @options[:config]\n end",
"def config\n configuration\n end",
"def config\r\n @configuration\r\n end",
"def configuration\n Configuration::get\n end",
"def configuration\n Configuration::get\n end",
"def get_config\n\t\tend",
"def get_act... | [
"0.692501",
"0.68117595",
"0.67992246",
"0.6711172",
"0.6711172",
"0.67032176",
"0.66439056",
"0.66324276",
"0.6619618",
"0.6603068",
"0.6548771",
"0.65445405",
"0.65445405",
"0.65445405",
"0.65445405",
"0.65445405",
"0.65445405",
"0.64680886",
"0.6447232",
"0.6406319",
"0.63... | 0.8935062 | 0 |
NOTE : I think this api is very badly designed. 1. parameter : giving 'id' parameter will filter by chat id. so instead of 'id' it should use 'chat_id' to make it more clear 2. response : I would probably return list and does group_by on the client side, or I would create another end point that returns grouped_by resul... | def index
list = current_user.chats.pluck :id
options = filter_params
options[:id] = filter_params[:id] == 'all' ? list : [filter_params[:id]]
@messages = ChatMessage.filter options
@messages = @messages.group_by(&:chat_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def groupchats\n @groupchat = []\n @group_comments = GroupComment.all\n @group_comments.each { |comment|\n if (comment.studygroup_id == group_comment_params[:studygroup_id].to_f)\n @groupchat.push(comment)\n end\n }\n render json: @groupchat\n end",
"def get_group_chat\n\t \tp\"-... | [
"0.70226955",
"0.6886226",
"0.6831614",
"0.62992144",
"0.6281334",
"0.6204657",
"0.62001276",
"0.6123886",
"0.60300833",
"0.5910145",
"0.5904673",
"0.5839655",
"0.5807279",
"0.57862145",
"0.5782848",
"0.57684755",
"0.5758375",
"0.5756378",
"0.5749425",
"0.5695322",
"0.5617327... | 0.70540565 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.