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
checks if the native build needs to be run
def should_build? return true if tagged_build? return should_build_nightly? if ENV['IS_NIGHTLY'] # Find the oldest common revision between HEAD's parent and our # default branch. # # HEAD's parent may _be_ our default branch, or the commit before # `master` if we've forked to a branch off it. More than likely, # though, `HEAD^1` is some commit in our stream of history, and will # be sufficient to find the starting point of divergence, if such a # point exists. # # If HEAD is a merge commit on `master`, then HEAD^1 points to the # previous commit on `master`, which should clearly be completely # separate from the branch that was merged, and hence the fork point # will be the point of divergence. oldest_shared_revision = sh("git merge-base '#{DEFAULT_BRANCH}' 'HEAD^1'") # Get all files that changed between the fork point and HEAD changed_files = git_log_between(oldest_shared_revision, 'HEAD').unique_lines # 1. Check if any packages we care about changed if changed_files.include?('package.json') && npm_native_package_changed?(oldest_shared_revision, 'HEAD') puts "some dependency matching #{NPM_DEP_NAME_REGEXP.inspect} changed" return true end # 2. Check if any files we care about changed if native_file_changed?(changed_files) puts 'some native file changed' return true end # 3. If we haven't decided to build yet, we aren't going to. puts 'build skippable' false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_for_executable; end", "def docker_native?\n if File.exists?('/usr/bin/sw_vers')\n if File.exists?('/Applications/Docker.app')\n true\n else\n false\n end\n else\n true\n end\n end", "def build?\n engine == :ruby && %w(1.8.7 1.9.2).i...
[ "0.67207956", "0.6439664", "0.63988864", "0.6312485", "0.6301037", "0.6289372", "0.6285254", "0.62387115", "0.62135315", "0.6203367", "0.62025267", "0.6182479", "0.61533916", "0.6144292", "0.61287916", "0.6115152", "0.6097354", "0.6073401", "0.60713077", "0.6071044", "0.60679...
0.61060375
16
use to enable or disable Praise
def enabled=(value) return if @enabled == value if value install else uninstall end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable\n end", "def enable\n end", "def enable!\n @active = true\n change_status(:wait)\n end", "def enable!; end", "def enable_kills\n app.main_controller.instance_variable_get(:@kill_int_button).disable = false\n app.main_controller.instance_variable_get(:@kill_term_button).dis...
[ "0.5886118", "0.5860226", "0.57615167", "0.5745413", "0.5708256", "0.56865865", "0.5664157", "0.5655735", "0.5655735", "0.55865645", "0.5585943", "0.5566987", "0.5566987", "0.55506104", "0.5548123", "0.55184186", "0.5469198", "0.54687744", "0.54679805", "0.54679805", "0.54679...
0.0
-1
reload ignored form file
def reload @ignored = nil ignored end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reload\n load @filename\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload\n end", "def reload!\n clear_changes_information\n self.exclude_from_save = false\n end", "...
[ "0.6289485", "0.61798614", "0.61798614", "0.61798614", "0.61798614", "0.61798614", "0.61798614", "0.61798614", "0.6173918", "0.61703014", "0.61516386", "0.6144893", "0.6138145", "0.6129667", "0.6129667", "0.61105853", "0.61105853", "0.61105853", "0.61105853", "0.6052958", "0....
0.60172415
20
log `message` on `level`
def log(level, message) @outputter.call(level, message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_message( level, message )\n\n end", "def log level, message\n logger.send(level, name) { message }\n end", "def log level, message\n logger.send(level, name) { message }\n end", "def log(level, message)\n return if SimpleSsh.configuration.logger.nil?\n SimpleSsh.configu...
[ "0.844051", "0.8366102", "0.8366102", "0.81043214", "0.806796", "0.806796", "0.7959862", "0.79293513", "0.77755785", "0.7761443", "0.7757639", "0.7719082", "0.7686701", "0.7686701", "0.76571006", "0.7580317", "0.7562166", "0.7545355", "0.75312674", "0.75210243", "0.7481521", ...
0.7607165
15
debe recibir un parametro, si ese parametro es el string "Hola" el metodo debe mostrar en pantalla "Hola Mundo".
def saludar(saludo = 'Hola a todos') puts saludo == 'Hola' ? 'Hola Mundo' : saludo end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def saludo(parametro)\n\tif parametro == 'Hola'\n\t\tputs 'Hola Mundo'\n\telse\n\t\tputs ''\n\tend\nend", "def saludar (nombre='juan',apellido='castillo')\n puts \"Hola #{nombre} #{apellido}\"\nend", "def saluda_persona(nombre=\"humano\")\n puts \"Hola #{nombre}\"\nend", "def sayhello(name, last_name='...
[ "0.68577194", "0.6694957", "0.6667956", "0.6635841", "0.66268003", "0.65626526", "0.65626526", "0.6554874", "0.64943665", "0.64822626", "0.6319305", "0.62515026", "0.6159352", "0.61547995", "0.6080599", "0.6007303", "0.59726864", "0.5941459", "0.5937928", "0.5897781", "0.5881...
0.5985234
16
deprecated, use json_string_to_hash instead
def json_parse(string) json_string_to_hash(string) # if string.class == String && string == "null" # nil # else # JSON.parse(string, {:symbolize_names => true}) # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_hash(str)\n JSON.parse(str)\nend", "def to_hash( json )\n JSON.parse( json )\n end", "def json_to_hash(json_data)\n\t\treturn JSON.parse(json_data, :symbolize_names => true)\t\n\tend", "def convert_it_to_hash_format(object)\n JSON.parse(object)\n end", "def hash_for_json(state = T.un...
[ "0.790237", "0.7806135", "0.77488863", "0.7598989", "0.7373908", "0.7263256", "0.7121124", "0.70802444", "0.6905353", "0.68732464", "0.6871293", "0.6831739", "0.67630154", "0.67137355", "0.66952795", "0.6676199", "0.6644026", "0.6622984", "0.6622984", "0.6622984", "0.6622984"...
0.6168422
48
Get unique lock key to check if job should be added second time to queue
def lock_key(*arguments) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_key; Thread.current[:job_key]; end", "def good_job_concurrency_key\n @good_job_concurrency_key || _good_job_concurrency_key\n end", "def __object_lock_key\n @key ||= \"this.#{object_id}\".to_sym\n end", "def redis_lock_key(*args)\n ['lock', self.class.name, identifier(*args)].com...
[ "0.69409204", "0.67388386", "0.657398", "0.64882404", "0.646672", "0.64602697", "0.6362764", "0.634955", "0.6306912", "0.6248584", "0.6237912", "0.61957705", "0.61700106", "0.6136047", "0.61335117", "0.6128663", "0.6117547", "0.6117037", "0.6093793", "0.60778207", "0.60707635...
0.6319826
8
unique key, that ensures only one job of this type is running at once
def throttle_key(*arguments) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def job_key; Thread.current[:job_key]; end", "def good_job_concurrency_key\n @good_job_concurrency_key || _good_job_concurrency_key\n end", "def unique_key\n @unique_key ||= section.identifier\n end", "def _good_job_concurrency_key\n key = self.class.good_job_concurrency_config...
[ "0.72358185", "0.7059932", "0.6929185", "0.6750526", "0.6742526", "0.6603871", "0.6598569", "0.6436538", "0.6354097", "0.63082826", "0.6286076", "0.62856084", "0.61869097", "0.6186612", "0.61798203", "0.6169598", "0.6159236", "0.61321783", "0.6127696", "0.61213326", "0.609753...
0.0
-1
GET /sponsors GET /sponsors.json
def index @search = Sponsor.ransack(params[:q]) @sponsors = @search.result.order(created_at: :desc).page(params[:page]) @sponsor = Sponsor.new respond_to do |format| format.html format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sponsors = @event.sponsors\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end", "def index\n @sponsors = Sponsor.all\n end", "def new\n @sponsor = @event.sponsors.new\n\n respond_to do |format|\n format....
[ "0.7897971", "0.7600725", "0.6694456", "0.66697204", "0.6633926", "0.6425035", "0.6249384", "0.60073316", "0.5973056", "0.5941132", "0.5918902", "0.5904299", "0.5764287", "0.5762846", "0.5737908", "0.57138085", "0.57107335", "0.56274784", "0.5587224", "0.55475354", "0.5524012...
0.6291723
6
GET /sponsors/1 GET /sponsors/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @sponsors = @event.sponsors\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @sponsors }\n end\n end", "def index\n @sponsors = Sponsor.all\n end", "def new\n @sponsor = @event.sponsors.new\n\n respond_to do |format|\n format....
[ "0.7771098", "0.7469397", "0.6923951", "0.6783386", "0.6463336", "0.63769", "0.62524754", "0.6243026", "0.6228021", "0.60011744", "0.5955731", "0.59341604", "0.5913355", "0.586133", "0.58494014", "0.58013767", "0.5758051", "0.5738903", "0.5731868", "0.5723685", "0.5703961", ...
0.0
-1
PATCH/PUT /sponsors/1 PATCH/PUT /sponsors/1.json
def update respond_to do |format| if @sponsor.update(sponsor_params) format.html { redirect_to admin_sponsors_path, notice: 'El patrocinador fue Modificado' } format.json { render :show, status: :ok, location: @sponsor } else format.html { render :edit } format.json { render json: @sponsor.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n respond_to do |format|\n if @sponsor.update_attributes(params[:sponsor])\n format.html { redirect_to [:admin, @event, @sponsor], notice: 'Sponsor was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format...
[ "0.66992885", "0.6699122", "0.66084963", "0.66084963", "0.65204835", "0.6392438", "0.61902326", "0.6139477", "0.6133817", "0.61283666", "0.6118318", "0.60939556", "0.609107", "0.5976776", "0.59607095", "0.590127", "0.5871591", "0.58581257", "0.58420193", "0.5838714", "0.58371...
0.6694605
2
DELETE /sponsors/1 DELETE /sponsors/1.json
def destroy @sponsor.destroy respond_to do |format| format.html { redirect_to admin_sponsors_path, notice: 'El patrocinador fue eliminado.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sponsor = Sponsor.find(params[:id])\n @sponsor.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_event_sponsors_url(@event) }\n format.json { head :ok }\n end\n end", "def destroy\n @sponsor.destroy\n respond_to do |format|\n format.html { redir...
[ "0.7486954", "0.7232938", "0.7232938", "0.7156058", "0.7098775", "0.7026694", "0.6891828", "0.6731754", "0.6703138", "0.66814953", "0.6674573", "0.6662849", "0.66154087", "0.66002524", "0.6572301", "0.65665567", "0.6563214", "0.6551312", "0.65498877", "0.65476173", "0.6541859...
0.7358749
1
Use callbacks to share common setup or constraints between actions.
def set_sponsor @sponsor = Sponsor.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.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sponsor_params params.require(:sponsor).permit(:image, :status, :url, :name, :email) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
context for commas only
def test_for_various_length_inputs_for_commas assert_equal 10, @calculator.Add('10') assert_equal 20, @calculator.Add('10,10') assert_equal 30, @calculator.Add('10,10,10') assert_equal 101, @calculator.Add('1,0,0,0,100') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commas(num)\nend", "def expression\n comma\n end", "def comma_breakable\n text ','\n breakable\n end", "def comma_breakable\n text ','\n breakable\n end", "def separate_comma(number)\n\tnumber\nend", "def scan_comma_spaces; end", "def for_commas\n each_line! do ...
[ "0.6825735", "0.65405613", "0.6520981", "0.6520981", "0.6423939", "0.64022154", "0.63434917", "0.63200706", "0.6276532", "0.62526345", "0.6163166", "0.6154809", "0.6034082", "0.5975869", "0.594262", "0.5877791", "0.5865761", "0.58639956", "0.58524036", "0.5794851", "0.5757832...
0.0
-1
context for new lines only
def test_for_various_length_inputs_for_new_lines assert_equal 30, @calculator.Add("10\n10\n10") assert_equal 30, @calculator.Add("10\n5\n5\n10") assert_equal 30, @calculator.Add("15\n15") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_newline(p); end", "def newline; end", "def single_line?; end", "def normal_line(text)\n end", "def parse_line_break; end", "def break_to_newline\n end", "def process_new_line\n @status.line += 1\n\n @skip_next = true if ((@cur_char == \"\\n\" && @next_char == \"\\r\") ||\n ...
[ "0.7326274", "0.692802", "0.6722901", "0.6694085", "0.6603193", "0.66020054", "0.65726346", "0.6511017", "0.6496604", "0.6427581", "0.64219886", "0.64219886", "0.6407489", "0.6360297", "0.6351073", "0.6344791", "0.6326145", "0.63037497", "0.626729", "0.62340385", "0.62092644"...
0.55367494
96
context for new lines and commas mixed
def test_for_various_length_inputs_for_mixed_delimiters assert_equal 30, @calculator.Add("10,10\n10") assert_equal 30, @calculator.Add("5\n5\n5,5\n5,5") assert_equal 30, @calculator.Add("5\n5\n5,5,5\n5") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def substitute_new_lines_and_commas(contents)\n\t\t\tcontents.gsub(/[,+\\n+]+/, \"|\")\n\t\tend", "def csv_multi_replacements\n [\n [/\\n\\n/ , \"\\n\"]\n ]\n end", "def parse_line_break; end", "def on_newline(p); end", "def break_to_newline\n end", "def newline; end", "def normal_line(t...
[ "0.6814081", "0.6675207", "0.64629644", "0.629251", "0.6209959", "0.61882097", "0.6180833", "0.6159998", "0.61160135", "0.6013641", "0.59813726", "0.59737784", "0.59434015", "0.58603376", "0.58503586", "0.58503586", "0.57868576", "0.5781979", "0.574356", "0.5729172", "0.57132...
0.54926574
46
Allows for the option of not including global search if the default method found in the base page serializer is overridden.
def header_components [].tap do |components| components << header_link components << header_search if @include_global_search end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include_global_search\n true\n end", "def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end", "def override_search?(search_ui)\n respond_to?(override_search(search_ui))\n end", "def page_not_found # rubocop:disable Lint/UselessMethodDefinition\n ...
[ "0.64846987", "0.6227388", "0.6227388", "0.61121", "0.59488076", "0.59352976", "0.59332246", "0.58696854", "0.57698834", "0.57452357", "0.5709522", "0.564641", "0.5624828", "0.5551318", "0.5524448", "0.5489294", "0.54502296", "0.5442122", "0.5441259", "0.54172325", "0.5417232...
0.0
-1
I worked on this challenge [by myself, with: ] I spent [] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? an array, a minimum length for the array (integer), an optional value to pad with What is the output? (i.e. What should the code return?) a single array that has as many elements as the minimum size What are the steps needed to solve the problem? check if array has fewer elements than required if it does, create remaining elements with value given if it doesn't, return 1. Initial Solution
def pad!(array, min_size, value = nil) #destructive if array.length < min_size i = array.length while i < min_size array[i] = value i += 1 end end p array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad!(array, min_size, value = nil) #destructive\n solution_array = []\n if min_size <= array.length\n #p array\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n #p times_to_pad\n times_to_pad.times do\n solution_array <<...
[ "0.82422334", "0.8241422", "0.82215893", "0.82205844", "0.81667274", "0.8164943", "0.8136965", "0.8119332", "0.8113788", "0.8104493", "0.81017196", "0.8100384", "0.8090372", "0.8081957", "0.8081073", "0.80760133", "0.8067386", "0.8067114", "0.80666286", "0.80664426", "0.80643...
0.7863706
73
test_array = [1,2,3] p test_array pad!(test_array,5,"apple") p test_array
def pad(input_array, min_size, value = nil) #non-destructive array = [] input_array.each do |x| array << x end if array.length < min_size i = array.length while i < min_size array[i] = value i += 1 end end p array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_array(array, min_size, pad_with)\nend", "def pad!(array, min_size, value = nil) #destructive \n\tarray\nend", "def pad!(array, min_size, value = nil) #destructive\n \n if min_size <= array.length\n p array\n else \n p array << array + [value] * (min_size - array.length) \n end\nend", "def p...
[ "0.7965218", "0.7860522", "0.78113693", "0.7799031", "0.77328616", "0.7729469", "0.7670328", "0.7636135", "0.76224756", "0.76206905", "0.7617477", "0.76044875", "0.75996584", "0.75926054", "0.75913334", "0.75852114", "0.7574953", "0.7562505", "0.7547606", "0.7542947", "0.7540...
0.73109496
61
test_array = [1,2,3] p test_array pad(test_array,5,"apple") p test_array 3. Refactored Solution
def pad!(array, min_size, value = nil) #destructive while array.length < min_size array.push(value) end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad_array(array, min_size, pad_with)\nend", "def pad!(array, min_size, value = nil) #destructive \n\tarray\nend", "def pad!(array, min_size, value = nil) #destructive\n difference = min_size - array.length\n #array.length #the variable len = array.length\n if difference > 0\n # puts positive amount o...
[ "0.8112698", "0.78071845", "0.7782316", "0.77674204", "0.77542275", "0.77436656", "0.77400476", "0.7739057", "0.77331513", "0.7730724", "0.77189136", "0.7692394", "0.76884544", "0.76882005", "0.7666801", "0.7631689", "0.76208913", "0.7607866", "0.760713", "0.7595675", "0.7593...
0.7271499
80
Create a new Platform object, referencing the given metadata object.
def initialize(metadata) @metadata = metadata end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform(platform_id)\n Platform.new(platform_id, client)\n end", "def create(platform)\n @platform = Locomotive::Platform.new(platform)\n\n if @platform.save\n redirect resource(@platform), :message => {:notice => \"Platform was successfully created\"}\n else\n render :n...
[ "0.6372692", "0.608851", "0.6018928", "0.6010982", "0.5917097", "0.5902059", "0.58361286", "0.5695932", "0.5695932", "0.5695932", "0.5695932", "0.5695932", "0.5695932", "0.5516199", "0.548061", "0.5367416", "0.53227943", "0.5290767", "0.52264506", "0.51962984", "0.5169276", ...
0.47567713
55
Queries whether the current runtime is JRuby or not.
def jruby? BSON::Environment.jruby? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jruby?\n java? ? engine =~ /jruby/ : false\n end", "def jruby?\n RbConfig::CONFIG['ruby_install_name'] == 'jruby'\n end", "def jruby?\n return @jruby if defined?(@jruby)\n @jruby = RUBY_PLATFORM =~ /java/\n end", "def jruby?\n engine == :jruby\n end", "def j...
[ "0.8754076", "0.85487634", "0.8544695", "0.8504037", "0.84097266", "0.8379618", "0.83726513", "0.8355712", "0.83051324", "0.82687545", "0.82030314", "0.8139191", "0.8015152", "0.7539138", "0.73663574", "0.72997826", "0.71986187", "0.71636456", "0.68008053", "0.6699464", "0.65...
0.7991077
13
Returns the list of Ruby versions that identify this runtime.
def ruby_versions if jruby? [ "JRuby #{JRUBY_VERSION}", "like Ruby #{RUBY_VERSION}" ] else [ "Ruby #{RUBY_VERSION}" ] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def versions\n registered_versions.keys\n end", "def versions\n @versions ||= run( :versions, '--bare' ).lines.map( &:chomp )\n end", "def get_all_versions()\n return []\n end", "def distro_ruby_versions\n case distribution_class\n when :ubuntu\n if is_distribution?(\"<= artful\")\n ...
[ "0.6673721", "0.6565671", "0.648179", "0.63505", "0.6311518", "0.6301251", "0.6245455", "0.61942095", "0.61903447", "0.61878943", "0.61255383", "0.6121989", "0.6116392", "0.6116392", "0.6116392", "0.6071986", "0.6040692", "0.6028115", "0.600507", "0.6001326", "0.59930515", ...
0.77954715
0
Returns the list of platform identifiers that identify this runtime.
def platforms [ RUBY_PLATFORM ].tap do |list| list.push "JVM #{java_version}" if jruby? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platforms; platform_names; end", "def platform_types\n @platform_types.to_hash\n end", "def platform_list; ['all','xbox-360']; end", "def platform_types\n get(\"platform-types\")[\"types\"]\n end", "def platforms\n return @platforms\n end", "def platforms id\...
[ "0.7808012", "0.7394551", "0.7254495", "0.72391677", "0.7222617", "0.7195903", "0.7189037", "0.71175927", "0.7113003", "0.7071535", "0.69080365", "0.68121797", "0.6770824", "0.67594445", "0.6748072", "0.6627183", "0.6619644", "0.6593324", "0.6582229", "0.6500979", "0.64254063...
0.7160086
7
Returns the version of the current Java environment, or nil if not invoked with JRuby.
def java_version return nil unless jruby? java.lang.System.get_property('java.version') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def version\n Buildr.application.deprecated 'Use ENV_JAVA[\\'java.version\\'] instead.'\n Java.load\n ENV_JAVA['java.version']\n end", "def jruby_version\n @jruby_version ||= ::JRUBY_VERSION.split(\".\").map {|s| s.to_i}\n end", "def java_version\n ver_str = `java -version 2>&1 |...
[ "0.7611097", "0.73115087", "0.6994427", "0.6878904", "0.6659567", "0.663514", "0.6524456", "0.64823276", "0.6402396", "0.6386181", "0.6312943", "0.630734", "0.62524915", "0.62177455", "0.6214292", "0.61375284", "0.6070759", "0.6047638", "0.6045004", "0.6035349", "0.60341585",...
0.854205
0
Builds and returns the default platform list, for use when building the platform string.
def default_platform_list [ metadata.platform, *ruby_versions, *platforms, RbConfig::CONFIG['build'] ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platforms; platform_names; end", "def platform_list; ['all','xbox-360']; end", "def define_platforms\n [define_centos_5, define_centos_6, define_run_list]\n end", "def supported_platforms\n _platforms = {\n #\n # os: 'linux'\n # platform_family: 'debian'\n 'debian' => %w(jessie...
[ "0.7067875", "0.6914716", "0.68334097", "0.6747732", "0.6727186", "0.6585642", "0.65708375", "0.647974", "0.6386737", "0.6298047", "0.6155845", "0.61378545", "0.6128046", "0.6028143", "0.6028143", "0.6014596", "0.600311", "0.59979236", "0.59923255", "0.5988947", "0.5968455", ...
0.84037083
0
Returns a single letter representing the purpose reported to the metadata, or nil if no purpose was specified.
def purpose return nil unless metadata.purpose metadata.purpose.to_s[0].upcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def purpose(*purpose)\n purpose.any? ? @purpose = purpose[0] : @purpose\n end", "def purpose\n \"Intern seeking #{category_name.capitalize} position\"\n end", "def purpose\n labware.plate_purpose\n end", "def purpose\n end", "def getLoanPurposeObjName\r\n\t\t return \"mfiforce__lo...
[ "0.6849523", "0.6706642", "0.66445595", "0.64964724", "0.6330996", "0.62314504", "0.60031295", "0.59161246", "0.5914989", "0.5563955", "0.54949784", "0.5394759", "0.5310124", "0.5245058", "0.52398413", "0.5217709", "0.52114767", "0.51898915", "0.5168928", "0.51392365", "0.513...
0.8645299
0
Builds and returns the platform string by concatenating relevant values together.
def to_s primary = [ *default_platform_list, purpose ].compact.join(', ') list = [ primary ] metadata.wrapping_libraries&.each do |library| list << (library[:platform] || '') end list.join('|') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform_to_s\n\t\treturn ((platform.all?) ? [ \"All\" ] : platform.names).join(\", \")\n\tend", "def build_host_name\n if @platform.abs_resource_name\n @platform.abs_resource_name\n elsif @platform.vmpooler_template\n @platform.vmpooler_template\n else\n @plat...
[ "0.66989166", "0.651544", "0.651544", "0.6465276", "0.62575144", "0.6204397", "0.6202783", "0.619167", "0.6168178", "0.61062354", "0.61010283", "0.60312766", "0.6013197", "0.5963289", "0.5948233", "0.5939444", "0.5933911", "0.59334946", "0.59286773", "0.58923775", "0.587127",...
0.68353313
0
Get the workflow task that generated this subject, if any
def parent_workflow_task if ! (_classifications = parent_classifications.limit(1)).empty? _classifications.first.workflow_task end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def workflow\n return @workflow\n end", "def task\n return @task\n end", "def getWorkflowId()\n @workflowId\n end", "def workflow\n @workflow ||= Workflow.find(self.workflow_id)\n end", "def workflow_id\n self.decision_conte...
[ "0.69862026", "0.69096893", "0.6703652", "0.66280466", "0.6612654", "0.64296687", "0.63082534", "0.6265276", "0.62629265", "0.61524093", "0.6104026", "0.60532695", "0.6048428", "0.6038973", "0.59882355", "0.59882355", "0.59882355", "0.59882355", "0.59882355", "0.59882355", "0...
0.7347341
0
find all the classifications for subject where task_key == compleletion_assesment_task calculate the percetage vote for retirement (pvr) if pvr is equal or greater than retire_limit, set self.status == retired.
def check_flagged_bad_count if flagged_bad_count >= 3 self.bad! increment_parents_subject_count_by -1 if parent_subject end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_retire_by_vote\n assesment_classifications = classifications.where(task_key: \"completion_assessment_task\").count\n if assesment_classifications > 2\n percentage_for_retire = retire_count / assesment_classifications.to_f\n if percentage_for_retire >= workflow.retire_limit\n self.r...
[ "0.7070442", "0.51974744", "0.5130238", "0.49730983", "0.49481544", "0.48998922", "0.48843467", "0.48770016", "0.4817029", "0.4769961", "0.476683", "0.47558603", "0.47457266", "0.4740095", "0.47387534", "0.472417", "0.47127128", "0.47108403", "0.4705368", "0.47018558", "0.467...
0.0
-1
find all the classifications for subject where task_key == compleletion_assesment_task calculate the percetage vote for retirement (pvr) if pvr is equal or greater than retire_limit, set self.status == retired.
def check_retire_by_vote assesment_classifications = classifications.where(task_key: "completion_assessment_task").count if assesment_classifications > 2 percentage_for_retire = retire_count / assesment_classifications.to_f if percentage_for_retire >= workflow.retire_limit self.retire! increment_parents_subject_count_by -1 if parent_subject end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_retirement(matching_options_hash, matching_tags_hash)\n log(:info, \"Processing get_retirement...\", true)\n\n case matching_tags_hash[:environment]\n when 'dev'\n # retire in one week (in seconds) and warn 3 days prior\n matching_options_hash[:retirement] = 1.week.to_i\n matching_o...
[ "0.5197728", "0.5130845", "0.4973518", "0.49489677", "0.49007612", "0.48848683", "0.48781055", "0.4817507", "0.47698593", "0.47668827", "0.47562307", "0.47454324", "0.47403663", "0.47379136", "0.4725004", "0.47129908", "0.47116616", "0.47048464", "0.4702217", "0.46771088", "0...
0.70706356
0
copies the current params (or whatever is passed in as the 3rd arg) removes the field value from params[:f] removes the field if there are no more values in params[:f][field] removes additional params (page, id, etc..)
def remove_facet_params(field, item, source_params = params) field = item.field if item.respond_to? :field value = facet_value_for_facet_item(item) p = source_params.dup # need to dup the facet values too, # if the values aren't dup'd, then the values # from the session will get remove in the show view... p[:f] = (p[:f] || {}).dup p[:f][field] = (p[:f][field] || []).dup p.delete :page p.delete :id p.delete :counter p.delete :commit p[:f][field] = p[:f][field] - [value] p[:f].delete(field) if p[:f][field].size.zero? p end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_facet_params(field, item, source_params = params)\n if item.respond_to? :field\n field = item.field\n end\n\n value = facet_value_for_facet_item(item)\n\n p = source_params.dup\n # need to dup the facet values too,\n # if the values aren't dup'd, then the values\n # from the se...
[ "0.7331271", "0.73252034", "0.7275696", "0.7037358", "0.6751866", "0.62123775", "0.61679244", "0.6165412", "0.6155714", "0.6088148", "0.5962238", "0.5889109", "0.5889109", "0.5871617", "0.58577895", "0.5857361", "0.5838785", "0.57973385", "0.56080836", "0.5606141", "0.5582313...
0.7300762
2
This is getting deprecated from Blacklight
def get_solr_response_for_field_values(field, values, extra_controller_params = {}) # solr_response = query_solr(params, extra_controller_params.merge(solr_documents_by_field_values_params(field, values))) # # [solr_response, solr_response.documents] # Updated Blacklight 5.10.x version of this deprecated function... query = search_builder.with(params).merge(extra_controller_params).merge(solr_documents_by_field_values_params(field, values)) solr_response = repository.search(query) [solr_response, solr_response.documents] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def hidden_apis; end", "def refutal()\n end", "def internal; end", "def silence_deprecations; end", "def preflight; end", "def deprecated_key=(_arg0); end", "def deprecated?\n false\n end", "def disabled_warnings; end", "def custom; end", "def custom; end", ...
[ "0.69195503", "0.6284982", "0.6169359", "0.6083879", "0.6050698", "0.60129887", "0.59706897", "0.5964684", "0.59489566", "0.59330773", "0.59330773", "0.5927391", "0.5926034", "0.5913971", "0.58953613", "0.5891193", "0.5862656", "0.58552355", "0.5852071", "0.58447057", "0.5843...
0.0
-1
GET /creaditcharges GET /creaditcharges.json
def index @creaditcharges = Creaditcharge.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to_s, req)\n WebPay::ChargeResponse.new(raw_response)\n end", "def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb...
[ "0.68474144", "0.6787908", "0.67821413", "0.65633386", "0.6550336", "0.65486026", "0.6517184", "0.6471022", "0.6450304", "0.6439945", "0.6438777", "0.63707256", "0.63629395", "0.62671876", "0.6179724", "0.616128", "0.61558145", "0.6136453", "0.6107472", "0.61019593", "0.60741...
0.6969908
0
GET /creaditcharges/1 GET /creaditcharges/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @charges = Charge.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @charges }\n end\n end", "def retrieve(params = {})\n req = WebPay::ChargeIdRequest.create(params)\n raw_response = @client._request(:get, 'charges' + '/' + req.id.to...
[ "0.7094665", "0.7031654", "0.6878673", "0.6842508", "0.6665254", "0.65680677", "0.65438056", "0.65418464", "0.65210986", "0.64888316", "0.6346419", "0.63324857", "0.6318991", "0.6316316", "0.63021123", "0.623985", "0.6214658", "0.6169272", "0.61314636", "0.61299443", "0.60972...
0.0
-1
POST /creaditcharges POST /creaditcharges.json
def create @creaditcharge = Creaditcharge.new(creaditcharge_params) respond_to do |format| if @creaditcharge.save format.html { redirect_to @creaditcharge, notice: 'Creaditcharge was successfully created.' } format.json { render :show, status: :created, location: @creaditcharge } else format.html { render :new } format.json { render json: @creaditcharge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def creaditcharge_params\n params.require(:creaditcharge).permit(:paid, :amount, :currency, :refunded)\n end", "def charge(attrs = {})\n post :charges, {}, attrs.to_xml(:root => :charge)\n end", "def post\n begin\n charge = Stripe::Charge.create({\n amount: params[:amount],\n ...
[ "0.68597627", "0.678337", "0.6619061", "0.6291422", "0.6286074", "0.6161494", "0.6134823", "0.6122625", "0.6118402", "0.61121213", "0.6097126", "0.609393", "0.6076844", "0.6063514", "0.60321057", "0.60304636", "0.5988227", "0.59835064", "0.59649205", "0.59602565", "0.5955334"...
0.67258185
2
PATCH/PUT /creaditcharges/1 PATCH/PUT /creaditcharges/1.json
def update respond_to do |format| if @creaditcharge.update(creaditcharge_params) format.html { redirect_to @creaditcharge, notice: 'Creaditcharge was successfully updated.' } format.json { render :show, status: :ok, location: @creaditcharge } else format.html { render :edit } format.json { render json: @creaditcharge.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entit...
[ "0.653131", "0.65000826", "0.6381857", "0.63733256", "0.6289832", "0.6289832", "0.6269988", "0.6198011", "0.6189383", "0.6157264", "0.6150978", "0.6144245", "0.611406", "0.6093485", "0.6090848", "0.60900676", "0.60877305", "0.60829055", "0.6060505", "0.6060308", "0.60554236",...
0.6562952
0
DELETE /creaditcharges/1 DELETE /creaditcharges/1.json
def destroy @creaditcharge.destroy respond_to do |format| format.html { redirect_to creaditcharges_url, notice: 'Creaditcharge was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @charge = Charge.find(params[:id])\n @charge.destroy\n\n respond_to do |format|\n format.html { redirect_to charges_url }\n format.json { head :no_content }\n end\n end", ...
[ "0.7224342", "0.7042915", "0.69786894", "0.69567543", "0.68959296", "0.6850214", "0.681102", "0.676899", "0.6760949", "0.6760949", "0.6760949", "0.6758837", "0.67526203", "0.6750132", "0.6736442", "0.66947174", "0.66944146", "0.6681081", "0.6636408", "0.66334873", "0.6598522"...
0.7178447
1
Use callbacks to share common setup or constraints between actions.
def set_creaditcharge @creaditcharge = Creaditcharge.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def creaditcharge_params params.require(:creaditcharge).permit(:paid, :amount, :currency, :refunded) 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.69811666", "0.6782836", "0.6747644", "0.6742015", "0.6735273", "0.6593917", "0.65037674", "0.6498627", "0.6482372", "0.64795715", "0.64566946", "0.6439213", "0.6380714", "0.6378147", "0.63657266", "0.63206697", "0.6300169", "0.62992156", "0.6295538", "0.62943023", "0.62915...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_productcategory @productcategory = Productcategory.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def productcategory_params params.require(:productcategory).permit(:product_id, :category_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69485277", "0.6813547", "0.6799911", "0.6796169", "0.6745757", "0.6741778", "0.6527065", "0.65204644", "0.64925444", "0.64314413", "0.64314413", "0.64314413", "0.6398711", "0.6355623", "0.6355327", "0.6345812", "0.6343951", "0.6338371", "0.6327366", "0.6327366", "0.6327366...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_supplier @supplier = Supplier.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.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def supplier_params params.require(:supplier).permit(:name, :address, :contact_person, :phone, :business_field, :management_system) 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.69811666", "0.6782836", "0.6747644", "0.6742015", "0.6735273", "0.6593917", "0.65037674", "0.6498627", "0.6482372", "0.64795715", "0.64566946", "0.6439213", "0.6380714", "0.6378147", "0.63657266", "0.63206697", "0.6300169", "0.62992156", "0.6295538", "0.62943023", "0.62915...
0.0
-1
Iterates through all pages and writes them to disk
def compile(target_path:) target_path = Pathname.new(target_path) mkdir_p target_path root = Pathname.new("/") cache_resources = @site.cache_resources @stdout.puts "Compiling #{@site.root_path.expand_path}" begin @site.cache_resources = true @site.resources.each do |resource| derooted = Pathname.new(resource.request_path).relative_path_from(root) path = target_path.join(derooted) mkdir_p path.dirname @stdout.puts " #{path}" File.open(path.expand_path, "w"){ |f| f.write render(resource) } end @stdout.puts "Successful compilation to #{target_path.expand_path}" ensure @site.cache_resources = cache_resources end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_pages\n Dir.foreach(@site_path) do |file|\n if file =~ /(\\w+)\\.page/\n path = File.join(@site_path, file)\n\n File.open(File.join(@site_path, \"#{$1}.html\"), 'w') do |f|\n f << generate_page(parse_page(path))\n end\n\n @log.debug(\" generated a page fro...
[ "0.7271941", "0.7140219", "0.70202434", "0.6874709", "0.68125105", "0.6777442", "0.6641574", "0.6519109", "0.6461862", "0.6455044", "0.6442109", "0.6425419", "0.63988715", "0.6389866", "0.6298207", "0.6272771", "0.6267969", "0.62410384", "0.6235346", "0.6229425", "0.6214663",...
0.0
-1
get nodes and edges information to render graph
def get_graph(job_id, opts = {}) job = get(job_id) history = get_execution_history(job_id, {})[0] hashed_job = { :job_id => job.job_id, :history => history, :depth => 0 }.merge(job.attributes) # set self node nodes = {job_id => hashed_job} edges = [] _set_dependency( :producers, opts[:producer_depth], nodes, edges, hashed_job ) _set_dependency( :consumers, opts[:consumer_depth], nodes, edges, hashed_job ) return {:nodes => nodes, :edges => edges} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nodes\n @object.edge_nodes\n end", "def nodes\n vertices\n end", "def nodes\n @pathway.graph.keys\n end", "def nodes; end", "def nodes; end", "def nodes; end", "def generate_graph\n end", "def graph_to_s\n string = \"\"\n @nodes.each do |name, node...
[ "0.7208687", "0.68886274", "0.6810669", "0.66654867", "0.66654867", "0.66654867", "0.6591602", "0.65633494", "0.6523224", "0.6521768", "0.6387311", "0.6353948", "0.6353948", "0.63392997", "0.6335708", "0.63048893", "0.6260461", "0.6250723", "0.6244331", "0.6224498", "0.622449...
0.0
-1
get dependency and set nodes and edges
def _set_dependency(direction, depth, nodes, edges, base_job) return if nodes[base_job[:job_id]][:depth] == depth base_job[direction].map{|depend_job| job = get(depend_job[:job_id]) history = get_execution_history(depend_job[:job_id], {})[0] hashed_job = { :job_id => job.job_id, :history => history, :depth => base_job[:depth] + 1 }.merge(job.attributes) nodes[job.job_id] = hashed_job if direction == :producers edges.push([job.job_id, base_job[:job_id]]) else edges.push([base_job[:job_id], job.job_id]) end # call recursively _set_dependency( direction, depth, nodes, edges, hashed_job ) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependency(start, vertex, nested = T.unsafe(nil)); end", "def resolve_dependencies\r\n @nodes.each do |node|\r\n puts \"processing #{node}\"\r\n\r\n node.outgoing_dependencies do |dependency|\r\n providers = nodes_satisfying(dependency.target)\r\n node.add_depen...
[ "0.61846226", "0.6176606", "0.60392344", "0.6008464", "0.5998792", "0.5943021", "0.58429444", "0.578868", "0.5779504", "0.57791716", "0.57791716", "0.57791716", "0.57522964", "0.574916", "0.5709424", "0.5709424", "0.57001966", "0.5696743", "0.5676362", "0.5676362", "0.56667",...
0.6385056
0
private not thread safe. should be locked around invocation
def _check_and_set_state(job_id, update_id, prev_state, post_state) return false unless @job_states[prev_state].include?(job_id) return false unless @jobs[job_id].update_id == update_id _set_state(job_id, post_state) return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def lock; end", "def lock; end", "def lock; end", "def executor; end", "def executor; end", "def executor; end", "def pausable; end", "def internal; end", "def thread()\n #This is a stub, used for indexing\n end", "def locked; end", "def thread; end", "...
[ "0.7419714", "0.6632743", "0.6632743", "0.6632743", "0.6375266", "0.6375266", "0.6375266", "0.63652354", "0.6244186", "0.61460656", "0.6138421", "0.6071038", "0.6071038", "0.6071038", "0.6045661", "0.60442585", "0.5996566", "0.5996566", "0.5996566", "0.5996566", "0.5996566", ...
0.0
-1
Mixes up the characters in a word except for the first and last ones.
def typoglycemiaWord(input) if input.length <= 3 input end letters = input.chars last = letters.pop first = letters.shift letters.shuffle! letters << first letters.rotate!(-1) letters << last letters.join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unite_words\n _, a_rest, a_word = %r{^(.* )?(\\w+)$}.match(a.text).to_a # a ends with word character\n _, b_word, b_rest = %r{^(\\w+\\s*)(.* )?$}.match(b.text).to_a # b starts with word character\n\n if a_word && b_word\n if a_word.length > b_word.length\n shift_backward(b_word)\...
[ "0.64808816", "0.6363401", "0.63504624", "0.6344132", "0.6234084", "0.6224055", "0.6224055", "0.6224055", "0.6224055", "0.6222031", "0.6221947", "0.61825705", "0.6147128", "0.61426955", "0.6084361", "0.6081411", "0.6020728", "0.59959984", "0.5987829", "0.5978595", "0.5971939"...
0.5761181
52
Runs typoglycemia on an entire sentence or paragraph of text by running it on each word and joining them all together
def typoglycemiaSentence(input) words = input.split(' ') words.map! { |x| typoglycemiaWord(x) } words.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def mltify_text text\n \n coder = HTMLEntities.new\n text = coder.decode text\n text = sanitize( text, okTags = \"\" )\n text = coder.encode text\n words = text.downcase.gsub( /[^A-za-z0-9\\s'\\-#]/...
[ "0.6258809", "0.6247616", "0.61224264", "0.6042626", "0.6038239", "0.5992348", "0.5986227", "0.5947738", "0.5947631", "0.5933149", "0.5932843", "0.5906505", "0.5906505", "0.58938813", "0.5893531", "0.5886432", "0.5878875", "0.58778787", "0.5873707", "0.58725613", "0.5857069",...
0.73533756
0
Subject can be set in your I18n file at config/locales/en.yml with the following lookup: en.challenge_mailer.new_support.subject
def new_support(challenge, supporter) @challenge = challenge @supporter = supporter mail(to: 'ferblape@gmail.com', subject: "New supporter created in challenge #{challenge.title}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatted_subject(text)\n name = PersonMailer.global_prefs.app_name\n label = name.blank? ? \"\" : \"[#{name}] \"\n \"#{label}#{text}\"\n end", "def subject\n self['subject'] || msg['subject']\n end", "def translate(mapping, key)\n I18n.t(:\"#{mapping.name}_subject\", :scope => [:d...
[ "0.6963972", "0.6961355", "0.68393034", "0.6777167", "0.6767181", "0.6756556", "0.66986144", "0.66853267", "0.6684056", "0.6660923", "0.66379845", "0.6636136", "0.6558609", "0.6551749", "0.65315884", "0.65310293", "0.6484057", "0.64699394", "0.6469322", "0.64608634", "0.64261...
0.0
-1
Assume you have a method isSubstring which checks if one word is a substring of another. Given two strings, s1 and s2, write code to check if s2 is a rotation of s1 using only one call to isSubstring (e.g. "waterbottle" is a rotation of "erbottlewat") Example
def string_rotation(str1, str2) arr1 = str1.split('') str1.length.times do |i| return true if arr1.unshift(arr1.pop).join == str2 end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isSubstring (s1, s2)\n return false unless s1.length == s2.length\n return true if s1 == s2\n s1_chars = s1.chars\n s2_chars = s2.chars\n\n i = 0\n while i < s1.length\n return true if s1_chars == s2.chars\n s1_chars.rotate!\n i += 1\n end\n false\nend", "def rotations?(string1, string2)\n ...
[ "0.8528898", "0.83292115", "0.8256356", "0.812214", "0.7971419", "0.76668984", "0.76668584", "0.7644801", "0.75578666", "0.74867827", "0.74769986", "0.7447758", "0.74141884", "0.7392098", "0.73602307", "0.73011917", "0.7049234", "0.70454127", "0.6990259", "0.6984406", "0.6973...
0.6872902
21
parse takes xml, either a document or a string and returns a parsed document. Since libxmlruby doesn't build a parse tree dynamically this is needed more than you would think. parse xml parse returns a parsed xml document
def parse(xml) document = make_document(xml) Atom::XML::Parser.document(document).parse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse xml\n begin\n output = Crack::XML.parse xml\n rescue Exception => e\n puts \"Exception parsing message #{e.message}\"\n return {}\n end\n end", "def parse(xml, parse_ext = false)\n if @external\n @tree = @document.createDocumentFragment\n el...
[ "0.6962447", "0.69230807", "0.6767429", "0.667164", "0.66603583", "0.66473675", "0.65253913", "0.6495687", "0.6476935", "0.64350337", "0.6315912", "0.6310409", "0.6297224", "0.62738615", "0.6218872", "0.61657906", "0.6144085", "0.6126145", "0.60890985", "0.607798", "0.6076322...
0.6514626
7
make_document takes either an xml document or a string and generates an xml document. make_document xml make_document returns an xml document.
def make_document(xml) xml.is_a?(Atom::XML::Document) ? xml : Atom::XML::Document.string(xml) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_document(xml)\n begin\n REXML::Document.new(xml) \n rescue REXML::ParseException\n # nil\n end \nend", "def xml_document(obj)\n case obj\n when XML::Document\n XML::Document.document(obj)\n else\n XML::Document.new('1.0')\n end\n end", "def create_do...
[ "0.68671405", "0.62896913", "0.6222105", "0.6101195", "0.60404855", "0.60394347", "0.6036842", "0.5981869", "0.5976448", "0.59676236", "0.5873593", "0.5855285", "0.5812573", "0.5749928", "0.570293", "0.5687029", "0.5663718", "0.5659624", "0.56470346", "0.5643663", "0.56248665...
0.7492961
0
new_empty_doc creates an empty LibXML::XML::Document new_empty_doc new_empty_doc returns a LibXML::XML::Document without any nodes.
def new_empty_doc Atom::XML::Document.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_doc\n @doc_content = \"\"\n @doc_start_page = nil\n @pages_in_doc = 0\n end", "def test_empty_string_returns_empty_doc\n doc = Nokogiri::HTML4(\"\")\n assert_instance_of(Nokogiri::HTML4::Document, doc)\n assert_nil(doc.root)\n end", "def start_document\n ...
[ "0.65579975", "0.63963425", "0.62460035", "0.6197546", "0.59919155", "0.5898277", "0.57229066", "0.56420135", "0.5606279", "0.5603064", "0.553305", "0.5493161", "0.54083884", "0.53468126", "0.53070456", "0.53070456", "0.5304408", "0.52900434", "0.52696574", "0.5263902", "0.52...
0.826931
0
find_and_update updates the values for the specified attributes on the node specified by the given xpath value. It is ill behaved and will change any matching attributes in any node returned using the given xpath. find_and_update takes an xpath value and a hash of attribute names with current and new value pairs. find_and_update '/apps:nickname', name: ['Bob', 'Tom']
def find_and_update(xpath, attributes) @doc.find(xpath).each do |node| if node_match?(node, attributes) attributes.each_key do |attrib| node.attributes[attrib.to_s] = attributes[attrib][1] end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_and_update_attributes(id, attr)\n object = find(id)\n object.update_attributes( attr ) if object\n end", "def find_and_update_atomically(id, attrs, opts = {})\n find_and_save_atomically(id, opts) {|r| r.assign_attributes attrs }\n end", "def update_attribute(attr_name, att...
[ "0.58149326", "0.5417441", "0.54005194", "0.53535706", "0.5161297", "0.51509595", "0.50808", "0.5049097", "0.501834", "0.501834", "0.500629", "0.4994027", "0.49870127", "0.4981046", "0.49764407", "0.49760187", "0.49756983", "0.4961054", "0.4961054", "0.49476373", "0.4921005",...
0.73446804
0
Sets instance variables in the current object based on values found in the XML document and the mapping specified in GoogleApps::Atom::MAPS
def set_instances(intersect, node) intersect.each do |attribute| instance_variable_set "@#{@map[attribute]}", check_value(node.attributes[attribute]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_map(mapfile)\n mapfile = File.join(\"lib\", \"adventure\", \"data\", mapfile)\n xml = Document.new(File.open(mapfile))\n @@name = xml.root.attributes[\"name\"]\n\n xml.elements.each(\"Map/variable\") do |e|\n tmp = e.attributes[\"value\"].split(/\\|/)\n case e.attributes[\"name\"]\n ...
[ "0.61590207", "0.59943783", "0.5927149", "0.5861682", "0.5805232", "0.5793589", "0.5791372", "0.5650071", "0.55879885", "0.5524786", "0.54949343", "0.54949343", "0.54949343", "0.54949343", "0.54949343", "0.54949343", "0.5447912", "0.5444892", "0.5417493", "0.54043853", "0.539...
0.49362037
53
Sets instance variables for property list type documents.
def attrs_from_props @doc.find('//apps:property').each do |entry| prop_name = entry.attributes['name'].to_sym if @map.keys.include?(prop_name) instance_variable_set "@#{@map[prop_name]}", check_value(entry.attributes['value']) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_properties(params)\n # Ignore if no args were passed.\n return -1 if params.empty?\n\n # List of valid input parameters.\n valid = {\n title: 1,\n subject: 1,\n author: 1,\n keywords: 1,\n comments: 1,\n last_...
[ "0.5902795", "0.5877296", "0.5855772", "0.5810769", "0.57830334", "0.57629013", "0.5752628", "0.56942147", "0.5674503", "0.5672222", "0.56173396", "0.5605927", "0.5605927", "0.5591829", "0.5591829", "0.55755544", "0.5562632", "0.5555559", "0.55390286", "0.5526098", "0.5521839...
0.0
-1
build_root creates the shared root structure for the document. build_root build_root returns an atom:entry node with an apps:category element appropriate for the document type.
def build_root(type) root = create_node(type: 'atom:entry') add_namespaces root, determine_namespaces(type) root << create_node(type: 'apps:category', attrs: Atom::CATEGORY[type.to_sym]) if Atom::CATEGORY[type.to_sym] root end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_root\n root << document_properties = XML::Node.new('DocumentProperties')\n document_properties['xmlns'] = 'urn:schemas-microsoft-com:office:office'\n\n document_properties << author = XML::Node.new('Author')\n author << 'Scarlet'\n document_properties << last_author = X...
[ "0.62314004", "0.6229209", "0.6050897", "0.599744", "0.5760172", "0.5634422", "0.5582986", "0.55789614", "0.5556382", "0.552561", "0.55154186", "0.5473402", "0.5443346", "0.540318", "0.5384135", "0.5371816", "0.5368832", "0.5327625", "0.5306193", "0.5283486", "0.52818537", ...
0.7834707
0
type_to_s returns the current document's type as a string. type_to_s type_to_s returns a string
def type_to_s self.class.to_s.split(':').last.downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n type\n end", "def to_s(type = 'full')\n case type.to_s\n when \"full\"\n self.document_file_name\n when \"foldername\"\n self.documentable_type.pluralize.downcase\n when \"subject\"\n \"#{self.class.to_s}: #{self.document_file_name}\"\n else\n ...
[ "0.7771513", "0.77626246", "0.749189", "0.7449742", "0.73681444", "0.7343448", "0.72930974", "0.7230167", "0.71018845", "0.70565414", "0.69397587", "0.6937772", "0.6902353", "0.6840066", "0.6837423", "0.6828992", "0.67714906", "0.6760692", "0.6664054", "0.6658267", "0.6640057...
0.69475776
10
type_to_sym returns the current document's type as a symbol. type_to_sym type_to_sym returns a symbol
def type_to_sym type_to_s.to_sym end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_as_symbol\n underscore(self.type).intern\n end", "def coerce_type_to_symbol\n @type = @type.to_sym\n end", "def type\n read_attr :type, :to_sym\n end", "def pbt_type_sym\n self.class.pbt_type_sym\n end", "def get_coerce_type_symbol( typ )\n \n case typ\n\n ...
[ "0.74362713", "0.74026674", "0.694641", "0.6722784", "0.6694686", "0.6675578", "0.6531417", "0.6508885", "0.6354857", "0.6347347", "0.63173664", "0.63035417", "0.6295631", "0.62892336", "0.6287243", "0.62815654", "0.62562805", "0.6242247", "0.623022", "0.6199843", "0.6197832"...
0.8004209
0
determine_namespaces builds a hash of namespace key/value pairs. determine_namespaces determine_namespaces returns a hash
def determine_namespaces(type) ns = { atom: Atom::NAMESPACES[:atom], apps: Atom::NAMESPACES[:apps] } case type.to_s when 'group', 'groupmember' ns[:gd] = Atom::NAMESPACES[:gd] end ns end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace_hash\n opt = {}\n namespaces.each do |type, attrs|\n key = \"xmlns:#{attrs[:key]}\"\n opt[key] = attrs[:value]\n end\n opt\n end", "def collect_namespaces\n # TODO: print warning message if a prefix refers to more than one URI in the document?\n ns...
[ "0.7163578", "0.7133806", "0.70950323", "0.6944123", "0.69402647", "0.69267356", "0.6836421", "0.67960453", "0.6723523", "0.66986066", "0.66443133", "0.6597831", "0.65607876", "0.6507967", "0.6507967", "0.65069926", "0.6390293", "0.6331829", "0.63171434", "0.6122446", "0.6122...
0.62311393
19
Delete a node from the document
def delete_node(xpath, attrs) @doc.find(xpath).each do |node| node.remove! if node_match?(node, attrs) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(node)\n remove_node(node)\n end", "def delete_node\n node.destroy if node\n end", "def delete_node\n delete(@nodename)\n end", "def delete_node(current_node)\n\nend", "def delete\n self.class.fire_event(NodeDeletedEvent.new(self))\n relations.each {|r| r.delete}\n ...
[ "0.8338023", "0.81512195", "0.78847295", "0.7527259", "0.7292093", "0.7204217", "0.70525694", "0.70504326", "0.70134634", "0.69980663", "0.69712687", "0.69136554", "0.69066185", "0.68716717", "0.684897", "0.68325454", "0.679226", "0.6774351", "0.6766485", "0.6741264", "0.6729...
0.7499514
4
changes each character in string to a letter 13 places down the alphabet
def rot13(secret_messages) secret_messages.map { |char| char.tr("a-z", "n-za-m") } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rot13(string)\n string.split('').inject('') { |text, char|\n text << case char\n when 'a'..'m', 'A'..'M'\n char.ord + 13\n when 'n'..'z', 'N'..'Z'\n char.ord - 13\n else\n char.ord\n end\n }\nend", "def rot13(str)\n str.each_char.map ...
[ "0.7682257", "0.75946575", "0.7488173", "0.74520904", "0.74158835", "0.72483027", "0.7238474", "0.72336066", "0.72098523", "0.7208321", "0.7197818", "0.71886826", "0.71768147", "0.7151545", "0.71468", "0.7138483", "0.71350133", "0.7125171", "0.71204346", "0.7104679", "0.70261...
0.0
-1
Sum of two lowest positive integers
def sum_two_smallest_numbers(numbers) numbers.min(2).reduce(:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_two_smallest_numbers(numbers)\n #Your code here\n numbers.select(&:positive?).min(2).reduce(:+)\nend", "def sum_two_smallest_nums(arr)\n\tpositive_arr = arr.select{|a| a >= 0}\n\tpositive_arr = positive_arr.sort\n\tc = positive_arr[0] + positive_arr[1]\n\treturn c\nend", "def sum_of_two_smallest_numbe...
[ "0.7789054", "0.7624649", "0.7391187", "0.7279128", "0.7110758", "0.71062297", "0.70723486", "0.703417", "0.70341206", "0.69792944", "0.6977603", "0.69624066", "0.69588983", "0.6932546", "0.69151044", "0.6910874", "0.6910826", "0.6882831", "0.68338704", "0.6828157", "0.682284...
0.7739816
1
Equal Sides of an Array
def find_even_index(arr) arr.length.times do |i| if arr[0...i].reduce(0, :+) == arr[i+1..-1].reduce(0, :+) return i end end -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def symmetrical?(arr)\n\nend", "def equalizeArray(arr)\n arr = arr.sort\n count = 0; j = 0\n for i in 0..(arr.length-1)\n if arr[j] != arr[i]\n j += 1\n count+=1\n end\n end\n count\nend", "def odd_occurances_in_array(a)\n res = 0\n a.each { |el| res ^= el }...
[ "0.6368728", "0.6224216", "0.6184038", "0.6178402", "0.6173576", "0.6152689", "0.6066188", "0.6048418", "0.6029682", "0.60149837", "0.6013308", "0.6013002", "0.5984805", "0.5967611", "0.5956722", "0.5949285", "0.59435433", "0.5941515", "0.5941313", "0.5918018", "0.5918001", ...
0.0
-1
Is n divisble by x and y?
def is_divisible(n,x,y) (n % x == 0) && (n % y == 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_divisible(n,x,y)\r\n (n%x == 0 && n%y == 0) ? 1==1 : 1==2\r\nend", "def is_divisible(n,x,y)\n #divide n by x\n #if that equals 0, try dividing it by y\n #if that also equals 0, then n is divisible by both numbers\n #else, it is not\n if try_with_x(n,x) && try_with_y(n,y)\n true\n else\n fals...
[ "0.7946846", "0.77634096", "0.7149214", "0.71420753", "0.71186554", "0.7031989", "0.69453657", "0.6928651", "0.6924363", "0.68289566", "0.6794958", "0.67907184", "0.67291814", "0.6716217", "0.667511", "0.66568595", "0.66447", "0.6641983", "0.6619746", "0.6615986", "0.6615807"...
0.7848058
1
Count the smiley faces
def count_smileys(arr) arr.count { |face| face =~ /(:|;){1}(-|~)?(\)|D)/ } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countSmileys(faces)\n valid_eyes = [':', ';']\n valid_nose = ['-', '~']\n valid_mouth = [')', 'D']\n\n counter = 0\n faces.each do |face|\n case face.size\n when 2\n if valid_eyes.include?(face[0]) &&\n valid_mouth.include?(face[1])\n counter += 1\n end\n when 3\n ...
[ "0.7683224", "0.74753475", "0.6867545", "0.6489354", "0.6458108", "0.6407486", "0.63969547", "0.6374563", "0.6338211", "0.6328656", "0.6327744", "0.6296098", "0.6245706", "0.6228712", "0.62022245", "0.6197879", "0.61835027", "0.6178155", "0.61637974", "0.61497617", "0.6128307...
0.73141956
2
Get the middle character
def get_middle(s) s.length.even? ? s[s.length/2 -1] + s[s.length/2] : s[s.length/2] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middle_character(string)\n array = string.split('')\n middle_char = ''\n middle_index = (array.size / 2.0).floor\n if array.size.odd?\n middle_char << array[middle_index]\n else\n middle_char << array[middle_index - 1] << array[middle_index]\n end\n middle_char\nend", "def middle_character(strin...
[ "0.8035538", "0.7970134", "0.7781633", "0.76355195", "0.75832415", "0.74290675", "0.7281345", "0.7259344", "0.72097236", "0.71949893", "0.7144517", "0.7130304", "0.7128191", "0.71239036", "0.7117018", "0.70768374", "0.70768374", "0.70606315", "0.7059919", "0.70337546", "0.702...
0.697437
22
The highest profit wins!
def min_max(lst) lst.minmax end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def best_offense\n @teams.max_by { |team| team.average_goals_scored }.team_name\n end", "def franchise_with_highest_profit\n company = get_company\n no_franchises(company)\n big_earner = company.franchises.max_by { |franchise| franchise.profit }\n puts \"Franchise #{big_earner.id} has the highest...
[ "0.73571384", "0.72975695", "0.7276422", "0.72590905", "0.72165793", "0.71791214", "0.70726186", "0.7065986", "0.7054975", "0.7054772", "0.70411414", "0.7022347", "0.70089257", "0.70005906", "0.6957923", "0.69341457", "0.6931644", "0.6921636", "0.69183016", "0.6904792", "0.68...
0.0
-1
Sum of a sequence
def sequence_sum(begin_number, end_number, step) (begin_number..end_number).step(step).sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sequence_sum\n reduce(:+)\n end", "def sumSeq(sSeq)\n sum = 0\n sSeq.each { |value| sum += value}\n return sum\n end", "def sum_of_sequence(begin_number, end_number, step)\n begin_number.step(end_number, step).reduce(0, :+)\nend", "def sum_of_sums(array)\n sequence_total = 0\n sum = 0\n...
[ "0.8676226", "0.83296335", "0.79506046", "0.7476241", "0.74440247", "0.7404009", "0.7353744", "0.73164517", "0.72966045", "0.7230903", "0.7220676", "0.7198648", "0.71880096", "0.7173932", "0.71523446", "0.7108958", "0.7093718", "0.70923", "0.7090392", "0.7043063", "0.704012",...
0.7471083
4
Count characters in your string
def count_chars(s) count = Hash.new(0) s.split("").each do |x| count[x] += 1 end count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def character_count(str)\n str.length\n end", "def count_chars (string)\n string.length\nend", "def count_characters(string)\n string.split.join.size\nend", "def char_count(s,c)\n\t\tcont = 0\n\t\ts.length.times do |i|\n\t\t\tif(s[i] == c)\n\t\t\t\tcont += 1\n\t\t\tend\n\t\tend\n\t\tcont\n\tend...
[ "0.8700325", "0.86246437", "0.8537747", "0.8258717", "0.8157606", "0.80732507", "0.8073055", "0.8053429", "0.8042707", "0.80313087", "0.80287695", "0.8027717", "0.8023456", "0.7988316", "0.7982838", "0.79794836", "0.79435366", "0.79435366", "0.79435366", "0.79435366", "0.7927...
0.7841006
28
sorted? yes? no? how?
def is_sorted_and_how(arr) arr == arr.sort ? "yes, ascending" : arr == arr.sort.reverse ? "yes, descending" : "no" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bigSorting(unsorted)\n\nend", "def is_sorted\r\n false\r\n end", "def sort_entries; end", "def stable_sort_by(list); end", "def orderly(array)\n p array.sort\nend", "def sorted?(arr)\n\nend", "def sorted_keys; end", "def sort a\r\n sort_rec a, []\r\nend", "def sort a\r\n sort_rec a, []...
[ "0.76336044", "0.7487934", "0.7334257", "0.72808766", "0.7037018", "0.7034382", "0.6961145", "0.6827325", "0.6827325", "0.68111676", "0.6799395", "0.6799395", "0.6779846", "0.6740791", "0.67370766", "0.67284155", "0.6695121", "0.66947114", "0.6694395", "0.66919935", "0.668046...
0.0
-1
decode some dubstepified string
def song_decoder(song) song.gsub("WUB", " ").gsub(/\s+/, " ").strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_string(str)\n\nend", "def decode(text); end", "def decode_b(str)\n str.gsub!(/=\\?ISO-2022-JP\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n str.gsub!(/=\\?SHIFT_JIS\\?B\\?([!->@-~]+)\\?=/i) {\n decode64($1)\n }\n str = Kconv::toeuc(str)\n st...
[ "0.7739982", "0.7599936", "0.74943745", "0.74883646", "0.72442335", "0.7158179", "0.7158179", "0.70441186", "0.702042", "0.700581", "0.6967196", "0.6951986", "0.6925282", "0.6853973", "0.6828901", "0.67725044", "0.6749914", "0.6730257", "0.67207223", "0.6698033", "0.664698", ...
0.0
-1
Encrypt this! =begin Your message is a string containing space separated words. You need to encrypt each word in the message using the following rules: The first letter needs to be converted to its ASCII code. The second letter needs to be switched with the last letter Keepin' it simple: There are no special characters in input. =end
def encrypt_this(text) x = text.split(" ") x.map! do |word, index| if x[0].length == 1 || word.length == 1 "#{word[0].codepoints.join()}" elsif word.length == 2 "#{word[0].codepoints.join()}#{word[1]}" else "#{word[0].codepoints.join()}#{word[-1]}#{word[2..-2]}#{word[1]}" end end x.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt_this(text)\n text.split.map { |word|\n word[1], word[-1] = word[-1], word[1] if word.size > 2\n word[0] = word[0].ord.to_s\n word\n } .join(' ')\nend", "def encrypt_phrase\n\t\tunencoded_array = @starting_phrase.split('').map{|v| v.ord - 65}\n\t\tone_time_array = @one_time_phrase.split(''...
[ "0.7612564", "0.76066184", "0.75946635", "0.7592905", "0.7545902", "0.75264096", "0.7494146", "0.74244726", "0.73717207", "0.7265766", "0.72233593", "0.71821845", "0.7163563", "0.7155648", "0.71470946", "0.71387154", "0.71231633", "0.7120026", "0.7111998", "0.7104385", "0.710...
0.72843
9
add a dash before and after each odd number
def dashatize(num) num ? num.to_s.scan(/[02468]+|[13579]/).join("-") : "nil" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dasherize_number(num)\n #split number into an array\n array = num.to_s.chars.map(&:to_i)\n i = 0\n #iterate over array to find odd numbers\n while i < array.length\n if !(array[i] % 2 == 0)\n #if it is the first number, only put a dash on the right side\n if i == 0\n array[0] = [array[...
[ "0.7773009", "0.7761568", "0.7619312", "0.7613159", "0.7587699", "0.7564808", "0.7432951", "0.7411432", "0.7408683", "0.7402173", "0.7379101", "0.73752654", "0.73626256", "0.7344184", "0.72652227", "0.72565717", "0.7165203", "0.7151381", "0.7109808", "0.7081299", "0.7066578",...
0.6270084
48
autocomplete input with matches found in a dictionary
def autocomplete(input, dictionary) mod_input = input.gsub(/[^a-zA-Z]/,"") dictionary.select { |word| word if word.start_with?(mod_input.downcase) || word.start_with?(mod_input.capitalize)} .first(5) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def autocomplete(input, dictionary)\n input.delete!(\"^a-zA-Z\")\n dictionary.lazy.select{ |word| word.downcase.start_with?(input.downcase) }.first(5)\nend", "def autocomplete(input, dictionary)\n words = Array.new\n dictionary.each do |word|\n if (word.gsub(/[^a-zA-Z]/, '')).downcase.start_with? (input.g...
[ "0.7348469", "0.694567", "0.6689012", "0.66169053", "0.64439434", "0.63796294", "0.63340676", "0.6314591", "0.62928444", "0.62701154", "0.6197698", "0.61196095", "0.6071315", "0.607131", "0.60622156", "0.6059856", "0.6058679", "0.6054026", "0.60471654", "0.6018718", "0.600582...
0.7079624
1
string input of names (eg. "Rey:van den Berg;Joe:Blythe") sort by last name and return in this format "(BLYTHE, JOE)(VAN DEN BERG, REY)"
def meeting(s) s .upcase .split(";") .map { |name| name.split(":") } .sort_by { |first, last| [last, first]} .map { |first, last| "(#{last}, #{first})"} .join end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_reindeer reindeer_names\n reindeer_names.sort_by{|string| string.split(\" \").last}\nend", "def meeting(s)\n new_arr = []\n names_arr = s.split(\";\").map { |full_name| full_name.scan(/(\\w.+):(\\w.+)/) }\n names_arr.each {|i| new_arr << [i[0][1].upcase, i[0][0].upcase] }\n sorted = new_arr.sort\n ...
[ "0.73721904", "0.7174723", "0.6993968", "0.6993968", "0.67791367", "0.6692931", "0.65834785", "0.65045893", "0.6367621", "0.6339965", "0.63252294", "0.6316098", "0.6301638", "0.6289421", "0.6255629", "0.6242353", "0.62099934", "0.61591417", "0.60917866", "0.6066553", "0.60598...
0.7147366
2
Find out which one of the given numbers differs from the others. One number usually differs from the others in evenness. Find one that is different in evenness, and return a position of this number.
def iq_test(numbers) x = numbers.split.map(&:to_i).map(&:even?) x.count(true) > 1 ? x.index(false) : x.index(true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_even_index(array)\n array.length.times do |middle_idx|\n part1 = [0] \n part2 = [0]\n array.each_with_index do |num, idx|\n part1 << num if idx < middle_idx\n part2 << num if idx > middle_idx\n end\n return middle_idx if part1.reduce(:+) == part2.reduce(:+)\n end\n -1\nend", ...
[ "0.6595478", "0.63248837", "0.6318139", "0.6290236", "0.62838763", "0.62781537", "0.622454", "0.6212934", "0.6192839", "0.6147033", "0.61387795", "0.61312073", "0.61201006", "0.61175257", "0.6087658", "0.6085952", "0.6079849", "0.6062213", "0.60357153", "0.6022624", "0.599756...
0.5750446
37
prints ["I", "am", "so", "keen", "to", "lean", "Ruby!"] longest word exercise Write a method to find the longest word in given string input
def longest_word(sentence) result = "" sentence.split.each do |word| if word.length > result.length result = word end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_longest_word(input_string)\n array = input_string.split(\" \")\n array.max_by {|word| word.length}\nend", "def longest (string)\n length_string = getlength(string)\n string.each do |word|\n if word.length == length_string.max\n puts word\n end\n end\nend", "def find_longest_word(input)...
[ "0.8557603", "0.85035527", "0.84895504", "0.8481186", "0.8468299", "0.846696", "0.84489805", "0.8438666", "0.8435628", "0.84226376", "0.83967346", "0.8391982", "0.8371188", "0.8358141", "0.83416975", "0.8326966", "0.8313749", "0.83116424", "0.8306712", "0.82642734", "0.825733...
0.8329832
15
Reabre un ticket dado su ID El ticket debe estar cerrado
def reopen_ticket if !current_user || !current_user.is_mod? redirect_to root_path and return end p = params.require(:ticket).permit(:id) if !p[:id] || !Ticket.exists?(id: p[:id]) @ticket = Ticket.new(p) if !p[:id] @ticket.errors.add(:base, "Necesitas dar un ID") else @ticket.errors.add(:base, "El ticket no existe.") end render :index and return end @ticket = Ticket.find(p[:id]) if @ticket.status @ticket.errors.add(:base, "El ticket ya está abierto") render :index and return end @ticket.status = true @ticket.save add_message :success, "Ticket #{@ticket.IDPrettyFormat} reabierto." redirect_to mod_page_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete id\n\t\t@tickets.delete ['id', id]\n\tend", "def set_ticket_detalle\n @ticket_detalle = TicketDetalle.find(params[:id])\n end", "def cancel_ticket(ticket)\n\n sql = \"SELECT film_id FROM tickets WHERE id = $1\"\n values = [ticket.id]\n film_id = SqlRunner.run(sql, values)[0]['film_i...
[ "0.63458407", "0.62035465", "0.61594504", "0.6138489", "0.6122428", "0.60971195", "0.6050122", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028", "0.6046028",...
0.68879616
0
Fetch token from current working directory.
def token File.open 'travis-token' do |file| file.read.chomp end rescue Errno::ENOENT => e $stderr.puts <<EOF Travis-CI token not found! To obtain it, do the following: $ travis login $ travis token > travis-token EOF raise e end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_token_from_tempfile\n # Store in env for command line!\n file = File.new('.token', 'r')\n token = file.read\n file.close\n token\n end", "def load_token\n ENV['ABS_TOKEN'] || token_from_file\n end", "def get_token\n get(TOKEN_URL)\n end", "def...
[ "0.78989047", "0.7363662", "0.7336466", "0.7161656", "0.7088174", "0.702768", "0.70263153", "0.702584", "0.69599664", "0.6852165", "0.68228596", "0.67848164", "0.6728826", "0.67240983", "0.66884863", "0.66804636", "0.6639053", "0.66272396", "0.6594658", "0.6591486", "0.655874...
0.6449016
23
This method exists based on the expectation that cart items could hold boxes or individual items
def weight if box box.weight * self.quantity else raise "Weight not known." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def use_cart(cart)\n cart.cart_items.each do |cart_item|\n order_items.build(item_id: cart_item.item.id, price: cart_item.item.send(item_price_method_name), quantity: cart_item.quantity) if cart_item.quantity.to_i > 0\n end\n end", "def check_cart item\n \tcheck = false\n \t#Doc tat ca san pham tro...
[ "0.6578641", "0.6542089", "0.6423299", "0.6396708", "0.63626164", "0.63344914", "0.6270403", "0.6269354", "0.62649006", "0.6254125", "0.62496096", "0.623737", "0.6234197", "0.6224698", "0.62189144", "0.6208052", "0.6184226", "0.6165823", "0.6144866", "0.6085557", "0.60824436"...
0.0
-1
Create a new object. The handle string represents a Handle.net prefix and suffix. Eg. "123456789/11" where "123456789" is the prefix. The handle is not a URL ie. not The expected_resource_type argument can be nil or one of the symbols listed in RESOURCE_TYPE_ID_TO_TYPE. If the value is not nil, we
def initialize(handle_string, expected_resource_type=nil) @handle_string = handle_string @resource_type = nil @resource_id = nil get_resource_info if expected_resource_type # Perform strict checking if @resource_type == nil && @resource_id == nil STDERR.puts <<-MSG_RESOURCE_NOT_FOUND.gsub(/^\t*/, '') ERROR: Unable to find a matching handle within the database. #{self.to_s} MSG_RESOURCE_NOT_FOUND exit(ERROR_RESOURCE_NOT_FOUND) end unless @resource_type == expected_resource_type STDERR.puts <<-MSG_BAD_RESOURCE_TYPE.gsub(/^\t*/, '') ERROR: Unexpected resource type! Expected type='#{expected_resource_type}'; Actual type='#{@resource_type}' #{self.to_s} MSG_BAD_RESOURCE_TYPE exit(ERROR_BAD_RESOURCE_TYPE) end unless @resource_id STDERR.puts <<-MSG_BAD_RESOURCE_ID.gsub(/^\t*/, '') ERROR: Resource ID does not exist. (Perhaps it has been deleted?) #{self.to_s} MSG_BAD_RESOURCE_ID exit(ERROR_BAD_RESOURCE_ID) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(handle, record_type)\n\t\t\t@prefix = read_string(handle)\n\t\t\t@name = read_dictstring(handle)\n\t\t\t@value = Record.MakeRecord(handle)\n\t\tend", "def get_resource(resource_type)\n\n Occi::Log.debug(\"Instantiating #{resource_type} ...\")\n\n if @model.get_by_id resource_type...
[ "0.57230586", "0.52225345", "0.51628625", "0.51544136", "0.514482", "0.5076008", "0.5051645", "0.50266975", "0.49904934", "0.49681312", "0.49473566", "0.49116713", "0.4903992", "0.4868091", "0.4851952", "0.48384976", "0.48182264", "0.48172596", "0.48072606", "0.48070955", "0....
0.75829685
0
Represent object as a string.
def to_s result = if @resource_type # @resource_id.inspect displays 'nil' when the DB column is nil "#{@resource_type}_id = #{@resource_id.inspect}" else "No resource found" end "#{result} (for handle '#{@handle_string}')" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n object.to_s\n end", "def to_s\n @object.to_s\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n \"#<#{self.class.name}:#{object_i...
[ "0.8466146", "0.8449354", "0.8199788", "0.8199788", "0.81755394", "0.7700158", "0.76318777", "0.7570099", "0.7362848", "0.7359538", "0.7353661", "0.73506653", "0.73506653", "0.73506653", "0.73506653", "0.73506653", "0.73506653", "0.73506653", "0.73506653", "0.73506653", "0.73...
0.0
-1
Set the transform (serialization) method for this mime type for use with the +display+ helper :api: public
def transform_method(transform = nil) @transform ||= transform || :"to_#{@format}" @transform end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mime_transform_method(key)\n raise ArgumentError, \":#{key} is not a valid MIME-type\" unless ResponderMixin::TYPES.has?(key)\n ResponderMixin::TYPES[key][:transform_method]\n end", "def add_mime_type(key, transform_method, values, new_response_headers = {}) \n enforce!(key => Symbol, value...
[ "0.63664484", "0.61476326", "0.6131315", "0.56974167", "0.567278", "0.5663855", "0.5611674", "0.5597497", "0.5582577", "0.5582577", "0.5582577", "0.5582577", "0.55379504", "0.5514639", "0.5502158", "0.54896414", "0.5483235", "0.5458586", "0.5440383", "0.5400404", "0.5374794",...
0.62583524
1
Set the acceptable mime types for this format. The first one declared will be used as the response header also. Please see Merb.add_mime_type for more information :api: public
def mime_types(*types) types.flatten.each do |t| @mime_types << t end @mime_types end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def accepts(*types)\n mime_types = types.map{ |type| mime_type(CONTENT_TYPE_ALIASES[type] || type) }\n condition do\n halt 406 unless mime_types.include?(request.media_type)\n content_type(mime_symbol(request.media_type))\n end\n end", "def set_content_type\n case p...
[ "0.71520805", "0.6973417", "0.6886272", "0.6879589", "0.68351465", "0.6786673", "0.67513514", "0.67388904", "0.6737786", "0.6708904", "0.67086685", "0.66771", "0.66771", "0.667029", "0.66296434", "0.6623992", "0.6508546", "0.6503081", "0.6493445", "0.6491775", "0.6458041", ...
0.666882
14
Setup a selector to determine at runtime the format for a request. The selector is a block that is run inside the router, and has access to the request, and router params object. ====Example Merb::CustomFormats.add(:foo) do mime_types "foo" selector do |request, router_params| return true in here to have :foo set, return false to move on end end :api: public
def selector(&block) @selector = block if block_given? @selector end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format(selector = nil, options, &block)\n if !selector && options.is_a?(String)\n selector = options\n options = nil\n else\n options = options.dup\n end\n options ||= block\n selector = selector_query(selector, options)\n add_rule :format, *selector, options\...
[ "0.58488077", "0.58289176", "0.5605589", "0.5408411", "0.52409893", "0.52381206", "0.52007407", "0.5159032", "0.5155908", "0.5137572", "0.5117684", "0.50752366", "0.5052614", "0.5042975", "0.4923668", "0.491022", "0.491022", "0.4908887", "0.4868585", "0.48673254", "0.48469356...
0.5439845
3
Set any custom default response headers that should be associated with this format. Please see Merb.add_mime_type for more information :api: public
def headers(headers = {}) @default_headers = headers if @default_headers.nil? || !headers.blank? @default_headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_content_type\n case params['format']\n when 'xml'\n response.headers['Content-Type'] = \"application/xml; charset=utf-8\"\n when 'json', 'csv'\n response.headers['Content-Type'] = \"application/json; charset=utf-8\"\n else\n raise \"Unexpected format!\"\n end\n end", "def s...
[ "0.7336418", "0.7025337", "0.7025337", "0.69219387", "0.6881779", "0.6826471", "0.6823878", "0.6793384", "0.6756835", "0.6667312", "0.6624526", "0.6598667", "0.65843165", "0.6554464", "0.65170866", "0.648704", "0.64815706", "0.6435421", "0.6431725", "0.64141005", "0.64135194"...
0.0
-1
Set the quality for this mime type matching. Please see Merb.add_mime_type for more information :api: public
def quality(qual = nil) @quality = qual || 1 if @quality.nil? @quality end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def quality(factor=0.8)\n @quality = factor\n end", "def quality=(value)\n\t\t\t@quality = value\n\t\tend", "def quality=(value)\n\t\t\t@quality = value\n\t\tend", "def quality=(value)\n\t\t\t@quality = value\n\t\tend", "def quality=(val)\n raise ArgumentError unless QUALITY.include? val.to_...
[ "0.6910486", "0.68383795", "0.68383795", "0.68383795", "0.6797724", "0.66047746", "0.6438408", "0.63919616", "0.60781246", "0.58966655", "0.5805369", "0.5774414", "0.57275295", "0.5707019", "0.56807256", "0.5670944", "0.5637381", "0.562775", "0.56185615", "0.56019634", "0.548...
0.6137599
8
Method for initialize the Case Media Form
def new # Initialize the Case Media Form @case_medium = CaseMedium.new # Initialize the Case Media with Case Media attachments @case_media_attachments = @case_medium.case_media_attachments.build end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(media)\n @media = media\n end", "def initialize(form)\n @form = form\n end", "def initialize(media_options={})\n @id = media_options[\"id\"]\n @format_type_id= media_options[\"format_type_id\"]\n @anime_series_id= media_options[\"anime_series_id\"]\n @cover_name= media_op...
[ "0.63741136", "0.610383", "0.60835475", "0.6074137", "0.6068732", "0.59597", "0.59017235", "0.59017235", "0.59017235", "0.59017235", "0.59017235", "0.59017235", "0.59017235", "0.59017235", "0.5862636", "0.5849461", "0.5827432", "0.57851785", "0.57391566", "0.5729217", "0.5728...
0.73897445
0
Method for creating the media for particular case
def create params[:case_medium][:owner_id] = devise_current_user.id.to_s # Creating the case media attachments according to the surgeon @case_media = current_user.case_media.new(case_media_params) if !current_user.setting.media_upload.nil? # Condition For checking the case media attachments are store into database or not @attachment_size = check_size_attachment(@case_media) if !(@attachment_size.include? false) if @case_media.save # After creating the case media attachment redirect the case media edit page redirect_to edit_case_case_medium_path(@surgery_case,@case_media) else # If case media is not creating the that is take into the same page redirect_to :back # Showing the warning message for the if image is not uploaded flash[:notice] = "Cannot upload more than 10 images at one go" end else # If case media is not creating the that is take into the same page redirect_to :back # Showing the warning message for the if image is not uploaded # flash[:notice] = "each attachment size limit is not more than 64MB" flash[:notice] = "Attachments size limit is exceed" end else # If case media is not creating the that is take into the same page redirect_to :back # Showing the warning message for the if image is not uploaded flash[:notice] = "please assign the size limit of the attachment in media upload settings" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMedia(nameStr, descriptionStr, projectStr)\n s = Sample.creator(\n {\n sample_type_id: SampleType.find_by_name(\"Media\").id,\n description: descriptionStr,\n name: nameStr, \n project: projectStr\n }, User.find(1) )\n end", "def media() @media = Media.new end", "def cre...
[ "0.74822855", "0.73086", "0.7265029", "0.72300446", "0.71072733", "0.6929908", "0.6893947", "0.68460035", "0.6787498", "0.6767294", "0.6752933", "0.67515767", "0.67337984", "0.6684468", "0.6678256", "0.6664649", "0.66369575", "0.65181035", "0.6484192", "0.64655215", "0.646030...
0.65209734
17
Method for creating the media for particular case
def update params[:case_medium][:owner_id] = devise_current_user.id.to_s # Updating the case media attachments accordin to the case media if @case_medium.update(case_media_params) # After update redirect ot the case page redirect_to edit_case_case_medium_path(@surgery_case,@case_medium) else # If more than 10 images then that is navigate the same page redirect_to edit_case_case_medium_path(@surgery_case,@case_medium) # if image is not uploaded then that showing the flash notice flash[:notice] = "Cannot upload more than 10 images at one go" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def createMedia(nameStr, descriptionStr, projectStr)\n s = Sample.creator(\n {\n sample_type_id: SampleType.find_by_name(\"Media\").id,\n description: descriptionStr,\n name: nameStr, \n project: projectStr\n }, User.find(1) )\n end", "def media() @media = Media.new end", "def cre...
[ "0.74822855", "0.73086", "0.7265029", "0.72300446", "0.71072733", "0.6929908", "0.6893947", "0.68460035", "0.6787498", "0.6767294", "0.6752933", "0.67515767", "0.67337984", "0.6684468", "0.6678256", "0.6664649", "0.66369575", "0.65209734", "0.65181035", "0.6484192", "0.646552...
0.0
-1
Method for the listing the timeline for the particular case
def index @timeline_user =devise_current_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeline\n request('timeline')\n end", "def show\n timeline\n end", "def timeline\n index\n new\n end", "def timeline(options = {})\n self.class.history.timeline(self, options)\n end", "def timeline(options = {})\n self.class.history.timeline(self, options)\n end"...
[ "0.7544594", "0.73424226", "0.72190326", "0.7072015", "0.7072015", "0.7054942", "0.6879071", "0.68384784", "0.6691275", "0.6647533", "0.6598247", "0.65272844", "0.65240264", "0.64595747", "0.6453509", "0.6441607", "0.6417664", "0.64067596", "0.64013153", "0.6340737", "0.63372...
0.0
-1
Method for finding the particular case media
def edit # All the case media attachment according the particular case media in the ascending orde accoding created at @case_media_attachments = @case_medium.case_media_attachments.all.order('case_media_attachments.created_at ASC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_case_media\n\t\t@case_medium = CaseMedium.find(params[:id])\n\tend", "def media_search\n\t\tcase_media = media_list(params[:searchterm])\n\t\t# check condition for case media is present or not.\n\t\tif case_media.present?\n\t\t# response to the JSON\n\t render json: { success: true, response: case_...
[ "0.75692534", "0.71801513", "0.6847555", "0.68293446", "0.68104887", "0.6764325", "0.6735161", "0.6716063", "0.66003036", "0.6545325", "0.65352577", "0.64995176", "0.6464723", "0.6457332", "0.6457332", "0.63858217", "0.6368922", "0.63573015", "0.63044363", "0.62608296", "0.62...
0.54445595
100
Method for generating whole timeline in the format of pdf
def share_timeline respond_to do |format| format.pdf do render pdf: "share_timeline" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_timeline\n \n ## LaTeX headers\n p = '\\documentclass[oneside,a4paper]{article}'\n p << \"\\\\usepackage[#{@language}]{babel}\"\n p << '\\usepackage{tikz}'\n p << '\\usepackage{geometry}'\n\n p << @extra_latex_packages\n p << \"\\\\geometry{paperwidth=#{@total_width}cm, paperheight=#{@total_he...
[ "0.76193243", "0.7187853", "0.7072751", "0.66895264", "0.65299857", "0.62304586", "0.6208961", "0.6141847", "0.6114315", "0.609249", "0.60788983", "0.60675", "0.60475236", "0.6033458", "0.6030237", "0.60204566", "0.60204566", "0.60199916", "0.5999454", "0.5998398", "0.5997242...
0.66807264
4
Method for destroying the particular case media
def destroy # Desttroy the particular case media with all the attachment files @case_medium.destroy # Redirect to the case media index page after destroy case medium redirect_to case_case_media_path(@surgery_case) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n if @ok\n if !@media_element.check_and_destroy\n @ok = false\n @error = @media_element.get_base_error\n end\n else\n @error = I18n.t('activerecord.errors.models.media_element.problem_destroying')\n end\n render :json => {:ok => @ok, :msg => @error}\n end", "...
[ "0.7626657", "0.74028665", "0.73525274", "0.7326569", "0.73150116", "0.73150116", "0.73150116", "0.7313188", "0.72973955", "0.72887266", "0.7284206", "0.72667634", "0.7217712", "0.72087276", "0.72065735", "0.7195411", "0.7191147", "0.71872276", "0.7165455", "0.71368945", "0.7...
0.8267069
0
Method for permitting he case media params
def case_media_params # Permitting the params with nested attributes of the case media attachments params.require(:case_medium).permit(:case_id,:owner_id, case_media_attachments_attributes: [:attachment, :note,:tags]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def media_params\n params.require(:media).permit(:url, :description, :media_type_id, :climb_ids, :pull_quote, :ascent_ids => [])\n end", "def media_file_params\n p = params.require(:media_file).permit(\n :slug, :caption, :media, :source_type, :source, :copyright_license, :copyright_notes, :acce...
[ "0.7016323", "0.6944294", "0.6942054", "0.68014365", "0.6742144", "0.6739266", "0.67130363", "0.6690652", "0.66716534", "0.66315544", "0.66305256", "0.65969294", "0.6593413", "0.65754473", "0.65713793", "0.6548938", "0.65232915", "0.65092814", "0.6503726", "0.64720345", "0.64...
0.68242705
3
Method for finding the particualr from params
def find_case # Finding the particular case @surgery_case = Case.find(params[:case_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_by_param(param)\n with_param(param).first\n end", "def find(param)\n detect { |e| e.to_param == param }\n end", "def find_param(key)\n find_param_by_key(key)\n end", "def get_param(name_or_id, by_name_or_id)\n param = nil\n @params.each do |p|\n if (by_name_or_...
[ "0.7340409", "0.7154197", "0.7001242", "0.6992711", "0.6992711", "0.6945157", "0.6710461", "0.6481589", "0.6433067", "0.6414479", "0.63845575", "0.63810205", "0.6376421", "0.63630295", "0.63452774", "0.63429946", "0.63355476", "0.6328518", "0.6328518", "0.6322865", "0.6306476...
0.0
-1