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
updates an object in the database based on a specified primary key ignore_fields should include a list of strings (field names)
def update(object, table, where_field, ignore_fields = []) vals = object.to_hash vals.delete_if {|k, v| ignore_fields.include?(k) } set_fields = vals.collect {|k,v| "#{k} = #{Formatter.format(v)}"}.join(', ') where = {where_field => vals[where_field]} sql = "update #{table} set #{set_fields} #{where_clause(where)};" execute(sql) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @fields = args[:fields] if args.key?(:fields)\n @id = args[:id] if args.key?(:id)\n end", "def update!(**args)\n @excluded_fields = args[:excluded_fields] if args.key?(:excluded_fields)\n @included_fields = args[:included_fields] if args.key?(:incl...
[ "0.6536162", "0.649942", "0.641709", "0.63931364", "0.63155645", "0.63140196", "0.6313877", "0.6271968", "0.6256422", "0.6256422", "0.6256422", "0.6256422", "0.6256422", "0.6161108", "0.6122666", "0.6072255", "0.6072255", "0.6068736", "0.6031267", "0.60102975", "0.60102975", ...
0.67923445
0
returns a where clause string, or empty string if the input is empty
def where_clause(where, and_or = "and", equals_like = "=") clause = where.keys.collect { |k| "#{k} #{equals_like} #{Formatter.format(where[k])}" } clause.empty? ? "" : "where #{clause.join(" #{and_or} ")}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where_clause\n \"\"\n end", "def generate_where_phrase\n opt_where = @opt[:where]\n\n return '' if opt_where.nil? or opt_where.empty?\n\n where = []\n opt_where.each_pair { |k, v|\n a = @entity.attr(k)\n r = @entity.rel(k)\n if a\n raise \"Field #...
[ "0.87024456", "0.7505429", "0.72001123", "0.71252614", "0.7100628", "0.7091434", "0.70348823", "0.69594175", "0.6780858", "0.66859996", "0.6539533", "0.6501606", "0.64432794", "0.64261824", "0.6406554", "0.63750887", "0.6347061", "0.6339936", "0.6325101", "0.6321957", "0.6274...
0.69765884
7
Returns the hexadecimal representation of the device's token.
def to_hexa [self.token].pack('H*') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token\n @token ||= \"%x-%s\" % [ Time.now.to_i, SecureRandom::hex(4) ]\n end", "def to_s\n token\n end", "def device_token(token)\n Util.validate(token, 'device_token', DEVICE_TOKEN_PATTERN)\n { device_token: token.upcase.strip }\n end", "def token\n len = 8\n token =...
[ "0.73099583", "0.71023047", "0.70134175", "0.6853934", "0.6664306", "0.66578573", "0.6641653", "0.65439284", "0.65263516", "0.6509558", "0.6422131", "0.63730186", "0.63591164", "0.6329285", "0.6325739", "0.6325274", "0.6307461", "0.6292327", "0.6289638", "0.6271425", "0.62714...
0.738468
0
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) if name_hash=={} nil else new1=name_hash.sort_by(&:last) new1[0][0] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n...
[ "0.8821222", "0.8777674", "0.87769854", "0.8745862", "0.8689437", "0.86553806", "0.865241", "0.86165065", "0.8587693", "0.8572328", "0.85674095", "0.8550907", "0.8529734", "0.8529734", "0.85182345", "0.84936565", "0.8475531", "0.8475531", "0.8466132", "0.8449126", "0.84490585...
0.0
-1
Initializes a new repository object
def initialize(*) super @relations = {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(repository)\n @repository = repository\n end", "def initialize(repository)\n @repository = repository\n end", "def initialize\n @configuration = RepositoryConfiguration.new\n end", "def initialize(repository)\n @repository = repository.readonly(true)\n end",...
[ "0.78154135", "0.7779593", "0.7713175", "0.74689466", "0.7456473", "0.7456473", "0.7451113", "0.7124649", "0.71085906", "0.70643055", "0.7055755", "0.7039993", "0.69982666", "0.6991273", "0.69434166", "0.68128306", "0.6800334", "0.67842865", "0.6769872", "0.6724756", "0.67193...
0.0
-1
Open a database transaction
def transaction(gateway: :default, **opts, &block) container.gateways[gateway].transaction(**opts, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_db_transaction\n @transaction = @connection.transaction('READ COMMITTED')\n end", "def open( tran: false, mode: :immediate ) # tran = true transaction\n #DBlog::stoD( parse_caller( caller.first ) ) if $debug == true\n @db = SQLite3::Database.new( @DBfile )\n @db.busy_timeout(...
[ "0.7429992", "0.7423955", "0.74046993", "0.7399045", "0.72763133", "0.72763133", "0.7245745", "0.7155892", "0.7155892", "0.7141348", "0.71261126", "0.70975685", "0.709488", "0.70160407", "0.6932359", "0.6906432", "0.6842205", "0.6820648", "0.6799601", "0.67520446", "0.674477"...
0.0
-1
Return a string representation of a repository object
def inspect %(#<#{self.class} struct_namespace=#{struct_namespace} auto_struct=#{auto_struct}>) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n \"#<DataMapper::Repository:#{@name}>\"\n end", "def to_s\n \"#{@timestamp}/#{@repo_name}/#{@sha}\"\n end", "def to_s\n @object.to_s\n end", "def get_repository_name(fedora_obj)\n return (get_coll_field_val(fedora_obj, :repository))\n end", "def to_s\n object.to_s\n ...
[ "0.8041432", "0.68100727", "0.675799", "0.673296", "0.6664463", "0.65978956", "0.6470836", "0.64097756", "0.6317016", "0.62398905", "0.6229984", "0.619932", "0.6189051", "0.61668855", "0.6157445", "0.6146853", "0.6133971", "0.61179614", "0.6057483", "0.60539395", "0.6013559",...
0.0
-1
Start a session for multiple changesets TODO: this is partly done, needs tweaks in changesets so that we can gather command results and return them in a nice way
def session session = Session.new(self) yield(session) transaction { session.commit! } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup\n group.each do |name, windows|\n next if options[:group] && name != options[:group]\n\n setup_session(name)\n\n windows.each_with_index do |win, i|\n setup_window(win, i)\n end\n\n add_command(:screen, 'select %s', screen_group.primary_pos)\n\n break\n end\n e...
[ "0.5645038", "0.5600603", "0.5377771", "0.53406185", "0.53059053", "0.5289312", "0.5191998", "0.51773614", "0.51625484", "0.51412654", "0.5111186", "0.51035756", "0.5072905", "0.50672936", "0.505797", "0.50386107", "0.503538", "0.50266045", "0.5006522", "0.5006522", "0.500652...
0.0
-1
Default options for Faraday::Connection
def connection_options { headers: { accept: default_media_type, user_agent: user_agent } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def faraday_options(options)\n {\n url: options[:url] + options[:path],\n proxy: faraday_proxy(options),\n ssl: faraday_ssl(options),\n headers: faraday_headers(options),\n request: faraday_request(options),\n }\n end", "def faraday_options(options)...
[ "0.7651207", "0.760284", "0.75656676", "0.75241506", "0.70591694", "0.6994", "0.6987868", "0.6987868", "0.6961589", "0.69589657", "0.69331485", "0.68425536", "0.6807153", "0.6806274", "0.6788857", "0.6740763", "0.67312825", "0.67238283", "0.6702927", "0.66781044", "0.6674413"...
0.69471544
11
Default pagination page size from ENV
def per_page page_size = ENV['BETTERY_PER_PAGE'] page_size.to_i if page_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_page_size\n 10\n end", "def default_page_size\n 50\n end", "def default_page_size\n PAGE_SIZE\n end", "def page_size\n params[:page] ? ( params[:page][:size] || Kaminari.config.default_per_page ) : Kaminari.config.default_per_page\n end", "def default_page_size\n 1000...
[ "0.8291398", "0.8285217", "0.818029", "0.81307906", "0.8097831", "0.80408156", "0.79253036", "0.7858203", "0.7653131", "0.76110643", "0.75804263", "0.7566498", "0.7503985", "0.7473855", "0.74668884", "0.7449633", "0.737427", "0.7351559", "0.7349721", "0.7216392", "0.7211626",...
0.6852504
43
Default proxy server URI for Faraday connection from ENV
def proxy ENV['BETTERY_PROXY'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def proxy_uri\n @proxy_uri ||= URI.parse(config(\"proxy-uri\"))\n end", "def proxy_address\n ENV[\"CHEF_API_PROXY_ADDRESS\"] || config[\"CHEF_API_PROXY_ADDRESS\"]\n end", "def proxy_uri; end", "def proxy_uri; end", "def proxy_address\n proxy? ? @options['proxy_address'] || '127.0.0.1' ...
[ "0.77360255", "0.72393674", "0.7168235", "0.7168235", "0.7166198", "0.71229726", "0.70860726", "0.7080839", "0.70665234", "0.70284176", "0.70121634", "0.69170314", "0.6909922", "0.68941987", "0.68810576", "0.68810576", "0.68810576", "0.68810576", "0.6817024", "0.68058485", "0...
0.6930492
11
The auth token in this URL is mine. It is recommended that you use your own auth token.
def get_module_info(mod) pull_url = "https://api.github.com/repos/puppetlabs/puppetlabs-#{mod.name}/issues?state=open&access_token=AUTHTOKEN" response = HTTParty.get pull_url#, :headers=>{"Authorization"=>"Token token=\"AUTHTOKEN\"", "User-Agent"=>"craig.gomes"} json = JSON.parse(response.body) ticket_count = get_ticket_count_for_module(mod.name) component_count = get_component_count_for_module(mod.name) p mod.name return ["#{mod.name}", "#{json.length}","#{ticket_count}","#{component_count}","#{mod.supported}", "#{mod.homepage_url}"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def auth_query\n \"?login=fcoury&token=8f700e0d7747826f3e56ee13651414bd\"\n end", "def auth_token\n @@auth_token\n end", "def http_auth_token\n @http_auth_token ||= if request.headers['Authorization'].present?\n request.headers['Authorization'].split(' ').last\n end\n end", "def auth_...
[ "0.74051106", "0.72607785", "0.7166069", "0.7158632", "0.7152467", "0.71464485", "0.71252185", "0.71212006", "0.7102885", "0.7093094", "0.7042155", "0.7017045", "0.7013346", "0.7001659", "0.70002234", "0.70001745", "0.699128", "0.6968728", "0.694033", "0.6934056", "0.69110364...
0.0
-1
2. define method 'yeller'
def yeller(array) array.join.upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartman(kenny)\n\nend", "def word_yeller(sentence)\n\n\nend", "def food_and_drink; end", "def king_richard_iii; end", "def jack_handey; end", "def yoda; end", "def weber; end", "def market\n end", "def kitten\n end", "def people_who_can_buy_beer(people)\nend", "def y\n end", "def s...
[ "0.6525506", "0.6385477", "0.62796783", "0.62690187", "0.6263288", "0.62543666", "0.62497926", "0.6209043", "0.61982507", "0.6191578", "0.61514384", "0.6130873", "0.6121399", "0.61116207", "0.61007494", "0.60944116", "0.60944116", "0.6049283", "0.6026287", "0.60199165", "0.60...
0.0
-1
OLD 3. return a randomly generated string of 8 letters.
def random_subdomain ('a'..'z').to_a.shuffle[0..7].join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_string\n (0...8).map { (65 + rand(26)).chr }.join\n end", "def randomString\r\n\t(0...8).map{(65+rand(26)).chr}.join\r\nend", "def generate_string\n (0...6).map{(65+rand(26)).chr}.join\n end", "def get_random_string(length=8)\n string = \"\"\n chars = (\"a\"..\"z\").to_a\n len...
[ "0.89523196", "0.87569964", "0.86269563", "0.85757023", "0.85694283", "0.8549885", "0.8549885", "0.8476012", "0.8419524", "0.8407083", "0.83305997", "0.82793474", "0.8261408", "0.8238449", "0.8154913", "0.81340396", "0.81277746", "0.8121198", "0.81160164", "0.8116002", "0.811...
0.0
-1
clean up unused instances that were prelaunched
def shutdown @cache.each_value do |c| c.stop c.teardown end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purge_instances!\n @@instances = [] and true\n end", "def finalize()\n # below function is not yet fully functional\n unlock_all_instances()\n end", "def cleanup\n @omicli_pgids.each do |pgid|\n `pkill -KILL -g #{pgid}`\n end\n @omicli_pgids.clear\n end", "def ...
[ "0.7683814", "0.7169009", "0.71030456", "0.6894109", "0.6857791", "0.6852686", "0.6794629", "0.6794629", "0.6794629", "0.6794629", "0.67801636", "0.67801636", "0.6734222", "0.6686754", "0.6686754", "0.6686754", "0.66711843", "0.66711843", "0.66711843", "0.66711843", "0.665666...
0.0
-1
A way of setting aside some code for future use define methods first
def hello puts "Hello Dude!!!" puts "Hellod Douchebag!!!" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define; end", "def define\n end", "def define\n end", "def define_helpers; end", "def autofinish=(_arg0); end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def macro; raise NotImplementedError; end", "def custom; end", "def custom; end", ...
[ "0.71588063", "0.6930309", "0.6930309", "0.67067754", "0.6158454", "0.61220056", "0.61220056", "0.61220056", "0.61219245", "0.61219245", "0.60488665", "0.6048857", "0.6048857", "0.603878", "0.60199606", "0.60066706", "0.59749013", "0.5923875", "0.5915176", "0.5894124", "0.588...
0.0
-1
if x is divisible by 3 return fizz if divisable by 5 return buzz if not divisable by either return nothing
def fizzbuzz(x) if x % 3== 0 && x % 5== 0 "FizzBuzz" elsif x % 3 == 0 "Fizz" elsif x % 5 == 0 "Buzz" else end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fizzbuzz(number)\n #if the number is divisible by both 3 and 5\n if number % 3 == 0 && number % 5 == 0\n \"FizzBuzz\"\n #else div by only 3\n elsif number % 3 == 0\n \"Fizz\"\n #else div by only 5\n elsif number % 5 == 0\n \"Buzz\"\n #else nil\n end\nend", "def fizzbuzz(num)\n if num % 3 ==...
[ "0.86647487", "0.8406497", "0.8352032", "0.8346881", "0.833436", "0.8323967", "0.83207345", "0.8301708", "0.82895774", "0.8280404", "0.827143", "0.82621235", "0.825573", "0.82554805", "0.82499844", "0.8229034", "0.8216233", "0.8182084", "0.8166908", "0.81608653", "0.81584525"...
0.822101
16
Create a new Disowned method.
def initialize(receiver, method_name, binding=nil) @receiver, @name = receiver, method_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(*)\n unavailable_method\n end", "def create(*)\n unavailable_method\n end", "def create(*)\n unavailable_method\n end", "def create(*)\n unavailable_method\n end", "def create(*)\n unavailable_method\n end", "def create!(*)\n u...
[ "0.60340863", "0.60339975", "0.60339975", "0.60339975", "0.60339975", "0.59559894", "0.58924675", "0.58798814", "0.5598794", "0.5598183", "0.5598183", "0.5598183", "0.5598183", "0.5598183", "0.5598183", "0.5572457", "0.5474228", "0.5445108", "0.5427639", "0.5309648", "0.52235...
0.0
-1
Is the method undefined? (aka `Disowned`)
def undefined? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def absent?; end", "def method_undefined(*) end", "def method_missing(*)\n invertable nil\n end", "def delete\n unavailable_method\n end", "def !\n !__getobj__\n end", "def unrealize_self\n raise NotImplementedError\n end", "def undef_method (sym) end", "def unused\n end"...
[ "0.6687545", "0.6665963", "0.66466933", "0.66415894", "0.6560168", "0.6551321", "0.6500626", "0.64555717", "0.6392588", "0.633796", "0.6335878", "0.63234323", "0.6282823", "0.62622005", "0.6255246", "0.6252727", "0.6221385", "0.62190926", "0.6209485", "0.61924416", "0.6192441...
0.5659593
82
Can we get the source for this method?
def source? false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "...
[ "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.8035403", "0.77874094", "0.7714847", "0.7664214", "0.7626701", ...
0.0
-1
Get the hypothesized owner of the method.
def owner class << receiver; self; end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner\n method_object && method_object.owner\n end", "def owner\n user\n end", "def owner\n user\n end", "def owner\n get_user owner_id\n end", "def owner\n @owner\n end", "def owner\n return @owner\n end", "def owner\n return...
[ "0.7209028", "0.68178785", "0.68178785", "0.67051864", "0.66931456", "0.66698176", "0.66698176", "0.66698176", "0.66698176", "0.66698176", "0.6622902", "0.6539869", "0.6536358", "0.6510767", "0.64882594", "0.64798313", "0.64102745", "0.64092344", "0.6371441", "0.6342556", "0....
0.0
-1
Raise a more useful error message instead of trying to forward to nil.
def method_missing(meth_name, *args, &block) raise "Cannot call '#{meth_name}' on an undef'd method." if method(:name).respond_to?(meth_name) Object.instance_method(:method_missing).bind(self).call(meth_name, *args, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def errback &block\n super\n end", "def errback &block\n super\n end", "def check_and_raise( err_ptr )\n return if err_ptr.null?\n raise specific_error_class( err_ptr ).new( err_ptr.message )\n end", "def original_error; end", "def original_error; end", "def wont_be_nil...
[ "0.6399342", "0.6399342", "0.6339612", "0.6253238", "0.6253238", "0.6189995", "0.6171289", "0.6171289", "0.6171289", "0.61296624", "0.6113887", "0.6074264", "0.6055598", "0.60311055", "0.59805125", "0.59805125", "0.59781027", "0.59639627", "0.59539783", "0.59393954", "0.59284...
0.0
-1
Dirty hack but if something call .reload in after_save callback > all changes are lost. See: nested set or notification sending
def prepare_reallocate_resources @__alloc_changes = changes.keys & ['assigned_to_id', 'start_date', 'due_date', 'estimated_hours', 'status_id'] if @custom_resource_allocator_changed @__alloc_changes << 'custom_resource_allocator' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_save\n reload\n end", "def reload!\n clear_changes_information\n self.exclude_from_save = false\n end", "def save_and_reload! model\n model.save!\n model.reload\nend", "def reload(*)\n super.tap do\n @mutations_before_last_save = nil\n @mutations_from_dat...
[ "0.7648201", "0.7627154", "0.71173316", "0.69068", "0.687985", "0.6804234", "0.67527425", "0.67414093", "0.6715457", "0.67055976", "0.66799164", "0.66799164", "0.66490406", "0.663182", "0.6629033", "0.6613637", "0.6571365", "0.6571365", "0.6524271", "0.65115106", "0.6510884",...
0.0
-1
def user object.user N+1 queries end
def user batch_load_one(object.user_id, 'User') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_query(username, access_type, operation, desired_object ,query)\n if(@dbiacl.check(username, access_type, operation, desired_object))\n r = @m.query(query)\n # r.each_hash do |f|\n # print \"#{f['name']} - #{f['email']}\"\n # end\n end\n return r\n end", "de...
[ "0.6448529", "0.64084643", "0.64084643", "0.6243765", "0.61985296", "0.618036", "0.6176715", "0.61582017", "0.61478835", "0.6137079", "0.6137079", "0.61060697", "0.6093369", "0.60785705", "0.6064956", "0.6024913", "0.6023018", "0.6023018", "0.6019539", "0.60179293", "0.601746...
0.6294219
3
GET /materia GET /materia.xml
def index @materia = Materium.where(:year => session[:current_year]).order(:nombre, :nivel) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @materia } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @materia }\n end\n end", "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.x...
[ "0.74991584", "0.74991584", "0.6888102", "0.6888102", "0.68567985", "0.67294693", "0.6680062", "0.667243", "0.66671544", "0.65922743", "0.6555439", "0.6530608", "0.65276414", "0.6513074", "0.6502829", "0.64870316", "0.64668703", "0.64561915", "0.64557415", "0.6443282", "0.643...
0.69898134
2
GET /materia/1 GET /materia/1.xml
def show @materium = Materium.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @materium } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @materia }\n end\n end", "def show\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.x...
[ "0.7520348", "0.7520348", "0.7048692", "0.6974221", "0.68667465", "0.68667465", "0.68316644", "0.68286896", "0.6723846", "0.6628334", "0.65829647", "0.65809447", "0.654361", "0.6542916", "0.65104425", "0.65015405", "0.6498743", "0.64903754", "0.6481528", "0.6462233", "0.64584...
0.6850224
6
GET /materia/new GET /materia/new.xml
def new @materium = Materium.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @materium } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @materia = Materia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @materia }\n end\n end", "def new\n @materia = Materia.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @materia }\...
[ "0.80594015", "0.80594015", "0.76362944", "0.75347215", "0.7522937", "0.74842083", "0.7464752", "0.74629605", "0.74568707", "0.7449294", "0.7430411", "0.74292177", "0.7403242", "0.7390172", "0.7351446", "0.7340527", "0.73365796", "0.7325003", "0.73210865", "0.73209804", "0.73...
0.7331101
17
POST /materia POST /materia.xml
def create @materium = Materium.new(params[:materium]) respond_to do |format| if @materium.save format.html { redirect_to(@materium, :notice => 'Materium was successfully created.') } format.xml { render :xml => @materium, :status => :created, :location => @materium } else format.html { render :action => "new" } format.xml { render :xml => @materium.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @materia = Materia.new(params[:materia])\n\n respond_to do |format|\n if @materia.save\n format.html { redirect_to(@materia, :notice => 'Materia was successfully created.') }\n format.xml { render :xml => @materia, :status => :created, :location => @materia }\n else\n ...
[ "0.67978483", "0.6782193", "0.6530069", "0.64196175", "0.6409381", "0.6401012", "0.6355132", "0.6355132", "0.6354216", "0.63147163", "0.6305745", "0.62965864", "0.62828165", "0.60198677", "0.59859717", "0.598499", "0.5971275", "0.5963085", "0.5957655", "0.59524435", "0.595111...
0.6127305
13
PUT /materia/1 PUT /materia/1.xml
def update @materium = Materium.find(params[:id]) respond_to do |format| if @materium.update_attributes(params[:materium]) format.html { redirect_to(@materium, :notice => 'Materium was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @materium.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @materia = Materia.find(params[:id])\n\n respond_to do |format|\n if @materia.update_attributes(params[:materia])\n format.html { redirect_to(@materia, :notice => 'Materia was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :actio...
[ "0.68901396", "0.6813191", "0.66474587", "0.6602974", "0.658214", "0.64215106", "0.63441974", "0.63232327", "0.62864774", "0.62859803", "0.6242237", "0.60048896", "0.5973258", "0.5964128", "0.59548974", "0.5939195", "0.5924124", "0.59172124", "0.5916784", "0.5901217", "0.5893...
0.62457573
10
DELETE /materia/1 DELETE /materia/1.xml
def destroy @materium = Materium.find(params[:id]) @materium.destroy respond_to do |format| format.html { redirect_to(materia_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @materia = Materia.find(params[:id])\n @materia.destroy\n\n respond_to do |format|\n format.html { redirect_to(materie_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @materia = Materia.find(params[:id])\n @materia.destroy\n\n respond_to do |format|\n ...
[ "0.7273359", "0.72649133", "0.6908274", "0.6865639", "0.6832522", "0.6804335", "0.6782122", "0.67646706", "0.67213166", "0.67146176", "0.67145985", "0.6714491", "0.6695394", "0.66817915", "0.66738456", "0.6673688", "0.6673511", "0.6673331", "0.66610664", "0.66531074", "0.6649...
0.7115544
2
Business Hours Rule On Routing Extension Routing Extension, Set to Final Default Extension ID
def updateAnsweringRuleOnRoutingExt(client, accountId, extensionId, answeringRuleId, forwardingNumberId) body = { 'enabled' => true, 'forwarding' => { 'notifyMySoftPhones' => true, 'softPhonesRingCount' => 5, 'ringingMode' => 'Sequentially', 'rules': [{ 'index': 1, 'ringCount': 3, 'forwardingNumbers' => [{ 'id' => forwardingNumberId }], }] } } client.http.put do |req| req.url "account/#{accountId}/extension/#{extensionId}/answering-rule/#{answeringRuleId}" req.headers['Content-Type'] = 'application/json' req.body = body end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real_remaining_path\n if defined?(@type_routing_extension)\n \"#{super}.#{@type_routing_extension}\"\n else\n super\n end\n end", "def routing_number; end", "def set_ht_route\n @ht_route = HtRoute.find(params[:id])\n end", "def create_defaul...
[ "0.5634275", "0.5488147", "0.5370173", "0.5027813", "0.4952811", "0.49217728", "0.49217728", "0.4918037", "0.49072945", "0.48810124", "0.48286378", "0.48030975", "0.47924358", "0.47849363", "0.47730657", "0.47472847", "0.47395438", "0.47367376", "0.47367376", "0.47367376", "0...
0.581931
0
GET /forums GET /forums.json
def index @forums = Forum.all @active_forums = @forums.select {|f| f.active? } @inactive_forums = @forums.reject {|f| f.active? } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\t@forums = Forum.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @forums }\n\t\tend\n\tend", "def forum_get(args)\n JSON.parse(HelpSpot.api_request('forums.get', 'GET', :xForumId => args[:forum_id])) rescue []\n end", "def GetForum i...
[ "0.77671856", "0.7589745", "0.75184065", "0.7478817", "0.71539265", "0.70286196", "0.70286196", "0.70286196", "0.70286196", "0.69910944", "0.69214654", "0.6826549", "0.6737704", "0.6723822", "0.66040236", "0.65955234", "0.6527513", "0.65156513", "0.6502173", "0.650166", "0.64...
0.54795986
85
GET /forums/1 GET /forums/1.json
def show @discussions = @forum.all_discussions end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetForum id\n\n APICall(path: \"forums/#{id}.json\")\n\n end", "def forum_get(args)\n JSON.parse(HelpSpot.api_request('forums.get', 'GET', :xForumId => args[:forum_id])) rescue []\n end", "def index\n\t\t@forums = Forum.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.e...
[ "0.80483717", "0.77152747", "0.7313871", "0.71460074", "0.7081574", "0.7057418", "0.70316064", "0.6988228", "0.69636196", "0.69636196", "0.69636196", "0.69636196", "0.69073516", "0.68871516", "0.67803884", "0.66700923", "0.66284996", "0.6587918", "0.65219617", "0.6515494", "0...
0.63640153
25
POST /forums POST /forums.json
def create @forum = Forum.new(forum_params) respond_to do |format| if @forum.save format.html { redirect_to @forum, notice: 'Forum was successfully created.' } format.json { render action: 'show', status: :created, location: @forum } else format.html { render action: 'new' } format.json { render json: @forum.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateForum params = {}\n \n APICall(path: 'forums.json',method: 'POST',payload: params.to_json)\n \n end", "def create_forum payload\n\t\t\t\t\tFreshdesk::Api::Client.convert_to_hash( @connection.post FORUMS, payload )\n\t\t\t\tend", "def create\n @forum = current_user.forums....
[ "0.7769464", "0.71131074", "0.70347774", "0.66510326", "0.65875685", "0.6508725", "0.6441141", "0.64038736", "0.63890857", "0.6381768", "0.6354872", "0.6338031", "0.6334574", "0.6286549", "0.62624896", "0.62036484", "0.61879236", "0.6183256", "0.61754733", "0.6157315", "0.607...
0.63347995
15
PATCH/PUT /forums/1 PATCH/PUT /forums/1.json
def update respond_to do |format| if @forum.update(forum_params) format.html { redirect_to @forum, notice: 'Forum was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @forum.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateForum id,params = {}\n \n APICall(path: \"forums/#{id}.json\",method: 'PUT',payload: params.to_json)\n \n end", "def update\n respond_to do |format|\n if @forum.update(forum_params)\n format.html { redirect_to forums_path, notice: 'Forum was successfully updated...
[ "0.7765339", "0.67594767", "0.6744013", "0.66692525", "0.66692525", "0.6612298", "0.6607951", "0.6603421", "0.65492445", "0.6547927", "0.65228397", "0.6488434", "0.6464664", "0.6450372", "0.64114004", "0.6382695", "0.6382495", "0.63658255", "0.63304347", "0.6318452", "0.63144...
0.6724261
5
DELETE /forums/1 DELETE /forums/1.json
def destroy @forum.destroy respond_to do |format| format.html { redirect_to forums_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteForum id\n \n APICall(path: \"forums/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @wforum = Wforum.find_by_permalink(params[:id])\n @wforum.destroy\n\n respond_to do |format|\n format.html { redirect_to wforums_url }\n format.json { head :no_cont...
[ "0.8212511", "0.7490235", "0.747481", "0.74232835", "0.74168694", "0.7356195", "0.7347033", "0.7343226", "0.7335497", "0.73206633", "0.73198986", "0.73194206", "0.729178", "0.72830653", "0.7260724", "0.72570455", "0.72470033", "0.72263837", "0.7223452", "0.7210815", "0.718429...
0.75450146
5
Use callbacks to share common setup or constraints between actions.
def set_forum @forum = Forum.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 forum_params params[:forum] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
GET /posters GET /posters.json
def index @posters = Poster.where(approved: true).all @categories = Category.all @locations = Location.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @prayers = Prayer.all\n render json: @prayers, status: 200 # you've got a serializer. Maybe you should use it.\n end", "def index\n @prayers = Prayer.where(\"user_id = ?\", getUser())\n\n @prayer_requests = PrayerRequest.all \n respond_to do |format|\n format.html # index....
[ "0.6492227", "0.64519024", "0.6372108", "0.63674825", "0.62877756", "0.62757397", "0.6261607", "0.6206438", "0.61979955", "0.61873585", "0.61779755", "0.6175557", "0.61144197", "0.6103919", "0.6091849", "0.60835344", "0.6067138", "0.60257983", "0.60252786", "0.60235095", "0.6...
0.59077644
34
GET /posters/1 GET /posters/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @prayers = Prayer.all\n @prayer = Prayer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @prayer }\n end\n end", "def show\n @porter = Porter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html...
[ "0.63389957", "0.6267022", "0.6163562", "0.61591285", "0.61516", "0.6143083", "0.61342615", "0.6134226", "0.61170596", "0.6108335", "0.6099202", "0.60655844", "0.60369974", "0.6035891", "0.601802", "0.60108143", "0.599285", "0.597659", "0.59605455", "0.59497595", "0.5930816",...
0.0
-1
POST /posters POST /posters.json
def create @poster = Poster.new(poster_params) @poster.user = current_user flash[:notice] = 'Your post has been submitted for review.' respond_to do |format| if @poster.save if params[:photos_attributes] params[:photos_attributes].each do |photo| @poster.photos.create(posterimage: photo[:posterimage]) end end format.html { redirect_to '/', notice: 'Poster was successfully created.' } format.json { render :show, status: :created, location: @poster } else format.html { render :new } format.json { render json: @poster.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_senders(sender_request, opts = {})\n data, _status_code, _headers = post_senders_with_http_info(sender_request, opts)\n data\n end", "def post(id, opts = {})\r\n uri = url_for(\"posts/#{id}\", opts)\r\n response = RestClient.get(uri)\r\n JSON.parse response\r\n end...
[ "0.6027802", "0.56225634", "0.5572578", "0.5540831", "0.5540316", "0.5536913", "0.55198956", "0.5517669", "0.54976445", "0.54922265", "0.54876053", "0.54649925", "0.5457953", "0.5457556", "0.5455206", "0.5442397", "0.54245526", "0.5420138", "0.54152286", "0.5403856", "0.53894...
0.5879894
1
PATCH/PUT /posters/1 PATCH/PUT /posters/1.json
def update respond_to do |format| if @poster.update(poster_params) if params[:photos_attributes] params[:photos_attributes].each do |photo| @poster.photos.create(posterimage: photo[:posterimage]) end end format.html { redirect_to '/', notice: 'Poster was successfully updated.' } format.json { render :show, status: :ok, location: @poster } else format.html { render :edit } format.json { render json: @poster.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "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 ...
[ "0.6526372", "0.6230447", "0.6124927", "0.60581064", "0.6022663", "0.60208565", "0.6003836", "0.5995444", "0.5995444", "0.5995444", "0.59853554", "0.5956184", "0.5886914", "0.58769196", "0.5874617", "0.58469063", "0.5840089", "0.5830842", "0.58108616", "0.5809691", "0.5800991...
0.5923922
12
DELETE /posters/1 DELETE /posters/1.json
def destroy @poster.destroy respond_to do |format| format.html { redirect_to '/', notice: 'Poster was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.html { redirect_to posts_path(client_id:current_user.client.id, per_page:5), notice: 'Post was successfully destroyed.' }\n format.json { head :no_content }\n end\n ...
[ "0.71780276", "0.70600355", "0.6949845", "0.6826422", "0.6807521", "0.6799978", "0.67610455", "0.6758723", "0.67414856", "0.6692695", "0.66721475", "0.66622865", "0.66622865", "0.6660707", "0.6654109", "0.66533566", "0.66470915", "0.6626429", "0.6619062", "0.6617008", "0.6602...
0.68664575
3
Use callbacks to share common setup or constraints between actions.
def set_poster @poster = Poster.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 poster_params params.require(:poster).permit(:title, :description, :company, :place, :phone1, :phone2, :price, :negotiate, :area_ids, :category_ids, :location_ids, :photos_attributes => [:posterimage]) 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
======FOR ASSET LOAN KEWPA 6 AND is_approved!=?
def loandetails a='id=? ' if AssetLoan.find(:all,:conditions=>['loaned_on>=? AND is_approved!=?',loandate, false]).map(&:asset_id).uniq.count!=0 #0.upto(AssetLoan.find(:all,:conditions=>['loaned_on=?',"2013-04-23"]).map(&:id).uniq.count-2) do |l| 0.upto(AssetLoan.find(:all,:conditions=>['loaned_on>=? AND is_approved!=?',loandate, false]).map(&:asset_id).uniq.count-2) do |l| a=a+'OR id=? ' end return a if (loandate.blank? == false && loanedasset == 1) #0) #unless loandate.blank? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approved?\n Weam.match('aprvd', poo_status) && \n !Weam.match(\"^(#{ALC1}|#{ALC2})\", applicable_law_code) &&\n (\n institution_of_higher_learning_indicator || \n ojt_indicator ||\n correspondence_indicator ||\n flight_indicator ||\n non_college_degree_indicator\...
[ "0.59816444", "0.5873816", "0.58157796", "0.5809474", "0.5637431", "0.5637431", "0.5634929", "0.5634248", "0.5632441", "0.55600595", "0.5537393", "0.5534149", "0.5515747", "0.5499011", "0.54926693", "0.5473461", "0.5461747", "0.544353", "0.5443468", "0.5441663", "0.5439955", ...
0.0
-1
====expectedreturndate2 newly added30July2013 tick to display all asset loan records
def loanedasset_details a='id=? ' if AssetLoan.all.map(&:asset_id).uniq.count!=0 0.upto(AssetLoan.all.map(&:asset_id).uniq.count-2) do |l| a=a+'OR id=? ' end return a if loanedasset == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def loandetails\n a='id=? ' if AssetLoan.find(:all,:conditions=>['loaned_on>=? AND is_approved!=?',loandate, false]).map(&:asset_id).uniq.count!=0\n #0.upto(AssetLoan.find(:all,:conditions=>['loaned_on=?',\"2013-04-23\"]).map(&:id).uniq.count-2) do |l|\n 0.upto(AssetLoan.find(:all,:conditions=>['loaned_on...
[ "0.6062456", "0.6005519", "0.58522284", "0.58172584", "0.58135104", "0.5783308", "0.5753155", "0.57522273", "0.57163274", "0.56729865", "0.56366915", "0.56255764", "0.5592914", "0.55835944", "0.55682385", "0.5520821", "0.5517581", "0.55060077", "0.55035543", "0.54831094", "0....
0.0
-1
tick to display all asset defect records
def alldefectasset_details a='id=? ' if AssetDefect.all.map(&:asset_id).uniq.count!=0 0.upto(AssetDefect.all.map(&:asset_id).uniq.count-2) do |l| a=a+'OR id=? ' end return a if alldefectasset == 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @asset_disposal_entries = AssetDisposalEntry.all\n end", "def index\n set_trading_account_budget_records_grid\n end", "def all_ticket_entries\n @ac = ApplicationController.new\n @tickets = Ticket.find(:all, :order => \"created_at\")[0..5000].reverse!\n @species = Specie.all\n @woodt...
[ "0.6495697", "0.62489504", "0.62071526", "0.61724216", "0.61014193", "0.6074935", "0.60663974", "0.60411227", "0.6013329", "0.60127604", "0.5998937", "0.5998937", "0.5998891", "0.5971256", "0.59626615", "0.5951605", "0.5946266", "0.59456193", "0.5940919", "0.59346694", "0.592...
0.0
-1
def assignedtodetails a='assignedto_id=? AND id=? ' if AssetDefect.all.map(&:asset_id).count!=0 0.upto(AssetDefect.all.map(&:asset_id).count2) do |l| a=a+'OR id=? ' end return a unless assignedto.blank? end
def assignedto_conditions #if category == 5 #KEW-PA 7 (search by : assignedto) #["assignedto_id=?", assignedto] unless assignedto.blank? #else #KEW-PA 9 (search by : assignedto) #[assignedtodetails, assignedto,AssetDefect.all.map(&:asset_id)] unless assignedto.blank? #end ["assignedto_id=?", assignedto] unless assignedto.blank? #use this condition WITH FILTER FOR asset in ASSETDEFECT DB only - in show page. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alldefectasset_details\n a='id=? ' if AssetDefect.all.map(&:asset_id).uniq.count!=0\n 0.upto(AssetDefect.all.map(&:asset_id).uniq.count-2) do |l| \n a=a+'OR id=? '\n end\n return a if alldefectasset == 1 \n end", "def loanedasset_details\n a='id=? ' if AssetLoan.all.map(&:asset_id).uniq...
[ "0.75788325", "0.71047366", "0.6773451", "0.59123695", "0.5895852", "0.5824576", "0.5414376", "0.53935033", "0.53726315", "0.52707154", "0.51866716", "0.51611304", "0.5149515", "0.51391417", "0.5118654", "0.51050735", "0.50372905", "0.4998662", "0.4992573", "0.49617854", "0.4...
0.8031737
0
def disposaltype_details a='id=? ' if AssetDisposal.find(:all, :conditions=>['disposal_type=?', disposaltype]).map(&:asset_id).uniq.count!=0 0.upto(AssetDisposal.find(:all, :conditions=>['disposal_type=?', disposaltype]).map(&:asset_id).uniq.count2) do |l| a=a+'OR id=? ' end return a unless disposaltype.blank? end def disposaltype_conditions [disposaltype_details, AssetDisposal.find(:all, :conditions=>['disposal_type=?',disposaltype]).map(&:asset_id)] unless disposaltype.blank? end
def orders "assetcode ASC"# "staffgrade_id ASC" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alldefectasset_details\n a='id=? ' if AssetDefect.all.map(&:asset_id).uniq.count!=0\n 0.upto(AssetDefect.all.map(&:asset_id).uniq.count-2) do |l| \n a=a+'OR id=? '\n end\n return a if alldefectasset == 1 \n end", "def loanedasset_details\n a='id=? ' if AssetLoan.all.map(&:asset_id).uniq...
[ "0.738523", "0.72795516", "0.66131985", "0.6555838", "0.6540959", "0.65148133", "0.63788414", "0.6116723", "0.5931683", "0.5751097", "0.5703716", "0.564441", "0.56172866", "0.5595794", "0.5594281", "0.55775625", "0.5563058", "0.5547305", "0.55338943", "0.55338943", "0.5494575...
0.0
-1
NOTE: this is an idea. let it sit.
def if_changed [ "init", "add .", "commit -m 'Initialize project'" ].each do |cmd| add Config::Patterns::Git do |git| git.dir = root git.cmd = cmd end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def anchored; end", "def suivre; end", "def refutal()\n end", "def weber; end", "def placebo?; false end", "def internal; end", "def implementation; ...
[ "0.7414521", "0.67107975", "0.65236074", "0.619586", "0.619586", "0.619586", "0.619586", "0.615412", "0.6149828", "0.6107761", "0.6039301", "0.5976863", "0.5929825", "0.591836", "0.591836", "0.5911261", "0.5828209", "0.5828209", "0.58244807", "0.58168507", "0.5809065", "0.5...
0.0
-1
GET /phlogs/new GET /phlogs/new.json
def new @phlog = Phlog.new(key: params[:key]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @wr_log = WrLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wr_log }\n end\n end", "def new\n @log = Log.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @log }\n end\n end", ...
[ "0.73567116", "0.7352432", "0.7102407", "0.70074123", "0.70072746", "0.7006068", "0.69814754", "0.6919451", "0.69074595", "0.69056123", "0.689788", "0.6839328", "0.6838484", "0.6833901", "0.6769273", "0.67546266", "0.67546266", "0.67447776", "0.67211604", "0.6717333", "0.6708...
0.6589933
30
POST /phlogs POST /phlogs.json
def create @phlog = Phlog.new(params[:phlog]) if @phlog.save flash[:notice] = "Successfully created phlog." redirect_to @phlog.gallery else render :action => 'new' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @phlog = Phlog.new(params[:phlog])\n if @phlog.save\n redirect_to phlogs_url, notice: \"Phlog was successfully created.\"\n else\n render :action => 'new'\n end\n end", "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def webhook\n ...
[ "0.67758965", "0.66143197", "0.63576525", "0.6305752", "0.6267546", "0.6149505", "0.60818344", "0.6065711", "0.598061", "0.594591", "0.59213877", "0.58886683", "0.58800817", "0.58603555", "0.5806258", "0.58053076", "0.5800786", "0.5768701", "0.5733917", "0.5706374", "0.570637...
0.57790595
17
PUT /phlogs/1 PUT /phlogs/1.json
def update @phlog = Phlog.find(params[:id]) if @phlog.update_attributes(params[:phlog]) flash[:notice] = "Successfully updated phlog." redirect_to @phlog.gallery else render :action => 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @phlog = Phlog.find(params[:id])\n\n respond_to do |format|\n if @phlog.update_attributes(params[:phlog])\n format.html { redirect_to @phlog, notice: 'Phlog was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit...
[ "0.6772466", "0.6502963", "0.6170802", "0.6148854", "0.6130955", "0.6104006", "0.6041727", "0.5878648", "0.5862576", "0.5809563", "0.5796076", "0.5793399", "0.5788915", "0.5788915", "0.5788915", "0.5771575", "0.5769294", "0.5739362", "0.5720441", "0.571039", "0.56959486", "...
0.5749367
17
GET /user_scaffolds GET /user_scaffolds.json
def index @user_scaffolds = UserScaffold.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user_scaffold\n @user_scaffold = UserScaffold.find(params[:id])\n end", "def create\n @user_scaffold = UserScaffold.new(user_scaffold_params)\n\n respond_to do |format|\n if @user_scaffold.save\n format.html { redirect_to @user_scaffold, notice: 'User scaffold was successfully c...
[ "0.71268255", "0.7025615", "0.6957724", "0.69060236", "0.66195375", "0.64031965", "0.64018756", "0.6247646", "0.6225047", "0.62123746", "0.6191049", "0.6174215", "0.61104214", "0.6034402", "0.58956623", "0.58525723", "0.5847859", "0.5830183", "0.58225924", "0.5777742", "0.566...
0.79491967
0
GET /user_scaffolds/1 GET /user_scaffolds/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_scaffolds = UserScaffold.all\n end", "def set_user_scaffold\n @user_scaffold = UserScaffold.find(params[:id])\n end", "def show\n @scaffold = Scaffold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @scaffold ...
[ "0.7840442", "0.7331392", "0.7304747", "0.71130127", "0.69395506", "0.6930651", "0.68452346", "0.651927", "0.6517233", "0.64164513", "0.6391002", "0.6337668", "0.62656415", "0.6256001", "0.61278826", "0.6107849", "0.60480547", "0.5996759", "0.5930537", "0.5848001", "0.5843267...
0.0
-1
POST /user_scaffolds POST /user_scaffolds.json
def create @user_scaffold = UserScaffold.new(user_scaffold_params) respond_to do |format| if @user_scaffold.save format.html { redirect_to @user_scaffold, notice: 'User scaffold was successfully created.' } format.json { render :show, status: :created, location: @user_scaffold } else format.html { render :new } format.json { render json: @user_scaffold.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_scaffolds = UserScaffold.all\n end", "def create\n @scaffold = Scaffold.new(params[:scaffold])\n\n respond_to do |format|\n if @scaffold.save\n format.html { redirect_to @scaffold, notice: 'Scaffold was successfully created.' }\n format.json { render json: @scaffold...
[ "0.7332477", "0.7216108", "0.7183677", "0.71055514", "0.6876776", "0.6788956", "0.6589432", "0.6575622", "0.6559148", "0.64171416", "0.639555", "0.6273647", "0.6130545", "0.6116311", "0.6107321", "0.6088", "0.60639757", "0.6059057", "0.5999862", "0.59084094", "0.5792833", "...
0.80203426
0
PATCH/PUT /user_scaffolds/1 PATCH/PUT /user_scaffolds/1.json
def update respond_to do |format| if @user_scaffold.update(user_scaffold_params) format.html { redirect_to @user_scaffold, notice: 'User scaffold was successfully updated.' } format.json { render :show, status: :ok, location: @user_scaffold } else format.html { render :edit } format.json { render json: @user_scaffold.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @scaffold.update(scaffold_params)\n format.html { redirect_to @scaffold, notice: 'Scaffold was successfully updated.' }\n format.json { render :show, status: :ok, location: @scaffold }\n else\n format.html { render :edit }\n format.j...
[ "0.73930776", "0.7361228", "0.6968939", "0.684675", "0.6793502", "0.6719351", "0.67107636", "0.6615852", "0.62241745", "0.62204105", "0.6118944", "0.6099799", "0.6090826", "0.58857167", "0.58297044", "0.57471806", "0.57441616", "0.57380843", "0.57364863", "0.56692004", "0.564...
0.7900175
0
DELETE /user_scaffolds/1 DELETE /user_scaffolds/1.json
def destroy @user_scaffold.destroy respond_to do |format| format.html { redirect_to user_scaffolds_url, notice: 'User scaffold was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @scaffold = Scaffold.find(params[:id])\n @scaffold.destroy\n\n respond_to do |format|\n format.html { redirect_to scaffolds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @scaffold.destroy\n respond_to do |format|\n format.html { redirect_to ...
[ "0.7643237", "0.75120604", "0.742448", "0.7339201", "0.712613", "0.67110455", "0.6545237", "0.6348256", "0.62838", "0.6261423", "0.6248667", "0.62397176", "0.6238693", "0.6231555", "0.6200892", "0.61969596", "0.6194719", "0.6149937", "0.61436146", "0.6111288", "0.61043024", ...
0.8026089
0
Use callbacks to share common setup or constraints between actions.
def set_user_scaffold @user_scaffold = UserScaffold.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 user_scaffold_params params.require(:user_scaffold).permit(:first_name, :last_name, :age, :email) 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
has_one :uploaded_by, serializer: UserSerializer
def filename File.basename(object.asset.path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creator\n UserSerializer.new(object.creator)\n end", "def owner\n OwnerSerializer.new(self.sporting_good.user)\n end", "def user\n UserSerializer.new(object.user).attributes\n end", "def getUploadedBy\r\n\t\t\t\t\treturn @uploadedBy\r\n\t\t\t\tend", "def create\n @upload = @user.uploads....
[ "0.64728934", "0.64534754", "0.63144296", "0.6309587", "0.59656674", "0.5834253", "0.5776995", "0.57483965", "0.57192683", "0.57183033", "0.57183033", "0.57183033", "0.57183033", "0.57183033", "0.57183033", "0.57183033", "0.57183033", "0.57183033", "0.57183033", "0.57183033", ...
0.0
-1
public instance Methods goes here
def after_sign_in_path_for(resource_or_scope) unless mobile_devices_format? if params[:apply_existing].present? and params[:apply_existing].eql?('yes') profile_path(:id => current_user.id, season_id: params[:season_id],org_id: params[:org_id]) else user_dashboard_path end else if current_user and current_user.has_role?(:parent) m_top_dashboard_path(current_user.parent_profile) elsif current_user m_invalid_parent_error_path else root_url end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def instance; end", "def instance; end", "def instance; end", "def initialize\n \n end", "def implementation; end", "def implementation; end", "def methods() end", "def initialize\n\t\t\n\tend", "def methods; end", "def methods; end", "def methods; end", "def m...
[ "0.78587425", "0.7471562", "0.7471562", "0.7471562", "0.72189283", "0.71468514", "0.71468514", "0.71126837", "0.7086227", "0.7086225", "0.7086225", "0.7086225", "0.7086225", "0.70718235", "0.68998396", "0.6892375", "0.6892375", "0.68193114", "0.681041", "0.681041", "0.681041"...
0.0
-1
Both Helper and Instance Methods a common helper to find user dashboard(home) based on role
def user_dashboard_path role_names if @roles.count > 1 if @roles.include?(:parent) launch_profiles_path(profile_id: current_user.parent_profile) else launch_profiles_path(user_id: current_user.id) end elsif @roles.include?(:parent) top_dashboard_path(current_user.parent_profile) elsif @roles.include?(:super_admin) organizations_path elsif @roles.include?(:org_admin) if current_user.managed_organizations.count > 1 launch_profiles_path(user_id: current_user.id) else org_enrollees_organizations_path(:id => current_user.managed_organizations.first.id,clear_session: true) end else root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_dashboard\n if @current_user.superadmin_role\n path = auth_hub.index_superadmin_url\n elsif @current_user.admin_role\n path = auth_hub.index_admin_url\n elsif @current_user.admin_servizi\n path = auth_hub.index_admin_url\n ...
[ "0.70152515", "0.6767943", "0.66862744", "0.64819616", "0.6365967", "0.63096195", "0.6117731", "0.6114683", "0.6089742", "0.6080363", "0.60765654", "0.6074125", "0.6054226", "0.6014627", "0.6005608", "0.60012037", "0.5994015", "0.59907985", "0.59762967", "0.5966778", "0.59613...
0.69533753
1
def is_iphone_browser? user_agent = request.env['HTTP_USER_AGENT'].downcase user_agent.index('iphone') and user_agent.include?("safari") and !user_agent.include?("crios") end
def trackUserDefinedTags if params[:document].include?(:tags) tags = params[:document][:tags].split(',') tags.map(&:strip!) tags.uniq.each do |tag| user_tag= @parent_profile.user_tags.where(tag: tag).first ||@parent_profile.user_tags.create(tag: tag, category_ids: params[:document][:category_id].to_a) if !user_tag.nil? and !user_tag.category_ids.include?(params[:document][:category_id]) begin user_tag.update_attributes(category_ids: user_tag.category_ids.push(params[:document][:category_id])) rescue next end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iphone_user_agent?\n request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"][/(Mobile\\/.+Safari)/]\n end", "def iphone_user_agent?\n request.env[\"HTTP_USER_AGENT\"] && request.env[\"HTTP_USER_AGENT\"][/(Mobile\\/.+Safari)/]\n end", "def iphone_user_agent?\n request.env[\"HTTP_US...
[ "0.9320714", "0.92597514", "0.92597514", "0.92597514", "0.92515516", "0.9121987", "0.9104626", "0.9100202", "0.9064085", "0.90382123", "0.89610857", "0.8077541", "0.7935387", "0.7914374", "0.78946966", "0.78292984", "0.7713498", "0.770666", "0.7704549", "0.76238215", "0.75839...
0.0
-1
Dynamic JSON FORM Related Stuff TODO need to modify this method
def parsedFromJSON(json, kid_profile, parents, season, organization_membership) error_kid = Hash.new parent_profile_type = nil JSON.parse(json.content)['form']['panel'].each do |t_panel| if !t_panel['field'].nil? t_panel['field'].each do |t_field| error_kid[t_field['unique']] ||= Array.new @f_val = params['profile'][t_field['unique']][0].fetch(t_field['id'], nil) @dyna_field = t_field['id'].to_sym t_nq = t_field['unique'] t_nq ||= "seas" ## defaults to season # required + req variant validations case t_field['required'] when "true" error_kid[t_field['unique']].push(t_field['id']) if @f_val.blank? when "trueif" f_status = Profile.check_required_if(t_field['required_if'],t_field['id'],t_nq,params['profile'],@f_val, 0) error_kid[t_field['unique']].push(t_field['id']) if f_status else end # DATE type validation(s) #if t_field['type'] == "date" # error_kid[t_nq].push(t_field['id']) unless @f_val =~ Profile::DOB_REGX #end #if t_field['id']== "birthdate" # error_kid[t_nq].push(t_field['id']) unless Profile.check_birth_date(@f_val) #end if t_field['type'] == "date" or t_field['id']== "birthdate" error_kid[t_nq].push(t_field['id']) unless Profile.check_birth_date?(@f_val) end # load to right bucket case t_field['unique'] when "univ" #kid_profile.read_attribute(@dyna_field.to_sym) kid_profile.write_attribute(@dyna_field.to_sym, @f_val) # create or update phone numbers if and only the type is 'phone' create_or_update_phone_numbers(t_field['type'], kid_profile, @dyna_field, @f_val) when "org" #organization_membership.read_attribute(@dyna_field.to_sym) organization_membership.write_attribute(@dyna_field.to_sym, @f_val) # create or update phone numbers if and only the type is 'phone' create_or_update_phone_numbers(t_field['type'], organization_membership, @dyna_field, @f_val) when "seas" #season.read_attribute(@dyna_field.to_sym) season.write_attribute(@dyna_field.to_sym, @f_val) # create or update phone numbers if and only the type is 'phone' create_or_update_phone_numbers(t_field['type'], season, @dyna_field, @f_val) if t_field['type'].eql?('check_box') if @f_val == "0" season[@dyna_field.to_sym] = false elsif @f_val == "1" season[@dyna_field.to_sym] = true end end when "parent" parent_profile_type||= ProfileParentType.new() parent_profile_type[@dyna_field] = @f_val end end # if parent observed part of field declaration, just add if parent_profile_type parents.push(parent_profile_type) parent_profile_type = nil end elsif !t_panel['fieldgroup'].nil? and !t_panel['fieldgroup']['field'].nil? # check group fields uniqueness t_nq_arr = t_panel['fieldgroup']['field'].collect { |item| item['unique'] }.uniq raise "FieldGroup's all fields should have same type" if t_nq_arr.nil? or t_nq_arr.size != 1 t_nq = t_nq_arr.first parents_count = 0 # parent pointer error_kid[t_nq] ||= Array.new params['profile'][t_nq].each do |f_field| f_field.last.each { |key, val| error_kid[t_nq][parents_count] ||= Hash.new # Find params attribute from template json t_att = t_panel['fieldgroup']['field'].detect { |each_field| each_field['id'] == key } #----------For First parent------------------ if parents_count.eql?(0) validate_field_group_fields(t_att,error_kid,t_nq,parents_count,val) else ##----- Except First parent: remove phone hash and check if all the values are empty or not(ex: email,fname,lname,child_relationship),if at least one is non-empty then apply below validate_field_group_fields(t_att,error_kid,t_nq,parents_count,val) unless f_field.last.values.delete_if{ |e| e.is_a?(Hash)}.all?{|v| v.blank? } end unless error_kid[t_nq][parents_count].has_key?(t_att['id']) # just create, if not initialized parent_profile_type||= ProfileParentType.new() # handl ephone with care :) if t_att['type'].eql?('phone') parent_profile_type.phone_numbers.push(PhoneNumber.new(contact: val['contact'], type: val['type'], key: key)) # unless val['contact'].blank? or val['type'].blank? else parent_profile_type[key.to_sym] = val end else # dont worry. field added to errors hash end } # add parent if parent_profile_type #parent_profile_type.email = parent_profile_type.email.downcase parents.push(parent_profile_type) parent_profile_type = nil end parents_count += 1 end end end error_kid.delete_if { |k, v| v.instance_of?(Array) and v.length < 1 } return kid_profile, parents, season, organization_membership, error_kid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form_json\n render template: 'utils/form_json'\n end", "def setup_form\n form = {\n schema: {\n type: 'object',\n properties: {\n array: {\n title: 'You have not configured your schema form',\n type: 'array',\n...
[ "0.7004815", "0.6603876", "0.65710264", "0.6339986", "0.6127298", "0.6112141", "0.6108365", "0.6049409", "0.60183275", "0.6014904", "0.6008444", "0.5939089", "0.5875267", "0.5860369", "0.5827957", "0.5818868", "0.57536924", "0.57027763", "0.5685648", "0.5682816", "0.5675183",...
0.5691155
18
Getting phone_numbers and label for given bucket from specified template
def bucket_phone_numbers_with_label(bucket_object, bucket, json_template) phone_numbers = {} bucket_object.phone_numbers.each do |phone_number| # grab phone number from specified bucket under given template label_of_phone = json_template.label_name(bucket, phone_number.key.to_s) if label_of_phone p_type = phone_number.type.blank? ? nil : "(#{phone_number.type})" phone_numbers[label_of_phone] = "#{phone_number.contact} #{p_type}" end end unless bucket_object.phone_numbers.blank? return phone_numbers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_numbers_from_ab(args = {})\n globalAddressBook = ABAddressBook.sharedAddressBook\n\n queryString = args[:string].nil? ? \"*\" : args[:string]\n matchValidator = Regexp.compile \"^#{args[:validator].nil? ? \"04\" : args[:validator].nil?}\"\n numberPrefix = Regexp.compile \"^#{args[:prefix].nil? ? \"61\"...
[ "0.54348624", "0.5032368", "0.50274986", "0.4903828", "0.4874043", "0.48340565", "0.48189098", "0.47767904", "0.47688952", "0.4758359", "0.4727419", "0.46719766", "0.4666839", "0.46556953", "0.46093014", "0.46029133", "0.45992652", "0.457819", "0.45616958", "0.45417416", "0.4...
0.8657441
0
checks if all of the cards are revealed, which means you won
def won? board.all? do |row| row.all?(&:revealed?) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def won?\n !@grid.flatten.any? do |card|\n !card.face_up\n end\n end", "def game_ended?\n @player.reveal? || @player.cards.size == 3 || @dealer.cards.size == 3\n end", "def has_lost?\n @deck.cards == []\n end", "def match_won?\n if @sets_won == 3\n @match_won = 1\n @set...
[ "0.7383226", "0.70301914", "0.69689435", "0.6852224", "0.68391496", "0.68007654", "0.67727476", "0.67472124", "0.6739343", "0.6720123", "0.66952085", "0.6690326", "0.66677266", "0.6642736", "0.6610323", "0.66073215", "0.66043603", "0.6601633", "0.6591257", "0.6583823", "0.652...
0.7184111
1
number the number to cube. Examples cube(5) => 125 Returns the numbers cube.
def cube(number) number.to_i return number**3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cube(number)\n return number * number * number\nend", "def cube(number)\n return number * number * number\nend", "def cube(number)\n return number ** 3\nend", "def cube(number)\n\n number * number * number\n\nend", "def cube(num)\n return num * num * num\nend", "def cube(num)\n retu...
[ "0.80610144", "0.80610144", "0.80321956", "0.80144686", "0.8009295", "0.7952921", "0.7952921", "0.79355663", "0.79309016", "0.7874561", "0.7874561", "0.78192997", "0.78114676", "0.7779841", "0.7679722", "0.766065", "0.76158386", "0.7569122", "0.75673217", "0.75151616", "0.715...
0.8448586
0
generate devise (fresh) configs and views programmatically bundle exec rails generate devise:install bundle exec rails generate devise User bundle exec rails generate devise:views templateengine=haml
def exec(cmd) puts cmd `#{cmd}` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_user(package_dir)\n system \"rails generate devise:install\"\n\n replace('config/environments/development.rb',\n \"config.action_mailer.raise_delivery_errors \\= false\",\n \"config.action_mailer.raise_delivery_errors = false\\n\\tconfig.action_mailer.default_url_options = { host: 'localhost:3...
[ "0.747427", "0.62012285", "0.61684936", "0.60498095", "0.581969", "0.57519335", "0.56102633", "0.5609516", "0.55723196", "0.5448626", "0.53879255", "0.5387887", "0.5356929", "0.53475374", "0.5295697", "0.5282007", "0.5272215", "0.52649313", "0.5261441", "0.52252185", "0.52143...
0.0
-1
Create a new DB > File Pipe
def db_to_file(src, dest) pool = Connections.init_pool src query_stream = QueryStream.new pool file_writer = FileWriter.new dest Pipe.new from: query_stream, to: file_writer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n File.open(@db_file, \"w\" ) do |file|\n end\n end", "def create_db_cmd!\n \"createdb -e #{new_db_name}\"\n end", "def create_db(options)\n info \"Created database '#{options[:name]}'\"\n end", "def create\n\n if File.exists?(dbfilename)\n puts \"Moved '#{dbfilename}' t...
[ "0.7135331", "0.7056816", "0.64670813", "0.63346654", "0.60971785", "0.59737647", "0.5924297", "0.5852817", "0.58512044", "0.5839182", "0.58355916", "0.5812355", "0.5802899", "0.5801419", "0.5783974", "0.5778621", "0.5767883", "0.573256", "0.5731255", "0.57273775", "0.5726042...
0.66708434
2
Create a new DB > STDOUT Pipe
def db_to_stdout(src) pool = Connections.init_pool src query_stream = QueryStream.new pool stdout_writer = STDOUTWriter.new Pipe.new from: query_stream, to: stdout_writer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db_cmd!\n \"createdb -e #{new_db_name}\"\n end", "def create_db(options)\n info \"Created database '#{options[:name]}'\"\n end", "def db_to_file(src, dest)\n pool = Connections.init_pool src\n query_stream = QueryStream.new pool\n file_writer = FileWriter.new d...
[ "0.66352725", "0.63978535", "0.63895315", "0.61696684", "0.6110076", "0.6077867", "0.58613443", "0.57219964", "0.56884116", "0.5656567", "0.5614573", "0.5590292", "0.55478615", "0.55467236", "0.5493163", "0.54838693", "0.5432055", "0.5411878", "0.54092586", "0.54006314", "0.5...
0.7257798
0
Create a new DB > Null pipe
def db_to_null(src) pool = Connections.init_pool src query_stream = QueryStream.new pool stdout_writer = NullWriter.new Pipe.new from: query_stream, to: stdout_writer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db_cmd!\n \"createdb -e #{new_db_name}\"\n end", "def create_db(options)\n info \"Created database '#{options[:name]}'\"\n end", "def create_database!(name=nil)\n db = if name\n self.server.database!(db_name_with_prefix(name))\n else\n self.databas...
[ "0.7547174", "0.6979349", "0.6830326", "0.6666297", "0.6541586", "0.65031683", "0.64446646", "0.64192957", "0.6418513", "0.6405373", "0.6380377", "0.637784", "0.6371501", "0.63308793", "0.6328157", "0.6291567", "0.62820655", "0.62549907", "0.6243959", "0.6229619", "0.62220114...
0.6238917
19
a method in the local binding used for testing
def local_method :local_method end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def spec; end", "def spec; end", "def testing\n # ...\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def __dummy_test__\n end", "def weber; end", "def binder; end", "def binder; end", "def tests=(_arg0); end", "def t...
[ "0.69199085", "0.66285586", "0.66285586", "0.6584058", "0.6504419", "0.6504419", "0.6504419", "0.6504419", "0.6417649", "0.6321924", "0.6320002", "0.6320002", "0.6279261", "0.6279261", "0.626716", "0.626716", "0.6215177", "0.61981225", "0.61949104", "0.6184448", "0.6184448", ...
0.0
-1
Return the directory of the given file path relative to the base directory of the project. [projectRelativePath] Path of the file relative to the project directory. The path will be formatted in visual studio xml path format. Example: 'C:/../projectBase/include/header1.h' > 'include\header1.h' Actually it only converts something like './include/header1.h' correctly.
def GetProjectDirectoryRelativeBaseDirectory(projectRelativePath) return FormatXmlPath(StripFilenameFromPath(projectRelativePath)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetVsProjectRelativePath(projectRelativePath)\n if(VsPathIsAbsolute(projectRelativePath))\n return projectRelativePath\n end\n \n return JoinXmlPaths([ \"..\", \"..\", projectRelativePath])\n end", "def GetVsSolutionRelativePath(projectRelativePath)\n if(VsPathIsAbsolute(pr...
[ "0.7673851", "0.73637074", "0.64911604", "0.61950505", "0.6168379", "0.61663866", "0.6161141", "0.60981035", "0.5985619", "0.5969413", "0.5959018", "0.5952809", "0.59443253", "0.59023297", "0.5901259", "0.5822341", "0.58104926", "0.5787172", "0.57497424", "0.57497424", "0.574...
0.7854427
0
Get the path of the file relative to the visual studio solution directory. [projectRelativePath] Path of the file relative to the base project directory.
def GetVsSolutionRelativePath(projectRelativePath) if(VsPathIsAbsolute(projectRelativePath)) return projectRelativePath end return JoinXmlPaths([ "..", projectRelativePath]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetVsProjectRelativePath(projectRelativePath)\n if(VsPathIsAbsolute(projectRelativePath))\n return projectRelativePath\n end\n \n return JoinXmlPaths([ \"..\", \"..\", projectRelativePath])\n end", "def GetProjectDirectoryRelativeBaseDirectory(projectRelativePath)\n return ...
[ "0.8318012", "0.74018806", "0.6801008", "0.6685289", "0.66343886", "0.66030765", "0.6562571", "0.6469459", "0.6353639", "0.6337989", "0.629349", "0.6269436", "0.6268716", "0.61860865", "0.6146283", "0.61154574", "0.6110474", "0.6105504", "0.6079103", "0.60523736", "0.6043171"...
0.815592
1
Get the path of the file relative to the visual studio project directory. [projectRelativePath] Path of the file relative to the base project directory.
def GetVsProjectRelativePath(projectRelativePath) if(VsPathIsAbsolute(projectRelativePath)) return projectRelativePath end return JoinXmlPaths([ "..", "..", projectRelativePath]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GetVsSolutionRelativePath(projectRelativePath)\n if(VsPathIsAbsolute(projectRelativePath))\n return projectRelativePath\n end\n \n return JoinXmlPaths([ \"..\", projectRelativePath])\n end", "def GetProjectDirectoryRelativeBaseDirectory(projectRelativePath)\n return FormatX...
[ "0.803091", "0.73230517", "0.6683338", "0.66307724", "0.6556832", "0.6502889", "0.65011805", "0.6341418", "0.6322431", "0.6297111", "0.6296585", "0.62302315", "0.6164224", "0.61611646", "0.6155429", "0.6107996", "0.6062366", "0.6050513", "0.60504204", "0.60385364", "0.6024646...
0.83303434
0
GET /requests GET /requests.json
def index @requests = Request.accessible_by(current_ability) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @requests = Request.all\n\n render json: @requests\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "def index\n @requests = ::Request.all\n\n respond_to do |format|\n format.html # in...
[ "0.71195513", "0.6854284", "0.6853197", "0.6835143", "0.6835143", "0.67639446", "0.67531043", "0.6720251", "0.6658772", "0.6585643", "0.6530313", "0.64756197", "0.6440112", "0.64036715", "0.6360889", "0.63438714", "0.6333824", "0.6333824", "0.6333824", "0.6333824", "0.6333824...
0.0
-1
GET /requests/1 GET /requests/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @requests = Request.all\n\n render json: @requests\n end", "def show\n @request = Request.find(params[:id])\n\n render json: @request\n end", "def index\n @requests = Request.all\n\n respond_to do |format|\n format.json { render :json => @requests}\n end\n end", "de...
[ "0.6923948", "0.6775905", "0.6691131", "0.6687603", "0.6687603", "0.6601547", "0.6509265", "0.64060545", "0.64060545", "0.64060545", "0.64060545", "0.6389414", "0.6377212", "0.62783706", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274", "0.6275274"...
0.0
-1
POST /requests POST /requests.json
def create @request = Request.new(request_params) respond_to do |format| if @request.save flash[:success] = @@msgs format.html { redirect_to @request, notice: 'Request was successfully created.' } format.json { render :show, status: :created, location: @request } else flash[:danger] = @@msge format.html { render :new } format.json { render json: @request.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_post(path, request)\n @http.post(\n :body => JSON(:request => request.to_hash),\n :headers => headers,\n :path => \"/api/v2/#{path}\",\n :expects => [200, 201, 202]\n )\n end", "def request_json\n @request.headers[\"Content-Type\"] = 'appli...
[ "0.62527245", "0.61672306", "0.61165977", "0.6080604", "0.60698915", "0.6035983", "0.6017509", "0.5978193", "0.5936988", "0.59057087", "0.58960724", "0.58763504", "0.5873753", "0.5845702", "0.58416176", "0.5835487", "0.58184886", "0.5750565", "0.57378525", "0.57262397", "0.57...
0.0
-1
PATCH/PUT /requests/1 PATCH/PUT /requests/1.json
def update respond_to do |format| if @request.update(request_params) flash[:success] = @@msgs format.html { redirect_to @request, notice: 'Request was successfully updated.' } format.json { render :show, status: :ok, location: @request } else flash[:danger] = @@msge format.html { render :edit } format.json { render json: @request.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\n @request.assi...
[ "0.71513766", "0.6705349", "0.66861606", "0.6674592", "0.6674592", "0.6674592", "0.6674592", "0.66463315", "0.6584018", "0.6565972", "0.6433838", "0.6405666", "0.6405666", "0.637993", "0.637993", "0.6360226", "0.63574314", "0.63574314", "0.6339808", "0.63397694", "0.6329588",...
0.57164073
87
DELETE /requests/1 DELETE /requests/1.json
def destroy if @request.destroy flash[:success] = @@msgs else flash[:danger] = @@msge end respond_to do |format| format.html { redirect_to requests_url, notice: 'Request was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to requests_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @request = Request.find(params[:id])\n @request.destroy\n\n respond_to do |format|\n format.html { redirect_to req...
[ "0.7705958", "0.7699295", "0.76810163", "0.76810163", "0.76810163", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7671836", "0.7389192", "0.73615795", "0.7333734", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198", "0.7329198",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_request @request = Request.accessible_by(current_ability).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 request_params params.require(:request).permit(:carga, :documento, :urgente, :motivo, :tipo, :portaria, :data_partida, :data_volta, :hora_partida, :hora_volta, :status, :user_id, :data_aguardando_cad, :user_aguardando_cad_id, :data_aguardando_useget, :user_aguardando_useget_id, :data_aprovada, :user_aprovada_id, :data_em_andamento, :user_em_andamento_id, :data_finalizada, :user_finalizada_id, :data_cancelada, :user_cancelada_id, :motivo_cancelamento, request_passengers_attributes: [:id, :passenger_id, :request_id, :passenger_nome]) 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
Initializes a new instance of this class.
def initialize(target_path = ApacheConfig::DEFAULT_CONFIG_PATH, config_path = DEFAULT_CONFIG_PATH) @target = Pathname.new(target_path).realpath.to_s @config_path = config_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n end", "def initialize\n \n end", "def initialize()\n end", "def initialize\n ...
[ "0.87681353", "0.87616813", "0.87616813", "0.87616813", "0.87616813", "0.87616813", "0.87616813", "0.8722745", "0.86175054", "0.85020417", "0.8478714", "0.8478714", "0.8460433", "0.84234136", "0.84234136", "0.84234136", "0.84234136", "0.84234136", "0.84234136", "0.84234136", ...
0.0
-1
Performs any necessary checks prior to modifying the configuration file and returns a `Boolean` value indicating whether the checks were successful or not.
def check? # Check if the configuration path exists and is a file unless File.exists? @config_path puts "#{@config_path} is not a valid path." return false end # Check if the configuration file is writable unless check_writable? puts "The Apache configuration file (#{@config_path}) is not writable by the current user." return false end # Check if there is not already a virtual host defined with the same host name unless check_content? /^\s*Include\s+#{@target}$/i puts "The target configuration file (#{@target}) is already being included by Apache." return false end # Success! :) return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_configuration!\n config.check!\n end", "def loaded_config?\n begin\n @config = YAML::load(File.open(@options.config_file))\n rescue => err\n @stderr.puts \"Error loading config file: #{err}\"\n return false\n end\n return true\nend", "def configured?\n @config = load_confi...
[ "0.70664185", "0.66473544", "0.6493362", "0.64319146", "0.64303666", "0.6372811", "0.63650155", "0.6361353", "0.6316284", "0.6305739", "0.6290693", "0.6289949", "0.6282868", "0.6282868", "0.6239907", "0.62314385", "0.6184884", "0.61766064", "0.6140557", "0.61336917", "0.61266...
0.7372118
0
Generates the new content that will be appended to the configuration file.
def new_config_content return <<-VHOST # vh configuration file Include #{@target} # /vh configuration file VHOST end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_app_config_file\n filename = 'config/init/app_config.rb'\n bakname = 'config/init/app_config.rb~'\n File.delete(bakname) if File.exist?(bakname)\n File.rename(filename, bakname) if File.exist?(filename)\n File.open(filename, \"w\") do |file|\n file.puts(app_config_content)\n end\n e...
[ "0.6608686", "0.6581524", "0.6483305", "0.63802785", "0.627995", "0.6171255", "0.6130464", "0.6069845", "0.6037591", "0.6035929", "0.5997994", "0.59853536", "0.5979996", "0.5979112", "0.59562486", "0.5947258", "0.5928096", "0.5888588", "0.5864798", "0.5854464", "0.5853672", ...
0.64692444
3
Use callbacks to share common setup or constraints between actions
def set_contact @contact = Contact.find(params[:id]) rescue ActiveRecord::RecordNotFound => e render json: { message: e.message}, status: :not_found 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 run_actions; end", "def action_hook; end", "def callbacks; end", "def callbacks; end", "def actions; end", "def add_actions; end", "def define_action_hook; end", "def define_action_helpers\n ...
[ "0.6286812", "0.6187808", "0.6184776", "0.6063208", "0.6063208", "0.6049123", "0.590157", "0.58827597", "0.57930803", "0.57467157", "0.56255555", "0.56055284", "0.55783254", "0.5557657", "0.5515892", "0.5487875", "0.54620403", "0.5441225", "0.54343027", "0.54343027", "0.54343...
0.0
-1
Only allow a trusted parameter "white list" through
def contact_params params.require(:contact).permit(:name, :email, :phone, :description, addresses: %i[line1 line2 city state zip] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def param_whitelist\n [:role, :title]\n end", "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def default_param_whitelist\n [\"mode\"]\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n ...
[ "0.71102256", "0.7103063", "0.7079237", "0.70405525", "0.696351", "0.6808852", "0.6794005", "0.67904145", "0.6729673", "0.67058986", "0.6666788", "0.6662568", "0.65984434", "0.65984434", "0.6595137", "0.6594866", "0.6583686", "0.65497476", "0.652406", "0.65006906", "0.6496638...
0.0
-1
destroy user session e.g. logout
def destroy session[:user_id] = nil redirect_to root_url, :notice => "Logged out" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n session[:user_id] = nil\n @curr_user = nil\n redirect_to :log_in, :notice => \"Logged out\"\n end", "def destroy\n user_session = UserSession.find\n logout_url = user_session.logout_url(params) unless user_session.nil?\n user_session.destroy unless user_sessio...
[ "0.8676461", "0.85778147", "0.85622656", "0.8524906", "0.85144913", "0.8483013", "0.8482786", "0.8471603", "0.84692615", "0.8462287", "0.8462219", "0.84528464", "0.84518445", "0.8444233", "0.84435964", "0.84393215", "0.84393215", "0.84393215", "0.84382963", "0.84344554", "0.8...
0.83750474
60
Problem 3 The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143?
def largest_prime_factor(num,prime_factors,recursive) candidate = 2 until candidate >= Math.sqrt(num) recursive = false if num % candidate == 0 num = num / candidate recursive = true prime_factors << candidate largest_prime_factor(num,prime_factors,recursive) end break if recursive candidate == 2 ? candidate += 1 : candidate += 2 end prime_factors << num unless recursive prime_factors.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_prime_factor\n number = 600851475143\n n = 2\n while n < number\n if number % n == 0\n factor = number / n\n return factor if is_prime?(factor)\n end\n n += 1\n end\nend", "def prime_factor\n max = 600851475143**0.5\n\n for i in (1..max).step(2)\n if 600851475143 % i == 0\...
[ "0.8296991", "0.8237952", "0.815384", "0.80350304", "0.7654529", "0.7570023", "0.756091", "0.7541239", "0.7516142", "0.7510195", "0.7509711", "0.7489281", "0.7485615", "0.74843186", "0.74667317", "0.74567527", "0.74528897", "0.74473155", "0.74453986", "0.74408484", "0.7439608...
0.72483945
41
depends_on 'sbiguniversaldriver'. note: can't depend on cask's yet, use "install" as a workaround
def install system "brew", "cask", "install", "sbig-universal-driver" system "cmake", "3rdparty/indi-sbig", *std_cmake_args system "make", "install" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_in_debian\n package 'apt-transport-https'\n package 'dirmngr' if get_debian_os_name == 'stretch'\n collectd_ppa_source = node['SignalFx_debian_ppa'][get_debian_os_name]['collectd']['uri']\n signalfx_collectd_plugin_ppa_source = node['SignalFx_debian_ppa'][get_debian_os_name]['collectd_plugin']['uri...
[ "0.59585345", "0.5884765", "0.57589316", "0.56672454", "0.55899197", "0.5455709", "0.5448377", "0.54463375", "0.54155046", "0.54141617", "0.5408518", "0.5401391", "0.5393316", "0.53808445", "0.53489536", "0.5334755", "0.5334755", "0.533167", "0.5324903", "0.53136766", "0.5303...
0.6668677
0
Write a program that iterates over an array and builds a new array that is the result of incrementing each value in the original array by a value of 2. You should have two arrays at the end of this program, The original array and the new array you've created. Print both arrays to the screen using the p method instead of puts. using map method
def increase_array_values(array, number) array.map {|num| num + number} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add1(arr)\n new_arr = arr.map do |num|\n num += 1\n end\n new_arr\nend", "def inc_by_2(numbers)\n p numbers\n p numbers.map {|x| x + 2 }\nend", "def multiply_by_two(array)\n # double_numbers = []\n # array.each do |number|\n # double_numbers << number * 2\n # end\n # double_numbers\n array....
[ "0.73846257", "0.72617155", "0.7237623", "0.71399367", "0.71399367", "0.7106535", "0.70883214", "0.7075543", "0.6983331", "0.696303", "0.69380915", "0.6896808", "0.6884022", "0.685798", "0.68494284", "0.6820077", "0.68115366", "0.678285", "0.67627317", "0.6732444", "0.6732060...
0.74651486
0
Authorize the request. The request needs to pass in "session_secret" cookie with the value of session secret.
def authorize_request if !cookies.nil? and !cookies[:session_secret].nil? if cookies[:session_secret] == Caterpillar::Security.get_secret logger.debug "Passes security check" return true end end logger.debug("Session secret is not present in %s" % cookies.inspect) logger.warn 'Someone from IP %s may be spoofing' % request.env['REMOTE_ADDR'] render :nothing => true, :status => 403 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_request\n if !cookies.nil? and !cookies[:session_secret].nil?\n config = Util.eval_configuration\n if cookies[:session_secret] == config.session_secret[:secret]\n logger.debug \"Passes security check\"\n return true\n end\n end\n logger.debug(\"Se...
[ "0.71722746", "0.66267854", "0.660407", "0.6481859", "0.64163876", "0.64160895", "0.63089186", "0.62940276", "0.62840974", "0.6195004", "0.61922145", "0.6151145", "0.6115023", "0.6110773", "0.60952395", "0.6067446", "0.6052897", "0.60295445", "0.60270745", "0.6026937", "0.601...
0.70481646
1
Get the Liferay UID from cookie.
def get_liferay_uid uid_key = 'Liferay_UID' unless cookies.nil? or cookies[uid_key].nil? @uid = cookies[uid_key] logger.debug("Liferay UID %s" % @uid) else logger.debug("UID key is not present in cookies %s" % cookies.inspect) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_userid\n request.cookies['userid']\n end", "def uu_user_id\n cookies.permanent[:uu_user_id] = nonce if cookies[:uu_user_id].nil?\n cookies[:uu_user_id]\n end", "def get_id_from_cookie\n Sinatra::Authentication::Cookies::Hashing.decrypt(cookies[:ottoman_connection], settings.privat...
[ "0.74597013", "0.691673", "0.68734807", "0.6813558", "0.67201924", "0.63985026", "0.6336532", "0.6336532", "0.63062006", "0.6209291", "0.6076984", "0.6010724", "0.6000314", "0.59762067", "0.59697586", "0.59604365", "0.59405655", "0.59404725", "0.5931655", "0.5920528", "0.5920...
0.8870413
0
ACTIONS: Deletes a course based, referencing it via its org_unit_id This reference is created through a formatted path appended with the id. Then, a delete http method is executed using this path, deleting the course.
def delete_course_by_id(org_unit_id) path = "/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}" # setup user path # ap path _delete(path) puts '[+] Course data deleted successfully'.green end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _delete(path)\n puts '[+] Course template data deleted successfully'.green\nend", "def destroy\n url = 'https://casa-core.herokuapp.com/api/units/' + params[:id]\n response = HTTParty.delet...
[ "0.7358662", "0.6931112", "0.6731743", "0.66706336", "0.65189934", "0.64202344", "0.63788605", "0.63651353", "0.63417655", "0.6338433", "0.6335494", "0.6321653", "0.6309916", "0.6296016", "0.62911385", "0.62899953", "0.6286885", "0.62813735", "0.62607193", "0.62583035", "0.62...
0.81997544
0
retrieve the list of parent org unit type constraints for course offerings
def get_parent_outypes_courses_schema_constraints path = "/d2l/api/lp/#{$lp_ver}/courses/schema" _get(path) # returns a JSON array of SchemaElement blocks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def available_departments\n (active_departments + active_units.collect(&:parent)).uniq\n end", "def org_types\n organizations.map(&:organization_type)\n end", "def course_types\n @course_types ||= Course.where(department_id: self.department_id)\n .where(course_num: self.course_num)\n .wher...
[ "0.5919298", "0.57001895", "0.54591125", "0.540907", "0.540214", "0.52978814", "0.52669036", "0.51850253", "0.5145648", "0.5140977", "0.5114233", "0.5072639", "0.50714684", "0.50349057", "0.50267106", "0.50035465", "0.499922", "0.4978568", "0.49733037", "0.49614733", "0.49562...
0.7387381
0
Performs a get request to retrieve a particular course using the org_unit_id of this particular course. If the course does not exist, as specified by the org_unit_id, the response is typically a 404 error. returns: JSON object of the course
def get_course_by_id(org_unit_id) path = "/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}" _get(path) # returns: JSON object of the course end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_course_template(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/coursetemplates/#{org_unit_id}\"\n _get(path)\n # return: JSON course template data\nend", "def get_course_overview(org_unit_id) # GET\n query_string = \"/d2l/api/le/#{$le_ver}/#{org_unit_id}/overview\"\n ap query_string\n _get(qu...
[ "0.73125505", "0.72459364", "0.71677864", "0.6955979", "0.66053355", "0.65522903", "0.6477534", "0.63313913", "0.6270251", "0.62677175", "0.6219315", "0.62182415", "0.60859346", "0.604203", "0.6025466", "0.5991047", "0.5957441", "0.5914164", "0.5913007", "0.59013295", "0.5891...
0.86179906
0
Checks whether the created course data conforms to the valence api for the course data JSON object. If it does conform, then nothing happens and it simply returns true. If it does not conform, then the JSON validator raises an exception.
def check_course_data_validity(course_data) schema = { 'type' => 'object', 'required' => %w(Name Code CourseTemplateId SemesterId StartDate EndDate LocaleId ForceLocale ShowAddressBook), 'properties' => { 'Name' => { 'type' => 'string' }, 'Code' => { 'type' => 'string' }, 'CourseTemplateId' => { 'type' => 'integer' }, 'SemesterId' => { 'type' => %w(integer null) }, 'StartDate' => { 'type' => %w(string null) }, 'EndDate' => { 'type' => %w(string null) }, 'LocaleId' => { 'type' => %w(integer null) }, 'ForceLocale' => { 'type' => 'boolean' }, 'ShowAddressBook' => { 'type' => 'boolean' } } } JSON::Validator.validate!(schema, course_data, validate_schema: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_updated_course_data_validity(course_data)\n schema = {\n 'type' => 'object',\n 'required' => %w(Name Code StartDate EndDate IsActive),\n 'properties' => {\n 'Name' => { 'type' => 'string' },\n 'Code' => { 'type' => 'string' },\n 'StartDate' => { 't...
[ "0.7630688", "0.726471", "0.7121686", "0.67469454", "0.6526173", "0.6478789", "0.641576", "0.6385273", "0.6366838", "0.6325095", "0.627835", "0.6196116", "0.6195593", "0.6165544", "0.61125654", "0.61125654", "0.60878456", "0.6069708", "0.6009227", "0.6009227", "0.5963776", ...
0.79338646
0
Creates the course based upon a merged result of the argument course_data and a preformatted payload. This is then passed as a new payload in the +_post+ method in order to create the defined course. Required: "Name", "Code" Creates the course offering
def create_course_data(course_data) # ForceLocale- course override the user’s locale preference # Path- root path to use for this course offering’s course content # if your back-end service has path enforcement set on for # new org units, leave this property as an empty string # Define a valid, empty payload and merge! with the user_data. Print it. # can be an issue if more than one course template associated with # a course and the last course template parent to a course cannot be deleted payload = { 'Name' => '', # String 'Code' => 'off_SEMESTERCODE_STARNUM', # String 'Path' => '', # String 'CourseTemplateId' => 99_989, # number: D2L_ID 'SemesterId' => nil, # number: D2L_ID | nil 'StartDate' => nil, # String: UTCDateTime | nil 'EndDate' => nil, # String: UTCDateTime | nil 'LocaleId' => nil, # number: D2L_ID | nil 'ForceLocale' => false, # bool 'ShowAddressBook' => false # bool }.merge!(course_data) check_course_data_validity(payload) # ap payload # requires: CreateCourseOffering JSON block path = "/d2l/api/lp/#{$lp_ver}/courses/" _post(path, payload) # puts '[+] Course creation completed successfully'.green end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_course_template(course_template_data)\n # TODO: make a bridge function that allows this to be done with 4 arguments, rather than\n # just a JSON.\n # Path- root path to use for this course offering’s course content\n # if your back-end service has path enforcement set on for\n ...
[ "0.6975375", "0.67821264", "0.6593974", "0.65223134", "0.64812624", "0.64717436", "0.64572084", "0.6443531", "0.6379578", "0.61653334", "0.61508346", "0.61455333", "0.61360425", "0.6124605", "0.6121605", "0.611272", "0.6102787", "0.60876554", "0.60738975", "0.60723823", "0.60...
0.7539701
0