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
Sets the MTUs for this VLANs.
def set_mtu(opts) opts = check_params(opts,[:mtus]) super(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def SetMtu(node)\n\t@interfaces.each do |ifn|\n\t self.GetGroupInterface(node, ifn).mtu=\"1528\"\n\tend\n end", "def SetMtu(node)\n @rstack.SetMtu(node)\n end", "def mti=(mti)\n validator = EnumAttributeValidator.new('String', [\"0100\", \"0120\", \"0200\"])\n unless validator.valid?(mti)\n ...
[ "0.57524985", "0.57125205", "0.5089353", "0.49055326", "0.4809779", "0.46781787", "0.46781787", "0.46313825", "0.45997128", "0.45847508", "0.45086566", "0.45039102", "0.44807643", "0.44807643", "0.4465888", "0.4455266", "0.44248164", "0.44182155", "0.44173896", "0.44060814", ...
0.49763003
4
Sets the the source checking states for this VLANs. If enabled and auto lasthop is disabled, check that the source of the first packet of a connection is correct (correct VLAN, router, node). This is equivalent to BSD's net.inet.sourcecheck sysctl variable.
def set_source_check_state(opts) opts = check_params(opts,[:states]) super(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_check_source_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end", "def source_check_state\n super\n end", "def check_source_state\n super\n end", "def set_source_interface(name = 'Vxlan1', opts = {})\n commands = command_builder('vxlan source-int...
[ "0.6762547", "0.60307753", "0.5692701", "0.56040984", "0.54006916", "0.53888077", "0.5177032", "0.512024", "0.5015896", "0.4943069", "0.49320355", "0.49155912", "0.49133372", "0.49016485", "0.4837418", "0.48176342", "0.48176342", "0.47626108", "0.4740771", "0.4729829", "0.471...
0.6682239
1
Sets the tag ids for this VLANs. Note: Currently (9.4.0+), this method is not supported; delete and recreate the VLAN instead.
def set_vlan_id(opts) opts = check_params(opts,[:vlan_ids]) super(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_ids=(list)\n tags.clear\n for id in list\n tags << Tag.find(id) if !id.empty?\n end\n end", "def set_tags(tags)\n self.tags = tags.map.each do |tag|\n Tag.find_or_create_by_name tag\n end\n end", "def set_tags(tags)\n @tags.update(tags)\n end", "def set_tag_ids nids...
[ "0.6666377", "0.65961194", "0.65618086", "0.6528188", "0.64253235", "0.63076854", "0.6159115", "0.61554724", "0.61131644", "0.606299", "0.606299", "0.6050458", "0.6012209", "0.59292305", "0.5891107", "0.58254653", "0.5809939", "0.5797764", "0.579429", "0.5775195", "0.57750696...
0.5832389
16
start of add to cart logic
def add # we need the id of the product to be added # lets get it now id = params[:id] # if the cart exists already use it if not make a new one if session[:cart] then cart = session[:cart] else session[:cart] = {} cart = session[:cart] end # If the product is in the cart then increase the existing quantity by 1 if cart[id] then cart[id] = cart[id] + 1 # this is the actual increase quantity part else cart[id] = 1 end redirect_to :action => :index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addtocart\n\t\tinsidecart<< createproduct\n\t\taddtocart\n\tend", "def add_to_cart (data)\n added = false\n data.each do |product_data|\n products = product_data[:product]\n if products != nil\n @browser.goto(@custom_base_url + products[:url])\n products[:attributes...
[ "0.7329773", "0.7258752", "0.72487384", "0.71752805", "0.7087249", "0.70594704", "0.70543087", "0.6980003", "0.6963486", "0.69622844", "0.69042856", "0.69042856", "0.68763524", "0.68760014", "0.6867254", "0.6861381", "0.68447375", "0.6841856", "0.67821884", "0.6746519", "0.67...
0.6698859
21
Start of index logic
def index # this method will pass the content of the cart to the page view if session[:cart] then @cart = session[:cart] # if session exists the pass cart contents to the cart view else @cart = {} # if the cart isnt a session the say the cart contents is empty end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_index\n end", "def index ; @index ; end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def index\r\n @index ||= 0\r\n end", "def start_pass(index)\n end", "def index_from_start(index); end", "def index\n @index ||= 1\n end", "def start_index(...
[ "0.7182834", "0.7143137", "0.6997526", "0.67670715", "0.67556", "0.67477393", "0.670621", "0.67032975", "0.6649499", "0.65923375", "0.6587755", "0.65256107", "0.64987653", "0.6378591", "0.6364617", "0.6360411", "0.6356636", "0.6314522", "0.6292073", "0.6280942", "0.6229948", ...
0.0
-1
Method to Clear the cart
def clearCart #sets session variable to nil and bring back to index session[:cart] = nil redirect_to :action => :index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_cart\n update_cart({})\n end", "def cart_clear\n cc = CartClear.new\n cc.params.merge!( { 'CartId' => @cart_id, 'HMAC' => @hmac } )\n cart = search( cc, @rg ).cart_clear_response.cart\n @cart_items = []\n @saved_for_later_items = []\n end", "def clear_cart(cart)\n ...
[ "0.8819012", "0.8553298", "0.8390226", "0.82448417", "0.79037595", "0.786143", "0.78293514", "0.77930176", "0.7726829", "0.7568193", "0.7566522", "0.7531423", "0.7531423", "0.7506985", "0.74822944", "0.741013", "0.7387313", "0.7352283", "0.73231196", "0.73229116", "0.729534",...
0.7407915
16
GET /fingers/1 GET /fingers/1.xml
def show @finger = Finger.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @finger } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friends(id)\n friends_data(request(\"users/friends/#{id}.xml\", :auth => true))\n end", "def create\n @finger = Finger.new(params[:finger])\n @finger.user = current_user\n \n respond_to do |format|\n if @finger.save\n flash[:notice] = 'Finger was successfully created.'\n ...
[ "0.6058822", "0.57901186", "0.5787219", "0.5698869", "0.5647543", "0.56392294", "0.5624455", "0.5605942", "0.5587766", "0.5496254", "0.54085344", "0.53884786", "0.53834164", "0.5379891", "0.53256345", "0.5324248", "0.5319311", "0.53118926", "0.530363", "0.5297249", "0.5291596...
0.70847297
0
GET /fingers/new GET /fingers/new.xml
def new @finger = Finger.new @finger.user = current_user respond_to do |format| format.html # new.html.erb format.xml { render :xml => @finger } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @finger = Finger.new(params[:finger])\n @finger.user = current_user\n \n respond_to do |format|\n if @finger.save\n flash[:notice] = 'Finger was successfully created.'\n format.html { redirect_to(fingers_path) }\n format.xml { render :xml => @finger, :status => :...
[ "0.68037736", "0.6724813", "0.6646627", "0.6530833", "0.64731985", "0.64006215", "0.6397397", "0.63782346", "0.6364024", "0.6330678", "0.63297874", "0.6315338", "0.62802935", "0.6279807", "0.6256123", "0.62546724", "0.6254477", "0.62474364", "0.6228865", "0.6226489", "0.61872...
0.72824943
0
POST /fingers POST /fingers.xml
def create @finger = Finger.new(params[:finger]) @finger.user = current_user respond_to do |format| if @finger.save flash[:notice] = 'Finger was successfully created.' format.html { redirect_to(fingers_path) } format.xml { render :xml => @finger, :status => :created, :location => @finger } else format.html { render :action => "new" } format.xml { render :xml => @finger.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @finger = Finger.find(params[:id])\n @finger.user = current_user\n respond_to do |format|\n if @finger.update_attributes(params[:finger])\n flash[:notice] = 'Finger was successfully updated.'\n format.html { redirect_to(fingers_path) }\n format.xml { head :ok }\n ...
[ "0.55039704", "0.54251176", "0.5343005", "0.53175426", "0.5239797", "0.5229069", "0.52240103", "0.51637775", "0.51343894", "0.5091505", "0.5073883", "0.5017746", "0.49986044", "0.4991063", "0.49683544", "0.49375308", "0.4926145", "0.48768073", "0.4848334", "0.4847382", "0.484...
0.68211067
0
PUT /fingers/1 PUT /fingers/1.xml
def update @finger = Finger.find(params[:id]) @finger.user = current_user respond_to do |format| if @finger.update_attributes(params[:finger]) flash[:notice] = 'Finger was successfully updated.' format.html { redirect_to(fingers_path) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @finger.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @finger = Finger.new(params[:finger])\n @finger.user = current_user\n \n respond_to do |format|\n if @finger.save\n flash[:notice] = 'Finger was successfully created.'\n format.html { redirect_to(fingers_path) }\n format.xml { render :xml => @finger, :status => :...
[ "0.59614885", "0.58890104", "0.58790255", "0.56750077", "0.5599315", "0.55899286", "0.55658597", "0.5400704", "0.5395109", "0.5373981", "0.5366468", "0.52468497", "0.5245675", "0.5244778", "0.52437353", "0.5215326", "0.51994777", "0.51800364", "0.51800364", "0.51800364", "0.5...
0.68502283
0
DELETE /fingers/1 DELETE /fingers/1.xml
def destroy @finger = Finger.find(params[:id]) @finger.destroy respond_to do |format| format.html { redirect_to(fingers_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def delete!\n Recliner.delete(uri)\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", ...
[ "0.642467", "0.64239526", "0.6389003", "0.63723946", "0.63683456", "0.6359452", "0.6331855", "0.625638", "0.6209855", "0.61830294", "0.6177054", "0.61646986", "0.6144835", "0.6133123", "0.6133123", "0.6133123", "0.6133123", "0.6133123", "0.6133123", "0.6133123", "0.60908574",...
0.7430854
0
Select options for category. def self.options_for_category categories = Category.find_by_depth 0 options = [] categories.each do |c| options.push [c.name, c.id] end end
def initialize(params = {}) super self.is_valid = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_category_select_options(c, level=0)\n retval = []\n retval << [('-' * level) + c.name, c.id]\n c.categories.each do |child_c|\n get_category_select_options(child_c, level + 1).each do |child_c|\n retval << child_c\n end\n end\n \n return retval\n end", "def category_op...
[ "0.7796857", "0.77922636", "0.7529909", "0.75153494", "0.7115543", "0.6840263", "0.68027747", "0.66743714", "0.6530413", "0.6508157", "0.6504777", "0.6503056", "0.64708847", "0.6403975", "0.6292927", "0.6205291", "0.6193125", "0.6134755", "0.6130949", "0.6122616", "0.60541445...
0.0
-1
Main entry point Requires a Time object and a parameter Hash, currently :format Returns an array of sound files with the requested output Example: sound_files_for_time(Time.now, format: "dMYaHm" format: h: 12h hour H: 24h hour m: minutes s: seconds d: day in number w: weekday name M: month name Y: year as "twenty twelve" p: AM or PM indicator a: the "at" word
def sounds_for_time(time, args={}) format = args.delete(:format) || 'dMYaHm' result = [] format.each_char do |c| result += send("parse_#{FORMAT_TABLE[c]}".to_sym, time) end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n file = \"english.srt\"\n times = parse_times file\n build_ffmpeg times, file\nend", "def file_for_day(day)\n sound_path(\"day-#{day}.ul\")\n end", "def collectFileInformation(tracks, flavor, startTimes, real_start_time)\n startTimes.each do |file|\n pathToFile = File.join(file[\"...
[ "0.61816245", "0.5397976", "0.538732", "0.52377385", "0.5225956", "0.51569784", "0.512419", "0.509282", "0.50804037", "0.5053026", "0.5043899", "0.5036145", "0.49884212", "0.4984467", "0.49619898", "0.4961411", "0.49398535", "0.49191245", "0.49179387", "0.49104792", "0.488077...
0.7513356
0
Returns the sounds for the single digits composing a number
def sounds_for_digits(num) result = [] num.to_s.each_char do |c| result << sound_path("#{c}.ul") end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sounds_for_number(number)\n number = number.to_i\n result = []\n thousands = (number / 1000).floor\n if thousands > 0\n result << \"#{thousands}.ul\" << \"thousand.ul\"\n end\n rest = number % 1000\n hundreds = (rest / 100).floor\n if hundreds > 0\n result ...
[ "0.78654265", "0.5743771", "0.5627809", "0.562216", "0.56200093", "0.5618234", "0.5611642", "0.559557", "0.5577491", "0.5554955", "0.5546062", "0.55415964", "0.55395436", "0.5508156", "0.55058163", "0.5505423", "0.5496334", "0.5474896", "0.5428884", "0.542052", "0.54169273", ...
0.8130094
0
Parses an "h" character from the main methods Returns the time in AM time.
def parse_hour_12h(time) sounds_for_number(time.strftime("%l")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def H; cat @time.strftime('%H') end", "def parse_hour_24h(time)\n sounds_for_number(time.strftime(\"%k\"))\n end", "def hour() time[0] end", "def handle_hh_mm\n handle_sign\n @tzhour = @tokens[@index].get_tag(ScalarHour).type\n next_tag\n next_tag\n @tzminute = @tokens[@index...
[ "0.7094211", "0.7090618", "0.6903488", "0.668905", "0.657391", "0.6550515", "0.64884627", "0.64142066", "0.6390568", "0.6379535", "0.6333664", "0.6332102", "0.63174045", "0.6297677", "0.627675", "0.62738585", "0.6267137", "0.625339", "0.62307733", "0.6205075", "0.61759114", ...
0.7338429
0
Parses an "H" character from the main methods Returns the time in 24 time.
def parse_hour_24h(time) sounds_for_number(time.strftime("%k")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_hour_12h(time)\n sounds_for_number(time.strftime(\"%l\"))\n end", "def H; cat @time.strftime('%H') end", "def hour() time[0] end", "def handle_hh_mm\n handle_sign\n @tzhour = @tokens[@index].get_tag(ScalarHour).type\n next_tag\n next_tag\n @tzminute = @tokens[@index...
[ "0.752976", "0.7320571", "0.68377846", "0.6787406", "0.6606236", "0.6604363", "0.65456736", "0.65254277", "0.64779127", "0.64444906", "0.63874817", "0.6375319", "0.6333604", "0.6297861", "0.62934923", "0.6269661", "0.62559444", "0.62559444", "0.6208015", "0.6201986", "0.61660...
0.7876351
0
Parses a "Y" character from the main methods Returns the numbers for the year in 4 digit format
def parse_year(time) year = time.strftime("%Y").to_i sounds_for_number(year / 100) + sounds_for_number(year % 100) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def year_via_ruby_parsing\n return unless orig_date_str =~ /\\d\\d/ # need at least 2 digits\n # need more in string than only 2 digits\n return if orig_date_str.match(/^\\d\\d$/) || orig_date_str.match(/^\\D*\\d\\d\\D*$/)\n return if orig_date_str =~ /\\d\\s*B.C./ # skip B.C. dates\n\n...
[ "0.72254795", "0.72176564", "0.69198483", "0.6898048", "0.68305844", "0.6799728", "0.6704873", "0.6701607", "0.66917324", "0.6677889", "0.66488624", "0.65660197", "0.65653646", "0.6564055", "0.6554773", "0.6543124", "0.6520513", "0.64829516", "0.6468795", "0.6465047", "0.6464...
0.6511989
17
Parses an "M" character from the main methods Returns the month in an array.
def parse_month(time) [file_for_month(time.strftime("%-m"))] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def roman_month(date)\n date[1]\n end", "def months_as_array\n (1..12).map {|m| [Date::MONTHNAMES[m]]}\n end", "def month\n @month ||= Date::ABBR_MONTHNAMES.index(@md[1])\n end", "def month_array\r\n\t\t[[\"January\", \"1\"],[\"February\", \"2\"], \r\n\t\t[\"March\", \"3\"],[\"April\"...
[ "0.7245807", "0.712635", "0.70139784", "0.70082116", "0.6973466", "0.6808378", "0.67515224", "0.6545827", "0.65232563", "0.64642924", "0.64642924", "0.64196014", "0.6395765", "0.6393626", "0.6390436", "0.63685083", "0.63532376", "0.6275884", "0.6272925", "0.6265755", "0.62456...
0.773772
0
Parses a "d" character from the main methods Returns the numbers for the day.
def parse_day(time) sounds_for_number(time.strftime("%-d")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_day(day)\n '%.2d' % day.to_i\n end", "def handle_dn\n @wday = Date::DAYS[@tokens[@index].get_tag(DayName).type]\n @index += 1\n @precision = :day\n end", "def parse_dob(dob)\n LineParser.dob(dob.split('/').map(&:to_i))\n end", "def ord(day)\n\nend", "def parse_dob(do...
[ "0.65706754", "0.64472526", "0.59283096", "0.59272754", "0.5918117", "0.5857765", "0.5746278", "0.572903", "0.56919897", "0.56760955", "0.5639098", "0.5585565", "0.55712116", "0.5556135", "0.55493206", "0.5548936", "0.5515986", "0.5499876", "0.54895705", "0.54888123", "0.5487...
0.70314485
0
Parses a "w" character from the main methods Returns the weekday sound.
def parse_weekday(time) [file_for_day(time.strftime("%w"))] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hackerSpeak(word)\n\tnew_word=''\n\tword.each_char do |c|\n\t\tif c.downcase=='a'\n\t\t\tnew_word=new_word+'4'\n\t\telsif c.downcase=='e'\n\t\t\tnew_word=new_word+'3'\n\t\telsif c.downcase=='i'\n\t\t\tnew_word=new_word+'1'\n\t\telsif c.downcase=='o'\n\t\t\tnew_word=new_word+'0'\n\t\telsif c.downcase=='s'\n\t\t...
[ "0.5982429", "0.59736145", "0.5855363", "0.5843768", "0.5716571", "0.5656632", "0.5634727", "0.56127197", "0.5593326", "0.55864394", "0.5586208", "0.55794543", "0.5547098", "0.55291426", "0.5528946", "0.5461002", "0.5454875", "0.54478186", "0.5430737", "0.5403627", "0.5400925...
0.63193196
0
Parses a "m" character from the main methods Returns the numbers for the minutes
def parse_minutes(time) minutes = time.strftime("%M").to_i minutes == 0 ? [sound_path("oclock.ul")] : sounds_for_number(minutes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minutes\n _nudge[1]\n end", "def parse_ms(with_hour: false)\n s0 = @scanner.pos\n s1 = match_digits!\n if s1 == :failed\n @scanner.pos = s0\n s0 = :failed\n elsif match_str(':') != :failed\n s3 = match_digits!\n if s3 == :failed\n ...
[ "0.691876", "0.6805741", "0.6769295", "0.6769295", "0.6556016", "0.6504679", "0.64736044", "0.6459606", "0.64034283", "0.6396048", "0.63351774", "0.62757033", "0.62239575", "0.6200673", "0.6146094", "0.61390084", "0.60862774", "0.6086245", "0.604878", "0.60487", "0.60487", ...
0.69660586
0
Parses a "s" character from the main methods Returns the numbers for the seconds
def parse_seconds(time) sounds_for_number(time.strftime("%S")) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ReturnSeconds(value)\n result = value.split(/m|s/)\n result = result[0].to_i*60 + result[1].to_i\n return result\nend", "def parse_time(str)\n seconds = 0\n str.scan(/\\d+ *[Dd]/).each { |m| seconds += (m.to_i * 24 * 60 * 60) }\n str.scan(/\\d+ *[Hh]/).each { |m| seconds += (m.to_i * 60 * 60) ...
[ "0.67289317", "0.6694145", "0.65751565", "0.6459403", "0.6431439", "0.6426587", "0.64001393", "0.6386974", "0.63670474", "0.6365357", "0.63624674", "0.6318847", "0.6223675", "0.6223675", "0.6223207", "0.621081", "0.620728", "0.62024933", "0.6200599", "0.6153995", "0.6150515",...
0.7095934
0
Parses a "p" character Returns AM or PM sound files
def parse_am_pm(time) time.strftime("%P") == "am" ? [sound_path("a-m.ul")] : [sound_path("p-m.ul")] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pbResolveAudioFile(str,volume=nil,pitch=nil)\n if str.is_a?(String)\n str=pbStringToAudioFile(str)\n str.volume=100\n str.volume=volume if volume\n str.pitch=100\n str.pitch=pitch if pitch\n end\n if str.is_a?(RPG::AudioFile)\n if volume || pitch\n return RPG::AudioFile.new(str.name,\...
[ "0.545785", "0.5429428", "0.5306381", "0.51962537", "0.5174581", "0.5147074", "0.5139501", "0.5045755", "0.5045755", "0.5045755", "0.5045554", "0.49954948", "0.49948603", "0.49886262", "0.49773237", "0.4969655", "0.49572945", "0.49486795", "0.49465916", "0.49029744", "0.49014...
0.69330776
0
Parses a "a" character Returns a "at" connection
def parse_at(time) [sound_path("at.ul")] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_at\n handle_possible(KeywordAt)\n handle_possible(SeparatorSpace)\n end", "def at!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 13 )\n\n type = AT\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block...
[ "0.621177", "0.599837", "0.5931464", "0.5674014", "0.5480492", "0.5431964", "0.53873646", "0.5372693", "0.53620714", "0.53377485", "0.52892685", "0.5274857", "0.52484465", "0.5240651", "0.52216977", "0.5214317", "0.5210502", "0.5205227", "0.5204377", "0.5193749", "0.51816493"...
0.52507824
12
Expects days from 0 to 6 where 0 is Sunday and 6 is Monday
def file_for_day(day) sound_path("day-#{day}.ul") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getSundays(d1,d2)\n d1 += 1 while (d1.wday != 0) # add days till starting on sunday\n sundays = []\n d1.step(d2,7) do |date| # move forward seven days for every sunday\n sundays .push date\n end\n sundays\nend", "def day_of_week\n dnum = day\n dnum -= 10 if dnum > 20\n dnum -= 10...
[ "0.7296824", "0.7263616", "0.72486085", "0.72068954", "0.7170879", "0.70695835", "0.70674956", "0.7059349", "0.70462614", "0.70386064", "0.70087373", "0.68912864", "0.68820775", "0.6865934", "0.6821711", "0.67912763", "0.6769885", "0.6732758", "0.67214394", "0.67014956", "0.6...
0.0
-1
Expects months from 1 to 12 where 1 is January. Files are actually numbered 0 to 11
def file_for_month(month) sound_path("mon-#{month.to_i - 1}.ul") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def month() end", "def parse_month(time)\n [file_for_month(time.strftime(\"%-m\"))]\n end", "def test_yearly_by_month_loop\n parse(\n 'FREQ=YEARLY;INTERVAL=1;UNTIL=20120203T225959Z;BYMONTH=2;BYSETPOS=1;BYDAY=SU,MO,TU,WE,TH,FR,SA',\n '2012-01-01 15:45:00',\n [\n ...
[ "0.6761202", "0.6733385", "0.6453396", "0.64510095", "0.6442446", "0.6442446", "0.6424039", "0.64170146", "0.6395089", "0.6323511", "0.63121873", "0.6304579", "0.62960637", "0.622856", "0.62112343", "0.6204197", "0.61971813", "0.6192324", "0.6183922", "0.6172286", "0.61657554...
0.6318267
10
Breaks a number down into components. Supports numbers up to 9999
def sounds_for_number(number) number = number.to_i result = [] thousands = (number / 1000).floor if thousands > 0 result << "#{thousands}.ul" << "thousand.ul" end rest = number % 1000 hundreds = (rest / 100).floor if hundreds > 0 result << "#{hundreds}.ul" << "hundred.ul" end rest = rest % 100 if rest <= 19 result << "#{rest}.ul" else tens = (rest / 10).floor units = rest % 10 result << "#{tens}0.ul" result << "#{units}.ul" if units > 0 end result.map {|r| sound_path(r) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splitNumber(val)\n\tresArr = []\n\twhile(val >= 1)\n\t\tresArr.push(val % 10)\n\t\tval = val / 10\n\tend\n\tresArr\nend", "def over_ten_split(number)\n return (number - 10).succ\nend", "def split_number(start)\r\r\n number = []\r\r\n number[0] = start / 1000 / 1000\r\r\n number[1] = start / 1000 ...
[ "0.7093631", "0.6990583", "0.6944445", "0.6906978", "0.6652212", "0.65960974", "0.65678585", "0.6559207", "0.654048", "0.6493624", "0.64903283", "0.64801943", "0.6449086", "0.6442826", "0.6417926", "0.6390654", "0.638116", "0.63810146", "0.63440937", "0.6342555", "0.633736", ...
0.0
-1
Gets the path for a sound file based on configuration and platform
def sound_path(name) multi_path(File.join(Adhearsion.config.ahnsay.sounds_dir, name)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_sound_source(type)\r\n sound = nil\r\n case type\r\n when :play_fitbell\r\n sound = File.join(get_resource_path, \"sound/fitebell.wav\")\r\n when :play_ba\r\n sound = File.join(get_resource_path, \"sound/ba.wav\")\r\n when :play_click4\r\n sound = File.join(get_res...
[ "0.7387547", "0.7022132", "0.6817764", "0.6745143", "0.6715965", "0.66164345", "0.6444321", "0.64136654", "0.64128417", "0.63787866", "0.63623923", "0.63603956", "0.63603956", "0.63603956", "0.6144198", "0.6126113", "0.6100045", "0.6086465", "0.6079731", "0.6026207", "0.60101...
0.7876083
0
Massages the file path depending on platform
def multi_path(path) path = path.chomp(File.extname(path)) if Adhearsion.config.punchblock.platform == :asterisk path = "file://" + path if Adhearsion.config.punchblock.platform == :xmpp path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform_specific_path(path)\n if RUBY_PLATFORM =~ /mswin|mingw|windows/\n system_drive = ENV['SYSTEMDRIVE'] ? ENV['SYSTEMDRIVE'] : \"\"\n path = win_slashify File.join(system_drive, path.split('/')[2..-1])\n end\n\n path\n end", "def normalized...
[ "0.7331798", "0.72073436", "0.6935914", "0.6927264", "0.691679", "0.6883882", "0.6883882", "0.68559873", "0.677458", "0.67641944", "0.67495286", "0.661395", "0.65997154", "0.6599325", "0.6585143", "0.65736735", "0.65606916", "0.65409684", "0.6539794", "0.651637", "0.6430668",...
0.0
-1
By default, you don't need this. Use it only if you have runtime initialization for your backend.
def initialize( options = {} ) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def backend; end", "def backends; end", "def initialize\n super(true)\n end", "def backend=(backend); end", "def at_init\n\n\t\tend", "def init\n\n end", "def init\n end", "def init\n end", "def init\n end", "def configured?; false; end", "def post_init\n end", "def auto_in...
[ "0.6971646", "0.6675645", "0.64763564", "0.64736176", "0.64511555", "0.6395973", "0.63322014", "0.63322014", "0.63322014", "0.6324129", "0.6271202", "0.6258255", "0.6210659", "0.6200997", "0.6200997", "0.6200997", "0.6200997", "0.61937296", "0.6186925", "0.6179913", "0.617297...
0.0
-1
Accepts the standard Resumator hash and outputs as plain text
def process( resume, options = {} ) text = "" text += process_personal( resume["personal"] ) text += process_experience( resume["experience"] ) text += process_skills( resume["skills"] ) text += process_education( resume["education"] ) text += process_hobbies( resume["hobbies"] ) text += process_footer( resume["footer"] ) return text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rehash\n raw \"REHASH\\r\\n\"\n end", "def get_hash(input)\n return $hasher.reset.update(input).to_s\nend", "def block_hash\n\t\tdigest = Digest::SHA2.new\n\n\t\tdigest << '%d' % [ self.index ]\n\t\tdigest << self.timestamp.strftime( '%s%N' )\n\t\tdigest << self.payload\n\t\tdigest << self.pay...
[ "0.6588555", "0.6174179", "0.6158154", "0.60514134", "0.59609103", "0.59609103", "0.59427434", "0.58217037", "0.58217037", "0.58217037", "0.58171684", "0.57874036", "0.57632124", "0.5688378", "0.5659628", "0.56579304", "0.5650635", "0.5650635", "0.55849665", "0.55849665", "0....
0.0
-1
for distance_attempt logic, there are certain 'states' that a competitor can get into
def triple_fault? Rails.cache.fetch("#{distance_attempt_cache_key_base}/triple_fault") do df = false if distance_attempts.count > 2 if distance_attempts[0].fault? && distance_attempts[1].fault? && distance_attempts[2].fault? if distance_attempts[0].distance == distance_attempts[1].distance && distance_attempts[1].distance == distance_attempts[2].distance df = true end end end df end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_state # {{{\n\n player_moves = []\n ki_moves = []\n\n player_moves = self.get_moves_as_hash true\n ki_moves = self.get_moves_as_hash false\n\n return WON if has_winning_combination player_moves\n return LOST if has_winning_combination ki_moves\n\n return DRAWN if player_moves.coun...
[ "0.64507663", "0.5898442", "0.5871546", "0.586736", "0.586736", "0.586736", "0.58284676", "0.5805894", "0.578024", "0.5776026", "0.564541", "0.5641445", "0.5616097", "0.56159776", "0.560865", "0.55902314", "0.55793357", "0.5564589", "0.5541524", "0.5535891", "0.55353767", "...
0.0
-1
1. For each cohort, display the cohort name and the amount of students like so. It's probably best that you create a method.
def display_list(students) students.each { |key, value| puts "#{key}: #{value} students" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cohort_list(list)\n\tlist.each do |cohort, num_of_students|\n\t\tputs \"#{cohort}: has #{num_of_students} students\"\n\tend\nend", "def display(students)\n students.each {|cohort, number_of_students| puts \"#{cohort}: #{number_of_students} students\"}\n end", "def print_by_cohort\n cohorts = []\n @stud...
[ "0.81365526", "0.79392177", "0.7832763", "0.77592695", "0.77164316", "0.76646787", "0.7601162", "0.75691086", "0.7547328", "0.74216574", "0.7371336", "0.73452514", "0.7343272", "0.7287619", "0.72631973", "0.7256217", "0.72309494", "0.72196174", "0.7211941", "0.7198243", "0.71...
0.0
-1
If optional block is given, it will be passed to the child class implementation of 'send'. The implementation can execute the block on a response to the published message
def publish(message, destination, code = nil, &blk) payload, sender = Gilmour::Protocol.create_request(message, code) send(sender, destination, payload, &blk) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_action &block\n @actions[:send] = block\n end", "def send msg\n @sending_socket.send(msg)\n\n if block_given? || @handler\n messages = response\n if !messages.nil?\n messages.each do |message|\n if block_given?\n yield me...
[ "0.6838609", "0.6531437", "0.651162", "0.64760154", "0.6300031", "0.62360877", "0.6232462", "0.6215255", "0.61379206", "0.61042744", "0.60513896", "0.60513896", "0.59684205", "0.5950558", "0.5918244", "0.5917582", "0.58880275", "0.58837336", "0.58770597", "0.5855661", "0.5843...
0.0
-1
Para imagenes almacenadas en la dase de datos
def blob_to_base64 (photo) #Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista return "data:image/jpeg;base64," + [photo].pack('m0') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_img\n\n end", "def images; end", "def add_image \n image = CARMD.image(self.vin)\n if image == \"\"\n image = \"http://clipart-library.com/img/2050778.png\"\n end\n self.auto_image = image \n self.save \n end", "def set_imagen\n @objeto = Imagen.find(params[...
[ "0.66399646", "0.6350283", "0.62796783", "0.62576264", "0.6131364", "0.6124412", "0.6090842", "0.60895085", "0.6042777", "0.60396785", "0.6012288", "0.59984326", "0.5988628", "0.5968303", "0.59598863", "0.5958608", "0.59576374", "0.5951554", "0.5935682", "0.5888274", "0.58622...
0.0
-1
Para imagenes almacenadas en disco
def file_to_base64 (photo) puts [photo].pack('m0') #Convierte de formato '/xFF' a Base64 para poder mostrar la foto en la vista return [photo].pack('m0') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_img\n\n end", "def sepia\n @photo = Photo.find(params[:id])\n img = Magick::Image.read('public' + @photo.attachment_url).first\n img = img.sepiatone()\n img.write('public' + @photo.attachment_url)\n end", "def images; end", "def charcoal\n @photo = Photo.find(params[:id])\n img ...
[ "0.66818684", "0.667384", "0.65921867", "0.64820796", "0.64053124", "0.63101983", "0.6294972", "0.61342466", "0.6120463", "0.61008704", "0.6095081", "0.6049432", "0.6048877", "0.60488236", "0.60479033", "0.60139465", "0.5942776", "0.5942776", "0.5932586", "0.5929353", "0.5882...
0.0
-1
Fuerza formato de fecha a "dd/mm/yyyy"
def format_date (date) return date.strftime("%d/%m/%Y") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_format t\n t.strftime \"%Y/%m/%d\"\n end", "def formatted_date(dt, format=\"%m/%d/%Y\")\n\t\tDate.strptime(dt, '%Y-%m-%d').strftime(format)\n\tend", "def date_format(date)\n\t if date\n\t date.strftime(\"%d/%m/%Y\")\n\t end\n\tend", "def format_date date\n date.strftime('%m/%d/%y')\n end...
[ "0.80554336", "0.80394876", "0.8025067", "0.7958487", "0.7909312", "0.786111", "0.78589314", "0.7852065", "0.7852065", "0.78196454", "0.7747431", "0.76876646", "0.76876646", "0.76657945", "0.7649918", "0.75773305", "0.75295556", "0.75099784", "0.742877", "0.7363715", "0.73434...
0.80143774
3
will always be a positive integer and return its additive persistence which is the number of times you must add the digits in num until you reach a single digit. For example: if num is 2718 then your program should return 2 because 2 + 7 + 1 + 8 = 18 and 1 + 8 = 9 and you stop at 9.
def AdditivePersistence(num) # code goes here sum = 0 count = 0 until num < 10 num1 = num.to_s sum = 0 for i in 0..num1.length-1 sum += num1[i].to_i end num = sum count += 1 end return count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AdditivePersistence(num)\n addv_pers = 0\n until num < 10\n num = num.digits.sum\n addv_pers += 1\n end\n addv_pers\nend", "def AdditivePersistence(num)\n count = 0\n\n while num > 9\n num = num.to_s.split(\"\").map{|i| i.to_i}.inject(:+)\n count += 1\n end\n\n count\nend", "def additiv...
[ "0.84167403", "0.80365", "0.77320504", "0.7713103", "0.7605349", "0.74756783", "0.7138025", "0.7126007", "0.70803404", "0.7049356", "0.70313007", "0.7028427", "0.7020832", "0.69682056", "0.69554216", "0.69242376", "0.6908651", "0.69063514", "0.6901997", "0.6889966", "0.685747...
0.8045087
1
GET /projects GET /projects.json
def index @completed_projects = Project.where(status: "completed").order("id ASC") @development_projects = Project.where(status: "in_development").order("id ASC") @tools = Tool.all.order("id ASC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listprojects\n get('listprojects.json')['projects']\n end", "def list\n get 'projects'\n end", "def projects\n request(method: 'getAllProjects')\n end", "def projects\n resource 'projects'\n end", "def projects(params = {})\n make_get_request('/account/projects', params)\n e...
[ "0.8574897", "0.8386689", "0.8355737", "0.8062607", "0.80368364", "0.8002139", "0.78593457", "0.7834634", "0.78324", "0.7799698", "0.77792805", "0.7748103", "0.77139485", "0.7700251", "0.7696023", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", "0.7695487", ...
0.0
-1
GET /projects/1 GET /projects/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n...
[ "0.78697544", "0.7698408", "0.7680339", "0.7613705", "0.75337136", "0.7525879", "0.7493363", "0.7493363", "0.7493363", "0.7493363", "0.7493363", "0.7493363", "0.7493363", "0.74931365", "0.7483965", "0.74803555", "0.7446126", "0.7429718", "0.74231553", "0.7414986", "0.7385634"...
0.0
-1
POST /projects POST /projects.json
def create @project = Project.new(project_params) respond_to do |format| if @project.save format.html { redirect_to projects_url, notice: 'Project was successfully created.' } format.json { render :show, status: :created, location: @project } else format.html { render :new } format.json { render json: @project.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new...
[ "0.7338948", "0.73139244", "0.7308003", "0.7299582", "0.7227503", "0.7225945", "0.71982473", "0.71170384", "0.7104803", "0.7095263", "0.7070636", "0.70408624", "0.70358187", "0.7024969", "0.70191896", "0.7009597", "0.698481", "0.697517", "0.6963753", "0.6963096", "0.6948756",...
0.0
-1
PATCH/PUT /projects/1 PATCH/PUT /projects/1.json
def update respond_to do |format| if @project.update(project_params) format.html { redirect_to projects_url, notice: 'Project was successfully updated.' } format.json { render :show, status: :ok, location: @project } else format.html { render :edit } format.json { render json: @project.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n render json: { errors: @project.errors.messages }, status: 200\n end\n end", "def update\n authorize! :update, @project\n\n if @project.update(project_params)\n head :no_content\n else\...
[ "0.70004326", "0.69119745", "0.6911138", "0.6889052", "0.6888448", "0.6878091", "0.68675476", "0.6857582", "0.685334", "0.685334", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68503886", "0.68...
0.0
-1
DELETE /projects/1 DELETE /projects/1.json
def destroy @project.destroy respond_to do |format| format.html { redirect_to projects_url, notice: 'Project was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.78951", "0.78593713", "0.7778056", "0.7771693", "0.77585995", "0.7730887", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77305084", "0.77244985", "0.7718401", "0.7718401", "0.7718401", "0.7718401", "0.7704753", "0.7704753", "0.7704753", "0.7704753", "0.7704753...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def project_params params.require(:project).permit(:name, :link, :status, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /transactions GET /transactions.json
def index @transactions = Transaction.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end", "def index\n @transactions = Transaction.all\n render json: @transactions\n end", "def all_transactions\n json_respo...
[ "0.8164624", "0.796332", "0.77854896", "0.7751081", "0.7728147", "0.7706774", "0.7691088", "0.7651612", "0.7590682", "0.7567767", "0.7548055", "0.751779", "0.75108814", "0.745996", "0.745996", "0.745996", "0.73983127", "0.7326831", "0.7299761", "0.7288485", "0.7288485", "0....
0.71780056
38
Use callbacks to share common setup or constraints between actions.
def set_transaction @transaction = Transaction.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
Scopes Events are active in system
def event_is_active_in_system all_active_events = Event.active.all.map{|e| e.id} unless all_active_events.include?(self.event_id) errors.add(:event_id, "is not an event in the system") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relevant_events_scope\n events\n end", "def relevant_events_scope\n raise NotImplementedError\n end", "def security_events\r\n SecurityEventsController.instance\r\n end", "def owned_events\n events\n end", "def update_global_common_events\n end", "def scopes; end", "def eve...
[ "0.71159434", "0.6445648", "0.606313", "0.605266", "0.6001098", "0.59904516", "0.5957228", "0.5957228", "0.59446734", "0.58913046", "0.5879322", "0.58706236", "0.58559", "0.58559", "0.57529557", "0.57418567", "0.5719775", "0.5719775", "0.5719775", "0.5719775", "0.5719775", ...
0.6197051
2
This method is called from the controller and takes care of the converting
def convert self.convert! success = system(convert_command) if success && $?.exitstatus == 0 self.converted! else self.failure! end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def convert\n end", "def convert\n end", "def converter\n\n end", "def converter; end", "def converter\n end", "def converters; end", "def converters; end", "def converters; end", "def convert\n raise NotImplementedError\n end", "def convert\n self.class.convert(obj...
[ "0.7285119", "0.7285119", "0.71368337", "0.7098768", "0.69031525", "0.68040794", "0.68040794", "0.68040794", "0.6360806", "0.6340408", "0.62317955", "0.6169485", "0.61558396", "0.61440164", "0.6098372", "0.5980671", "0.5941152", "0.5931265", "0.5876375", "0.5876375", "0.58240...
0.0
-1
GET /baz94s or /baz94s.json
def index @baz94s = Baz94.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(path, **args); end", "def get(url); end", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.json/\", args)\nend", "def get_json(state, city)\n HTTParty.get(\"http://api.wunderground.com/api/b0938627f87459c4/conditions/q/#{state}/#{city}.json\").parsed_response\nend", "def api_get url_...
[ "0.59387445", "0.5847188", "0.58247334", "0.57786256", "0.5737403", "0.57197505", "0.5716548", "0.57077134", "0.57044905", "0.570096", "0.56855375", "0.56599784", "0.5635169", "0.5595904", "0.5588284", "0.5588284", "0.55799794", "0.5576235", "0.5576235", "0.5562615", "0.55599...
0.0
-1
GET /baz94s/1 or /baz94s/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get(path, **args); end", "def get_aos_version_by_name(args = {}) \n get(\"/aosversions.json/version/#{args[:aosVersionName]}\", args)\nend", "def get_aos_version(args = {}) \n get(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def list_active_aos_versions(args = {}) \n get(\"/aosversions.jso...
[ "0.61163443", "0.601992", "0.6006613", "0.5934813", "0.5895519", "0.58394986", "0.57932687", "0.57771736", "0.57751614", "0.57751614", "0.57601815", "0.57549846", "0.57033354", "0.56991506", "0.569339", "0.56845844", "0.5681865", "0.5628445", "0.5628445", "0.56201816", "0.561...
0.0
-1
POST /baz94s or /baz94s.json
def create @baz94 = Baz94.new(baz94_params) respond_to do |format| if @baz94.save format.html { redirect_to @baz94, notice: "Baz94 was successfully created." } format.json { render :show, status: :created, location: @baz94 } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @baz94.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(path, **args); end", "def post_api(path, params={}, headers={})\n headers.merge!('CONTENT_TYPE' => \"application/json\")\n post path, params, headers\nend", "def post_json(path, body)\n uri = build_uri(path)\n puts \"*** POST #{path}\"\n puts JSON.pretty_generate(body)\n\n post_request = Net::HT...
[ "0.64013207", "0.5949766", "0.59155756", "0.5894378", "0.5884103", "0.58840513", "0.5849608", "0.5824947", "0.580368", "0.58030397", "0.5791843", "0.5787716", "0.5742922", "0.5733129", "0.57226634", "0.57186973", "0.57102036", "0.5671748", "0.5663848", "0.56458706", "0.563845...
0.5480952
51
PATCH/PUT /baz94s/1 or /baz94s/1.json
def update respond_to do |format| if @baz94.update(baz94_params) format.html { redirect_to @baz94, notice: "Baz94 was successfully updated." } format.json { render :show, status: :ok, location: @baz94 } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @baz94.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def update_aos_version(args = {}) \n id = args['id']\n temp_path = \"/aosversions.json/{aosVersionId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"aosversionId\")\n args.delete(key)\n path = temp_pat...
[ "0.6465599", "0.6313394", "0.63052225", "0.6287115", "0.62198776", "0.61856407", "0.61634755", "0.6151888", "0.6110573", "0.6004204", "0.60037816", "0.60013103", "0.5904396", "0.5904396", "0.5883331", "0.58516693", "0.5843176", "0.58250463", "0.5802294", "0.57998407", "0.5798...
0.58031523
18
DELETE /baz94s/1 or /baz94s/1.json
def destroy @baz94.destroy respond_to do |format| format.html { redirect_to baz94s_url, notice: "Baz94 was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete(*rest) end", "def test_delete_preconditions_failed\n request = Http::Request.new(\n 'DELETE',\n '/file1',\n 'If-Match' => \"\\\"#{Digest::MD5.hexdigest('bar')}\\\...
[ "0.6852052", "0.68285906", "0.66160333", "0.6586017", "0.6498215", "0.64959764", "0.64631444", "0.6461559", "0.6442501", "0.6442501", "0.64055824", "0.6384943", "0.63474727", "0.6335707", "0.6322956", "0.629167", "0.62751585", "0.6246913", "0.62424093", "0.6237382", "0.622487...
0.6089383
49
Use callbacks to share common setup or constraints between actions.
def set_baz94 @baz94 = Baz94.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
Only allow a list of trusted parameters through.
def baz94_params params.require(:baz94).permit(:foo1, :foo2, :foo3, :foo4, :foo5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.6950644", "0.68134046", "0.68034387", "0.6796522", "0.674668", "0.6742105", "0.6527854", "0.65214247", "0.6491907", "0.64294493", "0.64294493", "0.64294493", "0.64004904", "0.6356768", "0.63556653", "0.6348119", "0.6344521", "0.63386923", "0.632588", "0.632588", "0.632588"...
0.0
-1
Send User Emails This endpoint allows you to send a specific email to a user without waiting for or triggering a workflow.
def users_send_emails(user_id, content_type, accept, opts = {}) users_send_emails_with_http_info(user_id, content_type, accept, opts) return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email_to_user(user)\n if user.email && user.unsubscribed == false\n Email.create(:user_id => user.id, :message_id => self.id).deliver\n end\n end", "def send_message_email\n requires_user_can :edit, task\n users = User.where(email: params[:recipients])\n sent_to_users = []\n user...
[ "0.7328401", "0.7301532", "0.72548413", "0.71371895", "0.70754546", "0.6987976", "0.68541324", "0.6754346", "0.67339224", "0.6732289", "0.6706497", "0.66701245", "0.6641125", "0.66058356", "0.65567493", "0.65544844", "0.65449476", "0.64953226", "0.6487775", "0.6452408", "0.64...
0.6379936
26
Send User Emails This endpoint allows you to send a specific email to a user without waiting for or triggering a workflow.
def users_send_emails_with_http_info(user_id, content_type, accept, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: UsersApi.users_send_emails ..." end # verify the required parameter 'user_id' is set if @api_client.config.client_side_validation && user_id.nil? fail ArgumentError, "Missing the required parameter 'user_id' when calling UsersApi.users_send_emails" end # verify the required parameter 'content_type' is set if @api_client.config.client_side_validation && content_type.nil? fail ArgumentError, "Missing the required parameter 'content_type' when calling UsersApi.users_send_emails" end # verify the required parameter 'accept' is set if @api_client.config.client_side_validation && accept.nil? fail ArgumentError, "Missing the required parameter 'accept' when calling UsersApi.users_send_emails" end # resource path local_var_path = "/users/{user_id}/emails".sub('{' + 'user_id' + '}', user_id.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) header_params[:'Content-Type'] = content_type header_params[:'Accept'] = accept header_params[:'x-org-id'] = opts[:'x_org_id'] if !opts[:'x_org_id'].nil? # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(opts[:'body']) auth_names = ['x-api-key'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names) if @api_client.config.debugging @api_client.config.logger.debug "API called: UsersApi#users_send_emails\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email_to_user(user)\n if user.email && user.unsubscribed == false\n Email.create(:user_id => user.id, :message_id => self.id).deliver\n end\n end", "def send_message_email\n requires_user_can :edit, task\n users = User.where(email: params[:recipients])\n sent_to_users = []\n user...
[ "0.73295754", "0.73010355", "0.72570384", "0.71389556", "0.7077985", "0.6990391", "0.6855618", "0.6755134", "0.67348456", "0.67340934", "0.6705783", "0.66735274", "0.6644495", "0.66064894", "0.6556347", "0.65561265", "0.6546647", "0.64954424", "0.648944", "0.6453129", "0.6450...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = @current_user 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
filter the counts based on the user id set produces a new array of just the matched items if the user id filter is nil we match all the form of the input data is expected to be: [[user_id, cohort], ...] we sum up the count of matching user_ids into their cohort bucket
def sum_cohorts(users) sums = [] # initialize the expected number of cohorts (1..current_cohort).each do |cohort| sums[cohort] = 0 end users.each do |user| user_id = user[0] cohort = user[1] sums[cohort] = 0 if sums[cohort].nil? if match_user_id?(user_id) sums[cohort] += 1 end end return sums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cohorts_query_in(db, proc)\n sums = []\n # initialize the expected number of cohorts\n (1..current_cohort).each do |cohort|\n sums[cohort] = 0\n end\n\n if !@user_ids.nil?\n # build our user ids\n total_ids = @user_ids.length\n count = 0\n stmt = \"\"\n @user_ids.ea...
[ "0.6179814", "0.5751907", "0.55744034", "0.5488608", "0.5350726", "0.5249186", "0.52092034", "0.52043134", "0.5147224", "0.5118692", "0.51013154", "0.5058948", "0.50578564", "0.50486875", "0.5045273", "0.5021556", "0.5004701", "0.49844268", "0.4980961", "0.49513242", "0.49374...
0.7025142
0
run the query and add the users found as filters expects you to select and return only the user_ids
def add_users_query(db, proc) # since we are running a query, no longer match all even if it returns nothing ensure_user_ids sql = proc.call(date_first, date_last) results = db.execute(sql) # this form expects to see multiple result rows results.each do |r| user_id = r[0].to_i add_user_id(user_id) unless user_id == 0 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_users_id_from_query\n if query_is_mifare_number?\n find_users_from :card\n else\n found_user_ids = Set.new\n\n USER_SOURCES_PRIORITY.each do |source|\n if found_user_ids.size < USER_COUNT_SEARCH_LIMIT\n found_user_ids.merge(find_users_from source)\n end\n e...
[ "0.6915241", "0.6782004", "0.672524", "0.6550564", "0.649576", "0.6495702", "0.64841604", "0.6448145", "0.6443397", "0.6428057", "0.6426304", "0.63817537", "0.6351607", "0.63441473", "0.6334755", "0.63304937", "0.62921053", "0.62809527", "0.6263903", "0.6253346", "0.62506497"...
0.6664304
3
run the cohorts query, this expects you to return: [[user_id, cohort],...] user_id, cohort from the select and will be filtered against any previous add_users_query calls to effectively limit the results by filtering various conditions together once complete, we return with a single array that contains the cohort counts in the given cohort array position you should iterate assuming a start index of 1 up to the length
def cohorts_query_local_merge(db, proc) sql = proc.call(date_first, date_last) results = db.execute(sql) sums = sum_cohorts(results) save_sums(sums) return sums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cohorts_query_in(db, proc)\n sums = []\n # initialize the expected number of cohorts\n (1..current_cohort).each do |cohort|\n sums[cohort] = 0\n end\n\n if !@user_ids.nil?\n # build our user ids\n total_ids = @user_ids.length\n count = 0\n stmt = \"\"\n @user_ids.ea...
[ "0.7172977", "0.69906735", "0.69260067", "0.6465127", "0.6220563", "0.59685946", "0.59039056", "0.5900638", "0.5892886", "0.58772135", "0.5847169", "0.5719657", "0.56540424", "0.5615155", "0.5587426", "0.55198336", "0.54967433", "0.54714143", "0.54251933", "0.54024667", "0.54...
0.49077365
47
This form of query expects you to provide summarized results When we run the query we expect to get back results of: [[cohort, count], ...] we then record the sums in the rollup result table
def cohorts_query(db, proc) sums = [] # initialize the expected number of cohorts (1..current_cohort).each do |cohort| sums[cohort] = 0 end sql = proc.call(date_first, date_last) results = db.execute(sql) results.each do |r| cohort = r[0] sum = r[1] sums[cohort] = 0 if sums[cohort].nil? sums[cohort] += sum end save_sums(sums) return sums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_cohorts(users)\n sums = []\n # initialize the expected number of cohorts\n (1..current_cohort).each do |cohort|\n sums[cohort] = 0\n end\n\n users.each do |user|\n user_id = user[0]\n cohort = user[1]\n sums[cohort] = 0 if sums[cohort].nil?\n if match_user_id?(user_i...
[ "0.6110699", "0.60947895", "0.5991278", "0.5985832", "0.5840837", "0.57941365", "0.57623947", "0.5734036", "0.56640846", "0.55760056", "0.55481046", "0.55356014", "0.5510348", "0.5414227", "0.5407771", "0.540386", "0.5400838", "0.5367653", "0.5350469", "0.5318325", "0.5241472...
0.70358753
0
Run a cohorts_query derived from the current user_ids that have been added formed into a set that can be used in an IN clause. We actually break the set up into multiple parts in case we have a very large number of ids. We then sum the cohorts from the multiple calls, and report them the query must return results as [[cohort, sum],...] This call is similar the to plain cohorts_query except it filters against the user ids that have been added to the manager
def cohorts_query_in(db, proc) sums = [] # initialize the expected number of cohorts (1..current_cohort).each do |cohort| sums[cohort] = 0 end if !@user_ids.nil? # build our user ids total_ids = @user_ids.length count = 0 stmt = "" @user_ids.each do |user_id| if count % IN_CLAUSE_MAX == 0 stmt << "(#{user_id}" else stmt << ",#{user_id}" end count += 1 if (count % IN_CLAUSE_MAX == 0) || (count == total_ids) # hit max batch size or last batch, submit the query stmt << ")" sql = proc.call(date_first, date_last, stmt) stmt = "" results = db.execute(sql) results.each do |r| cohort = r[0] sum = r[1] sums[cohort] = 0 if sums[cohort].nil? sums[cohort] += sum end end end end save_sums(sums) return sums end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_cohorts(users)\n sums = []\n # initialize the expected number of cohorts\n (1..current_cohort).each do |cohort|\n sums[cohort] = 0\n end\n\n users.each do |user|\n user_id = user[0]\n cohort = user[1]\n sums[cohort] = 0 if sums[cohort].nil?\n if match_user_id?(user_i...
[ "0.6177951", "0.6114492", "0.52603155", "0.5226534", "0.5221034", "0.5028796", "0.50081253", "0.49946836", "0.4981251", "0.49521142", "0.49093488", "0.48550412", "0.48397872", "0.48375145", "0.48262027", "0.48130345", "0.47871277", "0.47742367", "0.47499028", "0.4749216", "0....
0.7764512
0
GET /black_fridays GET /black_fridays.json
def index @black_fridays = BlackFriday.paginate(:page => params[:page], :per_page => 10) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fridays = Friday.all\n end", "def show\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @closing_day }\n end\n end", "def index\n @holidays = Holiday.all\n\n respond_to do |format|\n ...
[ "0.63019675", "0.57668734", "0.57145727", "0.57114524", "0.5696606", "0.5683033", "0.56441444", "0.564085", "0.5618594", "0.56143415", "0.5519595", "0.550131", "0.54865074", "0.54823333", "0.54411155", "0.5439421", "0.54295236", "0.5393427", "0.5368539", "0.53629714", "0.5327...
0.64573187
0
GET /black_fridays/1 GET /black_fridays/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @fridays = Friday.all\n end", "def index\n @black_fridays = BlackFriday.paginate(:page => params[:page], :per_page => 10)\n end", "def show\n @closing_day = ClosingDay.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cl...
[ "0.63799", "0.6347761", "0.6135369", "0.6039325", "0.59884185", "0.59607416", "0.59281063", "0.58689964", "0.5863545", "0.5834585", "0.5786008", "0.5695188", "0.56912804", "0.56861067", "0.56544393", "0.56332445", "0.56255835", "0.5618451", "0.5614231", "0.5608541", "0.560724...
0.0
-1
POST /black_fridays POST /black_fridays.json
def create @black_friday = BlackFriday.new(black_friday_params) respond_to do |format| if @black_friday.save format.html { redirect_to @black_friday, notice: 'Black friday was successfully created.' } format.json { render :show, status: :created, location: @black_friday } else format.html { render :new } format.json { render json: @black_friday.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @friday = Friday.new(friday_params)\n\n respond_to do |format|\n if @friday.save\n format.html { redirect_to @friday, notice: \"Friday was successfully created.\" }\n format.json { render :show, status: :created, location: @friday }\n else\n format.html { render :n...
[ "0.64180404", "0.586408", "0.5675287", "0.566221", "0.5656307", "0.5606775", "0.5582695", "0.5578594", "0.5558162", "0.5536122", "0.55284905", "0.5519413", "0.54999155", "0.548241", "0.54597807", "0.5457774", "0.5438455", "0.54267293", "0.5408235", "0.54040164", "0.53981847",...
0.6805994
0
PATCH/PUT /black_fridays/1 PATCH/PUT /black_fridays/1.json
def update respond_to do |format| if @black_friday.update(black_friday_params) format.html { redirect_to @black_friday, notice: 'Black friday was successfully updated.' } format.json { render :show, status: :ok, location: @black_friday } else format.html { render :edit } format.json { render json: @black_friday.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @friday.update(friday_params)\n format.html { redirect_to @friday, notice: \"Friday was successfully updated.\" }\n format.json { render :show, status: :ok, location: @friday }\n else\n format.html { render :edit, status: :unprocessable_ent...
[ "0.6534209", "0.6212672", "0.6169254", "0.61150664", "0.6111235", "0.61073947", "0.60652864", "0.60615295", "0.6045077", "0.60324526", "0.6021983", "0.6021285", "0.6003562", "0.59936595", "0.59888697", "0.592375", "0.5914209", "0.59090865", "0.5907867", "0.5885865", "0.588226...
0.6813972
0
DELETE /black_fridays/1 DELETE /black_fridays/1.json
def destroy @black_friday.destroy respond_to do |format| format.html { redirect_to black_fridays_url, notice: 'Black friday was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @friday.destroy\n respond_to do |format|\n format.html { redirect_to fridays_url, notice: \"Friday was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @weekday = Weekday.find(params[:id])\n @weekday.destroy\n\n respond_to do |...
[ "0.67711014", "0.6717281", "0.6709792", "0.66702175", "0.66188335", "0.66172785", "0.66040945", "0.66011256", "0.65438354", "0.6541761", "0.65403503", "0.65228885", "0.6511923", "0.6509053", "0.6505492", "0.64925", "0.6491775", "0.64911705", "0.6463169", "0.6442766", "0.64415...
0.69452596
0
Use callbacks to share common setup or constraints between actions.
def set_black_friday @black_friday = BlackFriday.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 black_friday_params params.require(:black_friday).permit(:user_id, :product_id, :gender, :age, :occupation, :city_category, :stay_in_current_city_years, :marital_status, :product_category_1, :product_category_2, :product_category_3, :purchase) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
METHOD: initialise word game INPUT: secret word as string OUTPUT: WordGame instance
def initialize(secret) @secret = secret @guess_count = secret.length @word_state = ["_"] * secret.length @guesses = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(secret_word)\n puts \"Initializing game for new secret word...\"\n @secret_word = secret_word\n @current_state = \"\"\n secret_word.length.times { @current_state << \"_\" }\n @prev_guesses = []\n @available_guesses = secret_word.length\n @is_over_won = false\n end", "def init...
[ "0.79163533", "0.78474665", "0.7480395", "0.7479263", "0.7434373", "0.73875904", "0.72949153", "0.71076715", "0.71025366", "0.70366204", "0.70168674", "0.7016486", "0.70108616", "0.7005909", "0.69748276", "0.6970804", "0.6965631", "0.69593126", "0.69578195", "0.69392616", "0....
0.69524336
19
METHOD: check if guess correct INPUT: guessed letter as string OUTPUT: true or false
def guess_correct?(guess) @secret.include? guess end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess(letter)\n is_letter = /^[a-zA-Z]$/\n if letter.nil? or letter.empty? or not letter.match(is_letter)\n throw ArgumentError \n end\n letter.downcase!\n if self.guesses.include? letter or self.wrong_guesses.include? letter\n return false\n end\n if self.word.include? letter\n ...
[ "0.83395875", "0.8311119", "0.8305276", "0.8293208", "0.8265234", "0.82490057", "0.82372975", "0.81611437", "0.8147528", "0.8065921", "0.80438083", "0.80395985", "0.8036576", "0.7993273", "0.7969394", "0.79674435", "0.79671854", "0.79646635", "0.7919829", "0.7909802", "0.7906...
0.0
-1
METHOD: check if guess duplicated INPUT: guessed letter as string OUTPUT: true or false
def duplicate?(guess) @guesses.include? guess end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeated_guess?\r\n if @guessed_letters.include? @letter\r\n puts \"You have already guessed the letter #{@letter}, try again.\"\r\n return true\r\n end\r\n end", "def already_guessed? (letter)\r\n letter = letter.downcase\r\n @guessed_letters.include? letter\r\n end", "d...
[ "0.860954", "0.8222383", "0.8098351", "0.8065002", "0.8008855", "0.79772484", "0.7969457", "0.7907627", "0.7902701", "0.7871664", "0.7828328", "0.7823834", "0.7818478", "0.7795849", "0.77946335", "0.7787985", "0.7772331", "0.7746675", "0.77443296", "0.77425915", "0.7737831", ...
0.7403021
52
METHOD: add guess to tracked guesses if not duplicated INPUT: guessed letter as string OUTPUT: array of tracked guesses
def add_guess(guess) duplicate?(guess) ? @guesses : @guesses << guess end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_guess\n @guess = @guess.map!.with_index do |character, index|\n @word.downcase[index] == @letter ? @word[index] : character\n end\n end", "def guess_letters(letter)\n @guesses << letter\n @guesses\nend", "def letter_guessed(user_guess)\n\t\tif @guessed_letters.length == 0\n\t\t\t@guess...
[ "0.792962", "0.78505254", "0.7769422", "0.74021506", "0.7317234", "0.72854877", "0.7260846", "0.7251099", "0.7188374", "0.7187443", "0.7175978", "0.71673495", "0.71298856", "0.71237457", "0.71142584", "0.71006775", "0.7081098", "0.70733905", "0.70709395", "0.70657134", "0.702...
0.6910815
30
METHOD: update remaining guess count INPUT: N/A OUTPUT: integer of remaining guesses
def update_guess_count @guess_count > 0 ? @guess_count -= 1 : @guess_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guess_count\n\t\t @number_of_guesses -= 1\n\tend", "def increment_guess_count(current_guess_count)\n\tcurrent_guess_count += 1\nend", "def total_guess_count()\r\n\t\t# TODO: fill in method body\r\n\t\treturn -1\r\n\tend", "def increment_guess_count(guesses_made)\n guesses_made = guesses_made + 1\nend", ...
[ "0.7759731", "0.73455924", "0.7324958", "0.73007137", "0.7288633", "0.7288633", "0.7223735", "0.7216042", "0.7200896", "0.71794975", "0.69632095", "0.6962135", "0.6941786", "0.6849557", "0.6814378", "0.66789806", "0.6602662", "0.65936023", "0.65774333", "0.6550532", "0.651826...
0.79700905
0
METHOD: display word state INPUT: N/A OUTPUT: word state as string
def display_word_state @word_state.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_state_of_word()\r\n\r\n wordString = \"\"\r\n\r\n for i in 0..@secretWordLength-1 do\r\n\r\n key = @secretWord[i]\r\n\r\n if @lettersGuessed[key] == true \r\n wordString += key\r\n elsif @lettersGuessed[key] == false\r\n wordString += \"_ \" ...
[ "0.662951", "0.6614449", "0.65313107", "0.6524054", "0.6500809", "0.6387393", "0.6297495", "0.62627405", "0.62448466", "0.6211618", "0.61427057", "0.6130881", "0.6130296", "0.61248255", "0.6119928", "0.61089206", "0.61068046", "0.61050934", "0.6091142", "0.6081492", "0.607822...
0.79703206
0
METHOD: update word state with most recently added guess INPUT: N/A OUTPUT: updated word state
def update_word_state @secret.chars.each_with_index do |letter, idx| @word_state[idx] = letter if @guesses[-1] == letter end @word_state end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_game_state guess\n\t\tif @word.include?(guess)\n\t\t\t@hits << guess\n\t\telse\n\t\t\t@misses << guess\n\t\t\t@guesses_left -= 1\n\t\tend\n\tend", "def update_current_state(guess)\n start = 0\n while (i = @secret_word.index(guess, start)) != nil\n @current_state[i] = guess\n start = i ...
[ "0.7802108", "0.77900094", "0.74261653", "0.7343291", "0.7308614", "0.6945857", "0.6909196", "0.69077325", "0.6874585", "0.68211114", "0.6700159", "0.6661162", "0.657755", "0.6571838", "0.6571573", "0.64858186", "0.64727396", "0.64715916", "0.646832", "0.64497477", "0.6428058...
0.77347606
2
a simple filter to keep web crawlers from triggering this needlessly
def check_magic_token params[:magic_token] == Rails.application.secrets.salesforce_magic_token end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_filter; end", "def filter_redirect; end", "def filter_redirect; end", "def unfiltered_content; end", "def unfiltered_content; end", "def unfiltered_content; end", "def filter_cache; end", "def _filters_halted() \"<html><body><h1>Filter Chain Halted!</h1></body></html>\" end", "def bef...
[ "0.65347165", "0.6523866", "0.6523866", "0.6503984", "0.6503984", "0.6503984", "0.6278043", "0.62743187", "0.621413", "0.6175442", "0.6121482", "0.6115001", "0.6115001", "0.60824484", "0.59973884", "0.59973884", "0.59602416", "0.595875", "0.59543383", "0.5939358", "0.58930075...
0.0
-1
GET /friendships GET /friendships.json
def index @friendships = Friendship.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @friendships }\n end\n end", "def friendships_show(options = {})\n @req.get(\"/1.1/friendships/show.json\", options)\n end", "def show\n @friend...
[ "0.7930787", "0.7711196", "0.75130063", "0.7359897", "0.7359897", "0.73134756", "0.7235248", "0.7098102", "0.70333683", "0.6989055", "0.69784063", "0.6882203", "0.6827199", "0.6778252", "0.67537236", "0.67537236", "0.6712055", "0.6704092", "0.66797566", "0.6663811", "0.663125...
0.6882189
16
GET /friendships/1 GET /friendships/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @friendship }\n end\n end", "def index\n @friendships = @user.friendships\n\n respond_to do |format|\n format.html # index.html.erb\n ...
[ "0.7787635", "0.7707509", "0.7389193", "0.719965", "0.719965", "0.71584564", "0.71584564", "0.7076224", "0.6984562", "0.69049644", "0.6683278", "0.6682108", "0.6682108", "0.6682108", "0.6682108", "0.6678331", "0.6654447", "0.6641869", "0.65554625", "0.65029025", "0.64925325",...
0.0
-1
POST /friendships POST /friendships.json
def create if params[:status] == "pending" arefriends = Friendship.where(:user_id => params[:user_id], :friend_id => params[:friend_id]) if arefriends.empty? @friendship = current_user.friendships.build(:friend_id => params[:friend_id], :status => params[:status]) friend = User.find(params[:friend_id]) @friendship2 = friend.friendships.build(:friend_id => params[:user_id], :status => 'requested') respond_to do |format| if @friendship.save format.html { redirect_to connections_user_path(current_user), notice: 'Your Connection Request has been sent' } format.json { render action: 'show', status: :created, location: @friendship } else format.html { render action: 'new' } format.json { render json: @friendship.errors, status: :unprocessable_entity } end if @friendship2.save format.html { redirect_to @friendship2, notice: 'You received a Connection invitation' } format.json { render action: 'show', status: :created, location: @friendship2 } else format.html { render action: 'new' } format.json { render json: @friendship2.errors, status: :unprocessable_entity } end end else status = arefriends[0].status if status == "accepted" response = "Already friends" else if status == "pending" response = "Connection already requested by you" else response = "You'be been asked for that Connection" end end respond_to do |format| format.html { redirect_to connections_user_path(current_user), notice: response } format.json { render json: arefriends[0].errors, status: :unprocessable_entity } end end else if params[:status] == "accepted" @friendship = Friendship.where(:user_id => params[:user_id], :friend_id => params[:friend_id]) @friendship[0].status = "accepted" @friendship2 = Friendship.where(:user_id => params[:friend_id], :friend_id => params[:user_id]) @friendship2[0].status = "accepted" respond_to do |format| if @friendship[0].save format.html { redirect_to connections_user_path(current_user), notice: 'Connection accepted' } format.json { render action: 'show', status: :created, location: @friendship[0] } else format.html { render action: 'new' } format.json { render json: @friendship[0].errors, status: :unprocessable_entity } end if @friendship2[0].save format.html { redirect_to @friendship2[0], notice: 'The friendship was accepted' } format.json { render action: 'show', status: :created, location: @friendship2[0] } else format.html { render action: 'new' } format.json { render json: @friendship2[0].errors, status: :unprocessable_entity } end end else if params[:status] == "remove" @friendship = Friendship.where(:user_id => params[:user_id], :friend_id => params[:friend_id]) @friendship[0].destroy @friendship2 = Friendship.where(:user_id => params[:friend_id], :friend_id => params[:user_id]) @friendship2[0].destroy respond_to do |format| if @friendship[0].save format.html { redirect_to connections_user_path(current_user), notice: 'Connection Removed' } format.json { render action: 'show', status: :created, location: @friendship[0] } else format.html { render action: 'new' } format.json { render json: @friendship[0].errors, status: :unprocessable_entity } end if @friendship2[0].save format.html { redirect_to @friendship2[0], notice: 'A Connection has been removed' } format.json { render action: 'show', status: :created, location: @friendship2[0] } else format.html { render action: 'new' } format.json { render json: @friendship2[0].errors, status: :unprocessable_entity } end end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friendships_create(options = {})\n @req.post(\"/1.1/friendships/create.json\", options)\n end", "def create\n # prevent user from adding friends who are already on friends list.\n if @friendship\n render json: { Message: \"You're already friends!\" }, status: :unprocessable_entity\n ...
[ "0.7818167", "0.7393506", "0.73249245", "0.729346", "0.7141652", "0.7051172", "0.69890857", "0.69552326", "0.69517946", "0.68621576", "0.6860564", "0.6857097", "0.6840203", "0.6809342", "0.6780816", "0.67396927", "0.67190844", "0.67190844", "0.67190844", "0.67190844", "0.6709...
0.60648686
58
PATCH/PUT /friendships/1 PATCH/PUT /friendships/1.json
def update if params[:status] == "accepted" @friendship = current_user.friendships.build(:friend_id => params[:friend_id], :status => 'accepted') friend = User.find(params[:friend_id]) @friendship2 = friend.friendships.build(:friend_id => params[:user_id], :status => 'accepted') respond_to do |format| if @friendship.save format.html { redirect_to @friendship, notice: 'Your Connection Request has been sent' } format.json { render action: 'show', status: :created, location: @friendship } else format.html { render action: 'new' } format.json { render json: @friendship.errors, status: :unprocessable_entity } end if @friendship2.save format.html { redirect_to @friendship2, notice: 'You received a friendship invitation' } format.json { render action: 'show', status: :created, location: @friendship2 } else format.html { render action: 'new' } format.json { render json: @friendship2.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friendships_update(options = {})\n @req.post(\"/1.1/friendships/update.json\", options)\n end", "def update\n @friendship = @user.friendships.find(params[:id])\n\n respond_to do |format|\n if @friendship.update_attributes(params[:friendship])\n format.html { redirect_to [@game, ...
[ "0.75791544", "0.7365749", "0.7171268", "0.7171268", "0.7102057", "0.7068277", "0.7033859", "0.7033859", "0.694694", "0.69351727", "0.68741876", "0.68689406", "0.68521154", "0.6838455", "0.6747497", "0.66983867", "0.66889864", "0.66092294", "0.65870005", "0.6572818", "0.65396...
0.6769694
14
DELETE /friendships/1 DELETE /friendships/1.json
def destroy @friendship.destroy respond_to do |format| format.html { redirect_to friendships_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @friendship = @user.friendships.find(params[:id])\n @friendship.destroy\n\n respond_to do |format|\n format.html { redirect_to game_user_friendships_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @friendship = Friendship.find(params[:id])\n @frien...
[ "0.82214355", "0.8085715", "0.7877334", "0.77677894", "0.7734391", "0.7715833", "0.76893854", "0.76850754", "0.76729405", "0.7641806", "0.7634508", "0.76028705", "0.7581459", "0.7570719", "0.7564472", "0.7549868", "0.74964285", "0.749085", "0.7483406", "0.7478135", "0.7437925...
0.7987953
2
Use callbacks to share common setup or constraints between actions.
def set_friendship @friendship = Friendship.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 friendship_params params.require(:friendship).permit(:user_id, :friend_id, :status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Customisation point, expect individual cards to set their own length
def expected_length? formatted_number.length == 16 || formatted_number.length == 17 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cards_needed\n [@size, 5].min\n end", "def size\n cards.size\n end", "def length\n cards.length\n end", "def size\n return @cards.length\n end", "def size\n @cards.size\n end", "def size\n @cards.size\n end", "def size\n @cards.size\n end", "def car...
[ "0.6967645", "0.69532734", "0.6944996", "0.67095095", "0.6670523", "0.6670523", "0.65640694", "0.65004814", "0.64327115", "0.6409271", "0.6327344", "0.62774354", "0.62380415", "0.61485076", "0.6099927", "0.60522753", "0.6046741", "0.6040553", "0.6014089", "0.6009662", "0.5938...
0.0
-1
def get_list_id list_name sql = %q[SELECT id FROM lists WHERE name = $1] result = db.exec(sql, [list_name]) result.first['id'] empty array could be returned here, check if something was found end def share_list other_user_id, list_id sql = %q[INSERT INTO shared_lists (user_id, list_id) VALUES ($1, $2) RETURNING ] result = db.exec(sql, [other_user_id, list_id]) result.first end Make sure there is some verification of contents, array could be empty result.first is a good example
def get_user_lists user_id sql = %q[SELECT * FROM lists WHERE user_id = $1 ] result = db.exec(sql, [user_id]) result.entries.map{ |entry| build_list entry } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_info(user_id, list_id)\n return [db.execute(\"SELECT * FROM users WHERE user_id=?\", user_id), db.execute(\"SELECT * FROM listings WHERE list_id=?\", list_id)]\nend", "def already_shared(user_id, file_id)\n if $db.execute(\"SELECT * FROM shared_files WHERE file_id = ? AND user_id = ?\", file_id, u...
[ "0.6547393", "0.642324", "0.6395162", "0.6298203", "0.61114174", "0.60435504", "0.5993598", "0.5991419", "0.59888035", "0.59840375", "0.59094507", "0.5810523", "0.58045214", "0.58045214", "0.5753239", "0.574084", "0.5718982", "0.5712895", "0.57052", "0.5633266", "0.56257546",...
0.54742646
34
x is either the recommended value (Integer) or the query result (String) prior to conversion to Integer
def validate( x ) (x.to_s =~ /\A[1-5]\Z/) ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process_integer( val )\n\t\t\treturn Integer( val.to_s )\n\t\tend", "def pres(x)\n\tif x<10\n\t\treturn x = \"0\" + x.to_s\n\telse\n\t\treturn x = x.to_s\n\tend\nend", "def return_value(x)\n\tif x > 1\n\t\treturn x\n\telse\n\tend\nend", "def result\n value.sub(/^integer-/, '').to_i\n end...
[ "0.58335", "0.58176595", "0.5804167", "0.56590647", "0.56511843", "0.54943186", "0.5493593", "0.5479256", "0.54732704", "0.5391227", "0.5378253", "0.53576326", "0.5340153", "0.5319091", "0.5314443", "0.5269511", "0.5239462", "0.5179016", "0.51472306", "0.5129534", "0.51194245...
0.0
-1
GET /corps GET /corps.json
def index @corps = Corp.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @corges = Corge.all\n end", "def index\n @copons = Copon.all\n end", "def index\n @popcorns = Popcorn.all\n end", "def index\n @corridas = Corrida.all\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def index\n @cps = Cp.all\...
[ "0.6263931", "0.5835342", "0.58079046", "0.5802921", "0.57680696", "0.5691794", "0.56731963", "0.56525725", "0.55293006", "0.55221397", "0.5511802", "0.5472816", "0.54695475", "0.5452315", "0.54469156", "0.54377645", "0.5437015", "0.54313797", "0.5425353", "0.54224765", "0.54...
0.6692728
0
GET /corps/1 GET /corps/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @corps = Corp.all\n end", "def index\n @corps = Corp.all\n end", "def index\n @corges = Corge.all\n end", "def set_corpu\n @corpu = Corpu.find(params[:id])\n end", "def show\n @circulation = Circulation.find(params[:id])\n\n respond_to do |format|\n format.html # ...
[ "0.6537758", "0.6537758", "0.6211128", "0.5856104", "0.5821062", "0.58143884", "0.5800207", "0.5743693", "0.5714927", "0.56905675", "0.56778306", "0.56736755", "0.5650279", "0.5639502", "0.5614502", "0.56134313", "0.56128067", "0.56124675", "0.5610981", "0.5610778", "0.560419...
0.0
-1
POST /corps POST /corps.json
def create @corp = Corp.new(corp_params) respond_to do |format| if @corp.save format.html { redirect_to @corp, notice: 'Corp was successfully created.' } format.json { render :show, status: :created, location: @corp } else format.html { render :new } format.json { render json: @corp.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @corpu = Corpu.new(corpu_params)\n respond_to do |format|\n if @corpu.save\n format.json { head :no_content }\n format.js\n else\n format.json { render json: @corpu.errors.full_messages, status: :unprocessable_entity }\n end\n end\n end", "def create\n ...
[ "0.61426973", "0.5903807", "0.55852276", "0.5559872", "0.5545504", "0.5443921", "0.5400938", "0.53967345", "0.53742874", "0.5358108", "0.53553253", "0.53443646", "0.5334253", "0.5329681", "0.53193533", "0.53118676", "0.52779937", "0.5244831", "0.52070224", "0.5189835", "0.517...
0.5137135
28
PATCH/PUT /corps/1 PATCH/PUT /corps/1.json
def update respond_to do |format| if @corp.update(corp_params) format.html { redirect_to @corp, notice: 'Corp was successfully updated.' } format.json { render :show, status: :ok, location: @corp } else format.html { render :edit } format.json { render json: @corp.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @corpu.update(corpu_params)\n format.json { head :no_content }\n format.js\n else\n format.json { render json: @corpu.errors.full_message...
[ "0.63657326", "0.6250912", "0.61621356", "0.60965997", "0.60865307", "0.6085833", "0.60691607", "0.60228765", "0.5982152", "0.5982152", "0.59476143", "0.59448385", "0.5915759", "0.58931226", "0.5886872", "0.5853425", "0.58501947", "0.5846086", "0.5844588", "0.5832674", "0.582...
0.0
-1
DELETE /corps/1 DELETE /corps/1.json
def destroy @corp.destroy respond_to do |format| format.html { redirect_to corps_url, notice: 'Corp was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @corp.destroy\n respond_to do |format|\n format.html { redirect_to corps_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\...
[ "0.7157394", "0.6801786", "0.6619608", "0.65247077", "0.6523261", "0.6517229", "0.65159374", "0.65108764", "0.6501687", "0.6498776", "0.6487857", "0.64595914", "0.64335674", "0.64149374", "0.64125526", "0.64073616", "0.63975513", "0.6395592", "0.6394126", "0.6392911", "0.6389...
0.6500696
9
Use callbacks to share common setup or constraints between actions.
def set_corp @corp = Corp.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
Only allow a list of trusted parameters through.
def corp_params params.require(:corp).permit(:corp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.6950644", "0.68134046", "0.68034387", "0.6796522", "0.674668", "0.6742105", "0.6527854", "0.65214247", "0.6491907", "0.64294493", "0.64294493", "0.64294493", "0.64004904", "0.6356768", "0.63556653", "0.6348119", "0.6344521", "0.63386923", "0.632588", "0.632588", "0.632588"...
0.0
-1
access the type of the medal type is a sring and wight an integer
def initialize(type, weight) @type = type @weight = weight end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type\n munson.type\n end", "def sti_type\n self.type\n end", "def mediatype; end", "def presentation_unit_type_measure\n packing_material.presentation_unit_type_measure\n end", "def type\n return :basic if @is_basic\n return :platinum if @is_platinum\n return ...
[ "0.6272783", "0.6235713", "0.6224735", "0.62182754", "0.60074526", "0.5930462", "0.5904124", "0.58993685", "0.58853763", "0.577737", "0.57766974", "0.57642645", "0.57618296", "0.57510227", "0.57187635", "0.57038856", "0.57038856", "0.5679324", "0.5636631", "0.56254756", "0.56...
0.0
-1
GET /urls/1 GET /urls/1.json
def show if params[:short_url] @url = Url.find_by short_url: params[:short_url] if redirect_to "#{@url.original_url}" @url.clicks += 1 ip = request.env['HTTP_X_FORWARDED_FOR'] || request.remote_ip if !@url.ip_addresses.include? ip @url.ip_addresses.push(ip) end @url.save end else @base_url = "#{request.protocol}#{request.host_with_port}/" @url = Url.find(params[:id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @urls = Url.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @urls }\n end\n end", "def index\n @urls = ShortenedUrl.order(\"updated_at ASC\").all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { re...
[ "0.6885968", "0.66887754", "0.66787374", "0.66593164", "0.6529249", "0.6509962", "0.64914274", "0.6448754", "0.64453053", "0.6409037", "0.64083", "0.6267918", "0.6236266", "0.6223829", "0.6216287", "0.62162524", "0.620276", "0.6169882", "0.6138518", "0.6119957", "0.61180186",...
0.0
-1
POST /urls POST /urls.json
def create @url = Url.new(url_params) if @url.save redirect_to @url else render 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n params[:url_list].each do |url|\n WebUrl.new(:url => url).save\n end\n render :json=>params[:url_list].to_json\n end", "def create_api\n\n @url = Url.new(:url => params[:url])\n\n if @url.save\n url_hash = Hash.new\n\n url_hash[:short_url] = root_url.to_s() + \"urls_ap...
[ "0.66614103", "0.6225674", "0.62237", "0.6133381", "0.6110082", "0.60986954", "0.60519725", "0.60070646", "0.5954528", "0.59431005", "0.5926763", "0.58907574", "0.5872233", "0.58478326", "0.58240664", "0.58098954", "0.57900316", "0.57866234", "0.5748828", "0.57442534", "0.571...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_url @url = Url.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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1