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
lexer rule eol! (EOL) (in Ingredients.g)
def eol! # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 39 ) type = EOL channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 138:6: ( '\\r' )? '\\n' # at line 138:6: ( '\\r' )? alt_2 = 2 look_2_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eol!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 55 )\n\n type = EOL\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 354:6: ( '\\\\r' )? '\\\\n'\n # at line 354:6: ( '\\\\r' )?\n a...
[ "0.74224097", "0.7304435", "0.6839215", "0.6618777", "0.6492405", "0.64568603", "0.64382607", "0.64382607", "0.64382607", "0.6216605", "0.61108315", "0.61108315", "0.61108315", "0.60903263", "0.60903263", "0.60903263", "0.6087677", "0.60763377", "0.60457915", "0.5999391", "0....
0.73928595
1
lexer rule letter! (LETTER) (in Ingredients.g)
def letter! # -> uncomment the next line to manually enable rule tracing # trace_in( __method__, 40 ) type = LETTER channel = ANTLR3::DEFAULT_CHANNEL # - - - - main rule block - - - - # at line 139:9: ( 'a' .. 'z' | 'A' .. 'Z' ) if @input.peek( 1 ).between?( 0x41, 0x5a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 56 )\n\n type = LETTER\n channel = ANTLR3::DEFAULT_CHANNEL\n\n \n # - - - - main rule block - - - -\n # at line 355:9: ( 'a' .. 'z' | 'A' .. 'Z' )\n if @input.peek( 1 ).betwe...
[ "0.74882776", "0.66327024", "0.6490417", "0.6342117", "0.6150669", "0.6085292", "0.6064268", "0.6042905", "0.60393256", "0.6008116", "0.59963554", "0.59777784", "0.596488", "0.59417516", "0.5938436", "0.5914525", "0.5853806", "0.5846314", "0.5837675", "0.5830591", "0.58166057...
0.7507455
0
main rule used to study the input at the current position, and choose the proper lexer rule to call in order to fetch the next token usually, you don't make direct calls to this method, but instead use the next_token method, which will build and emit the actual next token
def token! # at line 1:8: ( T__8 | T__9 | T__10 | T__11 | T__12 | T__13 | T__14 | T__15 | T__16 | T__17 | T__18 | T__19 | T__20 | T__21 | T__22 | T__23 | T__24 | T__25 | T__26 | T__27 | T__28 | T__29 | T__30 | T__31 | T__32 | T__33 | T__34 | T__35 | T__36 | T__37 | T__38 | T__39 | T__40 | T__41 | T__42 | T__43 | ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_token\n\n token = nil\n\n until ss.eos? or token do\n if ss.check(/\\n/) then\n self.lineno += 1\n # line starts 1 position after the newline\n self.start_of_current_line_pos = ss.pos + 1\n end\n self.old_pos = ss.pos\n token =\n case state\n wh...
[ "0.71789134", "0.7152559", "0.71189433", "0.7099387", "0.7027668", "0.7023751", "0.70234585", "0.7019611", "0.7017878", "0.69873095", "0.69635427", "0.69476783", "0.69186777", "0.68400645", "0.67702806", "0.67455643", "0.66713107", "0.6603717", "0.6601433", "0.65970445", "0.6...
0.61581117
74
Write a method that takes an Array, and returns an Array of Arrays that represent the permutations of the original Array. The order of the permutations does not matter. You may not use the Arraypermutations method nor any other standard method that is meant to generate permutations please devise your own way of generat...
def permutations(array) results = [] 1000.times do premutation = array.shuffle results << array << premutation end results.uniq.sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permutations(array)\n results = []\n results[0] = [[array.first]]\n (1..array.length - 1).each do |i|\n new_perms = []\n old_perms = results[i-1].deep_dup\n old_perms.each do |perm|\n perm.each_with_index do |value, index|\n new_perms << perm.splice(index, i + 1)\n end\n new_p...
[ "0.8513149", "0.84643984", "0.84509206", "0.84313637", "0.8416704", "0.82391185", "0.820968", "0.8183791", "0.8138898", "0.81246555", "0.8108501", "0.8108501", "0.8108501", "0.8108501", "0.8084783", "0.8078712", "0.79847145", "0.7893512", "0.7869881", "0.78394806", "0.7838052...
0.7383227
38
Get some of product details
def details @specs = WatirNokogiri::Document.new(specs_element.html).table { screen: spec(Constants::PRODUCT_PAGE[:specs][:screen]), sensor: spec(Constants::PRODUCT_PAGE[:specs][:sensor]), megapixels: spec(Constants::PRODUCT_PAGE[:specs][:megapixels]) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details\n data = Storm::Base::SODServer.remote_call '/Product/details',\n :code => @code\n self.from_hash data\n end", "def get_product_info\n @client.call(self.class, __callee__.to_s, @call_params)\n end", "def product_info\n ...
[ "0.7851414", "0.75573224", "0.7551582", "0.7509629", "0.7488046", "0.7458662", "0.742825", "0.7264584", "0.7259181", "0.7214866", "0.7092344", "0.7091314", "0.70537406", "0.69804174", "0.6971911", "0.69626176", "0.6940344", "0.6917634", "0.68822175", "0.685885", "0.68578607",...
0.0
-1
Add top suggestion to cart
def add_top_suggestion_to_cart add_to_cart(suggestions.top) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_other_suggestion_to_cart(index)\n add_to_cart(suggestions.others[index], :other)\n title_element.hover # To unhover suggestion\n wait_until { !suggestion.hovered? && suggestion.added_to_cart? }\n end", "def add_to_cart(suggestion, type = nil)\n open_suggestion(suggestion) if type == :other\n...
[ "0.7142041", "0.69426954", "0.55149364", "0.55025697", "0.542215", "0.53919417", "0.53584045", "0.5285716", "0.52654606", "0.52539694", "0.52477515", "0.52460426", "0.5206915", "0.5197922", "0.5192393", "0.51915246", "0.51814413", "0.5147702", "0.51176685", "0.5106691", "0.51...
0.9146881
0
Add other suggestions to cart (by index)
def add_other_suggestion_to_cart(index) add_to_cart(suggestions.others[index], :other) title_element.hover # To unhover suggestion wait_until { !suggestion.hovered? && suggestion.added_to_cart? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_top_suggestion_to_cart\n add_to_cart(suggestions.top)\n end", "def add_to_cart(suggestion, type = nil)\n open_suggestion(suggestion) if type == :other\n suggestion.add_to_cart_element.when_visible.click\n wait_until { suggestion.added_to_cart_element.visible? }\n end", "def add_suggestion...
[ "0.68788946", "0.6062183", "0.593185", "0.57696766", "0.5555008", "0.5549299", "0.5549299", "0.5466284", "0.54214734", "0.5412461", "0.5408316", "0.54054654", "0.54034853", "0.539701", "0.5390124", "0.53885067", "0.5358786", "0.5350578", "0.5349006", "0.5330461", "0.53202754"...
0.7858726
0
Returns spec by label and remove unnecessary
def spec(label) nbsp = Nokogiri::HTML('&nbsp;').text @specs.row(label)[1].text.gsub(nbsp, ' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def by_label\n @by_label ||= notes.group_by(&:label)\n end", "def labeled_measurements(label)\n # Need *all* for the tests to pass (to work for both saved and unsaved)\n Rails.env.test? ? self.measurements.all.select { |m| label == m.label } : self.measurements.select { |m| label == m.label }\n en...
[ "0.5514073", "0.5406687", "0.54055786", "0.5384424", "0.53683263", "0.53677994", "0.53225297", "0.53087366", "0.5272051", "0.5163802", "0.5151455", "0.5151158", "0.5131104", "0.5128723", "0.51285934", "0.51165044", "0.5112829", "0.507005", "0.50604963", "0.5051944", "0.503322...
0.63532263
0
Add suggestion to cart
def add_to_cart(suggestion, type = nil) open_suggestion(suggestion) if type == :other suggestion.add_to_cart_element.when_visible.click wait_until { suggestion.added_to_cart_element.visible? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_top_suggestion_to_cart\n add_to_cart(suggestions.top)\n end", "def add_other_suggestion_to_cart(index)\n add_to_cart(suggestions.others[index], :other)\n title_element.hover # To unhover suggestion\n wait_until { !suggestion.hovered? && suggestion.added_to_cart? }\n end", "def add_suggest...
[ "0.7720142", "0.72584945", "0.6388958", "0.59400237", "0.58708125", "0.5836759", "0.5817648", "0.57519794", "0.574103", "0.5737641", "0.57114303", "0.5694445", "0.56890714", "0.56545126", "0.5654286", "0.5650851", "0.5626254", "0.56153184", "0.56016797", "0.55973333", "0.5597...
0.7758245
0
Hovers "other" suggestion to make 'Add to cart' button visible
def open_suggestion(suggestion) suggestion.hover wait_until { suggestion.hovered? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_other_suggestion_to_cart(index)\n add_to_cart(suggestions.others[index], :other)\n title_element.hover # To unhover suggestion\n wait_until { !suggestion.hovered? && suggestion.added_to_cart? }\n end", "def continue_shopping_button\n\t\t$tracer.trace(__method__)\n\t\treturn ToolTag.new(div.clas...
[ "0.65310526", "0.60728204", "0.59374475", "0.58787966", "0.57710385", "0.574477", "0.5627093", "0.5600567", "0.5562624", "0.55619866", "0.5490255", "0.54747736", "0.5471123", "0.54206645", "0.54141676", "0.5400306", "0.5371717", "0.53680885", "0.5364979", "0.5345335", "0.5321...
0.0
-1
WP_ACF_POSTS_BASE = "/acf/v3/posts" unused as we can get ACF from rest api now, but leaving in case we need it later
def accessible? # convenience method to check if wordpress is accessible # if we don't have this, the connection will take a long time to timeout timeout = 5 #seconds RestClient::Request.execute(:method => :head, :url => cms_host, :timeout => timeout) return true rescue RestClient::Exceptions::Ope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_posts_uri\n @read_posts_uri ||= \"#{base_uri}/readposts\"\n end", "def posts\n posts = @client.entries(content_type: 'post').items\n posts || []\n end", "def posts; end", "def posts_feed\n\n init_posts_feed\n\n end", "def feed_url\n blog_url + \"posts.atom\"\n end", "d...
[ "0.57018304", "0.5374574", "0.52868307", "0.5192826", "0.51360416", "0.5106211", "0.51059157", "0.5036134", "0.5016799", "0.492757", "0.49056518", "0.48441488", "0.4829039", "0.48209968", "0.47945184", "0.47785708", "0.47777763", "0.47775102", "0.47738808", "0.47650537", "0.4...
0.0
-1
show_text_column :number show_text_column :sale, :number
def show_text_column(*methods) return show_header_column(methods) if is_header content = get_methods_text_value(model, methods) content_tag :td, content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_column(detail)\n ''\n end", "def real_column; end", "def to_s\n \"#{name}\\t#{unit_price.format}#{\"\\t\\t#{sale_quantity} for #{sale_price.format}\" if on_sale?}\"\n end", "def summary_detail\n Classifieds::Listing.format_cols([@title, @mileage, @price], SUMMARY_COL_FORMATS)\n end", ...
[ "0.5999302", "0.5880699", "0.57596225", "0.5428339", "0.5384087", "0.5342525", "0.53334916", "0.5309775", "0.5309636", "0.526878", "0.5254952", "0.525197", "0.52031076", "0.5186972", "0.51548463", "0.5153834", "0.51537865", "0.51537865", "0.51537865", "0.51537865", "0.5153786...
0.52143204
12
show_currency_column :price show_currency_column :product, :price
def show_currency_column(*methods) return show_header_column(methods) if is_header content = get_methods_currency_value(model, methods) content_tag :td, content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product_price_details\n {:currency => 'EUR', :price => price}\n end", "def price_column_name(use_params = true)\n if use_params && params['currency'].present?\n pcheck = params['currency'].upcase\n if ['USD', settings[:price_additional_currency].upcase].include?(pcheck)\n return 'pric...
[ "0.68604106", "0.68081754", "0.67411536", "0.66348755", "0.6629583", "0.65343124", "0.65343124", "0.64953417", "0.64422435", "0.63770926", "0.63503957", "0.6343806", "0.63410836", "0.63410836", "0.6336685", "0.62931746", "0.62834024", "0.62585187", "0.62494624", "0.62335527", ...
0.6737111
3
show_percent_column :discount show_percent_column :product, :discount
def show_percent_column(*methods) return show_header_column(methods) if is_header content = get_methods_percent_value(model, methods) content_tag :td, content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_discount_percent( product )\n relation = self.product.relations.where( related_to: product ).first\n\n relation.try( :discount_percent) || 100\n end", "def discount_display\n if unit == :percent\n \"-#{discount.to_i}%\"\n else\n \"-#{discount.in_euro.to_yuan.display}\"\n e...
[ "0.66695505", "0.66226596", "0.64206964", "0.63202363", "0.62287164", "0.61749333", "0.61062026", "0.60595876", "0.6051979", "0.60293144", "0.6027827", "0.5974512", "0.5935594", "0.5887444", "0.58873236", "0.58801323", "0.58693177", "0.5865612", "0.58607936", "0.5856322", "0....
0.68518955
0
show_time_column :create_at show_time_column :sale, :create_at
def show_time_column(*methods) return show_header_column(methods) if is_header content = get_methods_time_value(model, methods) content_tag :td, content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_at; end", "def timestamps\n column(:created_at, :datetime)\n column(:updated_at, :datetime)\n end", "def time_to_show\n \n end", "def range_column\n 'created_at'\n end", "def decorated_created_at\n created_at.to_date.to_s(:long) \n end", "def draw_created_at(col...
[ "0.68463445", "0.66297454", "0.65547377", "0.6551762", "0.6545621", "0.65205985", "0.6505513", "0.64854074", "0.6428383", "0.64230114", "0.641822", "0.6417964", "0.64109707", "0.64109707", "0.63781697", "0.6371641", "0.6369491", "0.63585377", "0.6347334", "0.63276505", "0.632...
0.5796765
90
show_date_column :create_at show_date_column :sale, :create_at
def show_date_column(*methods) return show_header_column(methods) if is_header content = get_methods_date_value(model, methods) content_tag :td, content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_of_change\n created_at.display_date\n end", "def date_of_change\n created_at.display_date\n end", "def invoice_date_display\n\n end", "def created_at; end", "def create_date\n\t\tcreated_at.to_date\n\tend", "def decorated_created_at\n created_at.to_date.to_s(:long) \n end", "def...
[ "0.6696923", "0.6696923", "0.66198367", "0.6607602", "0.6507124", "0.6498184", "0.64835024", "0.64378613", "0.64136547", "0.6320716", "0.62933254", "0.62933254", "0.62933254", "0.6219925", "0.6206543", "0.6206543", "0.6200481", "0.61992705", "0.6149261", "0.6139449", "0.61246...
0.58499527
46
Parse ARGV, setting Args attributes as appropriate
def initialize @op=nil @limit=1000 @verbose=nil @trace=[] @heads=false @rom=false @image=nil @output=nil @include=[] @lib=[] @savetemp=false @docdir=nil @sysopt = {} @c = nil @sys = nil @rc = nil @optimization = nil ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(given_args=ARGV)\n @options, @arguments, @extras = self.class.parse_options!(given_args)\n end", "def parse_arguments\n @arguments = ARGV.collect { |arg| arg.strip }\n @filename = Pathname.new(@arguments.first)\n end", "def parse argv\n parse_args argv do |argv, remaining_a...
[ "0.7270962", "0.7262015", "0.7258295", "0.710308", "0.6997872", "0.69932956", "0.69932204", "0.6958458", "0.6940612", "0.691203", "0.6908928", "0.6905729", "0.6889501", "0.6876644", "0.68540543", "0.68122405", "0.68077314", "0.678752", "0.6781128", "0.6763914", "0.67570627", ...
0.0
-1
Apply parsed arguments to 'sys'
def apply(sys=nil) if @op.nil? @rc = 2 raise "No operation specified" end @sys ||= GMPForth::CLI::target('vm') @c = @sys.new @sysopt @c.include(*@include) if @include.length > 0 && @c.respond_to?(:include) @c.library_path(*@lib) if @lib.length > 0 && @c.respond_to?...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def system=(_arg0); end", "def parse argv\n parse_args argv do |argv, remaining_args, arg|\n remaining_args << arg\n end\n end", "def process_argv!\n args = ARGV.dup\n self.rest = []\n until args.empty? do\n arg = args.shift\n case\n when arg == '--'\n ...
[ "0.5894862", "0.5775882", "0.5758756", "0.5702717", "0.5634102", "0.5615361", "0.5591027", "0.55875915", "0.54734266", "0.54351234", "0.54134256", "0.53813565", "0.5371171", "0.5358579", "0.5355854", "0.53489053", "0.53426564", "0.5333397", "0.5322696", "0.5316104", "0.530370...
0.0
-1
add macro K or K=V
def macro(spec) @c.macro(*spec.split('=')) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lex_macro name, value\n macros << [name, value]\n end", "def opcode_7XKK(helper)\n\t\thelper.registry_X += helper.var_K\n\tend", "def add(k,v)\n @cells[k] = v\n end", "def _addElement( key, value )\n @token.addElement( key, value )\n end", "def []= k,v\n\t set k,v\n\t end", "d...
[ "0.5886598", "0.5754195", "0.5721594", "0.57030076", "0.5644806", "0.5578154", "0.5495386", "0.5491347", "0.54605114", "0.54187196", "0.53524387", "0.53524387", "0.5339791", "0.5335246", "0.5287283", "0.5262517", "0.52513194", "0.5239634", "0.5231091", "0.52164376", "0.520453...
0.52797395
15
return compiler Class for machine
def target(machine='vm') if machine == 'vm' require 'gmpforth/vm' end require "gmpforth/#{machine}compiler" GMPForth::const_get "#{machine.upcase}Compiler" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compiler\n guess_compiler unless @compiler\n @compiler && @compiler.class.to_sym\n end", "def compiler_class(extension)\n if cname = compiler_setting(extension)\n compname = Compiler.register.find{ |c| c.name.split('::').last == cname }\n compiler = const_get(compname)::Compil...
[ "0.76838064", "0.70170164", "0.64039034", "0.64039034", "0.62989753", "0.6257504", "0.61453813", "0.6141715", "0.6106821", "0.60525095", "0.604597", "0.59991497", "0.597278", "0.5951554", "0.5941365", "0.59347314", "0.5908614", "0.5908614", "0.5908614", "0.5907331", "0.589847...
0.7083206
1
split the name at the space for first & last name switch the positions create an index of vowels if a vowel is encountered use .next on the vowel array
def split_flip_name p "what is your first and last name? (type 'print' to quit)" name = gets.chomp.downcase old_name_array = [] old_name_array << name p old_name_array split_name = name.split(' ') #more elegant to use reverse method flip_name = split_name[1], split_name[0] #p flip_name join_name = f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fake_name_c2(real_name)\n\treal_full_name = real_name.split(\" \")\n\treal_first_name = real_full_name[0] \n\treal_last_name = real_full_name[1]\n\ti = 0\n\tfake_first_name = \"\"\n\tfake_last_name = \"\"\n\tvowel_index = \"\"\n\tlength_first = real_first_name.length\n\tlength_last = real_last_name.length \n\t...
[ "0.71467394", "0.7125527", "0.70856", "0.6907293", "0.69010913", "0.680197", "0.67973506", "0.67937833", "0.67487615", "0.6741716", "0.66775084", "0.665337", "0.65591985", "0.65532655", "0.6540673", "0.64904475", "0.64865625", "0.6478682", "0.6475782", "0.6438888", "0.6420256...
0.0
-1
loop through the flip_names make vowels in a position flip the vowels to next vowel if vowel... then add 1 to index.
def letter_change consonant = "bcdfghjklmnpqrstvwxyz" vowel = "aeiou" new_name = "" letter_new = "" split_flip_name.each do |letter| if consonant.index(letter) != nil letter_new = consonant[consonant.index(letter) + 1] elsif vowel.index(letter) != nil #addresses last vowel edge ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_vowel(name)\n\tvowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\tindex = 0\n\tname = name.split('') # string to array\n\tname_change1 = name.map do |letter| \n\t\tif vowels.include? letter \n\t\t\tvowels.rotate(1)[vowels.index(letter)]\n\t\telse\n\t\t\tletter\n\t\tend\n\tend\n\tname_change1.join # new arra...
[ "0.7158492", "0.7116826", "0.7079512", "0.6960102", "0.6929619", "0.69222254", "0.6860109", "0.6795494", "0.67679197", "0.67418003", "0.674037", "0.67373997", "0.6730076", "0.6698363", "0.6681006", "0.66802186", "0.6653309", "0.6605141", "0.6558567", "0.655484", "0.6537887", ...
0.72341466
0
The MIT License (MIT) Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/...
def azure_service Fog::Compute[:azure] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def how_it_works\r\n end", "def private; end", "def standalone; end", "def make; end", "def conscientious_require; end", "def implementation; end", "def implementation; end", "def spec; end", "def spec; end", "def library; end", "def library; end", "def setup; end", "def setup; end", "de...
[ "0.5617388", "0.54958606", "0.5419527", "0.53768283", "0.5356462", "0.5351567", "0.5351567", "0.53245425", "0.53245425", "0.5180923", "0.5180923", "0.5176319", "0.5176319", "0.5176319", "0.5176319", "0.5176319", "0.5176319", "0.5176319", "0.5176319", "0.5176319", "0.5176319",...
0.0
-1
params we will use to fill the XML format request
def local { :merchant_account_id => origin.merchant_id, :request_id => origin.request_id, :parent_transaction_id => origin.parent_transaction_id, :ip_address => REQUEST_IP_ADDRESS } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_body(xml); xml; end", "def params\n @params ||= @document.root.get_elements(\"params/param\").map {|e|\n XmlRpc::API::Message.parse_value(e.elements[\"value\"])\n } \n end", "def build_request_xml(function, param, extra = nil)\n xml = \"<?xml version=\\\"1.0\\\" enco...
[ "0.6993314", "0.67662144", "0.66039866", "0.655231", "0.6484857", "0.6431532", "0.64272004", "0.63577956", "0.6333685", "0.63049924", "0.6304096", "0.6304096", "0.62843055", "0.62825096", "0.62640977", "0.62494487", "0.6236507", "0.6236507", "0.62183106", "0.62160504", "0.618...
0.0
-1
get some body params from the remote elastic API itself rather than our database (safer)
def remote { :currency => origin.parent_transaction.response.requested_amount_currency, :amount => origin.parent_transaction.response.requested_amount, :payment_method => origin.parent_transaction.response.payment_method, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculate_params\n content_type == 'application/json' ? JSON.parse(body) : nil\n end", "def params\n self.GET.update(self.POST)\n rescue EOFError => boom\n self.GET\n end", "def body\n @params.to_json\n end", "def _params\n return params if params.present?\n\n @_para...
[ "0.63925415", "0.6346286", "0.6310234", "0.62916416", "0.627257", "0.6257669", "0.61831665", "0.6163683", "0.61537945", "0.6140528", "0.61384517", "0.61367446", "0.60961413", "0.60944825", "0.60871387", "0.60871387", "0.6079821", "0.6070679", "0.6068482", "0.6052081", "0.6029...
0.0
-1
Write a method that will take a string and return an array of vowels used in that string. Example: count_vowels("The quick brown fox") should return ["e","u","i","o","o"] count_vowels("Hello World") should return ["e","o","o"] Check your solution by running the tests: ruby tests/09_vowels_test.rb
def vowels (string) # Your code here vowels = ['a','e','i','o','u'] find = [] for letter in string.chars find << letter if vowels.include?(letter.downcase) end return find end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowels (string)\n vowels_arr = []\n count_vowels = string.scan(/[aeoui]/)\n vowels_arr << count_vowels\n puts vowels_arr\nend", "def count_vowels(str)\n vowels = 0\n str.split('').each do |char|\n vowels += 1 if ['a', 'e', 'i', 'o', 'u'].include? char\n end\n vowels\nend", "def count_vowels (str...
[ "0.8259597", "0.8081331", "0.8000202", "0.7932844", "0.79176027", "0.7845396", "0.78017753", "0.7800696", "0.777371", "0.7729605", "0.77074003", "0.76476854", "0.76440567", "0.76411045", "0.763504", "0.7633589", "0.7617113", "0.76091456", "0.76068664", "0.76059127", "0.760354...
0.7094164
70
Action managing the results found (used also with AJAX call, for pagination or ordering) Usage URL : GET /searches GET /searches.xml
def index # Creation of the search object and search do if params[:filter] params[:by] = "#{params[:filter][:field]}-#{params[:filter][:way]}" params[:per_page] = "#{params[:filter][:limit]}".to_i end @search = Search.new(setting_searching_params(:from_params => params))#.advance_search_fields ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\n @searches = Search.all\n end", "def index\n # Generate sunspot search\n @records = record_default_search\n\n respond_with(@records)\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n end", "def index\n @searches = Search.all\n e...
[ "0.7448767", "0.7421867", "0.7392267", "0.7392267", "0.7392267", "0.7392267", "0.7392267", "0.7366901", "0.7327242", "0.72951883", "0.7279269", "0.7223201", "0.7203839", "0.7197629", "0.7194583", "0.7187895", "0.71421105", "0.7130678", "0.7126997", "0.7104343", "0.70955336", ...
0.73919785
7
Action to print the advance search partial (used onl with AJAX call) Usage URL : GET /searches/print_advanced
def print_advanced @search ||= Search.new() render :partial => 'advanced_search', :locals => { :category => params[:cat] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quick_search_show\n @exp_token = nil\n @quick_search_active = true\n @qs_exp_table = exp_build_table(@edit[:adv_search_applied][:exp], true)\n @edit[:qs_tokens] = create_tokens(@qs_exp_table, @edit[:adv_search_applied][:exp])\n\n render :update do |page|\n page << javasc...
[ "0.6094974", "0.60347325", "0.59837383", "0.59718806", "0.594976", "0.5899138", "0.5805361", "0.58010733", "0.57922554", "0.5698798", "0.56961805", "0.56847227", "0.56634897", "0.5652365", "0.5631829", "0.5630376", "0.56175905", "0.560794", "0.5594342", "0.5589698", "0.558122...
0.76907897
0
formats domanice in datatables
def format_dominance(value) if value.class != Float return "" end dom = value * 100 "%E" % dom end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_html_table(rde_table)\n content_tag(:table, class: 'table rde-table') do\n rde_table.rows.map { |row|\n content_tag(row.tag, class: row.css_class) do\n row.cells.map { |cell|\n if cell.ruby_formatter\n content_tag(\n cell.tag,\...
[ "0.5847984", "0.5801693", "0.5800254", "0.5758842", "0.57482266", "0.5638756", "0.5589237", "0.5583976", "0.55050904", "0.5464177", "0.5445606", "0.539745", "0.5389324", "0.5381612", "0.53765", "0.536734", "0.5325598", "0.5294982", "0.52946115", "0.52825457", "0.52714396", ...
0.0
-1
align numerical values right
def align_right?(column) numeric_columns = [:Read_length, :Date, :Insert_length, :Distinct_peptides, :Peptide_diversity, :Selection_round, :Sequence_length, :Reads_sum, :Dominance_sum, :Rank, :Reads, :Dominance] numeric_columns.include?(column) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def align(y) #:nodoc:\n xd = self.digits.to_s\n yd = y.kind_of?(BigDecimal) ? y.digits.to_s : y\n BigDecimal.align(xd, yd)\n end", "def align(num)\n if num < 10\n \" #{num}\"\n else\n \" #{num}\"\n end\n end", "def align; end", "def align; end", "def align \n return @r...
[ "0.7037664", "0.6823432", "0.67873114", "0.67873114", "0.671719", "0.6528531", "0.6092991", "0.59483504", "0.59324336", "0.58962613", "0.58760226", "0.58707774", "0.586813", "0.586813", "0.58240545", "0.5796292", "0.5689039", "0.5666579", "0.56434834", "0.5625867", "0.5609638...
0.0
-1
choose_data nbsp = nonbreaking space, tests if a value other than the blank field in a dropdownmenu was selected
def not_just_nbsp?(field) field != "" && field.match(/^[[:space:]]+$/) == nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dl_value(value)\n value.blank? || value.size == 0 ? '&nbsp;'.html_safe : value\n end", "def text_for_html_select_option\n self.common_name ||= \"\"\n end", "def check_choice(choice)\n @spaces[choice] == \" \" ? true : false \n end", "def puc_puc_type_code_search_combo_changed\n\tpuc_type_cod...
[ "0.5827553", "0.5417161", "0.5342817", "0.5301268", "0.5285331", "0.5258167", "0.5234972", "0.51961833", "0.5161136", "0.5152126", "0.5118588", "0.5116185", "0.5063899", "0.5059218", "0.5010171", "0.5010171", "0.49853295", "0.49576908", "0.49455535", "0.4945468", "0.49423197"...
0.49832648
17
Strip the `help` message from the original ARGV, storing whether or not it was given for later.
def strip_help_param! @help_given = ARGV.delete('--help') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_help\n if (ARGV.length >= 1) && is_help_flag?(ARGV[0])\n puts \"Detailed Instructions on application use can be found in the README.md file.\"\n puts \"Look under the Installation heading for more information!\"\n exit\n else\n # Continue as norm...
[ "0.6558866", "0.65225", "0.65225", "0.65071857", "0.65071857", "0.64857394", "0.6474905", "0.6387526", "0.6256516", "0.62183577", "0.6103222", "0.6046542", "0.6015236", "0.6015236", "0.5992011", "0.59812355", "0.5947222", "0.59453356", "0.59445006", "0.59425884", "0.5925845",...
0.8599439
0
Print a help message.
def dump_help settings.dump_help end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_help\n puts HELP_MESSAGE\n end", "def show_help\n puts HELP_MESSAGE\n end", "def help_help\t# :nodoc:\n\t\t\"#{@program_name} -cmd help\\n\\tShow this message\\n\"\n\tend", "def print_help\r\n print <<~HEREDOC\r\n Usage: ruby caesar_cipher.rb [options] [message string]\r\n ...
[ "0.8377686", "0.8377686", "0.79501635", "0.7769242", "0.7709871", "0.7680923", "0.76204777", "0.7575897", "0.75518477", "0.7526741", "0.7525159", "0.7499956", "0.74942744", "0.7454223", "0.74341476", "0.7427854", "0.74270356", "0.7383897", "0.73771", "0.7376919", "0.73760235"...
0.0
-1
Print a help message and exit.
def dump_help_and_exit! dump_help exit(1) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def help\n\t\tself.usage(false)\n\t\texit EX_OK\n\tend", "def help_exit\r\n puts <<HELP\r\nUsage: etl.rb CONFIG_FILE\r\nHELP\r\n # exit 1\r\nend", "def help\n puts @option_parser\n exit\n end", "def show_help(opts)\n puts opts\n exit 0\nend", "def show_help(opts)\n puts opts\n exit 0\nen...
[ "0.788554", "0.78839046", "0.7860538", "0.7833763", "0.7833763", "0.78330827", "0.775054", "0.775054", "0.76952904", "0.7520389", "0.7416314", "0.7365596", "0.7365596", "0.73610204", "0.73347986", "0.730954", "0.7284111", "0.7278564", "0.7278564", "0.7278564", "0.7278564", ...
0.82287717
0
inclusive, return its missing ranges. For example, given [0, 1, 3, 50, 75], lower = 0 and upper = 99, return ["2", "4>49", "51>74", "76>99"]. Idea: Add two "artificial" elements, lower 1 before the first element and upper + 1 after the last element
def missing_ranges(array, lower = 0, upper = 99) ranges = [] i = 0 prev = lower - 1 while i <= array.size curr = (i == array.size) ? upper + 1 : array[i] if curr - prev > 1 ranges << get_range(prev + 1, curr - 1) end prev = curr i += 1 end ranges end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_range(range)\n start, finish = range.begin, range.end\n start += length if start < 0\n finish += length if finish < 0\n \n [start, finish - start - (range.exclude_end? ? 1 : 0)]\n end", "def find_missing_ranges(start_of_range, end_of_range)\n missing_ranges = []\n ...
[ "0.6683987", "0.6678718", "0.6539125", "0.64510286", "0.64396644", "0.64024043", "0.639511", "0.6373662", "0.63679487", "0.6353366", "0.63517237", "0.6349964", "0.6349858", "0.6329592", "0.6323406", "0.631339", "0.6310231", "0.6309938", "0.630067", "0.6296694", "0.6291093", ...
0.84420615
0
request github authorization token UserAgent is required store the token in ~/.socialcast/credentials.yml for future reuse
def authorization_token credentials = Socialcast::CommandLine.credentials return credentials[:scgitx_token] if credentials[:scgitx_token] username = current_user raise "Github user not configured. Run: `git config --global github.user 'me@email.com'`" if username.empty? passwor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_token\n json = cli.perform_quietly %Q(curl -u '#{username}:#{password}' -d '{\"scopes\": [\"repo\"], \"notes\": \"Octopolo\"}' https://api.github.com/authorizations)\n self.auth_response = JSON.parse json\n end", "def authorization_token\n credentials = Socialcast::CommandLi...
[ "0.79007196", "0.77020836", "0.709746", "0.68952155", "0.6881059", "0.6824038", "0.68061817", "0.68061817", "0.6804223", "0.67757136", "0.6770038", "0.674015", "0.6619437", "0.6605282", "0.6553398", "0.6529912", "0.6478228", "0.64742595", "0.644068", "0.64196044", "0.6401961"...
0.7847616
1
find the PRs matching the given commit hash
def pull_requests_for_commit(repo, commit_hash) query = "#{commit_hash}+type:pr+repo:#{repo}" say "Searching github pull requests for #{commit_hash}" github_api_request "GET", "search/issues?q=#{query}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_requests_for_commit(token, repo, commit_hash)\n query = \"#{commit_hash}+type:pr+repo:#{repo}\"\n say \"Searching github pull requests for #{commit_hash}\"\n response = RestClient::Request.new(:url => \"https://api.github.com/search/issues?q=#{query}\", :method => \"GET\", :headers =>...
[ "0.77069473", "0.6985027", "0.69659513", "0.6592675", "0.64969283", "0.63676095", "0.6133077", "0.6016445", "0.60024786", "0.59328055", "0.5867446", "0.58608264", "0.58464605", "0.58458793", "0.5804162", "0.5729812", "0.57268614", "0.56683886", "0.5660149", "0.56569433", "0.5...
0.7816156
0
find the PRs for a given branch
def pull_requests_for_branch(repo, branch) head_name = "#{repo.split('/').first}:#{branch}" github_api_request "GET", "repos/#{repo}/pulls?head=#{head_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_pr_for_branch(repo, branch)\n prs = pull_requests_for_branch(repo, branch)\n raise \"Multiple (#{prs.size}) open PRs for #{branch} found in #{repo}, unable to proceed\" if prs.size > 1\n prs.first\n end", "def fetch_commits(branch) \n puts \"Getting commits of ...
[ "0.69581246", "0.6518977", "0.63540035", "0.6331586", "0.62808853", "0.6209724", "0.61658937", "0.60042477", "0.59510344", "0.59229934", "0.58539414", "0.5818391", "0.5793207", "0.57590646", "0.57470596", "0.57429445", "0.570688", "0.5659186", "0.565648", "0.56480575", "0.563...
0.7190601
0
find the current PR for a given branch
def current_pr_for_branch(repo, branch) prs = pull_requests_for_branch(repo, branch) raise "Multiple (#{prs.size}) open PRs for #{branch} found in #{repo}, unable to proceed" if prs.size > 1 prs.first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_branch\n repo.branches.find(&:head?)\n end", "def get_pr_identifier(branch_name)\n puts \"Resolving PR identifier for: #{branch_name}\"\n return 0 if branch_name.nil? || (branch_name.include? 'master')\n\n branch_name.split('/')[0].to_i\nend", "def pull_requests_for_branch(repo, ...
[ "0.67537725", "0.6692139", "0.66807646", "0.6635551", "0.6568793", "0.65409184", "0.65219975", "0.65086967", "0.6505208", "0.6485328", "0.6485328", "0.6456248", "0.6403993", "0.6392943", "0.63850236", "0.63757265", "0.63757265", "0.6360421", "0.63597554", "0.63435614", "0.633...
0.8368944
0
post a comment on an issue
def comment_on_issue(issue_url, comment_body) github_api_request 'POST', "#{issue_url}/comments", { :body => comment_body }.to_json end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_comment_to_issue(issue, author)\n comment= RemoteComment.new(\"#{Time.now} , #{author} make a commit on this issue\")\n @tracker.addComment(issue.key,comment)\n end", "def add_comment_to_issue(issue_name, comment_text)\n\tissue = @client.Issue.find(issue_name)\n\tcomment = issue.comments.build\n\t...
[ "0.7415413", "0.74066144", "0.73876655", "0.71542144", "0.7137533", "0.71215117", "0.70875984", "0.70124453", "0.6903345", "0.68052435", "0.6795784", "0.6775135", "0.6768582", "0.6688634", "0.66666883", "0.6638616", "0.6609908", "0.6609587", "0.66072965", "0.6560742", "0.6545...
0.7454581
0
Returns table cells collection.
def cells(opts = {}) CellCollection.new(self, opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cells\n @cells ||= []\n end", "def cells\n @cells\n end", "def cells\n @cells\n end", "def cells\n rows.flatten\n end", "def cells\n attributes.fetch(:cells)\n end", "def cells\n rows.map { |r| r[key] }\n end", "def cells\n Enumer...
[ "0.78725225", "0.77786577", "0.77786577", "0.76812106", "0.75019777", "0.7478608", "0.74318737", "0.74230987", "0.74049073", "0.7091562", "0.7081813", "0.7026354", "0.674792", "0.670024", "0.66409636", "0.66023177", "0.63373744", "0.63229096", "0.6320099", "0.63064575", "0.62...
0.650395
16
This method generates an array of all moves that can be made after the current move.
def children children_result = [] empty_positions = [] (0..2).each do |idx1| (0..2).each do |idx2| empty_positions << [idx1,idx2] if @board.empty?([idx1,idx2]) end end empty_positions.each do |pos| dup_board = @board.dup dup_board[pos] = next_mover_mark next_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_possible_moves\n positions_array = []\n x = @position[0]\n y = @position[1]\n next_position = [x+1,y+2]\n positions_array << next_position if position_check(next_position)\n next_position = [x+1,y-2]\n positions_array << next_position if position_check(next_position)\n next_positio...
[ "0.74542904", "0.7448149", "0.74069035", "0.7375318", "0.72373027", "0.7234965", "0.7215259", "0.72118765", "0.72038615", "0.71801317", "0.71401936", "0.71162206", "0.70881444", "0.7080469", "0.70726323", "0.70608085", "0.7033311", "0.70258737", "0.6983692", "0.69750845", "0....
0.0
-1
start page for artist work submission
def submit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_work_on(guide)\n visit \"/admin\"\n click_on \"Lined up\"\n assert page.has_content?(guide.title)\n within :xpath, \"//form[contains(@action, '#{guide.id}/start_work')]\" do\n click_on \"Start work\"\n end\n assert page.has_content?(\"Work started\")\n end", "def startpage\n\t\t...
[ "0.6063066", "0.5988944", "0.58113235", "0.58113235", "0.58075", "0.57673055", "0.57594466", "0.57282054", "0.57133996", "0.5689413", "0.5683086", "0.5683086", "0.5677375", "0.56640583", "0.56470436", "0.56285757", "0.5602851", "0.55918556", "0.5587698", "0.556948", "0.555953...
0.0
-1
confirm that artist accepts guidelines
def accept session[:accept] = 1 redirect_to new_work_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_another_artist?\n @prompt.yes?(\"Would you like to add another artist?\")\n end", "def pregnancy_to_confirm\n # TODO: add (Just to confirm) . . . if participant known to be pregnant\n \"A\"\n end", "def clickbait\n if title && !title.include?(\"Won't Believe\"||\"Secret\"||\"Top...
[ "0.64752465", "0.6184268", "0.61469567", "0.580671", "0.579128", "0.57843924", "0.57774216", "0.5711132", "0.57070607", "0.5705888", "0.5683863", "0.5641864", "0.56274945", "0.56274945", "0.56274945", "0.5617044", "0.56057566", "0.5599359", "0.5593199", "0.5593199", "0.559278...
0.0
-1
thank you page after submission
def thank_you end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def thankyou\n end", "def thankyou\n end", "def thanks\n RequestMailer.thanks\n end", "def ask\n if @help_request.valid?\n MyousicaMailer.deliver_help_request(@help_request)\n flash[:notice] = \"Thanks for contacting us! Your question has been sent to our help desk, you'll receive a reply ...
[ "0.78696096", "0.78696096", "0.69029075", "0.6889517", "0.67891306", "0.67203104", "0.66887355", "0.6679805", "0.66719115", "0.6603204", "0.65716594", "0.6543556", "0.6401551", "0.6378175", "0.6359422", "0.6358141", "0.63331527", "0.63312054", "0.63078684", "0.6230283", "0.62...
0.78332454
2
JSONLD structure Will return JSON LD data if defined for the page
def get_json_ld() parent_data = {'datePublished' => self.created_at, 'dateModified' => self.updated_at} data = [] if dc_json_lds.size > 0 dc_json_lds.where(active: true).each do |element| dta = element.get_json_ld(parent_data) data << dta if dta.size > 0 end end data ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_ld; end", "def to_jsonld( hash )\n JSON::LD::API.expand( hash )\n end", "def as_jsonld\n provenance\n JSON::LD::API::fromRDF(@graph)\n end", "def json_ld\n Jekyll.logger.warn \"Jekyll::SeoTag::JSONLD is deprecated\"\n @json_ld ||= JSONLDDrop.new(self)\n end"...
[ "0.76196873", "0.68247616", "0.6694707", "0.64687437", "0.64636517", "0.6447008", "0.6188326", "0.61584365", "0.6134873", "0.6128769", "0.6024418", "0.5906851", "0.5890347", "0.5826099", "0.58240825", "0.5809728", "0.5657938", "0.5637948", "0.56160456", "0.5614645", "0.560462...
0.6312572
6
multiple ranges : ranges=A1:D5&ranges=Sheet2!A1:C4 If you not write the sheet name, it will be the first visible sheet
def get_range_data(spreadsheet_id, ranges) req_url = spreadsheet_path("#{spreadsheet_id}/values:batchGet?#{ranges}") Api.get_with_google_auth(req_url, @access_token).parse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_range_parts(range)\n if range =~ /([' a-zA-Z]+!)?([A-Z]+\\d+):([A-Z]+\\d+)/\n sheet = $1\n range1 = $2\n range2 = $3\n if sheet\n sheet = sheet[0..sheet.size-2]\n if sheet =~ /'(.+)'/\n sheet = $1\n end\n end\n return [sheet, range1, range2]\n ...
[ "0.61311585", "0.600341", "0.5912605", "0.5666766", "0.5532641", "0.5338881", "0.530316", "0.52701694", "0.5261661", "0.5238356", "0.522998", "0.52148885", "0.52102053", "0.5203397", "0.5199746", "0.51772964", "0.5109517", "0.5093684", "0.50808203", "0.50693405", "0.50693405"...
0.55520576
4
a single dash before and after each odd digit. There is one exception: don't start or end the string with a dash. You may wish to use the `%` modulo operation; you can see if a number is even if it has zero remainder when divided by two. Difficulty: medium.
def dasherize_number(num) num_string = num.to_s idx = 0 while idx < num_string.length-1 if num_string[idx].to_i % 2 != 0 num_string.insert(idx+1, "-") end idx += 1 end while num_string[idx] != "-" if num_string[idx2].to_i % 2 == 0 && num_string[idx2+1] != "-" puts "#{num_string[idx2]} qualifies" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dasherize_number(num)\n\n index = 0\n \n num_string = num.to_s\n new_string = ''\n \n while index < num_string.length\n # Simplify your checks for odd and evenness here. \n # You are checking for so many things which makes the code messy.\n # Just divide the number using modulo you don't need to chec...
[ "0.83199674", "0.7943096", "0.79272825", "0.79227567", "0.7920817", "0.78994495", "0.78490686", "0.7774895", "0.7765534", "0.77038646", "0.770371", "0.7688073", "0.76619536", "0.7653393", "0.7652072", "0.7632724", "0.7631717", "0.7612521", "0.76065284", "0.7601362", "0.758299...
0.796755
1
Send a request to Airship's API
def send_request(method: required('method'), path: nil, url: nil, body: nil, content_type: nil, encoding: nil, auth_type: :basic) req_type = case method when 'GET' :get when 'POST' :post when 'PUT' :put when 'DELE...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_request method, params = nil\n\t\t\tconnection = ZenfolioAPI::HTTP.new()\n\t\t\t@response = connection.POST(method, params, @auth.token)\n\t\tend", "def send_request method, params = {}\n uri = URI.parse(@api_url)\n if Time.now.to_i > @exp + 3600\n get_acces_token\n @exp = Time.now.to_i\n...
[ "0.6628872", "0.6592904", "0.6576277", "0.65641737", "0.65306175", "0.65167075", "0.64588153", "0.6361877", "0.6298487", "0.6181808", "0.61746407", "0.6173882", "0.6162016", "0.61580235", "0.61412376", "0.613671", "0.6120592", "0.6113011", "0.61107564", "0.6108852", "0.609901...
0.6878526
0
Create a Push Object
def create_push Push::Push.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push\n end", "def push name='create'\n \n end", "def push\n end", "def init_push\n ## empty\n end", "def push(p)\n @obj << p\n end", "def push(x)\n \n end", "def push(x)\n \n end", "def push(x)\n end", "def push(item); end", "def push(item)\n ...
[ "0.7891082", "0.7793675", "0.77476406", "0.760049", "0.7543264", "0.7471354", "0.7471354", "0.7317717", "0.7311111", "0.73090714", "0.7249172", "0.7245469", "0.7136501", "0.707143", "0.70623606", "0.70516825", "0.70492256", "0.7031239", "0.69953436", "0.69472224", "0.69137985...
0.82427317
0
Create a Scheduled Push Object
def create_scheduled_push Push::ScheduledPush.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_push\n PushNotification.push_to_user!(uid: @spot.priest.id, payload: push_payload)\n end", "def create_push\n Push::Push.new(self)\n end", "def push name='create'\n \n end", "def create\n @notification = Notification.new(notification_params)\n @notification.app = @app\n\n...
[ "0.71208954", "0.68654627", "0.6805676", "0.63060486", "0.61813194", "0.6109686", "0.6097779", "0.599136", "0.59656173", "0.5962978", "0.59574026", "0.5929021", "0.59171337", "0.59171337", "0.58963895", "0.5874963", "0.585614", "0.5842182", "0.58372444", "0.5833297", "0.58134...
0.834756
0
Builds the enum from string
def build_from_hash(value) constantValues = LiveDimensions.constants.select { |c| LiveDimensions::const_get(c) == value } raise "Invalid ENUM value #{value} for class #LiveDimensions" if constantValues.empty? value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_from_hash(value)\n constantValues = ExchangeStatus.constants.select { |c| ExchangeStatus::const_get(c) == value }\n raise \"Invalid ENUM value #{value} for class #ExchangeStatus\" if constantValues.empty?\n value\n end", "def build_from_hash(value)\n constantValues = NewOrResale....
[ "0.66046983", "0.6548398", "0.65373033", "0.6528928", "0.64598405", "0.6446511", "0.64443517", "0.6443306", "0.6406087", "0.6405894", "0.6379518", "0.6374375", "0.6367104", "0.6359485", "0.63550735", "0.6346857", "0.63404876", "0.6319777", "0.63088304", "0.6306753", "0.630464...
0.59538156
74
This method replies to the user with the welcoming message through telegram API.
def start send_message('Hello! Welcome to Hedma store🥰') send_message('Which item do you want to buy, dear customer?') user.set_next_bot_command('pants') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_reply(from, to, title, message)\n RestClient.post API_URL+\"/messages\",\n :from => from.email,\n :to => to.email,\n :subject => \"Follow Up: UROP Application for \"+title,\n :text => message\n end", "def reply\n message_body = params[\"Body\"]\n from_number = params[\"From...
[ "0.69929385", "0.69109863", "0.6834608", "0.67054474", "0.65194696", "0.6500081", "0.64860857", "0.6430953", "0.63602823", "0.63131285", "0.6267933", "0.6225614", "0.6210791", "0.61980695", "0.6179513", "0.6172502", "0.613527", "0.6103033", "0.6090004", "0.6074248", "0.606969...
0.0
-1
checking for true intergers
def num_check(num_one,num_two) num_one.to_i.to_s == num_one &&num_two.to_i.to_s == num_two || num_one.to_f.to_s == num_one &&num_two.to_f.to_s == num_two end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def integer?() end", "def check_integer\n if @position == 0 \n return false\n else return true\n end\n end", "def integer?(num)\n num.to_i > 0 && num.to_i.to_s == num\nend", "def int_array_check(arr)\n arr.each do |element|\n Integer(element) != nil rescue return false\n end\n r...
[ "0.7722203", "0.7339659", "0.7205337", "0.7089542", "0.7029524", "0.69790626", "0.69650924", "0.6936173", "0.68736315", "0.68578005", "0.6828094", "0.67877936", "0.6774835", "0.6758825", "0.6758825", "0.6744677", "0.6744677", "0.67211854", "0.6706297", "0.6706297", "0.6652158...
0.0
-1
methods for math operations
def add(num_one,num_two) puts "#{num_one} + #{num_two} = #{num_one + num_two}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def calculation\n end", "def operation(x)\n Math.sqrt(x.abs) + 5 * x ** 3\nend", "def do_math(num1, num2, operation)\n case operation\n when '+'\n num1.to_i + num2.to_i\n when '-'\n num1.to_i - num2.to_i\n when '*'\n num1.to_i * num2.to_i\n when '/'\n num1.to_f / num2.to_f\n ...
[ "0.7470433", "0.73151463", "0.7289202", "0.7278078", "0.7188631", "0.7108409", "0.7053834", "0.7028404", "0.7015173", "0.6959689", "0.6889479", "0.68835735", "0.68668944", "0.6852768", "0.68201506", "0.6818325", "0.6808176", "0.67941386", "0.67739725", "0.6764867", "0.6745565...
0.0
-1
Returns the modified time of the file, which is used as version number
def updated_at File.stat("#{RAILS_ROOT}/public/games/container.swf").mtime end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mod_time\n File.mtime(@filepath)\n end", "def get_modification_timestamp(path)\n File.mtime(path)\n end", "def source_file_mtime; end", "def last_modified_time\n mtime\n end", "def mtime\n File.mtime(file)\n end", "def fs_fileMtime(p)\n raise \"File: #{p} do...
[ "0.8224365", "0.8036859", "0.7851577", "0.78320366", "0.7787342", "0.77871805", "0.7756993", "0.76489586", "0.7635276", "0.7597495", "0.759071", "0.75390327", "0.75042623", "0.75042623", "0.7499012", "0.7418025", "0.7402437", "0.73917043", "0.7389778", "0.7389778", "0.7374485...
0.67928594
63
Validates and updates client, returns false if there is error
def upload_and_update(params) files = {'container' => 'container.swf'} locales = CONF[:locales].dup; locales.delete('en') locales.each do |l| files[l] = "#{l}.mo" end files.each do |k, v| data = params[k] unless data.blank? f = File.new("#{RAILS_ROOT}/public/g...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate\n r = super\n return r unless r.success?\n\n r = fetch_and_validate_client\n return r unless r.success?\n\n success\n end", "def validate_client\n ClientValidator.validate(lock_config)\n end", "def fetch_and_validate_client\n @client = Client.get_from_mem...
[ "0.7052749", "0.7049071", "0.6803206", "0.6800063", "0.67960846", "0.67939186", "0.67697746", "0.673977", "0.673977", "0.6429196", "0.64134264", "0.63956577", "0.6393896", "0.62873286", "0.6275172", "0.6272231", "0.6228706", "0.6225877", "0.62121856", "0.61760825", "0.6150348...
0.0
-1
Faire un echo, ici doublee
def echo(a) a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def echo(value); end", "def echo(value); end", "def echo(text)\n\ttext \nend", "def echo(str)\n\tstr\nend", "def echo(str)\n\tstr\nend", "def echo(string)\n string\n end", "def echo(str)\n str\n end", "def echo(phrase)\n\treturn \"#{phrase}\"\nend", "def echo(text)\n text\nend", "def...
[ "0.73634416", "0.73634416", "0.72298855", "0.7217283", "0.7217283", "0.713032", "0.7054546", "0.69923455", "0.68798065", "0.6820712", "0.6799501", "0.6758211", "0.6740983", "0.66923505", "0.66855776", "0.66749054", "0.6666255", "0.6649893", "0.6634983", "0.66294634", "0.66201...
0.6785574
11
Pour afficher la premiere lettre d'un mot
def start_of_word(word,nb) word[0...nb] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def motto; end", "def set_mot new_mot\n\n # Différence de longueur entre le mot précédent et le nouveau mot.\n diff_len = new_mot.length - length\n\n old_mot_base = \"#{self.mot_base}\".freeze\n new_mot_base = Texte::Mot.get_mot_base(new_mot).freeze\n Tests::Log << <<-EOT\nold mot base : #{old_mot...
[ "0.69803345", "0.6066462", "0.59604377", "0.573722", "0.57361573", "0.5689158", "0.568837", "0.56748414", "0.5642111", "0.5621128", "0.56188244", "0.5597578", "0.5591787", "0.55673635", "0.5522972", "0.5486775", "0.5483412", "0.5436142", "0.5414529", "0.53873867", "0.53873867...
0.0
-1
Pour afficher le premier mot
def first_word(sentence) sentence.split[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def motto; end", "def set_mot new_mot\n\n # Différence de longueur entre le mot précédent et le nouveau mot.\n diff_len = new_mot.length - length\n\n old_mot_base = \"#{self.mot_base}\".freeze\n new_mot_base = Texte::Mot.get_mot_base(new_mot).freeze\n Tests::Log << <<-EOT\nold mot base : #{old_mot...
[ "0.68946385", "0.6305964", "0.58074355", "0.5725549", "0.5685033", "0.56797934", "0.56460965", "0.56302965", "0.5610192", "0.56101245", "0.5564911", "0.5557352", "0.5538549", "0.5475707", "0.54508567", "0.5444877", "0.54034406", "0.53810537", "0.53767914", "0.53767914", "0.53...
0.0
-1
cette Methode met en majuscul un mot par rapport au condition
def titleize(sentence) sentence = sentence.split.map.with_index do|word,i| if i == 0 word = word.capitalize elsif word != "and" && word != "the" word = word.capitalize else word end end return sentence.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def imc\n\t\tnum = (@peso/(@talla*@talla)).round(2)\n\t\tif num < 18.5\n\t\t\tnum #- Bajo peso\"\n\t\telsif num > 18.5 and num < 24.9\n\t\t\tnum #- Adecuado\"\n\t\telsif num > 25.0 and num < 29.9\n\t\t\tnum #- Sobrepeso\"\n\t\telsif num > 30.0 and num < 34.9\n\t\t\tnum #Obesidad grado 1\"\n\t\telsif num > 35.0 an...
[ "0.63738495", "0.5803392", "0.5719487", "0.56296533", "0.55941075", "0.5557217", "0.5537862", "0.5516806", "0.5477643", "0.5451713", "0.545138", "0.54010993", "0.53968847", "0.53891194", "0.53873634", "0.53539884", "0.5346031", "0.5343158", "0.534051", "0.53321", "0.5331983",...
0.0
-1
GET /snifs GET /snifs.json
def index @snifs = Snif.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end", "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snps }\n end\n e...
[ "0.6512744", "0.621675", "0.60603684", "0.5856447", "0.58197993", "0.5725767", "0.56354535", "0.56300294", "0.5623959", "0.56222576", "0.5618928", "0.5599752", "0.55958164", "0.55904275", "0.5587488", "0.5583901", "0.5573124", "0.5565428", "0.5535591", "0.55350655", "0.550256...
0.7287172
0
GET /snifs/1 GET /snifs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @snifs = Snif.all\n end", "def index\n @snips = Snip.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @snips }\n end\n end", "def index\n @snps = Snp.all\n\n respond_to do |format|\n format.html # index.html.erb\n for...
[ "0.6978486", "0.6545009", "0.64423627", "0.6329921", "0.6122336", "0.60657585", "0.6058813", "0.5967574", "0.5949536", "0.5945823", "0.5925284", "0.59218657", "0.59180915", "0.5891826", "0.5862299", "0.58598745", "0.5854678", "0.5846624", "0.5833891", "0.5812093", "0.5784231"...
0.0
-1
POST /snifs POST /snifs.json
def create @snif = Snif.new(snif_params) respond_to do |format| if @snif.save format.html { redirect_to @snif, notice: 'Snif was successfully created.' } format.json { render :show, status: :created, location: @snif } else format.html { render :new } format.json { re...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def snif_params\n params.require(:snif).permit(:name, :phone_number, :address, :city, :state, :zipcode, :mcr_rating, :beds_capacity, :medicare, :medicaid, :percentage_occupied, :beds_unavailable, :in_hospital, :population, :corporation)\n end", "def create\n @snail = Snail.new(snail_params)\n\n res...
[ "0.65895134", "0.6065134", "0.5899985", "0.5772281", "0.57592726", "0.57537526", "0.5712918", "0.5708387", "0.5691933", "0.56793624", "0.5622553", "0.5619449", "0.5572421", "0.5571187", "0.55630267", "0.5501675", "0.5474147", "0.5446093", "0.5358653", "0.5347094", "0.5343273"...
0.7237168
0
PATCH/PUT /snifs/1 PATCH/PUT /snifs/1.json
def update respond_to do |format| if @snif.update(snif_params) format.html { redirect_to @snif, notice: 'Snif was successfully updated.' } format.json { render :show, status: :ok, location: @snif } else format.html { render :edit } format.json { render json: @snif.errors,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @spliff.update(spliff_params)\n format.html { redirect_to '/spliffs', notice: 'Spliff was successfully updated.' }\n format.json { redirect_to '/spliffs', status: :ok, location: '/spliffs' }\n else\n format.html { render :edit }\n fo...
[ "0.6109552", "0.60892266", "0.60892266", "0.5995837", "0.59838444", "0.5948596", "0.5926679", "0.5914574", "0.58887005", "0.5882957", "0.58363485", "0.57967156", "0.57857895", "0.5782142", "0.5778318", "0.575555", "0.5749949", "0.57302237", "0.56865627", "0.56858027", "0.5669...
0.66619235
0
DELETE /snifs/1 DELETE /snifs/1.json
def destroy @snif.destroy respond_to do |format| format.html { redirect_to snifs_url, notice: 'Snif was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @snip = Snip.find(params[:id])\n @snip.destroy\n\n respond_to do |format|\n format.html { redirect_to snips_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @snail.destroy\n respond_to do |fo...
[ "0.6636524", "0.64919865", "0.64625436", "0.64625436", "0.6438211", "0.64175147", "0.64059186", "0.6385224", "0.6358825", "0.6337138", "0.6309166", "0.62930757", "0.6292983", "0.62787616", "0.6268293", "0.62357444", "0.62136734", "0.62060666", "0.62060666", "0.61993486", "0.6...
0.7202979
0
Use callbacks to share common setup or constraints between actions.
def set_snif @snif = Snif.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 snif_params params.require(:snif).permit(:name, :phone_number, :address, :city, :state, :zipcode, :mcr_rating, :beds_capacity, :medicare, :medicaid, :percentage_occupied, :beds_unavailable, :in_hospital, :population, :corporation) 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
Complete the minimumBribes function below.
def minimumBribes(q) cont = 0 for i in (q.size-1).downto(2) #p " (#{i}) ==> #{q}" if !v(q,i) cont = "Too chaotic" break elsif q[i]-1 != i if q[i-1]-1 == i aux = q[i] q[i] = q[i-1] q[i-1] = aux else aux = q[i] q[i] = q[i-2] q[i-2] =...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min() end", "def minimumBribes(q)\n q.each_with_index.inject(0) do |bribes, (actual, index)|\n return bribes if q[index + 1].nil?\n\n index_diff = actual - index - 1\n maximun_distance = actual - 2\n distance = if index_diff <= 0 && maximun_distance >= 0 then\n q[maximun_distance...index].a...
[ "0.70699006", "0.69130206", "0.65860534", "0.65860534", "0.6475157", "0.6475157", "0.6411656", "0.6282819", "0.6186927", "0.611814", "0.6104782", "0.6100883", "0.608272", "0.60620993", "0.60420054", "0.6021028", "0.601942", "0.60166484", "0.6010683", "0.6010683", "0.5993276",...
0.6343342
7
takes three arguments, firstname, lastname, year
def generate_username3 (*allArgs) year = allArgs[2].to_s if year.length != 4 then return nil end alphaName = generate_username2(allArgs[0],allArgs[1]) return alphaName + year[-2..-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_requirements(fname, lname, month, yearofbirth)\n full_name = fname + ' ' + lname\n today_year = 2014\n today_month = 9\n month = 9\n yearofbirth = 1990\n final_age = (today_year - yearofbirth) + final_age_month\n puts full_name \n puts final_age\n end", "def year() end", "de...
[ "0.6912661", "0.6793854", "0.6777584", "0.66535723", "0.65614414", "0.65614414", "0.65012807", "0.64443433", "0.64105326", "0.6403897", "0.6403228", "0.63742787", "0.63668203", "0.63531137", "0.6321722", "0.62380445", "0.6233675", "0.6233675", "0.6216638", "0.618923", "0.6170...
0.5951388
41
sender setting for mailwrapper
def add @mailwrapper_sender = MailwrapperSender.new(params[:mailwrapper_sender]) if ! (request.get? || request.xhr?) @mailwrapper_sender.project_id = @project.id if ! @mailwrapper_sender.sender.empty? && @mailwrapper_sender.save flash[:notice] = l(:notice_successful_create) redirect_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_sender\n DEFAULT_SENDER\n end", "def sender_email\n msg['from_email'] || msg['sender'] || entry['sender'] || reject['sender']\n end", "def update_sender\n if !@from_name.blank? and from_email_address and !@from_email_address.empty? and !(@from_name.to_s == @from_email_address.to_s )\n ...
[ "0.7689218", "0.7489257", "0.747272", "0.74446666", "0.7413803", "0.73751295", "0.7306821", "0.72129333", "0.7059625", "0.7040805", "0.7020412", "0.6959056", "0.69341856", "0.69323504", "0.6924544", "0.69157445", "0.68838304", "0.6809641", "0.6785926", "0.67586637", "0.673395...
0.0
-1
arr = [0, 1, 5, 7] p two_sum_bad(arr, 6) p two_sum_bad(arr, 10)
def two_sum_sort(array, target) array = array.sort array.each_with_index do |val, idx| a = array.bsearch_index do |el| el == target - val end if a != idx && a return true end end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_sum(nums)\nend", "def sum_not_two(arr)\n arr.reduce(0) { |accum, num| num != 2 ? accum += num : accum }\nend", "def two_sum_brute nums\n (0...nums.length).each do |i|\n ((i + 1)...nums.length).each do |j|\n if nums[i] + nums[j] == 0\n return i, j\n end\n end\n end\n nil\nend"...
[ "0.7599562", "0.73798287", "0.7334541", "0.7224042", "0.7209791", "0.7201778", "0.7155479", "0.71119153", "0.70848715", "0.70824206", "0.70787704", "0.7076926", "0.70265704", "0.70232385", "0.70208615", "0.7015312", "0.7000055", "0.69968194", "0.6991458", "0.6978961", "0.6974...
0.0
-1
arr = [0, 1, 5, 7] p two_sum_sort(arr, 6) p two_sum_sort(arr, 10)
def two_sum_hash(array, target) hsh = Hash.new(0) array.each do |el| hsh[el] += 1 return true if el == target / 2 && hsh[el] >= 2 return true if hsh[target - el] >= 1 && el != target / 2 end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_two_smallest_numbers(arr)\n arr.sort[0] + arr.sort[1]\nend", "def oky_two_sum?(arr, target)\n sorted = arr.sort\n \nend", "def sum_two_smallest_numbers(numbers)\n numbers = numbers.sort\n numbers = numbers[0] + numbers[1]\nend", "def sum_two_smallest_numbers(numbers)\n sorted_numbers = ...
[ "0.7931986", "0.75070447", "0.74509597", "0.7403946", "0.73676085", "0.73674697", "0.73214144", "0.7273327", "0.7248787", "0.7245997", "0.7222283", "0.7203479", "0.71800804", "0.71730864", "0.7146026", "0.7131934", "0.71246386", "0.7100063", "0.70935273", "0.7087412", "0.7083...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.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 trusted parameter "white list" through.
def user_params params.require(:user).permit(:username, :password, :firstname, :lastname, :email) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Utility methods. Ask for confirmation. Returns true/false
def confirm(message, options = {}) confirm_message = options[:confirm_message] || 'Are you sure?' banner = options[:banner] || false banner ? header(message) : puts("\n#{message}") print "#{confirm_message} (yes/no) " choice = STDIN.gets.chomp case choice when 'yes' return true else puts 'Abort...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def confirm?(text='')\n return self.run_cmd('confirm ' + text) == 0\n end", "def confirm(prompt); end", "def confirm?(text)\n return self.run_cmd('confirm ' + text) == 0\n end", "def confirm(prompt)\n return true if config[:yes]\n valid_responses = %w[yes no y n]\n response = nil...
[ "0.791969", "0.78404033", "0.78028405", "0.779943", "0.7677", "0.7640373", "0.75884455", "0.7465596", "0.74057305", "0.7399831", "0.73690546", "0.7289984", "0.7237753", "0.7192274", "0.71631384", "0.71583796", "0.71583796", "0.7149657", "0.7127941", "0.7127941", "0.7126252", ...
0.7351641
11
Displays +message+ inside a formatted header.
def header(message) puts "\n" puts '+---' puts "| #{message}" puts '+---' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_header\n message.header\n end", "def header(msg)\n content_for :header do\n \"<h1>#{msg}</h1>\"\n end\n end", "def header(message)\n return if quiet?\n say(message, [:black, :on_white])\n end", "def header_message\n options.delete(:header_message) || tra...
[ "0.7734596", "0.76774305", "0.7396533", "0.71411455", "0.71388996", "0.7053047", "0.6939127", "0.6836892", "0.6792758", "0.6719506", "0.6704056", "0.67020226", "0.6674194", "0.6639994", "0.6598661", "0.6595082", "0.6568825", "0.65619993", "0.6542637", "0.6537941", "0.6520702"...
0.80003715
0
Used when creating a new animal. Example: Animal.new('Timmy', 4, 'male', 'toad')
def initialize(animal_name, age, gender, species) @animal_name = animal_name @age = age @gender = gender @species = species @toys = [] @pets = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def a_add # Assigning the Animal class with attributes\n print \"Name: \"; name = gets.chomp.to_s\n print \"Age: \"; age = gets.chomp.to_i\n print \"Gender: \"; gender = gets.chomp.to_s\n print \"Species: \"; species = gets.chomp.to_s\n Animal.new(name, age, gender, species)\nend", "def initialize\n @a...
[ "0.71391106", "0.7002378", "0.6945224", "0.6774133", "0.673374", "0.6722593", "0.66953486", "0.66576326", "0.6639601", "0.6623198", "0.6614533", "0.6614533", "0.6614533", "0.6598349", "0.658171", "0.654976", "0.6534545", "0.6533705", "0.6475446", "0.64663416", "0.6445977", ...
0.69915295
2
When we display the animal using puts or print, the to_s method is called to pretty print an Animal
def to_s p "Name :#{@animal_name}. Age: #{@age}. Gender: #{@gender}. Species: #{@species}. Most loved toy: #{toys.join("\n ")}. " end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\r\n pretty_output\r\n end", "def to_s\n \"#{@name} is #{@age} years and is the proud owner of #{@animal}\"\n end", "def to_s\n puts \"#{name} is a #{species} and plays with #{toys.join(\" \")}: \"\n end", "def to_pretty\n to_s(:prettyprint => true)\n end", "def to_s()\n pre...
[ "0.73889667", "0.7126284", "0.7109889", "0.705107", "0.6844391", "0.6831834", "0.6747217", "0.671494", "0.671227", "0.671227", "0.671227", "0.671227", "0.671227", "0.6681847", "0.6665748", "0.66506153", "0.66401666", "0.6476307", "0.6449375", "0.6437454", "0.64344317", "0.6...
0.74007475
0
animate confirm password field in (slide stuff right) or out (slide stuff left)
def animate_signup(direction) direction = (direction == :in ? :right : :left) @in_signup_view = !@in_signup_view [@login_button, @confirm_password_field, @confirm_password_underline].each do |moving_part| moving_part.slide(direction, Device.screen.width) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ask_password\n @display.echo_off\n print 'Enter password (6 - 20 characters): ', false, false\n @state = :new_password\n end", "def modal_confirm_password_field\n $tracer.trace(format_method(__method__))\n return ToolTag.new(@tag.find.input.className(create_ats_regex_string(\"ats-confirmpwdfi...
[ "0.54377615", "0.51595676", "0.49904466", "0.4952331", "0.48267686", "0.48172024", "0.47968668", "0.479164", "0.4767054", "0.47049454", "0.4686325", "0.46229938", "0.4620281", "0.46136996", "0.4584221", "0.45603505", "0.45595634", "0.45577925", "0.45469844", "0.45219705", "0....
0.6779366
0
Validates if endpoint does not exist
def isEndpointPresent? endpoint = Endpoint.find_by_id(params[:id]) if endpoint.nil? render json: { errors:[ { "code": "not_found", "detail": "Requested Endpoint with ID `#{params[:id]}` does not exist" } ] } , status: :not_found ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_endpoint(endpoint)\n begin\n Chef::Log.debug endpoint.get_endpoints\n rescue\n Chef::Log.error \"Unable to connect to the kubernetes api at #{endpoint.api_endpoint}\"\n end\n\n endpoint\n end", "def endpoint_present?\n endpoint = Endpoint.find_by(user_id: ...
[ "0.72944516", "0.71252584", "0.7084834", "0.70534015", "0.6549352", "0.6295214", "0.62877434", "0.6251708", "0.6245642", "0.62324977", "0.6217345", "0.6217345", "0.6217345", "0.6217345", "0.6217345", "0.6217345", "0.6213376", "0.61976016", "0.6174923", "0.6163788", "0.6133859...
0.73324764
0
vi: set ft=ruby :
def ubuntu_box(config, version) config.vm.box = "opscode-ubuntu-#{version}" config.vm.box_url = "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-#{version}_chef-provisionerless.box" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_of_executing_the_commands\n @commands = \":set ft=ruby\r\" + @commands\n RobotVim::Runner.new.run(:input_file => @input, :commands => @commands)\nend", "def ruby\n unless @ruby\n @ruby = \"\"\n @body.each_line do |l|\n @commands << {:ruby => l}\n @ruby << l\n ...
[ "0.5803009", "0.5457295", "0.544725", "0.5440447", "0.540047", "0.5387971", "0.53144646", "0.520739", "0.5160547", "0.5159978", "0.5159782", "0.5146485", "0.5083554", "0.50814515", "0.5080929", "0.5077087", "0.50639117", "0.50580174", "0.50580174", "0.50380445", "0.50380445",...
0.0
-1
GET /api/v1/initiative_fields GET /api/v1/initiative_fields.json
def index @api_v1_initiative_fields = Api::V1::InitiativeField.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_v1_initiative_field_params\n params.fetch(:api_v1_initiative_field, {})\n end", "def create\n @api_v1_initiative_field = Api::V1::InitiativeField.new(api_v1_initiative_field_params)\n\n respond_to do |format|\n if @api_v1_initiative_field.save\n format.html { redirect_to @api_v1...
[ "0.7723314", "0.7501595", "0.71824867", "0.66804445", "0.65187544", "0.64563215", "0.6453909", "0.6088169", "0.6053182", "0.60446984", "0.6023695", "0.5989668", "0.58562386", "0.58300763", "0.577786", "0.57694787", "0.5708566", "0.56879383", "0.56238157", "0.5576216", "0.5559...
0.843062
0
GET /api/v1/initiative_fields/1 GET /api/v1/initiative_fields/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @api_v1_initiative_fields = Api::V1::InitiativeField.all\n end", "def create\n @api_v1_initiative_field = Api::V1::InitiativeField.new(api_v1_initiative_field_params)\n\n respond_to do |format|\n if @api_v1_initiative_field.save\n format.html { redirect_to @api_v1_initiative_fie...
[ "0.8312915", "0.77173805", "0.7683618", "0.7560437", "0.70570254", "0.64728236", "0.6333762", "0.63068646", "0.6257241", "0.614246", "0.6114353", "0.601756", "0.5970863", "0.5907183", "0.58496946", "0.58447194", "0.5844131", "0.5799392", "0.5793104", "0.5776108", "0.5767621",...
0.0
-1
POST /api/v1/initiative_fields POST /api/v1/initiative_fields.json
def create @api_v1_initiative_field = Api::V1::InitiativeField.new(api_v1_initiative_field_params) respond_to do |format| if @api_v1_initiative_field.save format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully created.' } format.json { render :show,...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_v1_initiative_field_params\n params.fetch(:api_v1_initiative_field, {})\n end", "def index\n @api_v1_initiative_fields = Api::V1::InitiativeField.all\n end", "def set_api_v1_initiative_field\n @api_v1_initiative_field = Api::V1::InitiativeField.find(params[:id])\n end", "def updat...
[ "0.73445326", "0.7257176", "0.66346407", "0.655461", "0.65532094", "0.6166312", "0.6070766", "0.601722", "0.58630085", "0.5820158", "0.5724576", "0.56923926", "0.56550735", "0.56335205", "0.56181544", "0.56143594", "0.5607784", "0.5584821", "0.55098534", "0.55012184", "0.5467...
0.8106156
0
PATCH/PUT /api/v1/initiative_fields/1 PATCH/PUT /api/v1/initiative_fields/1.json
def update respond_to do |format| if @api_v1_initiative_field.update(api_v1_initiative_field_params) format.html { redirect_to @api_v1_initiative_field, notice: 'Initiative field was successfully updated.' } format.json { render :show, status: :ok, location: @api_v1_initiative_field } el...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @api_v1_initiative.update(api_v1_initiative_params)\n format.html { redirect_to @api_v1_initiative, notice: 'Initiative was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_initiative }\n else\n format.h...
[ "0.7024709", "0.70156956", "0.6961527", "0.6829162", "0.67827517", "0.66591793", "0.66242135", "0.66071653", "0.64481336", "0.6429974", "0.6347016", "0.62987673", "0.62840086", "0.6219578", "0.60922986", "0.6078671", "0.6072752", "0.59006304", "0.5867877", "0.585743", "0.5828...
0.7848958
0
DELETE /api/v1/initiative_fields/1 DELETE /api/v1/initiative_fields/1.json
def destroy @api_v1_initiative_field.destroy respond_to do |format| format.html { redirect_to api_v1_initiative_fields_url, notice: 'Initiative field was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @api_v1_initiative.destroy\n respond_to do |format|\n format.html { redirect_to api_v1_initiatives_url, notice: 'Initiative was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @api_v1_initiative_update.destroy\n respond_to do |for...
[ "0.7065923", "0.7009382", "0.6936364", "0.68974495", "0.6778656", "0.67338777", "0.66560256", "0.66560256", "0.6584064", "0.6520123", "0.6498632", "0.6460441", "0.64578813", "0.6402055", "0.6399952", "0.63947755", "0.63699967", "0.6365126", "0.63546544", "0.6344312", "0.63269...
0.8254054
0
Use callbacks to share common setup or constraints between actions.
def set_api_v1_initiative_field @api_v1_initiative_field = Api::V1::InitiativeField.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 api_v1_initiative_field_params params.fetch(:api_v1_initiative_field, {}) 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
atime, ctime, mtime, and utime aren't implemented in FuseFS yet
def atime(path) utime(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mtime() end", "def mtime() end", "def mtime; end", "def mtime; end", "def utime(atime, mtime) File.utime(atime, mtime, path) end", "def now_at_fs_resolution\n test_filename = \"#{Dir.pwd}/deleteme\"\n FileUtils.touch test_filename\n File.atime(test_filename)\nend", "def utime( atime, mtime ) Fil...
[ "0.75094694", "0.75094694", "0.72661656", "0.72661656", "0.68732303", "0.6724163", "0.6632858", "0.66228586", "0.66168195", "0.6569131", "0.6493252", "0.6488087", "0.63379997", "0.63023835", "0.622137", "0.62174326", "0.62091076", "0.61733454", "0.61321276", "0.6129247", "0.6...
0.59629786
35
Split up text by whitespace
def initialize(text) @words = text.split(" ") @next = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_text( text )\n result =text.split(/[\\n,\\r]/)\n end", "def split_text(text)\n if @wrap == :word\n text, skip = text.split(/\\s/), -1\n cc = /(\\\\\\w\\[\\w+\\])(.+)/\n text.each_with_index do |w,i|\n next if i < skip\n w << ' ' unless w[-1] == ' '\n rarr = []...
[ "0.7508139", "0.739284", "0.73628974", "0.7062535", "0.7022279", "0.69966364", "0.69073457", "0.6865187", "0.67547387", "0.66776025", "0.6617737", "0.6609236", "0.6597058", "0.65695536", "0.65654665", "0.6538607", "0.6516808", "0.651548", "0.6514573", "0.65105134", "0.6479179...
0.0
-1
Return the next word in the text
def next_word return if @next > @words.length word = @words[@next] @next += 1 return word end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_word\n start = @optr\n len = @txt.length\n\n while @optr < len && @txt[@optr].char != \" \"\n @optr += 1\n end\n\n while @optr < len && @txt[@optr].char == \" \"\n @optr += 1\n end\n\n @txt[start...@optr]\n end", "def next_word\n ...
[ "0.8411678", "0.7468841", "0.71054155", "0.70267624", "0.7008789", "0.6904551", "0.68696564", "0.67985815", "0.6755097", "0.6668692", "0.6646445", "0.6614941", "0.65849394", "0.6542342", "0.65301657", "0.6516317", "0.6487122", "0.64480424", "0.6447275", "0.6443995", "0.642288...
0.79602975
1
GET /vendedors GET /vendedors.json
def index @bg_gray = true @vendedors = Vendedor.where(punto_venta_id: current_user.punto_venta_id).where('baja is null or baja = false') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @vendedors = Vendedor.all\n end", "def venues(options = {})\n self.class.require_latitude_and_longitude(options)\n\n response = self.class.get(\"/venues.json\", :query => options, :basic_auth => @auth)[\"venues\"]\n response && response.flatten\n end", "def managed_venues\n\t\t\t get...
[ "0.7770894", "0.6679106", "0.64023197", "0.6379661", "0.62719244", "0.6245215", "0.6225248", "0.6204655", "0.6204655", "0.61447376", "0.61447376", "0.61447376", "0.61447376", "0.6105175", "0.60989994", "0.60911137", "0.60817116", "0.6080065", "0.60707337", "0.6051008", "0.596...
0.55393195
63
GET /vendedors/1 GET /vendedors/1.json
def show @bg_gray = true respond_to do |format| format.html format.pdf do render :pdf => 'obj_vend_pdf', :template => 'vendedors/obj_vend_pdf.html.erb', :layout => 'pdf.html.erb', :orientation => 'Portrait',# default Portrait :page_size => 'Legal' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @vendedors = Vendedor.all\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n fo...
[ "0.7484763", "0.66445196", "0.66445196", "0.66445196", "0.6558193", "0.6534067", "0.651859", "0.64890325", "0.6470065", "0.64488566", "0.64488566", "0.64488566", "0.64488566", "0.6372615", "0.6338768", "0.6338768", "0.6314814", "0.6290659", "0.6288132", "0.62611574", "0.62398...
0.0
-1
POST /vendedors POST /vendedors.json
def create @vendedor = Vendedor.new(vendedor_params) if vendedor_params["punto_venta_id"].nil? @vendedor.punto_venta_id = current_user.punto_venta_id end if current_user.punto_venta.vendedors.order(:avance).last == nil @vendedor.avance = 1 else @vendedor.avance = current_user.punt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vendedor = Vendedor.new(vendedor_params)\n\n respond_to do |format|\n if @vendedor.save\n format.html { redirect_to @vendedor, notice: 'Vendedor was successfully created.' }\n format.json { render :show, status: :created, location: @vendedor }\n else\n format.html...
[ "0.69403136", "0.69403136", "0.64879555", "0.64755523", "0.6442584", "0.6377389", "0.6023341", "0.5879122", "0.5879122", "0.5879122", "0.5879122", "0.58669394", "0.58669394", "0.5838501", "0.57319224", "0.57319224", "0.5706257", "0.5706257", "0.5700348", "0.566701", "0.564908...
0.56077355
23
POST /vendedors/actualizar_objetivos Metodo para crear nuevos Objetivos Mensuales de un Vendedor o editar su valor (Ajax request) Parametros: Mes, Anio, Vendedor, cantidad para cada Objetivo Mensual
def actualizar_objetivos mes = params[:mes] anio = params[:anio] @vendedor = Vendedor.find(params[:vendedor][:id]) cantidad_op = params[:oportunidades] cantidad_pm = params[:pruebas_manejo] cantidad_v = params[:ventas] cantidad_f = params[:financiaciones] cantidad_c = params[:calidad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @objetivo = Objetivo.new(objetivo_params)\n @objetivo.mision= @mision\n\n respond_to do |format|\n if @objetivo.save\n format.html { redirect_to [@mision, @objetivo], notice: 'Objetivo was successfully created.' }\n format.json { render :show, status: :created, location: [@...
[ "0.65007246", "0.64433295", "0.62116563", "0.61910725", "0.6174447", "0.6165192", "0.6162376", "0.61618936", "0.6129006", "0.6127996", "0.6069033", "0.60599226", "0.60576266", "0.60513437", "0.6042832", "0.6030313", "0.60178614", "0.5996448", "0.59885174", "0.59815633", "0.59...
0.75975126
0
PATCH/PUT /vendedors/1 PATCH/PUT /vendedors/1.json
def update respond_to do |format| if @vendedor.update(vendedor_params) format.html { redirect_to @vendedor, notice: 'Vendedor was successfully updated.' } format.json { render :show, status: :ok, location: @vendedor } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @vendedor.update(vendedor_params)\n format.html { redirect_to @vendedor, notice: t('.atualizado') }\n format.json { render :show, status: :ok, location: @vendedor }\n else\n format.html { render :edit }\n format.json { render json: @...
[ "0.666233", "0.6574446", "0.65697235", "0.63121486", "0.63121486", "0.62930536", "0.6283552", "0.6167473", "0.6154628", "0.61425316", "0.61300963", "0.6087976", "0.6067888", "0.6061622", "0.60593194", "0.6050315", "0.60371834", "0.6033888", "0.6033888", "0.6011873", "0.600766...
0.68436635
2
DELETE /vendedors/1 DELETE /vendedors/1.json
def destroy @vendedor.dar_baja(Date.today) respond_to do |format| format.html { redirect_to vendedors_url, notice: 'Se dio de baja correctamente.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vendedor = Vendedor.find(params[:id])\n @vendedor.destroy\n\n respond_to do |format|\n format.html { redirect_to(vendedors_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vendedor = Vendedor.find(params[:id])\n @vendedor.destroy\n\n respond_to do |fo...
[ "0.7443081", "0.7443081", "0.7386864", "0.7386864", "0.7148726", "0.70017076", "0.70017076", "0.6909455", "0.68576676", "0.6848558", "0.6848558", "0.6848558", "0.6848558", "0.6845724", "0.6833517", "0.6795626", "0.6779239", "0.6777406", "0.67712307", "0.6770569", "0.6729637",...
0.0
-1
GET /home_vendedor Metodo que renderiza el layout del home para el usuario con rol vendedor y punto_venta Si el usuario actual tiene el rol vendedor se muestran los datos referidos a su carga y la posibilidad de abrir un modal para ingresar la carga diaria Si el usuario actual tiene el rol punto_venta se muestra un des...
def home @sidebar = false @footer = false @carga_diarium = CargaDiarium.new @tipos_objetivos = TipoObjetivo.where(tipo: 'KPI') if current_user.has_role? :vendedor and !(current_user.has_role? :punto_venta) @vendedor = current_user.persona.vendedors.first else if (current_user.has_ro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decideur_show\n @user = Admin.where(role_id: 2).order(name: :asc)\n add_breadcrumb 'utilisateur', parametre_admin_path\n add_breadcrumb 'decideurs', parametre_decideurs_path\n render layout: 'fylo'\n end", "def admin_show\n @user = Admin.where(role_id: 1).order(name: :asc)\n add_breadcrumb...
[ "0.65024", "0.6251537", "0.60784405", "0.60434824", "0.5965429", "0.5928125", "0.5915949", "0.5895883", "0.58906275", "0.58816975", "0.58735013", "0.5836273", "0.58026", "0.5800842", "0.5752526", "0.5740435", "0.5701139", "0.5697018", "0.5678332", "0.56546587", "0.56459993", ...
0.70650655
0
POST /objetivos_y_carga_diaria Metodo para mostrar el valor de los Objetivos Mensuales asignados a un Vendedor en cada mes de cada anio (Ajax request) Parametros: Mes, anio, vendedor
def objetivos_y_carga_diaria mes = params[:mes].to_i anio = params[:anio].to_i vendedor_id = params[:vendedor_id].to_i vendedor = Vendedor.find(vendedor_id) totales = Hash.new total_ob_op = ObjetivoMensual.total_objetivos_punto_venta(anio, mes, vendedor, 7) total_ob_pm = ObjetivoMensual.tota...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def troca\n @remetente = Sobrevivente.where(id: params[:de]).first\n @destinatario = Sobrevivente.where(id: params[:para]).first\n\n enviar = {agua: 1, comida: 2, medicamento: 3, municao: 4}\n receber = {agua: 0, comida: 2, medicamento: 3, municao: 8}\n\n trocou = @remetente.troca(@destinatario, env...
[ "0.6407209", "0.6301499", "0.6301312", "0.6295171", "0.6180113", "0.6068575", "0.6025834", "0.60051054", "0.59554964", "0.5916921", "0.59078264", "0.5895338", "0.58896285", "0.58837485", "0.58519924", "0.58492744", "0.5826682", "0.5813876", "0.5808547", "0.5806477", "0.580585...
0.7168175
0