query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
GET /tasks_translations/1 GET /tasks_translations/1.xml | def show
@tasks_translation = TasksTranslation.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @tasks_translation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @tasks_translation = TasksTranslation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tasks_translation }\n end\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def translations(lang... | [
"0.6161382",
"0.60855395",
"0.60156786",
"0.6014239",
"0.5986636",
"0.59794897",
"0.59421444",
"0.5916029",
"0.5911339",
"0.5886465",
"0.5881313",
"0.58089095",
"0.5805754",
"0.57732743",
"0.57634354",
"0.5756552",
"0.57557786",
"0.5734326",
"0.5657179",
"0.5623847",
"0.56137... | 0.7059508 | 0 |
GET /tasks_translations/new GET /tasks_translations/new.xml | def new
@tasks_translation = TasksTranslation.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @tasks_translation }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end",
"def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { re... | [
"0.695351",
"0.681781",
"0.681781",
"0.681781",
"0.681781",
"0.6811606",
"0.68010306",
"0.67411697",
"0.66611695",
"0.6659251",
"0.6552536",
"0.65156525",
"0.6451627",
"0.64503384",
"0.6429063",
"0.6428584",
"0.64077604",
"0.6402117",
"0.63208574",
"0.63081473",
"0.62978756",... | 0.76929295 | 0 |
POST /tasks_translations POST /tasks_translations.xml | def create
@tasks_translation = TasksTranslation.new(params[:tasks_translation])
respond_to do |format|
if @tasks_translation.save
format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully created.') }
format.xml { render :xml => @tasks_translation, :status => :created, :location => @tasks_translation }
else
format.html { render :action => "new" }
format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_translations\n end",
"def request_translations(texts, options = T.unsafe(nil), http_options = T.unsafe(nil)); end",
"def create\n @events_translation = EventsTranslation.new(params[:events_translation])\n\n respond_to do |format|\n if @events_translation.save\n format.html { redir... | [
"0.67565733",
"0.5894751",
"0.5811457",
"0.57417226",
"0.5655364",
"0.56385374",
"0.5638287",
"0.5601117",
"0.55633235",
"0.55541253",
"0.55426544",
"0.55190897",
"0.5487896",
"0.54401577",
"0.54032",
"0.5394314",
"0.5340205",
"0.5333159",
"0.53139836",
"0.5313373",
"0.531119... | 0.66660917 | 1 |
PUT /tasks_translations/1 PUT /tasks_translations/1.xml | def update
@tasks_translation = TasksTranslation.find(params[:id])
respond_to do |format|
if @tasks_translation.update_attributes(params[:tasks_translation])
format.html { redirect_to([:admin,@tasks_translation], :notice => 'Tasks translation was successfully updated.') }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @tasks_translation.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\r\n\r\n data = params.except(:action, :controller, :options)\r\n options = params[:options]\r\n translations = GetPomo::PoFile.parse(File.read(\"#{Rails.root}/po/#{options[\"locale\"]}/#{APP_SID}.po\"))\r\n\r\n # Find translation\r\n\r\n @locale = translations.find { |t| t.comment == d... | [
"0.59877926",
"0.585553",
"0.582672",
"0.58142734",
"0.580088",
"0.5783669",
"0.577683",
"0.57681143",
"0.5725884",
"0.57240653",
"0.5716707",
"0.57111347",
"0.57111347",
"0.56954956",
"0.5636602",
"0.5621261",
"0.5614721",
"0.5599098",
"0.5580927",
"0.55802065",
"0.55754143"... | 0.6670991 | 0 |
DELETE /tasks_translations/1 DELETE /tasks_translations/1.xml | def destroy
@tasks_translation = TasksTranslation.find(params[:id])
@tasks_translation.destroy
respond_to do |format|
format.html { redirect_to(admin_tasks_translations_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_translations\n end",
"def delete_translations\n TranslationKey.find_by(name: description_translation_key).try(:destroy)\n end",
"def destroy\n @task = Task.find(params[:id])\n @task.destroy\n\n Task.find_by_name(unescape_url(params[:id]))\n respond_to do |format|\n format.html ... | [
"0.72990125",
"0.6736443",
"0.6604033",
"0.65872294",
"0.64097464",
"0.6369544",
"0.63376635",
"0.63249373",
"0.6318398",
"0.63169014",
"0.6302202",
"0.6277306",
"0.6277306",
"0.6277306",
"0.6277306",
"0.62321115",
"0.6225642",
"0.6221018",
"0.6177301",
"0.61757106",
"0.61618... | 0.74211144 | 0 |
takes a hash of question IDs (keys) and answers (values) | def set_answers!(params)
SurveyQuestion.with_question.find_all_by_survey_id(survey_id).each do |question| # iterate through all survey questions
if params[question.id.to_s].blank? # if the question hasn't been answered
remove_answer(question.id)
else
set_answer(question, params[question.id.to_s]) # save the answer
end
end
save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def answer_dictionary (profile)\n answers = {}\n profile['answers'].each do |answer|\n answers << {\n answer['questionId'] => answer\n }\n end\n answers\nend",
"def answers_for_question(question)\n @answers_for_question ||= {}\n @answers_for_question[question] ||= Answer.first_level_only\n ... | [
"0.7079243",
"0.6831264",
"0.6753015",
"0.673924",
"0.6645991",
"0.656122",
"0.656122",
"0.6428588",
"0.6341754",
"0.6301192",
"0.63009423",
"0.62833834",
"0.62736684",
"0.6184307",
"0.6170896",
"0.61706865",
"0.61139953",
"0.60994405",
"0.6005416",
"0.6002221",
"0.5984477",
... | 0.576746 | 38 |
destroy the answer if it exists (the user has unset it in the form) | def remove_answer(question_id)
answers.each do |a|
if a.survey_question.id == question_id
self.answers.delete(a)
a.destroy
return
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_answer\n \t\tself.answer = nil\n \tend",
"def destroy\n Answer.force_all.find_by_id(params[:answer_id]).destroy!\n redirect_to edit_admin_learning_object_path(id: @learning_object.id, anchor: 'answer-settings'), :notice => \"Odpoveď bola odstránená.\"\n end",
"def destroy\n @answer.... | [
"0.73642284",
"0.7251519",
"0.715624",
"0.7079844",
"0.7023826",
"0.69775724",
"0.6897252",
"0.68699455",
"0.68602204",
"0.6857843",
"0.6789795",
"0.6789795",
"0.67517215",
"0.67337674",
"0.6727605",
"0.67168045",
"0.67140955",
"0.67083687",
"0.6692894",
"0.66906184",
"0.6679... | 0.6398425 | 67 |
Cierre de la Clase | def atributos
p "El Modelo del carro es: #{@modelo}, la Marca es: #{@marca} y el Color es: #{@color}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend",
"def calculoComprimento(raio)\n return calculoDiametro(raio) * Math::PI\nend",
"def jeuTermine\n\t\t@grille.score.recupererTemps(self.timer)\n\t\tscoreFinal = @grille.score.calculerScoreFinal\n\t\t@@joueur.score = scoreFinal > 0 ? scoreFi... | [
"0.66516244",
"0.6460547",
"0.6408922",
"0.6303441",
"0.6296627",
"0.62791747",
"0.62757325",
"0.6271196",
"0.6256546",
"0.6215393",
"0.6199035",
"0.6197202",
"0.6193948",
"0.616021",
"0.6142314",
"0.6141753",
"0.6141748",
"0.61345625",
"0.6072196",
"0.60616326",
"0.60479325"... | 0.0 | -1 |
GET /orders GET /orders.json | def index
@customer = current_customer
@orders = current_customer.orders.all.order(created_at: :desc)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n ... | [
"0.83267236",
"0.815406",
"0.80041754",
"0.7947603",
"0.7846487",
"0.7823147",
"0.78028905",
"0.76992875",
"0.76980406",
"0.7682792",
"0.7682792",
"0.7682792",
"0.7682792",
"0.76827645",
"0.75880665",
"0.7574349",
"0.756171",
"0.7531827",
"0.74860185",
"0.7432208",
"0.7369724... | 0.0 | -1 |
GET /orders/1 GET /orders/1.json | def show
@customer = current_customer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end",
"def index\n @orders = Order.all\n render json: @orders\n end",
"def index\n @orders = Order.all\n render json: @orders, status: 200\n end",
"def index\n @orders = Order.order(\"id\").all\n\n resp... | [
"0.7554187",
"0.7488565",
"0.7475228",
"0.73777765",
"0.73714006",
"0.7341344",
"0.73384553",
"0.73168725",
"0.73018956",
"0.7291244",
"0.7291244",
"0.7291244",
"0.7291244",
"0.72911215",
"0.7281374",
"0.7266143",
"0.72498786",
"0.7228276",
"0.7213504",
"0.71842283",
"0.71261... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_order
@order = Order.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Note: a and b are not ordered! Examples get_sum(1, 0) == 1 1 + 0 = 1 get_sum(1, 2) == 3 1 + 2 = 3 get_sum(0, 1) == 1 0 + 1 = 1 get_sum(1, 1) == 1 1 Since both are same get_sum(1, 0) == 1 1 + 0 = 1 get_sum(1, 2) == 2 1 + 0 + 1 + 2 = 2 | def get_sum(a,b)
if a || b
a + b
elsif a == a
return a
elsif b == b
return b
else
puts "Invalid Option"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_sum(a, b)\n [a,b].reduce(&:+)\nend",
"def get_sum(a,b)\n if a > b \n (b..a).reduce(:+)\n else\n (a..b).reduce(:+)\n end\n end",
"def get_sum(a,b)\n if a > b\n [ *b..a ].sum\n elsif a == b\n a\n else\n [ *a..b ].sum\n end\nend",
"def get_sum(a,b)\n c, d = [a, b].sort... | [
"0.8176009",
"0.78915006",
"0.77607363",
"0.76230437",
"0.75418353",
"0.746267",
"0.7407989",
"0.73993254",
"0.7381634",
"0.7357282",
"0.73509336",
"0.73399186",
"0.73318714",
"0.7317591",
"0.724486",
"0.7216245",
"0.715397",
"0.71457314",
"0.71357864",
"0.7063525",
"0.693866... | 0.6910769 | 21 |
GET /contentareas/1 GET /contentareas/1.json | def show
@contentarea = Contentarea.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @contentarea }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @question_content_area }\n end\n end",
"def index\n @core_areas = Core::Area.find_mine(params).paginate(page: params[:page])\n\n ... | [
"0.6896688",
"0.67522126",
"0.6700889",
"0.65714943",
"0.6499365",
"0.6494538",
"0.6450973",
"0.6408846",
"0.63800746",
"0.63278615",
"0.6327422",
"0.6306175",
"0.6303182",
"0.630316",
"0.6285437",
"0.6242746",
"0.6236289",
"0.61805433",
"0.6167691",
"0.6108322",
"0.60960263"... | 0.7496818 | 0 |
GET /contentareas/new GET /contentareas/new.json | def new
@contentarea = Contentarea.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @contentarea }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @area = Area.new\n @other_areas = Area.all\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @area }\n end\n end",
"def new\n @area = Area.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ar... | [
"0.7594549",
"0.737397",
"0.737397",
"0.73288965",
"0.71919423",
"0.71270627",
"0.70101136",
"0.69096786",
"0.68503803",
"0.6825309",
"0.67825854",
"0.6714131",
"0.67098624",
"0.6695262",
"0.6695262",
"0.66949016",
"0.6694842",
"0.66306186",
"0.6622167",
"0.6621261",
"0.66148... | 0.8025531 | 0 |
POST /contentareas POST /contentareas.json | def create
@contentarea = Contentarea.new(params[:contentarea])
respond_to do |format|
if @contentarea.save
format.html { redirect_to @contentarea, notice: 'Contentarea was successfully created.' }
format.json { render json: @contentarea, status: :created, location: @contentarea }
else
format.html { render action: "new" }
format.json { render json: @contentarea.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @question_content_area = QuestionContentArea.new(params[:question_content_area])\n\n respond_to do |format|\n if @question_content_area.save\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully created.' }\n format.json { render j... | [
"0.676901",
"0.6386255",
"0.62644666",
"0.59451544",
"0.58977705",
"0.5799224",
"0.5799224",
"0.5781559",
"0.5684307",
"0.56748056",
"0.5647956",
"0.5618514",
"0.56175065",
"0.5572897",
"0.5566222",
"0.5551608",
"0.5539072",
"0.5535006",
"0.552705",
"0.55235976",
"0.5517436",... | 0.6968393 | 0 |
PUT /contentareas/1 PUT /contentareas/1.json | def update
@contentarea = Contentarea.find(params[:id])
respond_to do |format|
if @contentarea.update_attributes(params[:contentarea])
format.html { redirect_to @contentarea, notice: 'Contentarea was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @contentarea.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @question_content_area = QuestionContentArea.find(params[:id])\n\n respond_to do |format|\n if @question_content_area.update_attributes(params[:question_content_area])\n format.html { redirect_to @question_content_area, notice: 'Question content area was successfully updated.' }\n ... | [
"0.65948105",
"0.6158481",
"0.6158481",
"0.6158481",
"0.60637283",
"0.59376276",
"0.59227276",
"0.5866951",
"0.58296347",
"0.5743351",
"0.57418835",
"0.5712889",
"0.56902057",
"0.5688713",
"0.56774104",
"0.5653293",
"0.5653293",
"0.5646075",
"0.56446224",
"0.5625076",
"0.5595... | 0.7002027 | 0 |
DELETE /contentareas/1 DELETE /contentareas/1.json | def destroy
@contentarea = Contentarea.find(params[:id])
@contentarea.destroy
respond_to do |format|
format.html { redirect_to contentareas_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @question_content_area = QuestionContentArea.find(params[:id])\n @question_content_area.destroy\n\n respond_to do |format|\n format.html { redirect_to question_content_areas_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @core_area.destroy\n respo... | [
"0.7327646",
"0.71997595",
"0.7021301",
"0.7021301",
"0.7021301",
"0.69308525",
"0.6893276",
"0.68679726",
"0.68096644",
"0.67741394",
"0.67741394",
"0.67516667",
"0.6697249",
"0.6693985",
"0.6692189",
"0.66753334",
"0.66482323",
"0.66410965",
"0.66374415",
"0.66193974",
"0.6... | 0.786855 | 0 |
Source: Rex::Socket Converts an integer address into ascii | def addr_itoa(addr, v6=false)
nboa = addr_iton(addr, v6)
addr_ntoa(nboa)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_string(addr)\n \"%d.%d.%d.%d\" % [ (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (0xff&addr) ] \n end",
"def to_source; \"* = $#{@addr.to_s(16)}\"; end",
"def ipv4_to_txt(ipv4)\n IPAddr.new(ipv4, Socket::AF_INET).to_s\nend",
"def eton(addr)\n\t\taddr.split(':').map { |c| c.he... | [
"0.64881986",
"0.61728525",
"0.61047655",
"0.61040694",
"0.60361385",
"0.6026096",
"0.59620535",
"0.5958568",
"0.59266573",
"0.5924318",
"0.57478696",
"0.57301635",
"0.57039243",
"0.57039243",
"0.56707793",
"0.5668208",
"0.56606215",
"0.5645335",
"0.56335104",
"0.56279933",
"... | 0.5518871 | 27 |
Source: Rex::Socket Converts an integer into a network byte order address | def addr_iton(addr, v6=false)
if(addr < 0x100000000 && !v6)
return [addr].pack('N')
else
w = []
w[0] = (addr >> 96) & 0xffffffff
w[1] = (addr >> 64) & 0xffffffff
w[2] = (addr >> 32) & 0xffffffff
w[3] = addr & 0xffffffff
return w.pack('N4')
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def net_unpack_int(net_int)\n net_int.ord - NET_INT_OFFSET\nend",
"def _to_string(addr)\n \"%d.%d.%d.%d\" % [ (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (0xff&addr) ] \n end",
"def net_pack_int(int)\n net_error \"#{__method__}: '#{int}' is too low allowed range #{NET_MIN_INT}-#{NET_M... | [
"0.6731029",
"0.66789913",
"0.6571592",
"0.642643",
"0.62745106",
"0.6169225",
"0.60977787",
"0.6051954",
"0.60223883",
"0.5929707",
"0.59039205",
"0.57742816",
"0.57372266",
"0.57132983",
"0.5707379",
"0.5706876",
"0.5651955",
"0.5634735",
"0.5578813",
"0.5557973",
"0.554696... | 0.56830436 | 16 |
Source: Rex::Socket Converts a network byte order address to ascii | def addr_ntoa(addr)
# IPv4
if (addr.length == 4)
return addr.unpack('C4').join('.')
end
# IPv6
if (addr.length == 16)
return compress_address(addr.unpack('n8').map{ |c| "%x" % c }.join(":"))
end
raise RuntimeError, "Invalid address format"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _to_string(addr)\n \"%d.%d.%d.%d\" % [ (addr >> 24) & 0xff, (addr >> 16) & 0xff, (addr >> 8) & 0xff, (0xff&addr) ] \n end",
"def ipv4_to_txt(ipv4)\n IPAddr.new(ipv4, Socket::AF_INET).to_s\nend",
"def eton(addr)\n\t\taddr.split(':').map { |c| c.hex.chr }.join\n\tend",
"def to_s\r\n return to_s... | [
"0.66709393",
"0.65503466",
"0.6441555",
"0.64280134",
"0.6315121",
"0.6213539",
"0.6163443",
"0.6152091",
"0.6143007",
"0.598979",
"0.5964385",
"0.59339935",
"0.59219193",
"0.5905933",
"0.58973426",
"0.5896549",
"0.58521444",
"0.5841705",
"0.57688",
"0.57311064",
"0.5711901"... | 0.6393206 | 4 |
GET /embed_code_universities GET /embed_code_universities.json | def index
sc = sort_column
@q = EmbedCodeUniversity.ransack(params[:q])
@sort = sc + " "
if params[:page]
cookies[:embed_code_universities_page] = {
value: params[:page],
expires: 1.day.from_now
}
end
@embed_code_universities = @q.result.order(@sort + sort_direction).page(cookies[:embed_code_universities_page]).per_page(10)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_embed_code_university\n\t\t\t@embed_code_university = EmbedCodeUniversity.find(params[:id])\n\t\tend",
"def update\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.update(embed_code_university_params)\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code universi... | [
"0.673952",
"0.6662354",
"0.64158076",
"0.6358287",
"0.61113256",
"0.6107665",
"0.60792327",
"0.59437555",
"0.5830836",
"0.5710108",
"0.56751466",
"0.56129116",
"0.56129116",
"0.5378511",
"0.5372593",
"0.53306085",
"0.5276684",
"0.5215328",
"0.519791",
"0.51868623",
"0.514170... | 0.63774836 | 3 |
GET /embed_code_universities/1 GET /embed_code_universities/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_embed_code_university\n\t\t\t@embed_code_university = EmbedCodeUniversity.find(params[:id])\n\t\tend",
"def uni_years\n @uni_years = UniYear.where(university_id: params[:university_id])\n \n respond_to do |format|\n format.json { render json: @uni_years }\n end\n end",
"def update\n\t\tr... | [
"0.68970525",
"0.677042",
"0.6715693",
"0.63996136",
"0.6324283",
"0.6221291",
"0.6176581",
"0.61195654",
"0.61195654",
"0.6107554",
"0.60654426",
"0.5820541",
"0.5816487",
"0.57700765",
"0.5705703",
"0.5672223",
"0.56413966",
"0.5476639",
"0.54678154",
"0.5456961",
"0.545696... | 0.0 | -1 |
POST /embed_code_universities POST /embed_code_universities.json | def create
@embed_code_university = EmbedCodeUniversity.new(embed_code_university_params)
if params[:contact_id]
contact = params.require(:contact_id)
@embed_code_university.university_contacts << UniversityContact.find(contact)
end
respond_to do |format|
if @embed_code_university.save
format.html { redirect_to embed_code_universities_url, notice: 'Embed Code University was successfully created.' }
format.json { render :show, status: :created, location: @embed_code_university }
else
format.html { render :new }
format.json { render json: @embed_code_university.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n\t\trespond_to do |format|\n\t\t\tif @embed_code_university.update(embed_code_university_params)\n\t\t\t\tformat.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }\n\t\t\t\tformat.json { render :show, status: :ok, location: @embed_code_university... | [
"0.6561654",
"0.6505931",
"0.64317286",
"0.6308491",
"0.60532117",
"0.55457324",
"0.549462",
"0.5350438",
"0.53497",
"0.5296971",
"0.5296971",
"0.5277536",
"0.5271339",
"0.5269633",
"0.52593035",
"0.5210479",
"0.5209481",
"0.5188841",
"0.5183995",
"0.515444",
"0.51502603",
... | 0.68230885 | 0 |
PATCH/PUT /embed_code_universities/1 PATCH/PUT /embed_code_universities/1.json | def update
respond_to do |format|
if @embed_code_university.update(embed_code_university_params)
format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully updated.' }
format.json { render :show, status: :ok, location: @embed_code_university }
else
format.html { render :edit }
format.json { render json: @embed_code_university.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @university.update(university_params)\n format.html { redirect_to @university, notice: 'University was successfully updated.' }\n format.json { respond_with_bip(@university) }\n else\n format.html { render :edit }\n format.json { res... | [
"0.6673092",
"0.63839614",
"0.635037",
"0.635037",
"0.62727827",
"0.6161661",
"0.6011112",
"0.5980833",
"0.59548396",
"0.5923257",
"0.5909905",
"0.5896523",
"0.58769166",
"0.5851674",
"0.58383316",
"0.5838162",
"0.58330756",
"0.5827918",
"0.578646",
"0.571788",
"0.5713672",
... | 0.76467544 | 0 |
DELETE /embed_code_universities/1 DELETE /embed_code_universities/1.json | def destroy
@embed_code_university.destroy
respond_to do |format|
format.html { redirect_to embed_code_universities_url, notice: 'Embed code university was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @university = University.find(params[:id])\n @university.destroy\n\n respond_to do |format|\n format.html { redirect_to universities_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @university = University.find(params[:id])\n @university.destroy\n\... | [
"0.73060924",
"0.73060924",
"0.7090322",
"0.7089909",
"0.68064755",
"0.6706084",
"0.6702609",
"0.66959804",
"0.6657496",
"0.66157734",
"0.66149294",
"0.66105574",
"0.65992403",
"0.65505385",
"0.65489465",
"0.6540941",
"0.65293753",
"0.65212345",
"0.65010345",
"0.6481699",
"0.... | 0.782282 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_embed_code_university
@embed_code_university = EmbedCodeUniversity.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def embed_code_university_params
params.require(:embed_code_university).permit(:acronym, :name, :comments, :test_user, :test_password, :test_site, :embed_code, :status)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Converts a media URL into the path we use in the archive. | def output_archive_path
return if file.url.blank?
file
.url
.sub(/https:\/\/v1\/pageflow/, '/output.scrollytelling.com/v1/main/pageflow')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def site_asset_media_path(src)\n rewrite_asset_path(DmCms::MediaUrlService.call(src))\n end",
"def url_for_media( project, file )\n if (file)\n (file =~ /^(http:\\/\\/|mms:|\\/)/i ? file : url_for_project_directory( project ) + '/' + file )\n end\n end",
"def mediaize_path(path, type)\n ... | [
"0.6789613",
"0.674171",
"0.6672033",
"0.6586478",
"0.6495598",
"0.6435323",
"0.6112988",
"0.6108838",
"0.6000761",
"0.5969164",
"0.5967899",
"0.5960257",
"0.5940833",
"0.59108776",
"0.5887878",
"0.5875718",
"0.5787013",
"0.5782727",
"0.5769249",
"0.57644516",
"0.5755987",
... | 0.58815366 | 15 |
def upload redirect_to :controller=>:photos, :action=>:add end | def signout
#create a signout action at admin_helper
logout
redirect_to :controller=>:home, :action=>:index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n # redirect_to @upload.url\n end",
"def createalbum\n \tredirect_to(\"/photo/createAlbumPage\")\n end",
"def upload\n end",
"def upload\n end",
"def uploading_pictures\n end",
"def file_upload\n redirect_to wip_path()\n # TODO file_upload_wip\n end",
"def create\n\n @photo ... | [
"0.7395256",
"0.7162675",
"0.7085565",
"0.7085565",
"0.7035787",
"0.70299923",
"0.7006515",
"0.6991697",
"0.6979306",
"0.69612074",
"0.6904096",
"0.6846776",
"0.67398024",
"0.67220855",
"0.67166644",
"0.6680996",
"0.665854",
"0.665854",
"0.66242546",
"0.66170746",
"0.65833956... | 0.0 | -1 |
Creates and initialize new instance of the PasswordTokenProvider class. | def initialize(tenant_id, client_id, username, password, settings = ActiveDirectoryServiceSettings.get_azure_settings)
fail ArgumentError, 'Tenant id cannot be nil' if tenant_id.nil?
fail ArgumentError, 'Client id cannot be nil' if client_id.nil?
fail ArgumentError, 'Username cannot be nil' if username.nil?
fail ArgumentError, 'Password cannot be nil' if password.nil?
fail ArgumentError, 'Azure AD settings cannot be nil' if settings.nil?
@tenant_id = tenant_id
@client_id = client_id
@username = username
@password = password
@settings = settings
@expiration_threshold = 5 * 60
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(email, password)\n @email = email\n @password = password\n\n @auth_token = get_auth_token(@email, @password)\n end",
"def initialize(*args)\n if (args.size == 1)\n if args[0].respond_to? :get_authentication_header\n @token_provider = args[0]\n elsif ar... | [
"0.63866836",
"0.6321277",
"0.62741756",
"0.6256599",
"0.61785",
"0.6137156",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.61294466",
"0.6121393",
"0.... | 0.0 | -1 |
Returns the string value which needs to be attached to HTTP request header in order to be authorized. | def get_authentication_header
acquire_token if token_expired
"#{token_type} #{token}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth_header\n # headers: { 'Authorization': 'Bearer <token>' }\n\n request.headers['Authorization']\n # => 'Bearer <token>'\n end",
"def auth_header\n request.headers['Authorization']\n end",
"def auth_header\n\t\t# { Authorization: 'Bearer <token>' }\n\t\trequest.headers['Authori... | [
"0.73940784",
"0.72496825",
"0.7240007",
"0.72114575",
"0.7171801",
"0.71541965",
"0.71541965",
"0.71536463",
"0.713994",
"0.7013966",
"0.6953349",
"0.68860185",
"0.6785362",
"0.67773914",
"0.67727166",
"0.67509466",
"0.67461044",
"0.67419046",
"0.673874",
"0.6724939",
"0.672... | 0.6912637 | 11 |
Checks whether token is about to expire. | def token_expired
@token.nil? || Time.now >= @token_expires_on + expiration_threshold
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_expired?\n @token.nil? || Time.now >= @token_expires_on + expiration_threshold\n end",
"def token_expired?\n return true\n expires_at < Time.now if expires_at?\n end",
"def token_expired?\n self.expires < Time.zone.now.to_i\n end",
"def expired?(token)\n expires_on = token[/... | [
"0.874067",
"0.86791736",
"0.85950947",
"0.8432461",
"0.84150887",
"0.82270116",
"0.819294",
"0.819294",
"0.80725217",
"0.8035453",
"0.800982",
"0.80006504",
"0.79598695",
"0.79140645",
"0.78631717",
"0.78445935",
"0.77996224",
"0.77955",
"0.7775142",
"0.7753583",
"0.77316314... | 0.84368855 | 3 |
Retrieves a new authentication token. | def acquire_token
token_acquire_url = TOKEN_ACQUIRE_URL.dup
token_acquire_url['{authentication_endpoint}'] = @settings.authentication_endpoint
token_acquire_url['{tenant_id}'] = @tenant_id
url = URI.parse(token_acquire_url)
connection = Faraday.new(:url => url, :ssl => MsRest.ssl_options) do |builder|
builder.adapter Faraday.default_adapter
end
request_body = REQUEST_BODY_PATTERN.dup
request_body['{resource_uri}'] = ERB::Util.url_encode(@settings.token_audience)
request_body['{client_id}'] = ERB::Util.url_encode(@client_id)
request_body['{username}'] = ERB::Util.url_encode(@username)
request_body['{password}'] = ERB::Util.url_encode(@password)
response = connection.get do |request|
request.headers['content-type'] = 'application/x-www-form-urlencoded'
request.body = request_body
end
fail AzureOperationError,
'Couldn\'t login to Azure, please verify your tenant id, client id and username/password' unless response.status == 200
response_body = JSON.load(response.body)
@token = response_body['access_token']
@token_expires_on = Time.at(Integer(response_body['expires_on']))
@token_type = response_body['token_type']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end",
"def retrieve_token!\n body = request_token\n # Refresh our token early so that it won't expire while a request is in-flight. We expect 15m\n # expirys for tokens... | [
"0.7683927",
"0.7619788",
"0.76047355",
"0.75763",
"0.74369854",
"0.7382339",
"0.7350459",
"0.7275597",
"0.72349674",
"0.72190064",
"0.71881485",
"0.7183764",
"0.71789634",
"0.7165854",
"0.71385753",
"0.7096329",
"0.70874447",
"0.7077667",
"0.7067089",
"0.7038234",
"0.703018"... | 0.653737 | 81 |
Input: A string representing an English sentence Returns: The number of words in the sentence Prints: Nothing Although it's more complicated in relaity, we'll just pretend that sequence of spaces in a sentence designates the start of a new word. That means we don't care about how many spaces are between two words, only that there is at least one. | def word_count(string)
string_arr = string.split
string_arr.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def word_counter(string)\n\n if string.empty? #== 0, suggested by Rubocop\n i_num_words = 0\n else\n new_string = string\n new_string = new_string.delete \" \"\n i_num_words = string.length - new_string.length + 1\n end\n return i_num_words\nend",
"def word_counter(sentence)\n return sentence.sp... | [
"0.771766",
"0.76777244",
"0.75262284",
"0.7519263",
"0.75020605",
"0.73679334",
"0.7362968",
"0.73273224",
"0.72712827",
"0.7255368",
"0.71889406",
"0.7169248",
"0.71028066",
"0.70956016",
"0.70829356",
"0.7042309",
"0.7015173",
"0.7008757",
"0.69860464",
"0.69749874",
"0.69... | 0.6886883 | 24 |
Skip sessions and cookies for Rails API | def skip_session
request.session_options[:skip] = true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def do_not_set_cookie\n request.session_options[:skip] = true\n end",
"def skip_session\n request.session_options[:skip] = true if token\n end",
"def... | [
"0.7849452",
"0.7849452",
"0.7849452",
"0.7492377",
"0.7373368",
"0.7373368",
"0.7259103",
"0.71976125",
"0.7060268",
"0.70004874",
"0.6884276",
"0.68694776",
"0.68454075",
"0.67755544",
"0.6774599",
"0.66376334",
"0.66369456",
"0.6581109",
"0.6531287",
"0.6512128",
"0.648658... | 0.7619142 | 4 |
Asks the user to select a player to get a card from and a rank to ask for calls add_and_reaveal and returns true if the player gets the card and calls | def try_getting_cards_from_player(selected_rank)
selected_player = select_other_player
selected_player_id = game.get_player_index(selected_player)
if game.players[selected_player_id].has_card_with_rank?(selected_rank)
add_and_reveal(game.players[selected_player_id].remove_cards_with_rank(selected_rank), selected_player.name)
return true
end
return false
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ask_for_cards_until_go_fish_and_get_last_requested_rank\n while true\n selected_rank = player.select_rank\n if !try_getting_cards_from_player(selected_rank)\n return selected_rank\n end\n end\n end",
"def choose_and_add_card_to_user_deck\n prompt = TTY::Prompt.new\n card = ... | [
"0.7087192",
"0.68060803",
"0.6471887",
"0.6410753",
"0.63691777",
"0.6340101",
"0.63045573",
"0.627193",
"0.624135",
"0.6214965",
"0.6193872",
"0.61796653",
"0.6175372",
"0.61695784",
"0.6155624",
"0.61397594",
"0.61391777",
"0.6135714",
"0.6131522",
"0.6106471",
"0.60844505... | 0.7425027 | 0 |
Lets the user ask for cards unitl they don't get a card with the rank they ask for. Returns the last requested rank. | def ask_for_cards_until_go_fish_and_get_last_requested_rank
while true
selected_rank = player.select_rank
if !try_getting_cards_from_player(selected_rank)
return selected_rank
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rank_of_card_at (num)\n cards.fetch(num, \"Index #{num} is out of bounds.\")\n end",
"def rank\n RANKS.detect { |method, rank| send :\"#{method}?\" } || [:high_card, 0]\n end",
"def rank(response)\n rank = response.to_i\n if rank >= 1 && rank <= 5\n @current_listen.rank = rank\n else\... | [
"0.6651997",
"0.6469888",
"0.63968843",
"0.63383466",
"0.6257167",
"0.6227293",
"0.6101071",
"0.6099209",
"0.602198",
"0.6011953",
"0.5976888",
"0.59071684",
"0.5869691",
"0.5789175",
"0.5785682",
"0.572977",
"0.5724424",
"0.5667923",
"0.5659634",
"0.56245595",
"0.5622125",
... | 0.78995335 | 0 |
Adds a card to the player's hand. Announces it to other players, but doesn't show what card got added | def add_card_without_revealing_details(card)
player.add_card_to_hand(card)
message = "#{player.name} drew a card from the center."
game.players.each {|player| player.send_message_to_user(message)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_card(card)\n @addhand = @addhand + card\n end",
"def addCardToHand(card)\n @hand << card\n end",
"def add(card)\n\t\t@hand_contents.push(card)\n\tend",
"def addCard(card)\n \tif @can_get_cards\n \t @cards.push(card)\n else\n raise ArgumentError, \"Cards cannot be added to thi... | [
"0.8352869",
"0.81945187",
"0.81460637",
"0.8036714",
"0.8004742",
"0.7983781",
"0.7936867",
"0.7925681",
"0.7921334",
"0.7882519",
"0.7870291",
"0.78693336",
"0.78693336",
"0.7858476",
"0.7805674",
"0.77728564",
"0.77636373",
"0.7740002",
"0.7717491",
"0.766325",
"0.76440233... | 0.8249915 | 1 |
Adds cards to a player's hand and then Sends a message to all of the game's players revealing what cards the player took and where they got it from. TODO: make it so that the cards the player already has don't get mentioned | def add_and_reveal(cards, source="the deck")
player.add_card_to_hand(cards)
message = ""
if source.is_a?(Player) then display_source = source.name else display_source = source end
if cards.is_a?(Array) then cards.each {|card| message += "#{player.name} took #{card.description} from #{display_source}\n"} end
if !cards.is_a?(Array) then message = "#{player.name} took #{cards.description} from #{display_source}\n" end
game.players.each {|player| player.send_message_to_user(message)}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addCardsToHand(cards)\n @hand.concat(cards)\n end",
"def add_card_without_revealing_details(card)\n player.add_card_to_hand(card)\n message = \"#{player.name} drew a card from the center.\"\n game.players.each {|player| player.send_message_to_user(message)}\n end",
"def give_card_to_pla... | [
"0.7685799",
"0.735753",
"0.7192807",
"0.7178604",
"0.7168574",
"0.7115666",
"0.71085477",
"0.7090862",
"0.70635945",
"0.70139927",
"0.698107",
"0.6974285",
"0.69685185",
"0.69032645",
"0.6887878",
"0.6868682",
"0.68554443",
"0.68184406",
"0.6793746",
"0.6765969",
"0.6756906"... | 0.7330753 | 2 |
TODO: Crunch this down into 7 or fewer lines. I'm not gonna be able to get anywhere with this if I don't (temporarily) ignore this constraint | def take_turn
turn_over = false
until turn_over
last_rank = ask_for_cards_until_go_fish_and_get_last_requested_rank
end
player.lay_down_books
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def constraints; end",
"def constraints; end",
"def constraints; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def requirements; end",
"def required_positionals; end",
"def constraints\n super\n end",
"def requirements=(_arg0); end... | [
"0.63064045",
"0.5937013",
"0.5937013",
"0.5937013",
"0.5884657",
"0.5884657",
"0.5884657",
"0.5884657",
"0.5805864",
"0.557381",
"0.5553668",
"0.5553668",
"0.5485663",
"0.5364799",
"0.5356446",
"0.5356446",
"0.5356446",
"0.5354914",
"0.532599",
"0.52851963",
"0.5280748",
"... | 0.0 | -1 |
GET /alco_drinks GET /alco_drinks.json | def index
@alco_drinks = AlcoDrink.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def drinks\n top_drinks = Drink.top.limit(5)\n exclude_drink_ids = top_drinks.map(&:id)\n top_gin_drinks = Drink.top(Ingredient.gin_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_gin_drinks.map(&:id)\n top_vodka_drinks = Drink.top(Ingredient.vodka_canonical_id, exclude_drink_id... | [
"0.6568109",
"0.61779475",
"0.6090409",
"0.6040155",
"0.6032922",
"0.598778",
"0.59847236",
"0.5946186",
"0.59275955",
"0.592282",
"0.5868661",
"0.58345133",
"0.5808626",
"0.5778309",
"0.5769778",
"0.5703969",
"0.5690444",
"0.5667428",
"0.56601036",
"0.563854",
"0.559185",
... | 0.71127003 | 0 |
GET /alco_drinks/1 GET /alco_drinks/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @alco_drinks = AlcoDrink.all\n end",
"def drinks\n top_drinks = Drink.top.limit(5)\n exclude_drink_ids = top_drinks.map(&:id)\n top_gin_drinks = Drink.top(Ingredient.gin_canonical_id, exclude_drink_ids).limit(5)\n exclude_drink_ids += top_gin_drinks.map(&:id)\n top_vodka_drinks = D... | [
"0.69772196",
"0.62497663",
"0.62323505",
"0.6049066",
"0.60304797",
"0.59980154",
"0.59854996",
"0.59559375",
"0.59455854",
"0.5937912",
"0.58724207",
"0.581022",
"0.5790072",
"0.5777065",
"0.57551706",
"0.5707048",
"0.5678435",
"0.5674689",
"0.56560504",
"0.5651242",
"0.565... | 0.0 | -1 |
POST /alco_drinks POST /alco_drinks.json | def create
@alco_drink = AlcoDrink.new(alco_drink_params)
respond_to do |format|
if @alco_drink.save
format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully created.' }
format.json { render :show, status: :created, location: @alco_drink }
else
format.html { render :new }
format.json { render json: @alco_drink.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def alco_drink_params\n params.require(:alco_drink).permit(:title, :price, :type, :size, :url, :alko_id)\n end",
"def create\n @order = Order.new(order_params)\n @drink = Drink.where(drink: @order.drink).first\n if @drink.nil?\n respond_to do |format|\n format.json { render json: {},... | [
"0.6683482",
"0.61139476",
"0.609797",
"0.60717994",
"0.59599084",
"0.595412",
"0.58226043",
"0.57504964",
"0.5657172",
"0.5572373",
"0.5543805",
"0.5514553",
"0.54904985",
"0.54771066",
"0.5451169",
"0.538125",
"0.53686506",
"0.53679967",
"0.53570217",
"0.534887",
"0.534887"... | 0.7058279 | 0 |
PATCH/PUT /alco_drinks/1 PATCH/PUT /alco_drinks/1.json | def update
respond_to do |format|
if @alco_drink.update(alco_drink_params)
format.html { redirect_to @alco_drink, notice: 'Alco drink was successfully updated.' }
format.json { render :show, status: :ok, location: @alco_drink }
else
format.html { render :edit }
format.json { render json: @alco_drink.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @bubble_tea = BubbleTea.find(params[:id])\n\n if @bubble_tea.update(bubble_tea_params)\n render json: @bubble_tea\n else\n render plain: \"Failed to update drink information\"\n end\n end",
"def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n en... | [
"0.6167763",
"0.6046127",
"0.6044238",
"0.5989092",
"0.5945421",
"0.5919465",
"0.59105194",
"0.59084517",
"0.5903114",
"0.590088",
"0.5900537",
"0.5887939",
"0.5875218",
"0.5873801",
"0.5873735",
"0.5869736",
"0.58584195",
"0.58469945",
"0.58451927",
"0.5841187",
"0.58302134"... | 0.6719919 | 0 |
DELETE /alco_drinks/1 DELETE /alco_drinks/1.json | def destroy
@alco_drink.destroy
respond_to do |format|
format.html { redirect_to alco_drinks_url, notice: 'Alco drink was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n client.delete(\"/#{id}\")\n end",
"def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend",
"def delete\n client.delete(url)\n @deleted = true\nend",
"def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]... | [
"0.6863395",
"0.673317",
"0.6686762",
"0.6623346",
"0.6570386",
"0.654684",
"0.64999276",
"0.6485959",
"0.6480546",
"0.64771634",
"0.6456781",
"0.6456781",
"0.6456781",
"0.6456781",
"0.64176786",
"0.6416048",
"0.6409534",
"0.6387968",
"0.6387438",
"0.63845104",
"0.63646704",
... | 0.7240925 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_alco_drink
@alco_drink = AlcoDrink.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def alco_drink_params
params.require(:alco_drink).permit(:title, :price, :type, :size, :url, :alko_id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
process login. Verify first that there is a valid username/password and then make sure they are verified to login | def create
user = User.authenticate(params[:username], params[:password])
# valid account
if user && user.enabled?
self.current_user = user
remember_user if params[:remember_me] == "1"
flash[:notice] = "Signed in successfully"
redirect_back_or_default user_url(current_user)
# disabled user
elsif user && !user.enabled
flash.now[:error] = "Your account has been disabled."
render :action => "new"
# invalid username/pass
else
flash.now[:error] = "Username/Password was not found. If you have forgot your " +
"password click <a href=\"#{url_for new_lost_password_path}\">here</a>"
render :action => "new"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def login\n get_session_variables_from_authenticated_system\n\n return unless request.post?\n attempt_to_login_user\n\n if logged_in? && authorized?(current_user)\n create_secret_image_code\n set_session_variables_for_authenticated_system\n log_the_login\n redirect_with_proper_proto... | [
"0.71599764",
"0.714724",
"0.7143159",
"0.71002084",
"0.7098028",
"0.7046727",
"0.70304793",
"0.7005024",
"0.6962061",
"0.69345033",
"0.6920701",
"0.6877429",
"0.6856997",
"0.6802768",
"0.6801807",
"0.6795428",
"0.67886174",
"0.67263955",
"0.67167115",
"0.66437",
"0.6635576",... | 0.0 | -1 |
def pick_deck puts "Welcome! Please choose a deck (hogwarts or turing):" selection = gets.chomp if selection == "hogwarts" cards = CardGenerator.new('./hogwarts.txt') else selection == "turing" cards = CardGenerator.new('./cards.txt') end end | def start
"You're playing with #{deck.count} cards."
puts ("-"*60).cyan
deck.cards.each do |card|
puts "This is card number #{current + 1} out of #{deck.count}."
puts "Question: #{current_card.question}"
response = gets.chomp
record_guess(response)
puts "#{guesses.last.feedback}"
next_card
end
puts "****** Game over! ******"
puts "You had #{number_correct} correct answers out of #{deck.count} for a score of #{percent_correct}%"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choose_game\n puts \"Please choose from the following options:\"\n puts \"1) Roulette\"\n puts \"2) Casino War\"\n puts \"3) Blackjack\"\n puts \"4) $1 Slots\"\n puts \"5) Show wallet balance\"\n puts \"6) Cash out and leave\"\n answer = gets.strip.to_i\n case answer\n when 1\n ... | [
"0.7129752",
"0.69999975",
"0.69863254",
"0.694839",
"0.69452405",
"0.6863914",
"0.68625003",
"0.6838367",
"0.6838367",
"0.6832311",
"0.68286526",
"0.67793876",
"0.6776368",
"0.67302",
"0.6729739",
"0.67249095",
"0.6710728",
"0.6683755",
"0.6672884",
"0.6648815",
"0.6638053",... | 0.0 | -1 |
TODO count method definitions argumets too | def check_third_rule
total_method_calls = @data[:method_calls].size
proper_method_calls = @data[:method_calls].inject(0) do |sum, method_call|
sum += 1 unless method_call.number_of_arguments > 4
sum
end
@output[:third_rule] ||= {}
@output[:third_rule][:proper_method_calls] = proper_method_calls
@output[:third_rule][:total_method_calls] = total_method_calls
log_third_rule if @store_details
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def methods=(_arg0); end",
"def methods() end",
"def method_signature\n case @opcode.arguments.size\n when 0\n @file.puts \" def #{method_name}\"\n when 1\n @file.puts \" def #{method_name}(arg1)\"\n when 2\n @file.puts \" def #{method_name}(arg1, arg2)\"... | [
"0.72092044",
"0.70376766",
"0.6936947",
"0.68668497",
"0.68668497",
"0.6864879",
"0.6808671",
"0.6784053",
"0.6782423",
"0.6782423",
"0.6782423",
"0.6782381",
"0.67594534",
"0.67594534",
"0.6732685",
"0.6705517",
"0.6663869",
"0.66578764",
"0.66578764",
"0.66195595",
"0.6619... | 0.0 | -1 |
Con un objeto de tipo MenuUsuarioTipo, arma el item del menu | def mostrar_item(menu)
# Si el item tiene url, controlador o accion, arma link, sino solo label
if (menu.controller != '') or (menu.action != '') or (menu.url != '')
if menu.url != ''
link_to menu.nombre, menu.url
else
link_to menu.nombre, :controller => menu.controller, :action => menu.action
end
else
menu.nombre
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cargar_menu\n\t\tif session[:usuario]\n\t\t\t@opciones = Menu.find(:all, :order => 'padre, orden')\n\t\telse\n\t\t\t@opciones = []\n\t\tend\n\tend",
"def set_menu_item\n @menu_item = Menu::Item.find(params[:id])\n end",
"def getMenu(menu)\n end",
"def get_minimenu_item(minimenu, selection_type... | [
"0.6422874",
"0.62731093",
"0.62680507",
"0.6233922",
"0.6194415",
"0.61502635",
"0.61484414",
"0.61484414",
"0.61484414",
"0.60961294",
"0.608925",
"0.60805655",
"0.60748905",
"0.6038914",
"0.6038914",
"0.59662557",
"0.5921124",
"0.58893704",
"0.5887467",
"0.58720475",
"0.58... | 0.67245966 | 0 |
Fin mostrar_item_img Carga el menu dinamico de la aplicacion | def cargar_menu
if session[:usuario]
@opciones = Menu.find(:all, :order => 'padre, orden')
else
@opciones = []
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate_menu\n @items = []\n @x = @window.width / 3 + Const::FONT_SMALL_SIZE\n @y = @title_image.height * @img_size_factor + Const::GAME_WIN_GAP\n n_g = proc { @window.state = GameState.new(@window, @window.width / 3, 40) }\n cr_n = proc { @window.state = NetSetupState.new(@window) }\... | [
"0.68325734",
"0.66248494",
"0.63863933",
"0.63546157",
"0.6354337",
"0.6333094",
"0.62882394",
"0.62853163",
"0.6246288",
"0.6245095",
"0.623541",
"0.62309605",
"0.6198754",
"0.6187651",
"0.6164516",
"0.61503696",
"0.6142076",
"0.61310977",
"0.6129728",
"0.60896933",
"0.6061... | 0.6576866 | 2 |
Determins whether to get or set the configurations based on the input from the terminal | def execute(output: $stdout)
options.each do |key, val|
if val == key.to_s
output.puts RubyEdit.config.send(key)
else
RubyEdit.config.send("#{key}=", val)
output.puts "#{key.to_s.titleize} changed to #{val}"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def configure debug = false\n config = self.get_config\n puts 'What is the ip address of your wifi link? (currently \"' + self.get_config['host'].to_s + '\").'\n puts 'Enter a blank line to broadcast UDP commands (ok to just hit enter here).'\n host = STDIN.gets.chomp\n config['host'] = host if ! ho... | [
"0.6098473",
"0.6012483",
"0.59476423",
"0.59117895",
"0.5889961",
"0.58546525",
"0.58473957",
"0.57850724",
"0.5781561",
"0.57522076",
"0.5713059",
"0.5698034",
"0.56776327",
"0.5673832",
"0.56704026",
"0.5669409",
"0.5668026",
"0.56642157",
"0.56600404",
"0.5659764",
"0.565... | 0.5616686 | 24 |
Sanitizes the options hash to ensure only permitted values are processed | def options
@options = @options.select { |key, _val| CONFIGURATIONS.include?(key.to_sym) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_field_options(options={})\n options.stringify_keys.reject {|k, v| %w(vertical_align label edit req lock auto popup url position help).include?(k)}.symbolize_keys\n end",
"def sanitize_form_field_options(options={})\n options.symbolize_keys.reject {|k,v| [:disabled, :object, :help, :ed... | [
"0.78548044",
"0.7753926",
"0.768359",
"0.7629228",
"0.72975016",
"0.72790176",
"0.7191049",
"0.70391643",
"0.68849045",
"0.6758552",
"0.66946524",
"0.6687674",
"0.66675574",
"0.65549",
"0.65420026",
"0.65219057",
"0.64952636",
"0.6464923",
"0.64500093",
"0.64375514",
"0.6436... | 0.0 | -1 |
Since we do some custom things related to the Rails asset path, make sure everything is hooked up and the production cachebused assets are served up. | def test_login_assets
visit "/admin/login"
assert_text("Admin Sign In")
# Find the stylesheet on the Rails login page, which should have a
# cache-busted URL (note that the href on the page appears to be relative,
# but capybara seems to read it as absolute. That's fine, but noting it in
# case Capybara's future behavior changes).
stylesheet = find("link[rel=stylesheet]", :visible => :hidden)
assert_match(%r{\Ahttps://127\.0\.0\.1:9081/web-assets/admin/login-\w{64}\.css\z}, stylesheet[:href])
# Verify that the asset URL can be fetched and returns data.
response = Typhoeus.get(stylesheet[:href], keyless_http_options)
assert_response_code(200, response)
assert_equal("text/css", response.headers["content-type"])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def request_debug_assets?; end",
"def request_debug_assets?; end",
"def serve_assets\n if @serve_assets.nil?\n ENV['RACK_ENV'] == 'production' ? (@serve_assets = 'remote') : (@serve_assets = 'local_dynamic')\n end\n @serve_assets\n end",
"def production_opening\n @images_path = \"... | [
"0.687086",
"0.687086",
"0.66199887",
"0.6611236",
"0.6599043",
"0.6400139",
"0.6364572",
"0.6349223",
"0.6336473",
"0.633394",
"0.6312612",
"0.6312612",
"0.6312612",
"0.6245347",
"0.6245347",
"0.62412655",
"0.62412655",
"0.62277174",
"0.6225772",
"0.62251836",
"0.62160224",
... | 0.0 | -1 |
any character existing in remove must be deleted from str. eg "Battle of the Vowels: Hawaii vs. Grozny" and remove "aeiou" => "Bttl f th Vwls: Hw vs. Grzny" Ruby | def remove_str(str, remove)
original = str.split(//)
deleted = remove.split(//)
deleted.each {|char| original.delete(char)}
return original.join
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_vowels str\n str.delete \"aeiouAEIOU\"\nend",
"def disemvowel(str)\n str = str.delete 'AEIOUaeiou'\nend",
"def disemvowel(str)\n str.delete(\"aAeEiIoOuU\")\nend",
"def remove(str, char)\n output = \"\"\n i = 0\n while i < str.length\n if str[i] != char\n output ... | [
"0.73357683",
"0.71370786",
"0.7132476",
"0.7121308",
"0.71005595",
"0.7092973",
"0.7079901",
"0.70628387",
"0.7058515",
"0.70107335",
"0.70107335",
"0.7001405",
"0.69934356",
"0.69853026",
"0.6936308",
"0.6925361",
"0.6925285",
"0.69170123",
"0.6890742",
"0.68784535",
"0.686... | 0.7808549 | 0 |
GET /early_pregnancies/1 GET /early_pregnancies/1.json | def show
@early_pregnancy = EarlyPregnancy.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @early_pregnancy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end",
"def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early... | [
"0.6607259",
"0.5896155",
"0.5757807",
"0.5686196",
"0.5648688",
"0.5601559",
"0.5581479",
"0.5526163",
"0.55183405",
"0.54334307",
"0.5431434",
"0.53846765",
"0.53814524",
"0.5350196",
"0.5338833",
"0.5335959",
"0.53309476",
"0.53258055",
"0.52821755",
"0.5280087",
"0.527724... | 0.7305416 | 0 |
GET /early_pregnancies/new GET /early_pregnancies/new.json | def new
@early_pregnancy = EarlyPregnancy.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @early_pregnancy }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :cre... | [
"0.71642154",
"0.6592127",
"0.658093",
"0.6579997",
"0.6573371",
"0.65501714",
"0.64037865",
"0.63793546",
"0.63466704",
"0.63428956",
"0.63062537",
"0.63062537",
"0.6297843",
"0.62836426",
"0.62761027",
"0.6255826",
"0.62323004",
"0.6222083",
"0.62170804",
"0.62131166",
"0.6... | 0.7544288 | 0 |
POST /early_pregnancies POST /early_pregnancies.json | def create
@early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])
respond_to do |format|
if @early_pregnancy.save
format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }
format.json { render json: @early_pregnancy, status: :created, location: @early_pregnancy }
else
format.html { render action: "new" }
format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @early_pregnancy = EarlyPregnancy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @early_pregnancy }\n end\n end",
"def show\n @early_pregnancy = EarlyPregnancy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html... | [
"0.64132714",
"0.5656938",
"0.5608786",
"0.5480234",
"0.5391715",
"0.5363662",
"0.52588636",
"0.52548546",
"0.52204686",
"0.521578",
"0.5165906",
"0.511465",
"0.511465",
"0.509548",
"0.5047906",
"0.50300527",
"0.49915105",
"0.4983485",
"0.49808344",
"0.49736133",
"0.49634275"... | 0.71314317 | 0 |
PUT /early_pregnancies/1 PUT /early_pregnancies/1.json | def update
@early_pregnancy = EarlyPregnancy.find(params[:id])
respond_to do |format|
if @early_pregnancy.update_attributes(params[:early_pregnancy])
format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @early_pregnancy.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @early_pregnancy = EarlyPregnancy.new(params[:early_pregnancy])\n\n respond_to do |format|\n if @early_pregnancy.save\n format.html { redirect_to @early_pregnancy, notice: 'Early pregnancy was successfully created.' }\n format.json { render json: @early_pregnancy, status: :cre... | [
"0.6239597",
"0.5926131",
"0.5761822",
"0.5761411",
"0.57360405",
"0.56143844",
"0.555663",
"0.555663",
"0.55200493",
"0.54148245",
"0.5318787",
"0.5304119",
"0.51861477",
"0.51332426",
"0.5127757",
"0.51260257",
"0.5119609",
"0.50711143",
"0.5069658",
"0.5047927",
"0.5038554... | 0.706012 | 0 |
DELETE /early_pregnancies/1 DELETE /early_pregnancies/1.json | def destroy
@early_pregnancy = EarlyPregnancy.find(params[:id])
@early_pregnancy.destroy
respond_to do |format|
format.html { redirect_to early_pregnancies_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to pregnancies_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @pregnancy.destroy\n respond_to do |format|\n format.html { redirect_to rabbit_pregnancies_path(@rabbit), notice: ... | [
"0.70484656",
"0.67547834",
"0.6423742",
"0.63645214",
"0.6359939",
"0.6349028",
"0.6336078",
"0.6322436",
"0.6320436",
"0.6317159",
"0.6317159",
"0.63131094",
"0.63129115",
"0.6296011",
"0.6293658",
"0.6290253",
"0.6281394",
"0.62769383",
"0.6272711",
"0.6268596",
"0.6263143... | 0.7691479 | 0 |
The main view. This method builds the layout and returns the root view. | def view
unless is_parent_layout?
return parent_layout.view
end
@view ||= build_view
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n ... | [
"0.696131",
"0.6337119",
"0.6249508",
"0.60417897",
"0.60375375",
"0.6011281",
"0.600083",
"0.5982055",
"0.59603757",
"0.592674",
"0.5913294",
"0.58889717",
"0.58214444",
"0.5812093",
"0.57851976",
"0.57821167",
"0.57670414",
"0.57340527",
"0.5695982",
"0.5666105",
"0.5666105... | 0.71861297 | 0 |
Builds the layout and then returns self for chaining. | def build
view
self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout()\n layout_children()\n end",
"def build_layout\n year = Time.now.year\n add_call('Notification des abonnements électroniques', ->() { notifier })\n add_call(\"Extension des abonnements gratuits et d'échange de l'année #{year - 1}\", ->() { freesubs(year - 1) })\n ... | [
"0.69526476",
"0.660945",
"0.6481694",
"0.64088756",
"0.6383713",
"0.6274258",
"0.60869324",
"0.60573065",
"0.6044166",
"0.60239685",
"0.59837157",
"0.59619546",
"0.5908237",
"0.5904881",
"0.588625",
"0.5877895",
"0.5850595",
"0.574518",
"0.57274187",
"0.5700992",
"0.5671084"... | 0.5627197 | 25 |
Checks if the layout has been built yet or not. | def built?
!@view.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def place_in_layout?\n !(asset_file? || yaml_file? || no_layout?)\n end",
"def layout_available?\n if !@_layout_available\n @_layout_available = @site.layouts.include? @layout\n end\n @_layout_available\n end",
"def place_in_layout?\n !(asset_file? || no_layout?)\n end"... | [
"0.6809192",
"0.67895335",
"0.6743891",
"0.65651697",
"0.65258586",
"0.6502042",
"0.6496876",
"0.6496876",
"0.6353048",
"0.6342761",
"0.6309128",
"0.6240439",
"0.61594933",
"0.6091123",
"0.6071223",
"0.5975046",
"0.5949774",
"0.59473664",
"0.589373",
"0.5857565",
"0.5817412",... | 0.734391 | 0 |
just in case Assign a view to act as the 'root' view for this layout. This method can only be called once, and must be called before `add` is called for the first time (otherwise `add` will create a default root view). This method must be called from inside `layout`, otherwise you should just use `create`. You can also call this method with just an element_id, and the default root view will be created. | def root(element, element_id=nil, &block)
if @view
raise ContextConflictError.new("Already created the root view")
end
unless @assign_root
raise InvalidRootError.new("You should only create a 'root' view from inside the 'layout' method (use 'create' elsewhere)")
end
@assign_root = false
# this method can be called with just a symbol, to assign the root element_id
if element.is_a?(Symbol)
element_id = element
# See note below about why we don't need to `apply(:default_root)`
element = preset_root || default_root
elsif preset_root && preset_root != element
# You're trying to make two roots, one at initialization
# and one in your layout itself.
raise ContextConflictError.new("Already created the root view")
end
@view = initialize_element(element, element_id)
if block
if @context
raise ContextConflictError.new("Already in a context")
end
end
style_and_context(@view, element_id, &block)
return @view
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize_element(elem, element_id)\n if elem.is_a?(Class) && elem < TreeLayout\n layout = elem.new\n elem = layout.view\n elsif elem.is_a?(Class)\n elem = elem.new\n elsif elem.is_a?(TreeLayout)\n layout = elem\n elem = elem.view\n end\n\n if layout... | [
"0.67284423",
"0.5926831",
"0.59161115",
"0.5851478",
"0.5749565",
"0.56178254",
"0.556424",
"0.5561739",
"0.5547552",
"0.55419034",
"0.5516469",
"0.5512008",
"0.5414251",
"0.5414251",
"0.5381627",
"0.53578526",
"0.5327044",
"0.5322114",
"0.53206384",
"0.53086996",
"0.5288341... | 0.8038992 | 0 |
instantiates a view, possibly running a 'layout block' to add child views. | def create(element, element_id=nil, &block)
element = initialize_element(element, element_id)
style_and_context(element, element_id, &block)
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n ... | [
"0.6988359",
"0.66227734",
"0.6380642",
"0.6377121",
"0.6356555",
"0.6349092",
"0.6332554",
"0.62679535",
"0.6258892",
"0.62292624",
"0.62101126",
"0.61396545",
"0.60869783",
"0.6079702",
"0.6079131",
"0.6071809",
"0.6048129",
"0.5914804",
"0.5883417",
"0.5796154",
"0.5788072... | 0.0 | -1 |
Calls the style method of all objects in the view hierarchy that are part of this layout. The views in a child layout are not styled, but those layouts will receive a `reapply!` message if no root is specified. | def reapply!
root ||= self.view
@layout_state = :reapply
run_reapply_blocks
@child_layouts.each do |child_layout|
child_layout.reapply!
end
@layout_state = :initial
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def layout()\n layout_children()\n end",
"def style_and_context(element, element_id, &block)\n style_method = \"#{element_id}_style\"\n if parent_layout.respond_to?(style_method) || block_given?\n parent_layout.context(element) do\n if parent_layout.respond_to?(style_method)... | [
"0.5456927",
"0.53594893",
"0.5162902",
"0.5130848",
"0.51273304",
"0.50704503",
"0.48461854",
"0.48304355",
"0.47790796",
"0.47399643",
"0.46746725",
"0.46544686",
"0.46487",
"0.4647446",
"0.46388987",
"0.46213907",
"0.46047938",
"0.45974174",
"0.45681214",
"0.45681214",
"0.... | 0.715275 | 0 |
Only intended for private use | def reapply_blocks
@reapply_blocks ||= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def internal; end",
"def operations; end",
"def operations; end",
"def i... | [
"0.8149973",
"0.65438765",
"0.6523563",
"0.6523563",
"0.6523563",
"0.6523563",
"0.6341037",
"0.633144",
"0.6293213",
"0.6293213",
"0.62403715",
"0.6002386",
"0.6002386",
"0.59773976",
"0.5959009",
"0.59439325",
"0.59439325",
"0.59438956",
"0.5903242",
"0.5895697",
"0.5895286"... | 0.0 | -1 |
Blocks passed to `reapply` are only run when `reapply!` is called. | def reapply(&block)
raise ArgumentError.new('Block required') unless block
raise InvalidDeferredError.new('reapply must be run inside of a context') unless @context
if reapply?
yield
end
block = block.weak!
parent_layout.reapply_blocks << [@context, block]
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_reapply_blocks\n self.reapply_blocks.each do |target, block|\n context(target, &block)\n end\n end",
"def reapply_blocks\n @reapply_blocks ||= []\n end",
"def redo\n\t\tself.apply()\n\tend",
"def callBlock\n yield # Invokes block\n yield # Invokes block again\nend",
"d... | [
"0.7709384",
"0.7429321",
"0.5699448",
"0.56518894",
"0.5637443",
"0.56230223",
"0.5604898",
"0.5546339",
"0.5502816",
"0.5502708",
"0.5376504",
"0.5376504",
"0.5376504",
"0.53520954",
"0.5328649",
"0.5309528",
"0.53007543",
"0.52737707",
"0.5272016",
"0.5252527",
"0.5242242"... | 0.68201435 | 2 |
Only intended for private use | def run_reapply_blocks
self.reapply_blocks.each do |target, block|
context(target, &block)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def refutal()\n end",
"def schubert; end",
"def implementation; end",
"def implementation; end",
"def internal; end",
"def operations; end",
"def operations; end",
"def i... | [
"0.8149973",
"0.65438765",
"0.6523563",
"0.6523563",
"0.6523563",
"0.6523563",
"0.6341037",
"0.633144",
"0.6293213",
"0.6293213",
"0.62403715",
"0.6002386",
"0.6002386",
"0.59773976",
"0.5959009",
"0.59439325",
"0.59439325",
"0.59438956",
"0.5903242",
"0.5895697",
"0.5895286"... | 0.0 | -1 |
Instantiates a view via `create` and adds the view to the current target. If there is no context, a default root view can be created if that has been enabled (e.g. within the `layout` method). The block is run in the context of the new view. | def add(element, element_id=nil, options={}, &block)
# make sure we have a target - raises NoContextError if none exists
self.target
unless @context
create_default_root_context
end
# We want to be sure that the element has a supeview or superlayer before
# the style method is called.
element = initialize_element(element, element_id)
self.apply(:add_child, element, options)
style_and_context(element, element_id, &block)
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_view\n # Only in the 'layout' method will we allow default container to be\n # created automatically (when 'add' is called)\n @assign_root = true\n prev_should_run = @should_run_deferred\n @should_run_deferred = true\n layout\n unless @view\n if @assign_root\n ... | [
"0.6718354",
"0.6218812",
"0.5994188",
"0.59564203",
"0.589082",
"0.584812",
"0.56957126",
"0.56379354",
"0.56353474",
"0.55646044",
"0.5507839",
"0.54971176",
"0.5475263",
"0.5443148",
"0.5407258",
"0.5381738",
"0.5373539",
"0.5352424",
"0.53271246",
"0.5266663",
"0.5238476"... | 0.49613997 | 38 |
Retrieves a view by its element id. This will return the first view with this element_id in the tree, where first means the first object that was added with that name. | def get(element_id)
unless is_parent_layout?
return parent_layout.get(element_id)
end
@elements[element_id] && @elements[element_id].first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end",
"def get_view_for_viewid(view_id)\n\tp view_id\n\thttp = create_http\n\trequest = create_request(\"/rest/greenhopper/1.0/rapidviews/list\")\n\tresponse = ... | [
"0.73772925",
"0.6744815",
"0.6630552",
"0.64079195",
"0.6389456",
"0.62126046",
"0.62126046",
"0.61491805",
"0.6118278",
"0.6085293",
"0.58730686",
"0.57459897",
"0.559827",
"0.55873704",
"0.55843574",
"0.5556955",
"0.5551289",
"0.5523504",
"0.55211735",
"0.5516315",
"0.5484... | 0.63835335 | 5 |
Just like `get`, but if `get` returns a Layout, this method returns the layout's view. | def get_view(element_id)
element = get(element_id)
if element.is_a?(Layout)
element = element.view
end
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def find\n self.class.find(@view.layout)\n end",
"def layout\n lookup_layout\n end",
"def layout \n return @layout\n end",
"def layout\n self.cla... | [
"0.7880605",
"0.74371785",
"0.726519",
"0.72213805",
"0.71000254",
"0.69433266",
"0.687381",
"0.67814726",
"0.6598563",
"0.6558357",
"0.6480237",
"0.64305896",
"0.6300226",
"0.62878096",
"0.62842095",
"0.62837744",
"0.6264509",
"0.6254052",
"0.62313205",
"0.61782324",
"0.6175... | 0.73819125 | 2 |
Retrieves a view by its element id. This will return the last view with this element_id in the tree, where last means the last object that was added with that name. | def last(element_id)
unless is_parent_layout?
return parent_layout.last(element_id)
end
@elements[element_id] && @elements[element_id].last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_view(element_id)\n element = last(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n end",
"def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.view\n end\n element\n ... | [
"0.76032716",
"0.7285928",
"0.64575815",
"0.6348033",
"0.61473066",
"0.61315274",
"0.59403867",
"0.58972687",
"0.56723523",
"0.56723523",
"0.5428585",
"0.53694504",
"0.5360022",
"0.5274789",
"0.5267934",
"0.5244456",
"0.5243876",
"0.5237767",
"0.516572",
"0.5161922",
"0.51619... | 0.6152062 | 4 |
Just like `last`, but if `last` returns a Layout, this method returns the layout's view. | def last_view(element_id)
element = last(element_id)
if element.is_a?(Layout)
element = element.view
end
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def find\n self.class.find(@view.layout)\n end",
"def layout\n lookup_layout\n end",
"def layout \n return @layout\n end",
"def _\n\t\tviewStack = s... | [
"0.73148465",
"0.70989007",
"0.65639526",
"0.6493659",
"0.6479423",
"0.6402021",
"0.6356232",
"0.63348323",
"0.62675834",
"0.6239946",
"0.6193393",
"0.6181329",
"0.61765033",
"0.61596245",
"0.61401516",
"0.61368835",
"0.6056468",
"0.60201174",
"0.59620094",
"0.594193",
"0.585... | 0.74260455 | 0 |
Returns all the elements with a given element_id | def all(element_id)
unless is_parent_layout?
return parent_layout.all(element_id)
end
@elements[element_id] || []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_element id\n @elements[id.to_s]\n end",
"def element(id, params = {})\n get \"elements/#{id}\", {query: params}\n end",
"def find_all_by_id(id)\n find_all_by(:id, id)\n end",
"def element_by_id(elem_id)\r\n @web_browser.element_by_id(elem_id)\r\n end",
"def element_by_id... | [
"0.6787612",
"0.6639251",
"0.65340084",
"0.6308503",
"0.62612784",
"0.61858505",
"0.6075681",
"0.60415745",
"0.59866464",
"0.59804946",
"0.5970512",
"0.5881137",
"0.5876568",
"0.5869331",
"0.58307356",
"0.58008057",
"0.5800154",
"0.5800154",
"0.57604736",
"0.57374907",
"0.571... | 0.6994673 | 0 |
Just like `all`, but if `all` returns a Layout, this method returns the layout's view. | def all_views(element_id)
element = all(element_id)
if element.is_a?(Layout)
element = element.view
end
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def find\n self.class.find(@view.layout)\n end",
"def layout\n lookup_layout\n end",
"def layout\n self.class.layout || @app.layout\n end",
"def lay... | [
"0.77328396",
"0.7538165",
"0.7432526",
"0.7230115",
"0.71913254",
"0.7187486",
"0.700015",
"0.6833812",
"0.6609608",
"0.66010004",
"0.65887403",
"0.65697545",
"0.65234977",
"0.6497617",
"0.64930487",
"0.6445923",
"0.63752496",
"0.635355",
"0.63353413",
"0.6328743",
"0.629791... | 0.6456692 | 15 |
Just like `nth`, but if `nth` returns a Layout, this method returns the layout's view. | def nth_view(element_id, index)
element = nth(element_id)
if element.is_a?(Layout)
element = element.view
end
element
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find\n self.class.find(@view.layout)\n end",
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def get_view(element_id)\n element = get(element_id)\n if element.is_a?(Layout)\n element = element.v... | [
"0.6847427",
"0.6807654",
"0.63781375",
"0.6239731",
"0.6131137",
"0.59874547",
"0.58707976",
"0.5802285",
"0.56963944",
"0.56713474",
"0.5628221",
"0.56259525",
"0.55989623",
"0.55948174",
"0.5575403",
"0.5530654",
"0.54947513",
"0.5482559",
"0.54551005",
"0.5448186",
"0.544... | 0.7683796 | 0 |
Search for a sibling: the next sibling that has the given id | def next(element_id)
self.next(element_id, from: target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assert_next_sibling(id, expected_sibling_id)\n wait_for(:message => \"id '#{id}' should be next to '#{expected_sibling_id}'\") do\n actual_sibling_id = get_eval(\"this.page().findElement('#{id}').nextSibling.id\")\n expected_sibling_id == actual_sibling_id\n end\n end",
"def next_s... | [
"0.7491546",
"0.7345928",
"0.7177878",
"0.68406296",
"0.6749778",
"0.6365642",
"0.6277817",
"0.6254287",
"0.62472796",
"0.62472796",
"0.6234277",
"0.62078166",
"0.62020326",
"0.61923254",
"0.61802274",
"0.61371565",
"0.6121825",
"0.61027145",
"0.6087696",
"0.60655963",
"0.604... | 0.6109107 | 17 |
Search for a sibling: the previous sibling that has the given id | def prev(element_id)
prev(element_id, from: target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_predecessor(id)\n if self == successor\n self\n else\n pred = self\n while !between_left_inclusive(id, pred.nodeid, pred.successor.nodeid) # RPC\n pred = pred.closest_preceding_node(id) # RPC\n end\n pred\n end\n end",
"def previous_sibling\n... | [
"0.75249445",
"0.7476051",
"0.6834634",
"0.67705387",
"0.67394024",
"0.6711154",
"0.65623933",
"0.6555641",
"0.65186775",
"0.6513286",
"0.64798373",
"0.6459687",
"0.6414648",
"0.6414098",
"0.6389276",
"0.63885975",
"0.63619107",
"0.6347757",
"0.6339316",
"0.6289689",
"0.62896... | 0.6619917 | 6 |
This searches for the "nearest" view with a given id. First, all child views are checked. Then the search goes up to the parent view, and its child views are checked. This means any view that is in the parent view's hierarchy is considered closer than a view in a grandparent's hierarchy. This is a "depthfirst" search, so any subview that contains a view with the element id ABCD Starting at D, E is closer than F, because D&E are siblings. \ \ \E But F, G and H are closer than A or I, because they share a \ \FG closer parent (B). The logic is, "B" is a container, and \I \H all views in that container are in a closer family. | def nearest(element_id)
nearest(element_id, from: target)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find(id)\n sort() unless @sorted\n @tree.bsearch { |x| x.id == id }\n end",
"def find(id)\n each_descendant(false).detect {|op| op.id == id}\n end",
"def closest_parent(type, this_view = nil)\n this_view ||= view_or_self.superview\n while this_view != nil do\n retu... | [
"0.6051466",
"0.57747096",
"0.5398215",
"0.5309833",
"0.53007185",
"0.5266479",
"0.52470285",
"0.523239",
"0.523239",
"0.52228904",
"0.52208805",
"0.5209493",
"0.51327574",
"0.5075573",
"0.50686324",
"0.5068311",
"0.50654376",
"0.4990059",
"0.49706864",
"0.49682602",
"0.49465... | 0.63626915 | 0 |
Removes a view (or several with the same name) from the hierarchy and forgets it entirely. Returns the views that were removed. | def remove(element_id)
unless is_parent_layout?
return parent_layout.remove(element_id)
end
removed = forget(element_id)
context(self.view) do
removed.each do |element|
self.apply(:remove_child, element)
end
end
removed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end",
"def remove_views\n FileUtils.rm_rf(File.dirname(__FILE__) + \"/views\")\n end",
"def forget_tree(element_id, view)\n removed = forget_view(element_id, view)\n if view.subviews\n view.subviews.each do ... | [
"0.6830917",
"0.65834415",
"0.61898804",
"0.5997242",
"0.59435993",
"0.56832415",
"0.56377375",
"0.5615252",
"0.5560866",
"0.5374461",
"0.5272933",
"0.5230598",
"0.51240784",
"0.51160395",
"0.51057583",
"0.5085563",
"0.50455177",
"0.501904",
"0.5017382",
"0.5012597",
"0.49773... | 0.46617642 | 36 |
Removes a view from the list of elements this layout is "tracking", but leaves it in the view hierarchy. Returns the views that were removed. | def forget(element_id)
unless is_parent_layout?
return parent_layout.remove(element_id)
end
removed = nil
context(self.view) do
removed = all(element_id)
@elements[element_id] = nil
end
removed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end",
"def forget_tree(element_id, view)\n removed = forget_view(element_id, view)\n if view.subviews\n view.subviews.each do | sub |\n if (sub_ids = sub.motion_kit_meta[:motion_kit_ids])\n sub... | [
"0.66157573",
"0.5968465",
"0.5898754",
"0.5719658",
"0.5623492",
"0.5612306",
"0.5410967",
"0.5232013",
"0.513814",
"0.5111841",
"0.50762504",
"0.50626093",
"0.5020968",
"0.50082934",
"0.50068396",
"0.49651092",
"0.4945815",
"0.4918972",
"0.48925567",
"0.4891927",
"0.4890746... | 0.6103588 | 1 |
returns the root view that was removed, if any | def forget_tree(element_id, view)
removed = forget_view(element_id, view)
if view.subviews
view.subviews.each do | sub |
if (sub_ids = sub.motion_kit_meta[:motion_kit_ids])
sub_ids.each do | sub_id |
forget_tree(sub_id, sub) || []
end
end
end
end
removed
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _\n\t\tviewStack = self.instance_variable_get(\"@hooViews\");\n\t\treturn viewStack.last;\n\tend",
"def remove\n selected.each { |view| view.parent.removeView(view) }\n self\n end",
"def top()\n @view__.top\n end",
"def tree_root\n if (root_id = visibility_path_ids.first)\n ret... | [
"0.652876",
"0.63563377",
"0.59730095",
"0.5963546",
"0.56980985",
"0.5650808",
"0.559136",
"0.55689514",
"0.54697216",
"0.54530054",
"0.54407686",
"0.5416677",
"0.53992707",
"0.5384595",
"0.5376188",
"0.5358059",
"0.53303576",
"0.5326621",
"0.5316264",
"0.5313069",
"0.530152... | 0.51609904 | 38 |
This method builds the layout and returns the root view. | def build_view
# Only in the 'layout' method will we allow default container to be
# created automatically (when 'add' is called)
@assign_root = true
prev_should_run = @should_run_deferred
@should_run_deferred = true
layout
unless @view
if @assign_root
create_default_root_context
@view = @context
else
NSLog('Warning! No root view was set in TreeLayout#layout. Did you mean to call `root`?')
end
end
run_deferred(@view)
@should_run_deferred = prev_should_run
@assign_root = false
# context can be set via the 'create_default_root_context' method, which
# may be outside a 'context' block, so make sure to restore context to
# it's previous value
@context = nil
if @preset_root
@view = WeakRef.new(@view)
@preset_root = nil
end
@view
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view\n unless is_parent_layout?\n return parent_layout.view\n end\n @view ||= build_view\n end",
"def layout\n @layout\n end",
"def root\n blk = self.class.has_widgets_blocks or raise \"Please setup a widget tree using has_widgets()\"\n @root ||= Apotomo::... | [
"0.7210227",
"0.63595414",
"0.6343041",
"0.6262489",
"0.6257939",
"0.62497544",
"0.6186043",
"0.618303",
"0.6124064",
"0.610619",
"0.6065549",
"0.5998523",
"0.59898144",
"0.5923627",
"0.58750683",
"0.58750683",
"0.58321255",
"0.5807749",
"0.57807946",
"0.57748705",
"0.5741783... | 0.7055751 | 1 |
Initializes an instance of a view. This will need to be smarter going forward as `new` isn't always the designated initializer. Accepts a view instance, a class (which is instantiated with 'new') or a `ViewLayout`, which returns the root view. | def initialize_element(elem, element_id)
if elem.is_a?(Class) && elem < TreeLayout
layout = elem.new
elem = layout.view
elsif elem.is_a?(Class)
elem = elem.new
elsif elem.is_a?(TreeLayout)
layout = elem
elem = elem.view
end
if layout
if element_id
name_element(layout, element_id)
end
@child_layouts << layout
elsif element_id
name_element(elem, element_id)
end
return elem
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(view)\n @view = view\n end",
"def initialize(view)\n @view = view\n end",
"def initialize(view)\n @view = view\n end",
"def initialize(view, *args, &block)\n raise \"Trying to instantiate abstract class for #{self.class}\" if abstract_class?\n ... | [
"0.7086133",
"0.7030674",
"0.6974956",
"0.6407135",
"0.6243834",
"0.6094287",
"0.59766",
"0.584781",
"0.5846918",
"0.5845415",
"0.58148706",
"0.5806649",
"0.57250345",
"0.57247335",
"0.56872237",
"0.56553626",
"0.56547505",
"0.56318283",
"0.5607281",
"0.55543464",
"0.5540843"... | 0.53315353 | 30 |
Calls the `_style` method with the element as the context, and runs the optional block in that context. This is usually done immediately after `initialize_element`, except in the case of `add`, which adds the item to the tree before styling it. | def style_and_context(element, element_id, &block)
style_method = "#{element_id}_style"
if parent_layout.respond_to?(style_method) || block_given?
parent_layout.context(element) do
if parent_layout.respond_to?(style_method)
parent_layout.send(style_method)
end
if block_given?
yield
end
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(element, element_id=nil, options={}, &block)\n # make sure we have a target - raises NoContextError if none exists\n self.target\n\n unless @context\n create_default_root_context\n end\n\n # We want to be sure that the element has a supeview or superlayer before\n # the... | [
"0.58125013",
"0.5554899",
"0.5544672",
"0.5485018",
"0.5391613",
"0.5356065",
"0.5098809",
"0.5097967",
"0.49983513",
"0.49909022",
"0.4780992",
"0.4774864",
"0.47722697",
"0.4732404",
"0.47293657",
"0.47261757",
"0.47047907",
"0.4697932",
"0.46967188",
"0.4684911",
"0.46620... | 0.7057737 | 0 |
returns the open and close times for the specified date or an empty array if closed on that date | def open_close_times(date)
open_close = @open_close[as_string(date)] || @open_close[as_sym(date)] || @default_open_close
open_close.collect { |h| Time.parse("#{as_string(date)} #{h}") }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_to_next_open(date)\n closed_at = open_close_times(date).last\n date = next_day(date)\n while open_close_times(date) == CLOSED\n date = next_day(date)\n end\n open_at = open_close_times(date).first\n open_at - closed_at\n end",
"def time_already_open(date)\n open = open_close_t... | [
"0.64534926",
"0.6409739",
"0.63603306",
"0.6299311",
"0.6200742",
"0.61581165",
"0.6029236",
"0.5951282",
"0.5842453",
"0.5797058",
"0.5791879",
"0.57281333",
"0.5622623",
"0.55761486",
"0.55488986",
"0.5543903",
"0.54923105",
"0.5436157",
"0.54332745",
"0.5417022",
"0.54121... | 0.82159126 | 0 |
the length of time available during a specified day to do work e.g., there are 6 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 9:00 AM there are 5 hours available if we open at 9:00 AM, close at 3:00 PM, and the item was dropped off at 10:00 AM | def work_time(date)
open, closed = open_close_times(date)
closed - open - time_already_open(date)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end",
"def hours_left\n remaining = WorkingTime::Interval.new(self, close_of_business)\n return remaining.duration\n end",
"def min_available_talks_time_in_a_day\n 6*60\n end",
"def length\... | [
"0.6979938",
"0.68157035",
"0.68014127",
"0.6740032",
"0.6679813",
"0.6666197",
"0.65870154",
"0.6526906",
"0.65135354",
"0.6505848",
"0.647279",
"0.6434604",
"0.63763",
"0.6364804",
"0.636263",
"0.63397336",
"0.63150114",
"0.63057137",
"0.6286855",
"0.62328106",
"0.6227468",... | 0.6992688 | 0 |
the length of time from the specified time until we open e.g., if the specified time is 6:00 AM and we open at 8:30 AM, then the time until open is 2 hours and 30 minutes | def time_until_open(date)
open = open_close_times(date).first
open - date > 0 ? open - date : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end",
"def length\n return 0.0/0.0 unless depart_time && return_time\n (return_time - depart_time)/60\n end",
"def seconds_in_day_from(time)\n if @is_closed || time > time.set_time_to( @closing_time )\n... | [
"0.79465413",
"0.7040445",
"0.6824113",
"0.6822069",
"0.6782167",
"0.6614045",
"0.6577809",
"0.6544268",
"0.652704",
"0.65187865",
"0.6515837",
"0.65137535",
"0.6510953",
"0.64691705",
"0.6460538",
"0.6434077",
"0.64075595",
"0.640612",
"0.6368399",
"0.63516295",
"0.63397384"... | 0.672332 | 5 |
the length of time from when we opened to the specified time e.g., if we opened at 9:00 AM and the time specified is 9:30 AM, then the time already open is 30 minutes | def time_already_open(date)
open = open_close_times(date).first
date - open > 0 ? date - open : 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_length\n (end_time.hour - start_time.hour) + (end_time.min - start_time.min) / 60.0\n end",
"def opening_time\n opening_time = Time.new(2020, 10, 07, @opening_time[0..1], @opening_time[3..4])\n opening_time.strftime(\"%k:%M\")\n end",
"def opening_hour\n 11 # 11am\n end",
"d... | [
"0.76807165",
"0.7212819",
"0.6871908",
"0.6785013",
"0.6725005",
"0.67124176",
"0.665532",
"0.65909344",
"0.6585296",
"0.65680254",
"0.6495326",
"0.6473542",
"0.6458115",
"0.6450309",
"0.644557",
"0.63987",
"0.6361431",
"0.63541734",
"0.63475794",
"0.6318215",
"0.6311052",
... | 0.6270769 | 22 |
the length of time from the close of the working day on the specified date until the next opening e.g., if we close at 5:00 PM on May 26 and don't open again until 9:00 AM on May 28, then the time to next open is 40 hours | def time_to_next_open(date)
closed_at = open_close_times(date).last
date = next_day(date)
while open_close_times(date) == CLOSED
date = next_day(date)
end
open_at = open_close_times(date).first
open_at - closed_at
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def time_until_open(date)\n open = open_close_times(date).first\n open - date > 0 ? open - date : 0\n end",
"def hours_until_close\n (self.closing_date.to_time - Time.zone.now.to_time) / 1.hours\n end",
"def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already... | [
"0.7813214",
"0.7438753",
"0.7393421",
"0.6926699",
"0.66983944",
"0.66936547",
"0.66277957",
"0.6552454",
"0.64781725",
"0.64600545",
"0.644911",
"0.6411212",
"0.6373096",
"0.63586634",
"0.6345596",
"0.62750244",
"0.62622863",
"0.6245853",
"0.6240413",
"0.62377644",
"0.62303... | 0.725412 | 3 |
the date in our string format: e.g., Monday April 05, 2010 9:00 AM = Apr 05, 2010 | def as_string(date)
date.strftime("%b %d, %Y")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_date\n chars = @date.split('')\n chars.pop(6)\n chars.join('')\n end",
"def get_date(date)\n\t\tif date != nil\n\t\t\ttemp = Date.parse date.to_s\n\t\t\treturn temp.strftime(\"%a, %b %d %Y\")\n\t\telse\n\t\t\treturn \"Not specifed\"\n\t\tend\n\tend",
"def view_date(str)\r\n\t\t(wday,day,mo... | [
"0.76736623",
"0.73489916",
"0.7318942",
"0.7301286",
"0.72645795",
"0.7159368",
"0.7097934",
"0.7077886",
"0.70315427",
"0.70311004",
"0.70032275",
"0.70032275",
"0.6993825",
"0.69583154",
"0.6950454",
"0.69430065",
"0.69038975",
"0.6893868",
"0.68767935",
"0.6850804",
"0.68... | 0.6758831 | 27 |
the date in our short format: e.g., Monday April 05, 2010 9:00 AM = :mon | def as_sym(date)
date.strftime("%a").downcase.to_sym
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mon() @m_date.mon end",
"def short_date( date )\n date.strftime( '%b %d, %Y')\n end",
"def date_short(date)\n\t\tdate.strftime(\"%b %e, %Y\") if !date.blank?\n\tend",
"def view_date(str)\r\n\t\t(wday,day,mon,year,hhmmss,etc) = str.to_s.split(/ /)\r\n\t\tmonth = @months[mon]\r\n\t\tstr = \"#{year}\\/#... | [
"0.75766975",
"0.7412837",
"0.69893575",
"0.6814594",
"0.6801713",
"0.6801713",
"0.6801713",
"0.67772704",
"0.67281264",
"0.6718131",
"0.6718131",
"0.6710632",
"0.66894144",
"0.66697556",
"0.66697556",
"0.66663885",
"0.6582588",
"0.6573831",
"0.6560424",
"0.64899397",
"0.6482... | 0.0 | -1 |
advance the specified date by 24 hours | def next_day(date)
date + (60 * 60 * 24)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance(date, time)\n date.advance(hours: time.hour, minutes: time.min, seconds: time.sec)\n end",
"def add_day(day)\n day += 24*60*60\nend",
"def extendbythirthydays\n update_at = update_at + 14.days.from_now\n end",
"def advance_hours(hours)\n self + (hours * 60 * 60)\n end",
"def advanc... | [
"0.69941074",
"0.6841838",
"0.67930883",
"0.6630433",
"0.6575559",
"0.6570724",
"0.6570724",
"0.6464861",
"0.6400233",
"0.63858587",
"0.63757384",
"0.635167",
"0.6309209",
"0.6257211",
"0.6196842",
"0.60889256",
"0.60845995",
"0.6080924",
"0.6080924",
"0.606035",
"0.6031458",... | 0.7098298 | 0 |
use imageserver and blob csid to serve audio | def render_audio_csid options={}
# render audio player
content_tag(:div) do
options[:value].collect do |audio_csid|
content_tag(:audio,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 audio in MPEG format.",
src: "https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{audio_csid}/content",
id: 'audio_csid',
type: 'audio/mpeg'),
controls: 'controls',
style: 'height: 60px; width: 640px;')
end.join.html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def audio; end",
"def audio_url(source, options = T.unsafe(nil)); end",
"def send_data(s, data)\n\n if USE_MP3\n audio_data = `echo '#{data}' | base64 --decode | sox -r 8000 -c 1 -e mu-law -t raw - -r 48000 -c 1 -t mp3 -`\n else\n audio_data = `echo '#{data}' | base64 --decode | opusenc --quiet --raw -... | [
"0.6188182",
"0.6148834",
"0.6059774",
"0.58894014",
"0.58392197",
"0.58172303",
"0.5796662",
"0.5743499",
"0.5692511",
"0.565943",
"0.56481653",
"0.56124437",
"0.5525445",
"0.5520838",
"0.55117834",
"0.5502439",
"0.5419982",
"0.54087967",
"0.539042",
"0.5387752",
"0.53563017... | 0.6326567 | 0 |
use imageserver and blob csid to serve video | def render_video_csid options={}
# render video player
content_tag(:div) do
options[:value].collect do |video_csid|
content_tag(:video,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.",
src: "https://webapps.cspace.berkeley.edu/#TENANT#/imageserver/blobs/#{video_csid}/content",
id: 'video_csid',
type: 'video/mp4'),
controls: 'controls',
style: 'width: 640px;')
end.join.html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # This comment part specifies how to perform server side uploading\n # http://cloudinary.com/documentation/rails_video_upload#rails_video_upload_examples\n # http://cloudinary.com/documentation/upload_videos\n # http://cloudinary.com/documentation/video_management\n # http://cloudinary.... | [
"0.6226114",
"0.62218916",
"0.61662036",
"0.61038744",
"0.5980719",
"0.5953603",
"0.59417665",
"0.59393287",
"0.59091514",
"0.5905462",
"0.5891946",
"0.58840954",
"0.587745",
"0.587745",
"0.58565646",
"0.5837253",
"0.581587",
"0.5803875",
"0.5771184",
"0.57599425",
"0.5704587... | 0.63397646 | 0 |
serve audio directy via apache (apache needs to be configured to serve nuxeo repo) | def render_audio_directly options={}
# render audio player
content_tag(:div) do
options[:value].collect do |audio_md5|
l1 = audio_md5[0..1]
l2 = audio_md5[2..3]
content_tag(:audio,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 audio in MPEG format.",
src: "https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{audio_md5}",
id: 'audio_md5',
type: 'audio/mpeg'),
controls: 'controls',
style: 'height: 60px; width: 640px;')
end.join.html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def audio_url(source, options = T.unsafe(nil)); end",
"def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n ... | [
"0.5991261",
"0.5906598",
"0.5849579",
"0.5799654",
"0.57551384",
"0.5699021",
"0.5683428",
"0.5673827",
"0.5663674",
"0.5614898",
"0.55614704",
"0.55393094",
"0.55157477",
"0.5492845",
"0.54800117",
"0.5458145",
"0.54558307",
"0.5393685",
"0.53699785",
"0.53555274",
"0.53527... | 0.5889198 | 2 |
serve audio directy via apache (apache needs to be configured to serve nuxeo repo) | def render_video_directly options={}
# render video player
content_tag(:div) do
options[:value].collect do |video_md5|
l1 = video_md5[0..1]
l2 = video_md5[2..3]
content_tag(:video,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.",
src: "https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{video_md5}",
id: 'video_md5',
type: 'video/mp4'),
controls: 'controls',
style: 'width: 640px;')
end.join.html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def audio_url(source, options = T.unsafe(nil)); end",
"def songs\n<<<<<<< HEAD\n file=\"#{Rails.root}/public/#{params[:user_id]}/#{params[:file]}.#{params[:ext]}\"\n if File.exists?(file)\n send_file(\n file,\n filename: \"#{params[:file_name]}\",\n type: \"application/mp3\"\n ... | [
"0.5991261",
"0.5906598",
"0.5889198",
"0.5849579",
"0.5799654",
"0.57551384",
"0.5699021",
"0.5683428",
"0.5673827",
"0.5663674",
"0.5614898",
"0.55614704",
"0.55393094",
"0.55157477",
"0.5492845",
"0.54800117",
"0.5458145",
"0.54558307",
"0.5393685",
"0.53699785",
"0.535552... | 0.0 | -1 |
serve X3D directy via apache (apache needs to be configured to serve nuxeo repo) | def render_x3d_directly options={}
# render x3d player
content_tag(:div) do
options[:value].collect do |x3d_md5|
l1 = x3d_md5[0..1]
l2 = x3d_md5[2..3]
content_tag(:video,
content_tag(:source, "I'm sorry; your browser doesn't support HTML5 video in MP4 with H.264.",
src: "https://cspace-prod-02.ist.berkeley.edu/#TENANT#_nuxeo/data/#{l1}/#{l2}/#{x3d_md5}",
id: 'x3d_md5',
type: 'model/x3d+xml'),
controls: 'controls',
style: 'width: 640px;')
end.join.html_safe
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def public_file_server; end",
"def public_file_server; end",
"def proxy\n uri = URI.parse(params[:url])\n open(uri.to_s) do |f|\n # TODO: instead of using f.read below, perhaps read it a bit at a time and\n # stream it a bit at a time. Look into response chunking for Rails.\n data = f.read... | [
"0.50478256",
"0.50478256",
"0.49866343",
"0.49134192",
"0.48859057",
"0.4842553",
"0.47938356",
"0.47938356",
"0.46422634",
"0.46160978",
"0.46122935",
"0.45976636",
"0.45743403",
"0.45290786",
"0.4522045",
"0.4508615",
"0.44929716",
"0.4410881",
"0.44010726",
"0.4386273",
"... | 0.6053656 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.