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 |
|---|---|---|---|---|---|---|
collect with concurrency using the TaskCollection | def collect3 pages
id = 'barackobama'
results = []
tasks = TaskCollection.new( 50 )
1.upto pages do |page|
puts "queueing page #{page}"
task = BackgroundTask.new do
http_get id, page
end
tasks << task
end
i=0
loop do
i+=1
puts "getting next task..."
task = tasks.next_fin... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_collect\n collection = Array.new\n thread_each do |e|\n collection << yield(e)\n end\n collection\n end",
"def collect4 pages\n id = 'barackobama'\n results = []\n tp = ThreadPool.new( 10 )\n tasks = TaskCollection.new( 10, tp )\n i=0\n 1.upto pages do |page|\n puts \"... | [
"0.7181076",
"0.6717339",
"0.64663166",
"0.6361141",
"0.61362207",
"0.59631974",
"0.5908036",
"0.5782116",
"0.5683027",
"0.565089",
"0.55487937",
"0.5541805",
"0.5515108",
"0.54662067",
"0.54638183",
"0.54474795",
"0.5418348",
"0.54152626",
"0.5391991",
"0.53856534",
"0.53856... | 0.6295548 | 4 |
collect with concurrency using the TaskCollection | def collect4 pages
id = 'barackobama'
results = []
tp = ThreadPool.new( 10 )
tasks = TaskCollection.new( 10, tp )
i=0
1.upto pages do |page|
puts "queueing page #{page}"
tasks.add_task do
http_get id, page
end
if tasks.task_ready?
i+=1
puts "GOT A TASK FINISHED WHILE STILL ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def thread_collect\n collection = Array.new\n thread_each do |e|\n collection << yield(e)\n end\n collection\n end",
"def collect\n end",
"def collect; end",
"def collect3 pages\n id = 'barackobama'\n results = []\n tasks = TaskCollection.new( 50 )\n 1.upto pages do |page|\n p... | [
"0.71816796",
"0.6467065",
"0.63620126",
"0.6294512",
"0.6135848",
"0.5963572",
"0.5907907",
"0.5782173",
"0.5682388",
"0.5652262",
"0.5548434",
"0.5541521",
"0.55146456",
"0.5465575",
"0.54625165",
"0.5447025",
"0.54181564",
"0.5414951",
"0.53920394",
"0.5385017",
"0.5385017... | 0.6716002 | 1 |
GET /photographers/1 GET /photographers/1.xml | def show
@photographer = Photographer.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.xml { render :xml => @photographer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @photos = @album.photos\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @photos }\n end\n end",
"def index\n @photos = @place.photos\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @phot... | [
"0.68173426",
"0.6780589",
"0.66831183",
"0.65196574",
"0.64345324",
"0.63633996",
"0.62801665",
"0.62794346",
"0.62500465",
"0.62477",
"0.6215319",
"0.6202493",
"0.61865073",
"0.61826205",
"0.6139161",
"0.6137735",
"0.6137735",
"0.61037093",
"0.60995007",
"0.60923445",
"0.60... | 0.6884301 | 0 |
GET /photographers/new GET /photographers/new.xml | def new
@photographer = Photographer.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @photographer }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @phot = Phot.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @phot }\n end\n end",
"def new\n @photocontest = Photocontest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @photocont... | [
"0.7408847",
"0.72586846",
"0.6893632",
"0.6881939",
"0.6881939",
"0.6881939",
"0.6881939",
"0.68644804",
"0.68622965",
"0.68622965",
"0.6830333",
"0.6773976",
"0.6696876",
"0.66624534",
"0.6632548",
"0.661067",
"0.6588657",
"0.6587155",
"0.6564046",
"0.65601",
"0.65465623",
... | 0.73666763 | 1 |
POST /photographers POST /photographers.xml | def create
@photographer = Photographer.new(params[:photographer])
respond_to do |format|
if @photographer.save
format.html { redirect_to(@photographer, :notice => 'Photographer was successfully created.') }
format.xml { render :xml => @photographer, :status => :created, :location => @ph... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @phot = Phot.new(params[:phot])\n\n respond_to do |format|\n if @phot.save\n format.html { redirect_to(@phot, :notice => 'Photograph was successfully created.') }\n format.xml { render :xml => @phot, :status => :created, :location => @phot }\n else\n format.html {... | [
"0.63660985",
"0.58324623",
"0.5773975",
"0.57322",
"0.57235724",
"0.5713431",
"0.5705602",
"0.5700668",
"0.56530124",
"0.55234534",
"0.5490044",
"0.5462448",
"0.5462448",
"0.54523194",
"0.54098433",
"0.5377314",
"0.53720814",
"0.5362709",
"0.534863",
"0.53382015",
"0.5322068... | 0.62080634 | 1 |
PUT /photographers/1 PUT /photographers/1.xml | def update
@photographer = Photographer.find(params[:id])
respond_to do |format|
if @photographer.update_attributes(params[:photographer])
format.html { redirect_to(@photographer, :notice => 'Photographer was successfully updated.') }
format.xml { head :ok }
else
format.htm... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @phot = Phot.find(params[:id])\n\n respond_to do |format|\n if @phot.update_attributes(params[:phot])\n format.html { redirect_to(@phot, :notice => 'Photgraph was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\"... | [
"0.6339484",
"0.5955212",
"0.58845294",
"0.5817058",
"0.57346344",
"0.5733631",
"0.5733631",
"0.56560045",
"0.5600447",
"0.5597242",
"0.55680937",
"0.5560085",
"0.5510917",
"0.54873425",
"0.5471161",
"0.54545105",
"0.5446564",
"0.54327494",
"0.5432324",
"0.5417708",
"0.541644... | 0.6018315 | 1 |
DELETE /photographers/1 DELETE /photographers/1.xml | def destroy
@photographer = Photographer.find(params[:id])
@photographer.destroy
respond_to do |format|
format.html { redirect_to(photographers_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @phot = Phot.find(params[:id])\n @phot.destroy\n\n respond_to do |format|\n format.html { redirect_to(phots_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @photocontest = Photocontest.find(params[:id])\n @photocontest.destroy\n\n respond_to do |format... | [
"0.7042632",
"0.67370665",
"0.67123264",
"0.67123264",
"0.67123264",
"0.67123264",
"0.66589224",
"0.6658092",
"0.6658092",
"0.6652505",
"0.6638722",
"0.662164",
"0.6576813",
"0.65424955",
"0.65424955",
"0.65424955",
"0.65357894",
"0.6495151",
"0.64893013",
"0.6476771",
"0.647... | 0.7292495 | 0 |
To create class just pass params to constructor Net::HTTP::RestClient.new :host => '127.0.0.1', :port => 8080 | def initialize params = {}
defaults = {
:port => 80,
:user_agent => 'Net::HTTP::RestClient'
}
if params[:port]==443 && !params[:ssl]
defaults.merge! :ssl => {
:use_ssl => true,
:verify_mode => OpenSSL::SSL::VERIFY_NONE
}
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(args)\n require \"http2\"\n require \"json\"\n \n @http = Http2.new(\n :host => args[:host],\n :port => args[:port],\n :ssl => args[:ssl]\n )\n end",
"def initialize(proto,host,path,username = nil, password = nil)\n @proto, @host, @path, @username, @password = pro... | [
"0.7253297",
"0.7195995",
"0.7193622",
"0.6919879",
"0.6888865",
"0.6873243",
"0.6845457",
"0.6830123",
"0.6830008",
"0.67321366",
"0.66945785",
"0.6660367",
"0.66318756",
"0.66244185",
"0.6601434",
"0.6599789",
"0.65766096",
"0.6551249",
"0.6548499",
"0.65434813",
"0.6541353... | 0.69648594 | 3 |
Helper Method =begin def play(board) play_count = 0 while play_count < 9 turn(board) play_count += 1 end end =end | def play(board)
while (over?(board) != true && draw?(board) != true) # Checks to see if the game is over
turn(board) # Calls for another turn
end
if over?(board) == true # If the game is over...
if won?(board) != false # If there's a winner and win_combo available
puts "Congratulations #{winner(boar... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def play(board)\n count = 0\n while count < 9\n turn(board)\n count += 1\n end\nend",
"def play(board)\n turns = 0\n while turns < 9\n turn(board)\n turns += 1\n end\nend",
"def play(board)\n counter = 0\n until counter == 9\n turn(@board)\n counter += 1\n ... | [
"0.8932282",
"0.8791286",
"0.8779881",
"0.8746287",
"0.8656435",
"0.8518202",
"0.8518202",
"0.8455292",
"0.82669604",
"0.8249404",
"0.79115975",
"0.78094214",
"0.7751442",
"0.77434",
"0.77101076",
"0.7689337",
"0.76752514",
"0.7646811",
"0.76455194",
"0.7642807",
"0.7640595",... | 0.0 | -1 |
add .blank? to Array | def blank?
self.nil? || self.empty?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nil_blank(array)\n if ( array.include?(nil) ) #replace nil with empty string\n array.map! {|e| e ? e : \"\"}\n end\n return array\n end",
"def empty?\n to_ary.empty?\n end",
"def empty?\n @ary.empty?\n end",
"def empty?\n to_ary.empty?\n end",
"def empty?\n ... | [
"0.76463604",
"0.69529694",
"0.68961453",
"0.6887107",
"0.6887107",
"0.68834656",
"0.6824629",
"0.6805056",
"0.6796514",
"0.67236793",
"0.6572193",
"0.6572193",
"0.6572193",
"0.648297",
"0.6425834",
"0.64195216",
"0.6409729",
"0.63938284",
"0.6391386",
"0.6391386",
"0.6385022... | 0.62495357 | 39 |
convert to UTF16 and back to UTF8 as a workaround for some cases of strings returning "invalid byte sequence in UTF8" | def fix_utf_errors
self.encode('UTF-16', 'UTF-8', :invalid => :replace, :replace => '').encode('UTF-8', 'UTF-16')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_utf16(str)\n if str.respond_to?(:encode)\n str.encode('UTF-16BE')\n else\n Iconv.conv('UTF-16BE', 'UTF-8', str)\n end\n end",
"def to_utf16\r\n Iconv.iconv(\"utf-16LE\", \"utf-8\", self).first + \"\\x00\\x00\"\r\n end",
"def re_en... | [
"0.7952469",
"0.79265434",
"0.79001266",
"0.7597034",
"0.7564574",
"0.73676085",
"0.73360145",
"0.729087",
"0.7270305",
"0.71294326",
"0.7029048",
"0.69988906",
"0.69952947",
"0.6960252",
"0.694577",
"0.6883485",
"0.6832204",
"0.67867976",
"0.6780205",
"0.6686144",
"0.6667247... | 0.773909 | 3 |
def approve self.approved = true end | def retire
self.class.transaction do
self.reagent_ids = []
self.device_ownership_ids = []
self.lab_id = nil
self.department_id = nil
self.institute_id = nil
self.approved = false
self.joined = nil
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def approve!\n self.approved = true\n self.save\n end",
"def disapprove\n self.approved = false\n end",
"def approve!\n update_attribute(:active, true)\n end",
"def save\n self.approved = true\n super\n end",
"def approve\n self.update(status: \"APPROVED\")\n end",
... | [
"0.9176694",
"0.88271725",
"0.86907566",
"0.86544275",
"0.8604007",
"0.8491764",
"0.83516216",
"0.8300072",
"0.8164324",
"0.8129191",
"0.8062829",
"0.8053194",
"0.80491114",
"0.80210835",
"0.7971696",
"0.7912997",
"0.790865",
"0.7845862",
"0.7732859",
"0.7732576",
"0.770231",... | 0.0 | -1 |
param: Hash return: MonogDB document for a pet return: Nil if pet already exists create new Pet Document in the MongoDB with the following parameters | def create_pet_document_if_new(hash)
return nil if Pet.where(profile_url: hash[:profile_url]).exists?
Pet.new(
name: hash[:name],
breed: hash[:breed],
age: hash[:age],
gender: hash[:gender],
species: hash[:species],
profile_url: hash[:profile_url],
img_url: hash[:img_u... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def prepare_pet(pet_api)\n pet_id = random_id\n category = Petstore::Category.new('id' => 20002, 'name' => 'category test')\n tag = Petstore::Tag.new('id' => 30002, 'name' => 'tag test')\n pet = Petstore::Pet.new('id' => pet_id, 'name' => \"RUBY UNIT TESTING\", 'photo_urls' => 'photo url',\n ... | [
"0.6297636",
"0.6261388",
"0.613103",
"0.60227853",
"0.5987113",
"0.59801644",
"0.5966964",
"0.595031",
"0.5937723",
"0.5937313",
"0.5900276",
"0.5848832",
"0.58465976",
"0.5846304",
"0.58125454",
"0.5805349",
"0.5798577",
"0.5743265",
"0.56964463",
"0.56810176",
"0.56620353"... | 0.7660062 | 0 |
param: Nokogiri Document return: Array, list of paginated urls finds the 'last page number' and creates an array of urls with the paginated number at the end to iterate over | def get_paginated_urls(doc)
doc.xpath("//div[@class='k2Pagination initialPagination']").first.content =~ /\d+ of (\d+)/
last_page_number = $1.to_i
(1..last_page_number).map do |n|
"https://www.strayrescue.org/animals-for-adoption/page-#{n}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_page_count\n \n# EXPECTED FORMAT\n# \n# <div class=\"search-utility search-pagination-bottom\">\n#<ul class=\"search-pagination\">\n# <li><a href=\"#\" class=\"pagination-active\">1 </a></li>\n# <li><a href=\"/Browse?fulltextquery=las%20vegas&am... | [
"0.6919825",
"0.67353356",
"0.65517133",
"0.6417418",
"0.63931894",
"0.637022",
"0.637022",
"0.6323053",
"0.6311771",
"0.6258172",
"0.6258172",
"0.6231393",
"0.62250584",
"0.61954814",
"0.61299413",
"0.6127739",
"0.61226785",
"0.6116117",
"0.6043736",
"0.600036",
"0.5999511",... | 0.7972475 | 0 |
param: Nokogiri Document return: Hash creates an empty Hash in order to collect pet information to be added to the Pet Document in MongoDB creates a Case Statement to iterate over the Spans of profile url to gather content create string of pet profile image url and add to Hash | def create_pet_info_hash_from_doc(doc)
info = {}
img_src = doc.xpath("//div[@class='itemImageBlock']/span[@class='itemImage']/a/@href").first.value
info[:img_url] = "https://www.strayrescue.org#{img_src}"
name = doc.xpath("//div[@class='itemHeader']/h2").first
.content
.delet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_pet_document_if_new(hash)\n return nil if Pet.where(profile_url: hash[:profile_url]).exists? \n Pet.new(\n name: hash[:name],\n breed: hash[:breed],\n age: hash[:age],\n gender: hash[:gender],\n species: hash[:species],\n profile_url: hash[:profile_url],\n img_ur... | [
"0.63832617",
"0.6325799",
"0.5683983",
"0.56492853",
"0.55889964",
"0.5569335",
"0.5518562",
"0.5494657",
"0.5447748",
"0.541576",
"0.5412363",
"0.53103966",
"0.5282293",
"0.5255956",
"0.5248399",
"0.5233622",
"0.520535",
"0.52018553",
"0.5180472",
"0.5172048",
"0.5160439",
... | 0.6538964 | 0 |
param: Nokogiri Document return: Array, array of pet names iterates over children of H3 spans, finds content, substitues and strips trailing white space | def pet_names_from_doc(doc)
doc.xpath("//h3[@class='catItemTitle']//span[@class='a-name']").map do |span|
span.children
.first
.content
.gsub(",", "")
.strip
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parse_names(elem)\n nameList = elem.following_siblings()[0] #data_section.at(\"ul\")\n names = nameList.search(\"li\")\n @names = []\n names.each { |name|\n name = name.inner_html\n name.gsub! /\\s{2,}/, \" \"\n @names << name \n } \n end",
"def return_names_array(doc)\n ... | [
"0.62645966",
"0.6219923",
"0.5920607",
"0.5839375",
"0.5792405",
"0.57524264",
"0.5698442",
"0.5653736",
"0.55165404",
"0.55153114",
"0.5511272",
"0.5462218",
"0.54355705",
"0.54031277",
"0.53980976",
"0.53467673",
"0.5341171",
"0.5328564",
"0.5325719",
"0.53235465",
"0.5313... | 0.7656553 | 0 |
param: Nokogiri Document return: Array, array of pet profile urls finds the links of the unique pet profile urls and creates a string of each pet profile url | def pet_urls_from_doc(doc)
doc.xpath("//h3[@class='catItemTitle']/a/@href").map do |href|
"https://www.strayrescue.org#{href}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_profile_url(html)\n links = []\n selector = \"li.member-list-item a.member-link\"\n\n hubbers = html.css(selector)\n hubbers.each do |hubber|\n link = hubber['href']\n if link\n links << (link[0] == '/' ? \"https://github.com#{link}\" : link)\n else\n ... | [
"0.67583513",
"0.66959286",
"0.66626394",
"0.63180315",
"0.6111599",
"0.59398156",
"0.5908832",
"0.5900828",
"0.5885325",
"0.5883753",
"0.58748245",
"0.5863869",
"0.5846184",
"0.583691",
"0.5798016",
"0.57817566",
"0.57604825",
"0.5755527",
"0.5744607",
"0.5743458",
"0.572347... | 0.698358 | 0 |
param: Nokogiri Document return: Array, array of adopted pet urls creates empty Array, collects Arrays of both pet names and pet profile urls from main web page create new Hash, zips the two pet name and pet profile Arrays together if the name contains 'adopted', add it to the empty Array that was created | def adopted_pet_urls_from_doc(doc)
adopted_pet_urls = []
pet_names = pet_names_from_doc(doc)
pet_urls = pet_urls_from_doc(doc)
pets_hash = Hash[pet_names.zip(pet_urls)]
pets_hash.map do |name, url|
if name =~ /Adopted/i
adopted_pet_urls << url
end
end
adopted_pet... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unadopted_pet_urls_from_doc(doc)\n pet_names = pet_names_from_doc(doc)\n pet_urls = pet_urls_from_doc(doc)\n pets_hash = Hash[pet_names.zip (pet_urls)]\n pets_hash.map do |name, url|\n pets_hash.delete_if {|name, url| name =~/Adopted/i}\n end\n pets_hash.values\n end",
"def getHiredEm... | [
"0.72357863",
"0.6016453",
"0.60006917",
"0.595165",
"0.59323674",
"0.58845365",
"0.58549505",
"0.573119",
"0.5728181",
"0.5701977",
"0.5679949",
"0.5637692",
"0.56264645",
"0.5622417",
"0.5612407",
"0.5536986",
"0.55257237",
"0.55227166",
"0.5515477",
"0.55014527",
"0.548908... | 0.7410254 | 0 |
param: Nokogiri Document return: Hash, Hash values = pet urls utilize other functions to collect pet names and pet profile urls create new Hash, zips the two pet name and pet profile Arrays together if name contains 'adopted', delete key/value pair from Hash | def unadopted_pet_urls_from_doc(doc)
pet_names = pet_names_from_doc(doc)
pet_urls = pet_urls_from_doc(doc)
pets_hash = Hash[pet_names.zip (pet_urls)]
pets_hash.map do |name, url|
pets_hash.delete_if {|name, url| name =~/Adopted/i}
end
pets_hash.values
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adopted_pet_urls_from_doc(doc)\n adopted_pet_urls = []\n \n pet_names = pet_names_from_doc(doc)\n \n pet_urls = pet_urls_from_doc(doc)\n \n pets_hash = Hash[pet_names.zip(pet_urls)]\n pets_hash.map do |name, url|\n if name =~ /Adopted/i\n adopted_pet_urls << url\n end\n en... | [
"0.64886034",
"0.5745615",
"0.5714289",
"0.5642905",
"0.56397027",
"0.56157845",
"0.5515969",
"0.54539126",
"0.5445521",
"0.54343283",
"0.5409238",
"0.53915685",
"0.5389625",
"0.538633",
"0.538633",
"0.5386057",
"0.537926",
"0.53669876",
"0.5361267",
"0.5343076",
"0.5329281",... | 0.75550467 | 0 |
publishedAfter q type: video videoEmbeddable: true | def index
@email = Person.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_VideoEmbeddable(value)\n set_input(\"VideoEmbeddable\", value)\n end",
"def embed\n \"#{video.__embed__}#{tracker(true)}\"\n end",
"def embedded_video_url\n self.video_url.sub 'watch?v=', 'embed/'\n end",
"def after_save sender\n\n #Video.store\n end",
"def create_videos... | [
"0.6642834",
"0.64109755",
"0.62497765",
"0.60667455",
"0.59547055",
"0.5875923",
"0.58399135",
"0.5784964",
"0.5784726",
"0.5754142",
"0.57520545",
"0.57480115",
"0.5726057",
"0.572469",
"0.57095915",
"0.57095915",
"0.5660905",
"0.56586164",
"0.5656229",
"0.56474406",
"0.562... | 0.0 | -1 |
Method for handling get and post actions for entries "deduct" web page | def deduct
deduct_request_get request if request.get?
deduct_request_post request if request.post?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post\r\n end",
"def post; end",
"def POST; end",
"def post\n end",
"def create\n cite_key = params['entry']['cite_key']\n category = params['entry']['category']\n clean_params = EntryValidator.clean_params category, params\n @entry = Entry.new(category:category, cite_key:cite_key)\n ent... | [
"0.6206183",
"0.6185677",
"0.6150249",
"0.6017786",
"0.59523404",
"0.5791228",
"0.5684529",
"0.560153",
"0.5586362",
"0.5574847",
"0.55651575",
"0.5561733",
"0.5558291",
"0.5541198",
"0.5526616",
"0.55258906",
"0.5523774",
"0.5519768",
"0.5513334",
"0.54928845",
"0.54915404",... | 0.5126531 | 70 |
Method for handling get and post actions for entries "view" web page | def view #TODO: can probably cut down on duplication between get and post conditions below
if request.get?
if !session[:current_user_id].nil?
user_id = session[:current_user_id]
@account_names = AccountsHelper.get_account_names user_id
@category_names = CategoriesHelper.get_category_na... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def view\n view_get if request.get?\n view_post if request.post?\n end",
"def GET; end",
"def get\n puts \"In entries#get, params=#{params}\"\n context = params\n context[:entry_id] = params[:id]\n context[:mode] = 'display'\n context[:view_type] = \"table\"\n\n @entryHtml = getEntryHt... | [
"0.69736534",
"0.65089405",
"0.6323603",
"0.611741",
"0.60854805",
"0.6067153",
"0.6043354",
"0.5992369",
"0.5875226",
"0.58669114",
"0.58016324",
"0.5775578",
"0.5770767",
"0.576031",
"0.57114226",
"0.56859237",
"0.56773883",
"0.5660662",
"0.562665",
"0.5625527",
"0.561505",... | 0.5481287 | 43 |
Method for getting account and category information for user | def get_account_category_info
if !session[:current_user_id].nil?
user_id = session[:current_user_id]
@account_names = AccountsHelper.get_account_names user_id
@category_names = CategoriesHelper.get_category_names(user_id, session[:account_name])
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def user\n result = contact_categories.first(:conditions => {:category_type => User.to_s})\n result ? result.category : nil\n end",
"def get_acc_info\n JSON.parse(curl_get(\"/api2/account/info/\").body_str)\n end",
"def get_accounts_by_user\n return User.find(params[:user_id]).accounts... | [
"0.64471084",
"0.6287011",
"0.6247039",
"0.6202146",
"0.6179109",
"0.61725813",
"0.6143401",
"0.6139904",
"0.6078705",
"0.6052938",
"0.6035996",
"0.5998358",
"0.59978384",
"0.595258",
"0.59420085",
"0.5940729",
"0.593138",
"0.5895265",
"0.58848715",
"0.5875533",
"0.5870792",
... | 0.8027359 | 0 |
Method for getting the dollar balance for a savings account category | def get_category_balance(category_name)
category_id = CategoriesHelper.get_category_id(session[:current_user_id],
session[:account_name], category_name)
@category_balance = CategoriesHelper.get_category_entries_total category_id
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_category_balance(category_name)\n category = CategoriesHelper.get_category(session[:current_user_id],\n session[:account_name], category_name)\n CategoriesHelper.get_category_entries_total category[:id]\n end",
"def balance(currency)\n\t\treturn @balance[currency]\n\tend",... | [
"0.72775906",
"0.6943687",
"0.6920089",
"0.6841092",
"0.67796123",
"0.6774",
"0.67078555",
"0.66987276",
"0.6649567",
"0.65915745",
"0.6572539",
"0.6548832",
"0.6548704",
"0.6530043",
"0.65222836",
"0.6519932",
"0.6505765",
"0.64911646",
"0.64604867",
"0.6445759",
"0.6427847"... | 0.7236434 | 1 |
Method for retrieving entry form data via strong parameters | def entry_params
params_allowed = [:account_name, :entry_date, :category_name, :entry_amount]
if !@category_names.nil?
@category_names.each do |category_name|
params_allowed.push(category_name.to_sym)
end
end
params.require(:entry).permit(params_allowed)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def form_data?; end",
"def entry_params\n params.require(:entry).permit(:entry_name, :entry_email, :entry_phone, :entry_address)\n end",
"def entry_params\n params.require(:entry).permit(:name, :address, :phone, :email)\n end",
"def entry_params\n params.require(:entry).permit(:title, :body,... | [
"0.6587075",
"0.6266305",
"0.6255248",
"0.62087554",
"0.6191808",
"0.6191808",
"0.61198705",
"0.6116404",
"0.6103429",
"0.6085948",
"0.6050679",
"0.6041683",
"0.60302967",
"0.6024656",
"0.60204005",
"0.60095763",
"0.59909064",
"0.59907806",
"0.596541",
"0.59606373",
"0.595511... | 0.5602106 | 69 |
Method for handling "deduct" web page get requests | def deduct_request_get(request)
if !session[:current_user_id].nil?
get_account_category_info
if @account_names.nil?
flash_no_account_alert
elsif @category_names.empty?
flash_no_category_alert
else
if session[:category_name].nil?
session[:... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get(url); end",
"def get()\n html = html_for(baseurl)\n scrape html, baseurl\n end",
"def request_uncached request\n sleep 0.001 * options.delay.to_f # Sleep if requested\n\n if options.debug\n print \"Opening #{request[:uri]}...\"; $stdout.flush\n end\n\n if request[:meth... | [
"0.6426625",
"0.6265789",
"0.6222593",
"0.62002116",
"0.6049735",
"0.60071594",
"0.5960783",
"0.5897246",
"0.58320415",
"0.58270615",
"0.58062124",
"0.58015937",
"0.57477593",
"0.57459915",
"0.5729104",
"0.5726815",
"0.5705539",
"0.5685747",
"0.5685603",
"0.5684453",
"0.56630... | 0.0 | -1 |
Method for handling "deduct" web page post requests | def deduct_request_post(request)
get_account_category_info
get_category_balance session[:category_name]
entry_attributes = entry_params
if session[:account_name] == entry_attributes[:account_name] &&
session[:category_name] == entry_attributes[:category_name]
if !@category_name... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post; end",
"def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend",
"def post_data; end",
"def POST; end",
"def post\r\n end",
"def post\n end",
"def content_post\n\t\t\t# POST requests seem to bomb out when they're deflated\n\t\t\t# and they probably don't need to be co... | [
"0.6730462",
"0.67241806",
"0.6705417",
"0.66105056",
"0.6472793",
"0.63472795",
"0.62625366",
"0.6223247",
"0.6120572",
"0.6059435",
"0.60164744",
"0.60010564",
"0.59735614",
"0.5913049",
"0.58621687",
"0.58596927",
"0.58151597",
"0.57911634",
"0.57821596",
"0.57585466",
"0.... | 0.0 | -1 |
only employees that are logged in may view all beneficiaries and delete a beneficiary once a delete request is received lists all the beneficiaries in the system can only be viewed by an employee with correct credentials | def index
@beneficaries = Beneficiary.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @employee = Employee.find(params[:employee_id])\n @direct_deposits = @employee.direct_deposits.all\n skip_authorization\n end",
"def destroy\n u=User.find(session[:user]) \n if (u.role=='Admin' || u.role=='Member')\n \n @income = Income.find(params[:id])\n @income.destroy\n\... | [
"0.7040152",
"0.6271768",
"0.6158919",
"0.61038184",
"0.6031935",
"0.60009664",
"0.59996796",
"0.59821516",
"0.59334916",
"0.5919216",
"0.5903339",
"0.5902216",
"0.58974427",
"0.5871361",
"0.5865084",
"0.5857522",
"0.5830515",
"0.5812815",
"0.58053386",
"0.58018374",
"0.57877... | 0.0 | -1 |
creates a new beneficiary object | def new
@beneficiary = Beneficiary.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # @loyalty_benefit = LoyaltyBenefit.new(params[:loyalty_benefit])\n @merchant ||= Merchant.find(params[:merchant_id])\n @loyalty_benefit ||= @merchant.loyalty_benefits.build(params[:loyalty_benefit])\n @loyalty_benefit.user_id = current_user.id\n \n res... | [
"0.62414074",
"0.6235799",
"0.6186011",
"0.61720014",
"0.61679643",
"0.61235344",
"0.60894746",
"0.6078166",
"0.59848917",
"0.5983903",
"0.5983903",
"0.5983903",
"0.5955939",
"0.5944868",
"0.591054",
"0.58632517",
"0.58631307",
"0.5861688",
"0.5858615",
"0.58330286",
"0.58205... | 0.77469134 | 0 |
creates and saves the beneficiary to the database | def create
@beneficiary = Beneficiary.new(ben_params)
if @beneficiary.save
log_in @beneficiary
@beneficiary.send_activation_email
SystemLog.new( system_event: "Beneficiary account created by #{@beneficiary.lastname}, #{@beneficiary.enterprise_name}.", event_time: Time.now, users_id: @beneficiary.id ).sav... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n\t\t@beneficiary = Beneficiary.new\n\tend",
"def create\n @benefit = Benefit.new(benefit_params)\n\n respond_to do |format|\n if @benefit.save\n format.html { redirect_to admin_benefits_path, notice: 'Benefit was successfully created.' }\n else\n format.html { render :new }... | [
"0.704203",
"0.6803687",
"0.67160285",
"0.6691593",
"0.65505326",
"0.6460925",
"0.6448937",
"0.64448756",
"0.6432192",
"0.6414283",
"0.6376574",
"0.6355262",
"0.6351865",
"0.6282306",
"0.62121004",
"0.6208204",
"0.62073493",
"0.61295754",
"0.6124044",
"0.609684",
"0.6084854",... | 0.6547171 | 5 |
edits the beneficiaries data | def edit
@beneficiary = Beneficiary.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_benefit\r\n @benefit = Benefit.find(params[:id])\r\n end",
"def set_benefit\n @benefit = Benefit.find(params[:id])\n end",
"def set_benefit\n @benefit = Benefit.find(params[:id])\n end",
"def set_beneficiary\n @beneficiary = current_user.beneficiary\n end",
"def upda... | [
"0.66410035",
"0.66390187",
"0.66390187",
"0.6562762",
"0.6478544",
"0.6266202",
"0.6238503",
"0.62331575",
"0.6192873",
"0.61814654",
"0.61572844",
"0.61569816",
"0.6137837",
"0.6034763",
"0.59922856",
"0.5990092",
"0.59667116",
"0.59655374",
"0.59628576",
"0.59427863",
"0.5... | 0.67103916 | 0 |
shows this beneficiaries dashboard | def show
@beneficiary = Beneficiary.find(params[:id])
@clubs = Club.all
@club_updates = ClubUpdate.all
@projplans = BeneficiaryProject.where(beneficiary_id: current_user.id)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n dashboard_4\n end",
"def show\n @summary = {}\n # cash flow info\n @summary[\"cash_flow_domestic\"] = domestic_cash_flow_info\n # sell info\n @summary[\"domestic\"] = domestic_sold_info\n @summary[\"offshore\"] = offshore_sold_info\n # by date\n @summary[\"auction\"] = ... | [
"0.68773323",
"0.6619619",
"0.6569205",
"0.65086496",
"0.65060735",
"0.6453471",
"0.6441068",
"0.6380577",
"0.6370652",
"0.6368398",
"0.63344145",
"0.6312104",
"0.6274026",
"0.6240353",
"0.62382954",
"0.62380433",
"0.6232929",
"0.62328243",
"0.62328243",
"0.62328243",
"0.6232... | 0.6736464 | 1 |
allows the beneficiary to update their data | def update
@beneficiary = Beneficiary.find(params[:id])
if @beneficiary.update(ben_params)
SystemLog.new( system_event: "Beneficiary account updated by #{@beneficiary.lastname}, #{@beneficiary.enterprise_name}.", event_time: Time.now, users_id: @beneficiary.id).save
flash[:success] = "Your account has been up... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n \n end",
"def updated_data; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update; end",
"def update ; end",
"def update\r\n\r\n end",
"def update\n \n end",
"def upd... | [
"0.7783083",
"0.7609655",
"0.7572036",
"0.7572036",
"0.7572036",
"0.7572036",
"0.7572036",
"0.7572036",
"0.7572036",
"0.7572036",
"0.75643903",
"0.7563586",
"0.75211996",
"0.7499656",
"0.7446079",
"0.7444488",
"0.74223053",
"0.74223053",
"0.74223053",
"0.74223053",
"0.7422305... | 0.0 | -1 |
allows the employee to destroy the beneficiary | def destroy
@beneficiary = Beneficiary.find(params[:id])
SystemLog.new( system_event: " #{ @beneficiary.enterprise_name} account deleted by #{current_employee.lastname}, #{current_employee.firstname} ", event_time: Time.now, users_id: @beneficiary.id).save
@beneficiary.destroy
redirect_to beneficiaries_path
en... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @employee_insentive.destroy\n respond_to do |format|\n format.html { redirect_to employee_insentives_url, notice: 'Employee insentive was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def delete(employee)\n return nil if employee.nil?\n \n s... | [
"0.7222444",
"0.7202173",
"0.71570325",
"0.71539104",
"0.714456",
"0.7141796",
"0.7106405",
"0.70975906",
"0.7048666",
"0.7001246",
"0.7000961",
"0.6986492",
"0.6984746",
"0.6975261",
"0.69483507",
"0.69462186",
"0.6938677",
"0.6935757",
"0.6926977",
"0.69127655",
"0.69111526... | 0.74141186 | 0 |
sends a request with attached prefix and parameters. All parameters should be enter on Hash Both :prefix and :cont can be nil. Effectively request(:cmd=>a,:prefix=>b,:cont=>nil) and request(:cmd=>a,:prefix=>nil,:cont=>b) are equivalent. | def request(params=Hash.new, &result_cbk)
cmd = params.delete :cmd
prefix = params.delete :prefix
cont = params.delete :cont
offset = params.delete :offset
len = params.delete :len
if cont.is_a? String
cont=request_string(cont)
elsif cont.is_a? Integer
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def requestify(parameters, prefix=nil)\n if Hash === parameters\n return nil if parameters.empty?\n parameters.map { |k,v| requestify(v, name_with_prefix(prefix, k)) }.join(\"&\")\n elsif Array === parameters\n parameters.map { |v| requestify(v, name_with_prefix(prefix, \"\")) }.join... | [
"0.606929",
"0.60612863",
"0.5847957",
"0.5820325",
"0.5761126",
"0.5757932",
"0.5752136",
"0.57500154",
"0.57183176",
"0.5667486",
"0.5621435",
"0.5588398",
"0.55583924",
"0.5531352",
"0.5493395",
"0.5484581",
"0.5480696",
"0.54601586",
"0.54586464",
"0.5457348",
"0.54503626... | 0.70130724 | 0 |
Sets the related commands. | def related_commands(*cmdlist)
@related = cmdlist
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_commands\n super\n @commands['clear'] = ConsoleCommand_Clear.new(self)\n @commands['confirm'] = ConsoleCommand_Confirm.new(self)\n end",
"def set_commands; end",
"def set_commands(commands)\n if commands.is_a? Commands\n @commands = commands\n else\n raise Roomba::... | [
"0.8319109",
"0.81341016",
"0.7582211",
"0.756353",
"0.75620115",
"0.725374",
"0.7089648",
"0.69986004",
"0.68601644",
"0.68481284",
"0.6790899",
"0.67649215",
"0.6755012",
"0.6677813",
"0.66618025",
"0.6549687",
"0.65116525",
"0.6510897",
"0.64994144",
"0.6460818",
"0.645435... | 0.64350796 | 22 |
Uncomment the next line to define a global platform for your project platform :ios, '9.0' | def shared_pods
pod 'Firebase/Core'
pod 'Firebase/Auth'
pod 'Firebase/Firestore'
pod 'Firebase/Storage'
pod 'Kingfisher', '~> 4.0'
pod 'CodableFirebase'
pod 'IQKeyboardManagerSwift'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def flutter_additional_ios_build_settings(target)\n return unless target.platform_name == :ios\n\n # [target.deployment_target] is a [String] formatted as \"8.0\".\n inherit_deployment_target = target.deployment_target[/\\d+/].to_i < 11\n\n # ARC code targeting iOS 8 does not build on Xcode 14.3.\n force_to_a... | [
"0.6585135",
"0.6189414",
"0.6186799",
"0.61831987",
"0.61230564",
"0.6097925",
"0.6067752",
"0.6067752",
"0.6067752",
"0.60567516",
"0.60380656",
"0.60033345",
"0.59901696",
"0.5988518",
"0.5977584",
"0.5975002",
"0.5951426",
"0.5951426",
"0.59349376",
"0.5933664",
"0.590374... | 0.0 | -1 |
Gets a normalized response | def unpacked_data(response_body)
if @accept_type.upcase == 'JSON'
data = JSON.parse(@response.body)['data']
elsif @accept_type.upcase == 'XML'
data = Hash.from_xml(@response.body)['response']['data']['template']
end
return data.is_a?(Array) ? data : [data]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def response\n @parsed_response ||= JSON.parse(@response.body, symbolize_names: true)\n end",
"def parsed_response\n response\n end",
"def formatted_response\n self.response\n end",
"def normalize_responses\n return if form.blank?\n\n form.response_fields.each do |response_field|\n ... | [
"0.67323345",
"0.6547716",
"0.6453354",
"0.63641346",
"0.6310546",
"0.6282343",
"0.62443763",
"0.61632067",
"0.61331517",
"0.60854036",
"0.5966783",
"0.59375924",
"0.5880497",
"0.58695894",
"0.5862997",
"0.58567595",
"0.5856103",
"0.5841415",
"0.58336604",
"0.5806037",
"0.578... | 0.0 | -1 |
GET /grm_pics/1 GET /grm_pics/1.json | def show
@grm_pic = GrmPic.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @grm_pic }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/photos/#{params[:id]}.json?token=#{ENV['API_KEY']}\"\n\t response = RestClient.get(url)\n\t @photo = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/photos.json?token=#{ENV['API_KEY']}\"\n response = RestClient.get(url)\n @ph... | [
"0.7356959",
"0.73237115",
"0.7206281",
"0.7179565",
"0.7030517",
"0.699467",
"0.69745064",
"0.6966735",
"0.6953553",
"0.69411147",
"0.68934816",
"0.6883472",
"0.68559533",
"0.6849443",
"0.68468636",
"0.6806936",
"0.6797558",
"0.6790379",
"0.6774419",
"0.67398185",
"0.6729228... | 0.7249245 | 2 |
GET /grm_pics/new GET /grm_pics/new.json | def new
@grm_pic = GrmPic.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @grm_pic }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @pic = Pic.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pic }\n end\n end",
"def new\n @picture = Picture.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @picture }\n end\n ... | [
"0.77994967",
"0.7550111",
"0.7540671",
"0.7517751",
"0.7517751",
"0.7517751",
"0.74605054",
"0.7408422",
"0.74037975",
"0.7376584",
"0.7327317",
"0.7327317",
"0.7327317",
"0.7327317",
"0.7327317",
"0.7327317",
"0.7267969",
"0.7260424",
"0.7257166",
"0.72567034",
"0.72567034"... | 0.76826924 | 1 |
POST /grm_pics POST /grm_pics.json | def create
@grm_pic = GrmPic.new(params[:grm_pic])
respond_to do |format|
if @grm_pic.save
format.html { redirect_to @grm_pic, notice: 'Your picture has been successfully saved.' }
format.json { render json: @grm_pic, status: :created, location: @grm_pic }
else
format.html {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @photos = Photo.new(photos_params)\n if @photos.save\n render json: { id: @photos.id, url: @photos.gallery.url,\n size: @photos.gallery_file_size }\n else\n render json: { id: nil }\n end\n end",
"def create\n @picture = Picture.create!(picture_params)\n... | [
"0.6561947",
"0.65476966",
"0.64633185",
"0.6258583",
"0.6228458",
"0.6211262",
"0.6199565",
"0.6177735",
"0.6171326",
"0.6152017",
"0.6149494",
"0.61328316",
"0.61207646",
"0.61144936",
"0.60937655",
"0.60932153",
"0.6083489",
"0.6065815",
"0.60652703",
"0.6062749",
"0.60406... | 0.67714494 | 0 |
PUT /grm_pics/1 PUT /grm_pics/1.json | def update
@grm_pic = GrmPic.find(params[:id])
respond_to do |format|
if @grm_pic.update_attributes(params[:grm_pic])
format.html { redirect_to @grm_pic, notice: 'Grm pic was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @pictures = Picture.all.order(created_at: :desc)\n @picture.update(picture_params)\n render json: @pictures\n # head :no_content\n end",
"def update \n if @adm_galerias_imagem.update(adm_galerias_imagem_params)\n\t\thead :created \n else\n\t\thead :bad_request\n en... | [
"0.7073454",
"0.65477145",
"0.6546324",
"0.64918154",
"0.64849615",
"0.64209956",
"0.6403132",
"0.63799345",
"0.6379136",
"0.6344232",
"0.63350815",
"0.631945",
"0.6297801",
"0.62890863",
"0.6285601",
"0.625026",
"0.625026",
"0.62415177",
"0.623637",
"0.62290806",
"0.6218491"... | 0.6764094 | 1 |
DELETE /grm_pics/1 DELETE /grm_pics/1.json | def destroy
@grm_pic = GrmPic.find(params[:id])
@grm_pic.destroy
respond_to do |format|
format.html { redirect_to grm_pics_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n item = FormImage.last\n id = item[:id]\n item.destroy\n render json: {id: id}\n end",
"def destroy\n @gallery.pics.each do |pic|\n Cloudinary::Uploader.destroy(pic.public_id.split(\"/\").last.split(\".\")[0] ,@auth) if pic.public_id.present?\n pic.delete\n end\n @gall... | [
"0.7219369",
"0.72146237",
"0.7173361",
"0.7167007",
"0.71124303",
"0.7110825",
"0.7108186",
"0.708475",
"0.7048052",
"0.7036989",
"0.7032148",
"0.7027123",
"0.7013413",
"0.6983071",
"0.6980043",
"0.695333",
"0.69518375",
"0.69475526",
"0.69435453",
"0.693863",
"0.69380355",
... | 0.7440913 | 0 |
pragma mark UITableView delegate | def tableView(tableView, numberOfRowsInSection:section)
@items.size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_select(tableView, tableViewDelegate)\n # implement in row class\n end",
"def delegate_method; end",
"def on_table?; @on_table; end",
"def numberOfSectionsInTableView(table_view)\n 1\n end",
"def numberOfSectionsInTableView(table_view)\n 1\n end",
"def tableView(table_view, numb... | [
"0.7104923",
"0.5926286",
"0.58895457",
"0.5731961",
"0.5731961",
"0.57271934",
"0.56641734",
"0.56641734",
"0.56641734",
"0.56641734",
"0.5638189",
"0.5616284",
"0.55832577",
"0.55756986",
"0.55756986",
"0.55756986",
"0.55756986",
"0.55756986",
"0.55597204",
"0.55581295",
"0... | 0.524359 | 38 |
Assign score to each Bracketcontestant and status to entire Bracketcontest. Save all three records in a single transaction. This overrides (adds to) inherited method by automatically advancing teams if this Bracketcontest is referred to by the contestants of a subsequent Bracketcontest. | def record_result(homescore, awayscore, status="COMPLETED")
super(homescore, awayscore, status)
self.advance_contestants()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def advance_contestants()\n #logger.debug \"Prior(s): #{all_priors.collect{|bc| bc.contestantcode}.inspect()}\"\n winning_team = self.homecontestant.win ? self.homecontestant.team : self.awaycontestant.team\n losing_team = self.homecontestant.loss ? self.homecontestant.team : self.awaycontestant.team\n ... | [
"0.6763577",
"0.63428915",
"0.6275799",
"0.6046688",
"0.582363",
"0.57331854",
"0.5695344",
"0.56933",
"0.56845474",
"0.56724876",
"0.5669926",
"0.5652796",
"0.5628952",
"0.56161296",
"0.55998915",
"0.55485934",
"0.55281943",
"0.5527364",
"0.5523171",
"0.5513806",
"0.5510279"... | 0.6143797 | 3 |
return the contestantcode for the Winner of this Bracketcontest | def winner_code()
"W"+self.id.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def determine_winner\n result = @data[\"game_tags\"][\"Result\"]\n whites_result = result.split(\"-\")\n if whites_result == \"1\"\n \"White Wins!\"\n elsif whites_result == \"1/2\"\n \"It's a draw!\"\n else\n \"Black Wins!\"\n end\n end... | [
"0.6792582",
"0.6368583",
"0.6285211",
"0.6251946",
"0.6228171",
"0.6204866",
"0.61702955",
"0.61579",
"0.6149683",
"0.6144823",
"0.6136162",
"0.6124933",
"0.6122837",
"0.611645",
"0.61012614",
"0.608666",
"0.60840654",
"0.60832155",
"0.60770077",
"0.6031562",
"0.6028763",
... | 0.6749128 | 1 |
return the contestantcode for the Loser of this Bracketcontest | def loser_code()
"L"+self.id.to_s
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def client_code(crosswalk_record)\n rcc_log.debug \"Obtaining CLIENT CODE.\"\n if crosswalk_record && crosswalk_record.crosswalk_record_id.present?\n crosswalk_record = ReasonCodesClientsFacilitiesSetName.find(crosswalk_record.crosswalk_record_id)\n if crosswalk_record.present?\n client_code... | [
"0.57789713",
"0.5689643",
"0.5662474",
"0.54964215",
"0.54755956",
"0.54740286",
"0.5430414",
"0.54213524",
"0.5412487",
"0.53851306",
"0.53851306",
"0.5374983",
"0.53699464",
"0.53699464",
"0.53579766",
"0.53486276",
"0.53486276",
"0.5341376",
"0.5339156",
"0.5327791",
"0.5... | 0.0 | -1 |
Returns Array of Bracketcontestants which refer to this Bracketcontest. | def all_priors()
#self.bracketgrouping.bracketcontests.bracketcontestants
#Bracketcontestant.where(bracketgrouping: self.bracketgrouping).select{|bc|bc.priorcontest().id()==self.id()}.collect{|bc|bc.priorcontest()}
self.bcadvancements.collect {|bcadv| bcadv.bracketcontestant}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contests()\n\t\tself.as_contestants.collect{|c| c.contest }\n\tend",
"def as_contestants()\n\t\tContestant.where(team: self)\n\tend",
"def bloodoaths\n Bloodoath.all.select do |oath|\n oath.cults == self\n end\n end",
"def as_regular_contestants()\n\t Regularcontestant.where(team: se... | [
"0.6798893",
"0.67810136",
"0.5838418",
"0.5766713",
"0.56623036",
"0.56332487",
"0.5614",
"0.56134045",
"0.55654",
"0.55086684",
"0.55046046",
"0.54812104",
"0.54680866",
"0.54566044",
"0.5433172",
"0.5432431",
"0.5432431",
"0.54096085",
"0.5375719",
"0.53711",
"0.53282934",... | 0.6094237 | 2 |
Advance teams if this Bracketcontest is referred to by the contestants of a subsequent Bracketcontest. | def advance_contestants()
#logger.debug "Prior(s): #{all_priors.collect{|bc| bc.contestantcode}.inspect()}"
winning_team = self.homecontestant.win ? self.homecontestant.team : self.awaycontestant.team
losing_team = self.homecontestant.loss ? self.homecontestant.team : self.awaycontestant.team
self.all_p... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_teams\n if (home_team != nil and away_team != nil)\n puts \"Updating teams\"\n #match = Matchup.new(params)\n home_team.updateResults(self)\n away_team.updateResults(self)\n home_team.save\n away_team.save\n else\n return false\n end\n e... | [
"0.59530765",
"0.57159525",
"0.5650777",
"0.55969405",
"0.5594067",
"0.55399823",
"0.546448",
"0.5458613",
"0.5445283",
"0.5426526",
"0.5426526",
"0.5346426",
"0.53385586",
"0.5309299",
"0.52879107",
"0.5282461",
"0.526785",
"0.525595",
"0.5255781",
"0.5251995",
"0.52352595",... | 0.7077696 | 0 |
GET /agreement_renewals GET /agreement_renewals.json | def index
@agreement_renewals = AgreementRenewal.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_agreement_renewal\n @agreement_renewal = AgreementRenewal.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @agreement_renewal.update(agreement_renewal_params)\n format.html { redirect_to @agreement_renewal, notice: 'Agreement renewal was successfully updated.' }\... | [
"0.75588864",
"0.69028735",
"0.6847326",
"0.68314886",
"0.6630945",
"0.65671855",
"0.6417067",
"0.63124436",
"0.6262745",
"0.6012404",
"0.5966039",
"0.5868079",
"0.57940054",
"0.57935053",
"0.57818836",
"0.57747465",
"0.5706079",
"0.5614639",
"0.5597725",
"0.55975914",
"0.558... | 0.7824209 | 0 |
GET /agreement_renewals/1 GET /agreement_renewals/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @agreement_renewals = AgreementRenewal.all\n end",
"def set_agreement_renewal\n @agreement_renewal = AgreementRenewal.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @agreement_renewal.update(agreement_renewal_params)\n format.html { redirect_to @agree... | [
"0.771795",
"0.75944537",
"0.69393337",
"0.6767207",
"0.67222303",
"0.6713785",
"0.6665083",
"0.6454944",
"0.639897",
"0.63732034",
"0.6060927",
"0.6017399",
"0.5977465",
"0.5965415",
"0.5900248",
"0.58757555",
"0.5856989",
"0.57470375",
"0.574528",
"0.5732924",
"0.57219386",... | 0.0 | -1 |
POST /agreement_renewals POST /agreement_renewals.json | def create
@agreement_renewal = AgreementRenewal.new(agreement_renewal_params)
respond_to do |format|
if @agreement_renewal.save
Franchisee.find(@agreement_renewal.franchisee_id).update(latest_renewal: @agreement_renewal.renewed_date)
format.html { redirect_to franchisees_path, notice: 'A... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def agreement_renewal_params\n params.require(:agreement_renewal).permit! #(:franchisee_id, :renewed_date, :franchisee_document_id)\n end",
"def set_agreement_renewal\n @agreement_renewal = AgreementRenewal.find(params[:id])\n end",
"def update\n respond_to do |format|\n if @agreement_r... | [
"0.75171983",
"0.74939144",
"0.6841403",
"0.6785716",
"0.6752647",
"0.66705537",
"0.6496077",
"0.64264566",
"0.61755013",
"0.6113835",
"0.60929686",
"0.60794437",
"0.59437275",
"0.5929309",
"0.5900502",
"0.5886616",
"0.5863059",
"0.58458775",
"0.58444643",
"0.5817456",
"0.581... | 0.7407235 | 2 |
PATCH/PUT /agreement_renewals/1 PATCH/PUT /agreement_renewals/1.json | def update
respond_to do |format|
if @agreement_renewal.update(agreement_renewal_params)
format.html { redirect_to @agreement_renewal, notice: 'Agreement renewal was successfully updated.' }
format.json { render :show, status: :ok, location: @agreement_renewal }
else
format.html ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_agreement_renewal\n @agreement_renewal = AgreementRenewal.find(params[:id])\n end",
"def agreement_renewal_params\n params.require(:agreement_renewal).permit! #(:franchisee_id, :renewed_date, :franchisee_document_id)\n end",
"def update\n respond_to do |format|\n if @agreement.u... | [
"0.73842394",
"0.6889177",
"0.6737117",
"0.66704416",
"0.6670405",
"0.6661277",
"0.64394915",
"0.6325749",
"0.6318704",
"0.62377584",
"0.62272733",
"0.61745995",
"0.61628586",
"0.61009914",
"0.60826045",
"0.602723",
"0.59825796",
"0.59745795",
"0.59529454",
"0.592216",
"0.591... | 0.77773577 | 0 |
DELETE /agreement_renewals/1 DELETE /agreement_renewals/1.json | def destroy
@agreement_renewal.destroy
respond_to do |format|
format.html { redirect_to agreement_renewals_url, notice: 'Agreement renewal was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @renewal = Renewal.find(params[:id])\n @renewal.destroy\n\n respond_to do |format|\n format.html { redirect_to(renewals_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @tenancy_agreement = TenancyAgreement.find(params[:id])\n @tenancy_agreement.destroy\n\... | [
"0.73058057",
"0.7232317",
"0.7201038",
"0.70369333",
"0.6953326",
"0.6837525",
"0.6661316",
"0.6541359",
"0.6537618",
"0.6476778",
"0.6455483",
"0.6435957",
"0.6428224",
"0.6428224",
"0.6428224",
"0.6428224",
"0.6422864",
"0.64205974",
"0.6420101",
"0.6419499",
"0.64116246",... | 0.81961054 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_agreement_renewal
@agreement_renewal = AgreementRenewal.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 agreement_renewal_params
params.require(:agreement_renewal).permit! #(:franchisee_id, :renewed_date, :franchisee_document_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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
El siguiente metodo es para determinar si es un holiday | def holiday?
self.date_of_lecture.holiday?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def holiday?\n @holiday\n end",
"def public_holiday?\n HOLIDAYS.include? to_date\n end",
"def business_day?\n !holiday?\n end",
"def is_a_2014_bank_holiday?(date)\nend",
"def is_a_2014_bank_holiday?(date)\nend",
"def bank_holiday?\n @test_time = @time if @test_time.nil?\n... | [
"0.8586609",
"0.79637927",
"0.7883483",
"0.7783422",
"0.7783422",
"0.7763218",
"0.7569986",
"0.7526425",
"0.7432581",
"0.7390402",
"0.73606014",
"0.7334213",
"0.7303654",
"0.7298655",
"0.72273433",
"0.71741736",
"0.7173591",
"0.7154994",
"0.71006113",
"0.7016207",
"0.69766974... | 0.7916125 | 2 |
This can be a central controller to handle all the chat related routing functionality not necessarilly a conversations thing Create a conversation object | def create
=begin
if Conversation.between(params[:sender_id], params[:recipient_id]).present?
@conversation = Conversation.between(params[:sender_id], params[:recipient_id]).first
else # If conversation is not present
@conversation = Conversation.create!(conversation_params)
end
=end
sende... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create \n # If there is an existing conversation between the 2 parties, then the database is queried for the previous conversation and it is displayed. \n if Conversation.between(params[:sender_id], params[:recipient_id]).present?\n @conversation = Conversation.between(params[:sender_i... | [
"0.7483231",
"0.7452756",
"0.7254672",
"0.71872115",
"0.71850467",
"0.71797085",
"0.71762186",
"0.71255064",
"0.68997115",
"0.6869808",
"0.68689597",
"0.6864227",
"0.6847472",
"0.6843925",
"0.68353415",
"0.6834538",
"0.6833988",
"0.6800015",
"0.67652583",
"0.67621464",
"0.676... | 0.7256288 | 2 |
=begin def conversation_params params.permit(:sender_id, :recipient_id) end def interlocutor(conversation) current_user = conversation.recipient ? conversation.sender : conversation.recipient end =end | def new_interlocutor(conversation)
if current_user.id.eql?(conversation.sender_id)
return User.find(conversation.recipient_id)
else
return User.find(conversation.sender_id)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def conversation_params\n params.require(:conversation).permit(:participant_id).merge(user_id: current_user.id)\n end",
"def conversation_params\n params.permit(:sender_id, :receiver_id)\n end",
"def conversation_params\n params.require(:conversation).permit(:recipient_id, :sender_id)\n end",
... | [
"0.7903024",
"0.7856343",
"0.7846355",
"0.7470008",
"0.7462175",
"0.73686236",
"0.7332839",
"0.7291366",
"0.7186575",
"0.71622735",
"0.7144649",
"0.71332884",
"0.7101911",
"0.7097994",
"0.7091741",
"0.70562685",
"0.70562685",
"0.70297956",
"0.7028878",
"0.7028878",
"0.7023022... | 0.71664536 | 9 |
There is no way to silence the global warnings on looking up a qualified variable, so we're going to hack around it here. | def lookup_global_silent(param)
@context.find_global_scope.to_hash[param]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def qualified_cop_name(name, path, warn: T.unsafe(nil)); end",
"def strict_variables; end",
"def refurbish variable_name\n Value.typed @vars[variable_name], variable_name.to_s.sub(/^\\@/, '') #.sub(/^\\$/, '')\n end",
"def find_var(name, depth = nil)\n # Ignore depth, it has no bearing on namesp... | [
"0.6305697",
"0.6080789",
"0.59336734",
"0.59063536",
"0.5866285",
"0.583225",
"0.5795347",
"0.577678",
"0.572645",
"0.5652632",
"0.56335396",
"0.55091023",
"0.54765713",
"0.5468927",
"0.5468718",
"0.54148394",
"0.54129255",
"0.5402912",
"0.5368779",
"0.53549606",
"0.53484565... | 0.55065626 | 12 |
Create a summary from a profile report. | def summary(profile_report, num_compliant, num_non_compliant)
report = {
'compliant' => num_compliant,
'non_compliant' => num_non_compliant
}
if profile_report['documented_missing_parameters']
report['documented_missing_parameters'] = profile_report['documented_missing_parameters'].count
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parseProfile(section, record)\n profile = Profile.new(\n @fields.dig(section, record, 0).to_i,\n @fields.dig(section, record, 1),\n @fields.dig(section, record, 2).to_i,\n @fields.dig(section, record, 3).to_i,\n @fields.dig(section, record, 4).to_i,\n ... | [
"0.5805049",
"0.5661702",
"0.54991186",
"0.5442923",
"0.543887",
"0.5402037",
"0.53999573",
"0.5299518",
"0.52981764",
"0.52265495",
"0.521325",
"0.5200884",
"0.5188935",
"0.5175486",
"0.5171689",
"0.51609385",
"0.5158901",
"0.5140869",
"0.51381457",
"0.5106581",
"0.5106581",... | 0.66530186 | 0 |
You have a bank of switches before you, numbered from 1 to n. Each switch is connected to exactly one light that is initially off. You walk down the row of switches and toggle every one of them. You go back to the beginning, and on this second pass, you toggle switches 2, 4, 6, and so on. On the third pass, you go back... | def flip_switcher(n)
switch_bank = []
n.times { switch_bank << false }
switches_on = []
counter = 1
loop do
break if counter > switch_bank.length
switch_bank.each_with_index do | switch, position |
switch_bank[position] = !switch if (position + 1) % counter == 0
end
counter += 1
end
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def light_switches(n)\n light_hash = {}\n 1.upto(n) { |i| light_hash[i] = true }\n 2.upto(n) do |current_pass|\n light_hash.map do |light, state|\n light_hash[light] = !state if light % current_pass == 0\n end\n end\n lights_left_on = light_hash.select do |_, state|\n state\n end\n result = []... | [
"0.84838074",
"0.83852506",
"0.8084767",
"0.8049383",
"0.7898044",
"0.78762996",
"0.7849238",
"0.776707",
"0.7754998",
"0.7641954",
"0.7614625",
"0.7311757",
"0.72323716",
"0.72290456",
"0.71254337",
"0.7118258",
"0.7052836",
"0.7046569",
"0.70273775",
"0.7023022",
"0.7014063... | 0.78734314 | 6 |
extend Concerns::Slugifiable::ClassMethods include Concerns::Slugifiable::InstanceMethods | def slug
self.name.downcase.gsub(' ', '-')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def acts_as_sluggable(options = {})\n self.sluggable_attribute = options[:with].to_s if options[:with]\n self.send(:include, InstanceMethods)\n end",
"def is_sluggable(options = Hash.new)\n # Add class-methods\n extend DataMapper::Is::Sluggable::ClassMethods\n # Add insta... | [
"0.74998194",
"0.7426411",
"0.738677",
"0.738677",
"0.70414156",
"0.6976999",
"0.6971317",
"0.69466305",
"0.69451874",
"0.69330305",
"0.6898385",
"0.6800396",
"0.67305034",
"0.6730325",
"0.6692687",
"0.6688356",
"0.66774124",
"0.6644625",
"0.6644625",
"0.6625444",
"0.6623613"... | 0.6649595 | 18 |
Metodo utilizado para notificar o modelo responsavel quando um pagamento for cancelado | def notificar_pagamento_cancelado
self.association_class.constantize.find_by(id: self.association_id).pagamento_cancelado
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cancelled_requests; end",
"def cancelled?; end",
"def check_for_cancel\n return unless params[:commit] == t( :cancel )\n back( notice: 'Alterações descartadas.' )\n end",
"def cancelar\n respond_to do |format|\n if @ticket.update(status:3)\n \n @ticket.payment.update(estatu... | [
"0.6936696",
"0.6925732",
"0.6710073",
"0.66825527",
"0.6666501",
"0.6619672",
"0.6607341",
"0.6607341",
"0.6607341",
"0.6578347",
"0.6578347",
"0.6567384",
"0.6552998",
"0.6552998",
"0.6552998",
"0.6552998",
"0.6552998",
"0.6552998",
"0.6552998",
"0.6552998",
"0.6552998",
... | 0.0 | -1 |
Metodo utilizado para notificar o modelo responsavel quando um pagamento for efetuado | def notificar_pagamento_efetuado
self.association_class.constantize.find_by(id: self.association_id).pagamento_efetuado
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contas_a_pagar\n @movimentos = Movimento.find(:all,:conditions => [\"data_pagamento is null and entidade_id = ? and tipo_movimento = 'D'\", current_usuario.entidade_id])\n end",
"def paginate; false; end",
"def relatorio_titulos_anuais_invalidos\n if (params[:professor_id]).present?\n @relatorio... | [
"0.6377385",
"0.63147575",
"0.6179766",
"0.6053154",
"0.5979316",
"0.5962213",
"0.5936181",
"0.58580035",
"0.58120877",
"0.5773827",
"0.5772475",
"0.5771984",
"0.57246035",
"0.5723763",
"0.5680051",
"0.5677796",
"0.56526613",
"0.5647268",
"0.56398064",
"0.5631044",
"0.5607209... | 0.5297033 | 63 |
Metodo utilizado para notificar o modelo responsavel quando esta aguardando um pagamento | def notificar_aguardando_pagamento
self.association_class.constantize.find_by(id: self.association_id).aguardando_pagamento
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate; false; end",
"def contas_a_pagar\n @movimentos = Movimento.find(:all,:conditions => [\"data_pagamento is null and entidade_id = ? and tipo_movimento = 'D'\", current_usuario.entidade_id])\n end",
"def mostra_nao_pagas_aprovadas_os\n\n @os_id = params[:os_id]\n @titulo_nao_pagas=fal... | [
"0.6561936",
"0.6502684",
"0.62332594",
"0.622031",
"0.6195768",
"0.60964113",
"0.60528785",
"0.6047911",
"0.6016605",
"0.6011015",
"0.5991877",
"0.5983377",
"0.5953771",
"0.59407395",
"0.58878523",
"0.5872436",
"0.5853645",
"0.5836941",
"0.5830381",
"0.57956785",
"0.579348",... | 0.61778194 | 5 |
Metodo utilizado para notificar o modelo responsavel quando um pagamento esta em analise | def notificar_pagamento_em_analise
self.association_class.constantize.find_by(id: self.association_id).pagamento_em_analise
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paginate; false; end",
"def relatorio_titulos_anuais_invalidos\n if (params[:professor_id]).present?\n @relatorio_tit_prof = TituloProfessor.paginate(:all,:page=>params[:page],:per_page =>20,:conditions => [\"professor_id = ? and (titulo_id = 6 or titulo_id = 7 or titulo_id = 8) and ano_letivo <> ?\",... | [
"0.6321071",
"0.6189849",
"0.615538",
"0.6120777",
"0.6104634",
"0.60361916",
"0.5989867",
"0.5970417",
"0.5923465",
"0.5909711",
"0.577617",
"0.5749825",
"0.5739915",
"0.572749",
"0.5708375",
"0.5699104",
"0.5695306",
"0.56790286",
"0.56790274",
"0.5642375",
"0.56257856",
... | 0.5433973 | 46 |
Metodo utilizado para notificar o modelo responsavel quando um pagamento esta em disputa | def notificar_pagamento_em_disputa
self.association_class.constantize.find_by(id: self.association_id).pagamento_em_disputa
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def revisa_deuda\n if com_compra.adeudos[:cuentas_con_deuda] == 0\n com_compra.pagado!\n else\n com_compra.pendiente!\n end\n end",
"def contas_a_pagar\n @movimentos = Movimento.find(:all,:conditions => [\"data_pagamento is null and entidade_id = ? and tipo_movimento = 'D'\", current_usuar... | [
"0.6367561",
"0.61616343",
"0.60961455",
"0.6005732",
"0.5890918",
"0.58713037",
"0.57006896",
"0.5693877",
"0.564749",
"0.55724204",
"0.55677843",
"0.55108947",
"0.5509424",
"0.5427363",
"0.5424544",
"0.53639793",
"0.53566265",
"0.5353305",
"0.5323565",
"0.5323438",
"0.53221... | 0.5848684 | 6 |
Metodo utilizado para notificar o modelo responsavel quando um pagamento esta estornado | def notificar_pagamento_estornado
self.association_class.constantize.find_by(id: self.association_id).pagamento_estornado
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def contas_a_pagar\n @movimentos = Movimento.find(:all,:conditions => [\"data_pagamento is null and entidade_id = ? and tipo_movimento = 'D'\", current_usuario.entidade_id])\n end",
"def paginate; false; end",
"def relatorio_titulos_anuais_invalidos\n if (params[:professor_id]).present?\n @relatorio... | [
"0.6160883",
"0.6083659",
"0.60405684",
"0.59140956",
"0.59133023",
"0.5911975",
"0.58875835",
"0.5815543",
"0.57412136",
"0.57179683",
"0.56792057",
"0.56729895",
"0.5603003",
"0.55811393",
"0.5528504",
"0.5506432",
"0.5491988",
"0.5473746",
"0.5473746",
"0.5463804",
"0.5451... | 0.54101473 | 28 |
trabajo los datos de la sesion, cuando hago click en submit del form me toma por defecto la accion new del controller por eso lo uso para hacer otra cosa que no es new nada sino controlar la sesion, no estoy usando .save como se hace usualmente en esta accion "create" predefinida de rails | def create
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n # Buscamos con este metodo mediante el login\n @estudiante = Estudiante.find_by_nombre_usuario(params[:estudiante][:nombre_usuario])\n \n # Verificamos si el password es correcto\n if @estudiante and @estudiante.password == params[:estudiante][:password]\n # Mensaje notice que se pre... | [
"0.69419444",
"0.6865192",
"0.6827488",
"0.6817336",
"0.6792601",
"0.67608947",
"0.66898096",
"0.66796744",
"0.6678696",
"0.6643488",
"0.6561563",
"0.6556065",
"0.65551376",
"0.6548641",
"0.65464747",
"0.6524534",
"0.65237164",
"0.65045905",
"0.6499054",
"0.64927655",
"0.6492... | 0.0 | -1 |
GET /job_form_sources GET /job_form_sources.json | def index
@job_form_sources = JobFormSource.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_job_form_source\n @job_form_source = JobFormSource.find(params[:id])\n end",
"def create\n @job_form_source = JobFormSource.new(job_form_source_params)\n\n respond_to do |format|\n if @job_form_source.save\n format.html { redirect_to @job_form_source, notice: 'Job form source wa... | [
"0.6902017",
"0.65166306",
"0.63694215",
"0.59058714",
"0.57900345",
"0.56477255",
"0.5631562",
"0.5560675",
"0.54310924",
"0.5397977",
"0.537743",
"0.53730184",
"0.5336556",
"0.5322456",
"0.53149736",
"0.53102803",
"0.5306294",
"0.5281327",
"0.5274943",
"0.5273368",
"0.52576... | 0.8140983 | 0 |
GET /job_form_sources/1 GET /job_form_sources/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @job_form_sources = JobFormSource.all\n end",
"def set_job_form_source\n @job_form_source = JobFormSource.find(params[:id])\n end",
"def create\n @job_form_source = JobFormSource.new(job_form_source_params)\n\n respond_to do |format|\n if @job_form_source.save\n format... | [
"0.7944684",
"0.7076237",
"0.66479534",
"0.64266074",
"0.614156",
"0.57764024",
"0.574103",
"0.55089635",
"0.5489623",
"0.54265547",
"0.54173595",
"0.5361036",
"0.53493804",
"0.5317075",
"0.5295687",
"0.5254084",
"0.5239228",
"0.5201512",
"0.51975715",
"0.51872665",
"0.517743... | 0.0 | -1 |
POST /job_form_sources POST /job_form_sources.json | def create
@job_form_source = JobFormSource.new(job_form_source_params)
respond_to do |format|
if @job_form_source.save
format.html { redirect_to @job_form_source, notice: 'Job form source was successfully created.' }
format.json { render action: 'show', status: :created, location: @job_f... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @job_form_sources = JobFormSource.all\n end",
"def job_form_source_params\n params.require(:job_form_source).permit(:name, :content, :category_id, :company_id)\n end",
"def set_job_form_source\n @job_form_source = JobFormSource.find(params[:id])\n end",
"def update\n respon... | [
"0.7277465",
"0.6955971",
"0.6726922",
"0.58972484",
"0.57770544",
"0.56926644",
"0.55746686",
"0.5547016",
"0.5525693",
"0.545783",
"0.53754765",
"0.5354074",
"0.5341737",
"0.5268604",
"0.5261016",
"0.52091265",
"0.5189321",
"0.5171732",
"0.5169544",
"0.5131325",
"0.5126489"... | 0.72836673 | 0 |
PATCH/PUT /job_form_sources/1 PATCH/PUT /job_form_sources/1.json | def update
respond_to do |format|
if @job_form_source.update(job_form_source_params)
format.html { redirect_to @job_form_source, notice: 'Job form source was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: 'edit' }
format.json {... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_job_form_source\n @job_form_source = JobFormSource.find(params[:id])\n end",
"def job_form_source_params\n params.require(:job_form_source).permit(:name, :content, :category_id, :company_id)\n end",
"def index\n @job_form_sources = JobFormSource.all\n end",
"def update\n respon... | [
"0.6888753",
"0.6417322",
"0.60998845",
"0.6068493",
"0.5970968",
"0.59485865",
"0.59063494",
"0.59063494",
"0.58415323",
"0.58111537",
"0.5774476",
"0.57653385",
"0.57603025",
"0.5731284",
"0.5720086",
"0.57173246",
"0.5714788",
"0.5697505",
"0.5680176",
"0.5679402",
"0.5673... | 0.7456987 | 0 |
DELETE /job_form_sources/1 DELETE /job_form_sources/1.json | def destroy
@job_form_source.destroy
respond_to do |format|
format.html { redirect_to job_form_sources_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @job_form.destroy\n respond_to do |format|\n format.html { redirect_to job_forms_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @jargon_file = JargonFile.find(params[:id])\n @source = @jargon_file.source\n @jargon_file.destroy\n\n respond_to do... | [
"0.6748908",
"0.643806",
"0.6366777",
"0.6312047",
"0.62892777",
"0.6268566",
"0.6253289",
"0.62438524",
"0.62391955",
"0.620396",
"0.620396",
"0.620396",
"0.620396",
"0.6203538",
"0.61790305",
"0.6173839",
"0.6173839",
"0.6173781",
"0.6173067",
"0.6161133",
"0.6159895",
"0... | 0.7967529 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_job_form_source
@job_form_source = JobFormSource.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 job_form_source_params
params.require(:job_form_source).permit(:name, :content, :category_id, :company_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.6981269",
"0.6783559",
"0.6746007",
"0.67423046",
"0.6735905",
"0.6593568",
"0.6504213",
"0.649792",
"0.6482664",
"0.6478558",
"0.64566684",
"0.64392304",
"0.6380194",
"0.6376366",
"0.636562",
"0.63208145",
"0.63006365",
"0.63001287",
"0.6292953",
"0.62927175",
"0.62911004... | 0.0 | -1 |
POST /documents POST /documents.json | def create
@document = Document.new(resource_params)
respond_to do |format|
if @document.save
format.html { redirect_to @document, notice: 'Primary document was successfully created.' }
format.json { render json: @document, status: :created, location: @document }
else
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @document = Document.new(params[:document])\n\n respond_to do |format|\n if @document.save\n format.html { redirect_to @document, :notice => 'Document was successfully created.' }\n format.json { render :json => @document, :status => :created, :location => @document }\n e... | [
"0.7267415",
"0.72268313",
"0.72020537",
"0.72020537",
"0.7193004",
"0.71516347",
"0.7137478",
"0.71373665",
"0.7124582",
"0.70484006",
"0.68926215",
"0.68771446",
"0.68380576",
"0.6815543",
"0.6751143",
"0.6745509",
"0.6733746",
"0.6723664",
"0.6687253",
"0.668583",
"0.66797... | 0.68183285 | 13 |
PUT /documents/1 PUT /documents/1.json | def update
@document = Document.find(params[:id])
respond_to do |format|
if @document.update_attributes(resource_params)
format.html { redirect_to @document, notice: 'Primary document was successfully updated.' }
format.json { head :no_content }
else
format.html { render act... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def put_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Put.new(uri)\n req.body = document.to_json\n run(uri, req)\n end",
"def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\... | [
"0.7604765",
"0.7348989",
"0.7190452",
"0.7094024",
"0.70421684",
"0.6972244",
"0.6862227",
"0.6861711",
"0.6825018",
"0.6811377",
"0.6811377",
"0.6811377",
"0.6798293",
"0.6792356",
"0.6753529",
"0.67480385",
"0.67318904",
"0.66923976",
"0.6636967",
"0.6636967",
"0.6636967",... | 0.6753539 | 14 |
DELETE /documents/1 DELETE /documents/1.json | def destroy
@document = Document.find(params[:id])
@document.destroy
respond_to do |format|
format.html { redirect_to documents_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n @client.delete_document(@path)\n end",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
"def destroy\n @doc = Doc.find(params[:id])\n @doc.destroy\n\n respond... | [
"0.78232354",
"0.761401",
"0.7518423",
"0.75177574",
"0.7488822",
"0.7488822",
"0.7488822",
"0.7488822",
"0.7488822",
"0.7483412",
"0.7483412",
"0.74585146",
"0.7431029",
"0.74234265",
"0.7416177",
"0.74146056",
"0.7329395",
"0.7328653",
"0.7327659",
"0.7327659",
"0.73240066"... | 0.7474384 | 18 |
Leaving :name out makes it start to work (though, obviously this skips the name column). | def with_workers_works_a_bit
association_join(:workers, select: [:id, :title])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def minimal_name_data(name)\n return nil unless name\n\n [\n name.id, # 0\n name.correct_spelling_id, # 1\n name.synonym_id, # 2\n name.text_name # 3\n ]\n end",
"def name = (name)",
"def name=( str )\n se... | [
"0.6099135",
"0.60160416",
"0.58407605",
"0.5791207",
"0.57720375",
"0.57720375",
"0.57699466",
"0.57699466",
"0.5739583",
"0.56624526",
"0.56606686",
"0.56306434",
"0.56108403",
"0.5591305",
"0.5583757",
"0.5581239",
"0.55618536",
"0.5555592",
"0.5555592",
"0.5536256",
"0.55... | 0.0 | -1 |
Update the document in the ElasticSearch index | def update_in_index
__elasticsearch__.index_document
index_dependent_models.map(&:update_in_index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_document index, id, document\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}/_update\")\n req = Net::HTTP::Post.new(uri)\n req.body = { \"doc\": document }.to_json\n run(uri, req)\n end",
"def update(index, type, id, body)\n handler.update index: index, type: type, id: i... | [
"0.7750656",
"0.76317126",
"0.74974483",
"0.73167944",
"0.72780126",
"0.7081224",
"0.7007855",
"0.6937101",
"0.6903114",
"0.6899316",
"0.6868905",
"0.6853994",
"0.68358326",
"0.67995703",
"0.67330927",
"0.66740733",
"0.6601732",
"0.6601732",
"0.65792024",
"0.6558365",
"0.6558... | 0.691069 | 8 |
Delete the document from the ElasticSearch index | def delete_from_index
begin
__elasticsearch__.delete_document
rescue Elasticsearch::Transport::Transport::Errors::NotFound
nil
end
index_dependent_models.map(&:update_in_index)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_from_index\n SearchIndex.delete_record(self)\n end",
"def delete_from_index\n SearchIndex.delete_record(self)\n end",
"def delete_document index, id\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_doc/#{id}\")\n req = Net::HTTP::Delete.new(uri)\n run(uri, req)\n end",
... | [
"0.7872329",
"0.7872329",
"0.76368904",
"0.7628255",
"0.75707453",
"0.753529",
"0.73901457",
"0.72586507",
"0.72125816",
"0.72034657",
"0.7194374",
"0.7166646",
"0.7152139",
"0.7092922",
"0.7088451",
"0.7081925",
"0.7057382",
"0.69845164",
"0.69702405",
"0.6965706",
"0.694521... | 0.76899254 | 2 |
Override to trigger dependent models to be reindexed, should return an array of models to run .update_in_index on. | def index_dependent_models
[]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_in_index\n __elasticsearch__.index_document\n\n index_dependent_models.map(&:update_in_index)\n end",
"def reindex(options = {})\n version = options.fetch(:version, :current)\n updated_after = options.fetch(:updated_after, {})\n Rails.application.eager_load! if define... | [
"0.80026114",
"0.6606336",
"0.6555497",
"0.6547541",
"0.64225525",
"0.637486",
"0.63058555",
"0.6191246",
"0.6093131",
"0.6049399",
"0.60274565",
"0.58736914",
"0.58485883",
"0.5825542",
"0.5805995",
"0.57466406",
"0.57359797",
"0.57359797",
"0.5695739",
"0.5646257",
"0.55837... | 0.7159479 | 1 |
Search the specified field for a match | def field_search(field, q, options={})
# Search for a match based on prefix or a string match as a backup
query = {
'bool' => {
'minimum_should_match' => 1,
'should' => [
{'prefix' => {field => q}},
{'match' => {field => q}}
]
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search(field, value)\n @rows.select {|row| get_variable(row, field).downcase == value.downcase}\n end",
"def find_by(field, value)\n @base.send('find_by_' + field, value)\n end",
"def search(records, field, criteria)\n records.select { |record| record[field] == criteria }... | [
"0.68972903",
"0.678904",
"0.67524",
"0.67034",
"0.6587151",
"0.6448331",
"0.6397797",
"0.63417494",
"0.6310424",
"0.6302159",
"0.6276021",
"0.6256991",
"0.6207925",
"0.6202676",
"0.61856836",
"0.6174738",
"0.61681485",
"0.61666954",
"0.6159139",
"0.61588144",
"0.610695",
"... | 0.721409 | 0 |
Execute a query hash in ElasticSearch | def query_search(query, options={})
run_query query, options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_query(query, options={})\n query = prepare_query query, options\n\n # Run the query\n response = self.__elasticsearch__.search query\n\n Hashie::Mash.new({\n records: response.records,\n total_entries: response.results.total\n })\n end",
"def run_... | [
"0.64678544",
"0.63897514",
"0.6310682",
"0.63063127",
"0.62367165",
"0.621879",
"0.61621904",
"0.6140587",
"0.60975003",
"0.60954255",
"0.6094708",
"0.60892636",
"0.6088106",
"0.6072499",
"0.60309774",
"0.5970738",
"0.595387",
"0.59528565",
"0.59323835",
"0.59227353",
"0.592... | 0.5895453 | 22 |
Private Methods Run a query hash in ElasticSearch | def run_query(query, options={})
query = prepare_query query, options
# Run the query
response = self.__elasticsearch__.search query
Hashie::Mash.new({
records: response.records,
total_entries: response.results.total
})
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def search\n\n # define the elasticsearch result \"size\" (limit)\n limit = params['limit'].to_i\n # define the elasticsearch result \"from\" (offset)\n offset = params['offset'].to_i\n # Pass through\n hack = params['hack']\n # Default output\n searchResults = ''\n # If we have filters,... | [
"0.67951715",
"0.67138463",
"0.6692617",
"0.6489539",
"0.648391",
"0.6402631",
"0.63912636",
"0.63809335",
"0.6371244",
"0.63253087",
"0.6157233",
"0.6127758",
"0.6123099",
"0.6115673",
"0.6082589",
"0.60728127",
"0.60671407",
"0.60497683",
"0.60481715",
"0.60407084",
"0.6038... | 0.6912933 | 0 |
sanitize query string for Lucene. Useful if the original query raises an exception due to invalid DSL parse. | def sanitize(q)
# Escape special characters
# http://lucene.apache.org/core/4_8_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description#Escaping_Special_Characters
escaped_characters = Regexp.escape('\\+-&|!(){}[]^~*?:\/')
q = q.gsub(/([#{escaped_char... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sanitize_query(q)\n return '' if q.nil?\n q.gsub(/\\s+/, ' ').gsub(/[^a-zA-Z 0-9\\*\\?'\\\"]/i, '?')\n end",
"def clean_query_string(q)\n ERB::Util.url_encode(q.gsub(/-|\\(|\\)|:/, \"\"))\n end",
"def sanitize(sanitize=true)\n self.query.sanitize = sanitize\n self\n end",
... | [
"0.74976784",
"0.66845554",
"0.65489334",
"0.6544331",
"0.63703036",
"0.63545144",
"0.6305875",
"0.62399507",
"0.61814445",
"0.6138866",
"0.6124209",
"0.6113268",
"0.61065865",
"0.6103726",
"0.6051869",
"0.5963916",
"0.5949201",
"0.5913767",
"0.5913767",
"0.5901934",
"0.58871... | 0.78661376 | 0 |
Prepare a query hash for ElasticSearch | def prepare_query(q_hash, options={})
terms = options.fetch(:terms, {})
limit = options.fetch(:limit, -1)
skip = options.fetch(:skip, -1)
order = options.fetch(:order, {})
# Load the query but don't return any field data since we don't need it
query = {
'fiel... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assemble_query(query_hash)\n key_values, query_map = build_key_values(query_hash)\n key_values.merge(\"-query\" => query_translate(array_mix(query_map)))\n end",
"def prep_query\n @options[:query]['region_id'] = @region_id if @region_id\n @options[:query]['state'] = @state if @state\... | [
"0.6657636",
"0.64480984",
"0.64376813",
"0.62665766",
"0.622618",
"0.62170714",
"0.60946506",
"0.60846287",
"0.6039062",
"0.60343003",
"0.6033652",
"0.60207164",
"0.5993325",
"0.5967071",
"0.59469855",
"0.5945662",
"0.59448963",
"0.5942173",
"0.5920074",
"0.59066314",
"0.588... | 0.64518785 | 1 |
Don't forget, you can make methods to make your life easy! | def mk_coupon_hash(c)
rounded_unit_price = (c[:cost].to_f * 1.0 / c[:num]).round(2)
{
:item => "#{c[:item]} W/COUPON",
:price => rounded_unit_price,
:count => c[:num]
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def who_we_are\r\n end",
"def suivre; end",
"def private; end",
"def how_it_works\r\n end",
"def schubert; end",
"def zuruecksetzen()\n end",
"def probers; end",
"def methods() end",
"def custom; end",
"def custom; end",
"def implementation; end",
"def implementation; end",
"def methods;... | [
"0.71165895",
"0.7012973",
"0.69752645",
"0.6920876",
"0.6821373",
"0.6807805",
"0.679579",
"0.66605073",
"0.6609081",
"0.6609081",
"0.6599811",
"0.6599811",
"0.6578475",
"0.6578475",
"0.6578475",
"0.6578475",
"0.65692586",
"0.65692586",
"0.65692586",
"0.65692586",
"0.6548028... | 0.0 | -1 |
A nice "First Order" method to use in apply_coupons | def apply_coupon_to_cart(matching_item, coupon, cart)
matching_item[:count] -= coupon[:num]
item_with_coupon = mk_coupon_hash(coupon)
item_with_coupon[:clearance] = matching_item[:clearance]
cart << item_with_coupon
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def order; end",
"def order; end",
"def first_order?\n self.order_num === 1\n end",
"def first; end",
"def first; end",
"def processOrder\n \n end",
"def order\n end",
"def install_order(arr)\n\nend",
"def order=(_arg0); end",
"def default; return DefaultOrder; end",
"def earliest!\n ... | [
"0.5941312",
"0.5941312",
"0.5814373",
"0.57416594",
"0.57416594",
"0.56944346",
"0.5616546",
"0.56127626",
"0.56087047",
"0.55292195",
"0.55064154",
"0.5490428",
"0.54683125",
"0.54475623",
"0.5427703",
"0.54255164",
"0.54026544",
"0.5383018",
"0.5383018",
"0.53810763",
"0.5... | 0.0 | -1 |
Don't forget, you can make methods to make your life easy! | def items_total_cost(i)
i[:count] * i[:price]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def who_we_are\r\n end",
"def suivre; end",
"def private; end",
"def how_it_works\r\n end",
"def schubert; end",
"def zuruecksetzen()\n end",
"def probers; end",
"def methods() end",
"def custom; end",
"def custom; end",
"def implementation; end",
"def implementation; end",
"def methods;... | [
"0.71157336",
"0.7013357",
"0.69749075",
"0.69198376",
"0.68212265",
"0.68083453",
"0.67951924",
"0.66612774",
"0.6608807",
"0.6608807",
"0.65997493",
"0.65997493",
"0.6579074",
"0.6579074",
"0.6579074",
"0.6579074",
"0.6568317",
"0.6568317",
"0.6568317",
"0.6568317",
"0.6548... | 0.0 | -1 |
Returns information about a product's pricing and options | def details
data = Storm::Base::SODServer.remote_call '/Product/details',
:code => @code
self.from_hash data
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pricing\n request('pricing', :get)\n end",
"def product_price_details\n {:currency => 'EUR', :price => price}\n end",
"def product_info\n {\n product_name: {\n default_value: 'similarity detection reference tool'\n },\n product_version: '1.0',\n description: {\n ... | [
"0.7411729",
"0.71958095",
"0.6848395",
"0.68344593",
"0.679317",
"0.6767781",
"0.6726655",
"0.6719021",
"0.66110903",
"0.65399194",
"0.653437",
"0.64653534",
"0.6455096",
"0.6367996",
"0.6362918",
"0.634817",
"0.62701416",
"0.62650603",
"0.62539333",
"0.62383366",
"0.6234065... | 0.59448636 | 41 |
This is mostly defined as a separate method so that we can catch it being called from within rspec tests. | def handle_emit_exception(e)
RailsPipeline.logger.error("Error during emit(): #{e}")
puts e.backtrace.join("\n")
raise e # this probably isn't going anywhere BTW
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def spec; end",
"def spec; end",
"def verify_stubbed_calls; end",
"def expected_method; end",
"def self_test; end",
"def self_test; end",
"def ignore_unexpected_calls!\n return if @ignoring_unexpected_calls # do it once!\n\n @ignoring_unexpected_calls = true\n\n def self.method_missing(sym, *a... | [
"0.64169234",
"0.64169234",
"0.6335622",
"0.62818366",
"0.6168866",
"0.6168866",
"0.6138308",
"0.6134362",
"0.6073191",
"0.6065263",
"0.60537094",
"0.60356826",
"0.5992046",
"0.5992046",
"0.5967638",
"0.58970404",
"0.58901787",
"0.58889574",
"0.5848297",
"0.58448184",
"0.5822... | 0.0 | -1 |
Get pub/sub topic name to which changes to this model will be published | def topic_name(version="1_0")
return "harrys-#{Rails.env}-v#{major(version)}-#{table_name}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def topic\n @topic.to_s\n end",
"def topic\n return @topic\n end",
"def topic\n @_topic ||= request.env['loudmouth_map'][:topic_model].singularize.downcase\n end",
"def topic\n return @topic\n end",
"def topic\n ... | [
"0.7606316",
"0.73472583",
"0.72841966",
"0.7268738",
"0.7268738",
"0.7217053",
"0.69816154",
"0.6940967",
"0.68310535",
"0.68010956",
"0.67356896",
"0.6708951",
"0.6604084",
"0.6589858",
"0.65544194",
"0.64270866",
"0.6370025",
"0.63316643",
"0.6323007",
"0.63205314",
"0.629... | 0.63122755 | 20 |
Get the major version number from a "1_1" style major/minor version string | def major(version)
if version.include? '_'
major, _ = version.split('_', 2)
else
major = version
end
return major
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def major_version\n version.match(/(\\d\\.\\d)/)[0] if name.is_a? String\n end",
"def major_version(version = nil)\n version ||= installed_version?\n return \"0\" if version.nil?\n\n version.sub(/(\\.\\d+)+$/, '')\n end",
"def major(version)\n res = 0\n res = Regexp.last_match(1... | [
"0.8207271",
"0.7986395",
"0.79068166",
"0.7669902",
"0.74915874",
"0.7473114",
"0.7305747",
"0.72741026",
"0.72741026",
"0.72741026",
"0.7155101",
"0.70178777",
"0.6950608",
"0.69086623",
"0.68697447",
"0.685392",
"0.67660445",
"0.674636",
"0.66941214",
"0.66525346",
"0.6572... | 0.84629554 | 0 |
Executes block and collects GC statistics during the block execution. Collected stats are printed to stdout (or to the file set in $RUBY_GC_DATA_FILE env var): allocated memory size (in KB) during block execution number of memory allocations during block execution number of GC collections during block execution time (i... | def gc_statistics(description = "", options = {})
#do nothing if we don't have patched Ruby GC
yield and return unless GC.respond_to? :enable_stats
GC.enable_stats || GC.clear_stats
GC.disable if options[:disable_gc]
yield
stat_string = description + ": "
stat_string += "allocated: #{GC.a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def profile_gc\n GC.start\n before = GC.stat(:total_freed_objects)\n yield\n GC.start\n after = GC.stat(:total_freed_objects)\n\n puts \"Objects Freed: #{after - before}\"\n # print \";#{after - before}\"\n end",
"def gc_bench\n asym = :total_allocated_objects\n csym = :count\n\n GC.star... | [
"0.689785",
"0.65107095",
"0.6203202",
"0.61820596",
"0.611012",
"0.6075999",
"0.59965223",
"0.5991316",
"0.5991316",
"0.5927411",
"0.5832568",
"0.5811299",
"0.5704191",
"0.5661653",
"0.5654021",
"0.56477785",
"0.56195146",
"0.554268",
"0.5538469",
"0.54971206",
"0.5486728",
... | 0.73482245 | 0 |
Needed to access the attribute from the linkedlist class | def initialize(value = nil, next_node = nil)
@next_node = next_node
@value = value
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attribute; end",
"def attr; end",
"def trail\n attribute_get(:linkname)\n end",
"def attribute(name); end",
"def attr_list\n\t\ta_list \n\tend",
"def att... | [
"0.68520373",
"0.68520373",
"0.68520373",
"0.68520373",
"0.68520373",
"0.68520373",
"0.68520373",
"0.66711795",
"0.63874936",
"0.63520837",
"0.63110614",
"0.6304548",
"0.6242464",
"0.6242464",
"0.61602545",
"0.61602545",
"0.6058598",
"0.60133404",
"0.60133404",
"0.5957095",
"... | 0.0 | -1 |
TODO: print out build command line if no args provided. | def show_usage
STDERR.puts "\nusage: ./build [ profile=<name> ] [ --minify ]"
STDERR.puts "\nsupported profiles are:"
Dir.chdir(PROFILE_PATH) do
STDERR.puts Dir['*.js'].map {|profile| "\t#{profile.sub(/\.js/, '')}"}
end
STDERR.puts "\nIf no profile is selected, 'core' will be used\n\n"
exit(1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def usage()\n puts \"usage: ruby build.rb [verbose] [clean] [rebuild] \"\n puts \" [keepSource] [-buildType=[debug|release|all]\"\n puts \" build.rb clean will just clean artifacts and exit\"\n exit -1\nend",
"def _build_command\n use_pipefail = false # debug option\n _asse... | [
"0.70588523",
"0.6706524",
"0.6652348",
"0.66314375",
"0.6592496",
"0.6566255",
"0.652619",
"0.65217817",
"0.6493607",
"0.64672375",
"0.6461881",
"0.6433425",
"0.6409706",
"0.6333187",
"0.62778354",
"0.6205242",
"0.6160402",
"0.608921",
"0.6082007",
"0.607671",
"0.60715353",
... | 0.580554 | 46 |
has n, :disorder, 'Disorder', :parent_key=>[:disorder_id] has n, :disorder_values, 'DisorderValue', :child_key => [:aasequence_id], :parent_key =>[:id] has 1, :xdet, 'Xdet', :child_key => :aasequence_id has 1, :conseq, 'Conseq', :child_key => :aasequence_id | def calculate_intra_consensus_value
count=0
if IntraResidueContact.all(:seq_id => self.seq_id, :first_residue=>self.original_position) || IntraResidueContact.all(:seq_id => self.seq_id, :second_residue=>self.original_position)
count +=1
end
#if !Conseq.first(:aasequence_id => self.AAsequence_id).n... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def children_table; end",
"def child_relation; end",
"def child_keys() []; end",
"def child_exam_paper_structures\n exam_paper_structures.where(level: 1).order(\"order_index ASC\")\n end",
"def has_many_identities(assoc, options={})\r\n fk = options[:foreign_key] || :\"#{model_name.to_s.underscor... | [
"0.5494254",
"0.54810244",
"0.52725565",
"0.50830287",
"0.5051331",
"0.49993297",
"0.49510726",
"0.49499288",
"0.49257338",
"0.49237293",
"0.4917477",
"0.49033493",
"0.4884771",
"0.48671502",
"0.48424217",
"0.48424217",
"0.48424217",
"0.48424217",
"0.48424217",
"0.48424217",
... | 0.0 | -1 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.