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
discover the address for this trip place from its relationships
def address return poi.address unless poi.nil? return place.address unless place.nil? addr = get_address return addr.blank? ? raw_address : addr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addresses\n query(:address)\n end", "def residential_address\n return unless @user.loa3?\n\n dig_out('addresses', 'address_pou', VAProfile::Models::Address::RESIDENCE)\n end", "def address_by_place_id(place_id)\n where(:place_id => place_id).first\n end", "def get_add...
[ "0.6656821", "0.65080637", "0.6384102", "0.63673544", "0.63088083", "0.63019145", "0.6223912", "0.62215227", "0.6199937", "0.61691785", "0.61642265", "0.61551803", "0.6148008", "0.6113723", "0.61110044", "0.61011106", "0.6071704", "0.6055317", "0.6050442", "0.60323864", "0.60...
0.6271624
6
discover the default string value for this trip place from its relationships
def to_s return poi.to_s unless poi.nil? return place.to_s unless place.nil? addr = get_address return addr.blank? ? raw_address : addr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preferred_name(default, preferred)\n if default.nil? && preferred.nil?\n 'No one'\n elsif preferred.nil?\n default\n else\n preferred\n end\n end", "def default_value\n default_db_value ? default_db_value.to_s : \"null\"\n end", "def get_defau...
[ "0.56976575", "0.5662383", "0.56051373", "0.5583346", "0.55768996", "0.5563286", "0.55539644", "0.5551917", "0.5550344", "0.55154765", "0.5515414", "0.5507771", "0.5482009", "0.5435568", "0.5431843", "0.5430972", "0.5425953", "0.5424553", "0.53832686", "0.53058046", "0.526963...
0.0
-1
discover the zipcode for this trip place from its relationships
def zipcode return poi.zip unless poi.nil? return place.zip unless place.nil? return get_zipcode end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postal_code\n self[:zip]\n end", "def zip\n self[:address][:postalCode]\n end", "def search_zip_code\r\n @addresses = Address.find_by_zip_code(params[:address][:zip_code])\r\n end", "def load_districts_zip(zip_code)\n params = {'zip' => zip_code}\n @districts = process('...
[ "0.63452387", "0.63422775", "0.6255217", "0.6154878", "0.6084261", "0.59584016", "0.5884672", "0.5824158", "0.57361025", "0.5713872", "0.570411", "0.5701743", "0.5671898", "0.5671898", "0.56452024", "0.5644597", "0.5627292", "0.56267315", "0.5623451", "0.56075126", "0.5591091...
0.6343369
1
METHOD TO CREATE A LIST input: string of items separated by spaces (example: "carrots apples cereal pizza") steps:
def create_list(title, list_arr) # grocery_list will be a string from user # assign an empty hash (will eventually be the list) final_list = {} # use split method to get list items list_arr = list_arr.split # Iterate through the elements of the array and insert to hash # set default quantity list_arr.each { |item| final_list[item]=1} # print the list to the console [can you use one of your other methods here?] puts print_list(title,final_list) final_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_list (item_list)\n #convert user input to array\n item_list = item_list.split(' ')\n return item_list\nend", "def new_list(item_String, quantity = 1)\n $list = []\n array_strings = item_String.split\n array_strings.each do |element|\n \tlist_item = {\n \t\tquantity: quantity,\n \t\titem: elemen...
[ "0.7490359", "0.72430724", "0.71403927", "0.70354414", "0.6922523", "0.6903794", "0.6864969", "0.68273455", "0.68128616", "0.67992324", "0.6781416", "0.6766408", "0.6749295", "0.6735803", "0.67265195", "0.67030793", "0.66947573", "0.66856885", "0.66623735", "0.6659941", "0.66...
0.0
-1
output: [hash] METHOD TO ADD AN ITEM TO A LIST input: list, item name, and optional quantity
def add_item(list, add_item, add_quantity=1) # steps: # Add item as key and quantity as value to final_list hash(item and quantity will be user inputs) list[add_item] = add_quantity # Return updated hash list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend", "def add(list, item_name, quantity)\n\tlist[item_name] = quantity\n\tlist\nend", "def add_item(list, item_name, quantity = 1)\n\tlist[item...
[ "0.8829534", "0.8829534", "0.88240135", "0.87028354", "0.87025785", "0.87025785", "0.86511934", "0.86244744", "0.85747325", "0.85730284", "0.85553586", "0.85238117", "0.85012025", "0.84922564", "0.8489195", "0.84753567", "0.84693295", "0.84591496", "0.84468234", "0.8444895", ...
0.838218
29
output: updated hash METHOD TO REMOVE AN ITEM FROM THE LIST input: list and item name
def remove_item(list, rm_item) # steps: # use delete method with key (item) as argument list.delete(rm_item) # return list list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_item(list_name, item)\r\n# input: list, item name\r\n# steps: delete item name and value from hash\r\n list_name.delete(item)\r\n# output: updated hash with item removed\r\np list_name\r\nend", "def list_remove(hash_items, item_name)\n hash_items.delete(item_name)\n return hash_items\nend", "def ...
[ "0.8797937", "0.8641972", "0.85495484", "0.8446512", "0.83836013", "0.8378233", "0.8357819", "0.8357819", "0.8357819", "0.83380544", "0.8315129", "0.83071345", "0.8303172", "0.83007216", "0.82781786", "0.8249939", "0.8248783", "0.82440776", "0.8182585", "0.8151725", "0.812812...
0.7696101
86
output: updated hash METHOD TO UPDATE THE QUANTITY OF AN ITEM input: list, item name, new quantity
def update_quantity(list, upd_item, new_quantity) # steps: # reassign key (item) a new value (quantity) list[upd_item] = new_quantity # return list list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_quantity(list_name, item, value)\r\n# input: list, item name, new quantity\r\n# steps: find item in the hash and change quantity to new quantity\r\n list_name[item] = value\r\n# output: updated hash with new value for item key\r\n p list_name\r\nend", "def update_qty(list_hash, item, qty)\r\n \tlis...
[ "0.87030816", "0.85322976", "0.8530851", "0.85046077", "0.8499819", "0.8499819", "0.84602684", "0.8432709", "0.8424952", "0.83793443", "0.8347535", "0.8347497", "0.8328248", "0.8325422", "0.83117807", "0.8292133", "0.82835966", "0.82835966", "0.82717055", "0.8263529", "0.8253...
0.8143599
31
output: updated hash METHOD TO PRINT A LIST AND MAKE IT LOOK PRETTY input: title, list
def print_list(title,list) # steps: # print title of list (will ask user for this input) puts "**********************" puts " #{title.upcase}:" puts "**********************" # print headers of item and quantity puts " # ITEM" puts "----------------------" # print each item and it's quantity, bulleted if possible list.each {|item,quantity| puts " #{quantity} #{item}"} puts "**********************" # print today's date date = Time.new puts " Made on: #{date.month}/#{date.day}/#{date.year}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_to_print(title,list)\n line = \"\" \n 1.upto(title.size){line << \"-\"}\n title = title + \"\\n\" + line + \"\\n\"\n return title + (list.collect {|x| \" => #{x}\" }).join(\"\\n\")\n end", "def print_list(list_name)\r\n# input: hash name\r\n# steps: add dashes and spacing\r\np \"List:\"\r\n...
[ "0.77988094", "0.7737018", "0.75002086", "0.7404148", "0.73617095", "0.7340666", "0.7319176", "0.7298175", "0.72817343", "0.71640044", "0.7163696", "0.7107956", "0.710603", "0.71029", "0.7101576", "0.7101576", "0.7088003", "0.70704913", "0.704006", "0.70399714", "0.70278066",...
0.7729893
2
def name replaced with attr_reader or attr_accessor
def lost? # ruby style/convention says methods that return booleans should end w/ "?", so can't just use attr_reader/attr_writer/attr_accessor @lost end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_accessor(name)\n attr_reader(name)\n attr_writer(name)\n nil\n end", "def attr_reader(sym, *more) end", "def attr_reader(*)\n end", "def define_attr_reader(name)\n define_method(name) do\n instance_variable_get(\"@#{name}\")\n end\n end", "def attr(name); end...
[ "0.75800496", "0.75754565", "0.75579435", "0.7492696", "0.72385854", "0.7208101", "0.7197241", "0.71849245", "0.70393854", "0.7014108", "0.6943722", "0.69365406", "0.69219846", "0.69157404", "0.6898428", "0.68894714", "0.68676114", "0.68610567", "0.685036", "0.68164617", "0.6...
0.0
-1
Return urlsafe base64 HMAC for data, assumes hmac_secret is set.
def compute_hmac(data) s = [compute_raw_hmac(data)].pack('m').chomp!("=\n") s.tr!('+/', '-_') s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hmac_hash(secret, data)\n algo = 'SHA1'\n _digest = OpenSSL::Digest.new(algo)\n OpenSSL::HMAC.hexdigest(_digest, secret, data)\n end", "def hmac_signature(key, data)\n sha = HMAC::SHA1.new(key)\n sha.update(data)\n base64(sha.digest)\n end", "def signature_for(data, secret)\...
[ "0.71493673", "0.7005676", "0.670317", "0.66372913", "0.66372913", "0.66000056", "0.6567909", "0.6560621", "0.65314186", "0.6423527", "0.6398781", "0.62952703", "0.62781453", "0.6062815", "0.6042645", "0.5962813", "0.5905947", "0.58647203", "0.5829988", "0.5819255", "0.581065...
0.7223387
0
If the account_password_hash_column is set, the password hash is verified in ruby, it will not use a database function to do so, it will check the password hash using bcrypt.
def account_password_hash_column nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_password(password, hash)\n BCrypt::Password.new(hash) == password\n end", "def get_password_hash\n if account_password_hash_column\n account![account_password_hash_column]\n elsif use_database_authentication_functions?\n db.get(Sequel.function(function_name(:rodauth_get_salt...
[ "0.7374337", "0.7356962", "0.7332111", "0.708981", "0.7004459", "0.6978496", "0.69761056", "0.69653875", "0.68635774", "0.6860733", "0.6835812", "0.6835148", "0.6820272", "0.67767113", "0.67736965", "0.67410606", "0.6701725", "0.66954476", "0.66886747", "0.66748405", "0.66654...
0.7018097
4
Return a string for the parameter name. This will be an empty string if the parameter doesn't exist.
def param(key) param_or_nil(key).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_name\n @param_name.respond_to?(:call) ? @param_name.call : @param_name\n end", "def param_namer(param)\n \"$_#{param}\"\n end", "def parameter_string\n\t\tend", "def parameter_string\n \"\"\n end", "def param_name(key)\n first, *rest = keys(key)\n if firs...
[ "0.7811591", "0.7329533", "0.69914734", "0.6978847", "0.68234736", "0.68229944", "0.68144816", "0.67942953", "0.67942953", "0.67942953", "0.6788499", "0.6788499", "0.67531747", "0.6744404", "0.6744404", "0.6744404", "0.6744404", "0.6744404", "0.6744404", "0.6698332", "0.66686...
0.75049573
1
Return a string for the parameter name, or nil if there is no parameter with that name.
def param_or_nil(key) value = raw_param(key) unless value.nil? value = value.to_s value = over_max_bytesize_param_value(key, value) if max_param_bytesize && value.bytesize > max_param_bytesize value = null_byte_parameter_value(key, value) if value && value.include?("\0") end value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_name\n @param_name.respond_to?(:call) ? @param_name.call : @param_name\n end", "def param(key)\n param_or_nil(key).to_s\n end", "def parameter(name)\n parameters.find { |p| p.name == name.to_s }\n end", "def param_for_name(name)\n @params.fetch(name, n...
[ "0.7839522", "0.75286406", "0.7044579", "0.69348574", "0.68219143", "0.6806134", "0.6791785", "0.6788562", "0.6786684", "0.67695135", "0.67206293", "0.6650375", "0.66407067", "0.66407067", "0.6639024", "0.6635799", "0.663501", "0.663501", "0.663501", "0.6616055", "0.65998703"...
0.6221218
68
Return nil by default for values over maximum bytesize.
def over_max_bytesize_param_value(key, value) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_allowed_bytesize(v, max)\n end", "def default_max_size; end", "def max_size\n 1\n end", "def default_max_in_memory_size\n @default_max_in_memory_size || DEFAULT_MAX_IN_MEMORY_SIZE\n end", "def max_size; end", "def max_size=(_arg0); end", "def specific_max_size(number); ...
[ "0.7048917", "0.69685555", "0.6604613", "0.65568906", "0.65325785", "0.64720196", "0.6436458", "0.6316911", "0.63024276", "0.6302215", "0.62844723", "0.6233355", "0.6225882", "0.62036234", "0.6199145", "0.6152728", "0.6145607", "0.61380404", "0.6134343", "0.60376334", "0.6033...
0.74810094
0
Return nil by default for values with null bytes
def null_byte_parameter_value(key, value) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_null_byte(v)\n end", "def null \n return @raw.null \n end", "def process_nillable_values(args:)\n args[:byte_size] = nil if args[:byte_size].blank?\n args\n end", "def process_nillable_values(args:)\n args[:byte_size] = nil unless args[:byte_size].present?\n args\n ...
[ "0.7342216", "0.68070954", "0.66826034", "0.656124", "0.64034367", "0.6388334", "0.6386083", "0.63598377", "0.6342451", "0.6321569", "0.6313501", "0.6313254", "0.6161936", "0.6160538", "0.61589456", "0.61338544", "0.61203986", "0.6091144", "0.6043458", "0.6041877", "0.6041877...
0.73827493
0
Don't set an error status when redirecting in an error case, as a redirect status is needed.
def set_redirect_error_status(status) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect(location, status = '302'); request.redirect(location, status); end", "def redirect?\n # redirects are 3xx\n return @status >= 300 && @status < 400\n end", "def redirect_ok; end", "def redirect_ok; end", "def redirect?; end", "def redirect?\n 300 <= code && code < 400\n end...
[ "0.72776395", "0.7213422", "0.7120492", "0.7120492", "0.70450735", "0.6884401", "0.6833134", "0.6813714", "0.6789967", "0.67788184", "0.6737465", "0.6719334", "0.67080665", "0.67079306", "0.67056316", "0.67028445", "0.669154", "0.6683165", "0.6648155", "0.6641535", "0.6635181...
0.8550512
0
Get the password hash for the user. When using database authentication functions, note that only the salt is returned.
def get_password_hash if account_password_hash_column account![account_password_hash_column] elsif use_database_authentication_functions? db.get(Sequel.function(function_name(:rodauth_get_salt), account ? account_id : session_value)) else # :nocov: password_hash_ds.get(password_hash_column) # :nocov: end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_user_password\n self.password = sha1_digest(self.user_password, self.salt)\n self.user_password = nil\n end", "def hash_password\n if password.present?\n self.salt = BCrypt::Engine.generate_salt\n self.hashed_password = BCrypt::Engine.hash_secret(password, self.salt)\n end\n end"...
[ "0.73407525", "0.7305118", "0.7273412", "0.72535986", "0.701587", "0.6994785", "0.68946946", "0.68771034", "0.6866493", "0.68236434", "0.68070513", "0.67818266", "0.67270565", "0.67245585", "0.66816676", "0.66433036", "0.6640192", "0.6633492", "0.6633174", "0.66188866", "0.66...
0.80357903
0
This is needed for jdbc/sqlite, which returns timestamp columns as strings
def convert_timestamp(timestamp) timestamp = db.to_application_timestamp(timestamp) if timestamp.is_a?(String) timestamp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_sql\n \"timestamp '#{to_s}'\"\n end", "def timestamp(row)\n row[0].to_f\nend", "def to_sql\n self.strftime(\"%Y-%m-%d %H:%M:%S\")\n \tend", "def type_literal_generic_datetime(column)\n :timestamp\n end", "def timestamp\n self.created_at.to_s(:db)\n end", "def to_sql\n ...
[ "0.7502201", "0.72052735", "0.69924843", "0.69723177", "0.6725154", "0.6671377", "0.64212924", "0.63930243", "0.6342454", "0.63148004", "0.62781566", "0.62503713", "0.6234043", "0.62166214", "0.6190682", "0.61698246", "0.6159796", "0.6158178", "0.61475915", "0.6126058", "0.61...
0.6015667
33
This is used to avoid race conditions when using the pattern of inserting when an update affects no rows. In such cases, if a row is inserted between the update and the insert, the insert will fail with a uniqueness error, but retrying will work. It is possible for it to fail again, but only if the row is deleted before the update and readded before the insert, which is very unlikely to happen. In such cases, raising an exception is acceptable.
def retry_on_uniqueness_violation(&block) if raises_uniqueness_violation?(&block) yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sneaky_save(avoid_insert_conflict: nil)\n begin\n sneaky_create_or_update(avoid_insert_conflict: avoid_insert_conflict)\n rescue ActiveRecord::StatementInvalid\n false\n end\n end", "def raises_uniqueness_violation?(&block)\n transaction(:savepoint=>:only, &block)\n false\n r...
[ "0.67513746", "0.65868825", "0.6517185", "0.63281465", "0.62889713", "0.6247235", "0.61678493", "0.61678493", "0.6159286", "0.6152866", "0.59580976", "0.5857649", "0.5827829", "0.57634676", "0.57280236", "0.5725281", "0.572263", "0.56740296", "0.5632502", "0.56265414", "0.562...
0.620919
6
In cases where retrying on uniqueness violations cannot work, this will detect whether a uniqueness violation is raised by the block and return the exception if so. This method should be used if you don't care about the exception itself.
def raises_uniqueness_violation?(&block) transaction(:savepoint=>:only, &block) false rescue unique_constraint_violation_class => e e end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retry_on_uniqueness_violation(&block)\n if raises_uniqueness_violation?(&block)\n yield\n end\n end", "def retry_transaction(&block)\n tries = 3\n begin\n yield\n rescue ActiveRecord::RecordInvalid, ActiveRecord::RecordNotUnique\n tries -= 1\n if tries > 0\n ...
[ "0.8227882", "0.62486017", "0.5877959", "0.5869566", "0.5543474", "0.5516552", "0.5399367", "0.5380863", "0.5317911", "0.5317804", "0.5317804", "0.53080606", "0.53064775", "0.53021216", "0.5301212", "0.52759105", "0.5213642", "0.51614475", "0.51512957", "0.50801015", "0.50596...
0.7240546
1
Work around jdbc/sqlite issue where it only raises ConstraintViolation and not UniqueConstraintViolation.
def unique_constraint_violation_class if db.adapter_scheme == :jdbc && db.database_type == :sqlite # :nocov: Sequel::ConstraintViolation # :nocov: else Sequel::UniqueConstraintViolation end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_detecting_duplicate_entry_constraint_violation\n begin\n save\n rescue ActiveRecord::StatementInvalid => e\n # Would that rails gave us the nested exception to check...\n if e.message =~ /.*[Dd]uplicate/\n errors.add_to_base(translate_with_theme('duplicate_entry_please_try_agai...
[ "0.71445197", "0.66329813", "0.6396467", "0.628304", "0.622174", "0.6119858", "0.6055775", "0.60428435", "0.60182035", "0.60038817", "0.592732", "0.5918079", "0.58941764", "0.5809525", "0.57830614", "0.57510746", "0.57140636", "0.56878424", "0.56799215", "0.56777626", "0.5648...
0.70253205
1
This is needed on MySQL, which doesn't support non constant defaults other than CURRENT_TIMESTAMP.
def set_deadline_value(hash, column, interval) if set_deadline_values? # :nocov: hash[column] = Sequel.date_add(Sequel::CURRENT_TIMESTAMP, interval) # :nocov: end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_values\n self.date ||= DateTime.now\n end", "def default_timestamp_format\n \"TIMESTAMP '%Y-%m-%d %H:%M:%S%N %z'\".freeze\n end", "def generate_default_values\n self.created_at = DateTime.now unless self.created_at\n end", "def timestamps\n opts = @table.schem...
[ "0.6554644", "0.65061677", "0.6424828", "0.6330221", "0.62712324", "0.6250039", "0.6170995", "0.60692316", "0.60148466", "0.60006034", "0.5992138", "0.5974885", "0.5951453", "0.58762014", "0.5859642", "0.5848238", "0.5836488", "0.5833915", "0.58169585", "0.57981086", "0.57744...
0.0
-1
Set the template path only if there isn't an overridden template in the application. Result should replace existing template opts.
def _template_opts(opts, page) opts = scope.send(:find_template, scope.send(:parse_template_opts, page, opts)) unless File.file?(scope.send(:template_path, opts)) opts[:path] = template_path(page) end opts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_path\n @default_options.fetch(:template_path, nil)\n end", "def template_path(template, opts)\n t = template.to_s\n if (v = @_view_subdir) && t !~ /\\//\n template = \"#{v}/#{t}\"\n end\n super\n end", "def assign_template\n @templ...
[ "0.73226917", "0.724883", "0.6801521", "0.67943865", "0.67519003", "0.6743041", "0.6658982", "0.6565212", "0.6557703", "0.6551305", "0.6433538", "0.63292116", "0.63167316", "0.6244802", "0.62268543", "0.61312705", "0.61067533", "0.6104239", "0.60850424", "0.6061657", "0.60356...
0.6580649
7
optional filters for defining usage according to Casein::AdminUser access_levels before_filter :needs_admin, :except => [:action1, :action2] before_filter :needs_admin_or_current_user, :only => [:action1, :action2]
def index @casein_page_title = 'Categorias' @categories = Category.order(sort_order(:nombre)).paginate :page => params[:page] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_admin\n redirect_to :login unless current_user.permission.manage_app ||\n current_user.permission.manage_attrs ||\n current_user.permission.manage_achievement_categories ||\n current_user.permission.manage_talent_trees ||\n current_user.permission.manage_talents ||\n curre...
[ "0.7267958", "0.6981016", "0.69264644", "0.6716236", "0.6716236", "0.6716236", "0.67104375", "0.66513115", "0.6617181", "0.65406954", "0.6537394", "0.651807", "0.6457908", "0.64508194", "0.64484423", "0.64442724", "0.6438858", "0.64349455", "0.6384369", "0.63587534", "0.63312...
0.0
-1
write your code here
def greet (name) "Hello, #{name}!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def custom; end", "def custom; end", "def run\n end", "def method\n\t\t# code code\n\tend", "def run; end", "def run; end", "def run; end", "def run; end", "def run; ...
[ "0.7043092", "0.7043092", "0.7043092", "0.7043092", "0.7043092", "0.7043092", "0.7043092", "0.6382698", "0.6382698", "0.6352213", "0.6334336", "0.63308704", "0.63308704", "0.63308704", "0.63308704", "0.63308704", "0.63308704", "0.63308704", "0.63308704", "0.63308704", "0.6319...
0.0
-1
TODO: select with name[]
def select_multi(field_name, choices, options = {}) power_options = power_options!(field_name, options) # generic_field(:select, super(field_name, choices, options), field_name, power_options) generic_field(:select, 'SELECT MULTI', field_name, power_options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(*names)\n result = []\n names.each { |name|\n name = Field.name_canonicalize(name)\n result.concat(find_all { |n, v|\n n.downcase == name\n })\n }\n result\n end", "def fields_by_name(name)\n @fields.select{|f|f.name==...
[ "0.68360335", "0.6645509", "0.6546593", "0.62704164", "0.6232201", "0.61981314", "0.61889815", "0.61889815", "0.618224", "0.61465955", "0.61464155", "0.6135498", "0.60959154", "0.60161924", "0.60161924", "0.6005286", "0.60037434", "0.59386057", "0.5924485", "0.5924485", "0.59...
0.0
-1
First line starts from middle of all the columns. In next line, expand left side and right side with '' in index range(middle_idx line_index, middle_idx + line_index) params: xi line_index of 0 based. return: an array of column index numbers corresponding to the current line index which can make the tree shape.
def algorithm(xi) yi_min = self.height - 1 - xi yi_max = self.height - 1 + xi y_array = (yi_min..yi_max).to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tree_at(line, column); end", "def left_child(indx)\n 2*indx + 1\n end", "def horizontal_grid_line(index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.GraphComponentState_horizontal_grid_line(@handle.ptr, index)\n ...
[ "0.6695516", "0.5569071", "0.54340374", "0.54031396", "0.54011583", "0.5348261", "0.53228736", "0.52889764", "0.5281722", "0.5252969", "0.51921785", "0.51887536", "0.5144769", "0.5127972", "0.50927836", "0.5063194", "0.5059906", "0.5057241", "0.5037174", "0.50164026", "0.5008...
0.0
-1
POST /frontapp_support_sources POST /frontapp_support_sources.json
def create @support_source = FrontappSupportSource.new(frontapp_support_source_params) respond_to do |format| if @support_source.save format.html { redirect_to support_sources_path, notice: 'Support source was successfully created.' } format.json { render :show, status: :created, location: @support_source } else format.html { render :new } format.json { render json: @support_source.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def frontapp_support_source_params\n params.require(:frontapp_support_source).\n permit(:name, :frontapp_auth_token,\n :frontapp_user_id, :frontapp_inbox_ids_as_string).\n merge(user: current_user)\n end", "def set_frontapp_support_source\n @support_source = current_user.frontapp_support_...
[ "0.6840675", "0.6512786", "0.6216179", "0.6091219", "0.57109064", "0.55643976", "0.5503779", "0.5502661", "0.5502556", "0.5485731", "0.5462232", "0.5425297", "0.534418", "0.5332665", "0.53206515", "0.5293588", "0.52738035", "0.52652967", "0.5262682", "0.52316916", "0.52239853...
0.7467037
0
PATCH/PUT /frontapp_support_sources/1 PATCH/PUT /frontapp_support_sources/1.json
def update respond_to do |format| if @support_source.update(frontapp_support_source_params) format.html { redirect_to @support_source, notice: 'Support source was successfully updated.' } format.json { render :show, status: :ok, location: @support_source } else format.html { render :edit } format.json { render json: @support_source.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n sources = Fenix::Store::Converter::Flattener.sources params[:sources]\n respond_to do |format|\n if @host.set_sources sources\n format.html { redirect_to source, notice: 'SourceList was successfully updated.' }\n format.json { render :show, status: :ok, location: source }\n ...
[ "0.6636469", "0.64439833", "0.6161364", "0.6118049", "0.60415477", "0.6025269", "0.59855866", "0.5952451", "0.5941746", "0.5926055", "0.59219974", "0.5919296", "0.5867781", "0.5836152", "0.5822313", "0.58192176", "0.5817657", "0.58020675", "0.57862246", "0.5770091", "0.576766...
0.73294055
0
DELETE /frontapp_support_sources/1 DELETE /frontapp_support_sources/1.json
def destroy @support_source.destroy respond_to do |format| format.html { redirect_to support_sources_url, notice: 'Support source was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n authorize_user!\n respond_to do |format|\n format.html { redirect_to sources_path(@source) }\n format.json { head :no_content }\n @source.destroy\n end\n end", "def destroy\n @cla_source.destroy\n respond_to do |format|\n format.html { redirect_to cla_sources_url...
[ "0.69014657", "0.68325377", "0.677435", "0.67720145", "0.67617685", "0.67617685", "0.67615503", "0.67182916", "0.66766065", "0.6612491", "0.65844524", "0.6569961", "0.65570587", "0.65509456", "0.65509456", "0.6533156", "0.6501823", "0.6498255", "0.64895874", "0.6483071", "0.6...
0.7042307
0
Use callbacks to share common setup or constraints between actions.
def set_frontapp_support_source @support_source = current_user.frontapp_support_sources.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 frontapp_support_source_params params.require(:frontapp_support_source). permit(:name, :frontapp_auth_token, :frontapp_user_id, :frontapp_inbox_ids_as_string). merge(user: current_user) 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
Relies on ActiveRecord ==
def test_sort [ FactoryGirl.build(:category, :id => 2), FactoryGirl.build(:category, :id => 1), FactoryGirl.build(:category)].sort end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==\n end", "def ==(other); false; end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", "def ==(other); end", ...
[ "0.774361", "0.77093244", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", "0.76522046", ...
0.0
-1
orders scores ind descending value, on score board
def create score = current_user.scores.new(score_params) if score.save render json: score else render json: { errors: score.errors.join(',') }, status: 422 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_using_rank\n score[1]\n end", "def sort_scores(unsorted_scores, highest_possible_score)\n arr = []\n unsorted_scores.each do |score|\n if arr[score]\n arr[score] += 1\n else\n arr[score] = 1\n end\n end\n \n output = []\n arr.each_with_index do |num, idx|\n if num\n n...
[ "0.7259435", "0.7149945", "0.68166596", "0.67952", "0.67807746", "0.67765516", "0.66983306", "0.665392", "0.6619831", "0.65771294", "0.64678746", "0.6443204", "0.64085907", "0.6282923", "0.6217106", "0.62136954", "0.6187679", "0.61784613", "0.6174508", "0.6138206", "0.6080813...
0.0
-1
end ........................................ Ruby will check the below condition, if the left side evaluates to false, it will check the right
def authenticate_agent(rank, name, credentials) if (rank == "007" && name == "James Bond") || credentials == "Secret Agent" puts "Access granted #{rank}, please proceed to the Intelligence Department" else puts "Access Denied" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check ; true ; end", "def conditionally_false\n\t\t!self\n\tend", "def truth\n\t\t\t\"You can't handle the truth\" ; true\n\t\tend", "def right?; end", "def semact?; false; end", "def left?; end", "def cond; end", "def cond; end", "def cond; end", "def condition; end", "def right_optimizabl...
[ "0.6936507", "0.68575704", "0.68527347", "0.6849671", "0.6782816", "0.6582656", "0.65415657", "0.65415657", "0.65415657", "0.65409833", "0.6487943", "0.6474126", "0.64156556", "0.64135027", "0.6411398", "0.64056283", "0.63826495", "0.636736", "0.6367347", "0.6332303", "0.6315...
0.0
-1
puts "no" == "yes" ? "The two are equal!" : "No, it's not!"
def even_or_odd(num) num.even? ? "That is an even number" : "That number is not even" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def yesno(s)\n puts s ? 'yes' : 'no'\n end", "def police_trouble(a,b)\n if (a == b)\n puts \"True\"\n else\n puts \"False\"\n end \nend", "def yes_or_no(value = false)\n value ? \"Yes\" : \"No\"\n end", "def yes_no(bool)\n case bool\n when 1\n \"yes\"\n when 0\n \"no\"\n ...
[ "0.7822539", "0.6488336", "0.6362433", "0.63503087", "0.6285073", "0.6281771", "0.62084436", "0.6184067", "0.61600274", "0.61078095", "0.6103081", "0.6081749", "0.60766774", "0.60741687", "0.60286015", "0.6021307", "0.6020903", "0.59779936", "0.5944606", "0.5943364", "0.59258...
0.5524312
88
end .............Default or Optional Parameters..............
def make_phone_call(number, international_code = 1, area_code = 646) puts "Calling #{international_code}-#{area_code}-#{number}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def param; end", "def param; end", "def params; end", "def params; end", "def params; end", "def params; ...
[ "0.77413565", "0.77413565", "0.77413565", "0.77413565", "0.77413565", "0.77413565", "0.77413565", "0.77413565", "0.75997204", "0.75997204", "0.73067325", "0.73067325", "0.73067325", "0.73067325", "0.73067325", "0.73067325", "0.73067325", "0.73067325", "0.73067325", "0.73067325"...
0.0
-1
.....................Call a Method from another Method..........
def add(a, b) a + b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call() end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def call; end", "def calls; end", "def calls; end", "def call\n\n\tend", "def call\n\n\tend", "def invoke; end", "def method\n\t\t# code code\n\tend",...
[ "0.74964064", "0.7403404", "0.7403404", "0.7403404", "0.7403404", "0.7403404", "0.7403404", "0.7403404", "0.7403404", "0.7371763", "0.7371763", "0.7340971", "0.7340971", "0.71927637", "0.71816385", "0.71280164", "0.70827204", "0.7043805", "0.70285016", "0.70285016", "0.702343...
0.0
-1
replicate the given item ID on an additional node
def replicate_once(item_id) current_nodes = find_nodes(item_id) possible_nodes = @master.data_nodes.values.select {|n| not current_nodes.include?(n)} target_node = possible_nodes[(rand * possible_nodes.size).floor] begin current_nodes[0].replicate_data(item_id, target_node) end #TODO if the above line failed, re-start this method. add_replica(item_id, target_node) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replicate_node(node_id)\n data_to_replicate = get_data_list(node_id)\n data_to_replicate.each do |data_id|\n replicate(data_id)\n end\n end", "def add_replica(item_id, target_node, recovery_mode = false)\n# @logger.log_add_replica(item_id, Marshal.dump(target_node)) unless recov...
[ "0.780044", "0.653256", "0.60542476", "0.6004983", "0.59656054", "0.59132254", "0.5910546", "0.5844275", "0.58354086", "0.5812551", "0.5811051", "0.58055866", "0.57606685", "0.57511157", "0.5748595", "0.57362896", "0.5730767", "0.57136625", "0.56880325", "0.56879205", "0.5683...
0.7394588
1
find all nodes this item ID is currently stored on
def find_nodes(item_id) return @data_to_nodes[item_id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes\n nodes_by_id.values\n end", "def get_all_items\n items(@nodename)\n end", "def all\n Directory.all.map do |node_id|\n find node_id\n end\n end", "def nodes\n\t\t# Query the database\n\t\tnodeQuery = Node.select(:node_id)\n\t\t# Place the query in an array\n\t\tn...
[ "0.73976517", "0.6829159", "0.6678692", "0.65628386", "0.64820445", "0.64217794", "0.6364471", "0.636337", "0.63535976", "0.63535976", "0.6306287", "0.6255241", "0.6129386", "0.6109872", "0.60937876", "0.60849595", "0.60497683", "0.60355353", "0.60184646", "0.5997937", "0.596...
0.78986424
0
choose the next node to replicate on
def next_replica return @master.data_nodes[@master.data_nodes.keys[(rand * @master.data_nodes.size).floor]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def node_at(index)\n node = head\n index.times { node = node.next_node }\n node\n end", "def get_next_node(node)\n i = node.number + 1\n i = 0 if i >= nodes.size\n get_node(i)\n end", "def go_to_next(rng)\n choice = rng.rand(0...@neighbors.size)\n @neighbors[choice]\n ...
[ "0.6514668", "0.6421571", "0.6368228", "0.6344465", "0.6340192", "0.6325491", "0.6226159", "0.62227464", "0.6169168", "0.611879", "0.60579425", "0.6012685", "0.5968307", "0.5967144", "0.5964623", "0.5961795", "0.5956632", "0.5930374", "0.590164", "0.5901462", "0.5897588", "...
0.624754
6
replicate all data on a node
def replicate_node(node_id) data_to_replicate = get_data_list(node_id) data_to_replicate.each do |data_id| replicate(data_id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def replicate_once(item_id)\n current_nodes = find_nodes(item_id)\n possible_nodes = @master.data_nodes.values.select {|n| not current_nodes.include?(n)}\n target_node = possible_nodes[(rand * possible_nodes.size).floor]\n \n begin\n current_nodes[0].replicate_data(item_id, target_n...
[ "0.699328", "0.6991535", "0.6089273", "0.60508937", "0.6039473", "0.5968721", "0.5853404", "0.58148897", "0.5768634", "0.57670987", "0.5750188", "0.57152104", "0.5705888", "0.5638921", "0.56120044", "0.5598138", "0.55959207", "0.55907553", "0.55842155", "0.5553286", "0.550234...
0.8124062
0
get the list of data elements stored on this node
def get_data_list(node_id) if @nodes_to_data[node_id].nil? return [] else return @nodes_to_data[node_id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_node_data()\n return @node_data\n end", "def list_data\n _check_and_get(@_data, Array)\n end", "def all_data\n @data\n end", "def to_a\n collect { |node| node.data }\n end", "def all\n return @data\n end", "def all\n return @data\n end", "...
[ "0.69746375", "0.6967763", "0.6935135", "0.6915528", "0.6805751", "0.6805751", "0.6731588", "0.66621655", "0.66082394", "0.6561876", "0.6561876", "0.6561876", "0.65204203", "0.64814293", "0.64812005", "0.6471252", "0.6431633", "0.64258343", "0.64151", "0.63963366", "0.6391301...
0.6840105
4
mark this item as stored at this node
def add_replica(item_id, target_node, recovery_mode = false) # @logger.log_add_replica(item_id, Marshal.dump(target_node)) unless recovery_mode if @nodes_to_data[target_node].nil? @nodes_to_data[target_node] = [item_id] else @nodes_to_data[target_node] = @nodes_to_data[target_node] << item_id end if @data_to_nodes[item_id].nil? @data_to_nodes[item_id] = [target_node] else @data_to_nodes[item_id] = @data_to_nodes[item_id] << target_node end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set(item, node)\n\t\t\t@hash[item] = node\n\t\tend", "def mark\n @temp = @push\n @mark = @index\n end", "def node=(node)\n items_node[:node] = node\n end", "def set_item(item)\n return if @item == item\n @item = item\n refresh\n end", "def set_item(item)\n ...
[ "0.6731198", "0.62898755", "0.6254815", "0.624817", "0.624817", "0.6192102", "0.6042183", "0.6020909", "0.5948556", "0.5917509", "0.5853266", "0.5846719", "0.58341926", "0.58221734", "0.57944095", "0.57898515", "0.5775122", "0.5738727", "0.5723727", "0.5718844", "0.5709879", ...
0.0
-1
remove the metadata info about this item, it's no longer needed.
def clear_replicas(item_id, recovery_mode = false) # @logger.log_clear_replicas(item_id) unless recovery_mode nodes = find_nodes(item_id) nodes.each do |node| @nodes_to_data[node].delete(item_id) end @data_to_nodes.delete(item_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove!\n MiGA.DEBUG \"Metadata.remove! #{path}\"\n File.unlink(path)\n nil\n end", "def remove!\n self.results.each{ |r| r.remove! }\n self.metadata.remove!\n end", "def remove_item(item)\r\n items.delete(item)\r\n item.owner = nil\r\n end", "def del_meta(name)\n _manage...
[ "0.68260854", "0.6648593", "0.6592068", "0.65913236", "0.6546396", "0.6363503", "0.6240255", "0.621463", "0.6200061", "0.6136708", "0.61334115", "0.611737", "0.61117536", "0.6071198", "0.60455155", "0.6036215", "0.60284984", "0.60149527", "0.6010991", "0.6005475", "0.59993416...
0.0
-1
Replace this with your real tests.
def test_truth assert_kind_of Picture, pictures(:first) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end"...
[ "0.7446459", "0.6956364", "0.69155836", "0.69155836", "0.6864151", "0.6864151", "0.66406286", "0.66406286", "0.66253287", "0.6547665", "0.6524571", "0.6484549", "0.6484549", "0.6484549", "0.6403847", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188", "0.6389188"...
0.0
-1
GET /po_receipts GET /po_receipts.json
def home #sleep(60) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receipts_plist\n plist_virtual_attribute_get(:receipts)\n end", "def index\n @receipts = current_account.receipts.all\n end", "def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end", "def index\n @receipts = current_user.receipts\n end", "def index\n @re...
[ "0.6986946", "0.6897085", "0.6842668", "0.67751515", "0.6733184", "0.6731087", "0.6696973", "0.6615695", "0.6485501", "0.6407677", "0.63738376", "0.63600856", "0.63300115", "0.63208663", "0.6277574", "0.6255837", "0.62501556", "0.62271374", "0.62058103", "0.6194002", "0.61882...
0.0
-1
GET /po_receipts/1 GET /po_receipts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end", "def receipts_plist\n plist_virtual_attribute_get(:receipts)\n end", "def index\n @receipts = current_account.receipts.all\n end", "def index\n @receipts = Receipt.status_based_receipts(params[:receipt_status...
[ "0.6875864", "0.68286467", "0.65048707", "0.6447613", "0.64221716", "0.6376781", "0.6372004", "0.63661253", "0.6353669", "0.634854", "0.62733674", "0.6228477", "0.6201489", "0.6172263", "0.61586636", "0.61450446", "0.61346877", "0.61068964", "0.60977864", "0.60884005", "0.605...
0.0
-1
POST /po_receipts POST /po_receipts.json
def create @po_receipt = PoReceipt.new(po_receipt_params) respond_to do |format| if @po_receipt.save format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully created.' } format.json { render :show, status: :created, location: @po_receipt } else format.html { render :new } format.json { render json: @po_receipt.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_receipt(atom)\n form_data = { application: @application_name }\n @hive_party.post \"/atoms/#{atom.id}/receipts\", form_data\n end", "def sms_receipts_post(url, opts = {})\n data, _status_code, _headers = sms_receipts_post_with_http_info(url, opts)\n data\n end", "def create\n...
[ "0.721813", "0.67675304", "0.6680944", "0.6589276", "0.65421957", "0.65368307", "0.6452098", "0.6452098", "0.6449987", "0.63635993", "0.6341161", "0.6330778", "0.6267977", "0.62663114", "0.6241786", "0.6206461", "0.61965257", "0.61912036", "0.61812663", "0.61712927", "0.61522...
0.7144056
1
PATCH/PUT /po_receipts/1 PATCH/PUT /po_receipts/1.json
def update respond_to do |format| if @po_receipt.update(po_receipt_params) format.html { redirect_to @po_receipt, notice: 'Po receipt was successfully updated.' } format.json { render :show, status: :ok, location: @po_receipt } else format.html { render :edit } format.json { render json: @po_receipt.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @receipt = current_user.receipts.find(params[:id])\n respond_to do |format|\n if @receipt.update(receipt_params)\n format.html { redirect_to @receipt, notice: 'Receipt was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render act...
[ "0.663678", "0.6530603", "0.6501283", "0.6446072", "0.6438361", "0.6438137", "0.6438137", "0.64157146", "0.634435", "0.6319594", "0.6273267", "0.62509465", "0.620919", "0.61912376", "0.6097274", "0.6086628", "0.6084257", "0.60782176", "0.6029632", "0.6028742", "0.59962356", ...
0.7156478
0
DELETE /po_receipts/1 DELETE /po_receipts/1.json
def destroy lifnr = @po_receipt.lifnr lifdn = @po_receipt.lifdn werks = @po_receipt.werks @po_receipt.destroy respond_to do |format| format.html { redirect_to po_receipts_url(lifnr: lifnr, lifdn: lifdn, werks: werks) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @receipt = Receipt.find(params[:id])\n @receipt.destroy\n\n respond_to do |format|\n format.html { redirect_to receipts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @receipt.destroy\n respond_to do |format|\n format.html { redirect_to recei...
[ "0.7249442", "0.7205277", "0.71285504", "0.7062397", "0.70389324", "0.702607", "0.69623387", "0.6948784", "0.6899735", "0.68326765", "0.68326765", "0.68326765", "0.67873055", "0.67733824", "0.6762464", "0.6696877", "0.66483766", "0.66245335", "0.66068006", "0.66017556", "0.65...
0.7292007
0
Use callbacks to share common setup or constraints between actions.
def set_po_receipt @po_receipt = PoReceipt.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 po_receipt_params params.require(:po_receipt).permit(:uuid, :barcode, :vtweg, :lifnr, :lifdn, :matnr, :werks, :pkg_no, :date_code, :mfg_date, :menge, :alloc_qty, :balqty, :status, :vtype, :impnr, :charg, :remote_ip, :creator, :updater) 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
GET /spiders GET /spiders.json
def index @spiders = Spider.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end", "def index\n\t\t@pipelines = Pipeline.all(include: :stages)\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @pipelines }\n\t\tend\n\tend", "def index\n ...
[ "0.7527467", "0.578524", "0.5602479", "0.5582062", "0.55442256", "0.554001", "0.554001", "0.5492717", "0.54835296", "0.5453081", "0.54461664", "0.5442363", "0.54386324", "0.538377", "0.5317914", "0.53159386", "0.5291303", "0.5291303", "0.5289522", "0.528471", "0.5277389", "...
0.7576435
0
GET /spiders/1 GET /spiders/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @spiders = Spider.all\n end", "def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end", "def show\n @rider = Rider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rider }\n ...
[ "0.7207449", "0.70266545", "0.56690043", "0.56690043", "0.56281745", "0.5612165", "0.55994374", "0.5563946", "0.5540704", "0.54717034", "0.5458986", "0.54572767", "0.54251295", "0.5420087", "0.54197514", "0.54171497", "0.5381326", "0.5380862", "0.53777814", "0.5371228", "0.53...
0.0
-1
POST /spiders POST /spiders.json
def create @spider = Spider.new(spider_params) respond_to do |format| if @spider.save format.html { redirect_to @spider, notice: 'Spider was successfully created.' } format.json { render :show, status: :created, location: @spider } else format.html { render :new } format.json { render json: @spider.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @spiders = Spider.all\n end", "def listspiders(project=self.project)\n get('listspiders.json', project: project)['spiders']\n end", "def spider_params\n params.require(:spider).permit(:name, :container_id, :status, :image_id, :prefix, :frequency, :run_info, :max_memory)\n end", "d...
[ "0.65026385", "0.6009115", "0.57850796", "0.55037534", "0.54188097", "0.5372787", "0.53106445", "0.53051174", "0.52793837", "0.5213296", "0.5197774", "0.51752377", "0.5118427", "0.5107348", "0.510598", "0.51013225", "0.50770897", "0.50742877", "0.5062011", "0.49972507", "0.49...
0.6690364
0
PATCH/PUT /spiders/1 PATCH/PUT /spiders/1.json
def update respond_to do |format| if @spider.update(spider_params) format.html { redirect_to @spider, notice: 'Spider was successfully updated.' } format.json { render :show, status: :ok, location: @spider } else format.html { render :edit } format.json { render json: @spider.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "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(url, data)\n Rest...
[ "0.60661185", "0.5957777", "0.5957616", "0.5947359", "0.5903018", "0.59004456", "0.5881387", "0.5865824", "0.58632433", "0.5799487", "0.5793312", "0.5738856", "0.57338053", "0.5730968", "0.56914645", "0.56741804", "0.5652866", "0.56454325", "0.56349313", "0.55989033", "0.5591...
0.5858193
9
DELETE /spiders/1 DELETE /spiders/1.json
def destroy @spider.destroy respond_to do |format| format.html { redirect_to spiders_url, notice: 'Spider was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @go_slim = GoSlim.find(params[:id])\n @go_slim.destroy\n\n respond_to do |format|\n format.html { redirect_to go_slims_url }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def delete(path)\n RestClient.delete r...
[ "0.6548", "0.64675266", "0.6307504", "0.62991554", "0.6270885", "0.62647176", "0.6261972", "0.62554896", "0.62056506", "0.6178789", "0.61371577", "0.6125963", "0.6096617", "0.6096617", "0.60804516", "0.60776794", "0.60740256", "0.60643065", "0.6057096", "0.6054811", "0.604914...
0.6931202
0
Use callbacks to share common setup or constraints between actions.
def set_spider @spider = Spider.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def spider_params params.require(:spider).permit(:name, :container_id, :status, :image_id, :prefix, :frequency, :run_info, :max_memory) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
takes num returns many num
def fibs(num) arry = [0, 1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, 144] arry[num] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magic_numbers(count)\nend", "def numbers(n)\n\nend", "def many_results(n)\r\n\treturn 1, n /2, n\r\nend", "def multiples(num)\n\tresult = []\n\tsum = 0\n\ti = 1\n\twhile i < num\n\t\tif i % 3 == 0 || i % 5 == 0\n\t\t\tresult << i\n\t\tend\n\t\ti += 1\n\tend\n\tresult.each do |digit|\n\t\tsum += digit\n\t...
[ "0.72358567", "0.7193444", "0.69431883", "0.6741622", "0.6658723", "0.6616837", "0.6594157", "0.6535502", "0.6506408", "0.64606684", "0.6448966", "0.6433005", "0.63878816", "0.636836", "0.6358029", "0.6356467", "0.6346895", "0.634617", "0.6345477", "0.6328723", "0.6321861", ...
0.0
-1
GET /publications GET /publications.json
def index @publications = Publication.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if @author_id\n @publications = @author.publications\n else\n @publications = Publication.all\n end\n render json: @publications\n end", "def publications\n @publications = Publication.all\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { ...
[ "0.793708", "0.7693545", "0.73052156", "0.71499056", "0.710067", "0.70662844", "0.70455796", "0.6991772", "0.6912951", "0.68665963", "0.68345994", "0.6816118", "0.6789779", "0.6753457", "0.66966105", "0.6667548", "0.66633326", "0.66335666", "0.6605103", "0.6571169", "0.654839...
0.7443663
5
POST /publications POST /publications.json
def create @publication = Publication.new(publication_params) respond_to do |format| if @publication.save format.html { redirect_to publications_url, notice: 'Publication was successfully created.' } format.json { render :show, status: :created, location: @publication } else format.html { render :new } format.json { render json: @publication.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @publication = Publication.new(publication_params)\n\n if @publication.save\n render json: @publication, status: :created\n else\n reponse = { status: \"error\", code: 422,\n message: \"couldn't create the publication\",\n errors: @publication.error...
[ "0.7351526", "0.7222527", "0.7222527", "0.7187896", "0.7085576", "0.70243484", "0.6952572", "0.6914492", "0.6897696", "0.68479717", "0.6800644", "0.6797221", "0.6747078", "0.6727789", "0.67252874", "0.6698838", "0.6681279", "0.66702557", "0.66583014", "0.6594258", "0.6580721"...
0.7260106
1
PATCH/PUT /publications/1 PATCH/PUT /publications/1.json
def update respond_to do |format| if @publication.update(publication_params) format.html { redirect_to publications_url, notice: 'Publication was successfully updated.' } format.json { render :show, status: :ok, location: @publication } else format.html { render :edit } format.json { render json: @publication.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n logger.info('PUT Update:')\n logger.info(request_body)\n new_pub = hashed_request\n old_pub = Publication.find_by(id: params[:id])\n if old_pub.blank?\n head :not_found\n return\n elsif old_pub.deleted?\n head :gone\n return\n end\n if old_pub.harvested_pub?...
[ "0.7181202", "0.7017134", "0.68675035", "0.67795646", "0.67539096", "0.67428213", "0.67428213", "0.67428213", "0.671077", "0.6670905", "0.66663516", "0.65363234", "0.6523172", "0.6493263", "0.64796525", "0.6436615", "0.638798", "0.63537747", "0.6313768", "0.6308919", "0.62913...
0.6731068
8
DELETE /publications/1 DELETE /publications/1.json
def destroy @publication.destroy respond_to do |format| format.html { redirect_to publications_url, notice: 'Publication was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @publication.destroy\n respond_to do |format|\n format.html { redirect_to publications_url }\n format.json...
[ "0.78301245", "0.78301245", "0.7801926", "0.7751558", "0.7702748", "0.76973265", "0.7599814", "0.7575114", "0.75505936", "0.7549252", "0.75462687", "0.7530383", "0.75106543", "0.7419731", "0.7398968", "0.73864627", "0.7363567", "0.7351437", "0.72758895", "0.7194398", "0.71791...
0.75696844
10
Use callbacks to share common setup or constraints between actions.
def set_publication @publication = Publication.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 publication_params params.require(:publication).permit(:bib, person_ids: [], project_ids: []) 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
require all new entries to have these four fields, at a minimum, INCLUDING notes
def result_check params.require(:result).permit(:name, :costinusd, :aacostpts, :aacostusd, :bacostpts, :bacostusd, :uacostpts, :uacostusd, :dlcostpts, :dlcostusd, :ascostpts, :ascostusd, :nkcostpts, :nkcostusd, :sqcostpts, :sqcostusd, :lacostpts, :lacostusd, :accostpts, :accostusd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_required_fields\n user = new_record? ? author : current_journal.try(:user)\n\n required_attribute_names(user).each do |attribute|\n if /^\\d+$/.match?(attribute)\n attribute = attribute.to_i\n v = custom_field_values.detect {|v| v.custom_field_id == attribute}\n if v &&...
[ "0.6091969", "0.5979381", "0.5979381", "0.595067", "0.5946971", "0.5915128", "0.58852035", "0.58462495", "0.5815208", "0.5805569", "0.566186", "0.5607317", "0.56022465", "0.55788034", "0.5549925", "0.55423266", "0.55375445", "0.54914427", "0.5489911", "0.54780114", "0.5477048...
0.0
-1
GET /crossword_puzzles/1 GET /crossword_puzzles/1.json
def show @crossword_puzzle = CrosswordPuzzle.find(params[:id]) #Creates a solution for the puzzle by the user unless (current_user.nil? || @crossword_puzzle.nil?) @crossword_solution = CrosswordSolution.find_or_create_by_user_id_and_crossword_puzzle_id(current_user.id, @crossword_puzzle.id) end respond_to do |format| format.html # show.html.erb format.json { render json: @crossword_puzzle } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @puzzles = Puzzle.order :name\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @puzzles }\n end\n end", "def new\n @crossword_puzzle = CrosswordPuzzle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { ...
[ "0.6225021", "0.60576874", "0.5939479", "0.5932435", "0.5921396", "0.58294564", "0.58211523", "0.57480085", "0.56797725", "0.5666099", "0.56627667", "0.56585425", "0.5646442", "0.55696684", "0.5558909", "0.5556609", "0.54991317", "0.54934365", "0.54934365", "0.54934365", "0.5...
0.5740075
8
GET /crossword_puzzles/new GET /crossword_puzzles/new.json
def new @crossword_puzzle = CrosswordPuzzle.new respond_to do |format| format.html # new.html.erb format.json { render json: @crossword_puzzle } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @paper_word = PaperWord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @paper_word }\n end\n end", "def new\n @word = Word.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @word }\n ...
[ "0.6949752", "0.68672717", "0.68672717", "0.68672717", "0.68672717", "0.68672717", "0.6809923", "0.6769404", "0.6591035", "0.6575545", "0.65729815", "0.65692127", "0.6555466", "0.65527725", "0.65492034", "0.6518632", "0.64954877", "0.6488429", "0.6487212", "0.6472325", "0.647...
0.71602786
0
POST /crossword_puzzles POST /crossword_puzzles.json
def create @crossword_puzzle = CrosswordPuzzle.new(params[:crossword_puzzle]) if !@crossword_puzzle.user && current_user @crossword_puzzle.user = current_user end respond_to do |format| if @crossword_puzzle.save if current_user.admin format.html { redirect_to @crossword_puzzle, notice: 'Crossword puzzle was successfully created.' } else format.html{ redirect_to edit_crossword_puzzle_path(@crossword_puzzle), :notice => "Puzzle created!" } end format.json { render json: @crossword_puzzle, status: :created, location: @crossword_puzzle } else format.html { render action: "new" } format.json { render json: @crossword_puzzle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @paper_word = PaperWord.new(params[:paper_word])\n\n respond_to do |format|\n if @paper_word.save\n format.html { redirect_to @paper_word, notice: 'Paper word was successfully created.' }\n format.json { render json: @paper_word, status: :created, location: @paper_word }\n ...
[ "0.59651744", "0.55942965", "0.5541964", "0.54664713", "0.54053706", "0.54040056", "0.54001254", "0.5396807", "0.5380307", "0.5374924", "0.53667176", "0.5311728", "0.53114116", "0.53114116", "0.5309286", "0.5309286", "0.5309286", "0.53056145", "0.5303603", "0.5296149", "0.528...
0.59659815
0
PUT /crossword_puzzles/1 PUT /crossword_puzzles/1.json
def update @crossword_puzzle = CrosswordPuzzle.find(params[:id]) respond_to do |format| if @crossword_puzzle.update_attributes(params[:crossword_puzzle]) format.html { redirect_to edit_crossword_puzzle_path(@crossword_puzzle), notice: 'Puzzle saved!' } format.json { head :no_content } format.js else format.html { render action: "edit", notice: 'Error while saving.' } format.json { render json: @crossword_puzzle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @word = Word.find(params[:id])\n\n respond_to do |format|\n\n if @word.update_attributes(params[:word])\n format.json { head :no_content }\n else\n format.json { render :json => @word.errors,\n :status => :unprocessable_entity }\n end\n...
[ "0.6003195", "0.5832756", "0.57551366", "0.5728726", "0.56529737", "0.56529737", "0.56529737", "0.56529737", "0.56218475", "0.5549136", "0.55422103", "0.55068344", "0.549347", "0.54843426", "0.54843426", "0.54843426", "0.54843426", "0.54843426", "0.54679215", "0.5455668", "0....
0.6163839
0
DELETE /crossword_puzzles/1 DELETE /crossword_puzzles/1.json
def destroy @crossword_puzzle = CrosswordPuzzle.find(params[:id]) @crossword_puzzle.destroy respond_to do |format| if current_user.admin format.html { redirect_to crossword_puzzles_url, notice: 'Puzzle successfully deleted.' } else format.html { redirect_to root_url, notice: 'Crossword puzzle successfully deleted.' } end format.json { head :no_content } format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @paper_word = PaperWord.find(params[:id])\n @paper_word.destroy\n\n respond_to do |format|\n format.html { redirect_to paper_words_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @word_praat.destroy\n respond_to do |format|\n format.html { red...
[ "0.68856907", "0.6765128", "0.67376244", "0.67296416", "0.6724661", "0.6724661", "0.6724661", "0.6724661", "0.6724661", "0.67044264", "0.6696909", "0.6656563", "0.6653519", "0.6628278", "0.662076", "0.6617038", "0.6613154", "0.661139", "0.65942556", "0.6590585", "0.65708786",...
0.6478811
33
Uses player input to determine the battle command.
def choose_attack print_battle_commands(header = "Choose an attack:") input = player_input index = has_battle_command(input) #input error loop while !index puts "You don't have '#{input}'" print_battle_commands(header = "Try one of these:") input = player_input index = has_battle_command(input) end return @battle_commands[index] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def phase2_command_input \r\n # Play decision SE\r\n $game_system.se_play($data_system.decision_se)\r\n # Branch by party command window cursor position\r\n case @party_command_window.command\r\n when SDK::Scene_Commands::Scene_Battle::Fight # fight\r\n phase2_command_fight\r\n when SDK::...
[ "0.70609623", "0.70355", "0.6947934", "0.68862426", "0.6633459", "0.661562", "0.6567215", "0.6544181", "0.6514603", "0.6471352", "0.6465121", "0.6387266", "0.63676935", "0.63569516", "0.63325167", "0.62914205", "0.62868357", "0.62705934", "0.6267516", "0.626027", "0.6252274",...
0.6792389
4
Requires input to select item and on whom to use it during battle (Use command). Return nil on error.
def choose_item_and_on_whom(enemy) index = nil item = nil # Choose the item to use. while !index print_inventory puts "Which item would you like to use?" input = player_input prompt: "(or type 'pass' to forfeit the turn): " return if (input.casecmp("pass").zero?) index = has_item(input) if !index print NO_SUCH_ITEM_ERROR else item = @inventory[index].first end end whom = nil # Choose on whom to use the item. while !whom puts "On whom will you use the item (#{@name} or #{enemy.name})?" input = player_input prompt: "(or type 'pass' to forfeit the turn): " return if (input.casecmp("pass").zero?) if (input.casecmp(@name).zero?) whom = self elsif (input.casecmp(enemy.name).zero?) whom = enemy else print "What?! Choose either #{@name} or #{enemy.name}!\n\n" end end return C[item, whom] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_item\n\n if @inventory.empty?\n slow_type(\"\\nYou don't have anything in your inventory\")\n\n else\n print_inventory_items\n\n use_item = TTY::Prompt.new\n\n choices = []\n @options = []\n @inventory.each do |item_id|\n inventory_item = find_item_by_id(item_id)\n ...
[ "0.7295352", "0.66059655", "0.64451236", "0.64365077", "0.62689704", "0.6259953", "0.61984205", "0.6178161", "0.6145603", "0.6133078", "0.61178565", "0.6101897", "0.6096184", "0.60942155", "0.6093194", "0.6092084", "0.6084433", "0.60492486", "0.60466254", "0.604445", "0.60262...
0.6303358
4
Sends the player back to a safe location, halves its gold, and restores HP.
def die sleep(2) unless ENV['TEST'] # TODO: fix next line. regen_location could be nil or "bad." @location = @map.regen_location type("After being knocked out in battle,\n") type("you wake up in #{@map.name}.\n\n") sleep(2) unless ENV['TEST'] # Heal the player. set_stats(hp: @stats[:max_hp]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kick(player_name)\n\t\n\t player_name.hp = player_name.hp - 20\n\n\t end", "def die\n sleep(2) unless ENV['TEST']\n\n # TODO: fix next line. regen_location could be nil or \"bad.\"\n @location = @map.regen_location\n\n type(\"After being knocked out in battle,\\n\")\n type(\"you wake up in #{...
[ "0.644188", "0.6198938", "0.61366934", "0.6132904", "0.6065919", "0.6029237", "0.6009856", "0.5991272", "0.5988335", "0.5912267", "0.5909582", "0.589586", "0.5866175", "0.5858791", "0.5850262", "0.58336574", "0.58141494", "0.5796272", "0.57941866", "0.5787628", "0.5782212", ...
0.6135624
3
Moves the player down. Increases 'y' coordinate by 1.
def move_down down_tile = C[@location.first + 1, @location.second] move_to(down_tile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_down\r\n if @y + @vel_y < SCREEN_HEIGHT - GAME_PRESET[\"player_move_down\"]\r\n @y += @vel_y\r\n end\r\n end", "def move_down(n)\n self.y -= n\n end", "def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend", "def move_down(turn_enabled = true)\n @y += 1 ...
[ "0.84450954", "0.7647884", "0.73934776", "0.73630226", "0.73521405", "0.72659457", "0.71944845", "0.71581674", "0.71370125", "0.70650494", "0.7042545", "0.68378377", "0.6713143", "0.6696204", "0.6696204", "0.6666921", "0.66378856", "0.6633491", "0.66154736", "0.65613794", "0....
0.65976655
19
Moves the player left. Decreases 'x' coordinate by 1.
def move_left left_tile = C[@location.first, @location.second - 1] move_to(left_tile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_left \r\n if @x - @vel_x > GAME_PRESET[\"player_move_left\"]\r\n @x -= @vel_x\r\n end\r\n end", "def move_left\n\t\t@x_speed -= @speed_inc_step\n\t\tif @x_speed < -@max_speed\n\t\t\t@x_speed = -@max_speed\n\t\tend\n\n\t\tupdate_x(@x_speed)\n\n\t\tif !face_left?\n\t\t\tupdate_angle(calculate_ang...
[ "0.8338273", "0.7785288", "0.7763415", "0.7679488", "0.76286787", "0.74821323", "0.7165592", "0.7136886", "0.7124332", "0.71148473", "0.7034083", "0.70095694", "0.70095694", "0.68827945", "0.6868804", "0.6846114", "0.68417704", "0.68364877", "0.6707493", "0.6672153", "0.66629...
0.62541634
55
Moves the player right. Increases 'x' coordinate by 1.
def move_right right_tile = C[@location.first, @location.second + 1] move_to(right_tile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_right\r\n if @x + @vel_x < SCREEN_WIDTH - GAME_PRESET[\"player_move_right\"]\r\n @x += @vel_x\r\n end\r\n end", "def move_right\n\t\tmove([1,0])\n\tend", "def move_right\n\t\t@x_speed += @speed_inc_step\n\t\tif @x_speed > @max_speed\n\t\t\t@x_speed = @max_speed\n\t\tend\n\n\t\tupdate_x(@x_...
[ "0.84250695", "0.7901699", "0.77740717", "0.7690245", "0.74000055", "0.73994577", "0.7097265", "0.708047", "0.69408184", "0.6901933", "0.68985355", "0.6881219", "0.68619436", "0.68537927", "0.68376124", "0.6835703", "0.6835633", "0.6802224", "0.6797812", "0.6797812", "0.67708...
0.6862269
12
Safe setter function for location and map.
def move_to(coordinates, map = @map) # Prevents operations on nil. return if map.nil? y = coordinates.first; x = coordinates.second # Save the map. @saved_maps[@map.name] = @map if @map # Even if the player hasn't moved, we still change to true. # This is because we want to re-display the minimap anyway. @moved = true # Prevents moving onto nonexistent and impassable tiles. return if !(map.in_bounds(y, x) && map.tiles[y][x].passable) @map = @saved_maps[map.name] ? @saved_maps[map.name] : map @location = coordinates tile = @map.tiles[y][x] update_map unless tile.monsters.empty? # 50% chance to encounter monster. if [true, false].sample clone = tile.monsters[Random.rand(0..(tile.monsters.size-1))].clone battle(clone) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location=(data)\n if self.location.present? && !data.is_a?(Hash)\n self.location.destroy\n end\n \n if data.is_a?(Hash)\n if self.location.present?\n self.location.attributes = data\n else\n super(Location.new data)\n end\n else\n super(data)\n end\n en...
[ "0.6912048", "0.6796796", "0.6522319", "0.65150994", "0.6451366", "0.64149064", "0.64078635", "0.6237788", "0.62025017", "0.6188886", "0.61868346", "0.61010027", "0.61008084", "0.6091306", "0.6064603", "0.6060982", "0.60591483", "0.6056453", "0.60199803", "0.5998788", "0.5974...
0.0
-1
Moves the player up. Decreases 'y' coordinate by 1.
def move_up up_tile = C[@location.first - 1, @location.second] move_to(up_tile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_up\n\t\tunless @y_player <= 0\n\t\t\t@y_player -= 4\n\t\tend\n\tend", "def move_up\r\n if @y + @vel_y > GAME_PRESET[\"player_move_up\"]\r\n @y -= @vel_y\r\n end\r\n end", "def move_up\n unless @value.eql? 1\n @y -= 50\n @value -= 1\n end\n end", "def move_up\n\t\t# if th...
[ "0.8473898", "0.84681857", "0.79214144", "0.7700698", "0.764459", "0.7614573", "0.75507265", "0.74856675", "0.74225557", "0.72708976", "0.7248377", "0.7061182", "0.6933274", "0.6896247", "0.68573534", "0.68009686", "0.674319", "0.6737837", "0.6666356", "0.6657828", "0.6623143...
0.66657823
19
Prints the map in regards to what the player has seen. Additionally, provides current location and the map's name.
def print_map # Provide some spacing from the edge of the terminal. 3.times { print " " }; print @map.name + "\n\n" @map.tiles.each_with_index do |row, r| # Provide spacing for the beginning of each row. 2.times { print " " } row.each_with_index do |tile, t| print_tile(C[r, t]) end print "\n" end print "\n" # Provide some spacing to center the legend. 3.times { print " " } # Prints the legend. print "¶ - #{@name}'s\n location\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_map\n\n # Provide some spacing to center the name.\n (0..(@map.name.length/4)).each do\n print \" \"\n end\n\n print @map.name + \"\\n\\n\"\n\n @map.tiles.each_with_index do |row, r|\n # Provide spacing for the beginning of each row.\n (0..(@map.name.length/2)).each do\n ...
[ "0.7134865", "0.6895263", "0.6881917", "0.6813431", "0.6575877", "0.653626", "0.64906824", "0.647277", "0.6420577", "0.63627094", "0.6360731", "0.6260933", "0.6221287", "0.621146", "0.6188618", "0.61772645", "0.61495423", "0.6136092", "0.6108629", "0.61017257", "0.60913604", ...
0.7251592
0
Prints a minimap of nearby tiles (using VIEW_DISTANCE).
def print_minimap print "\n" for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE) # skip to next line if out of bounds from above map next if y.negative? # centers minimap 10.times { print " " } for x in (@location.second-VIEW_DISTANCE)..(@location.second+VIEW_DISTANCE) # Prevents operations on nonexistent tiles. print_tile(C[y, x]) if (@map.in_bounds(y, x)) end # new line if this row is not out of bounds print "\n" if y < @map.tiles.size end print "\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_minimap\n print \"\\n\"\n for y in (@location.first-VIEW_DISTANCE)..(@location.first+VIEW_DISTANCE)\n # skip to next line if out of bounds from above map\n next if y < 0\n # centers minimap\n 10.times do\n print \" \"\n end\n for x in (@location.second-VIEW_DIST...
[ "0.83357704", "0.6402761", "0.62895626", "0.62808174", "0.6154004", "0.6044166", "0.60214835", "0.5905696", "0.5888686", "0.58621854", "0.57700944", "0.5757397", "0.57502127", "0.5732081", "0.5726335", "0.5725984", "0.570613", "0.5668745", "0.5655546", "0.56177217", "0.558181...
0.8136597
1
Prints the tile based on the player's location.
def print_tile(coords) if ((@location.first == coords.first) && (@location.second == coords.second)) print "¶ " else print @map.tiles[coords.first][coords.second].to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_tile(coords)\n if ((@location.first == coords.first) && (@location.second == coords.second))\n print \"¶ \"\n else\n print @map.tiles[coords.first][coords.second].to_s\n end\n end", "def show_player\n if @position == 1\n puts \"le joueur #{@position} : #{@name.capitalize} #{...
[ "0.7665916", "0.6691956", "0.65180314", "0.6510894", "0.6468359", "0.6464139", "0.6356246", "0.63491505", "0.63429517", "0.629416", "0.62820613", "0.6255598", "0.6245893", "0.62337184", "0.6218377", "0.62048995", "0.61825913", "0.6175415", "0.61319804", "0.612568", "0.6121357...
0.764693
1
Updates the 'seen' attributes of the tiles on the player's current map.
def update_map(coordinates = @location) for y in (coordinates.first-VIEW_DISTANCE)..(coordinates.first+VIEW_DISTANCE) for x in (coordinates.second-VIEW_DISTANCE)..(coordinates.second+VIEW_DISTANCE) @map.tiles[y][x].seen = true if (@map.in_bounds(y, x)) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_player_map\n @map.tiles[@location.first][location.second].seen = true\n #corners\n @map.tiles[@location.first + 1][@location.second - 1].seen = true\n @map.tiles[@location.first - 1][@location.second - 1].seen = true\n @map.tiles[@location.first + 1][@location.second + 1].seen = true\n ...
[ "0.74244654", "0.67985487", "0.6310106", "0.6039057", "0.5997607", "0.5917731", "0.5696204", "0.5630758", "0.55744594", "0.55705756", "0.5569027", "0.5552337", "0.5541701", "0.54226077", "0.5404282", "0.5378507", "0.5373933", "0.53683406", "0.5340139", "0.53180796", "0.519530...
0.6793228
2
How the Player behaves after winning a battle.
def handle_victory(entity) type("You defeated the #{entity.name}!\n") super(entity) print "\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_win\n @player.won_bet\n puts \"You have #{@player.chips_remaining} remaining\"\n end", "def win\n\t\tputs \"Player #{@myIndex} made a correct accusation and has won the game!\"\n\tend", "def win_message\n puts \"Player #{@id.to_s} (#{@piece}) wins!\"\n end", "def battle_outcome()\n ...
[ "0.8044219", "0.7509282", "0.7461444", "0.7375538", "0.7283133", "0.72822636", "0.7110048", "0.709128", "0.708576", "0.7047893", "0.7002596", "0.6989944", "0.6984924", "0.69747096", "0.6942723", "0.69220406", "0.69206995", "0.6904667", "0.69037956", "0.68941754", "0.68941754"...
0.0
-1
The treasure given by a Player after losing a battle.
def sample_treasures nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def treasure_drop(enemy)\n if rand(100) < enemy.treasure_prob\n treasure = $data_items[enemy.item_id] if enemy.item_id > 0\n treasure = $data_weapons[enemy.weapon_id] if enemy.weapon_id > 0\n treasure = $data_armors[enemy.armor_id] if enemy.armor_id > 0\n end\n return treasure\n end", "d...
[ "0.7148631", "0.71128994", "0.7036147", "0.6561897", "0.6464999", "0.63113695", "0.6297646", "0.6283097", "0.62032", "0.61390823", "0.6107691", "0.60848916", "0.60777104", "0.60464716", "0.6026727", "0.6025658", "0.60153216", "0.60074407", "0.5976005", "0.59339404", "0.588605...
0.0
-1
Returns the gold given to a victorious Entity after losing a battle and deducts the figure from the Player's total as necessary
def sample_gold gold_lost = 0 # Reduce gold if the player has any. if @gold.positive? type("Looks like you lost some gold...\n\n") gold_lost = @gold/2 @gold -= gold_lost end gold_lost end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gain_gold\n if $game_troop.gold_total > 0\n rate = Grade.rate(:gold)\n gold = $game_troop.gold_total\n gold = gold * rate / 100\n $game_party.gain_gold(gold)\n else\n gold = 0\n end\n return gold\n end", "def lose_gold(n)\n gain_gold(-n)\n end", "def gold_result(en...
[ "0.73759586", "0.7155349", "0.7060013", "0.69382966", "0.68649083", "0.6833854", "0.6819328", "0.6809912", "0.66842455", "0.66752476", "0.662677", "0.6573059", "0.6558426", "0.6470538", "0.64487606", "0.6442957", "0.64313215", "0.641958", "0.6368014", "0.6317911", "0.63106894...
0.7261822
1
attr_reader :lots attr_writer :otu_id
def initialize(options = {}) opt = { :otu_id => nil, :include_specimen_identifiers => :most_recent, # :most_recent, :all, :first :include_distributions => false, # true might not work now :include_lots => false, # true might not work now :include_specimens => true }.merge!(options.symbolize_keys) return false if opt[:otu_id].blank? @otu = Otu.find(opt[:otu_id]) @specimens = @otu.specimens $MATERIAL_CATEGORIES = %w/holotype lectotype neotype syntype paratype paralectotype/ # "other" is added via a method # @otu.specimenstype_specimens.with_type_status('holotype') @me = HashFactory.call # see Proc in environment.rb o = Otu.find(opt[:otu_id]) $total_specimens = 0 _from_distributions(o) if opt[:include_distributions] _from_lots(o) if opt[:include_lots] _from_specimens(o) if opt[:include_specimens] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_lot\n @lot = Lot.find(params[:id])\n end", "def set_lot\n @lot = Lot.find(params[:id])\n end", "def set_lot\n @lot = Lot.find(params[:id] || params[:lot_id])\n end", "def lot_name\n lot.name\n end", "def set_eventslot\n @eventslot = Eventslot.find(params[:id])\n ...
[ "0.63560444", "0.63560444", "0.62873876", "0.6133977", "0.6111231", "0.5638261", "0.55661833", "0.5538123", "0.553616", "0.553616", "0.55190825", "0.55190825", "0.54840636", "0.5478688", "0.5395919", "0.53915995", "0.53821784", "0.53453", "0.5340263", "0.52712417", "0.5259721...
0.0
-1
pass an array of specimens
def sex_str(specimens) v = {} specimens.each do |s| v[s.sex] = 0 if !v[s.sex] v[s.sex] += 1 end sx = [] v.keys.sort.each do |k| sx << (v[k] == 1 ? "1 #{k}" : "#{v[k]} #{k}s") end sx.join(", ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_specimens(operations:)\n operations.map { |op| op.input_array(SPECIMEN).map(&:item) }.flatten\n end", "def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end", "def spec( *args )\n if args.length == 1\n # Array of 4*Coords in Array.\...
[ "0.62259907", "0.6098829", "0.5974337", "0.5709445", "0.5631295", "0.54762113", "0.5451019", "0.54435164", "0.54424405", "0.5440108", "0.54169065", "0.54015744", "0.5388878", "0.5348063", "0.5329697", "0.5322659", "0.5314729", "0.5311235", "0.5230368", "0.5213647", "0.5213647...
0.0
-1
pass an array of specimens
def inst_str(specimens) is = [] v = {} v["unknown"] = [] specimens.each do |s| if !s.repository.blank? && !s.repository.coden.blank? if v[s.repository.coden].nil? v[s.repository.coden] = [s] else v[s.repository.coden] << s end else v["unknown"] << s end end v.delete("unknown") if v["unknown"].size == 0 ls = [] v.keys.each do |r| s = '' s += id_str(v[r]) s += " (#{r})" ls << s end ls.join("; ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_specimens(operations:)\n operations.map { |op| op.input_array(SPECIMEN).map(&:item) }.flatten\n end", "def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end", "def spec( *args )\n if args.length == 1\n # Array of 4*Coords in Array.\...
[ "0.62259907", "0.6098829", "0.5974337", "0.5709445", "0.5631295", "0.54762113", "0.5451019", "0.54435164", "0.54424405", "0.5440108", "0.54169065", "0.54015744", "0.5388878", "0.5348063", "0.5329697", "0.5322659", "0.5314729", "0.5311235", "0.5230368", "0.5213647", "0.5213647...
0.0
-1
pass an array of specimens
def country_str(specimens) v = {} v["country not specified"] = [] specimens.each do |s| if !s.ce.blank? && !s.ce.geog.blank? && !s.ce.geog.country.blank? && !s.ce.geog.country.name.blank? if v[s.ce.geog.country.name].nil? v[s.ce.geog.country.name] = [s] else v[s.ce.geog.country.name] << s end else v["country not specified"] << s end end v.delete("country not specified") if v["country not specified"].size == 0 is = [] v.keys.sort.each do |c| txt = "#{c.upcase}: " txt << sex_str(v[c]) txt += ". " txt += inst_str(v[c]) + "." is << txt end is.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collect_specimens(operations:)\n operations.map { |op| op.input_array(SPECIMEN).map(&:item) }.flatten\n end", "def project_spec_arrays\n [:controller_specs, :model_specs, :view_specs]\n end", "def spec( *args )\n if args.length == 1\n # Array of 4*Coords in Array.\...
[ "0.62259907", "0.6098829", "0.5974337", "0.5709445", "0.5631295", "0.54762113", "0.5451019", "0.54435164", "0.54424405", "0.5440108", "0.54169065", "0.54015744", "0.5388878", "0.5348063", "0.5329697", "0.5322659", "0.5314729", "0.5311235", "0.5230368", "0.5213647", "0.5213647...
0.0
-1
The methods below this are summaries render a quick display (should move to a helper likely)
def display_quick s = '' for i in @me.keys s << " <b>#{i}.</b><br/>" # country for j in @me[i].keys s << "&nbsp;<b>#{j}:</b><br/>" if not j == 'unknown' # state for k in @me[i][j].keys s << "&nbsp;&nbsp;#{k}<br/>" if not k == 'unknown' # county for l in @me[i][j][k].keys s << ("&nbsp;&nbsp;" + (l == 'unknown' ? "<i>repository not given</i>" : "&nbsp;&nbsp;#{l}") + "<br/>") if not l == nil # repository s << "&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;" + @me[i][j][k][l].keys.collect{|m| ("#{@me[i][j][k][l][m]} " + case m # the count when 'female' "&#9792;" when 'male' "&#9794" when 'gynadropmorph' "[&#9792;&#9794;]" else "unknown sex" end)}.join(",") s << "<br/>" end end end end s.html_safe end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summary\n #render unless @output\n @summary\n end", "def render_summary\n summary = nil\n\n end", "def summary\n \n end", "def summary\n end", "def summary\n end", "def summary; end", "def summary; end", "def summary; end", "def summary; end", "def summary\n # TO...
[ "0.74183255", "0.7262107", "0.724728", "0.71588504", "0.71588504", "0.7126353", "0.7126353", "0.7126353", "0.7126353", "0.7065552", "0.6954688", "0.68671477", "0.68125504", "0.6693552", "0.6680704", "0.66309476", "0.6582658", "0.6552832", "0.6523691", "0.6518315", "0.6491239"...
0.63020146
46
crude and somewhat duplicated could be simplified for sure
def _from_distributions(otu) ds = otu.distributions sex = 'unknown' rep = 'unknown' if not ds == nil for d in ds if d.geog_id country = d.geog.country ? d.geog.country.name : 'unknown' state = d.geog.state ? d.geog.state.name : 'unknown' county = d.geog.county ? d.geog.county.name : 'unknown' # ug-leee @me[country][state][county][rep][sex] == {} ? @me[country][state][county][rep][sex] = d.num_specimens : @me[country][state][county][rep][sex] += d.num_specimens else @me[:unknown][:unknown][:unknown][rep][sex] == {} ? @me[:unknown][:unknown][:unknown][rep][sex] = d.num_specimens : @me[:unknown][:unknown][:unknown][rep][sex] += d.num_specimens end $total_specimens += d.num_specimens end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def anchored; end", "def suivre; end", "def stderrs; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def formation; end", "def offences_by; end", "def transformations; end", "def operations; en...
[ "0.67515683", "0.6312525", "0.6046015", "0.6020571", "0.59406114", "0.58216065", "0.5820206", "0.5820206", "0.5820206", "0.5820206", "0.5813013", "0.5775777", "0.5754169", "0.5612189", "0.5612189", "0.5576442", "0.5554098", "0.5552385", "0.5551547", "0.5529452", "0.5524351", ...
0.0
-1
GET /test_questions/1 GET /test_questions/1.json
def show @test_question = TestQuestion.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render :json => @test_question } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n render json: @test_module.test_questions, status: :ok\n end", "def questions\n self.class.get(\"/2.2/questions\", @options)\n end", "def get_question_list\n json= RestClient.get(\"http://localhost:3000/questions\")\n JSON.parse(json)\n end", "def index\n @questions = Quest...
[ "0.76273316", "0.7617988", "0.7499508", "0.7131678", "0.7084854", "0.70559084", "0.7049141", "0.7017962", "0.6995291", "0.6921943", "0.6921117", "0.68634236", "0.6856893", "0.6797967", "0.67955124", "0.67807794", "0.6770636", "0.67601764", "0.675877", "0.675877", "0.675877", ...
0.7409299
3
GET /test_questions/new GET /test_questions/new.json
def new @test_question = TestQuestion.new respond_to do |format| format.html # new.html.erb format.json { render :json => @test_question } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n #@question = Question.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }\n end\n end", "def new\n @question = Question.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @question }...
[ "0.7850332", "0.7842054", "0.7842054", "0.7842054", "0.7842054", "0.7842054", "0.7769053", "0.7741807", "0.76394236", "0.75785047", "0.7525696", "0.74207133", "0.74169517", "0.74103963", "0.7407483", "0.7403773", "0.73939776", "0.73933125", "0.7390224", "0.7376302", "0.737326...
0.7969413
0
POST /test_questions POST /test_questions.json
def create @test_question = TestQuestion.new(params[:test_question]) respond_to do |format| if @test_question.save format.html { redirect_to @test_question, :notice => 'Test question was successfully created.' } format.json { render :json => @test_question, :status => :created, :location => @test_question } else format.html { render :action => "new" } format.json { render :json => @test_question.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @test_question = TestQuestion.new(test_question_params)\n\n respond_to do |format|\n if @test_question.save\n format.html { redirect_to @test_question, notice: 'Test question was successfully created.' }\n format.json { render :show, status: :created, location: @test_question ...
[ "0.71973485", "0.71973485", "0.7070897", "0.6947893", "0.6812038", "0.6792296", "0.67156166", "0.6702249", "0.6676173", "0.66741323", "0.6644101", "0.6619836", "0.66078454", "0.6598531", "0.6592832", "0.6485802", "0.6456139", "0.64504063", "0.6449363", "0.64361995", "0.637914...
0.7289749
0
PUT /test_questions/1 PUT /test_questions/1.json
def update @test_question = TestQuestion.find(params[:id]) respond_to do |format| if @test_question.update_attributes(params[:test_question]) format.html { redirect_to @test_question, :notice => 'Test question was successfully updated.' } format.json { head :ok } else format.html { render :action => "edit" } format.json { render :json => @test_question.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @survey = Survey.find(params[:id])\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index do |question, idx|\n json[:questions][idx]['id'] = idx + 1\n end\n\n respond_to do |format|\n if @survey.update_attributes(json)\...
[ "0.6997375", "0.6963279", "0.6862295", "0.6816271", "0.6780306", "0.6747774", "0.6659595", "0.6625654", "0.66036695", "0.65941435", "0.65813667", "0.65140575", "0.6468147", "0.6456749", "0.64493847", "0.6426765", "0.6426765", "0.6426765", "0.6426765", "0.6426765", "0.64069027...
0.7103229
0
DELETE /test_questions/1 DELETE /test_questions/1.json
def destroy @test_question = TestQuestion.find(params[:id]) @test_question.destroy respond_to do |format| format.html { redirect_to test_questions_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n question = QuestionTest.where(test_id: params[:test_id], question_id: params[:id])\n if question.delete_all\n return render json: {message: 'Question was removed succesfully.', error: false}\n else\n return render json: {message: 'Error: Something went wrong. Question was ...
[ "0.77042663", "0.75446856", "0.75446856", "0.75303197", "0.7495366", "0.73791075", "0.734512", "0.734512", "0.734512", "0.734512", "0.734512", "0.734512", "0.73442084", "0.7342919", "0.73042595", "0.73042595", "0.7303724", "0.7284187", "0.7283592", "0.7282965", "0.7282965", ...
0.78112733
0
First line defines the mathod 'cheese_and_crackers' with the arguments (cheese_count, boxes_of_crackers)
def cheese_and_crackers(cheese_count, boxes_of_crackers) #prints "You have X cheeses!" The number would be the first number put inside of the method variables. puts "You have #{cheese_count} cheeses!" #prints "You have X boxes of crackers!" puts "You have #{boxes_of_crackers} boxes of crackers!" #prints "Man thats enough for a party!" puts "Man that's enough for a party!" #prints "Get a blanket" puts "Get a blanket. \n" #ends the methods definition end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n puts \"You have #{cheese_count} cheeses.\"\n puts \"You have #{boxes_of_crackers} boxes of crackers.\"\n puts \"Party on, you fat bastard!\\n\"\nend", "def cheese_and_crackers(cheese_count, boxes_of_crackers)\n\tputs \"You have #{cheese_count} cheeses...
[ "0.7751951", "0.76843095", "0.76841515", "0.76822186", "0.7677064", "0.7654234", "0.76409215", "0.76380426", "0.76228297", "0.76228297", "0.76228297", "0.76228297", "0.76228297", "0.76228297", "0.76228297", "0.76228297", "0.76228297", "0.76228297", "0.75442857", "0.7422361", ...
0.7191251
21