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
This test ensures that all 30 of the causes are indeed put into the new array
def test_all_causes_uploaded assert_equal(30, @file_handler.good_causes_array.length) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_array_number_positive\n @numbers.each do |value, expected|\n assert_equal expected, @TS_Array.format(value)\n end\n end", "def new_array\n\tfull_array.map! {|x| #We call upon the definition from above to create the conditionals for this \n\t\t #function. By defining these arr...
[ "0.6148283", "0.60147953", "0.59576327", "0.5950306", "0.5866427", "0.58109355", "0.5797707", "0.5782602", "0.5746871", "0.5714495", "0.5702237", "0.5620786", "0.5591926", "0.5557249", "0.5545046", "0.5543314", "0.5536085", "0.55336803", "0.552436", "0.5519074", "0.54926455",...
0.6308502
0
Decorate env["rack.input"] with Rack::Simulator::RecordingInput so that request body contents get recorded as they're read.
def record_request(env) input = create_recording_input(env) env.update "rack.input" => input input end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rack_input ; @env['rack.input'] ; end", "def read_request_body(env)\n env[\"rack.input\"].read.tap do\n env[\"rack.input\"].rewind\n end\n end", "def read_body_input\n return unless\n (request.post? || request.put? || request.patch? || request.delet...
[ "0.6937502", "0.6158382", "0.58635837", "0.57790506", "0.57587165", "0.5738999", "0.56618255", "0.56404954", "0.56239396", "0.55573374", "0.54688627", "0.5447792", "0.5374441", "0.5361297", "0.5355621", "0.5331058", "0.5297451", "0.52921337", "0.5272504", "0.5272504", "0.5272...
0.801203
0
Decorate Rack::StreamingProxy::Response with Rack::Simulator::RecordingResponse so that response body contents get recorded as they arrive.
def record_response(response) response[2] = create_recording_response(response[2]) response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_response response_payload, stream\n _write response_payload, stream\n end", "def send_response response, stream\n _log_result [ :receive_request, :response, response, :stream, stream ] do\n response_payload = decoder.encode(response)\n _send_response(response_payload, str...
[ "0.6425199", "0.62709945", "0.60621905", "0.59264576", "0.5801054", "0.57956344", "0.5674216", "0.5669313", "0.5602888", "0.5599185", "0.5591424", "0.5572519", "0.5563881", "0.55526805", "0.5532246", "0.5519012", "0.5494267", "0.54821396", "0.54704213", "0.546401", "0.5429438...
0.63531303
1
Determines whether the field exists.
def field?(name) @attributes.key?(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_exists?(storage_name, field_name)\n true\n end", "def has_field?(field_name); end", "def field_exists?(name)\n @fields.key?(name.to_s) || @fields.key?(name.to_sym)\n end", "def has_field?(name)\n fields.key?(name.to_sym)\n end", "def field_exists?(storage_name, field_name)...
[ "0.8401876", "0.8241691", "0.81353205", "0.81122696", "0.78858906", "0.7869292", "0.78261685", "0.7741541", "0.7680509", "0.7677227", "0.76413536", "0.76042646", "0.75434595", "0.74342525", "0.7389981", "0.73852456", "0.73179525", "0.7293509", "0.7084877", "0.70737153", "0.70...
0.73455346
16
Provides arbitrary access to the result fields.
def [](name) @attributes[name] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_fields\n @fields ||= result_meta.collect { |m| m.name }\n end", "def result\n\n fields['__result__']\n end", "def fetch_fields\n @result.fetch_fields\n end", "def result_metadata\n return nil if @fields.empty?\n Result.new @fields\n end", "def result_attrs\n ...
[ "0.77872497", "0.75212073", "0.7492745", "0.6970816", "0.6677718", "0.6459887", "0.64300793", "0.64300793", "0.64300793", "0.62134856", "0.61792773", "0.61607325", "0.61465234", "0.61380225", "0.61380225", "0.6134983", "0.61123395", "0.6046659", "0.60427684", "0.6032539", "0....
0.0
-1
Perform SSDP discover to find camera on network.
def ssdp_search log.info 'Trying SSDP discover...' try = 1 while true do response = Frisky::SSDP.search SSDP_SEARCH_TARGET if response.present? break elsif try < SSDP_SEARCH_RETRY try += 1 log.warn "SSDP discover failed, retrying... (#{try}/#{SSDP_SEARCH_RETRY})" sleep(SSDP_RETRY_INTERVAL) else raise DeviceNotFound, 'Cannot find camera API server. Please confirm network connection is correct.' end end log.info 'SSDP discover succeeded.' # get device description dd = HTTPClient.new.get_content(response[0][:location]) # puts dd parse_device_description(dd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def discover\n result = SSDP::Consumer.new.search(service: 'urn:schemas-upnp-org:device:ZonePlayer:1', first_only: true, timeout: @timeout, filter: lambda {|r| r[:params][\"ST\"].match(/ZonePlayer/) })\n @first_device_ip = result[:address]\n end", "def discover\n send_discovery_message\n @...
[ "0.6223428", "0.62060595", "0.568083", "0.5523649", "0.5523649", "0.53488255", "0.5194386", "0.494581", "0.49343812", "0.49279255", "0.49056956", "0.49056956", "0.48461354", "0.4707961", "0.46829712", "0.4651169", "0.4638467", "0.46220684", "0.46118456", "0.4600262", "0.45931...
0.75476795
0
Parse device description and get endpoint URLs
def parse_device_description(dd) dd_xml = Nokogiri::XML(dd) raise DeviceDescriptionInvalid if dd_xml.nil? dd_xml.remove_namespaces! camera_name = dd_xml.css('device friendlyName').inner_text services = dd_xml.css('device X_ScalarWebAPI_Service') endpoints = {} services.each do |sv| service_type = sv.css('X_ScalarWebAPI_ServiceType').inner_text endpoints[service_type] = File.join(sv.css('X_ScalarWebAPI_ActionList_URL').inner_text, service_type) end # endpoints['liveview'] = dd_xml.css('device X_ScalarWebAPI_LiveView_URL').inner_text # endpoints.delete_if { |k, v| v.blank? } log.info "model-name: #{camera_name}" log.debug 'endpoints:' endpoints.each do |e| log.debug " #{e}" end endpoints end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_service_list_info(device_base_url)\n @control_url = if @service_list_info[:controlURL]\n build_url(device_base_url, @service_list_info[:controlURL])\n else\n log \"<#{self.class}> Required controlURL attribute is blank.\"\n \"\"\n end\n\n @event_su...
[ "0.58744115", "0.56076026", "0.55825895", "0.5527714", "0.55187845", "0.54824114", "0.5435621", "0.54300797", "0.54293054", "0.53766596", "0.535989", "0.5349114", "0.53395534", "0.52802503", "0.526947", "0.526548", "0.5262266", "0.5253825", "0.52416456", "0.52416456", "0.5232...
0.73561096
0
This packages the set path, with the specified target path
def package(path, target) # Load manifest puts "Load manifest..." manifest = YAML::load_file(File.join(path, 'manifest.yml')) # Target directory for package files puts "Target is: #{target}" Dir.mkdir(target) if not File.exists?(target) # Package name package = "#{manifest['name']}-#{manifest['version']}" puts "Package: #{package}" # Tgz manifest['package'] = "#{package}.tgz" command = "tar -czf #{package}.tgz --exclude pkg -C #{path} ." puts "Packing: #{command}" system command # Move puts "Finishing.." FileUtils.mv("#{package}.tgz", target) File.open(File.join(target, "#{package}.yml"), 'w') do |f| f.puts(manifest.to_yaml) f.close end puts "Done." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_path(path)\n path\n end", "def set_move_target cf=current_file\n ff = expand_path(cf)\n return unless File.directory? ff\n\n @move_target = ff\n message \"Move target set to #{cf}.\"\nend", "def set_project_path(ppath)\n if File.file? File.join(ppath, 'package.xml')\n ...
[ "0.6342506", "0.61848766", "0.6161445", "0.61577594", "0.610071", "0.60801905", "0.6060079", "0.60510916", "0.6023889", "0.5950428", "0.59487295", "0.59098", "0.590224", "0.58609843", "0.5857907", "0.5857907", "0.57756805", "0.5729142", "0.57066745", "0.56940985", "0.56940985...
0.0
-1
Start a thread to run the command.
def run env_args = @system_env ? [@system_env] : [] options_args = @system_options ? [@system_options] : [] system_args = [*env_args, *Rscons.command_executer, *@command, *options_args] @thread = Thread.new do system(*system_args) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_thread #does this need to be its own thread?\n @@thread = Thread.new do\n self.run\n end\n end", "def start\n @client.ping\n @state.set :run\n @thread ||= Thread.new{ work_loop }\n end", "def create_command_thread\n Thread.new do\n loop do\n log_in...
[ "0.7220944", "0.6938115", "0.6845989", "0.68416405", "0.675229", "0.6688967", "0.6663532", "0.6612129", "0.65330607", "0.6527723", "0.6488303", "0.64748305", "0.64571375", "0.6413223", "0.6407342", "0.6401731", "0.63543147", "0.63345057", "0.632099", "0.63139427", "0.62825567...
0.67486894
5
Returns only the file name component of `uri`.
def font_name(uri) _, name = path_and_name(uri) name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end", "def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end", "def name_parser(uri)\n base_uri = uri.dup\n File.basename(base_uri, '.*')\n end", "def uri_to_filename(uri, abspath = false)\n filename = File.join...
[ "0.77729535", "0.7733224", "0.77302724", "0.7200771", "0.7179131", "0.7134892", "0.7107497", "0.70473075", "0.70402706", "0.70145637", "0.69844526", "0.6953647", "0.6922831", "0.6869172", "0.68588805", "0.6763907", "0.6762424", "0.67614293", "0.6750968", "0.6715147", "0.66801...
0.0
-1
Returns only the path component of `uri`
def path(uri) path, _ = path_and_name(uri) path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end", "def get_file_uri_path(uri)\n uri.sub(%r{\\Afile://}, '')\n end", "def fullpath(uri)\n return File.join(DIR, uri.gsub('/', File::SEPARATOR))\n end", "def request_uri(uri)\n if has_colon_path_separator?(uri)\n path = ...
[ "0.76605356", "0.76501673", "0.7532288", "0.73901004", "0.7325675", "0.70297503", "0.6961733", "0.6957676", "0.6938104", "0.6933643", "0.68702495", "0.6849227", "0.6807059", "0.6807059", "0.6795218", "0.67306495", "0.67271304", "0.67188925", "0.669027", "0.665048", "0.6627107...
0.81633604
0
Returns all glyph names inside the folder at `uri`.
def glyph_names(uri) images = files(uri).sort if images.empty? raise Compass::SpriteException, %Q{No glyph images were found matching "#{uri}" in the images path. Your current images path is: #{folder}} end images.map { |f| File.basename(f)[0..-5] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def font_name(uri)\n _, name = path_and_name(uri)\n name\n end", "def key(uri, options={})\n [self.class.name + \":fontcustom:\" + File.dirname(File.expand_path(uri)), File.basename(uri)]\n end", "def get_character_names\n\t\t\tget_all_character_uris.map { |uri| get_charact...
[ "0.6193483", "0.5989412", "0.55691594", "0.5505927", "0.5389235", "0.53849745", "0.53525084", "0.53358305", "0.5266505", "0.51619667", "0.51536065", "0.5145504", "0.50983095", "0.5060944", "0.50173724", "0.50058115", "0.4957", "0.49428782", "0.48383284", "0.48097298", "0.4751...
0.79425573
0
Returns `Sass::Engine` options with defaults
def sass_options(uri, importer, options) options.merge!(:filename => uri.gsub(%r{\*/},"*\\/"), :syntax => :scss, :importer => importer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_sass_options\n\t\t\t\t# Just use sassc defaults.\n\t\t\t\tSprockets::Sassc.options.dup\n\t\t\tend", "def sass_options\n\t\t\t\t# NOTE: For Sassc importer is now a **class** and not an instance.\n\n\t\t\t\t# Allow the use of custom SASS importers, making sure the\n\t\t\t\t# custom importer is a `Sproc...
[ "0.7078988", "0.696842", "0.68497586", "0.66755635", "0.6242595", "0.592194", "0.58303237", "0.5639779", "0.5612375", "0.5580067", "0.5490546", "0.54560363", "0.54445314", "0.5423786", "0.5395201", "0.5357462", "0.5340434", "0.53275424", "0.5316081", "0.5316081", "0.5312123",...
0.57852405
7
Renders the stylesheet for font `name` at `uri`
def content_for_font(uri, name) erb = File.read File.join(template_path, 'stylesheet.scss.erb') binder = TemplateData.new(uri: uri, name: name, path: fonts_path, glyph_names: glyph_names(uri)) ERB.new(erb).result(binder.expose_binding) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def font_name(uri)\n _, name = path_and_name(uri)\n name\n end", "def font(name)\n primitive \"font \\'#{name}\\'\"\n end", "def apply_stylename(stylename)\n if stylesheet && stylesheet.is_a?(Teacup::Stylesheet)\n style(stylesheet.query(stylename, self))\n end\...
[ "0.6891522", "0.62219334", "0.60538656", "0.591162", "0.5840924", "0.569745", "0.56601256", "0.56249344", "0.5609117", "0.5599219", "0.557609", "0.55361193", "0.5455039", "0.54038185", "0.53686947", "0.53269804", "0.53041327", "0.53041327", "0.52809674", "0.52757245", "0.5249...
0.7832772
0
Returns the fonts path
def fonts_path Compass.configuration.fonts_dir.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n @path ||= File.join(Rack::Fontserve.fonts_path, name)\n end", "def font\n @font_path\n end", "def font_path(path, options={})\n # Knock .fonts off the end, because Middleman < 3.1 doesn't handle fonts\n # in asset_path\n asset_path(path, :type => :font).s...
[ "0.82762", "0.81759006", "0.8011802", "0.7933593", "0.7749491", "0.77029884", "0.7623605", "0.7349836", "0.7315099", "0.71299297", "0.7028504", "0.6965495", "0.68765384", "0.6762451", "0.6722617", "0.67174214", "0.67128956", "0.6696758", "0.6629548", "0.6600048", "0.6547878",...
0.8590298
0
Returns the gems' internal template path.
def template_path File.expand_path('../templates', __FILE__) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_path\n return File.join(File.dirname(__FILE__), \"../../../templates\", platform)\n end", "def templates_path\n File.join(File.dirname(__FILE__), '..', 'templates')\n end", "def templates_path\n File.join(root, TEMPLATES)\n end", "def templates_path\n File.join((File.exp...
[ "0.8169346", "0.8051783", "0.7949126", "0.79032314", "0.7887982", "0.7865741", "0.7864027", "0.7841679", "0.7756125", "0.7683272", "0.7651769", "0.7627415", "0.76048267", "0.75782007", "0.7566187", "0.75465906", "0.7546503", "0.7543882", "0.750789", "0.7481016", "0.74713737",...
0.81705797
0
Returns an array of font files.
def files(uri) [].tap do |ary| ary.concat Dir[uri] search_paths.each { |p| ary.concat Dir[File.join p, uri] } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fonts_list\n initiate_library\n FONTS_LIBRARY.keys\n end", "def find_os_font_files\n if RUBY_ENGINE == 'mruby'\n # MRuby does not have `Dir` defined\n `find #{directory} -name *.ttf`.split(\"\\n\")\n else\n # If MRI and/or non-Bash shell (like cmd.exe)\n ...
[ "0.7399109", "0.7267535", "0.7137044", "0.70370233", "0.68328255", "0.6576729", "0.649168", "0.6364661", "0.63271993", "0.62373215", "0.6202205", "0.61888", "0.6122929", "0.60956466", "0.60143054", "0.5947628", "0.5893936", "0.5877139", "0.58354044", "0.58267176", "0.58210725...
0.0
-1
Unused. Just returns nil.
def find_relative(uri, base, options) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def returns_nil; end", "def missing?; end", "def unused\n end", "def missing; end", "def caveats; nil end", "def caveats; nil end", "def null\n end", "def absent?; end", "def used?; end", "def method_missing(name)\n return nil\n end", "def getc; nil; end", "def method_missing(*)...
[ "0.7623348", "0.6816288", "0.6801471", "0.6659487", "0.6636204", "0.6636204", "0.6613361", "0.6610025", "0.64935917", "0.6451205", "0.6424915", "0.64211833", "0.6398946", "0.6398946", "0.6398946", "0.6344267", "0.63223314", "0.630921", "0.6291684", "0.6274112", "0.6264206", ...
0.0
-1
Returns the string representation of this instance.
def to_s self.class.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n self.inspect\n end", "def to_s\n self\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string\n end", "def to_s\n @string ||= Builder::ToString.new(self).string\n ...
[ "0.8942756", "0.87964755", "0.8645984", "0.8645984", "0.8645984", "0.8645984", "0.8598134", "0.8498578", "0.8498578", "0.8498578", "0.8498578", "0.8478802", "0.8459072", "0.8388199", "0.83625984", "0.82659894", "0.8240732", "0.8233293", "0.82311547", "0.81962925", "0.81962925...
0.0
-1
Returns the hash of this instance.
def hash self.class.name.hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash #:nodoc:\n __getobj__.hash ^ self.class.hash\n end", "def hash\n to_h.hash ^ self.class.hash\n end", "def hash\n @hash ||= begin\n result = 17\n result = 31 * result + self.class.hash\n result = 31 * result + ord\n result.is...
[ "0.79312027", "0.75733745", "0.75585", "0.75585", "0.7491832", "0.7460944", "0.73641026", "0.72826153", "0.72441465", "0.71788514", "0.7176844", "0.7176844", "0.7176844", "0.7176844", "0.7176844", "0.7176844", "0.7176844", "0.7175118", "0.7162125", "0.7162125", "0.7162125", ...
0.68377405
54
Compares this instance with another object.
def eql?(other) other.class == self.class end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n super\n end", "def ==(other)\n super\n end", "def ==(other)\n super\n end", "def ==(other)\n cmp?(__method__, coerce(other))\n end", "def ==(other)\n @klass == other.klass && @version == other.version && @timestamp == other.timestam...
[ "0.68017006", "0.6709541", "0.6709541", "0.6651596", "0.6620342", "0.6603224", "0.6598617", "0.6510921", "0.6489036", "0.6451377", "0.64461243", "0.64404875", "0.64339906", "0.64050364", "0.64050364", "0.6394886", "0.6394881", "0.63917196", "0.6390869", "0.6388827", "0.638577...
0.0
-1
This instance's Compass cache key
def key(uri, options={}) [self.class.name + ":fontcustom:" + File.dirname(File.expand_path(uri)), File.basename(uri)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key\n :cache\n end", "def cache_key\n end", "def cache_key_base\n \"georeferencer/#{Georeferencer::VERSION}/#{self.to_s.underscore}\"\n end", "def cache_key; @cache.to_sym; end", "def git_cache\n self[KEY]\n end", "def cache_key\n Digest::SHA1.hexdigest \"#...
[ "0.66788906", "0.6553897", "0.65132767", "0.6354226", "0.6297628", "0.6249065", "0.6232735", "0.62280077", "0.614644", "0.61149305", "0.60437", "0.59735405", "0.58318263", "0.5826001", "0.5797903", "0.5797903", "0.57797277", "0.5768488", "0.5764933", "0.57297516", "0.57288843...
0.0
-1
def active_user if current_user && current_user.active == 0 && current_user != User.first redirect_to new_user_session_path redirect_to current_user sign_out(current_user) redirect_to new_user_session_path end end
def only_admin if user_role == 'admin' else redirect_to clients_path, notice: "У вас нет прав для просмотра даного раздела, или редактирования информации" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def active_user\n redirect_to(root_path) unless (current_user != nil && current_user.active == true)\n end", "def active_user\n redirect_to(root_url) unless current_user.active?\n end", "def require_active_user\n unless current_user && current_user.status == UserStatus::ACTIVE\n flash[:...
[ "0.8795437", "0.86254716", "0.77000654", "0.74746656", "0.746405", "0.7462757", "0.74206984", "0.7395661", "0.73685396", "0.7273973", "0.7246089", "0.723155", "0.7210896", "0.71574074", "0.7156436", "0.71554816", "0.71541846", "0.71421313", "0.7115309", "0.70957345", "0.70859...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_notice @board = Board.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 notice_params params.require(:board).permit(:project_id, :category_id, :title, :pre_title, :user_id, :count_at, :content, :data) 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
POST /tickets POST /tickets.xml
def create @ticket = Ticket.new(params[:ticket]) @ticket.ticket_status_id = 1 @ticket.requestor_id = current_user.id @ticket.account_id = current_user.company.account_id respond_to do |format| if @ticket.save format.html { redirect_to(@ticket, :notice => 'Ticket was successfully created.') } format.xml { render :xml => @ticket, :status => :created, :location => @ticket } else format.html { render :action => "new" } format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def CreateTicket params = {}\n\n APICall(path: 'tickets.json',method: 'POST',payload: {ticket: params}.to_json)\n \n end", "def create\n @ticket = OTRS::Ticket.new(params[:ticket])\n\n respond_to do |wants|\n if @ticket.save\n flash[:notice] = 'Ticket was successfully created...
[ "0.6977013", "0.6767579", "0.6441101", "0.6353196", "0.6283202", "0.62500036", "0.6162499", "0.6154073", "0.61421895", "0.6128714", "0.6120049", "0.61138666", "0.60984397", "0.6093189", "0.6078853", "0.60691994", "0.6067009", "0.6067009", "0.6067009", "0.6067009", "0.60668504...
0.62009346
6
PUT /tickets/1 PUT /tickets/1.xml
def update @ticket = Ticket.find(params[:id]) # if open if params[:ticket][:ticket_status_id] == "1" @ticket.solver_id = nil # if solved elsif params[:ticket][:ticket_status_id] == "2" @ticket.solver_id = current_user.id @ticket.solved_at = Time.now end respond_to do |format| if @ticket.update_attributes(params[:ticket]) format.html { redirect_to(@ticket, :notice => 'Ticket was successfully updated.') } # format.xml { head :ok } else format.html { render :action => "edit" } # format.xml { render :xml => @ticket.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def UpdateTicket params = {}\n \n APICall(path: 'tickets.json',method: 'PUT',payload: params.to_json)\n \n end", "def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present t...
[ "0.71716595", "0.6992756", "0.66403306", "0.65968966", "0.65968966", "0.6564605", "0.6499069", "0.63786453", "0.63271725", "0.6298588", "0.6288541", "0.62855816", "0.6245388", "0.6234354", "0.6234354", "0.6234354", "0.6234354", "0.6234354", "0.6231986", "0.621225", "0.6185252...
0.60131204
52
DELETE /tickets/1 DELETE /tickets/1.xml
def destroy @ticket = Ticket.find(params[:id]) @ticket.destroy respond_to do |format| format.html { redirect_to(tickets_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteTicket id\n \n APICall(path: \"tickets/#{id}.json\",method: 'DELETE')\n \n end", "def destroy\n @ticket = Ticket.find(params[:id])\n @ticket.destroy\n\n respond_to do |format|\n flash[:notice] = 'Ticket was successfully deleted.'\n format.html { redirect_to ...
[ "0.72978204", "0.70917976", "0.7014431", "0.6937131", "0.68844134", "0.68618435", "0.68491113", "0.6813173", "0.67988074", "0.67745036", "0.67414105", "0.6731433", "0.67303765", "0.66890657", "0.6686519", "0.66465455", "0.66249007", "0.66245013", "0.6616118", "0.66036433", "0...
0.7175858
7
Removes all devices registered to receive push notifications from Ably matching the filter params provided.
def remove_where(params = {}) filter = if params.kind_of?(Ably::Models::DeviceDetails) { 'deviceId' => params.id } else raise ArgumentError, "params must be a Hash" unless params.kind_of?(Hash) raise ArgumentError, "device_id filter cannot be specified alongside a client_id filter. Use one or the other" if params[:client_id] && params[:device_id] IdiomaticRubyWrapper(params).as_json end client.delete("/push/deviceRegistrations", filter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_where(params)\n raise ArgumentError, \"params must be a Hash\" unless params.kind_of?(Hash)\n\n if (IdiomaticRubyWrapper(params).keys & [:channel, :client_id, :device_id]).length == 0\n raise ArgumentError, \"at least one channel, client_id or device_id filter param must be provid...
[ "0.6857784", "0.58889776", "0.58623", "0.582682", "0.578672", "0.57309055", "0.5698828", "0.5681943", "0.56647724", "0.5607639", "0.55510014", "0.5544888", "0.5520093", "0.54906213", "0.54903895", "0.5469456", "0.5461047", "0.54393256", "0.54155356", "0.5392632", "0.53730863"...
0.71179
0
Generates accessor method and sets configuration for Neo4j node properties. The generated accessor is a simple wrapper around the set_property and get_property methods. If a property is set to nil the property will be removed. ==== Configuration By setting the :type configuration parameter to 'Object' makes it possible to marshal any ruby object. If no type is provided the only the native Neo4j property types are allowed: TrueClass, FalseClass String Fixnum Float Boolean ==== Parameters props:: a variable length arguments or a hash, see example below ==== Example class Baaz; end class Foo include Neo4j::NodeMixin property :name, :city can set several properties in one go property :bar, :type => Object allow serialization of any ruby object end f = Foo.new f.bar = Baaz.new
def property(*props) if props.size == 2 and props[1].kind_of?(Hash) props[1].each_pair do |key, value| pname = props[0].to_sym properties_info[pname] ||= {} properties_info[pname][key] = value end props = props[0..0] end props.each do |prop| pname = prop.to_sym properties_info[pname] ||= {} properties_info[pname][:defined] = true define_method(pname) do self[pname] end name = (pname.to_s() +"=").to_sym define_method(name) do |value| self[pname] = value end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def property(*props)\n if props.size == 2 and props[1].kind_of?(Hash)\n props[1].each_pair do |key,value|\n pname = props[0].to_sym\n properties_info[pname] ||= {}\n properties_info[pname][key] = value\n end\n props = props[0..0]\n end\n\n ...
[ "0.63775975", "0.63535565", "0.59530765", "0.58846277", "0.58574575", "0.5857003", "0.5849898", "0.5847692", "0.5821723", "0.5769069", "0.57295257", "0.56559294", "0.56281114", "0.5617659", "0.558959", "0.5545663", "0.5450895", "0.53524506", "0.53454447", "0.5340233", "0.5326...
0.60443807
2
Returns true if the given property name should be marshalled. All properties that has a type will be marshalled. ===== Example class Foo include Neo4j::NodeMixin property :name property :since, :type => Date end Foo.marshal?(:since) => true Foo.marshal?(:name) => false ==== Returns true if the property will be marshalled, false otherwise
def marshal?(prop_name) return false if properties_info[prop_name.to_sym].nil? return false if properties_info[prop_name.to_sym][:type].nil? return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshal?(prop_name)\n return false if properties_info[prop_name.to_sym].nil?\n return false if properties_info[prop_name.to_sym][:type].nil?\n return true\n end", "def property?(name); end", "def has_property?(name)\n property_names.include?(name.to_str)\n end", ...
[ "0.8062677", "0.61960185", "0.5974656", "0.5831312", "0.5795914", "0.5782261", "0.57817006", "0.5751793", "0.55826074", "0.5459678", "0.54196894", "0.53208745", "0.5304282", "0.52475804", "0.5242632", "0.523897", "0.5230043", "0.5184926", "0.51785046", "0.5146686", "0.5139103...
0.80511063
1
Returns true if the given property name has been defined with the class method property or properties. Notice that the node may have properties that has not been declared. It is always possible to set an undeclared property on a node. ==== Returns true or false
def property?(prop_name) return false if properties_info[prop_name.to_sym].nil? properties_info[prop_name.to_sym][:defined] == true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def property?(name)\n @internal_node.has_property(name.to_s) unless @internal_node.nil?\n end", "def has_property?(name)\n property_names.include?(name.to_str)\n end", "def property?(prop_name)\n return false if properties_info[prop_name.to_sym].nil?\n properties_info[pr...
[ "0.79378545", "0.76343876", "0.75983834", "0.7464764", "0.7442013", "0.7371657", "0.7225832", "0.7218207", "0.7097377", "0.70181096", "0.7017852", "0.7000701", "0.69489336", "0.68501025", "0.67837983", "0.6724318", "0.66626936", "0.6576955", "0.6532775", "0.64939904", "0.6493...
0.76550156
1
Creates a struct class containig all properties of this class. ==== Example h = Person.value_object.new h.name => nil h.name='kalle' h[:name] => 'kalle' ==== Returns Struct
def value_object @value_class ||= create_value_class end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_value_class\n # the name of the class we want to create\n name = \"#{self.to_s}ValueObject\".gsub(\"::\", '_')\n\n # remove previous class if exists\n Neo4j.instance_eval do\n remove_const name\n end if Neo4j.const_defined?(name)\n\n # get the propertie...
[ "0.7290117", "0.712792", "0.64528716", "0.6395849", "0.6395849", "0.61798507", "0.5757991", "0.5638254", "0.56272686", "0.5536849", "0.5526361", "0.5524188", "0.54884356", "0.5480611", "0.5480101", "0.5471257", "0.5440912", "0.5440554", "0.5404191", "0.53968036", "0.5391301",...
0.63100135
5
Index a property or a relationship. If the rel_prop arg contains a '.' then it will index the relationship. For example "friends.name" will index each node with property name in the relationship friends. For example "name" will index the name property of this NodeMixin class. ==== Example class Person include Neo4j::NodeMixin property :name index :name end
def index(*rel_type_props) if rel_type_props.size == 2 and rel_type_props[1].kind_of?(Hash) rel_type_props[1].each_pair do |key, value| idx = rel_type_props[0] indexer.field_infos[idx.to_sym][key] = value end rel_type_props = rel_type_props[0..0] end rel_type_props.each do |rel_type_prop| rel_name, prop = rel_type_prop.to_s.split('.') index_property(rel_name) if prop.nil? index_relationship(rel_name, prop) unless prop.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index(*rel_type_props)\n if rel_type_props.size == 2 and rel_type_props[1].kind_of?(Hash)\n rel_type_props[1].each_pair do |key,value|\n idx = rel_type_props[0]\n lucene_index.field_infos[idx.to_sym][key] = value\n end\n rel_type_props = rel_type_props[0....
[ "0.7288442", "0.67547715", "0.6402718", "0.62274927", "0.5914052", "0.56443816", "0.54494786", "0.5249937", "0.5191071", "0.51769805", "0.51255125", "0.5123793", "0.5071441", "0.48718327", "0.48432213", "0.48432213", "0.48187688", "0.48037878", "0.47879744", "0.47714213", "0....
0.75249135
0
Remove one or more specified indexes. Those indexes will not be updated anymore, old indexes will still exist until the update_index method is called.
def remove_index(*keys) keys.each do |key| raise "Not implemented remove index on a relationship index" if key.to_s.include?('.') indexer.remove_index_on_property(key) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_index(*keys)\n keys.each do |key|\n index_updaters.delete key.to_s\n index_triggers.delete key.to_s\n end\n end", "def delete_indexes\n self.class.indexes.each do |name, index|\n index.delete(self)\n end\n end", "def remove_indexes\n wi...
[ "0.7717733", "0.76628214", "0.76315725", "0.7231418", "0.7117488", "0.68684566", "0.68525743", "0.6832971", "0.6784574", "0.6774953", "0.6773404", "0.6766283", "0.67055947", "0.6572012", "0.6560715", "0.6540171", "0.6433763", "0.6374606", "0.63630974", "0.62896067", "0.623406...
0.68711066
5
Creates a new value object class (a Struct) representing this class. The struct will have the Ruby on Rails method: model_name and new_record? so that it can be used for restful routing.
def create_value_class # :nodoc: # the name of the class we want to create name = "#{self.to_s}ValueObject".gsub("::", '_') # remove previous class if exists Neo4j.instance_eval do remove_const name end if Neo4j.const_defined?(name) # get the properties we want in the new class props = self.properties_info.keys.map{|k| ":#{k}"}.join(',') Neo4j.module_eval %Q[class #{name} < Struct.new(#{props}); end] # get reference to the new class clazz = Neo4j.const_get(name) # make it more Ruby on Rails friendly - try adding model_name method if self.respond_to?(:model_name) model = self.model_name.clone ( class << clazz; self; end).instance_eval do define_method(:model_name) {model} end end # by calling the _update method we change the state of the struct # so that new_record returns false - Ruby on Rails clazz.instance_eval do define_method(:_update) do |hash| @_updated = true hash.each_pair {|key, value| self[key.to_sym] = value if members.include?(key.to_s) } end define_method(:new_record?) { ! defined?(@_updated) } end clazz end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_value_class\n # the name of the class we want to create\n name = \"#{self.to_s}ValueObject\".gsub(\"::\", '_')\n\n # remove previous class if exists\n Neo4j.instance_eval do\n remove_const name\n end if Neo4j.const_defined?(name)\n\n # get the propertie...
[ "0.76358664", "0.6627431", "0.6627431", "0.65742934", "0.65742934", "0.6490917", "0.64336646", "0.63315207", "0.62739456", "0.6219534", "0.61787766", "0.6158979", "0.61205995", "0.6024203", "0.5948093", "0.5932635", "0.5932635", "0.5900365", "0.5882989", "0.5847604", "0.58476...
0.75324345
1
Complete the freqQuery function below.
def freqQuery(queries) data_to_freq = Hash.new(0) freq_to_data = Hash.new { |h, a| h[a] = Set.new } answers = [] queries.each do |(op, operand)| case op when 1 freq = data_to_freq[operand] freq_to_data[freq].delete(operand) freq_to_data[freq + 1].add(operand) data_to_freq[operand] += 1 when 2 freq = data_to_freq[operand] if freq > 0 freq_to_data[freq].delete(operand) freq_to_data[freq - 1].add(operand) data_to_freq[operand] -= 1 end when 3 if freq_to_data[operand].empty? answers << '0' else answers << '1' end end end answers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getfreqs\n @freqs = Hash.new\n @fieldvalues.each do |v|\n @freqs[v] = @db.execute(\"select count(*) from #{@tablename} where #{@fieldname} = '#{v}'\").to_s \n end\nend", "def frequency\n \n end", "def termfreq_query(ocr_search_terms)\n search_terms = if ocr_search_terms.match?(/\\A\"[\\...
[ "0.687462", "0.67307854", "0.6713973", "0.66566217", "0.6513829", "0.6458088", "0.63687646", "0.6342034", "0.63073784", "0.6299702", "0.6294351", "0.629047", "0.62090176", "0.6191928", "0.6149464", "0.61120784", "0.6064749", "0.60541934", "0.6044832", "0.6039893", "0.60311043...
0.6815869
1
I worked on this challenge by myself. I spent 1.5 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? two mandatory parameters: an array and an integer representing the min size for the array 1 optional parameter: what the array should be padded with What is the output? (i.e. What should the code return?) should return an array with values upto the min size What are the steps needed to solve the problem? IF min_size is > the arrays length Create empty container Set Container to array Set difference variable to min_size arrays length Create counter and set it to 0 WHILE counter < difference variable Push the optional value into the container Add one to the counter END WHILE ELSIF the min_size <= array length Create Counter and set it to 0 Create empty container WHILE counter is < array length Push the array value into the container Add one to the counter END WHILE END IF RETURN container 1. Initial Solution
def pad!(array, min_size, value = nil) #destructive array.keep_if{ |a| a <= array.length} difference = min_size - array.length counter = 0 while counter < difference array << value counter += 1 end p array # self = ans_array return array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(array, min_size, value = nil) #non-destructive\n \n new_array = [].concat(array)\n # array.each { |el| new_array << el } \n \n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount of difference into array through defau...
[ "0.7629955", "0.7571371", "0.7521349", "0.7518253", "0.7482418", "0.7437794", "0.74250764", "0.74179643", "0.74141103", "0.7413934", "0.74125034", "0.74018675", "0.73859525", "0.73849076", "0.73831195", "0.7358307", "0.73367393", "0.73341274", "0.733276", "0.73265755", "0.732...
0.71717703
47
Output basic sentence errors. Usage:
def errors(object, method, options = {}) if object.errors[method] content_tag(::Erroneous.error_tag, :class => ::Erroneous.error_class) do object.errors[method].to_sentence end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_error\n error <<~MSG\n Sorry, please check\n your input to verify it\n is correct.\n MSG\n prompt error\nend", "def print_error\n puts @error_text if @error_text\n print_usage\n end", "def error\n\tputs \" - Dis donc #{@name}, tu vois pas que c'est pas possible ?!? Allez r...
[ "0.67367315", "0.672531", "0.65944815", "0.6547218", "0.65372294", "0.65144575", "0.6505194", "0.65014064", "0.65003645", "0.6484086", "0.6466017", "0.6463041", "0.64473766", "0.6444941", "0.6424828", "0.6402322", "0.6401382", "0.6400696", "0.63699234", "0.63499945", "0.63352...
0.0
-1
GET /info_products GET /info_products.json
def index @info_products = InfoProduct.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_g...
[ "0.7567608", "0.75569105", "0.75371516", "0.7463189", "0.7324338", "0.72873944", "0.72737664", "0.7253924", "0.72452885", "0.72249985", "0.722452", "0.7219048", "0.7216621", "0.72044146", "0.71736133", "0.7155781", "0.71354663", "0.7135314", "0.7134823", "0.7127358", "0.71262...
0.72787297
6
GET /info_products/1 GET /info_products/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @products = Product.find_by_id(params[:id])\n msg = { status: 200 , product: @products }\n respond_to do |format|\n format.html { render json: msg }\n format.json { render json: msg }\n end\n end", "def show\n @product = Product.find(params[:id])\n json_re...
[ "0.75499177", "0.7508243", "0.74916375", "0.73904586", "0.73874795", "0.73768646", "0.7366282", "0.7366152", "0.7349132", "0.73397946", "0.73336214", "0.7286331", "0.7219111", "0.72103363", "0.7199447", "0.716116", "0.7157434", "0.7138505", "0.7112859", "0.7106358", "0.710409...
0.0
-1
POST /info_products POST /info_products.json
def create @info_product = InfoProduct.new(info_product_params) respond_to do |format| if @info_product.save format.html { redirect_to @info_product, notice: 'Info product was successfully created.' } format.json { render action: 'show', status: :created, location: @info_product } else format.html { render action: 'new' } format.json { render json: @info_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n if params[:products]\n params[:products].each do |product|\n @product = Product.new(name: product[:name],\n brand: product[:brand],\n model: product[:model],\n sku: product[:sku],\n ...
[ "0.728334", "0.6980908", "0.6914759", "0.69123816", "0.6908625", "0.6870827", "0.6858335", "0.6855899", "0.682818", "0.6824612", "0.6822394", "0.6797391", "0.67972535", "0.6770512", "0.6738885", "0.67355305", "0.67327815", "0.6723256", "0.6721253", "0.6698904", "0.66781783", ...
0.7339541
0
PATCH/PUT /info_products/1 PATCH/PUT /info_products/1.json
def update respond_to do |format| if @info_product.update(info_product_params) format.html { redirect_to @info_product, notice: 'Info product was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @info_product.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n return unless product_params\n render json: @product.simple_info, status: :ok if @product.up...
[ "0.7304445", "0.71842456", "0.6979929", "0.6957122", "0.6861858", "0.68566513", "0.6784718", "0.6772806", "0.67465615", "0.67307997", "0.6723913", "0.6685266", "0.66630507", "0.66611165", "0.6652337", "0.66399974", "0.6631596", "0.6614675", "0.6602834", "0.6601796", "0.659379...
0.69542384
4
DELETE /info_products/1 DELETE /info_products/1.json
def destroy @info_product.destroy respond_to do |format| format.html { redirect_to info_products_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end", "def delete(options = nil)\n request = Request.new(@client)\n path = \"/products/\" + CGI...
[ "0.74346274", "0.72619194", "0.7249758", "0.7246764", "0.7217557", "0.7213932", "0.71968603", "0.7156025", "0.7116255", "0.7105015", "0.71042186", "0.70819986", "0.7066436", "0.7064341", "0.7051715", "0.7046372", "0.7041738", "0.70407706", "0.7034847", "0.7031881", "0.7031881...
0.7495183
0
Use callbacks to share common setup or constraints between actions.
def set_info_product @info_product = InfoProduct.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 info_product_params params.require(:info_product).permit(:title, :description, :image_id, :price) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
pass only inpatient or outpatient and script will update all the rates for items
def update_rate_for_philhealth(admission_type) @path = "../csv/inpatient_ordered_items.csv" if admission_type == 'inpatient' @path = "../csv/or_ordered_items.csv" if admission_type == 'outpatient' my_file = CSV.read(@path) count = my_file.count w = [] x = 1 count.times do w << my_file[x][0] if x + 1 == my_file.count else x += 1 end end Database.connect @info = [] if admission_type == 'inpatient' w.each do |o| @info << get_item_rate(:inpatient => true, :item_code => o) end elsif admission_type == 'outpatient' w.each do |o| @info << get_item_rate(:outpatient => true, :item_code => o) end end line_arr = File.readlines(@path) File.open(@path, "w") do |f| line_arr = "MSERVICE_CODE,RATE,MRP_TAG,PH_CODE,ORDER_TYPE,DESCRIPTION" line_arr.each{|line| f.puts(line)} end @x = 0 @info.each do |s| add_line_to_csv(@path, s) if (@x + 1) == @info.count else @x += 1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit_rates\n return unless has_permission :can_do_billing\n @page_title = 'Edit Aircraft and Instructor Hourly Rates'\n @instructors = Group.users_in_group('instructor')\n @aircrafts = Aircraft.find(:all,:conditions=>['deleted = false'],:order=>\"identifier\")\n @offices = Office.find :all\n @instructors...
[ "0.6121198", "0.59733105", "0.59733105", "0.5854111", "0.5800185", "0.57689226", "0.5761698", "0.5749352", "0.5744491", "0.5731893", "0.56728816", "0.5671284", "0.564213", "0.5625614", "0.5587672", "0.55637926", "0.5541054", "0.55288035", "0.5517269", "0.550026", "0.54926145"...
0.6166932
0
GET /groups/1 GET /groups/1.xml
def show @group = Group.find(params[:id]) @groupphoto_comments = Comment.find_groupphoto_comments_for(@group) @groupphotos = @group.groupphotos.find(:all, :limit => 5) @comments = @group.comments.find(:all, :limit => 10, :order => 'created_at DESC') @groups_comments = Comment.find_group_comments_for(@group) if @group.owner == current_user @is_group_owner = true else @is_group_owner = false end @member_count = @group.accepted_memberships.count @accepted_memberships = @group.accepted_memberships.find(:all, :limit => 5).collect{|f| f.member } @pending_memberships_count = @group.pending_memberships.count() update_view_count(@group) unless @group.owner && current_user.eql?(@group) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n respond_to do |format|\n format.html { @groups = Group.get_groups(current_user, params) }\n format.xml { render :xml => Group.get_groups(params.merge({:show => 'all'})) }\n end\n end", "def index\n respond_to do |format|\n format.html { @groups = Group.get_groups(current_use...
[ "0.7458304", "0.7458304", "0.73493075", "0.7280024", "0.7280024", "0.7198835", "0.71705717", "0.71705717", "0.7100443", "0.7045646", "0.702687", "0.7020981", "0.7020981", "0.7020981", "0.7020981", "0.7020981", "0.69466156", "0.69457245", "0.6941096", "0.6915983", "0.6859768",...
0.0
-1
GET /groups/new GET /groups/new.xml
def new @group = Group.new @membership = Membership.new @group_permission = GroupPermission.new @metro_areas = MetroArea.find(:all) @states = State.find(:all) respond_to do |format| format.html # new.html.erb format.xml { render :xml => @group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end...
[ "0.7769969", "0.7768821", "0.7768821", "0.7768821", "0.7768821", "0.7768821", "0.7768821", "0.7768821", "0.7768821", "0.7768821", "0.76758593", "0.76745856", "0.7673317", "0.7649658", "0.7647979", "0.7647979", "0.76447934", "0.75070655", "0.7494794", "0.7486221", "0.7481707",...
0.68859965
64
POST /groups POST /groups.xml
def create @group = Group.new(params[:group]) #here we add the current user to the membership collection of the group @membership = @group.memberships.build(params[:membership]) @membership.group = @group @membership.user = current_user @membership.initiator = false @membership.membership_status_id = 2 #and here we set the current_user as the owner of the group @group_permission = @group.group_permissions.build(params[:group_permission]) @group_permission.membership = @membership @group_permission.group_role = GroupRole.find_by_name('Owner') @group.metro_area = MetroArea.find(params[:metro_area_id]) @group.state = (@group.metro_area && @group.metro_area.state) ? @group.metro_area.state : nil @group.country = @group.metro_area.country if (@group.metro_area && @group.metro_area.country) #current_user.track_activity(:created_a_group) # unless @user.is_in_group?(@group) # @user.memberships << @group # end respond_to do |format| if @group.save flash[:notice] = 'Group was successfully created.' format.html { redirect_to(@group) } format.xml { render :xml => @group, :status => :created, :location => @group } else format.html { render :action => "new" } format.xml { render :xml => @group.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(groups)\n groups_params = groups.inject({}) do |params, (k, v)|\n params[\"groups[#{k}]\"] = 1\n params\n end\n\n response = RouteNGN.put self.class.base_url, {:id => self.id}.merge!(groups_params)\n response.success?\n end", "def create\n #logger.info \"Post parameters...
[ "0.660965", "0.6602641", "0.6588023", "0.6588023", "0.6567241", "0.6546185", "0.6518592", "0.63975435", "0.6392506", "0.6383147", "0.63828105", "0.6363887", "0.6356866", "0.6355277", "0.6355277", "0.6355277", "0.6323264", "0.6296784", "0.6214893", "0.61911434", "0.6170261", ...
0.0
-1
PUT /groups/1 PUT /groups/1.xml
def update @group = Group.find(params[:id]) unless params[:metro_area_id].blank? @group.metro_area = MetroArea.find(params[:metro_area_id]) @group.state = (@group.metro_area && @group.metro_area.state) ? @group.metro_area.state : nil @group.country = @group.metro_area.country if (@group.metro_area && @group.metro_area.country) else @group.metro_area = @group.state = @group.country = nil end @avatar = Groupphoto.new(params[:avatar]) @avatar.group = @group @group.avatar = @avatar if @avatar.save respond_to do |format| if @group.update_attributes(params[:group]) flash[:notice] = 'Group was successfully updated.' format.html { redirect_to(@group) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @group.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def update\n \n @group = Group.find(...
[ "0.6685341", "0.66725194", "0.66642857", "0.66642857", "0.664555", "0.6640031", "0.6640031", "0.6640031", "0.6640031", "0.6640031", "0.6640031", "0.6574576", "0.65679026", "0.6565279", "0.6562684", "0.654085", "0.6539202", "0.6516348", "0.65080595", "0.6467505", "0.6426014", ...
0.0
-1
DELETE /groups/1 DELETE /groups/1.xml
def destroy Group.destroy(params[:id]) respond_to do |format| format.html { redirect_to(groups_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n\n @group = Group.find(params[:id])\n @group.d...
[ "0.75220656", "0.7415823", "0.7415823", "0.7407739", "0.738726", "0.73836434", "0.73836434", "0.73836434", "0.73836434", "0.73836434", "0.73836434", "0.73836434", "0.73836434", "0.7370456", "0.7269584", "0.72519714", "0.7237191", "0.71856934", "0.71669525", "0.7165269", "0.71...
0.74686384
1
Returns the models based on parameters
def models(join_ids = nil, page = nil, where = {}) models = self.where(where) models = models.page(page) unless page.nil? models = join_habtm(models, join_ids) if join_ids models end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def requested_models(requested_model)\n case requested_model\n when /^(.+)[(](.+)[)]$/ #handle model(with associations), i.e. Image(for scene A)\n base_model = $1.classify.constantize\n scopes = $2.split(',')\n models = base_model\n\n scopes.each do |scope|\n models = models.send(sco...
[ "0.7198896", "0.70128286", "0.6698968", "0.6597765", "0.651536", "0.64912206", "0.64506626", "0.6446446", "0.6424069", "0.6421399", "0.6349976", "0.6330564", "0.62953407", "0.62894386", "0.6273193", "0.6266258", "0.6188774", "0.6178141", "0.6174015", "0.6171136", "0.61071527"...
0.0
-1
removes slashes before and after a string
def strip_slashes self.gsub(/(^\/|\/$)/,'') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_slash(str)\n\t\tarr = str.split('/')\n\t\tret = arr.first\n\t\tarr.delete_at(0)\n\t\tarr.each { |s|\n\t\t\tif s != ''\n\t\t\t\tret += \"/#{s}\"\n\t\t\tend\n\t\t}\n\t\tret\n\tend", "def strip_slash(input)\n if input =~ /(.+)\\/$|^\\/$/\n input = $1\n end\n input\n end", "def strip_slas...
[ "0.7873733", "0.7776378", "0.7776378", "0.7557837", "0.7306148", "0.72933346", "0.7206056", "0.7093182", "0.70899636", "0.7089076", "0.70371234", "0.6988588", "0.6978141", "0.6940838", "0.6926858", "0.6906179", "0.6906179", "0.6816555", "0.6774389", "0.6772389", "0.67420274",...
0.7496338
4
Fully qualified queue name (i.e luigi:useast1)
def fqqn if new_resource.queue_name new_resource.queue_name else "#{new_resource.name}_#{new_resource.region_name}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n @queue_string\n end", "def name\n @queue.name\n end", "def name\n @queue.queue_name\n end", "def request_queue_name(name)\n \"fluffle.requests.#{name}\"\n end", "def relative_queue\n gcp_task\n .name\n .match(%r{/queues/([^/]+)})\n...
[ "0.8114529", "0.7788377", "0.7739617", "0.751874", "0.73683435", "0.73626435", "0.73158616", "0.73158616", "0.7235672", "0.72337466", "0.72337466", "0.7082629", "0.7080004", "0.7001149", "0.6981248", "0.6746225", "0.6711521", "0.66642004", "0.66524565", "0.6619211", "0.654513...
0.6805738
15
The method should return the number of pairs of elements that sum to 0.
def opposite_count(nums) count = 0 nums.each.with_index do |num1, index1| nums.each_with_index do |num2, index2| if index1 < index2 && num1 + num2 == 0 count += 1 end end end count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pairs_to_zero(nums)\n\n count = 0\n newArr = []\n\n for i in 0..nums.length do\n for j in 1..nums.length do\n if nums[i].to_i + nums[j].to_i == 0\n count = count + 1\n end\n end\n end\n return count-2\nend", "def pairs_to_zero(nums)\n # Write ...
[ "0.80425924", "0.782534", "0.77792853", "0.75105983", "0.7424221", "0.7382175", "0.7310076", "0.72767335", "0.7272561", "0.72348154", "0.7210766", "0.7209286", "0.7196865", "0.71952045", "0.71829265", "0.71720654", "0.715707", "0.7145629", "0.7088739", "0.7019778", "0.7007886...
0.696116
21
key to get just the data part of the bag
def bag_key(bag_name) File.join(complete_bag_key(bag_name), 'data') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_data; end", "def key_data; end", "def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end", "def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n end", "def get_from_data_bags_cache(data_bag)\n encrypted_data_bags[data_bag]\n ...
[ "0.7407418", "0.7407418", "0.720429", "0.720429", "0.7203217", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0.6893434", "0....
0.7256075
2
key to get the entire bag
def complete_bag_key(bag_name) File.join('bags', bag_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bag_key(bag_name)\n File.join(complete_bag_key(bag_name), 'data')\n end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end",...
[ "0.71697104", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383", "0.71051383"...
0.71649796
1
and it should ignore all nonalphanumeric characters. If you wish, you may simplify things by calling the palindrome? method you wrote in the previous exercise. Examples:
def real_palindrome?(string) string.downcase.delete('^a-z0-9') == string.downcase.delete('^a-z0-9').reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def real_palindrome?(string)\n new_string = string.downcase.chars.delete_if { |element| !/[a-zA-Z0-9]/.match?(element)}.join\n new_string == new_string.reverse\nend", "def real_palindrome?(string)\n palindrome?(string.downcase.gsub(/\\W/, ''))\nend", "def real_palindrome?(str)\n str = str.downcase.delete('...
[ "0.8061688", "0.7958594", "0.7935886", "0.79180074", "0.7915282", "0.79099977", "0.79095405", "0.7869924", "0.7869924", "0.7869924", "0.7869924", "0.7869924", "0.7869924", "0.78595537", "0.7833781", "0.7828668", "0.7824666", "0.77922434", "0.77727246", "0.77567196", "0.774245...
0.7564981
52
Only allow a trusted parameter "white list" through.
def cat_ppr_expense_type_params params.require(:cat_ppr_expense_type).permit(:key, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_flop @flop = Flop.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 flop_params params.require(:flop).permit(:game_id, :user_id, :comment, :flopplayer) 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.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
GET /events GET /events.json
def index # @search = Event.ransack(params[:q]) if current_user.role.super_admin==true || current_user.role.ie_supervisor==true || current_user.role.super_supervisor==true @events = Event.where('status_id BETWEEN ? AND ?', 10020,10022).order('priority_id ASC') @json = Event.all.to_gmaps4rails elsif current_user.role.medios==true if current_user.analyst.area_id == 10001 @events = Event.where("status_id = ?", 10020).order('priority_id ASC') elsif current_user.analyst.area_id == 10000 @events = Event.where("analyst_id = ? AND status_id = ?", current_user.analyst_id,10020).order('priority_id ASC') end elsif current_user.role.supervisor == true if current_user.analyst.area_id == 10001 @events = Event.where('status_id BETWEEN ? AND ? AND area_id BETWEEN ? AND ?', 10020,10022,10001,10003).order('priority_id ASC') elsif current_user.analyst.area_id == 10000 @events = Event.where('status_id BETWEEN ? AND ? AND area_id = ?', 10020,10022,10000).order('priority_id ASC') end else @events = Event.where("analyst_id = ? AND status_id BETWEEN ? AND ?", current_user.analyst_id, 10020,10022).order('priority_id ASC') @json = Event.where("(analyst_id = #{current_user.analyst_id})").to_gmaps4rails end respond_to do |format| format.html # index.html.erb format.json { render json: @events } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}...
[ "0.8337294", "0.82393", "0.7943906", "0.7928331", "0.77682066", "0.77408546", "0.76701826", "0.7665501", "0.76581633", "0.7642472", "0.76212007", "0.7615658", "0.7615658", "0.7612881", "0.75687", "0.7522498", "0.7488667", "0.74813455", "0.74698067", "0.7441679", "0.74408287",...
0.0
-1
GET /events/1 GET /events/1.json
def show @event = Event.find(params[:id]) @json=Event.find(params[:id]).to_gmaps4rails respond_to do |format| format.html # show.html.erb format.json { render json: @event } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use...
[ "0.75029767", "0.74019474", "0.7361382", "0.7348975", "0.73475033", "0.7338018", "0.7317425", "0.72875094", "0.72813755", "0.7246173", "0.72317284", "0.7219172", "0.7219172", "0.7218839", "0.7218839", "0.721464", "0.7204848", "0.71989256", "0.7196662", "0.71925515", "0.719221...
0.0
-1
GET /events/new GET /events/new.json
def new @event = Event.new @event.latitude = 28.700001 @event.longitude = -105.966667 @json = '[{"description":"<h4>Evento 10000</h4><h4>Periferico de la Juventud 4101, Colinas del Sol, Chihuahua</h4>","lat":"28.6352778","lng":"-106.0888889"}]' respond_to do |format| format.html # new.html.erb format.json { render json: @event } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @event = Event.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end", "def new\n @event = Event.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @event }\n end\n end", ...
[ "0.81609446", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513", "0.81505513"...
0.0
-1
POST /events POST /events.json
def create @event = Event.new(params[:event]) if @event.status_id.nil? @event.status_id = 10020 end @event.description = @event.description.upcase @event.address = @event.address.upcase @event.suburb = @event.suburb.upcase @event.observations = @event.observations.upcase # @event.searchable = @event.searchable+ " " + @event.idstring if @event.searchable==nil @event.searchable = " " end if @event.analyst_id != nil @event.searchable = @event.searchable + " " + @event.analyst.analyst end if @event.description != nil @event.searchable = @event.searchable+ " "+@event.description end if(@event.address!=nil) @event.searchable=@event.searchable+" "+@event.address end if @event.locality_id!=nil @event.searchable=@event.searchable+" "+@event.locality.locality end if @event.area_id!=nil @event.searchable=@event.searchable+" "+@event.area.description end if @event.crime_id!=nil @event.searchable=@event.searchable+" "+@event.crime.crime end if @event.observations!=nil @event.searchable=@event.searchable+" "+@event.observations end respond_to do |format| if @event.save # UserMailer.event_registration(@event).deliver format.html { redirect_to @event, notice: 'Evento registrado exitosamente.' } format.json { render json: @event, status: :created, location: @event } else format.html { render action: "new" } format.json { render json: @event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def crea...
[ "0.7714071", "0.7611226", "0.76028967", "0.7541319", "0.7444731", "0.73206913", "0.73138195", "0.728203", "0.7251226", "0.7235907", "0.7235907", "0.7215051", "0.71682763", "0.7150409", "0.7126664", "0.7118896", "0.7117831", "0.71162695", "0.70964044", "0.70907074", "0.7083036...
0.0
-1
PUT /events/1 PUT /events/1.json
def update @event = Event.find(params[:id]) if @event.searchable==nil @event.searchable = " " end if @event.analyst_id != nil @event.searchable = @event.searchable + " " + @event.analyst.analyst end # @event.searchable = @event.searchable+ " " + @event.idstring if @event.description != nil @event.searchable = @event.searchable+" "+@event.description end if @event.address!=nil @event.searchable=@event.searchable+" "+@event.address end if @event.locality_id!=nil @event.searchable=@event.searchable+" "+@event.locality.locality end if @event.area_id!=nil @event.searchable=@event.searchable+" "+@event.area.description end if @event.crime_id!=nil @event.searchable=@event.searchable+" "+@event.crime.crime end if @event.observations!=nil @event.searchable=@event.searchable+" "+@event.observations end respond_to do |format| if @event.update_attributes(params[:event]) format.html { redirect_to @event, notice: 'Evento actualizado exitosamente.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @event.update(event_params)\n render json: @event, status: 201\n else\n render json: { message: \"Error. Error. Please try again.\"}, status: 400\n end\n end", "def put_events(args)\n\tapi_url = \"#{@base_url}/#{args[:collection]}/#{args[:key]}/events/#{args[:event_type]}\"\n\...
[ "0.75664943", "0.74722904", "0.7472032", "0.7430477", "0.7370732", "0.7366599", "0.7356629", "0.73164594", "0.73164594", "0.73085743", "0.72540325", "0.72540325", "0.72351176", "0.7175737", "0.71719027", "0.7161037", "0.7161037", "0.7160709", "0.71240234", "0.71132576", "0.70...
0.0
-1
DELETE /events/1 DELETE /events/1.json
def destroy @event = Event.find(params[:id]) @event.destroy respond_to do |format| format.html { redirect_to events_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_...
[ "0.76930726", "0.76881516", "0.76881516", "0.76881516", "0.7682237", "0.75857896", "0.75689495", "0.7561053", "0.75411737", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.7540857", "0.754029...
0.7514892
65
def create_tool(tool:) todo params argv_params = "file_path /home/hlaushka/Documents/docs/file.csv mode cmd br_sep options print".split ToolsRunner.create(tool, argv_params) end
def validate_tool_index(tool_index) if tool_index < 0 || tool_index > @tools_list.count - 1 puts "Incorrect tool number. Entered tool number should be between 1 and #{@tools_list.count}.".red false else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def command_to_merge_files(tool, input)\n p \"#{ tool } #{ input }\"\nend", "def add_tool(file, clazz)\n name = File.basename(file).gsub(/.rb$/, '').gsub(/_task/, '')\n doc_file = File.expand_path(File.dirname(file) + \"/#{name}_documentation.rb\")\n content = clazz.new(name, Rake::application).to_rdoc\n\n ...
[ "0.5877851", "0.5848357", "0.57052934", "0.56768507", "0.55764115", "0.5547309", "0.5546019", "0.55306214", "0.55171347", "0.5460839", "0.54515946", "0.54385364", "0.54377425", "0.54218215", "0.5402575", "0.5395326", "0.5385869", "0.5383703", "0.53539175", "0.5341093", "0.533...
0.0
-1
Goal: Find the largest palindrome made from the product of two 3digit numbers.
def palindrome?( num ) num.to_s == num.to_s.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_palindrome_product\n palindromes = []\n\n 999.downto(100) do |x|\n 999.downto(100).each do |y|\n if (x * y).to_s == (x * y).to_s.reverse\n palindromes << x * y\n end\n end\n end\n palindromes.max\nend", "def problem_4\n num1 = 999\n largest_pal = 0\n\n while num1 > 99\n ...
[ "0.84046125", "0.83515126", "0.83123755", "0.8290492", "0.8224497", "0.81743455", "0.81512", "0.8136867", "0.8105362", "0.80470777", "0.8046456", "0.8039838", "0.8005792", "0.8000342", "0.79184365", "0.7885222", "0.786905", "0.7838499", "0.78167075", "0.777991", "0.7721346", ...
0.0
-1
initialize fields with blank data
def initialize(attributes = {}, persisted = false) # initialize embedded attributes attributes = attributes.with_indifferent_access attributes[:account] ||= {} super(attributes, persisted) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_with_empty\n new({\"name\" => \"\", \"dob\" => \"\", \"maritalStatus\" => \"\", \"mobileNumber\" => \"\", \"email\" => \"\"})\n end", "def initialize_fields\n publisher.build if publisher.empty?\n contributor.build if contributor.empty?\n creator.build if creator.empty?\n identifie...
[ "0.77298653", "0.7715992", "0.7472341", "0.73990434", "0.72803324", "0.71429145", "0.7063508", "0.7041504", "0.7041434", "0.70047164", "0.69360554", "0.6916612", "0.6900326", "0.68420696", "0.6835774", "0.6812111", "0.67113405", "0.6706716", "0.66904974", "0.6687813", "0.6659...
0.0
-1
GET /latstrapshome4s GET /latstrapshome4s.json
def index @latstrapshome4s = Latstrapshome4.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_latstrapshome4\n @latstrapshome4 = Latstrapshome4.find(params[:id])\n end", "def index\n @latstraps1s = Latstraps1.all\n end", "def create\n @latstrapshome4 = Latstrapshome4.new(latstrapshome4_params)\n\n respond_to do |format|\n if @latstrapshome4.save\n format.html { red...
[ "0.6768186", "0.6311229", "0.61196923", "0.5813387", "0.5644982", "0.5488639", "0.54577315", "0.54411453", "0.5365293", "0.5357068", "0.5356071", "0.53518814", "0.53471994", "0.5314165", "0.52877593", "0.52850556", "0.52842224", "0.52446586", "0.52002513", "0.5183562", "0.517...
0.778371
0
GET /latstrapshome4s/1 GET /latstrapshome4s/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @latstrapshome4s = Latstrapshome4.all\n end", "def set_latstrapshome4\n @latstrapshome4 = Latstrapshome4.find(params[:id])\n end", "def index\n @latstraps1s = Latstraps1.all\n end", "def create\n @latstrapshome4 = Latstrapshome4.new(latstrapshome4_params)\n\n respond_to do |...
[ "0.7583175", "0.6926308", "0.6411559", "0.62909544", "0.6123574", "0.5903843", "0.58503526", "0.5724244", "0.5718959", "0.5693941", "0.5693085", "0.5668104", "0.56536394", "0.5615174", "0.55876994", "0.55804574", "0.55649185", "0.5563946", "0.55394214", "0.55020726", "0.54821...
0.0
-1
POST /latstrapshome4s POST /latstrapshome4s.json
def create @latstrapshome4 = Latstrapshome4.new(latstrapshome4_params) respond_to do |format| if @latstrapshome4.save format.html { redirect_to @latstrapshome4, notice: 'Latstrapshome4 was successfully created.' } format.json { render :show, status: :created, location: @latstrapshome4 } else format.html { render :new } format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_latstrapshome4\n @latstrapshome4 = Latstrapshome4.find(params[:id])\n end", "def index\n @latstrapshome4s = Latstrapshome4.all\n end", "def create\n @latstraps1 = Latstraps1.new(latstraps1_params)\n\n respond_to do |format|\n if @latstraps1.save\n format.html { redirect_to...
[ "0.63684154", "0.63466996", "0.6294666", "0.6129968", "0.5955446", "0.5533068", "0.5170543", "0.513104", "0.50711435", "0.50275415", "0.50243765", "0.500362", "0.4961166", "0.4929911", "0.49243268", "0.49179128", "0.4914953", "0.49068555", "0.4880998", "0.48685476", "0.486821...
0.73753613
0
PATCH/PUT /latstrapshome4s/1 PATCH/PUT /latstrapshome4s/1.json
def update respond_to do |format| if @latstrapshome4.update(latstrapshome4_params) format.html { redirect_to "/latstrapshome4s"} format.json { render :show, status: :ok, location: @latstrapshome4 } else format.html { render :edit } format.json { render json: @latstrapshome4.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @latstraps1.update(latstraps1_params)\n format.html { redirect_to \"/latstraps1s\"}\n format.json { render :show, status: :ok, location: @latstraps1 }\n else\n format.html { render :edit }\n format.json { render json: @latstraps1.err...
[ "0.6797663", "0.6216851", "0.5979598", "0.5957633", "0.593836", "0.59164244", "0.58783346", "0.5870612", "0.5792803", "0.5767228", "0.5739863", "0.5735761", "0.57329446", "0.5730667", "0.5711544", "0.56994313", "0.5681854", "0.56656325", "0.56656325", "0.56630427", "0.5661736...
0.74033314
0
DELETE /latstrapshome4s/1 DELETE /latstrapshome4s/1.json
def destroy @latstrapshome4.destroy respond_to do |format| format.html { redirect_to latstrapshome4s_url, notice: 'Latstrapshome4 was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @latstraps1.destroy\n respond_to do |format|\n format.html { redirect_to latstraps1s_url, notice: 'Latstraps1 was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete_json(path)\n url = [base_url, path].join\n resp = HTTParty.delete(url, ...
[ "0.72791404", "0.67249525", "0.66970205", "0.66899365", "0.66634834", "0.66596955", "0.66591865", "0.6653499", "0.66420424", "0.66234857", "0.6608323", "0.65863", "0.65767795", "0.65657735", "0.655653", "0.6546803", "0.6546383", "0.65352553", "0.6527048", "0.65217596", "0.651...
0.76777935
0
Use callbacks to share common setup or constraints between actions.
def set_latstrapshome4 @latstrapshome4 = Latstrapshome4.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def latstrapshome4_params params.require(:latstrapshome4).permit(:exercise, :reps, :sets) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.6946679", "0.6811753", "0.67995036", "0.679359", "0.67437977", "0.6738685", "0.6525698", "0.65186113", "0.6492684", "0.64316213", "0.64316213", "0.64316213", "0.6397299", "0.63539475", "0.63526994", "0.6344162", "0.63427454", "0.6336022", "0.63279474", "0.63279474", "0.632...
0.0
-1
For AJAX request to get previous version
def get_previous_version content_version = ContentVersion.find(params[:id]) render :text => content_version.title+"||"+content_version.body+"||"+params[:id] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def previous_version\n self[:previous_version]\n end", "def get_version\n request('getVersion')\n end", "def previous_version\n @previous_version ||= previous_versions[0]\n end", "def load_previous_version\n Version.all(:limit => 1, :order => [ :processed.desc ]).first\n end", "...
[ "0.6724138", "0.66291887", "0.65729547", "0.6559381", "0.6553339", "0.64885956", "0.6360906", "0.6333761", "0.6288369", "0.62779856", "0.62739253", "0.62739253", "0.6271415", "0.62340707", "0.6205192", "0.6201832", "0.6197258", "0.6187482", "0.6178216", "0.6162251", "0.613894...
0.68980205
1
def next_state(estimate) interest = Interest.find_by(customer_id: estimate.customer, provider_id: estimate.provider) interest.move_2_next interest.delete_cached_state end
def send_email(estimate) if Rails.env.production? ProviderMailer.delay.estimate_email(estimate) else ProviderMailer.estimate_email(estimate).deliver end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_state\n newstate = state_transition_out\n newiteration = @iteration\n if [:day, :signup].include?(@state)\n newiteration = @iteration + 1\n end\n @state = newstate\n @iteration = newiteration\n #state_transition_in\n @state\n end", "def get_next_state\n ...
[ "0.6348148", "0.59750855", "0.574245", "0.56950617", "0.56490594", "0.563093", "0.56154716", "0.55900514", "0.5481979", "0.54582363", "0.5445926", "0.5401551", "0.5377385", "0.53753895", "0.5328189", "0.53036153", "0.52611417", "0.5255631", "0.52484196", "0.52336806", "0.5233...
0.0
-1
this is a hash, every key stores a list
def initialize(filename) @filename=filename @global_res={} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n lists.inject({}){ |hash, p| hash[p[0]] ||= []; hash[p[0]] << p[1]; hash }\n end", "def hash(key); end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", "def hash; end", ...
[ "0.7521272", "0.6992086", "0.6801215", "0.6801215", "0.6801215", "0.6801215", "0.6801215", "0.6801215", "0.6801215", "0.6801215", "0.6801215", "0.6801215", "0.6763024", "0.67442393", "0.67442393", "0.6671632", "0.66348547", "0.657452", "0.65470845", "0.65338075", "0.65338075"...
0.0
-1
"a was [], b was [1,2], expected []")
def array_diff(a, b) a.delete_if { |ael| b.include?(ael)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def expecting; [] end", "def test_2\n\t\ta = 1, 2, 3, 4\n\t\tb = [1, 2, 3, 4]\n\t\tassert_equal(a, b)\n\tend", "def another; return []; end", "def test_compare_two_string_arrays_none\n \ttest_list1 = [\"cat\", \"dog\", \"cow\"]\n \ttest_list2 = [\"pig\", \"rat\", \"rabbit\"]\n \tassert_empty @w.compare_tw...
[ "0.6816961", "0.6398093", "0.6358299", "0.59605485", "0.5932598", "0.58422726", "0.57968354", "0.5720726", "0.5592122", "0.5505717", "0.55041814", "0.54789925", "0.5478201", "0.54761255", "0.5467212", "0.5464308", "0.5458753", "0.5433082", "0.5418302", "0.5412207", "0.5409294...
0.0
-1
show a specific problem
def show #if there is a language and submission query string, that means the user #is trying to look at a past submission #if there are params but they aren't valid, just redirect to problem page if params_present? && !params_valid? redirect_to problem_path(params[:id]) end #From here on, we know that if params are present, they are valid @problem = Problem.find(params[:id]) @languages = Language.joins(test: :problem).where("problem_id = ?", params[:id]) if params_present? @cur_language = @languages.find(params[:language_id]) else @cur_language = @languages.last end result = Result.find_by_problem_id(params[:id]) @sample_input = result.sample_input @sample_output = result.sample_output @tests = Test.where("problem_id=?", @problem.id) if params_present? submission = Submission.find(params[:submission_id]) @beginning_code = submission.code else @beginning_code = Test.where(language_id: @cur_language.id, problem_id: params[:id]).first.starter_code end #puts "================" #puts @test #puts "================" #if the user is not signed in, we don't want #the submit button to be clickable if user_signed_in? @should_enable = "" else @should_enable = "disabled" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\t\t@problem = Problem.find(params[:id])\n\tend", "def show\n @problem = Problem.find(params[:id])\n end", "def show_problem\n\t\t@problem = Problem.find(params[:problem_id])\n\t\tredirect_to competition_path(Competition.find(params[:id]), problem_id: @problem.id)\n end", "def show\n @page_...
[ "0.6959201", "0.68605137", "0.6777254", "0.67269963", "0.63323444", "0.6269449", "0.622222", "0.61974037", "0.6181548", "0.6178756", "0.6088504", "0.60480374", "0.60480374", "0.60471994", "0.60364383", "0.6015477", "0.59100556", "0.589807", "0.5867656", "0.5850504", "0.577073...
0.52399
97
Returns true if the query strings passed to the Problem Controller's show action are valid.
def params_valid? #if the user isn't signed in or there aren't any parameters, the params #aren't valid if !user_signed_in? || !params_present? return false end #Check whether a submission for the given language exists and whether it #belongs to the current user. submission = Submission.where(id: params[:submission_id], language_id: params[:language_id]) submission.present? && current_user.id == submission.first.user_id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid?\n return false if @query.nil?\n return true\n end", "def invalid_params?\n @invalid_params.keys.length == 0\n end", "def valid_params_request?\n true\n end", "def valid_params_request?\n true\n end", "def valid_params?(*args)\n args.map { |a| ret...
[ "0.6294095", "0.6277298", "0.62257147", "0.62257147", "0.62244934", "0.6215315", "0.6212874", "0.6112642", "0.60809636", "0.6054678", "0.6050781", "0.60407716", "0.60217226", "0.59746826", "0.5967935", "0.5965087", "0.5964616", "0.5943434", "0.5924906", "0.58617723", "0.58247...
0.56906843
37
while line = gets.chomp do case line when /^\s/ next when /^quit$/i break else puts line.reverse end end
def hasValue?(x) case x when nil, [], "", 0 false else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mock_me\n while true do\n mock = gets.chomp\n if mock == 'quit' || mock == 'q'\n break\n else\n puts mock\n end\n end\nend", "def continue\n puts \"Would you like to continue from memory (y/n)?\"\n cont = gets.strip.downcase\n case cont\n when 'y'\n puts \" \"\n else\n ...
[ "0.6464455", "0.63047194", "0.63013804", "0.6289324", "0.6200168", "0.6189499", "0.6137334", "0.61342674", "0.6131089", "0.6130385", "0.61293966", "0.59897923", "0.59734243", "0.59494734", "0.59447306", "0.5926484", "0.5918894", "0.5893268", "0.5852542", "0.5848468", "0.58395...
0.0
-1
GET /strongholds GET /strongholds.json
def index @strongholds = Stronghold.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_holds opts= {}\n path, opts = build_user_path(\"holds\", opts)\n JSON.parse(get path, opts)\n end", "def index\n\t\t@households = current_user.households\n\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.json { render json: @households }\n\t\tend\n\tend", "def show...
[ "0.71926564", "0.67053014", "0.6484865", "0.63498956", "0.62871855", "0.62685335", "0.6184573", "0.6161659", "0.6159199", "0.6123439", "0.60504323", "0.5996416", "0.59788674", "0.59758407", "0.59169996", "0.5861943", "0.5849813", "0.5843686", "0.58305085", "0.5797811", "0.579...
0.730104
0
GET /strongholds/1 GET /strongholds/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @strongholds = Stronghold.all\n end", "def show\n @holding = Holding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @holding }\n end\n end", "def show\n @household = Household.find(params[:id])\n\n respond_to do ...
[ "0.71409374", "0.6658426", "0.6605827", "0.6532576", "0.6357554", "0.63384455", "0.6217011", "0.61976427", "0.6188937", "0.6144951", "0.6062887", "0.6022242", "0.60206544", "0.6014588", "0.60089564", "0.59732324", "0.5969024", "0.59671247", "0.59671247", "0.5962829", "0.59585...
0.0
-1
POST /strongholds POST /strongholds.json
def create @stronghold = Stronghold.new(stronghold_params) respond_to do |format| if @stronghold.save format.html { redirect_to @stronghold, notice: 'Stronghold was successfully created.' } format.json { render :show, status: :created, location: @stronghold } else format.html { render :new } format.json { render json: @stronghold.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @hold = @member.holds.new(hold_params)\n\n respond_to do |format|\n if @hold.valid? && @hold.save\n format.html { redirect_to member_hold_path(@member, @hold), notice: 'Hold was successfully created.' }\n format.json { render :show, status: :created, location: @hold }\n e...
[ "0.6904679", "0.6594412", "0.6383217", "0.6353738", "0.6216304", "0.6216304", "0.621562", "0.6156554", "0.61242497", "0.6094384", "0.6057741", "0.6006719", "0.5999948", "0.5958767", "0.5957567", "0.5950637", "0.5924727", "0.59122723", "0.5857291", "0.58345795", "0.5744639", ...
0.70228314
0
PATCH/PUT /strongholds/1 PATCH/PUT /strongholds/1.json
def update respond_to do |format| if @stronghold.update(stronghold_params) format.html { redirect_to @stronghold, notice: 'Stronghold was successfully updated.' } format.json { render :show, status: :ok, location: @stronghold } else format.html { render :edit } format.json { render json: @stronghold.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @hold.update(hold_params)\n format.html { redirect_to member_hold_path(@member, @hold), notice: 'Hold was successfully updated.' }\n format.json { render :show, status: :ok, location: @hold }\n else\n format.html { render :edit }\n f...
[ "0.64804274", "0.6390568", "0.63848674", "0.638034", "0.61199945", "0.60758096", "0.60496736", "0.6035179", "0.6033918", "0.6026584", "0.60202616", "0.6013773", "0.5985575", "0.5983647", "0.59701085", "0.5953881", "0.5951518", "0.5946864", "0.59388334", "0.59255856", "0.59212...
0.68234414
0
DELETE /strongholds/1 DELETE /strongholds/1.json
def destroy @stronghold.destroy respond_to do |format| format.html { redirect_to strongholds_url, notice: 'Stronghold was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @hold.destroy\n respond_to do |format|\n format.html { redirect_to member_furloughs_url(@member), notice: 'Hold was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @hold_request.destroy\n respond_to do |format|\n format.html ...
[ "0.7086192", "0.69762766", "0.6960917", "0.6960917", "0.6955327", "0.6948466", "0.6895336", "0.6834514", "0.6804844", "0.6718816", "0.6718593", "0.67147136", "0.6709622", "0.67071605", "0.6699769", "0.6644031", "0.6617585", "0.6612838", "0.6608187", "0.6592465", "0.6574398", ...
0.7350676
0
Use callbacks to share common setup or constraints between actions.
def set_stronghold @stronghold = Stronghold.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 stronghold_params params.require(:stronghold).permit(:typeID, :provinceStrength, :familyHonor, :goldProduction, :keywords, :description, :clan) 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.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
Wakoopa::Baseself.find() Delegates find commands to the find... methods. The Wakoopa API only supports fetching multiple rows, you can't find anything by id. This means this method will always call Wakoopa::Baseself.find_every() and throw a warning when its being called with anything else then ":all" as it's first parameter. Example: software = Wakoopa::Software.find(:all) => Array software = Wakoopa::Software.find() => throws a warning, Array
def find(*args) options = args.last.is_a?(Hash) ? args.pop : {} warn "The Wakoopa API doesn\'t support finding single rows. \n Please use \".all()\" or \"s.find(:all)\" instead of \".find()\"." unless args.first == :all find_every(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_all\n fail NotImplementedError\n end", "def find_all\n finder_or_run(:find_all)\n end", "def find_all\n end", "def find_all\n \n end", "def find(*args)\n ids = args.__find_args__\n raise_invalid if ids.any?(&:nil?)\n for_ids(ids).execute_or_raise(i...
[ "0.7130098", "0.70827204", "0.6854056", "0.6761496", "0.66097844", "0.6549146", "0.65192", "0.6519048", "0.6517933", "0.6517933", "0.64373446", "0.64061296", "0.64021766", "0.6364344", "0.6357505", "0.6347588", "0.63380706", "0.6239791", "0.6227192", "0.6220112", "0.6203646",...
0.7692714
0
Wakoopa::Baseself.find_every(Hash/nil) Creates an arguments hash and calls Wakoopa::Request.get(). Will check if the user has provided a feedkey (using Wakoopa.feedkey=()). If so, it'll put it into the arguments Hash. Example software = Wakoopa::Software.find_every => Array
def find_every(options = {}) query = {:limit => 100}.merge(options) feedkey = Wakoopa.feedkey if feedkey query.merge!(:key => feedkey) end Wakoopa::Request.get(self, :query => query) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(*args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n warn \"The Wakoopa API doesn\\'t support finding single rows. \\n Please use \\\".all()\\\" or \\\"s.find(:all)\\\" instead of \\\".find()\\\".\" unless args.first == :all\n find_every(options)\n end", "def method_missi...
[ "0.5905304", "0.5545406", "0.549658", "0.5407741", "0.52498066", "0.517535", "0.51381785", "0.51021725", "0.5057253", "0.50387186", "0.50067794", "0.4981273", "0.49654025", "0.4957496", "0.49529976", "0.49365422", "0.49229497", "0.49204722", "0.4885798", "0.48823923", "0.4882...
0.7765673
0
Wakoopa::Baseself.all() Calls find(:all, ) directly. This method is only here for convenience. Example software = Wakoopa::Software.all => Array
def all(*args) find(:all, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all(*args)\n find(:all, *args)\n end", "def all\n self.class.all\n end", "def find_all\n end", "def all(options={})\r\n find(:all,options)\r\n end", "def find_all\n \n end", "def all(*args, &block)\n find(:all, *args, &block)\n end", "def get_all...
[ "0.7608413", "0.75359535", "0.7497445", "0.74285686", "0.73931336", "0.73842585", "0.73470944", "0.73230153", "0.7320985", "0.73173606", "0.723731", "0.7143809", "0.71429855", "0.7138044", "0.7135924", "0.7125559", "0.70454496", "0.70392877", "0.7029568", "0.7022472", "0.7014...
0.7685891
1
Wakoopa::Baseself.method_missing(Symbol, ) Catches missing methods and checks for find_all_by... calls. If it finds any, It'll call find(:all) directly, passing the arguments it pulled from the method_id and the supplied arguments. Example: software = Wakoopa::Software.find_all_by_name('Firefox') => Array
def method_missing(method_id, *args) options = args.last.is_a?(Hash) ? args.pop : {} method_id.to_s.match(/^find_all_by_([_a-zA-Z]\w*)$/) attributes = {} $1.split('_and_').each do |key| attributes.merge!({key.intern => args.shift}) end find(:all, attributes.merge(options)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(method_id, *arguments)\n if match = /find_(all_by|by)_([_a-zA-Z]\\w*)/.match(method_id.to_s)\n finder = determine_finder(match)\n\n facets = extract_attribute_names_from_match(match)\n super unless all_attributes_exists?(facets)\n\n #Overrride facets to...
[ "0.72437584", "0.72346985", "0.7035593", "0.7015546", "0.67154413", "0.67152965", "0.66927767", "0.6524196", "0.6508102", "0.64535534", "0.6448997", "0.63932693", "0.6349629", "0.6329751", "0.63252336", "0.6319494", "0.62954056", "0.62650794", "0.62382966", "0.62365735", "0.6...
0.75724435
0
Get new attributes hash for the new version Attributes missing in new_attrs will be filled in from the previous version (specified in the constructor)
def attributes(new_attrs) @new_attrs = new_attrs.symbolize_keys attrs = original_attributes.merge(@new_attrs.merge({ is_current_version: true, id: @record.id, version: @record.version + 1 })) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes=(new_attributes)\n acceptable_attributes = [:ID, :Name, :Note, :Alias, :Parent]\n @attributes = if new_attributes.is_a?(Hash)\n # Symbolify the keys in the hash\n symbolized_attributes = Hash[new_attributes.map { |(attribute, value)| [attribute.to_sym, value] ...
[ "0.6791887", "0.6747363", "0.67453074", "0.67087436", "0.67006326", "0.6607027", "0.6594977", "0.654098", "0.65255004", "0.651062", "0.64889497", "0.6486875", "0.6460138", "0.64331496", "0.6432091", "0.64175564", "0.6413493", "0.63629514", "0.63581854", "0.6307485", "0.628857...
0.786781
0
The relevant attributes of the previous version i.e: the record we initialized this builder with
def original_attributes @record.attributes.symbolize_keys.select do |(attr, _)| !%i(created_at updated_at).include?(attr) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attributes(new_attrs)\n @new_attrs = new_attrs.symbolize_keys\n attrs = original_attributes.merge(@new_attrs.merge({\n is_current_version: true,\n id: @record.id,\n version: @record.version + 1\n }))\n end", "def version_attributes\n ...
[ "0.7457403", "0.7340435", "0.7143289", "0.7104254", "0.7064421", "0.6887731", "0.6880535", "0.68599045", "0.6851441", "0.683623", "0.681501", "0.6793889", "0.67920035", "0.6768727", "0.67562383", "0.6747207", "0.67394537", "0.67260045", "0.6724536", "0.6724144", "0.6694726", ...
0.6739849
16
Creates a credit on customers credit card.
def create render json: ::Transaction::CreditSerializer.new( do_credit! ), status: :created end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_credit_card\n # populate new card with some saved values\n ActiveMerchant::Billing::CreditCard.new(\n :first_name => user.first_name,\n :last_name => user.last_name,\n # :address etc too if we have it\n :brand => cc_type\n )\n end", "def create\n @credit_card = ...
[ "0.7990706", "0.7931482", "0.72002363", "0.7184272", "0.7160763", "0.7153957", "0.7098096", "0.7091005", "0.70789754", "0.707551", "0.70728105", "0.70529145", "0.70522726", "0.70261896", "0.7012722", "0.69620323", "0.69368386", "0.6931177", "0.690628", "0.68981755", "0.689779...
0.6369884
100
Perform the credit. returns Transaction::credit
def do_credit! # user = User.where('id=? OR rfid=?', user_param.to_i, user_param).first user = User.find_by(id: user_param) BridgePayService.new( user ).credit( credit_amount ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def credit(money, identification, options = {})\n post = { :gateid => identification }\n\n commit('CREDIT', money, post)\n end", "def credit(money, authorization, options = {})\r\n request = RocketGate::GatewayRequest.new\r\n response = RocketGate::GatewayResponse.new\r\n ...
[ "0.74964136", "0.7448513", "0.7423364", "0.74086714", "0.73757976", "0.73081553", "0.7240079", "0.70344526", "0.70057184", "0.6972157", "0.6964254", "0.69372195", "0.6914911", "0.689453", "0.678939", "0.6757402", "0.6757402", "0.6754598", "0.67544836", "0.6697791", "0.6683489...
0.74353504
2