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
http= Formats a HTTPRequest or HTTPResponse body for log output.
def format_body_for_log_output(obj) #obj.body.inspect output = '' if obj.content_type == 'application/json' if @log_pretty_print_body output << "\n" output << JSON.pretty_generate(JSON.parse(obj.body)) return output else return obj.body end else return obj.body.inspect end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_http(response)\n resp_template = '[http] Response: %s (%s bytes in %s seconds)'\n log_status = (response.status || 0)\n log_total_time = response.total_time.truncate(3)\n\n Wgit.logger.debug(\"[http] Request: #{response.url}\")\n Wgit.logger.debug(\n format(resp_templa...
[ "0.6978058", "0.6319764", "0.6285594", "0.6275759", "0.62595665", "0.6220176", "0.6059088", "0.6059088", "0.60305864", "0.5974047", "0.59566706", "0.59403044", "0.592439", "0.5907273", "0.5907273", "0.58782256", "0.5703002", "0.5669729", "0.5662731", "0.5659888", "0.56402004"...
0.641483
1
pretty_print_body Performs final processing of a request then executes the request and returns the response. Debug output for all requests and responses is also handled by this method.
def process_request(request) request['User-Agent'] = "Ruby/#{RUBY_VERSION}" request['Cookie'] = cookie if cookie logger.debug { redact_passwords(%(REQUEST: #{request.method} #{to_s}#{request.path} HEADERS: #{request.to_hash.inspect} #{log_request_body and request.request_body_permitted? ? "BODY: #{format_body_for_log_output(request)}" : ''})) } response = http.request(request) logger.debug { %(RESPONSE: #{response.inspect} HEADERS: #{response.to_hash.inspect} #{log_response_body and response.respond_to?(:body) ? "BODY: #{format_body_for_log_output(response)}" : ''}) } response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_body_for_log_output(obj)\n #obj.body.inspect\n output = ''\n if obj.content_type == 'application/json'\n if @log_pretty_print_body\n output << \"\\n\"\n output << JSON.pretty_generate(JSON.parse(obj.body))\n return output\n else\n ...
[ "0.5969238", "0.5873237", "0.5858578", "0.57536733", "0.56226623", "0.5590127", "0.55589813", "0.55249816", "0.5465667", "0.54633826", "0.5434214", "0.5415169", "0.5412629", "0.5410881", "0.5330033", "0.5254732", "0.52501947", "0.5218523", "0.5193851", "0.5190924", "0.5181252...
0.55567634
7
get Processes put and post request bodies based on the request content type and the format of the data
def process_put_and_post_requests(request, data) content_type = request['Content-Type'] ||= 'application/x-www-form-urlencoded' case content_type when 'application/x-www-form-urlencoded'; request.form_data = data when 'application/json'; request.body = (data.is_a?(Hash) or data.is_a?(Array)) ? JSON.generate(data) : data else #data = data.to_s unless request.body.is_a?(String) request.body = data end process_request(request) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_content_body\n if put_or_post? && request.content_type.include?(\"application/json\")\n body_params = request.body.read\n parsed = body_params && body_params.length >= 2 ? JSON.parse(body_params) : nil\n params.merge!(parsed)\n end\n end", "def parse_request\n p request.body.st...
[ "0.7124032", "0.6494493", "0.64630395", "0.615268", "0.6100315", "0.60318524", "0.5952956", "0.5924296", "0.5859695", "0.5850232", "0.5848475", "0.5844456", "0.5844456", "0.5844456", "0.5844456", "0.5832203", "0.58174855", "0.5789141", "0.5742484", "0.57302177", "0.57280904",...
0.7974371
0
process_form_request Creates a HTTP POST request and passes it on for execution
def post(path, data, headers = { }) path = "/#{path}" unless path.start_with?('/') request = Net::HTTP::Post.new(path, headers) process_put_and_post_requests(request, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_http_request\n # the http request details are available via the following instance variables:\n # @http_protocol\n # @http_request_method\n # @http_cookie\n # @http_if_none_match\n # @http_content_type\n # @http_path_info\n # @http_r...
[ "0.68347996", "0.6553303", "0.654552", "0.6478408", "0.6465167", "0.6268156", "0.6220876", "0.61887854", "0.61825037", "0.6161735", "0.6082435", "0.60820746", "0.6064472", "0.6063108", "0.60323983", "0.6024838", "0.59016865", "0.5879485", "0.5856687", "0.5851772", "0.5851772"...
0.0
-1
post Creates a HTTP PUT request and passes it on for execution
def put(path, data, headers = { }) path = "/#{path}" unless path.start_with?('/') request = Net::HTTP::Put.new(path, headers) process_put_and_post_requests(request, data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put!\n request! :put\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def put(*args)\n request :put, *args\n end", "def do_put(uri = \"\", body = \"\")\n @connection.put do |req|\n req.url uri\n ...
[ "0.7646371", "0.74567693", "0.7446057", "0.7338822", "0.73251945", "0.73188925", "0.73115295", "0.7303692", "0.7296367", "0.72951216", "0.7248079", "0.7230704", "0.7222972", "0.7216127", "0.7211231", "0.71995205", "0.71900976", "0.71681416", "0.71304625", "0.7106134", "0.7073...
0.0
-1
redact_passwords Returns the connection information in a URI format.
def to_s @to_s ||= "http#{http.use_ssl? ? 's' : ''}://#{http.address}:#{http.port}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reconstruct_uri\n servers = @servers.join(',')\n options = options_mapper.ruby_to_string(@uri_options).map do |k, vs|\n unless vs.nil?\n if vs.is_a?(Array)\n vs.map { |v| \"#{k}=#{v}\" }.join('&')\n else\n \"#{k}=#{vs}\"\n end\n end\n ...
[ "0.57137305", "0.5617284", "0.5609501", "0.5597366", "0.5563817", "0.5559846", "0.5503401", "0.5503401", "0.55033946", "0.53538907", "0.52642703", "0.52394027", "0.5215215", "0.521483", "0.51651484", "0.5156823", "0.51523024", "0.5144156", "0.51326174", "0.5124401", "0.511548...
0.0
-1
initialize Sets the AdobeAnywhere connection information.
def initialize_http_handler(args = {}) @http = HTTPHandler.new(args) logger.debug { "Connection Set: #{http.to_s}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n # Create temporary data directory\n create_data_dir\n\n # Init connection to ADS\n init_ads\n\n # Initialize Data science toolkit\n init_dstk\n\n # Init connection to SQLite\n # init_sqlite3\n end", "def initialize_connection(env)\n end", "def init!\n @logger = @...
[ "0.6797215", "0.6342797", "0.63325286", "0.625161", "0.625161", "0.6249513", "0.620127", "0.60614103", "0.6009564", "0.5988029", "0.5974352", "0.59320796", "0.591591", "0.59087193", "0.5887663", "0.58689296", "0.5867611", "0.58542365", "0.5823386", "0.5815663", "0.58073133", ...
0.0
-1
Initializes a resolver with a chace and git resolver.
def initialize(cache, git_resolver) @git_resolver = git_resolver @constraints = [] @cache = cache end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolver\n @resolver ||= Resolver.new @cache, @git_resolver\n end", "def initialize(resolvers=[Hosts.new, DNS.new])\n @resolvers = resolvers\n end", "def initialize(*args)\r\n @resolver_em = nil\r\n @resolver_ruby = nil\r\n @src_address = nil\r\n reset_attributes\r\n \r...
[ "0.7287232", "0.62402445", "0.6183722", "0.59864813", "0.59854376", "0.58580714", "0.5697018", "0.56601286", "0.5651439", "0.56431097", "0.56223035", "0.5588248", "0.55761087", "0.55140126", "0.5433996", "0.5412271", "0.540991", "0.540339", "0.5391296", "0.5385264", "0.534989...
0.71722627
1
Add constraints, usually from the `elmpackage.json`.
def add_constraints(constraints) @constraints = add_dependencies(constraints) do |package, constraint| [package, constraint] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constraints(extra_constraints=[])\n @constraints + extra_constraints\n end", "def supports_external_add_constraints?() true; end", "def supports_external_add_constraints?() false; end", "def add_constraint(constraint_def)\n @constraints << Constraint.new(constraint_def)\n end", "def con...
[ "0.70579046", "0.6984189", "0.69013256", "0.6656419", "0.6514199", "0.6514199", "0.6514199", "0.6348425", "0.62525076", "0.6145717", "0.5975218", "0.59417284", "0.59212047", "0.59021646", "0.58978933", "0.58761966", "0.5837804", "0.57824075", "0.5769337", "0.57296216", "0.561...
0.78639287
0
Adds a dependency by git reference.
def add_ref_dependency(package, ref) @git_resolver.repository(package).checkout(ref) pkg_version = elm_package(package)['version'] version = "#{pkg_version}+#{ref}" @cache.ensure_version(package, version) add_package_dependencies(package, version) [[package, "= #{version}"]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_dependency(path, dependency); end", "def add_dependency(dependency)\n @dependencies << dependency\n end", "def add(dependency)\n @dependencies[cookbook_name(dependency)] = dependency\n end", "def add_dependency(name)\n dependencies[name]\n end", "def add_dependency(dependenc...
[ "0.75690764", "0.7016373", "0.69927007", "0.69777554", "0.6886298", "0.66608256", "0.6595977", "0.6585415", "0.6577361", "0.65702736", "0.6549951", "0.6457353", "0.64443916", "0.6390711", "0.63719314", "0.6268928", "0.6232989", "0.6199733", "0.61542493", "0.6137449", "0.61240...
0.7708227
0
Adds a package to the cache, the following things happens: If there is no local repository it will be cloned Getting all the tags and adding the valid ones to the cache Checking out and getting the `elmpackage.json` for each version and adding them recursivly
def add_package(package) return if @git_resolver.package?(package) && @cache.key?(package) @git_resolver .repository(package) .tags .map(&:name) .each do |version| @cache.ensure_version(package, version) add_version(package, version) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve( name, version )\n # It is possible, and almost inevitable, that we can install two packages that must oscilate\n # at the same time. As a result, we will be relinking a package that has not been installed yet,\n # but will be on the next commit. In this situation, we need keep a c...
[ "0.63148886", "0.63095236", "0.6153931", "0.6031779", "0.5951049", "0.58827543", "0.58711606", "0.5831942", "0.58238757", "0.57993156", "0.57802415", "0.5707059", "0.5674666", "0.5643315", "0.5616146", "0.5611785", "0.5579036", "0.55716896", "0.55611795", "0.5521116", "0.5484...
0.783327
0
Adds a package's dependencies to the cache.
def add_package_dependencies(package, version) add_dependencies(elm_dependencies(package)) do |dep_package, constraint| add_package(dep_package) @cache.dependency(package, version, [dep_package, constraint]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_package(package)\n return if @git_resolver.package?(package) && @cache.key?(package)\n\n @git_resolver\n .repository(package)\n .tags\n .map(&:name)\n .each do |version|\n @cache.ensure_version(package, version)\n add_version(package, version)\n ...
[ "0.722093", "0.65596914", "0.6440679", "0.6387912", "0.62661684", "0.622392", "0.61397046", "0.60093", "0.593324", "0.58842635", "0.5825428", "0.57871664", "0.57667214", "0.57667214", "0.57427096", "0.5738691", "0.5734621", "0.5727954", "0.57269496", "0.5722182", "0.5717367",...
0.7598626
0
Adds a version and it's dependencies to the cache.
def add_version(package, version) @git_resolver .repository(package) .checkout(version) add_package_dependencies(package, version) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(path)\n return true unless File.exist?(path)\n\n metadata[path] = {\n \"mtime\" => File.mtime(path),\n \"deps\" => [],\n }\n cache[path] = true\n end", "def store(new_version)\n self.version = new_version\n cache.store(CACHE_VERSION_KEY, {'version' => new_v...
[ "0.6806722", "0.6693854", "0.64496756", "0.64264196", "0.62462646", "0.59037393", "0.587454", "0.5810862", "0.57657486", "0.575851", "0.5744475", "0.57353634", "0.57148457", "0.56910443", "0.5679653", "0.5654151", "0.5651992", "0.5651992", "0.56298006", "0.5613648", "0.561364...
0.61168444
5
Gets the `elmpackage.json` for a package.
def elm_dependencies(package) ElmPackage.dependencies elm_package_path(package) rescue {} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_packagejson\n packagejson = File.join(Dir.pwd, 'package.json')\n\n File.open packagejson, 'w+' do |f|\n JSON.pretty_generate @packagejson\n end\n end", "def package_data\n dpkg_query = 'dpkg-query -W -f=\\'\"${Package}\": {' \\\n '\"version\": \"${Version}\",' \\\n ...
[ "0.64674", "0.6425842", "0.6318602", "0.6135908", "0.6130004", "0.6114746", "0.6094451", "0.6039804", "0.58127344", "0.58067495", "0.5764647", "0.5736285", "0.5685676", "0.5680743", "0.5679717", "0.5675836", "0.5672493", "0.5660065", "0.56575656", "0.5623746", "0.5617333", ...
0.52796024
41
Retruns the contents of the `elmpacakge.json` of the given package.
def elm_package(package) ElmPackage.read elm_package_path(package) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_data\n dpkg_query = 'dpkg-query -W -f=\\'\"${Package}\": {' \\\n '\"version\": \"${Version}\",' \\\n '\"status\": \"${Status}\",' \\\n '\"arch\": \"${Architecture}\",' \\\n '\"src_pkg\": \"${source:Package}\"' \\\n '...
[ "0.6152569", "0.5910548", "0.5636321", "0.5588741", "0.55583924", "0.5548635", "0.5532092", "0.55274636", "0.5463891", "0.54022497", "0.5368472", "0.5361749", "0.5342878", "0.533426", "0.5327336", "0.53252065", "0.5296397", "0.5277462", "0.52731544", "0.52541196", "0.5215454"...
0.6178537
0
Retruns the path of the `elmpacakge.json` of the given package.
def elm_package_path(package) File.join(@git_resolver.repository_path(package), 'elm-package.json') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_for(package)\n \"#{package.path}.metadata.json\"\n end", "def path_for(package)\n \"#{package.path}.metadata.json\"\n end", "def path_from_package(package_name)\n ret = package_from_name package_name\n ret && ret.root_path\n end", "def package_path(extension=...
[ "0.68543273", "0.68191034", "0.6579817", "0.62927717", "0.61223686", "0.6004571", "0.5991151", "0.5942468", "0.5938609", "0.5924367", "0.59099466", "0.5833316", "0.5829839", "0.5818851", "0.57817113", "0.5763771", "0.5734866", "0.5718441", "0.57035613", "0.5700325", "0.570032...
0.75490236
0
project submission is the album (per person) each submission can contain several pictures, with several revisions for per picture
def approved? self.is_approved == true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_with_submission_files(revision, path = '/')\n # Remember that assignments have folders within repositories - these\n # will be \"spoofed\" as root...\n if path == '/'\n path = assignment.repository_folder\n end\n\n files_added = false\n # First, go through directories...\n di...
[ "0.61527556", "0.5931717", "0.5834327", "0.57956856", "0.5740955", "0.5726669", "0.56366736", "0.5627271", "0.56236255", "0.55950016", "0.55713695", "0.55454177", "0.5542972", "0.55364347", "0.5527799", "0.5524003", "0.55073196", "0.54944426", "0.54936713", "0.5474354", "0.54...
0.0
-1
=begin Show grading =end
def max_grade graded_pictures_count = self.pictures.where(:is_deleted=> false, :is_graded => true).count if graded_pictures_count == 0 return nil else return self.pictures. where(:is_deleted=> false, :is_graded => true). maximum("score") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def displayed_grade\n (grade * 4 + 1).to_i\n end", "def print_grades\n @learn_grades.each do |grade|\n puts grade.which_course?.foreground(:yellow) + \": \".foreground(:yellow)\n puts grade.summary\n end\n end", "def grade\n @grade\n end", "def grade_with_label\n \"Grade: #{grade}...
[ "0.7151982", "0.7151686", "0.69544315", "0.6904735", "0.6739912", "0.6508171", "0.64603275", "0.6441673", "0.6402243", "0.63908064", "0.63586265", "0.6321024", "0.624367", "0.61693394", "0.613899", "0.60548633", "0.60548633", "0.6051233", "0.6034253", "0.6025765", "0.60060126...
0.0
-1
adds up all the income the driver has earned throughout the ride share history
def money_earned_by_driver(driver) sum = 0.0 driver.each do |money| earned = money[:cost] sum += earned.round(2) end return sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_income_per_driver(all_rides)\n all_drivers_income = {}\n\n all_rides.each do |driver_id, rides|\n income = 0\n rides.each do |ride_data|\n income += ride_data[:cost]\n end\n all_drivers_income[driver_id] = income\n end\n\n return all_drivers_income\nend", "def drivers_earnings(ride...
[ "0.6727789", "0.66643316", "0.6386869", "0.6340817", "0.61855394", "0.61506313", "0.6007859", "0.59887487", "0.5924656", "0.59047014", "0.58978415", "0.58318335", "0.58293074", "0.58129513", "0.57773876", "0.57697505", "0.57471544", "0.5716752", "0.56786215", "0.56685615", "0...
0.570424
18
calculates the average rating of each driver
def average_rating(driver) sum = 0.0 driver.each do |find_rating| driver_rating = find_rating[:rating] sum += driver_rating end average = sum / driver.length return average end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def driver_avg_rating(driver)\n all_ratings = driver[:rides].map { |ride| ride[:rating] }\n avg_rating = all_ratings.sum.to_f / all_ratings.length.to_f\n return avg_rating\nend", "def driver_average_rating(driver_id, rides)\n driver_rides = rides.select { |ride| ride [:driver_id] == driver_id }\n sum_rati...
[ "0.8634792", "0.8405102", "0.8358219", "0.824431", "0.81474376", "0.81443787", "0.8064696", "0.8040263", "0.80354357", "0.7972031", "0.79681516", "0.7915796", "0.7909533", "0.7808768", "0.77997565", "0.77997565", "0.7791552", "0.7759868", "0.7744967", "0.7742053", "0.77364916...
0.85366243
1
GET /tutors GET /tutors.json
def index @tutors = Tutor.all respond_to do |format| format.html # index.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @tutors = Tutor.all\n end", "def teachers\n url = drop_url_version + \"/count/teacherAssociations/#{params['edorg_id']}/teachers\"\n begin\n entities = RestClient.get(url, get_header)\n entities = JSON.parse(entities)\n rescue => e\n logger.info(\"Could not get ed orgs for...
[ "0.6943682", "0.6899561", "0.66746986", "0.6637723", "0.6623478", "0.64065075", "0.6367074", "0.63408554", "0.6309496", "0.6303666", "0.6300664", "0.6294256", "0.6268812", "0.6178598", "0.6103102", "0.60934097", "0.6080172", "0.6052959", "0.60411775", "0.6037478", "0.60339695...
0.66978574
2
GET /tutors/new GET /tutors/new.json
def new @tutor = Tutor.new respond_to do |format| format.html # new.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial }\n end\n end", "def new\n @tutorial = Tutorial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tutorial ...
[ "0.76410246", "0.76410246", "0.7620987", "0.7421808", "0.72606856", "0.71770334", "0.7124342", "0.71094155", "0.7082674", "0.70749855", "0.7067462", "0.6995994", "0.6995994", "0.69925016", "0.6979895", "0.69666475", "0.6952253", "0.6934674", "0.6915609", "0.69127935", "0.6912...
0.0
-1
POST /tutors POST /tutors.json
def create @tutor = Tutor.new(params[:tutor]) respond_to do |format| if @tutor.save ShiftTime.all.each do |time| Availability.new(:available => :pref, :tutor_id => @tutor.id, :shift_time_id => time.id).save end format.html { redirect_to tutors_url, notice: 'Tutor was successfully created.' } else format.html { render action: "new" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @tutorials = Tutorial.all\n @tutorial = Tutorial.new(tutorial_params)\n\n if @tutorial.save\n render json: @tutorial\n else\n render json: @tutorial.errors.full_messages, status:400\n end\n end", "def create\n @tutorial = current_user.tutorials.create(tutorial_...
[ "0.67953503", "0.6353726", "0.6292895", "0.6292895", "0.62446654", "0.6240231", "0.623933", "0.6137126", "0.6120261", "0.6089057", "0.603924", "0.60086876", "0.5921137", "0.59002286", "0.5894721", "0.58832884", "0.58832884", "0.5850894", "0.5849425", "0.58324593", "0.5807533"...
0.0
-1
DELETE /tutors/1 DELETE /tutors/1.json
def destroy @tutor = Tutor.find(params[:id]) @tutor.destroy respond_to do |format| format.html { redirect_to tutors_url } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tutorial = Tutorial.find(params[:id])\n @tutorial.destroy\n render json: @tutorial\n end", "def destroy\n @tutorial.destroy\n respond_to do |format|\n format.html { redirect_to tutorials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tutor...
[ "0.7555222", "0.7356286", "0.7343291", "0.7259021", "0.72292906", "0.71787435", "0.71340597", "0.7103946", "0.7066205", "0.7034133", "0.7033001", "0.7027081", "0.7023385", "0.7002902", "0.69744176", "0.6972317", "0.6958501", "0.6954677", "0.6938309", "0.690373", "0.6900627", ...
0.6736313
66
If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params devise_parameter_sanitizer.permit(:sign_up){ |u| u.permit(:organisation_id , :password_confirmation , :organisation_admin , :name, :email, :password) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = params.delete(:readwrite)\n end\n\n # add default parameters\n bindat...
[ "0.6905034", "0.683687", "0.68280804", "0.67889357", "0.6674015", "0.66522104", "0.66448265", "0.6595933", "0.65606564", "0.64921725", "0.6489163", "0.64781183", "0.64483696", "0.64394945", "0.6419598", "0.6419251", "0.63999707", "0.63977224", "0.63977224", "0.63934815", "0.6...
0.0
-1
If you have extra params to permit, append them to the sanitizer. def configure_account_update_params devise_parameter_sanitizer.permit(:account_update, keys: [:attribute]) end The path used after sign up. def after_sign_up_path_for(resource) super(resource) end
def after_sign_up_path_for(resource) session[:orga_id] = resource.organisation_id user_steps_path(resource) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_account_update_params\n devise_parameter_sanitizer.permit(\n :account_update, keys: authentication_params(type: :sign_up)\n )\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_ac...
[ "0.8903516", "0.87293184", "0.86677575", "0.86677575", "0.86677575", "0.86677575", "0.86677575", "0.86677575", "0.86677575", "0.8658831", "0.86475295", "0.86079943", "0.85779583", "0.85646635", "0.85241055", "0.8512612", "0.8508361", "0.85028183", "0.8494039", "0.84924823", "...
0.0
-1
Calculate the sum of the previous paths' path count for path(x,y)
def path(x, y) # If x or y are on the edge, meaning they have only one path, return 1 if (x == 0 || y == 0) return 1 # If in the middle of the square, check to see if sum of paths for node already calculated? else # If so, return calculated sum of paths for node if @node[x][y] != 0 return @node[x][y] # Otherwise, set node[x][y] to sum of paths for connected nodes through recursion # Return newly calculated node[x][y] else @node[x][y] = path(x-1, y) + path(x, y-1) return @node[x][y] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_count(steps, current=0)\n if current == steps\n 1\n elsif current > steps\n 0\n else\n path_count(steps, current + 1) +\n path_count(steps, current + 2) +\n path_count(steps, current + 3)\n end\nend", "def total_paths(initial_s)\n reachable_stops(initial_s).count\n end", "de...
[ "0.6994832", "0.66429937", "0.6623631", "0.6476143", "0.6407324", "0.6325711", "0.6321759", "0.62865746", "0.6257735", "0.6247522", "0.6242535", "0.624224", "0.6219328", "0.61601347", "0.6159639", "0.61567396", "0.6091275", "0.60147154", "0.60092944", "0.59739965", "0.5912465...
0.6472097
4
PRIVATE Method to print formatted message
def print_formatted(tag, msg) puts "#{tag}: #{msg}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_message\n return @format_message if @format_message\n\n @format_message = self.message.dup\n\n if self.line\n @format_message << \" near line #{self.line}\"\n end\n\n if self.code\n @format_message << \": #{format_code}\"\n end\n\n @format_message\n end", "def format_me...
[ "0.7415442", "0.71897846", "0.7105872", "0.6942405", "0.69229376", "0.6885429", "0.68786436", "0.68521297", "0.684772", "0.684772", "0.68388855", "0.68202025", "0.68202025", "0.68202025", "0.68202025", "0.68202025", "0.68202025", "0.68202025", "0.68202025", "0.67670625", "0.6...
0.775349
0
Method to create tag and execute formatted print
def print_ok(msg) tag = '[ OK ]' print_formatted(tag,msg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print\r\n tags.eac...
[ "0.66452223", "0.6501758", "0.63295853", "0.6139407", "0.6017965", "0.5980382", "0.5979343", "0.5957566", "0.5926302", "0.5893266", "0.5883901", "0.5846941", "0.58419794", "0.5822158", "0.5795912", "0.5747759", "0.5745081", "0.5735167", "0.57340574", "0.5721091", "0.57120043"...
0.0
-1
Method to create tag and execute formatted print
def print_error(msg) tag = '[ ERROR ]' print_formatted(tag,msg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print\r\n tags.eac...
[ "0.66452223", "0.6501758", "0.63295853", "0.6139407", "0.6017965", "0.5980382", "0.5979343", "0.5957566", "0.5926302", "0.5893266", "0.5883901", "0.5846941", "0.58419794", "0.5822158", "0.5795912", "0.5747759", "0.5745081", "0.5735167", "0.57340574", "0.5721091", "0.57120043"...
0.0
-1
Method to create tag and execute formatted print
def print_record(msg) tag = '[ RECORD ]' print_formatted(tag,msg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print\r\n tags.eac...
[ "0.66452223", "0.6501758", "0.63295853", "0.6139407", "0.6017965", "0.5980382", "0.5979343", "0.5957566", "0.5926302", "0.5893266", "0.5883901", "0.5846941", "0.58419794", "0.5822158", "0.5795912", "0.5747759", "0.5745081", "0.5735167", "0.57340574", "0.5721091", "0.57120043"...
0.0
-1
Method to create tag and execute formatted print
def print_execute(msg) tag = '[ EXECUTE ]' print_formatted(tag,msg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print\r\n tags.eac...
[ "0.66462797", "0.6503351", "0.63333297", "0.6142451", "0.6018473", "0.5979574", "0.5978763", "0.5955846", "0.5927126", "0.58925277", "0.5883725", "0.58473694", "0.584524", "0.58199567", "0.5794381", "0.5747163", "0.574351", "0.57352203", "0.5733761", "0.5719264", "0.5710345",...
0.0
-1
Method to create tag and execute formatted print
def print_warning(msg) tag = '[ WARNING ]' print_formatted(tag,msg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print\r\n tags.eac...
[ "0.66452223", "0.6501758", "0.63295853", "0.6139407", "0.6017965", "0.5980382", "0.5979343", "0.5957566", "0.5926302", "0.5893266", "0.5883901", "0.5846941", "0.58419794", "0.5822158", "0.5795912", "0.5747759", "0.5745081", "0.5735167", "0.57340574", "0.5721091", "0.57120043"...
0.0
-1
Method to create tag and execute formatted print
def print_info(msg) tag = '[ INFO ]' print_formatted(tag,msg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print\r\n tags.eac...
[ "0.66452223", "0.6501758", "0.63295853", "0.6139407", "0.6017965", "0.5980382", "0.5979343", "0.5957566", "0.5926302", "0.5893266", "0.5883901", "0.5846941", "0.58419794", "0.5822158", "0.5795912", "0.5747759", "0.5745081", "0.5735167", "0.57340574", "0.5721091", "0.57120043"...
0.0
-1
Method to create tag and execute formatted print
def print_none(msg) tag = ' ' print_formatted(tag,msg) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag(tag)\n print \"<#{tag}>\"\n print yield\n print \"</#{tag}>\"\nend", "def print_tag_message(tag)\n print_time_stamp\n puts 'Current tag is set to '.colorize(:blue) + '#' + tag\n end", "def print_formatted(tag, msg)\n puts \"#{tag}: #{msg}\"\n end", "def print\r\n tags.eac...
[ "0.66452223", "0.6501758", "0.63295853", "0.6139407", "0.6017965", "0.5980382", "0.5979343", "0.5957566", "0.5926302", "0.5893266", "0.5883901", "0.5846941", "0.58419794", "0.5822158", "0.5795912", "0.5747759", "0.5745081", "0.5735167", "0.57340574", "0.5721091", "0.57120043"...
0.0
-1
GET /pages GET /pages.xml
def index respond_with(@pages = Page.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 5)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "def index\n @pages = @user.pages\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n ...
[ "0.73508507", "0.734734", "0.73289436", "0.73262346", "0.7321917", "0.7321917", "0.73211396", "0.7300929", "0.7300929", "0.72503465", "0.7236709", "0.72232467", "0.71869653", "0.7115463", "0.70771515", "0.7061126", "0.70592284", "0.70508873", "0.6988912", "0.6875172", "0.6792...
0.6100128
93
GET /pages/1 GET /pages/1.xml
def show respond_with(@page = Page.find(params[:id])) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @pages = Page.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @page }\n end\n end", "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n...
[ "0.7240595", "0.7175242", "0.71416986", "0.71416986", "0.7135126", "0.7135126", "0.7057775", "0.70284396", "0.6986637", "0.6978276", "0.697713", "0.6938267", "0.69377303", "0.68386036", "0.6821595", "0.6812652", "0.6787446", "0.67184156", "0.6716908", "0.6694082", "0.66778725...
0.0
-1
GET /pages/new GET /pages/new.xml
def new respond_with(@page = Page.new) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @page = current_cms.pages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n end\n end", "def new\n @page = Page.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @page }\n ...
[ "0.7837418", "0.7740716", "0.7740716", "0.7740716", "0.7740716", "0.7740716", "0.7740716", "0.7714634", "0.7693529", "0.76722115", "0.7594718", "0.75105387", "0.7480689", "0.7444072", "0.73575026", "0.73414886", "0.73297346", "0.72564614", "0.72548366", "0.7247537", "0.724282...
0.67176753
61
POST /pages POST /pages.xml
def create respond_with(@page = Page.create(params[:page]), :status => :created) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @page = Page.new(params[:page])\n\n respond_to do |format|\n if @page.save\n format.json { render json: @page, status: :created, location: [:api, @page] }\n format.xml { render xml: @page, status: :created, location: [:api, @page] }\n else\n format.json { render ...
[ "0.6393701", "0.63614", "0.62852484", "0.6194392", "0.61868143", "0.6163854", "0.6161021", "0.6158837", "0.61517274", "0.6139733", "0.6139733", "0.6122696", "0.6118308", "0.6105398", "0.6104559", "0.60812664", "0.60769343", "0.60662496", "0.6062452", "0.60615647", "0.60525924...
0.58116496
59
PUT /pages/1 PUT /pages/1.xml
def update @page = Page.find(params[:id]) @page.update_attributes(params[:page]) respond_with(@page, :status => :updated) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @page = Page.find(params[:id])\n\n respond_to do |format|\n if @page.update_attributes(params[:page])\n format.json { head :no_content }\n format.xml { head :no_content }\n else\n format.json { render json: @page.errors, status: :unprocessable_entity }\n for...
[ "0.66284263", "0.65006965", "0.6484426", "0.634817", "0.63170284", "0.63170284", "0.6307204", "0.62850606", "0.62725157", "0.6272457", "0.6272457", "0.62669927", "0.625621", "0.62487787", "0.6245245", "0.6210775", "0.6209471", "0.6154518", "0.61382294", "0.61285436", "0.60986...
0.62164617
15
DELETE /pages/1 DELETE /pages/1.xml
def destroy @page = Page.find(params[:id]) @page.destroy respond_with(@page, :status => :deleted, :location => pages_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_page(id)\n @client.raw('delete', \"/content/pages/#{id}\")\n end", "def destroy\n @page = Page.find(params[:id])\n @page.destroy\n\n respond_to do |format|\n format.html { redirect_to(pages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @page = Page.find...
[ "0.7252332", "0.7161119", "0.7161119", "0.7161119", "0.7161119", "0.7161119", "0.7161119", "0.7161119", "0.7161119", "0.7106013", "0.7086914", "0.7062609", "0.7045329", "0.69755495", "0.6959714", "0.6921489", "0.69133663", "0.68900084", "0.68893564", "0.68533075", "0.684198",...
0.6531334
52
Get a device pixel ratio. Can be used to handle desktop browser zoom, retina devices and custom screen scale for mobile devices. Use $window.visual_viewport.scale to handle mobile zoom.
def zoom `#@native.devicePixelRatio` end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixel_aspect_ratio\n pixel_width / pixel_height\n end", "def aspect_ratio\n if self.native_width && self.native_height\n return self.native_width/self.native_height.to_f\n else\n return 1.324 # Derived from the default values, above\n end\n end", "def aspect_ratio\n return 'n...
[ "0.68068504", "0.6387045", "0.6333623", "0.6145255", "0.61379796", "0.60970527", "0.59606546", "0.5932427", "0.5862331", "0.58117133", "0.5797866", "0.57392436", "0.5712926", "0.57086307", "0.57035506", "0.5682102", "0.5612614", "0.56079054", "0.5605045", "0.55290115", "0.552...
0.6323729
3
Handle pixel_ratio changes. This will trigger a block on zoom.
def on_zoom &block %x{ var mqString = "(resolution: " + #@native.devicePixelRatio + "dppx)"; #@native.matchMedia(mqString).addListener(#{block.to_n}); } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_zoom\n @effectus_old_zoom_x = @picture.zoom_x\n @effectus_old_zoom_y = @picture.zoom_y\n self.zoom_x = @effectus_old_zoom_x / 100.0\n self.zoom_y = @effectus_old_zoom_y / 100.0\n end", "def set_ratio\n @ratio = $program.width.to_f / $program.height\n end", "def update_capture_rect\n...
[ "0.6145346", "0.6041189", "0.5530866", "0.5511827", "0.5478244", "0.5422451", "0.53960496", "0.53921884", "0.53900766", "0.53817016", "0.53699714", "0.5347563", "0.53198594", "0.52945364", "0.5288352", "0.5268228", "0.5256204", "0.5252647", "0.52232707", "0.5218196", "0.52181...
0.65428907
0
GET /dishes GET /dishes.json
def index @dishes = @chef.dishes end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def show\n @dishes = Dish.all\n end", "def index\n @dishes = @restaurant.dishes\n end", "def index\n @admin_dishes = Admin::Dish.all\n end", "def index\n @s...
[ "0.7480477", "0.7480477", "0.7480477", "0.7239044", "0.7230754", "0.7189477", "0.69575727", "0.69111127", "0.6894276", "0.68802094", "0.687456", "0.67474675", "0.672814", "0.6632182", "0.6631193", "0.6630109", "0.65183073", "0.6511417", "0.6491279", "0.64826745", "0.64742416"...
0.69706947
6
GET /dishes/1 GET /dishes/1.json
def show unless @dish.my_chef?(@chef) redirect_to :chef_dishes end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def index\n @dishes = Dish.all\n end", "def show\n @dish = Dish.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dish }\n end\n end", "def ...
[ "0.7109968", "0.7109968", "0.7109968", "0.704836", "0.6982206", "0.6942599", "0.69029236", "0.6888127", "0.6863229", "0.6814225", "0.6768038", "0.6758687", "0.6747016", "0.67401415", "0.6729565", "0.67221105", "0.6671445", "0.665709", "0.66046786", "0.64892066", "0.64820224",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_dish @dish = Dish.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 dish_params params.fetch(:dish, {}).permit(:name, :description, :price, :active) 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
get the specified fileset
def get_fileset filesets = batched_get( { id: params[:id] } ) if filesets.empty? render_json_fileset_response(:not_found ) else render_json_fileset_response(:ok, fileset_transform( filesets ) ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_set\n @file_set ||= ::FileSet.find(id)\n end", "def file_set\n @file_set ||= resource_decorator.geo_members&.first\n end", "def file_set\n @file_set ||= begin\n representative_id = geo_work.solr_document.representative_id\n file_set_id = [representative...
[ "0.7341747", "0.7093118", "0.6789575", "0.6673121", "0.66451925", "0.656942", "0.65615577", "0.6493162", "0.63825893", "0.6359777", "0.6325632", "0.62982774", "0.62797445", "0.62391984", "0.62300026", "0.62230355", "0.6185841", "0.6183874", "0.61782706", "0.608058", "0.608015...
0.718102
1
add a new file(set)
def add_fileset # grab the parameters work_id = params[:work] file_id = params[:file] label = params[:label] # validate them if work_id.blank? == false && file_id.blank? == false && label.blank? == false work = get_the_work( work_id ) if work.nil? == false filename = APIV1FilesetsController.cache_contents( file_id ) if filename.blank? == false fileset = ::FileSet.new fileset.title << label file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user ) file_actor.create_metadata( work ) file_actor.create_content( File.open( filename ) ) fileset.visibility = Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC fileset.save! # audit the information #audit_log( "File #{label} for work id #{work_id} (#{work.identifier}) added by #{User.cid_from_email( @api_user.email)}" ) WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), "File #{File.basename( filename )}/#{label} added" ) render_standard_response( :ok ) else render_standard_response( :not_found, 'File not found' ) end else render_standard_response( :not_found, 'Work not found' ) end else render_standard_response( :unauthorized, 'Missing work identifier or file identifier or file label' ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_set_append\n # Append the array of file metadata values to any FileSets with new FileNodes being appended\n parent.file_metadata += file_nodes\n file_nodes\n end", "def addFile(file)\r\n @files << file\r\n end", "def add(filename)\n not_implemented('add')\n end", "def add_fil...
[ "0.7100433", "0.70020795", "0.68909746", "0.6839125", "0.6719752", "0.67011416", "0.6693415", "0.6651965", "0.65866196", "0.6566777", "0.6493537", "0.64864457", "0.648329", "0.6456593", "0.6447512", "0.63588643", "0.6349152", "0.62968373", "0.6256042", "0.62408036", "0.622825...
0.63270295
17
remove the specified fileset
def remove_fileset fileset = get_the_fileset if fileset.nil? == false works = fileset.in_works work_id = works.empty? ? 'unknown' : works[0].id # audit the information WorkAudit.audit( work_id, User.cid_from_email( @api_user.email), "File #{fileset.label}/#{fileset.title[0]} deleted" ) file_actor = ::CurationConcerns::Actors::FileSetActor.new( fileset, @api_user ) file_actor.destroy render_standard_response( :ok ) else render_standard_response( :not_found, 'Fileset not available' ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_fileset(volid)\n fn = get_fs_fn(volid)\n if File.exists?(fn)\n HDB.verbose and puts \"Removing fileset for volume ID #{volid}\"\n FileUtils.rm(fn)\n @filesets.delete(volid)\n end\n end", "def delete_fileset( user, fileset )\n\n print \"deleting file set #{file...
[ "0.7830266", "0.75154257", "0.69488794", "0.681318", "0.6724291", "0.66937715", "0.6636439", "0.6604545", "0.6499365", "0.64312756", "0.6426991", "0.6410731", "0.6393872", "0.637669", "0.6351044", "0.6294012", "0.625544", "0.6245612", "0.6231983", "0.6217379", "0.61795235", ...
0.83428305
0
render a json response
def render_json_fileset_response( status, filesets = nil ) render json: API::FilesetListResponse.new( status, filesets ), :status => status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_json\n end", "def json(response, options = {})\n render options.merge(:json => response)\n end", "def json_render(json = {})\n json_render_html('success', json)\n end", "def render_json(json)\n self.response[:headers]['Content-Type'] = 'text/javascript'\n self.response[:bo...
[ "0.83037084", "0.7844951", "0.7669119", "0.7589152", "0.7464116", "0.7352983", "0.7281533", "0.72758114", "0.7210089", "0.71743166", "0.71188974", "0.71158355", "0.70405245", "0.70298445", "0.70298445", "0.70255536", "0.7010939", "0.7004776", "0.69703555", "0.694587", "0.6934...
0.0
-1
render a csv response
def render_csv_fileset_response( filesets ) @records = filesets headers['Content-Disposition'] = 'attachment; filename="fileset-list.csv"' headers['Content-Type'] ||= 'text/csv' render 'csv/v1/filesets' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_csv_works_response( works )\n @records = works\n headers['Content-Disposition'] = 'attachment; filename=\"work-list.csv\"'\n headers['Content-Type'] ||= 'text/csv'\n render 'csv/v1/works'\n end", "def render_csv(data,headers,filename)\n csv_writer = ::CSV::Writer.generate(output = '')\...
[ "0.7991944", "0.779453", "0.779453", "0.7758373", "0.76909244", "0.7652963", "0.7634279", "0.7577946", "0.7475563", "0.7419247", "0.7410092", "0.7393171", "0.73769665", "0.736391", "0.734872", "0.73005825", "0.7293429", "0.72895014", "0.7280932", "0.725443", "0.7222304", "0...
0.7501892
8
Write a method that takes an Array as an argument, and reverses its elements in place; that is, mutate the Array passed into this method. The return value should be the same Array object. You may not use Arrayreverse or Arrayreverse!. Understanding: Make a method that is mutating The mutation reverses the order of the elements Either duplicate the original array for reference Or, save each value before it is manipulated The stored value could be used after the half of array swapped If counter >= array.length/2 use stored values in reverse order from storage Duplicate array easier Element to use at each iteration is counter if counter initiated at one Or, counter 1 if started at zero Or, even easier! .pop last elemtent from duplicate array Break if duplicate array.length == 0 at top
def backwards!(array) duplicate = array.clone counter = 0 loop do break if duplicate.empty? # counter == array.length array[counter]= duplicate.pop counter += 1 end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse!(array)\n copy = array.clone\n index = -1\n\n copy.each do |element|\n array[index] = element\n index -= 1\n end\n\n array\nend", "def reverse!(array)\n iteration = array.length / 2\n iteration.times do |index|\n array[index], array[-index - 1] = array[-index - 1], array[index]\n end...
[ "0.854425", "0.8462013", "0.84513927", "0.83876175", "0.83704543", "0.83704543", "0.8306197", "0.8274625", "0.82558495", "0.82239956", "0.8220534", "0.8220534", "0.82157254", "0.82157254", "0.82157254", "0.8199073", "0.81806886", "0.81729925", "0.8169787", "0.8148518", "0.814...
0.7933362
61
Adds a new track to the pattern.
def track(name, wave_data, rhythm) track_key = unique_track_name(name) new_track = Track.new(track_key, wave_data, rhythm) @tracks[track_key] = new_track # If the new track is longer than any of the previously added tracks, # pad the other tracks with trailing . to make them all the same length. # Necessary to prevent incorrect overflow calculations for tracks. longest_track_length = tick_count() @tracks.values.each do |track| if track.rhythm.length < longest_track_length track.rhythm += "." * (longest_track_length - track.rhythm.length) end end return new_track end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_track(track)\n reload\n @tracks << track\n save\n end", "def add_track(track)\n unless self.tracks.include?(track)\n self.tracks << track\n end\n \n track\n end", "def add_track(*args)\n commit('addTrack', *args)\n end", "def add_tra...
[ "0.7547167", "0.75271547", "0.72325426", "0.69226134", "0.69226134", "0.67416644", "0.67270344", "0.6695988", "0.6333293", "0.62729615", "0.6145037", "0.602736", "0.5878309", "0.5829796", "0.5798306", "0.57837355", "0.5765849", "0.57293254", "0.56887287", "0.5685331", "0.5659...
0.5901091
12
The number of samples required for the pattern at the given tempo. DOES NOT include samples necessary for sound that overflows past the last tick of the pattern.
def sample_length(tick_sample_length) @tracks.keys.collect {|track_name| @tracks[track_name].sample_length(tick_sample_length) }.max || 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lengths\n frequencies.map { |frequency| (@project.speed_of_sound / (frequency * 2) * 1000).round(0) }\n end", "def nclocks\n return @sig_waveforms[0][1].length\n end", "def beats_per_minute\n return DEFAULT_TEMPO if @tracks.nil? || @tracks.empty?\n event = @tracks.first.events.detect ...
[ "0.6073124", "0.6011683", "0.5952126", "0.5886647", "0.58209544", "0.58209544", "0.5769846", "0.5704317", "0.5631941", "0.5575624", "0.5512494", "0.5484181", "0.5484181", "0.5452692", "0.52917707", "0.5274809", "0.5274809", "0.5274809", "0.5274809", "0.52414316", "0.5228543",...
0.61676615
0
The number of samples required for the pattern at the given tempo. Include sound overflow past the last tick of the pattern.
def sample_length_with_overflow(tick_sample_length) @tracks.keys.collect {|track_name| @tracks[track_name].sample_length_with_overflow(tick_sample_length) }.max || 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sample_length(tick_sample_length)\n @tracks.keys.collect {|track_name| @tracks[track_name].sample_length(tick_sample_length) }.max || 0\n end", "def beats_per_minute\n return DEFAULT_TEMPO if @tracks.nil? || @tracks.empty?\n event = @tracks.first.events.detect { |e| e.kind_of?(MIDI::Tempo) }\n ...
[ "0.6159818", "0.606809", "0.601155", "0.59882826", "0.57891333", "0.57185465", "0.57055926", "0.57055926", "0.5649277", "0.55226415", "0.5494908", "0.54325664", "0.5396639", "0.53945136", "0.53945136", "0.53512967", "0.5319225", "0.5303313", "0.52267677", "0.52267677", "0.520...
0.5750562
5
Returns whether or not this pattern has the same number of tracks as other_pattern, and that each of the tracks has the same name and rhythm. Ordering of tracks does not matter; will return true if the two patterns have the same tracks but in a different ordering.
def same_tracks_as?(other_pattern) @tracks.keys.each do |track_name| other_pattern_track = other_pattern.tracks[track_name] if other_pattern_track == nil || @tracks[track_name].rhythm != other_pattern_track.rhythm return false end end return @tracks.length == other_pattern.tracks.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def same_tracks_as?(other_pattern)\n @tracks.keys.each do |track_name|\n other_pattern_track = other_pattern.tracks[track_name]\n if other_pattern_track.nil? || @tracks[track_name].rhythm != other_pattern_track.rhythm\n return false\n end\n end\n\n @tracks.length == oth...
[ "0.89459646", "0.658278", "0.6314192", "0.60308874", "0.6010899", "0.5708707", "0.5697091", "0.5679371", "0.56540245", "0.5640146", "0.5559628", "0.55541915", "0.5430255", "0.54141515", "0.5374365", "0.53398955", "0.53310454", "0.53065026", "0.52857995", "0.52852714", "0.5282...
0.89420646
1
Returns a YAML representation of the Pattern. Produces nicer looking output than the default version of to_yaml().
def to_yaml longest_track_name_length = @tracks.keys.inject(0) do |max_length, name| (name.to_s.length > max_length) ? name.to_s.length : max_length end ljust_amount = longest_track_name_length + 7 yaml = "#{@name.to_s.capitalize}:\n" @tracks.keys.sort.each do |track_name| yaml += " - #{track_name}:".ljust(ljust_amount) yaml += "#{@tracks[track_name].rhythm}\n" end return yaml end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_yaml() end", "def to_yaml\n # write yaml\n end", "def to_yaml\n YAML::dump(self)\n end", "def to_yaml\n YAML::dump(self)\n end", "def to_yaml\n YAML::dump(self)\n end", "def to_yaml\n YAML::dump(self)\n end", "def to_yml\n YAML.dump(self)\n end", "def serialize\n ...
[ "0.66700035", "0.6506397", "0.64078915", "0.64078915", "0.64078915", "0.6394679", "0.63654983", "0.6293455", "0.62788105", "0.6274251", "0.62159735", "0.62159735", "0.6174336", "0.61645746", "0.6140597", "0.6131433", "0.61242855", "0.61096317", "0.6109043", "0.6084597", "0.60...
0.5836246
36
Returns a unique track name that is not already in use by a track in this pattern. Used to help support having multiple tracks with the same sample in a track.
def unique_track_name(name) i = 2 name_key = name while @tracks.has_key? name_key name_key = "#{name}#{i.to_s}" i += 1 end return name_key end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unique_track_name(name)\n i = 2\n name_key = name\n while @tracks.has_key? name_key\n name_key = \"#{name}#{i.to_s}\"\n i += 1\n end\n\n name_key\n end", "def unique_name\n unique_name = @name\n unique_name += \" (#{@disambiguation})\" if @disambiguatio...
[ "0.81452787", "0.67846096", "0.674309", "0.64689434", "0.63747644", "0.6361295", "0.62208444", "0.6047114", "0.6007644", "0.5988842", "0.5983048", "0.59761363", "0.593555", "0.593555", "0.5917065", "0.5880443", "0.58753675", "0.58692724", "0.5864421", "0.58629364", "0.5858118...
0.8083689
1
seeds: array of unique numbers from 0..99 length: length of the number string to generate
def gen_numstr(seeds, length) ((length/2) + 1).times.map{ seeds.sample.to_s.rjust(2, "0") }.join[0..length-1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def random_numbers(len)\n numbers = (\"0\"..\"9\").to_a\n newrand = \"\"\n 1.upto(len) { |i| newrand << numbers[rand(numbers.size - 1)] }\n return newrand\n end", "def generate_sequence()\n (0..9).to_a.permutation(4).to_a #all permutations, 4 digits long\nend", "def generate_random_characters(num...
[ "0.7459485", "0.71623707", "0.71389174", "0.70728457", "0.7042807", "0.69644445", "0.6903056", "0.6898947", "0.6792982", "0.6790028", "0.6773381", "0.6768046", "0.6748388", "0.67283815", "0.6722684", "0.670361", "0.6690658", "0.66757816", "0.667491", "0.66640776", "0.66581696...
0.75942796
0
should initialize with Student (Object), a boating test name (String), a boating test status (String), and an Instructor (Object)
def initialize (hash) @student = hash[:student] @name = hash[:name] @status = hash[:status] @teacher = hash[:teacher] BoatingTest.all << self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(student,boating_test_name,boating_test_status,instructor)\n @student = student\n @boating_test_name = boating_test_name\n @boating_test_status = boating_test_status\n @instructor = instructor\n @@all << self\n end", "def initialize(student, test_name, status, instructor)\n @stud...
[ "0.81520367", "0.80605036", "0.8041177", "0.7263264", "0.7237492", "0.7153897", "0.7087904", "0.68749785", "0.6766958", "0.6758973", "0.672123", "0.66684455", "0.6662399", "0.66289693", "0.6627173", "0.65964794", "0.6581052", "0.64542276", "0.6423145", "0.63743836", "0.635106...
0.6818532
8
non optimimed version of part2
def subsequences(start, sub, last) to_test = [] to_test << sub valid_combinations = 0 while to_test.any? next_to_test = Set.new to_test .select { |subset| find_path(start, subset, last) } .tap { |subsets| valid_combinations += subsets.size } .each do |subset| subset.combination(subset.size - 1).to_a.each do |s| next_to_test << s end end to_test = next_to_test end valid_combinations end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parts; end", "def parts; end", "def parts; end", "def diff2; end", "def probers; end", "def diff1; end", "def offences_by; end", "def part11\n # STUB\n end", "def stderrs; end", "def private; end", "def rest_positionals; end", "def part2(elves)\n higher_power = Math::log(elves,3).cei...
[ "0.64125264", "0.64125264", "0.64125264", "0.57457674", "0.5708471", "0.5698382", "0.55819756", "0.5580104", "0.54894406", "0.54858583", "0.54825467", "0.5474363", "0.546747", "0.546747", "0.546747", "0.546747", "0.5446488", "0.544049", "0.54364026", "0.5429073", "0.5421506",...
0.0
-1
return [FalseClass] false if there is no path with those chargers
def find_path(start, chargers, builtin) chargers = chargers.dup current_jolt = start chargers << builtin chargers.sort.each do |charger| difference = charger - current_jolt return false if difference > 3 current_jolt = charger end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def paths?\n !paths.empty?\n end", "def path?\n !path.empty?\n end", "def path_would_break_wraith?(path)\n path.include?('path')\n end", "def check_paths paths\n exist_count = paths.inject(0){|cnt, path| cnt += 1 if exists?(path); cnt}\n raise \"Indeterminate out...
[ "0.72064775", "0.69182116", "0.676882", "0.6663887", "0.66604364", "0.6616644", "0.66089827", "0.6555849", "0.65496373", "0.65234625", "0.65234625", "0.64287835", "0.63943535", "0.6352969", "0.6350156", "0.6331958", "0.62666494", "0.62528807", "0.62371665", "0.62268704", "0.6...
0.65792185
7
call throw(:error) for fail save process (save method will return false)
def _save raise NotImplementedError, 'override #_save in a subclass' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save\n save!\n rescue StandardError\n false\n end", "def save\r\n do_without_exception(:save!)\r\n end", "def save!\n raise \"#{self.inspect} failed to save\" unless self.save\n end", "def save\n import\n errors.none?\n end", "def save\n self.save! ...
[ "0.80393517", "0.77055967", "0.76802033", "0.75978285", "0.75014454", "0.74911124", "0.74640834", "0.7456718", "0.72671604", "0.7255539", "0.72389245", "0.7188606", "0.7103299", "0.7072355", "0.702532", "0.7009599", "0.6995099", "0.6983157", "0.6974013", "0.69105357", "0.6901...
0.62890667
94
GET /issue_groups/1 GET /issue_groups/1.json
def show @issue_group = IssueGroup.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @issue_group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @issue_groups = IssueGroup.all\n end", "def new\n @issue_group = IssueGroup.new\n\n #Load possible GitHub\n @repos = GithubWrapper.new()\n @repos.list_all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue_group }\n end\n end",...
[ "0.7772095", "0.7340468", "0.71958435", "0.69669783", "0.67493176", "0.66678965", "0.6626798", "0.6621851", "0.626897", "0.62573826", "0.6254444", "0.6229301", "0.62209374", "0.61692965", "0.6146769", "0.6145963", "0.6131465", "0.6121597", "0.6115342", "0.61093354", "0.610690...
0.76692176
1
GET /issue_groups/new GET /issue_groups/new.json
def new @issue_group = IssueGroup.new #Load possible GitHub @repos = GithubWrapper.new() @repos.list_all respond_to do |format| format.html # new.html.erb format.json { render json: @issue_group } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @issue_group = IssueGroup.new(params[:issue_group])\n\n logger.info(\"Params #{params.inspect}\")\n\n respond_to do |format|\n if @issue_group.save\n format.html { redirect_to @issue_group, notice: 'Issue group was successfully created.' }\n format.json { render json: @issu...
[ "0.7767872", "0.72521126", "0.71462786", "0.71363425", "0.71321195", "0.71321195", "0.71321195", "0.71321195", "0.71321195", "0.71321195", "0.71321195", "0.71321195", "0.7079238", "0.70675385", "0.70675385", "0.70404357", "0.70376873", "0.7032116", "0.7024279", "0.70119876", ...
0.8175249
0
POST /issue_groups POST /issue_groups.json
def create @issue_group = IssueGroup.new(params[:issue_group]) logger.info("Params #{params.inspect}") respond_to do |format| if @issue_group.save format.html { redirect_to @issue_group, notice: 'Issue group was successfully created.' } format.json { render json: @issue_group, status: :created, location: @issue_group } else format.html { render action: "new" } format.json { render json: @issue_group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n @issue_group = IssueGroup.new(issue_group_params)\n current_report = Report.first_or_create\n if @issue_group.save\n current_report.report_parts << @issue_group\n format.html { redirect_to reports_path, notice: 'Issue group was successfully crea...
[ "0.68627423", "0.6629523", "0.6629523", "0.65878445", "0.6467961", "0.6396799", "0.6345851", "0.63126564", "0.62941825", "0.6287958", "0.62344867", "0.62292826", "0.6222382", "0.61881787", "0.6120158", "0.6105716", "0.60973823", "0.60863996", "0.6083738", "0.60231096", "0.601...
0.7616738
0
PUT /issue_groups/1 PUT /issue_groups/1.json
def update @issue_group = IssueGroup.find(params[:id]) respond_to do |format| if @issue_group.update_attributes(params[:issue_group]) format.html { redirect_to @issue_group, notice: 'Issue group was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @issue_group.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_issue_group\n @issue_group = IssueGroup.find(params[:id])\n end", "def update\n @issue_tracker_group.update(issue_tracker_group_params)\n @issue_tracker_groups = IssueTrackerGroup.all \n @issue_tracker_group = IssueTrackerGroup.new \n end", "def update\n respond_to do |format|\n ...
[ "0.7412922", "0.69454664", "0.6830498", "0.6674788", "0.6555305", "0.65256375", "0.65231335", "0.64981943", "0.6425023", "0.638065", "0.6311228", "0.6272844", "0.62069434", "0.6187006", "0.61557144", "0.6103973", "0.6101552", "0.60941404", "0.60836506", "0.60769355", "0.60700...
0.76037633
0
DELETE /issue_groups/1 DELETE /issue_groups/1.json
def destroy @issue_group = IssueGroup.find(params[:id]) @issue_group.destroy respond_to do |format| format.html { redirect_to issue_groups_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n # @group = @hub.groups.get(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to hub_groups_url }\n format.json { head :no_content }\n end\n end", "def DeleteGroup id\n \n APICall(path: \"groups/#{id}.json\",method: 'DELETE')\n ...
[ "0.744944", "0.74131614", "0.7323961", "0.7302787", "0.7295251", "0.7292162", "0.7250964", "0.7240694", "0.72196484", "0.71975356", "0.7175185", "0.7174294", "0.7174294", "0.715537", "0.715537", "0.715537", "0.715537", "0.715537", "0.71486956", "0.71486956", "0.7140114", "0...
0.81782764
0
I worked on this challenge by myself. I spent 3 hours on this challenge. Pseudocode Input: an array of strings Output: one of these strings or an argument error Steps: Initial Solution class Die def initialize(labels) end
def sides sides = Array.new sides = ["A", "B", "C", "D", "E", "F"] num_of_sides = sides.length if num_of_sides == 0 puts "Argument Error: not enough sides" else puts num_of_sides end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(dice_roll_string, output=$stdout)\n @output = output\n @dice_roll_string = dice_roll_string.downcase.gsub(' ', '')\n if valid_dice_roll_string?\n set_default_values\n add_dice_to_dice_array(@number_of_dice, @sides_on_dice)\n else\n raise ArgumentError.new('In...
[ "0.5174266", "0.51364017", "0.50558156", "0.49675912", "0.49332753", "0.49220926", "0.49107173", "0.48835805", "0.48795894", "0.48635888", "0.4847959", "0.48451233", "0.484325", "0.48404688", "0.48393837", "0.4829782", "0.48241046", "0.48062432", "0.4772998", "0.4733544", "0....
0.43536425
96
Return the most recent svn revision number stored in git
def get_git_si_revision info = get_command_output(Git::Si::GitControl.log_command('--pretty=%B')) return Git::Si::GitControl.parse_last_svn_revision(info) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_svn_revision\n svn_info = get_command_output(Git::Si::SvnControl.info_command)\n return Git::Si::SvnControl.parse_last_revision(svn_info)\n end", "def get_svn_rev( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['Revision']\nend", "def get_last_changed_revision(repo, fname)\n ...
[ "0.7910216", "0.76775026", "0.7575089", "0.75320107", "0.73994267", "0.73659205", "0.7312522", "0.7298962", "0.7265565", "0.723441", "0.72234696", "0.72123295", "0.7145389", "0.7111473", "0.7083814", "0.7038966", "0.70022297", "0.6970724", "0.69662327", "0.6951856", "0.684061...
0.7714214
1
Return the most recent svn revision number
def get_svn_revision svn_info = get_command_output(Git::Si::SvnControl.info_command) return Git::Si::SvnControl.parse_last_revision(svn_info) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_svn_rev( dir='.' )\n\tinfo = get_svn_info( dir )\n\treturn info['Revision']\nend", "def last_revision\n get_revision('REVISION')\n end", "def get_latest_svn_timestamp_tag\n\trooturl = get_svn_repo_root()\n\ttagsurl = rooturl + \"/#{SVN_TAGS_DIR}\"\n\t\n\ttags = svn_ls( tagsurl ).grep( T...
[ "0.76590186", "0.7561654", "0.7293517", "0.72895926", "0.7266247", "0.72489864", "0.722211", "0.72143", "0.7207977", "0.71917176", "0.7143983", "0.71363", "0.7115474", "0.70794713", "0.6975075", "0.6946581", "0.69384044", "0.6908449", "0.6897423", "0.68877494", "0.6881807", ...
0.7919027
0
Start a new list of paths, starting with the DEFAULT_PATHS
def initialize @locations = DEFAULT_PATHS.dup # use a copy to prevent global state @exists = Hash.new do |hash, p| hash[p] = system('test -x ' + p) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_paths\n [ '.' ]\n end", "def initial_paths; end", "def dir_list\n path_from_env || default_path\n end", "def prepend_paths(*paths)\n self.paths.unshift(*paths)\n end", "def assign_paths\n self.path = generate_path(self)\n end", "def file_path_list\n @file_pa...
[ "0.66164964", "0.65297616", "0.64456075", "0.6287014", "0.61309135", "0.6024572", "0.5955224", "0.5955224", "0.5952223", "0.5948113", "0.5935666", "0.5932988", "0.5838435", "0.583528", "0.57734543", "0.5770425", "0.57577354", "0.5751455", "0.5751455", "0.57502985", "0.5749986...
0.0
-1
Add a new path to the stack before the existing ones.
def <<(new_path) @locations.unshift(new_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepend_path(path)\n @paths.unshift(File.expand_path(path, root))\n end", "def prepend_path(path)\n @trail.prepend_path(path)\n end", "def prepend_path(path)\n mutate_config(:paths) do |paths|\n path = File.expand_path(path, root).dup.freeze\n paths.unshift(path)\n e...
[ "0.70139915", "0.70096296", "0.6951032", "0.69117737", "0.6755237", "0.67519903", "0.6688714", "0.6630987", "0.66274905", "0.66130424", "0.65608054", "0.6494707", "0.6439117", "0.6411317", "0.6381258", "0.63473004", "0.6329796", "0.62921315", "0.62315565", "0.62176996", "0.62...
0.6792241
4
Scan all the known paths to find the given program. Note: this probably only works on unixlike systems.
def to(program) location = locations.find { |path| exists? File.join(path, program) } raise NotFound.new(program) unless location location end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_program( *names )\n system_path = ENV.read( 'PATH', Array )\n [ names ].flatten!.find do | prog |\n system_path.find { | d | File.executable?( d / prog ) }\n end\n end", "def find_programs *directories\n directories.flatten.\n map {|d| Pathname.new(d).expand_path.children rescue [] ...
[ "0.7869624", "0.7779596", "0.7232688", "0.69642735", "0.6946855", "0.6843952", "0.65294385", "0.641528", "0.6391864", "0.6381843", "0.63490164", "0.6337146", "0.6336708", "0.63198054", "0.62760186", "0.62760186", "0.62760186", "0.62422353", "0.62021047", "0.61926484", "0.6190...
0.0
-1
Make the actual test if a given path points to an executable file.
def exists?(path) @exists[path] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_executable(path)\n # Be smart: If the path includes a forward slash, we're checking\n # an absolute path. Otherwise, we're checking a global executable\n if path.include?('/')\n @commands << \"test -x #{path}\"\n else\n @commands << \"[ -n \\\"`echo \\\\`which ...
[ "0.71624357", "0.71217924", "0.7120038", "0.7096307", "0.70784134", "0.68564534", "0.6693522", "0.6609413", "0.6599233", "0.6588062", "0.6572967", "0.6561461", "0.6561351", "0.64652497", "0.6438425", "0.6395151", "0.63700235", "0.6367695", "0.63121575", "0.6308431", "0.625242...
0.0
-1
Actions Objective: To get all the candidates applied for a Campaign Input: Call with Campaign object Output: Returns all users who has applied for a requested campaign
def candidates_applied users.where('users.status <> :s', s: USER_STATUS_DELETED) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_campaigns\n # iterate through the matching campaigns and determine whether their requirements have been met\n matching_campaigns.each do |campaign|\n campaign.actions << self\n # associate the campaign with the user if all of the campaign requirements have been met\n if campaign.req...
[ "0.6268198", "0.592085", "0.5899938", "0.57610637", "0.5646621", "0.5555751", "0.554982", "0.54885423", "0.5450536", "0.5435476", "0.5430007", "0.53892314", "0.5370071", "0.53641415", "0.5358377", "0.5347822", "0.5327097", "0.53081053", "0.52782345", "0.5270602", "0.5268664",...
0.48875076
80
Objective: To get all the candidates who are forwarded to client or rejected for a Campaign Input: Call with Campaign object Output: Returns all users who are forwarded to client or rejected for a requested campaign
def candidates_forwarded_or_rejected users.where('users.status <> :us AND user_campaigns.status in (:cs)', us: USER_STATUS_DELETED, cs: [USER_CAMPAIGN_STATUS_FORWARDED, USER_CAMPAIGN_STATUS_REJECTED]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def candidates_forwarded\n users.where('users.status <> :us AND user_campaigns.status = :cs', us: USER_STATUS_DELETED, cs: USER_CAMPAIGN_STATUS_FORWARDED)\n end", "def index\n @user_campaigns = UserCampaign.all\n end", "def get_user_campaigns username, password\n do_request 'get_user_campaigns', u...
[ "0.6343768", "0.5703365", "0.5695372", "0.56617075", "0.56560344", "0.550285", "0.54683644", "0.5385286", "0.53811663", "0.5373534", "0.53647345", "0.5362587", "0.535516", "0.53546154", "0.53505564", "0.53442097", "0.53237075", "0.5297325", "0.5266161", "0.52497625", "0.52438...
0.6196754
1
Objective: To get all the candidates who are forwarded to client for a Campaign Input: Call with Campaign object Output: Returns all users who are forwarded to client for a requested campaign
def candidates_forwarded users.where('users.status <> :us AND user_campaigns.status = :cs', us: USER_STATUS_DELETED, cs: USER_CAMPAIGN_STATUS_FORWARDED) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_campaigns = UserCampaign.all\n end", "def get_user_campaigns username, password\n do_request 'get_user_campaigns', username: username, password: password\n end", "def add_ids_to_campaignmember(obj,instance_url,access_token)\n json_payload = nil\n campaign_id = obj[\"event\"]...
[ "0.59518826", "0.58395857", "0.5580348", "0.5544941", "0.553979", "0.55374235", "0.55362356", "0.5473714", "0.54561806", "0.54405636", "0.5432052", "0.5413591", "0.539702", "0.53905255", "0.5380241", "0.53705096", "0.5359584", "0.5319965", "0.52920306", "0.528768", "0.5269345...
0.6193619
0
Objective: TODO: Input: Output:
def check_status #binding.pry #TODO: set date_activated/ date_inactive return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stderrs; end", "def probers; end", "def formation; end", "def schubert; end", "def anchored; end", "def solution4(input)\n end", "def schumann; end", "def private; end", "def transformations; end", "def malts; end", "def transform; end", "def rassoc(p0) end", "def algorithms; end", "...
[ "0.62893474", "0.6279681", "0.62515515", "0.6146573", "0.612371", "0.611462", "0.6095964", "0.6052027", "0.6019143", "0.6002512", "0.5996389", "0.59518677", "0.5936928", "0.5936928", "0.5936928", "0.5936928", "0.5936928", "0.5923737", "0.5923737", "0.5923737", "0.58953446", ...
0.0
-1
Objective: TODO: Input: Output:
def initial_exam_end_date(contact) initial_campaign_exam = CampaignExam.where("campaign_id = ? AND stage = ?", self.id, EXAM_STAGE_INITIAL).first initial_exam_present = false initial_exam_ended_date = false if initial_campaign_exam.present? initial_exam_present = true initial_user_exam = UserExam.where("user_id = ? AND exam_id = ?",contact.id, initial_campaign_exam.exam_id).first initial_exam_ended_date = (initial_exam_present) ? initial_user_exam.date_end : false end return initial_exam_present, initial_exam_ended_date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stderrs; end", "def probers; end", "def formation; end", "def schubert; end", "def anchored; end", "def solution4(input)\n end", "def schumann; end", "def private; end", "def transformations; end", "def malts; end", "def transform; end", "def rassoc(p0) end", "def algorithms; end", "...
[ "0.62892145", "0.6279755", "0.62516665", "0.6146027", "0.6123367", "0.61147946", "0.6095489", "0.6051495", "0.6019269", "0.60023516", "0.59965533", "0.5951997", "0.5936875", "0.5936875", "0.5936875", "0.5936875", "0.5936875", "0.5924004", "0.5924004", "0.5924004", "0.58949274...
0.0
-1
Objective: TODO: Input: Output:
def additional_exam_end_date(contact) additional_campaign_exam = CampaignExam.where("campaign_id = ? AND stage = ?", self.id, EXAM_STAGE_ADDITIONAL).first additional_exam_present = false additional_exam_ended_date = false if additional_campaign_exam.present? additional_exam_present = true additional_user_exam = UserExam.where("user_id = ? AND exam_id = ?",contact.id, additional_campaign_exam.exam_id).first additional_exam_ended_date = (additional_exam_present) ? additional_user_exam.date_end : false if additional_user_exam end return additional_exam_present, additional_exam_ended_date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stderrs; end", "def probers; end", "def formation; end", "def schubert; end", "def anchored; end", "def solution4(input)\n end", "def schumann; end", "def private; end", "def transformations; end", "def malts; end", "def transform; end", "def rassoc(p0) end", "def algorithms; end", "...
[ "0.62892145", "0.6279755", "0.62516665", "0.6146027", "0.6123367", "0.61147946", "0.6095489", "0.6051495", "0.6019269", "0.60023516", "0.59965533", "0.5951997", "0.5936875", "0.5936875", "0.5936875", "0.5936875", "0.5936875", "0.5924004", "0.5924004", "0.5924004", "0.58949274...
0.0
-1
Objective: TODO: Input: Output:
def verification_exam_end_date(contact) verification_campaign_exam = CampaignExam.where("campaign_id = ? AND stage = ?", self.id, EXAM_STAGE_VERIFICATION).first verification_exam_present = false verification_exam_ended_date = false if verification_campaign_exam.present? verification_exam_present = true verification_user_exam = UserExam.where("user_id = ? AND exam_id = ?",contact.id, verification_campaign_exam.exam_id).first verification_exam_ended_date = (verification_exam_present) ? verificationuser_exam.date_end : false if verification_user_exam.present? end return verification_exam_present, verification_exam_ended_date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stderrs; end", "def probers; end", "def formation; end", "def schubert; end", "def anchored; end", "def solution4(input)\n end", "def schumann; end", "def private; end", "def transformations; end", "def malts; end", "def transform; end", "def rassoc(p0) end", "def algorithms; end", "...
[ "0.62892145", "0.6279755", "0.62516665", "0.6146027", "0.6123367", "0.61147946", "0.6095489", "0.6051495", "0.6019269", "0.60023516", "0.59965533", "0.5951997", "0.5936875", "0.5936875", "0.5936875", "0.5936875", "0.5936875", "0.5924004", "0.5924004", "0.5924004", "0.58949274...
0.0
-1
method that returns the count of nonoperators (in this case, leaves)
def leaves(node, depth=0) if node.left.nil? && node.right.nil? puts "#{node.value}, depth: #{depth}" return 1 else leaves(node.left, depth+1) + leaves(node.right, depth+1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_non_operators(node)\n return if node == nil\n count_non_operators = 0\n print_non_operators(node.left) #starts recursion -- go left\n if node.value.match(/\\d/) #if digits included\n count_non_operators += 1\n print node.value + \" \" #print value of this node\n # print node.count\n end\n ...
[ "0.7215823", "0.6880722", "0.65477526", "0.653713", "0.6405595", "0.6322592", "0.6300525", "0.6217108", "0.61835617", "0.616405", "0.61376786", "0.6119083", "0.6084096", "0.6074037", "0.6017967", "0.5971832", "0.5848849", "0.57825005", "0.5756899", "0.5733635", "0.5674857", ...
0.57485604
19
method that returns whether a given operator exists in the tree
def includes_op(node, op) return true if node.value == op if !node.left.nil? && !node.right.nil? includes_op(node.left, op) || includes_op(node.right, op) else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def operator?(node, operator)\n return if node == nil\n operator?(node.left, operator) #starts recursion -- go left\n if node.value.match(/\\+|\\-|\\/|\\%|\\*/) && (node.value == operator.value) #if operators included\n return true #true\n end\n operator?(node.right, operator) #recursion -- go right\nend",...
[ "0.78650576", "0.7574017", "0.75524473", "0.7505051", "0.7362399", "0.70811903", "0.7063182", "0.70574933", "0.7001024", "0.6965773", "0.6910942", "0.6910942", "0.68314147", "0.6750852", "0.67170715", "0.66944593", "0.6449556", "0.6449499", "0.6410005", "0.64081866", "0.64081...
0.7444033
4
The default security delegates to ActiveRecordPermissions. You may override the method to customize.
def customize_authorized? authorized_for?(:action => :read) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def custom_permissions\n # Limits deleting objects to a the admin user\n #\n # if current_user.admin?\n # can [:destroy], ActiveFedora::Base\n # end\n\n if current_user.admin?\n # Role management\n # don't allow :destroy, :edit, :create\n # - destroy adds a 'delete' button that\...
[ "0.7124058", "0.70427585", "0.6954191", "0.69149697", "0.6909459", "0.6890503", "0.68741816", "0.6855458", "0.68015546", "0.6762293", "0.66815597", "0.66815597", "0.6657583", "0.6640195", "0.6627914", "0.66278124", "0.6593337", "0.64492166", "0.64396954", "0.64392996", "0.631...
0.0
-1
Get only active todos
def active_todos todos.active.order('created_at DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filtered_todos # return the current filtered todos\n TodoItem.all.select { |todo| !(todo.destroyed? or (filter == :completed and !todo.complete) or (filter == :uncompleted and todo.complete))}\n end", "def get_completed_todos\n return Todo.where({\"user_id\" => self.id, \"completed\...
[ "0.7314079", "0.7291622", "0.70031685", "0.698361", "0.6960638", "0.6761387", "0.66480875", "0.6573122", "0.6546193", "0.6520399", "0.64178336", "0.6390285", "0.63839036", "0.637986", "0.6378437", "0.63660294", "0.63417155", "0.63198775", "0.6307474", "0.6262161", "0.6227911"...
0.82490206
0
Get only completed todos
def completed_todos todos.completed.order('completed_time DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_completed_todos\n return Todo.where({\"user_id\" => self.id, \"completed\" => true})\n end", "def get_unfinished_todos\n return Todo.where({\"user_id\" => self.id, \"completed\" => false})\n end", "def show_completed_items\n return @to_do_item.select { |x| x.is_done? == true }\n end", "de...
[ "0.8325468", "0.803294", "0.7754711", "0.7539019", "0.74677336", "0.73926884", "0.737596", "0.72712314", "0.725952", "0.7242745", "0.72334725", "0.71628726", "0.71108925", "0.71039295", "0.7060276", "0.706005", "0.70252687", "0.69380397", "0.6936288", "0.690666", "0.6896613",...
0.7720436
3
Get only tickler todos
def tickler_todos todos.ticklers.order('completed_time DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_todos\n (global_todos.where(language: I18n.locale).to_a.delete_if{ |gt| local_todos.map(&:title).include?(gt.title) } + local_todos)\n end", "def get_unfinished_todos\n return Todo.where({\"user_id\" => self.id, \"completed\" => false})\n end", "def filtered_todos # return the ...
[ "0.700647", "0.6996474", "0.6917995", "0.6915276", "0.68297905", "0.6785343", "0.67156184", "0.66268283", "0.6597759", "0.65945643", "0.65683454", "0.6559726", "0.65131783", "0.6492128", "0.6413532", "0.64133567", "0.6362647", "0.6320331", "0.62956285", "0.6247938", "0.624559...
0.7468833
0
Get todos for user based on options
def todos_for_options(options) todos.for_options(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_todos user_id=\"self\", options={}\n response = get(\"/lists/#{user_id}/todos\", options)[\"response\"]\n Foursquared::Response::List.new(self, response[\"list\"])\n end", "def list_todo_items(opts={})\n query_param_keys = [\n \n ]\n\n form_param_keys = [\n \n ...
[ "0.7449564", "0.7086831", "0.70777005", "0.69103485", "0.6809593", "0.6615748", "0.647293", "0.6472612", "0.6402902", "0.6368681", "0.63076264", "0.6247526", "0.6241648", "0.6231019", "0.60494703", "0.60227764", "0.6000844", "0.59954983", "0.5974967", "0.59619856", "0.5949281...
0.7414612
1
GET /atmdebitcardapps/1 GET /atmdebitcardapps/1.xml
def show @atmdebitcardapp = Atmdebitcardapp.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @atmdebitcardapp } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @atmdebitcardapp = Atmdebitcardapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atmdebitcardapp }\n end\n end", "def show\n @calmapp = Calmapp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.6601822", "0.61928034", "0.60641456", "0.59622836", "0.5919472", "0.58790195", "0.58567476", "0.5698513", "0.5678407", "0.5624944", "0.55989367", "0.558528", "0.5556278", "0.55546564", "0.5552545", "0.5548556", "0.5531218", "0.5525632", "0.5497469", "0.5488445", "0.5463279...
0.72165793
0
GET /atmdebitcardapps/new GET /atmdebitcardapps/new.xml
def new @atmdebitcardapp = Atmdebitcardapp.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @atmdebitcardapp } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @app = Mms::App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", "def new\n @app = App.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app }\n end\n end", ...
[ "0.6873521", "0.6815628", "0.6815628", "0.6815628", "0.67191625", "0.6654106", "0.6650754", "0.66290647", "0.65888226", "0.65349233", "0.6474763", "0.6422396", "0.64146155", "0.6410578", "0.63418543", "0.6313318", "0.6309214", "0.6271763", "0.6268056", "0.6252117", "0.619758"...
0.75321627
0
POST /atmdebitcardapps POST /atmdebitcardapps.xml
def create @atmdebitcardapp = Atmdebitcardapp.new(params[:atmdebitcardapp]) respond_to do |format| if @atmdebitcardapp.save flash[:notice] = 'ATM/Debit Card Application was successfully sent to the concerned person in the Credit Union.' #send email Emailer.deliver_atmdebitcardapp_email(@atmdebitcardapp) format.html { redirect_to(@atmdebitcardapp) } format.xml { render :xml => @atmdebitcardapp, :status => :created, :location => @atmdebitcardapp } else format.html { render :action => "new" } format.xml { render :xml => @atmdebitcardapp.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @atmdebitcardapp = Atmdebitcardapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @atmdebitcardapp }\n end\n end", "def update\n @atmdebitcardapp = Atmdebitcardapp.find(params[:id])\n\n respond_to do |format|\n if @atmdebitcarda...
[ "0.6098403", "0.58407986", "0.5521944", "0.5520135", "0.55172306", "0.54389465", "0.54311866", "0.5418477", "0.5345657", "0.53400165", "0.53400165", "0.53054476", "0.5296114", "0.5296114", "0.524679", "0.5234558", "0.5234217", "0.5227456", "0.5223287", "0.519975", "0.51623905...
0.6760203
0
PUT /atmdebitcardapps/1 PUT /atmdebitcardapps/1.xml
def update @atmdebitcardapp = Atmdebitcardapp.find(params[:id]) respond_to do |format| if @atmdebitcardapp.update_attributes(params[:atmdebitcardapp]) flash[:notice] = 'Atmdebitcardapp was successfully updated.' format.html { redirect_to(@atmdebitcardapp) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @atmdebitcardapp.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n put(\"/apps/#{name}\", :app => attributes).to_s\n end", "def update\n @app = Mms::App.find(params...
[ "0.624868", "0.624868", "0.61521286", "0.6088706", "0.5792676", "0.5773933", "0.57592666", "0.57533085", "0.57533085", "0.56924003", "0.5680585", "0.56788445", "0.56630313", "0.566164", "0.5659014", "0.5648623", "0.5632018", "0.56266016", "0.5615254", "0.5526513", "0.5470466"...
0.7005282
0
DELETE /atmdebitcardapps/1 DELETE /atmdebitcardapps/1.xml
def destroy @atmdebitcardapp = Atmdebitcardapp.find(params[:id]) @atmdebitcardapp.destroy respond_to do |format| format.html { redirect_to(atmdebitcardapps_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def gp_delete_file(aid)\n data = Asn1Ber.encode [{:class => :application, :primitive => true,\n :number => 0x0F, :value => aid}]...
[ "0.6445463", "0.6342466", "0.63039404", "0.63039404", "0.6248787", "0.62485516", "0.613984", "0.61367285", "0.6125919", "0.60752475", "0.60458827", "0.6038029", "0.601892", "0.5969037", "0.5935423", "0.592592", "0.5915474", "0.58908767", "0.5885418", "0.5867698", "0.58617735"...
0.7253086
0
Returns the best matches for person from the prefs dictionary. Number of results and similarity function are optional params.
def top_matches(item_prefs, item, number=5) scores = [] item_prefs.keys.each do |other| if other != item similarity = distance_similarity(item_prefs, item, other) if similarity > 0 scores << [similarity, other] end end end scores = scores.sort_by { |score| -score[0] } return scores[0, number] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getRecommendations(prefs, person, scorefunc = :sim_pearson )\n totals = {}\n simSums = {}\n for other in prefs.keys\n # don't compare me to myself\n next if other == person\n\n if scorefunc == :sim_pearson\n sim = sim_pearson( prefs, person, other)\n else\n sim = sim_...
[ "0.7446463", "0.7334533", "0.7251244", "0.7180137", "0.71721077", "0.70187503", "0.69632196", "0.6462425", "0.6341025", "0.62454134", "0.614427", "0.5947641", "0.5927768", "0.58204", "0.57610977", "0.56258005", "0.5625544", "0.55958945", "0.5588384", "0.5562072", "0.5552533",...
0.6475671
7
TODO: move this into a Row class
def sources_for(r) return if r[:source].to_s.empty? [{ url: r[:source] }] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row; end", "def row(row)\n Row.new(@data, row)\n end", "def colrow() @records.get_data(GRT_COLROW); end", "def row(index)\n end", "def render_row row\n if row == :separator\n separator\n else\n Y + row.map_with_index do |cell, i|\n render_cell(cell, row_to_index(...
[ "0.75999767", "0.6784493", "0.6782084", "0.6728905", "0.671557", "0.66666627", "0.6630663", "0.66092485", "0.65685964", "0.6545702", "0.65412277", "0.6392364", "0.6371714", "0.63497233", "0.6275184", "0.62088937", "0.6170038", "0.6162382", "0.6151706", "0.61235404", "0.610392...
0.0
-1
Can't know up front what these might be; take anything in the form identifier__xxx
def identifiers @r.keys.select { |k| k.to_s.start_with? 'identifier__' }.map do |k| { scheme: k.to_s.sub('identifier__', ''), identifier: @r.delete(k), } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identifier; end", "def identifier; end", "def identifiers; end", "def identifier_string\n name\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier\n name.gsub(/[^A-Za-z0-9_]/, '_')\n end", "def identifier_for identifier\n \"#{name.gsub(/^.*::...
[ "0.725983", "0.725983", "0.70416933", "0.6896587", "0.68238384", "0.68238384", "0.68140614", "0.67049605", "0.67049605", "0.6541334", "0.6499793", "0.6479945", "0.6435105", "0.6429728", "0.6429728", "0.6367907", "0.6309655", "0.6308294", "0.6308294", "0.6266114", "0.6229704",...
0.57082677
64
List the collaborators for the schema
def index @collaborators = @schema.user_schemas.map do |user_schema| { id: user_schema.user.id, username: user_schema.user.username, email: user_schema.user.email, image: user_schema.user.image, access_mode: user_schema.access_mode_integer } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def collaborators\n @collaborators ||= get(\"/repos/show/#{owner.login}/#{name}/collaborators\")['collaborators'] || []\n end", "def index\n @collaborators = Collaborator.all\n end", "def index\n @collaborators = Collaborator.all\n end", "def collaborators(app_env)\n app_setting_list('co...
[ "0.80011624", "0.74142283", "0.74142283", "0.7403674", "0.7403674", "0.73831755", "0.73479235", "0.7337613", "0.7332367", "0.73104155", "0.72943705", "0.72616184", "0.7249638", "0.7131179", "0.70864564", "0.69503236", "0.68667877", "0.6862623", "0.6848087", "0.6832862", "0.67...
0.75939614
1
TODO: change this behavior with a simple redirect
def resource_not_found flash.now.alert = "notifications.document.not_found" @info = { id: params[:id] } render "shared/html/404" and return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect?; end", "def redirects; end", "def redirect_ok; end", "def redirect_ok; end", "def redirect(location, status = '302'); request.redirect(location, status); end", "def redirect(url); end", "def redirect_internal() redirect_to \"/nothing\"; end", "def redirect_to(path)\n render(:status =...
[ "0.8000896", "0.7921914", "0.7793433", "0.7793433", "0.7765757", "0.7755194", "0.75381035", "0.73461646", "0.7274764", "0.725656", "0.7254717", "0.71883416", "0.7149953", "0.71362084", "0.70713466", "0.7019029", "0.7017108", "0.70099735", "0.70046496", "0.6972814", "0.6969307...
0.0
-1