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
returns the product of width and height
def size @w * @h end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def size\n width * height\n end", "def area\n w * h\n end", "def area\n \t@width * @height\n end", "def pixel_size; size.x * size.y; end", "def pixels\n \n return width.to_i * height.to_i\n \n end", "def recArea(w, h) \n w * h \nend", "def...
[ "0.7049353", "0.68688756", "0.67459685", "0.6741506", "0.6581576", "0.6440514", "0.6422227", "0.63724047", "0.63554037", "0.6346381", "0.6303441", "0.6293437", "0.62914354", "0.62914354", "0.6221868", "0.6205481", "0.61977094", "0.6196684", "0.6178043", "0.6164418", "0.614926...
0.65048707
5
return flattened 1 demensional array of data
def to_ary @data.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten\n\t\tmake_flat(@array)\n\tend", "def to_flat_array\n ary = Array.new(self.size)\n self.each.with_index { |v,i| ary[i] = v }\n ary\n end", "def flatten!\n\t\t@array = make_flat(@array)\n\tend", "def flatten() end", "def using_flatten(array)\n array.flatten\n end", "def to_a(di...
[ "0.74812", "0.71189785", "0.7038779", "0.7022733", "0.6809204", "0.6804873", "0.679972", "0.67994994", "0.6772876", "0.6736347", "0.6736347", "0.6712354", "0.6677306", "0.6639736", "0.6634985", "0.6627387", "0.66112447", "0.6564481", "0.65421504", "0.65313625", "0.65212154", ...
0.6752124
9
To redirect create and update actions redirect to index page upon submit.
def create super do |format| redirect_to collection_url and return if resource.valid? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n redirect_to :action => \"new_or_edit\"\n end", "def index\n redirect_to :action => \"edit\" and return\n end", "def index\n redirect_to(:action => :new)\n end", "def index\n redirect_to :action => 'new'\n end", "def index \n redirect_to :action => \"new\"\n end", "def i...
[ "0.7754762", "0.77000725", "0.7584724", "0.7567472", "0.75173753", "0.74609184", "0.7446445", "0.74001354", "0.7358094", "0.7288963", "0.7280002", "0.71853536", "0.718368", "0.7168632", "0.71491045", "0.70854485", "0.70423126", "0.6985959", "0.69630045", "0.6851528", "0.67886...
0.0
-1
TODO: should be a bang name
def add_sprints!(sprint_count:, sprint_days: 5) return unless sprint_count > 0 sprints = project.sprints.order(:start_date) last_sprint = sprints.last 1.upto(sprint_count) do starting = last_sprint ? last_sprint.end_date.next_weekday : project.start_date ending = starting begin day_counter = sprint_days while day_counter > 1 ending = ending.next_weekday day_counter -= 1 end last_sprint = Sprint.new( project: project, start_date: starting, end_date: ending ) last_sprint.save! rescue ActiveRecord::RecordInvalid => e if last_sprint.errors[:end_date].present? && last_sprint.errors[:end_date].include?("Cannot end after its Project end date.") project.end_date = last_sprint.end_date project.save! project.reload last_sprint.save! else raise e end end end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def formation; end", "def suivre; end", "def terpene; end", "def custom; end", "def custom; end", "def refutal()\n end", "def verdi; end", "def who...
[ "0.7711573", "0.7046109", "0.69062954", "0.69062954", "0.69062954", "0.69062954", "0.6720959", "0.64098775", "0.63855046", "0.6360771", "0.6335622", "0.6335622", "0.63151014", "0.6290336", "0.6225018", "0.62097037", "0.6199263", "0.6138941", "0.61379784", "0.61379784", "0.613...
0.0
-1
Parses the content of strings file
def parse(_string, _extension) [{}, {}] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_file!(input_file)\r\n File.open(input_file, \"rb:UTF-8\").each(LOCSTR_END_OF_LINE + \"\\n\") do |line|\r\n strings << line.chomp(LOCSTR_END_OF_LINE + \"\\n\") + \"\\x00\"\r\n end\r\n\r\n @number_of_strings = @strings.size\r\n @offset_to_strings = 8 + 8 * @number_of_strings\r\n ...
[ "0.71552265", "0.66983837", "0.65995914", "0.6521663", "0.6520932", "0.64546496", "0.6415772", "0.62816495", "0.6261204", "0.6225305", "0.6106197", "0.6101507", "0.5940384", "0.5936521", "0.5936088", "0.5916726", "0.5912572", "0.5912308", "0.5878723", "0.58628976", "0.5859169...
0.0
-1
Returns res directory for the mapped locale Base implementation does nothing
def directory(_mapped_locale, _is_default) '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resource_root\n FilePath.new(build_module.root, name + \".resources\").canonicalize\n end", "def locales_path\n unless defined?(@locales_path)\n self.locales_path = \"#{public_path}/#{DEFAULT_LOCALES_LOCATION}\"\n end\n\n @locales_path\n end", "def get_resource_path\r\n ...
[ "0.6442619", "0.6418418", "0.6209744", "0.6170908", "0.60329807", "0.60329807", "0.5999955", "0.59879243", "0.59687746", "0.5946484", "0.59407145", "0.5913207", "0.5892395", "0.5892237", "0.58596075", "0.58596075", "0.58596075", "0.58596075", "0.58596075", "0.58596075", "0.58...
0.77760965
0
Returns the default name
def default_file_name '' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_name\n @default_name ||= \"__#{name}_default__\"\n end", "def default_name\n return unless name\n Dry::Core::Inflector.underscore(name).tr('/', '_').to_sym\n end", "def default_name\n [long_name, short_name].reject(&:empty?).first\n end", "def defaul...
[ "0.9102542", "0.8864684", "0.84408617", "0.8213624", "0.79921633", "0.7780745", "0.7754106", "0.7750642", "0.771804", "0.75714076", "0.74867105", "0.7463388", "0.7463388", "0.74359965", "0.72883534", "0.7235551", "0.7176406", "0.71715426", "0.71677595", "0.71335834", "0.70999...
0.7126954
20
Writes the locale to a directory
def write_locale(directory, file, strings, plurals, locale, date); end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write!\n Dir.mkdir @directory unless File.directory? @directory\n\n @locales.each_with_index do |locale, index|\n strings = @strings[locale]\n plurals = @plurals[locale]\n\n l_directory = locale_directory locale, index.zero?\n\n file = @table.to_s.empty? ? @adapter.default...
[ "0.8152813", "0.7201601", "0.69882953", "0.66470236", "0.65303713", "0.64872706", "0.64524055", "0.6406505", "0.6266684", "0.6263246", "0.6248797", "0.6108113", "0.60377336", "0.60247386", "0.5920466", "0.59017855", "0.57747775", "0.5753936", "0.5695618", "0.5693142", "0.5692...
0.8565011
0
==================================== Convenience methods to provide a single point of entry Reads the content of a directory
def read(directory) strings = {} plurals = {} files = Dir[directory] files.each do |file| ext = File.extname(file) next unless allowed_extensions.include? ext parsed_strings, parsed_plurals = parse(File.read(file), ext) strings = strings.merge(parsed_strings) plurals = plurals.merge(parsed_plurals) end [strings, plurals] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_content(entry)\n entry.rewind if entry.respond_to? :rewind\n case entry\n when File, Tempfile, StringIO then entry.read\n when Dir then (entry.entries - ['.', '..']).collect { |filename| read_content(Pathname.new(File.join(entry.path, filename))) }.compact.sort\n when String ...
[ "0.72681445", "0.70044273", "0.69144374", "0.6873336", "0.6811239", "0.6739954", "0.66171944", "0.66171944", "0.65765476", "0.643254", "0.63712", "0.63476497", "0.633005", "0.63291174", "0.6316887", "0.62841547", "0.62769", "0.62662345", "0.62609065", "0.62460655", "0.6246065...
0.0
-1
Fills the header placeholders
def header(path, file, locale, date) File.read(path) .gsub('<file>', file) .gsub('<locale>', locale) .gsub('<date>', date.to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_header(dat)\n @headers = { to: to }\n dat.each do |key, val|\n key = key.to_s.downcase\n raise \"invalid field #{key}\" unless valid_fields.include?(key)\n @headers[key.to_sym] = val unless val.nil?\n end\n end", "def insert_headers headers = []\n ...
[ "0.6433813", "0.6284279", "0.6250777", "0.6246205", "0.62141824", "0.6179087", "0.6177737", "0.6161931", "0.61340755", "0.6130798", "0.61269706", "0.6091905", "0.60538185", "0.60305834", "0.6021211", "0.5972471", "0.59471756", "0.59197855", "0.5900245", "0.58930725", "0.58779...
0.0
-1
much of this code was borrowed from GeoKit, thanks...
def get_live_response(address_info) raise "API key not specified.\nCall AddressStandardization::GoogleMaps.api_key = '...' before you call .standardize()." unless GoogleMaps.api_key address_info = address_info.stringify_keys address_str = [ address_info["street"], address_info["city"], (address_info["state"] || address_info["province"]), address_info["zip"] ].compact.join(" ") url = "http://maps.google.com/maps/geo?q=#{address_str.url_escape}&output=xml&key=#{GoogleMaps.api_key}&oe=utf-8" AddressStandardization.debug "[GoogleMaps] Hitting URL: #{url}" uri = URI.parse(url) res = Net::HTTP.get_response(uri) return unless res.is_a?(Net::HTTPSuccess) content = res.body AddressStandardization.debug "[GoogleMaps] Response body:" AddressStandardization.debug "--------------------------------------------------" AddressStandardization.debug content AddressStandardization.debug "--------------------------------------------------" xml = Nokogiri::XML(content) xml.remove_namespaces! # good or bad? I say good. return unless xml.at("/kml/Response/Status/code").inner_text == "200" addr = {} addr[:street] = get_inner_text(xml, '//ThoroughfareName').to_s addr[:city] = get_inner_text(xml, '//LocalityName').to_s addr[:province] = addr[:state] = get_inner_text(xml, '//AdministrativeAreaName').to_s addr[:zip] = addr[:postalcode] = get_inner_text(xml, '//PostalCodeNumber').to_s addr[:country] = get_inner_text(xml, '//CountryName').to_s return if addr[:street] =~ /^\s*$/ or addr[:city] =~ /^\s*$/ Address.new(addr) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def geo; end", "def geopos(key, member); end", "def geography_columns!; end", "def coordquery(p)\r\nend", "def geography_columns; end", "def geodatos\n end", "def geom_coords\n# self.geom.geometry_n(0).y.to_s + \" \" + self.geom.geometry_n(0).x.to_s\n \"\" + self.latitude.to_s + \" \" + se...
[ "0.71987957", "0.65258163", "0.6324832", "0.62951565", "0.6210477", "0.6043317", "0.5955868", "0.5807732", "0.5744036", "0.57354873", "0.5704406", "0.5694448", "0.56794775", "0.5678364", "0.56602937", "0.56387264", "0.56162655", "0.560439", "0.5598764", "0.5593731", "0.559355...
0.0
-1
When our existing file exceeds a reasonable size, move it to a new filename, and open a new file that uses the same name as our old file did.
def transition_unified_files(file) file.close base_name, path_name, idx = File.basename(file.path, '.log'), File.dirname(file.path), 2 while(true) new_filepath = path_name + "/" + base_name + "_#{idx}.log" if(!File.exists?(new_filepath)) FileUtils.mv(file.path, new_filepath) # move our old file to an unused filename file = File.open(path_name + "/" + base_name + ".log", 'a+') # and re-open a new file with the same name as our old file break end idx += 1 end file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moveOldFile(name)\n return unless File.file?(name)\n\n count = 0\n while true\n count += 1\n nfn = \"#{name}.#{count}\"\n\n if !File.file?(nfn)\n File.rename(name, nfn)\n break\n end\n end\nend", "def rename_file\n return unless filename_changed?\n\n old_full_filen...
[ "0.63312143", "0.62076026", "0.61313343", "0.60734653", "0.6023239", "0.597376", "0.5946079", "0.59441215", "0.5927258", "0.58704036", "0.5844318", "0.58398014", "0.5766982", "0.57214856", "0.56694317", "0.5664562", "0.56479615", "0.563978", "0.56375176", "0.5599651", "0.5566...
0.5167222
63
Save the contents of source file into a master_hash hash with the given key, so long as the source file has more action entries in it. Otherwise, remove key from master_hash if the source file has been emptied.
def build_file_into_master_hash(master_hash, key, source_file) entries = grab_and_hashify(source_file, SIZE_OF_HASH_BLOCKS) if(!entries.blank?) master_hash.merge({ key.to_sym => entries }) else master_hash.delete(key.to_sym) master_hash end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove filename\n return false unless source_hash.key?(filename)\n source_hash.delete filename\n true\n end", "def copy_content_to(key, source_root, source_key, metadata = {})\n source_root.with_input_io(source_key) do |io|\n copy_io_to(key, io, source_root.md5_sum(source_key), sour...
[ "0.5886325", "0.52260816", "0.5221473", "0.5177054", "0.5124466", "0.49301687", "0.49288794", "0.4828572", "0.47610435", "0.47589764", "0.47509995", "0.47199625", "0.47199625", "0.4684239", "0.46688947", "0.46670628", "0.46501485", "0.46428072", "0.46243903", "0.45836744", "0...
0.7440597
0
Grab the time of the next action after our current file position, then return to that position
def get_next_action_time(file) start_pos = file.pos next_time = get_next_result_time(file) file.seek(start_pos, IO::SEEK_SET) next_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_of_last_file_action(file)\r\n\t\tresult_time = nil\r\n\t\tstarting_pos = file.pos\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tfile.seek(file.pos-[10000, file.pos].min, IO::SEEK_SET)\r\n\t\t\r\n\t\twhile(!file.eof? && (this_line = file.readline))\r\n\t\t\tresult_time = Time.parse($1) if(this_line =~NEW_AC...
[ "0.7225953", "0.71267027", "0.66801333", "0.6642811", "0.6440103", "0.6163304", "0.59265846", "0.59265846", "0.5797089", "0.57644284", "0.57644284", "0.57644284", "0.57404035", "0.5735688", "0.56971353", "0.56480134", "0.5623349", "0.5608162", "0.5608162", "0.5608162", "0.559...
0.7839334
0
Read backwards through file until we find the time of the last action written to it.
def get_next_result_time(file) result_time = nil while(!file.eof? && (this_line = file.readline)) if(this_line =~NEW_ACTION_REGEX) result_time = Time.parse($1) break end end result_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_time_of_last_file_action(file)\r\n\t\tresult_time = nil\r\n\t\tstarting_pos = file.pos\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tfile.seek(file.pos-[10000, file.pos].min, IO::SEEK_SET)\r\n\t\t\r\n\t\twhile(!file.eof? && (this_line = file.readline))\r\n\t\t\tresult_time = Time.parse($1) if(this_line =~NEW_AC...
[ "0.7026059", "0.6491201", "0.63406974", "0.60755646", "0.59712696", "0.5971249", "0.58754116", "0.58385503", "0.57078147", "0.5602624", "0.5552814", "0.5552814", "0.5552814", "0.5552814", "0.55264175", "0.5513404", "0.5504965", "0.5501962", "0.549304", "0.546804", "0.5458944"...
0.5772872
8
Read backwards through file until we find the time of the last action written to it.
def get_time_of_last_file_action(file) result_time = nil starting_pos = file.pos file.seek(0, IO::SEEK_END) file.seek(file.pos-[10000, file.pos].min, IO::SEEK_SET) while(!file.eof? && (this_line = file.readline)) result_time = Time.parse($1) if(this_line =~NEW_ACTION_REGEX) end # Reset file file.seek(starting_pos, IO::SEEK_SET) result_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_seek_to_time(file, time_obj, logger)\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tend_pos = file.pos\r\n\t\tfile.rewind\r\n\t\tfile = seek_to_time_helper(file, time_obj, 0, end_pos, logger)\r\n\t\tstarting_line_pos = file.pos\r\n\r\n\t\tfile.each do |line|\r\n\t\t\tif(line =~ NEW_ACTION_REGEX)\r\n\t\t\t\tthis...
[ "0.6491861", "0.63410956", "0.60770077", "0.597135", "0.59708893", "0.58750296", "0.58390456", "0.5772574", "0.5708681", "0.56038016", "0.55556464", "0.55556464", "0.55556464", "0.55556464", "0.5525236", "0.5514578", "0.55058163", "0.5503089", "0.5493834", "0.5468655", "0.545...
0.70258874
0
This is hell slow. If it must be used (which I question), it will need some TLC. Would like to do binary search, but it'd be a pain to write dual cases for determining the right action when moving forward vs moving backwards toward it.
def file_seek_to_time(file, time_obj, logger) file.seek(0, IO::SEEK_END) end_pos = file.pos file.rewind file = seek_to_time_helper(file, time_obj, 0, end_pos, logger) starting_line_pos = file.pos file.each do |line| if(line =~ NEW_ACTION_REGEX) this_time = Time.parse($1) if this_time >= time_obj file.seek(starting_line_pos, IO::SEEK_SET) break end end starting_line_pos = file.pos end file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def walking_toward?\n return Direction::Down if (@current_tile_indx >= 0 and @current_tile_indx <= 2)\n return Direction::Up if (@current_tile_indx >= 9 and @current_tile_indx <= 11)\n return Direction::Left if (@current_tile_indx >= 3 and @current_tile_indx <= 5)\n return Direction::Ri...
[ "0.65205055", "0.62301284", "0.6225734", "0.61937743", "0.6138444", "0.6124464", "0.61034703", "0.6095395", "0.6076776", "0.6066899", "0.5998013", "0.59795153", "0.5975277", "0.59719175", "0.59478235", "0.59416676", "0.59098643", "0.58945566", "0.58942205", "0.5893506", "0.58...
0.0
-1
Do a binary search until we find a file position that is less than MAX_TIME_BETWEEN_CONTROLLER_ACTIONS before the time we seek.
def seek_to_time_helper(file, target_time, start_pos, end_pos, logger) return nil unless file && target_time logger.info("Checking between file pos #{start_pos} and #{end_pos}.") rewind_pos = file.pos middle_pos = (start_pos+end_pos)/2 file.seek(middle_pos, IO::SEEK_SET) file.each do |line| if(line =~ NEW_ACTION_REGEX) this_time = Time.parse($1) if this_time >= target_time return seek_to_time_helper(file, this_time, start_pos, middle_pos, logger) elsif(this_time < target_time && (this_time-target_time).abs < MAX_TIME_BETWEEN_CONTROLLER_ACTIONS) file.seek(rewind_pos, IO::SEEK_SET) return file else return seek_to_time_helper(file, this_time, middle_pos, end_pos, logger) end end end # If we can't find any line that meets the criteria we seek, just send back the file object in the closest spot we could find. file.seek(rewind_pos, IO::SEEK_SET) return file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_seek_to_time(file, time_obj, logger)\r\n\t\tfile.seek(0, IO::SEEK_END)\r\n\t\tend_pos = file.pos\r\n\t\tfile.rewind\r\n\t\tfile = seek_to_time_helper(file, time_obj, 0, end_pos, logger)\r\n\t\tstarting_line_pos = file.pos\r\n\r\n\t\tfile.each do |line|\r\n\t\t\tif(line =~ NEW_ACTION_REGEX)\r\n\t\t\t\tthis...
[ "0.60095817", "0.53200203", "0.5279065", "0.51741594", "0.51152444", "0.51143277", "0.5034979", "0.50088876", "0.49413612", "0.48829132", "0.47969675", "0.47834408", "0.47834408", "0.47777817", "0.4761641", "0.47480258", "0.47463036", "0.47145933", "0.47036147", "0.46304908", ...
0.6711165
0
The max bound of the prime number range
def take(size) raise ArgumentError if size < 1 range .select { |v| prime? v } .take(size - 1) .to_a .unshift(2) # adds 2 as we take only odd numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_upper_limit_of(range)\n range.max\nend", "def get_upper_limit_of(range)\n range.max\nend", "def largest_prime(number)\r\n limit = Math.sqrt(number).floor \r\n (2..limit).select { |n| number % n == 0 && Prime.prime?(n) }.max\r\nend", "def upper_limit_for(desired_prime_number)\n i = 2\n wh...
[ "0.77478606", "0.77383935", "0.7464976", "0.72996044", "0.72637457", "0.7189556", "0.71862864", "0.71847427", "0.7168655", "0.71521616", "0.70306104", "0.69700617", "0.69178843", "0.69174993", "0.6901216", "0.6894312", "0.68821144", "0.6872953", "0.6865968", "0.68658525", "0....
0.0
-1
:tie, :dealer, :player, :dealer_busted, :player_busted
def detect_result(dealer_tot, player_tot) if player_tot > MAX_VALUE :player_busted elsif dealer_tot > MAX_VALUE :dealer_busted elsif dealer_tot < player_tot :player elsif dealer_tot > player_tot :dealer else :tie end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def affichage_player\n\n\n end", "def human_and_human_player(size)\n\t@player1 = \"player\"\n @player2 = \"player\"\nend", "def detect_result\n case\n when player.busted? then :player_busted\n when dealer.busted? then :dealer_busted\n when player.total > dealer.total then :player_higher\n wh...
[ "0.67244494", "0.667788", "0.65078944", "0.6469328", "0.6376295", "0.6328424", "0.6328424", "0.6328424", "0.6328424", "0.6328424", "0.6328424", "0.6328424", "0.6201409", "0.61753166", "0.61658144", "0.61617005", "0.6145756", "0.6082519", "0.6066469", "0.6066469", "0.6066469",...
0.0
-1
yaml => YAML String / config => YAML path silent / quiet / verbose
def initialize @argv_option = {} @config = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_for_yaml(opts = {})\n path = opts[:yaml] || fixture('app_config.yml')\n config_for({ yaml: path }.merge(opts))\n end", "def yaml\n parse_yaml_string(yaml_string(config_file), config_file)\n end", "def yaml_file?; end", "def yaml\n @config.to_yaml\n end", "def yaml_...
[ "0.6787396", "0.6782029", "0.6781727", "0.6616474", "0.6595259", "0.65163434", "0.6477871", "0.63987166", "0.6366485", "0.63271475", "0.627424", "0.62559974", "0.61879957", "0.6170774", "0.6123417", "0.6095065", "0.60552955", "0.60490334", "0.60274416", "0.6020626", "0.602062...
0.0
-1
Recursively builds children until it reaches the max_depth.
def build_children(node, parent = nil) node.children = get_all_moves(node) unless node.depth + 1 == @max_depth node.children.each {|child| build_children(child, node)} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_children(node)\n #return nil if node.depth > @max_depth\n POSSIBLE_MOVES.each do |move|\n if (node.x + move[0] < size && node.y + move[1] < size) &&\n (node.x + move[0] >= 0 && node.y + move[1] >= 0)\n child = Node.new(node.x + move[0], node.y + move[1], node.depth + 1, [], node...
[ "0.65670353", "0.6157627", "0.6124455", "0.6097771", "0.5991611", "0.59461516", "0.59067696", "0.58819246", "0.58620787", "0.58413696", "0.5836486", "0.5825835", "0.58243984", "0.58111185", "0.5778077", "0.5770776", "0.5704197", "0.5691301", "0.5668295", "0.5658111", "0.56522...
0.7432677
0
Returns an array of Square objects that a knight could move to from given coordinates. Increments depth.
def get_all_moves(node) x, y, current_depth = node.x, node.y, node.depth verified_moves = [] all_moves = all_moves_array(x,y) all_moves.each {|move| verified_moves << Square.new(move[0], move[1], current_depth+1, node) if on_board?(move)} verified_moves end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def knight_moves\n\t\tnode = Square.new(@start)\n\t\t@queue << node\n\t\twhile @queue.empty? == false\n\t\t\tcurrent = @queue[0]\n\t\t\tif current.value == @final\n\t\t\t\tdisplay_result(current)\t\t\t\n\t\t\telse\n\n\t\t\t\t8.times do |num|\n\t\t\t\t\tx = current.value[0] + @row[num]\n\t\t\t\t\ty = current.value[...
[ "0.6891413", "0.6891112", "0.6749234", "0.6566769", "0.6564747", "0.6540462", "0.6408261", "0.6377399", "0.6327106", "0.62944263", "0.6270446", "0.6264", "0.6256845", "0.6222055", "0.6202018", "0.61890566", "0.61872584", "0.61830306", "0.61789703", "0.6170842", "0.61585224", ...
0.6621611
3
Returns TRUE if all of the coordinates fall on the board. Based on BOARD_SIZE
def on_board?(coords) coords.any? {|coord| coord < 1 || coord > @size } ? false : true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ship_coords_are_all_on_board\n all_aboard = true\n @ship.coords.each do |coord|\n row, col = coord\n # if row & col are NOT between 0 and 9...\n unless row.between?(0,9) && col.between?(0,9)\n # ...then not all the coords are ok.\n all_aboard = false\n end\n break u...
[ "0.80548596", "0.77984095", "0.7756664", "0.7526133", "0.7440196", "0.7352483", "0.73282796", "0.72934544", "0.7279896", "0.7231397", "0.7217839", "0.720466", "0.7139954", "0.71274424", "0.7124715", "0.70857716", "0.7083321", "0.70783573", "0.7077019", "0.7072715", "0.7055687...
0.8310522
0
Returns an array of ALL possible moves a knight could move to from given coordinates. Irrelevant of whether the move is on the board or not. Brute force.
def all_moves_array(initial_x, initial_y) final = [] x = initial_x + 2 final << [x, initial_y+1] << [x, initial_y-1] x = initial_x - 2 final << [x, initial_y+1] << [x, initial_y-1] y = initial_y + 2 final << [initial_x+1, y] << [initial_x-1, y] y = initial_y - 2 final << [initial_x+1, y] << [initial_x-1, y] final end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def possible_moves\n all_moves = []\n x, y = @position\n moves = [[x, y-1], [x-1, y-1], [x-1, y], [x-1, y+1], [x, y+1], [x+1, y+1], [x+1, y], [x+1, y-1]]\n moves.each do |position|\n all_moves << [position] if position.all? { |number| number.between?(0,7) }\n end\n all_moves\n ...
[ "0.7960609", "0.7929445", "0.7898043", "0.78408843", "0.7643922", "0.75717896", "0.753551", "0.7497893", "0.7492138", "0.7476726", "0.7451445", "0.7445694", "0.74324775", "0.7417555", "0.73717844", "0.73292977", "0.72824574", "0.7231368", "0.7225667", "0.7222458", "0.72011167...
0.6819195
66
Recursively gets the number of children of a node
def count_children(node) return 0 if node.children.nil? node.children.count + (node.children.map {|child| count_children(child)}).inject(&:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def num_children\n count = 0\n self.children.each do |child|\n count = count + child.num_children\n end\n\n return self.children.size + count\n end", "def nodeCount\n count = 1\n\n if @children.size\n @children.each do |key, val|\n count += val.nodeCount\n end\n end\n\...
[ "0.8164399", "0.81610334", "0.8152095", "0.80179775", "0.80056554", "0.7857073", "0.7850586", "0.77509224", "0.77185154", "0.7679977", "0.76256555", "0.7606697", "0.7579198", "0.74554014", "0.74243027", "0.7409021", "0.7337356", "0.7307475", "0.72675633", "0.72146225", "0.720...
0.8529156
0
ruby escapes \ with double \\, to support slack multipline text, we have to unescape json output
def unescapeJson(jsonObj) temp = JSON.generate(jsonObj) temp.gsub! '\\\\', '\\' return temp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def json_escape(str)\n str.to_s.gsub('/', '\\/')\n end", "def json_escape_string(s)\n return s if s !~ /[\"\\\\\\b\\f\\n\\r\\t]/\n\n result = \"\"\n s.split(\"\").each do |c|\n case c\n when '\"', \"\\\\\"\n result << \"\\\\\" << c\n when \"\\n\" then resu...
[ "0.72216874", "0.71969855", "0.68390673", "0.6488732", "0.6488732", "0.6375361", "0.6349221", "0.6316618", "0.62304336", "0.6212158", "0.61774135", "0.6176177", "0.6167906", "0.61417544", "0.61411434", "0.61411434", "0.61411434", "0.6136487", "0.6136487", "0.6136487", "0.6118...
0.6614677
3
given the game state as a string (0 represent empty grid, 1 represent X and 2 represent O) determine if the game has a winner by connection a row, column or diagonal outputs either the name of player1 or player2, if the game has no winner return nil
def checkWinner(state, player1, player2) for i in 0..2 row_candidate = true column_candidate = true for j in 1..2 # check rows if state[i * 3 + j] == '0' || state[i * 3 + j] != state[i * 3 + j - 1] then row_candidate = false elsif row_candidate && state[i * 3 + j] == state[i * 3 + j - 1] then if j == 2 then winner = if state[i * 3 + j] == '1' then player1 else player2 end return winner end end # check columns if state[j * 3 + i] == '0' || state[j * 3 + i] != state[(j - 1) * 3 + i] then column_candidate = false elsif column_candidate && state[j * 3 + i] == state[(j - 1) * 3 + i] then if j == 2 then winner = if state[j * 3 + i] == '1' then player1 else player2 end return winner end end end end # check diagonals if state[0] == state[4] && state[4] == state[8] && state[0] != '0' then winner = if state[0] == '1' then player1 else player2 end return winner end if state[2] == state[4] && state[4] == state[6] && state[2] != '0' then winner = if state[2] == '1' then player1 else player2 end return winner end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n [\n [[0,0],[0,1],[0,2]], # column 0\n [[1,0],[1,1],[1,2]], # column 1\n [[2,0],[2,1],[2,2]], # column 2\n [[0,0],[1,0],[2,0]], # row 0\n [[0,1],[1,1],[2,1]], # row 1\n [[0,2],[1,2],[2,2]], # row 2\n [[0,0],[1,1],[2,2]], # descending diagonal\n [[0,2],[1,1],[2,0]], # ...
[ "0.74219316", "0.7336712", "0.7237744", "0.71878356", "0.7144838", "0.7097895", "0.70918286", "0.707591", "0.70042974", "0.6994823", "0.69611806", "0.6950121", "0.69468296", "0.6943349", "0.69373286", "0.6935397", "0.6924532", "0.69238096", "0.6908051", "0.69077545", "0.68777...
0.77616906
0
delete the current ongoing game in the channel
def del channel = params['channel_id'] existing = Board.find_by(:channel => channel) if existing then existing.destroy return render json: { :response_type => 'in_channel', :text => 'Removed the current game for the channel. It was between *' + existing.player1 + '* and *' + existing.player2 + '*' } end return render json: { :text => 'No ongoing game in the current channel' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_game(channel)\n @games.delete(channel)\n end", "def remove_game(channel)\n if t = @games[channel].join_timer\n @bot.timer.remove(t)\n end\n @games.delete(channel)\n end", "def remove_game(channel)\n if t = @games[channel].join_timer\n @bot.timer.remove(t)\n end\n @ga...
[ "0.76571417", "0.7488021", "0.7488021", "0.70198894", "0.6971595", "0.68607944", "0.68112344", "0.6799116", "0.6789865", "0.6679612", "0.65322596", "0.6526817", "0.65182793", "0.65057564", "0.64897335", "0.64824367", "0.64490056", "0.6448674", "0.64102656", "0.64076614", "0.6...
0.7840634
0
GET /az_commons GET /az_commons.xml
def index_user @commons_class = get_class(params) @my_companies = current_user.my_works @commons = @commons_class.get_by_companies(@my_companies) @title = @commons_class.get_label respond_to do |format| format.html { render :template => 'az_commons/index_user'} #format.xml { render :xml => @az_commons } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port...
[ "0.6588384", "0.6474953", "0.6219437", "0.62064445", "0.6124817", "0.6092717", "0.5976041", "0.5964822", "0.5906616", "0.590409", "0.58637714", "0.5830161", "0.58263284", "0.5785629", "0.57346416", "0.5682439", "0.5677263", "0.56707776", "0.56703067", "0.56425816", "0.5607737...
0.0
-1
GET /az_commons/new GET /az_commons/new.xml
def new @az_common = get_class(params).new @az_common.owner_id = params[:owner_id] @az_common.az_base_project_id = params[:az_base_project_id] prepare_new_data(@az_common) respond_to do |format| format.html { render :template => 'az_commons/new'} format.xml { render :xml => @az_common } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_ver...
[ "0.7007069", "0.6624524", "0.6441859", "0.6420778", "0.6377737", "0.6377737", "0.6353533", "0.6316274", "0.6303567", "0.6289457", "0.6280265", "0.62800884", "0.62309206", "0.62177575", "0.6211435", "0.6211116", "0.62059766", "0.6202678", "0.6191449", "0.6170333", "0.6168102",...
0.6183348
19
POST /az_commons POST /az_commons.xml
def create @az_common = get_class(params).new(params[params[:controller].singularize]) respond_to do |format| if @az_common.save flash[:notice] = 'Запись успешно создана.' format.html { redirect_to(@az_common) } format.xml { render :xml => @az_common, :status => :created, :location => @az_common } else prepare_new_data(@az_common) format.html { render :action => "new", :template => 'az_commons/new'} format.xml { render :xml => @az_common.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "d...
[ "0.6495916", "0.62547135", "0.62411004", "0.6226977", "0.6204481", "0.60116357", "0.5978979", "0.59730524", "0.5956479", "0.59249187", "0.58429193", "0.5803627", "0.57983243", "0.57913923", "0.5735941", "0.5708214", "0.5701436", "0.57011306", "0.5682378", "0.566368", "0.56610...
0.50705385
93
DELETE /az_commons/1 DELETE /az_commons/1.xml
def destroy @az_common = get_class(params).find(params[:id]) @az_common.destroy respond_to do |format| format.html { redirect_to(:action => 'index_user') } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete()\n response = send_post_request(@xml_api_del...
[ "0.6939556", "0.6889899", "0.67618334", "0.6665839", "0.6657073", "0.645977", "0.6291324", "0.6257252", "0.62337685", "0.61951244", "0.6190986", "0.6122008", "0.61089253", "0.60935533", "0.6083684", "0.6060604", "0.6047522", "0.6043572", "0.60315126", "0.60282415", "0.6019818...
0.6229394
9
GET /dividas GET /dividas.json
def index if params[:data_inicio] == "" or params[:data_inicio] == nil @data_inicio = Date.today.at_beginning_of_month.strftime('%d/%m/%Y') @data_fim = Date.today.at_end_of_month.strftime('%d/%m/%Y') else @data_inicio = params[:data_inicio] @data_fim = params[:data_fim] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dividas = Divida.all\n end", "def index\n @diciplinas = Diciplina.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @diciplinas }\n end\n end", "def show\n @venta = Venta.find(params[:id])\n\n @domicilios = Domicilio.where(usuari...
[ "0.6938535", "0.66453755", "0.661861", "0.6591345", "0.65346754", "0.65327233", "0.64870656", "0.64774007", "0.64741576", "0.6451815", "0.64309627", "0.64295554", "0.64252824", "0.6397183", "0.63908565", "0.6383635", "0.6382955", "0.6367887", "0.6366933", "0.63666564", "0.635...
0.0
-1
GET /dividas/1 GET /dividas/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @veiculo }\n end\n end", "def show\n @servicio = Servicio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n forma...
[ "0.67898035", "0.67681885", "0.6719024", "0.6715985", "0.67148983", "0.6679437", "0.6660912", "0.6654598", "0.66535175", "0.6638433", "0.6635148", "0.66007847", "0.6595203", "0.6582729", "0.6579822", "0.6578053", "0.65778506", "0.6565468", "0.6548008", "0.65478104", "0.653213...
0.0
-1
POST /dividas POST /dividas.json
def create @divida = Divida.new(divida_params) respond_to do |format| if @divida.save format.html { redirect_to @divida, notice: 'Divida was successfully created.' } format.json { render :show, status: :created, location: @divida } else format.html { render :new } format.json { render json: @divida.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dividendo_params\n params.require(:dividendo).permit(:competencia, :descricao, :pago, :valor, :data_vencimento, :categoria_id)\n end", "def create\n @divisa = Divisa.new(divisa_params)\n\n respond_to do |format|\n if @divisa.save\n format.html { redirect_to @divisa, notice: 'Divisa ...
[ "0.6306471", "0.61928034", "0.61587626", "0.61322737", "0.6100432", "0.60633063", "0.60253465", "0.6008307", "0.59889096", "0.5982501", "0.5962352", "0.596177", "0.59522295", "0.5925508", "0.59243524", "0.5913997", "0.5902765", "0.5896074", "0.58326036", "0.5818633", "0.58105...
0.6542379
1
PATCH/PUT /dividas/1 PATCH/PUT /dividas/1.json
def update respond_to do |format| if @divida.update(divida_params) format.html { redirect_to @divida, notice: 'Divida was successfully updated.' } format.json { render :show, status: :ok, location: @divida } else format.html { render :edit } format.json { render json: @divida.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @veiculo = Veiculo.find(params[:id])\n\n respond_to do...
[ "0.68797475", "0.65223366", "0.6491587", "0.64734954", "0.6470606", "0.6393045", "0.63397527", "0.6301795", "0.6284694", "0.6231668", "0.6202724", "0.61822116", "0.61790216", "0.6167292", "0.6167292", "0.615802", "0.61545813", "0.61512893", "0.6136925", "0.61233157", "0.61172...
0.62103355
11
DELETE /dividas/1 DELETE /dividas/1.json
def destroy @divida.destroy respond_to do |format| format.html { redirect_to dividas_url, notice: 'Divida was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n client.delete(\"/#{id}\")\n end", "def delete\n render :json => @fiestas.delete_at(params[:id].to_i)\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def destroy\n ...
[ "0.7728567", "0.71770984", "0.71057004", "0.7099192", "0.7095137", "0.7088978", "0.7088978", "0.7088978", "0.7088978", "0.7084559", "0.7074602", "0.70610625", "0.7040359", "0.7024625", "0.7019558", "0.70152634", "0.70128053", "0.7003081", "0.69843996", "0.6978702", "0.6971239...
0.70138234
17
Use callbacks to share common setup or constraints between actions.
def set_divida @divida = Divida.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 divida_params params.require(:divida).permit(:numr_tipodivida, :numr_cheque, :data_vencimento, :valr_divida, :desc_observacao, :numg_tipopagamento, :data_cadastro, :desc_docprincipal, :data_cancelamento, :data_pagamento, :valr_pagamento, :valr_multa, :valr_juro, :numr_notafiscal, :numr_parcela, :desc_caminhocheque, :flag_ordinaria, :flag_despesafixa, :condominio_id, :contabank_id, :prestador_id, :user_inclusao, :despesa_id, :user_exclusao, :flag_pago) 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
rubocop:disable Metrics/CyclomaticComplexity rubocop:disable Metrics/AbcSize
def edit_cell(cell, target) case target when "[Time.zone.today]" then replace!(cell, target, date_format(Time.zone.today)) when "[bill_company_name]" then replace!(cell, target, @project.billing_company_name || '') when "[project_cd]" then replace!(cell, target, @project.cd) when "[project_name]" then replace!(cell, target, @project.name) when "[project_period]" then replace!(cell, target, project_period) when "[bill_cd]" then replace!(cell, target, @bill.cd) when "[bill_payment_type]" then replace!(cell, target, I18n.t("enumerize.defaults.payment_type.#{@bill.payment_type}")) when "[bill_amount]" then replace!(cell, target, @bill.amount) when "[subtotal]" then replace!(cell, target, subtotal) when "[tax]" then replace!(cell, target, tax) when "[total]" then replace!(cell, target, total) # TODO(ito): Change under two conditions when the function of computing man-hours is added when "[excess]" then replace!(cell, target, 0) when "[transportation_expenses]" then replace!(cell, target, 0) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def strategy; end", "def used?; end", "def offences_by; end", "def isola...
[ "0.7575491", "0.6228001", "0.6228001", "0.62206525", "0.6116412", "0.60743344", "0.60743344", "0.60743344", "0.60743344", "0.6052599", "0.60515994", "0.5941999", "0.5851441", "0.5786109", "0.5786109", "0.57513005", "0.57513005", "0.57513005", "0.57455516", "0.5738835", "0.570...
0.0
-1
rubocop:enable Metrics/CyclomaticComplexity rubocop:enable Metrics/AbcSize
def replace!(cell, target, value) replace_word = value.is_a?(Integer) ? cell.value.gsub(target, value.to_s).to_i : cell.value.gsub(target, value) cell.change_contents(replace_word, cell.formula) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def implementation; end", "def implementation; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def strategy; end", "def used?; end", "def offences_by; end", "def suivr...
[ "0.7623404", "0.6341815", "0.6292353", "0.6292353", "0.61580694", "0.6146817", "0.6146817", "0.6146817", "0.6146817", "0.61436105", "0.6052479", "0.602375", "0.58737695", "0.5861187", "0.58322", "0.58322", "0.5825923", "0.5806006", "0.5806006", "0.5793213", "0.5793213", "0....
0.0
-1
GET /students GET /students.json
def index user_type = session[:user_type] case user_type when ApplicationController::TYPE_ADMIN @students = Student.all else flash[:notice] = "You are not authorised to perform this action" redirect_to root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_students\n @course = Course.find(params[:course_id])\n\n render json: @course.students\n end", "def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end", "def index\n @students = Student.all\n render json: @students\n end", "def my_students(query=...
[ "0.78874433", "0.77285767", "0.7703694", "0.76748186", "0.7627283", "0.752462", "0.7511281", "0.7511281", "0.74931425", "0.74641156", "0.741123", "0.7402749", "0.738447", "0.73735154", "0.7360754", "0.7352857", "0.7268802", "0.7268802", "0.7268802", "0.7268802", "0.7268802", ...
0.0
-1
GET /students/1 GET /students/1.json
def show user_type = session[:user_type] case user_type when ApplicationController::TYPE_STUDENT if(current_user.id != params[:id].to_i) flash[:notice] = "You are not authorised to perform this action" redirect_to root_path end when ApplicationController::TYPE_LIBRARIAN flash[:notice] = "You are not authorised to perform this action" redirect_to root_path when ApplicationController::TYPE_ADMIN # admin can see any student end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_student\n @student = Student.find(params[:std_id])\n render json: @student\n end", "def show\n student = Student.find(params[:id])\n render json: student\nend", "def show\n @student = User.find params[:id]\n respond_to do |format|\n format.html # index.html.erb\n format.jso...
[ "0.79915404", "0.77167404", "0.764098", "0.7618442", "0.7569385", "0.75570226", "0.75570226", "0.75570226", "0.75570226", "0.75570226", "0.75570226", "0.75570226", "0.75570226", "0.749562", "0.749562", "0.7488676", "0.74655014", "0.74655014", "0.74454695", "0.74425215", "0.74...
0.0
-1
POST /students POST /students.json
def create @student = Student.new(student_params) @student.set_book_limit respond_to do |format| if @student.save format.html { redirect_to root_url, notice: 'Student was successfully created.' } format.json { render :show, status: :created, location: @student } else format.html { render :new } format.json { render json: @student.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @student = Student.new(student_params)\n\n if @student.save\n render json: @student, status: :created\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end", "def create\n @student = current_user.students.create(student_params)\n\n respond_...
[ "0.7277736", "0.7135355", "0.71114737", "0.71114737", "0.70372117", "0.70311", "0.70311", "0.70311", "0.70311", "0.70311", "0.70311", "0.70311", "0.6981121", "0.6974331", "0.6952658", "0.6951065", "0.6949918", "0.6949918", "0.6949918", "0.6949918", "0.6949918", "0.6949918",...
0.0
-1
PATCH/PUT /students/1 PATCH/PUT /students/1.json
def update respond_to do |format| if @student.update(student_params) @student.set_book_limit @student.save format.html { redirect_to root_url, notice: 'Student was successfully updated.' } format.json { render :show, status: :ok, location: @student } else format.html { render :edit } format.json { render json: @student.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @student.update(student_params)\n render json: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end", "def update\n # @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])...
[ "0.7182317", "0.7118746", "0.7112766", "0.70681185", "0.70681185", "0.7049016", "0.7049016", "0.7049016", "0.7049016", "0.7049016", "0.70481044", "0.69805574", "0.69361293", "0.69361293", "0.69361293", "0.688415", "0.6873322", "0.68329144", "0.68329144", "0.68329144", "0.6832...
0.0
-1
DELETE /students/1 DELETE /students/1.json
def destroy Student.delete(params[:id]) respond_to do |format| format.html { redirect_to students_url, notice: 'Student was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @student.delete\n respond_to do |format|\n format.html { redirect_to students_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @student = Student.find(params[:id])\n @student.destroy\n\n respond_to do |format|\n format.html { redirect_to studen...
[ "0.781907", "0.7671166", "0.7663204", "0.76587826", "0.7656264", "0.7656264", "0.7656264", "0.7656264", "0.7656264", "0.7656264", "0.7656264", "0.7656264", "0.7620924", "0.7620924", "0.7620924", "0.7620924", "0.75964904", "0.74745804", "0.7466961", "0.7465633", "0.7436561", ...
0.7527029
17
Use callbacks to share common setup or constraints between actions.
def set_student @student = Student.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 student_params params.require(:student).permit(:email, :name, :password, :edu_level, :book_limit, :university_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980384", "0.6782743", "0.6746196", "0.6742575", "0.6736", "0.6594004", "0.65037984", "0.6496699", "0.64819324", "0.64791185", "0.6456292", "0.64403296", "0.63795286", "0.6375975", "0.6365291", "0.63210756", "0.6300542", "0.6299717", "0.62943304", "0.6292561", "0.6290683",...
0.0
-1
tkxel_dev: Send email upon voucher creation
def food_mail(email) @url = 'http://foodcircles.net/?app=mobile_email' mail(:to => email, :reply_to => 'jk@joinfoodcircles.org', :subject => "Your appetite is powerful.") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def voucher_created(voucher)\n @voucher = voucher\n mail :to => voucher.email, :subject => \"Your Offer Code and Information\"\n end", "def setup_email(user, payment)\n mail = Mail.deliver do\n to user.email\n from 'FoodCircles <hey@joinfoodcircles.org>'\n subject \"Got your Voucher for...
[ "0.8462904", "0.70727456", "0.6913794", "0.68953955", "0.6893193", "0.6875904", "0.68185943", "0.6793213", "0.6765978", "0.6738851", "0.6724619", "0.67229515", "0.6715527", "0.67127854", "0.6702236", "0.6686836", "0.6681539", "0.66647476", "0.66564995", "0.6637404", "0.662545...
0.0
-1
tkxel_dev: Email Content creation is handled in the following method.
def setup_email(user, payment) mail = Mail.deliver do to user.email from 'FoodCircles <hey@joinfoodcircles.org>' subject "Got your Voucher for #{payment.offer.venue.name}" reply_to 'used@inbound.foodcircles.net' html_part do content_type 'text/html; charset=UTF-8' body "<table width = '550px'><tr><td style = font-size:12pt; font-family:Arial><p style= text-align: justify;>Print this email or just show it off on a fancy electronic device.</p> <p style= text-align: justify> <b>confirmation code:</b> #{payment.code}<br> <b>good for:</b> #{payment.offer.name}<br> <b>only at:</b> #{payment.offer.venue.name}<br> <b>with a minimum of:</b> #{payment.offer.min_diners} diners<br> <b>expiring:</b> #{30.days.from_now.to_date}</p><br> <b>3 steps to redeem:</b> <p> <b>1)</b> Show server this message before you order. They should jot your code down and confirm.<br> <b>2)</b> Order regular food or drink for each person in party.<br> <b>3)</b> Mark Voucher used by following this link! <a href=\"http://staging.foodcircles.net/payment/used?code=#{payment.code}&source=email\">Mark Voucher Used</a></br> </p><br><br> Enjoy!<br><br> Contact support at <b>support@joinfoodcircles.org</b> if you have any concerns or questions whatsoever.<br><br><br> <h3><u>FOR SERVERS:</u></h3> <p style= text-align: justify;><b>Write down the confirmation code on the table's receipt or your POS system</b>. Place a \"Buy One, Feed One\" placard on the guest's table, and mark a tally on your chalkboard (if available). Call us at 312 945 8627 with any questions!</p></td></tr></table>" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_email_content\n txt = I18n.t(\"estimate_request.fltk.email_content\", :origin => self.origin_port.name, :destination => destination_port.name, :count => self.estimate_items.first.number_of_items, :description => self.estimate_items.first.description)\n txt\n end", "def mk_email\n ps = \"P...
[ "0.68935984", "0.6638961", "0.64742064", "0.64098126", "0.6375902", "0.6322598", "0.63189614", "0.6270697", "0.62671113", "0.6265751", "0.6254013", "0.6235689", "0.617957", "0.617957", "0.6135113", "0.60822135", "0.60725814", "0.6057028", "0.6040514", "0.6029099", "0.60260975...
0.0
-1
With MangoPay we do an immediate payout to receivers account
def handle_paid_payment(payment) response = MangoPay::Withdrawal.create({ 'UserID' => payment.recipient.mangopay_id, 'WalletID' => 0, 'BeneficiaryID' => payment.recipient.mangopay_beneficiary_id, 'Amount' => payment.total_sum.cents, 'Tag' => payment.id }) puts "WITHDRAWAL RESPONSE #{response.inspect}" if response["ErrorCode"] ApplicationHelper.send_error_notification(response["ErrorCode"], "MangopayWithdrawalError", response) return false else return true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_pay\n self.paid_at = Time.now.utc\n self.send_paid\n end", "def payout\n\t\t# if !current_user.merchant_id.blank?\n # \t\t\taccount = Stripe::Account.retrieve(current_user.merchant_id)\n # \t\t\t@login_link = account.login_links.create()\n\t\t# end\n end", "def payout(amount, target_address:...
[ "0.68328315", "0.67279655", "0.6485425", "0.64456135", "0.61975", "0.61922866", "0.6176197", "0.6158198", "0.6107334", "0.6090993", "0.60807323", "0.6062563", "0.6045458", "0.5991927", "0.59805334", "0.5920878", "0.5915377", "0.59128165", "0.59119236", "0.58974683", "0.586575...
0.0
-1
will return the parameter locale if Mangopay supports it
def payment_compatible_locale(locale) locale = locale.to_s.split("-").first if ["fr", "en", "es", "it", "pt", "de", "nl", "fi"].include?(locale) return locale else return "en" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locale\n lang = params.fetch(:language, I18n.default_locale).to_sym\n I18n.available_locales.include?(lang) ? lang : I18n.default_locale\n end", "def get_locale_from_params \n return nil unless params[:locale]\n I18n.available_locales.include?(params[:locale].to_sym) ? params[:locale] : nil\...
[ "0.7838158", "0.7825573", "0.7823879", "0.77388436", "0.7726428", "0.7635549", "0.7635549", "0.7635549", "0.7635549", "0.7635549", "0.7635549", "0.7635549", "0.7489069", "0.7451018", "0.74438983", "0.74419606", "0.74080664", "0.7404709", "0.7404513", "0.7402561", "0.73953307"...
0.71903276
30
Check that required payout details are present (and creates MangoPay benificiary if needed)
def required_payout_details_present?(person) return false unless person.bank_account_owner_name && person.bank_account_owner_address && person.iban && person.bic.present? return person.mangopay_beneficiary_id.present? || create_mangopay_beneficiary(person) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @payout = Payout.new(payout_params)\n\n respond_to do |format|\n if @payout.save\n format.html { redirect_to @payout, notice: 'Payout was successfully created.' }\n format.json { render :show, status: :created, location: @payout }\n else\n format.html { render :new...
[ "0.63583624", "0.63566107", "0.6131647", "0.60571337", "0.59907997", "0.59208137", "0.59208137", "0.5919957", "0.5873683", "0.5869971", "0.5848572", "0.58260286", "0.58059704", "0.5783886", "0.5783886", "0.57693124", "0.5767362", "0.5764828", "0.5758694", "0.5756678", "0.5746...
0.76887155
0
Scrub sensitive parameters from your log filter_parameter_logging :password
def access_required_member logger.debug session.to_yaml redirect_to '/access_denied.html' and return unless session["user_#{current_user.id}"][:access_level] >= Role.access_level('Member') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_password_confirmation\n log :filter_password_confirmation, \"\"\n replace_in_file 'config/initializers/filter_parameter_logging.rb',\n 'Rails.application.config.filter_parameters += [:password]',\n 'Rails.application.config.filter_parameters += [:password, :password_c...
[ "0.70550495", "0.6336262", "0.6336262", "0.63316625", "0.6258226", "0.62339425", "0.62339425", "0.6213462", "0.6187749", "0.6110442", "0.60382676", "0.5864885", "0.584808", "0.579081", "0.5772373", "0.5756956", "0.574457", "0.573957", "0.57173705", "0.57173705", "0.57173705",...
0.0
-1
required for declarative_authorization roles has a TITLE field
def role_symbols (roles || []).map {|r| r.title.to_sym} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_have_invalid_role_title\n assert ! roles(:invalid_title).valid?, \"'Hangaround' shouldn't be a valid role title.\"\n end", "def role; end", "def role; end", "def title(text)\n raise DSLError, \"title only allowed in role blocks\" if @current_role.nil?\n role_titles[@current_...
[ "0.6781774", "0.66469723", "0.66469723", "0.6556628", "0.6538224", "0.64279", "0.642527", "0.6396382", "0.638975", "0.6356024", "0.6325904", "0.6264541", "0.6260399", "0.62375784", "0.62160397", "0.62018883", "0.61882824", "0.6130857", "0.60919774", "0.6067625", "0.6050125", ...
0.0
-1
Write a program that contains a method called greeting that takes a name as its parameter. It then prints a greeting message with the name included in it.
def greeting(name) print "Hello there, #{name}!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def greeting(name)\n puts \"Hello #{name}, welcome to the program!\"\nend", "def greeting(name)\n print \"hello \" + name + \" what the fuck is your problem?\"\nend", "def greeting(name)\n\t\tputs \" Hi there #{name}, how are you doing today?\"\n\tend", "def greeting(name)\n\tputs \"Hello \" + name + \...
[ "0.85417664", "0.83980525", "0.83280915", "0.83228564", "0.8301846", "0.8301846", "0.82970876", "0.8276872", "0.8154406", "0.80973935", "0.8090549", "0.8077661", "0.80389327", "0.8037178", "0.8010585", "0.7981332", "0.7980237", "0.7979566", "0.7968205", "0.79409516", "0.79409...
0.8227649
8
Lists ReservationInstance records from the API as a list. Unlike stream(), this operation is eager and will load `limit` records into memory before returning.
def list(reservation_status: :unset, limit: nil, page_size: nil) self.stream( reservation_status: reservation_status, limit: limit, page_size: page_size ).entries end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end", "def list(limit: nil, page_size: nil)\n self.stream(limit: limit, page_size: page_size).entries\n end", "def list(limit: nil, page_size: nil)\n self.stream...
[ "0.65928", "0.65928", "0.65611684", "0.64563847", "0.64563847", "0.64563847", "0.64563847", "0.64563847", "0.64563847", "0.6360206", "0.61795986", "0.59689677", "0.59689677", "0.58669424", "0.57883817", "0.57568574", "0.5723503", "0.5700078", "0.56211066", "0.56211066", "0.56...
0.6616134
0
Streams Instance records from the API as an Enumerable. This operation lazily loads records as efficiently as possible until the limit is reached.
def stream(reservation_status: :unset, limit: nil, page_size: nil) limits = @version.read_limits(limit, page_size) page = self.page( reservation_status: reservation_status, page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each\n limits = @version.read_limits\n\n page = self.page(page_size: limits[:page_size],)\n\n @version.stream(page,\n limit: limits[:limit],\n page_limit: limits[:page_limit]).each {|x| yield x}\n ...
[ "0.6504", "0.64974874", "0.6495632", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0.6494728", "0....
0.0
-1
When passed a block, yields ReservationInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached.
def each limits = @version.read_limits page = self.page(page_size: limits[:page_size], ) @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]).each {|x| yield x} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_instances\n instances = []\n next_token = nil\n all_records_retrieved = false\n\n until all_records_retrieved\n response = @@client.describe_instances({\n next_token: next_token\n })\n next_token = response.next_token\n all_records...
[ "0.6061828", "0.590731", "0.58006203", "0.56511086", "0.5615702", "0.5598442", "0.5386773", "0.53819895", "0.5355276", "0.5296818", "0.52892333", "0.5276433", "0.5223779", "0.5134384", "0.50909615", "0.5085312", "0.5066368", "0.5063402", "0.5031241", "0.50076544", "0.49771437...
0.47103518
78
Retrieve a single page of ReservationInstance records from the API. Request is executed immediately.
def page(reservation_status: :unset, page_token: :unset, page_number: :unset, page_size: :unset) params = Twilio::Values.of({ 'ReservationStatus' => reservation_status, 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) response = @version.page('GET', @uri, params: params) ReservationPage.new(@version, response, @solution) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def index\n scope = apply_scopes(Reservation)\n @reservations = scope.respond_to?(:to_a) ? scope.to_a : scope.all\n @reservations = @reservations.paginate(page: params['page'])\n end", "def index\n @reser...
[ "0.7140015", "0.64149225", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.620297", "0.614509", "0.6142477", "0.6093186", "0.60762304", "0.6062868", ...
0.6298048
2
Retrieve a single page of ReservationInstance records from the API. Request is executed immediately.
def get_page(target_url) response = @version.domain.request( 'GET', target_url ) ReservationPage.new(@version, response, @solution) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reservations = V2::Reservation.order(id: :desc).page(params[:page])\n end", "def index\n scope = apply_scopes(Reservation)\n @reservations = scope.respond_to?(:to_a) ? scope.to_a : scope.all\n @reservations = @reservations.paginate(page: params['page'])\n end", "def page(reservation_...
[ "0.71400803", "0.64153403", "0.6299721", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6203335", "0.6146225", "0.61417955", "0.60943013",...
0.574941
45
Provide a user friendly representation
def to_s '#<Twilio.Taskrouter.V1.ReservationList>' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70430577", "0.7025487", "0.7008232", "0.7007793", "0.69441473", "0.6917163", "0.68431", "0.6797009", "0.6655106", "0.66227216", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.660979", "0.660979", "0.6585346", "0...
0.0
-1
Provide a user friendly representation
def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70430577", "0.7025487", "0.7008232", "0.7007793", "0.69441473", "0.6917163", "0.68431", "0.6797009", "0.6655106", "0.66227216", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.660979", "0.660979", "0.6585346", "0...
0.0
-1
Provide a detailed, user friendly representation
def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Taskrouter.V1.ReservationContext #{context}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details; end", "def to_s; description end", "def get_detail\n return self.inspect\n end", "def to_display\n raise NotImplementedError\n end", "def formatted_info\n \"#{self.name} - #{self.description}\"\n end", "def toString\n #Not sure if we want this or just use the getters for mor...
[ "0.68170065", "0.68142146", "0.6758589", "0.6718451", "0.66697186", "0.6655344", "0.6632312", "0.66273594", "0.6550127", "0.65188134", "0.6497969", "0.6480078", "0.6477721", "0.6472211", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64...
0.0
-1
Build an instance of ReservationInstance
def get_instance(payload) ReservationInstance.new(@version, payload, workspace_sid: @solution[:workspace_sid], worker_sid: @solution[:worker_sid]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_reservation\n #@reservation = Reservation.new\n end", "def new\n @reserve = Reservation.new\n end", "def new\n\t\t@reservation = Reservation.new\n\tend", "def create_reservation(guest_id:, room_id:, start_date:, end_date:)\n Reservation.new(\n guest_id: guest_id,\n room_id: room...
[ "0.74287575", "0.74072343", "0.7145606", "0.693043", "0.69267935", "0.6905704", "0.6877023", "0.6496482", "0.64404047", "0.6426042", "0.64192414", "0.62462634", "0.61453587", "0.61143494", "0.6091121", "0.6047725", "0.60467935", "0.6038181", "0.6024694", "0.60130376", "0.6013...
0.7364325
2
Provide a user friendly representation
def to_s '<Twilio.Taskrouter.V1.ReservationPage>' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70430577", "0.7025487", "0.7008232", "0.7007793", "0.69441473", "0.6917163", "0.68431", "0.6797009", "0.6655106", "0.66227216", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.660979", "0.660979", "0.6585346", "0...
0.0
-1
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
def context unless @instance_context @instance_context = ReservationContext.new(@version , @params['workspace_sid'], @params['worker_sid'], @params['sid']) end @instance_context end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def context\n unless @instance_context\n @instance_context = ApplicationContext.new(@version , @params['account_sid'], @params['sid'])\n end\n @instance_context\n end", "def context\n ...
[ "0.6837938", "0.6802996", "0.67975914", "0.67719287", "0.6769035", "0.6769035", "0.6731887", "0.6682339", "0.66800934", "0.667849", "0.6676959", "0.6640555", "0.6627805", "0.6610363", "0.66007906", "0.6591611", "0.65719724", "0.6567965", "0.6560346", "0.6556549", "0.65504354"...
0.63312715
31
Provide a user friendly representation
def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.ReservationInstance #{values}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_display\n raise NotImplementedError\n end", "def to_s; description end", "def toString\n #Not sure if we want this or just use the getters for more\n #selective formatting\n end", "def to_s\n super\n end", "def to_s\n super\n end", "def to_s\n \"#{@nam...
[ "0.70430577", "0.7025487", "0.7008232", "0.7007793", "0.69441473", "0.6917163", "0.68431", "0.6797009", "0.6655106", "0.66227216", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.6618043", "0.660979", "0.660979", "0.6585346", "0...
0.0
-1
Provide a detailed, user friendly representation
def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Taskrouter.V1.ReservationInstance #{values}>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def details; end", "def to_s; description end", "def get_detail\n return self.inspect\n end", "def to_display\n raise NotImplementedError\n end", "def formatted_info\n \"#{self.name} - #{self.description}\"\n end", "def toString\n #Not sure if we want this or just use the getters for mor...
[ "0.68170065", "0.68142146", "0.6758589", "0.6718451", "0.66697186", "0.6655344", "0.6632312", "0.66273594", "0.6550127", "0.65188134", "0.6497969", "0.6480078", "0.6477721", "0.6472211", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64502096", "0.64...
0.0
-1
... Ready state of each day' .... Test methods days=[0, 1, 2, 3, 4, 5] chk_workers=[0,1,2,3] test_cnt_filled(y, days, chk_workers, 1)
def char_selected(prompt='chose :', srcs) print prompt while true res = gets.chop! case res when /[#{srcs}]/i return res end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def weekday(days)\nt = Date.today\narr = []\n days.times do\n arr << \"ok\" if t.saturday? || t.sunday?; t = t - 1\n end\n arr.count\nend", "def task_count_instances\n #ex_count = find_exception_count\n if self.occurrence_type.eql?(\"count\")\n count = self.count.to_i\n return count\n elsif ...
[ "0.578286", "0.5644725", "0.55621606", "0.5473797", "0.5427427", "0.5424821", "0.5407498", "0.5389978", "0.53689975", "0.5364893", "0.5333127", "0.5312072", "0.53025943", "0.5253928", "0.52538526", "0.52506834", "0.52307487", "0.52279055", "0.5218273", "0.5203248", "0.5203248...
0.0
-1
sends all the pages in this message returns the message
def send_pages Msg.resolve(recipient).each do |user| next if !user.sms_validated? p = Page.new_page_to_user(self, user) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_page\n send_message(\"page\")\n end", "def sent\n @messages = current_user.messages.order('created_at DESC').unarchived.paginate(:page => params[:page], :per_page => 10)\n end", "def page(message, url)\n recipients message.recipients\n from ADMIN_EMAIL\n subject message.su...
[ "0.6956178", "0.6514956", "0.6492343", "0.63325435", "0.6324517", "0.6280375", "0.62239534", "0.62089765", "0.61276126", "0.60872334", "0.6085665", "0.6065085", "0.606036", "0.6049398", "0.60426766", "0.6028769", "0.5968318", "0.5959539", "0.59392667", "0.59057176", "0.589545...
0.7152458
0
GET /projectareas/1 GET /projectareas/1.xml
def show @projectarea = Projectarea.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @projectarea } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @project_areas = ProjectArea.all\n end", "def index\n @projects = @client.projects\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @projects }\n end\n end", "def new\n @projectarea = Projectarea.new\n\n respond_to do |format|\n ...
[ "0.66682184", "0.634664", "0.62768626", "0.6212603", "0.61729914", "0.6153749", "0.61136156", "0.6106011", "0.61049753", "0.6101279", "0.6101279", "0.6092744", "0.60809135", "0.60733116", "0.60714346", "0.6058272", "0.6035322", "0.60149705", "0.60101664", "0.599544", "0.59675...
0.7037262
0
GET /projectareas/new GET /projectareas/new.xml
def new @projectarea = Projectarea.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @projectarea } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @projectarea = Projectarea.new(params[:projectarea])\n\n respond_to do |format|\n if @projectarea.save\n flash[:notice] = 'Projectarea was successfully created.'\n format.html { redirect_to(@projectarea) }\n format.xml { render :xml => @projectarea, :status => :created...
[ "0.71269447", "0.702568", "0.6980662", "0.6980662", "0.69217044", "0.6921029", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", "0.6819034", ...
0.78220785
0
POST /projectareas POST /projectareas.xml
def create @projectarea = Projectarea.new(params[:projectarea]) respond_to do |format| if @projectarea.save flash[:notice] = 'Projectarea was successfully created.' format.html { redirect_to(@projectarea) } format.xml { render :xml => @projectarea, :status => :created, :location => @projectarea } else format.html { render :action => "new" } format.xml { render :xml => @projectarea.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project_area = ProjectArea.new(project_area_params)\n\n respond_to do |format|\n if @project_area.save\n format.html { redirect_to @project_area, notice: 'Project area was successfully created.' }\n format.json { render :show, status: :created, location: @project_area }\n ...
[ "0.6412374", "0.5897453", "0.58403254", "0.5838494", "0.579858", "0.57751274", "0.55490553", "0.55028486", "0.54609144", "0.54419535", "0.5338592", "0.53223807", "0.53205025", "0.5317225", "0.5298864", "0.5267774", "0.5253832", "0.5233806", "0.5231168", "0.5231168", "0.523004...
0.66089976
0
PUT /projectareas/1 PUT /projectareas/1.xml
def update @projectarea = Projectarea.find(params[:id]) respond_to do |format| if @projectarea.update_attributes(params[:projectarea]) flash[:notice] = 'Projectarea was successfully updated.' format.html { redirect_to(@projectarea) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @projectarea.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :project => {:user_id => 1,\r\n :url => 'http://www.apiproject.com',\r\n :name => 'API Project',\r\n :descrip...
[ "0.6494426", "0.61116356", "0.5929459", "0.5929459", "0.5863026", "0.5863026", "0.5842453", "0.5786108", "0.5738155", "0.56864125", "0.56864125", "0.56864125", "0.5634796", "0.5589337", "0.5588147", "0.5529578", "0.55207264", "0.54972243", "0.5474664", "0.54031044", "0.539676...
0.66401917
0
DELETE /projectareas/1 DELETE /projectareas/1.xml
def destroy @projectarea = Projectarea.find(params[:id]) @projectarea.destroy respond_to do |format| format.html { redirect_to(projectareas_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @area = Area.find(params[:id])\n if @area.children.size == 0 and @area.name != \"localhost\"\n @area.destroy\n flash[:notice] = \"Deleted #{@area.to_s}\" \n else\n flash[:notice] = \"#{@area.to_s} not deleted. It has children or is the localhost node.\" \n end\n\n re...
[ "0.67901736", "0.654388", "0.654388", "0.65335155", "0.6464684", "0.644625", "0.644625", "0.6379995", "0.62911654", "0.62151057", "0.62045926", "0.6188616", "0.61597186", "0.61538047", "0.613933", "0.6137967", "0.61368936", "0.6126015", "0.6120021", "0.61189497", "0.60846424"...
0.7297433
0
There are two situations where we want to avoid checking for an active (ongoing) production deployment: A caller of this trigger could set SKIP_DEPLOYMENT_CHECK to avoid the check, i.e. during feature flag activation When we are checking the status during an ongoing deployment (deployment_check? == true)
def skip_active_deployment_check? ENV['SKIP_DEPLOYMENT_CHECK'] == 'true' || deployment_check? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend", "def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend", "def deploy_disabled?\n ENV['NO_DEPLOY'] == '1'\nend", "def deploy_requires_approval?\n super || pipeline_next_stages.any?(&:deploy_requires_approval?)\n end", "def region_is_available_fo...
[ "0.7550755", "0.7550755", "0.7549739", "0.7073127", "0.656491", "0.6546807", "0.64391065", "0.63907504", "0.6372478", "0.63191116", "0.6083619", "0.60770607", "0.6072778", "0.6068416", "0.60591704", "0.6057308", "0.6027853", "0.602724", "0.6022737", "0.6004141", "0.5936783", ...
0.81786835
0
GET /users/blocks GET /users/blocks.json
def index @users_blocks = Block.all.where(user_id: current_user.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block_users\n request('/block/users', {body: {}})\n end", "def index\n @blocks = Block.all\n\n render json: @blocks\n end", "def create\n @users_block = Block.new(blocked_id: params[:block][:blocked],\n user_id: current_user.id)\n @users = get_blockable_user...
[ "0.7631785", "0.7106992", "0.70535165", "0.7030853", "0.69684577", "0.6933396", "0.69011587", "0.6872988", "0.68617296", "0.6833513", "0.6818587", "0.6693042", "0.664015", "0.66317266", "0.66317266", "0.6624982", "0.6579073", "0.65446943", "0.652411", "0.6498027", "0.64584744...
0.7533225
1
POST /users/blocks POST /users/blocks.json
def create @users_block = Block.new(blocked_id: params[:block][:blocked], user_id: current_user.id) @users = get_blockable_users respond_to do |format| if @users_block.save format.html { redirect_to block_path, notice: 'Block was successfully created.' } format.json { render :show, status: :created, location: @users_block } else format.html { render :new } format.json { render json: @users_block.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def block(user)\n post \"blocks/create/#{user}\"\n end", "def create\n @block = Block.new(block_params)\n\n if @block.save\n render json: @block, status: :created, location: @block\n else\n render json: @block.errors, status: :unprocessable_entity\n end\n end", "def create\n @bloc...
[ "0.8266645", "0.70048237", "0.69854116", "0.69636035", "0.68545735", "0.68484443", "0.68373317", "0.68008536", "0.67833334", "0.6736109", "0.67128116", "0.67036885", "0.66368484", "0.6614877", "0.66117805", "0.65809923", "0.65646106", "0.6538575", "0.6504471", "0.6360691", "0...
0.7893728
1
DELETE /users/blocks/1 DELETE /users/blocks/1.json
def destroy @users_block.destroy respond_to do |format| format.html { redirect_to block_path, notice: 'Block was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_block(user)\n delete \"blocks/destroy/#{user}\"\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format.html { redirect_to blocks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @block.destroy\n respond_to do |format|\n format...
[ "0.7901728", "0.7585324", "0.7585324", "0.75791234", "0.75643224", "0.7525792", "0.74564135", "0.74558383", "0.7440272", "0.72926694", "0.7287158", "0.7286936", "0.72502226", "0.7233116", "0.7218091", "0.7142713", "0.7142713", "0.7088925", "0.70857775", "0.70030016", "0.69459...
0.7711706
1
Use callbacks to share common setup or constraints between actions.
def set_users_block @users_block = Block.find_by(id_params) 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
USAGE NOTES: this method will throw an error if it is passed something other than a vowel ('aeiou')
def next_vowel(vowel) 'aeiou'[('aeiou'.index(vowel) + 1) % 'aeiou'.length] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_vowel?(letter)\n \"aeiou\".include?(letter)\n end", "def vowels (string)\n # Your code here\nend", "def is_vowel?(letter)\n case letter\n when \"a\", \"e\", \"i\", \"o\", \"u\"\n return true\n else\n return false\n end\nend", "def is_vowel(letter)\n \"aeiou\".include?(letter.downcase)\...
[ "0.7614158", "0.7571017", "0.7498188", "0.7482208", "0.74205154", "0.7409443", "0.73978084", "0.7360995", "0.73423153", "0.73389965", "0.73190147", "0.73127383", "0.73107314", "0.7306997", "0.7291381", "0.72582793", "0.72038", "0.7196371", "0.7181058", "0.7087927", "0.7080217...
0.0
-1
create a method that takes a lowercase consonant and returns the next consonant
def next_consonant(consonant) # handle 'z' edge case if consonant == 'z' consonant = 'b' # if the next letter is a vowel elsif 'aeiou'.include?(consonant.next) # return the letter after that consonant.next.next # otherwise, return the next letter else consonant.next end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_consonant (consonant)\n consonant_downcase = consonant.downcase\n index = CONSONANTS.index(consonant_downcase)\n\n # handle edge case for letter 'z'\n if consonant_downcase == \"z\"\n next_consonant = CONSONANTS[0]\n else\n next_consonant = CONSONANTS[index + 1]\n end\n #Capitalize next lette...
[ "0.81774974", "0.793842", "0.78743875", "0.78390753", "0.7724036", "0.7724036", "0.7599899", "0.75961876", "0.75937635", "0.7518389", "0.75182676", "0.7357389", "0.73339355", "0.7329713", "0.7313025", "0.7232356", "0.7186105", "0.71557504", "0.7081289", "0.7019443", "0.701546...
0.7913301
2
create a method that takes a name and returns a fake name
def make_fake_name(name) # downcase to avoid issues due to capitalization # convert name to an array of characters # for each letter, name = name.downcase.chars.map! do |letter| # if it is a vowel, change it to the next vowel if 'aeiou'.include?(letter) next_vowel(letter) # elsif it is a letter, change it to the next consonant elsif ('a'..'z').include?(letter) next_consonant(letter) # otherwise, nil it end end # convert name back to a string and re-capitalize it name = name.join.capitalize end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def specialize_method_name( name )\n return \"#{name}#{self.class.name.split(\"::\")[-1].gsub(/[A-Z]/){|s| \"_#{s.downcase}\"}}\".intern\n end", "def fake_name(real_name)\n #call swap name to swap first and last names\n swapped_name = swap_name( real_name)\n last_name = swapped_name[0]\n first_name = ...
[ "0.71277565", "0.71235347", "0.7045497", "0.6998256", "0.6993382", "0.6946044", "0.6929188", "0.68508023", "0.68508023", "0.6828969", "0.67936015", "0.6789207", "0.6778685", "0.6662652", "0.66410613", "0.66410613", "0.6634728", "0.6634728", "0.6583612", "0.6561081", "0.654598...
0.0
-1
create a method that takes a full name and returns a fake full name
def make_fake_full_name (full_name) # put names into an array and swap first and last (if you wanted a string instead: name.partition(' ').reverse.join) full_name = full_name.split(' ').reverse # for each name, replace it with a fake name full_name.map! {|name| make_fake_name(name)} # convert the full name back to a string with a space between the partial names full_name = full_name.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name(first_name, last_name)\n # TODO: the method should return the fullname\n #----------------------------\n\n # your code here\n\n #----------------------------\nend", "def full_name\n get_full_name\n end", "def fake_name (first_name, last_name)\n \"#{last_name} #{first_name}\"\nend", "de...
[ "0.7889941", "0.782253", "0.78032035", "0.7752266", "0.7699821", "0.76951313", "0.76771945", "0.76598346", "0.76390576", "0.7635211", "0.7629882", "0.7588677", "0.75661516", "0.75337845", "0.75320745", "0.7521852", "0.7517981", "0.7515368", "0.7512004", "0.7512004", "0.751200...
0.7930022
0
Need to doublecheck that the hash YAML is simple enough to also be legal JSON.
def flatten_event_payload(event) case event.type when 'CreateEvent' return YAML::dump({ 'ref_type' => event.payload.ref_type, 'description' => event.payload.description }) when 'DeleteEvent' return YAML::dump({ 'ref_type' => event.payload.ref_type }) when 'DeploymentEvent' return YAML::dump({ 'name' => event.payload.name }) when 'ForkEvent' return YAML::dump({ 'forkee' => event.payload.forkee['full_name'] }) when 'GollumEvent' ## TODO: pages[][page_name] return YAML::dump({ 'action' => event.payload.action }) when 'IssuesEvent' return YAML::dump({ 'action' => event.payload.action, 'issue' => event.payload.issue['url'] }) when 'IssueCommentEvent' return YAML::dump({ 'action' => event.payload.action, 'issue' => event.payload.issue['url'] }) when 'MemberEvent' return YAML::dump({ 'action' => event.payload.action, 'member' => event.payload.member['login'] }) when 'MembershipEvent' return YAML::dump({ 'action' => event.payload.action, 'member' => event.payload.member['login'], 'team' => event.payload.team['name'], 'scope' => event.payload.scope }) when 'PullRequestEvent' return YAML::dump({ 'action' => event.payload.action, 'pull_request' => event.payload.pull_request['url'] }) when 'PullRequestReviewCommentEvent' return YAML::dump({ 'action' => event.payload.action, 'pull_request' => event.payload.pull_request['url'] }) when 'PushEvent' return YAML::dump({ 'size' => event.payload.size }) when 'ReleaseEvent' return YAML::dump({ 'action' => event.payload.action, 'release' => event.payload.release['url'] }) when 'RepositoryEvent' return YAML::dump({ 'action' => event.payload.action, 'repository' => event.payload.repository['full_name'] }) when 'StatusEvent' return YAML::dump({ 'state' => event.payload.state, 'sha' => event.payload.sha }) when 'TeamAddEvent' return YAML::dump({ 'team' => event.payload.team['name'], 'repository' => event.payload.repository['full_name'] }) when 'WatchEvent' return YAML::dump({ 'action' => event.payload.action }) else # CommitCommentEvent # DeploymentStatusEvent # DownloadEvent - No longer exists # FollowEvent - No longer exists # ForkApplyEvent - No longer exists # GistEvent - No longer exists # PageBuildEvent # PublicEvent return '' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verify_yaml(yaml)\r\n expect(yaml).to be_instance_of(String)\r\n expect(yaml.length).to be >= 40_000\r\n %w{person: personAddress: syntax:}.each{|s| expect(yaml).to include(s)}\r\n end", "def yaml_content() = JSON.parse(content.to_json).to_yaml", "def serialize(hash)\n handle_encoding_er...
[ "0.65405375", "0.610742", "0.59913933", "0.59499514", "0.59301084", "0.58896166", "0.58498716", "0.5837605", "0.5833974", "0.5833974", "0.58185714", "0.58177996", "0.5806338", "0.5771341", "0.576988", "0.57175803", "0.5694498", "0.56568587", "0.5617414", "0.56140465", "0.5611...
0.0
-1
TODO: Currently the event payload storage is BIG. And a little useless. I need to take each event type that is known about, and convert the GitHub object into an array of hash. If not known, it should store the whole object, while wincing.
def db_insert_events(db, events) begin db.transaction do events.each do |event| flatPayload=flatten_event_payload(event) db[ "INSERT INTO events ( id, type, actor, org, repo, public, created_at, payload ) VALUES ( ?, ?, ?, ?, ?, ?, ?, ?)", event.id, event.type, event.actor.login, event.org.login, event.repo.name, event.public.to_s, event.created_at.to_s, flatPayload].insert #puts " Inserted: #{event.id}" end end rescue => e puts "Error during processing: #{$!}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flatten_event_payload(event)\n case event.type\n when 'CreateEvent'\n return YAML::dump({ 'ref_type' => event.payload.ref_type, 'description' => event.payload.description })\n when 'DeleteEvent'\n return YAML::dump({ 'ref_type' => event.payload.ref_type })\n when 'DeploymentEvent'\n ...
[ "0.67787796", "0.64926255", "0.6118883", "0.60921526", "0.60250604", "0.59186286", "0.59169394", "0.59097224", "0.5727255", "0.55693775", "0.55673075", "0.55574", "0.5535561", "0.55075973", "0.5477441", "0.54125696", "0.538977", "0.538683", "0.5384652", "0.53831744", "0.53764...
0.0
-1
byr (Birth Year) iyr (Issue Year) eyr (Expiration Year) hgt (Height) hcl (Hair Color) ecl (Eye Color) pid (Passport ID) cid (Country ID)
def passport_valid?(passport_hash) has_required_fields = REQUIRED_FIELDS.all? do |required_field| !passport_hash[required_field].nil? end return false unless has_required_fields REQUIRED_FIELDS.all? do |field| case field when 'byr' valid_birth_year?(passport_hash[field]) when 'iyr' valid_issue_year?(passport_hash[field]) when 'eyr' valid_expiration_year?(passport_hash[field]) when 'hgt' valid_height?(passport_hash[field]) when 'hcl' valid_hair_color?(passport_hash[field]) when 'ecl' valid_eye_color?(passport_hash[field]) when 'pid' valid_passport_number?(passport_hash[field]) else false end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cwyear\n end", "def w_year; end", "def year; end", "def year; end", "def year() end", "def card_year\n card[:year].to_i\n end", "def card_data\n {:cc_type => cc_type, :last_digits => last_digits, :first_name => first_name, :last_name => last_name, :year => year, :month => month}\n end", ...
[ "0.5807297", "0.56011546", "0.5452058", "0.5452058", "0.5359808", "0.5355504", "0.52998847", "0.52906036", "0.52709967", "0.5250252", "0.5247376", "0.5194594", "0.51912796", "0.517386", "0.51321924", "0.51321924", "0.51321924", "0.51277864", "0.51174724", "0.5113224", "0.5089...
0.0
-1
Returns a list of messaging protocols supported by the node (or cluster). Common values are: amqp amqp/ssl mqtt stomp The exact value depends on RabbitMQ configuration and enabled plugins.
def enabled_protocols self.overview.listeners. map { |lnr| lnr.protocol }. uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def protocols\n self\n .class.included_modules\n .reject { |m| m&.name.nil? }\n .select { |m| m.name.start_with? 'MatrixSdk::Protocols::' }\n .map { |m| m.name.split('::').last.to_sym }\n end", "def protocols\n\t\t\treturn ( self.headers.sec_websocket_protocol || '' ).split( /...
[ "0.6611549", "0.6611149", "0.6611149", "0.593993", "0.58764625", "0.57830316", "0.56831086", "0.56583405", "0.5649526", "0.5635362", "0.5561755", "0.55457574", "0.54450715", "0.5440701", "0.53676075", "0.52836466", "0.519165", "0.50969887", "0.5073199", "0.50297445", "0.50029...
0.577266
6
Returns a hash of protocol => port.
def protocol_ports (self.overview.listeners || []). reduce(Hash.new) { |acc, lnr| acc[lnr.protocol] = lnr.port; acc } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n \"#{@ipv4}#{@port}\".hash\n end", "def to_hash\n thishash = Hash.new()\n thishash['node_number'] = @node_number\n thishash['port'] = @port\n unless @slaveof.nil?\n thishash['slaveof'] = @slaveof['host'] + \":\" + @slaveof['port'].to_s\n end\n return thishash\n end",...
[ "0.8080794", "0.6304852", "0.6073284", "0.6059332", "0.5995155", "0.596545", "0.5949295", "0.5817943", "0.5794598", "0.5765751", "0.57593197", "0.5732313", "0.57077813", "0.5678648", "0.5676193", "0.5670764", "0.5653143", "0.56393075", "0.55943185", "0.5576942", "0.5552088", ...
0.66337043
1
Return dependencies for an object file.
def obj_dep( o ) deps = [] inc_dirs = [ SRC_DIR, TEST_DIR ] cpp = o.sub(/\.o$/,'.cpp') \ .sub(/^obj\/src\//, 'src/') \ .sub(/^obj\/test\//, 'test/') # print cpp, "\n" headers = cpp_headers( cpp, inc_dirs ) # print headers.join(" "), "\n" deps << cpp deps << headers # deps << cpp.sub( /\.cpp$/, '.h' ) return deps end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(filename = \"dependencies.yml\")\n dependencies = Set.new\n $/=\"\\n\\n\"\n File.open(filename, \"r\").each do |object|\n begin\n dependencies << Dependency.deserialize(object)\n rescue\n raise $!, \"Could not load object from #{filename}\", $!.backtrace\n ...
[ "0.7069585", "0.69625485", "0.66465575", "0.6525914", "0.64900213", "0.6469389", "0.64443696", "0.64443696", "0.64443696", "0.64443696", "0.63890594", "0.6342516", "0.633928", "0.6333779", "0.6324865", "0.63203615", "0.62962294", "0.6197755", "0.61847746", "0.6172639", "0.614...
0.71190846
0
add_cominfo_if_fortran.rb create new (Version 7) FDPS_module_blueprint.F90 from old one (version 6)
def process_interface_additions print <<EOF procedure :: ci_initialize procedure :: ci_set_communicator procedure :: ci_delete procedure :: ci_create procedure :: ci_split EOF end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_Add(inst_inf,mode)\n\n # collect Target Macro detail\n module_name = inst_inf.ModuleName\n verilog = inst_inf.ReplaceVerilogFile\n inst_name = inst_inf.InstName\n\n # Get Signal Information of New Macro\n signal_db, new_signal_db = get_SignalDB_from_Verilog(inst_inf,module_name,verilog...
[ "0.52315915", "0.51792353", "0.5146374", "0.51327616", "0.5079716", "0.5049118", "0.49810645", "0.49523193", "0.49307397", "0.49055862", "0.48765934", "0.4875688", "0.4871991", "0.48605093", "0.48311394", "0.4815281", "0.47792965", "0.47776997", "0.472742", "0.4719503", "0.47...
0.46342248
26
sign in user with their user credentials abort if the user object is not a hash or is empty
def sign_in_user(user) wait_until {sign_in.visible?} sign_in.click enter_credentials(user) sign_in_button.click end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def submit\n user = User.where(email: email).first\n if user && !user.password.nil? && user.password == password\n user\n else\n errors.add(:base, :invalid_credentials)\n nil\n end\n end", "def login\n user = User.find_by_email(params[:username])\n if user.nil? || (user && u...
[ "0.6689021", "0.6673973", "0.664951", "0.66427743", "0.66251415", "0.6608341", "0.6562409", "0.65134674", "0.65009576", "0.64671564", "0.6441641", "0.64374936", "0.6433681", "0.63984156", "0.6375763", "0.63670677", "0.6353004", "0.6351801", "0.63299173", "0.63220173", "0.6315...
0.0
-1
Called after each example to clean up created buffers.
def reset end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup; end", "def cleanup; end", "def cleanup; end", "def cleanup; end", "def teardown\n @mem.mem_clear\n end", "def cleanup!; end", "def cleanup!; end", "def after_teardown; end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", "def cleanup\n end", ...
[ "0.6685315", "0.6685315", "0.6685315", "0.6685315", "0.66204935", "0.6592262", "0.6592262", "0.65023196", "0.6491954", "0.6491954", "0.6473183", "0.6473183", "0.6473183", "0.6473183", "0.6469978", "0.6463223", "0.6463223", "0.6463223", "0.6452932", "0.6452932", "0.64318836", ...
0.0
-1
Called after all examples are complete to clean up created servers, etc.
def teardown end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_teardown; end", "def teardown\n # Empty\n end", "def teardown\n # Empty\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "def teardown\n end", "d...
[ "0.70971906", "0.6766081", "0.6766081", "0.67441714", "0.67441714", "0.67256707", "0.67256707", "0.67256707", "0.67256707", "0.67256707", "0.67256707", "0.67256707", "0.67256707", "0.6704392", "0.66914856", "0.66886747", "0.66886747", "0.66579366", "0.66205496", "0.6592868", ...
0.663528
26
Create and enter a buffer with the given contents
def create_buffer(contents) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buffer; end", "def buffer; end", "def buffer; end", "def buffer(str)\n IntelligentBuffer.new(str)\n end", "def open_buffer(io, options = T.unsafe(nil)); end", "def open_buffer\n @out_buffers ||= []\n @out_buffers.push(@out)\n @out = \"\"\n end", "def assemble_buffer(direction, fun...
[ "0.64580494", "0.64580494", "0.64580494", "0.645514", "0.64307946", "0.64214927", "0.6373565", "0.6305096", "0.6261392", "0.61619186", "0.61504847", "0.61288255", "0.6116715", "0.61000973", "0.61000973", "0.6060957", "0.60351145", "0.60163367", "0.6001304", "0.59913576", "0.5...
0.843908
0
Enter the given key sequence in the active buffer
def press(key_sequence) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(key)\n cmd = \"input keyevent #{map_key(key)};\"\n @sequence == \"\" ? @sequence = cmd : @sequence = @sequence + cmd\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\n end", "def key_press locator, keycode\r\n command 'keyPress', locator, keycode\r\...
[ "0.69253063", "0.68007314", "0.68007314", "0.66498524", "0.6583793", "0.6340866", "0.6340866", "0.6331402", "0.63207793", "0.63171494", "0.6314997", "0.62860566", "0.62041444", "0.6201621", "0.6168597", "0.6153032", "0.614488", "0.6143033", "0.6119854", "0.6077393", "0.607020...
0.76466894
0
Return the contents of the line with the given number in the active buffer
def line(number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line\n buffer[line_number]\n end", "def line(number)\n lines[number - 1]\n end", "def line_at(filename, line_number) # :nodoc:\n line = LineCache::getline(filename, line_number, @reload_on_change)\n return \"\\n\" unless line\n return line.gsub(/^\\s+/, '').chomp\n end", ...
[ "0.78151494", "0.6983924", "0.68906516", "0.67963874", "0.67521614", "0.67521614", "0.6698712", "0.6623574", "0.6603453", "0.6603453", "0.6603453", "0.6603453", "0.6603453", "0.6543458", "0.6543458", "0.6543458", "0.65258956", "0.64647174", "0.6403315", "0.63947666", "0.63944...
0.6308628
25
Deletes all entries with keys matching the regular expression. The +matcher+ must be valid pattern for N1QL +REGEXP_MATCHES+ function. More info at Because the operation performed on query engine, and it might take time to propagate changes from key/value engine to the indexer. Therefore the keys, that were created a moment ago might not be deleted. Also this method assumes, that primary index created on the target bucket
def delete_matched(matcher, _options = nil) pattern = case matcher when Regexp matcher.inspect[1..-2] when String matcher.tr("?", ".").gsub("*", ".*") else raise NotImplementedError, "Unable to convert #{matcher.inspect} to Regexp pattern" end operation_options = ::Couchbase::Options::Query(named_parameters: {"pattern" => pattern}, metrics: true) operation_options.consistent_with(::Couchbase::MutationState.new(@last_mutation_token)) if @last_mutation_token begin result = cluster.query("DELETE FROM #{scope_qualifier} cache WHERE REGEXP_MATCHES(META(cache).id, $pattern)", operation_options) result.meta_data.metrics.mutation_count rescue ::Couchbase::Error::ParsingFailure, ::Couchbase::Error::ServiceNotAvailable raise NotImplementedError, "The server does not support delete_matched operation" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_matched(matcher, options = nil)\n options = merged_options(options)\n instrument(:delete_matched, matcher.inspect) do\n failsafe(:read_multi, returning: false) do\n matcher = key_matcher(matcher, options)\n begin\n with do |store|\n ...
[ "0.7052915", "0.6985551", "0.6913937", "0.68575263", "0.6547291", "0.65195936", "0.6311247", "0.58905625", "0.57763535", "0.57760274", "0.569831", "0.5563897", "0.5508622", "0.5440013", "0.53916997", "0.52703464", "0.5154937", "0.5077251", "0.5032267", "0.50318426", "0.500873...
0.7410343
0