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
Is a Gemfile present in this project? Returns a binary integer.
def gemfile_present tree = repository.repo.lookup(revision).tree gemfiles = tree.select{|item| item[:name] == 'Gemfile' } binary_integer gemfiles end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby?\n exist? 'Gemfile'\n end", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def gem_path?(file); end", "def gemfile_lock_present\n tree = repository.repo.lookup(revision).tree\n locks = tree.select{|item| item[:na...
[ "0.70599777", "0.7055482", "0.7055482", "0.6917134", "0.66831756", "0.65346116", "0.64840156", "0.6443277", "0.62977225", "0.6291899", "0.6276246", "0.6276246", "0.62530035", "0.62530035", "0.62530035", "0.6213173", "0.62077135", "0.61826694", "0.6181243", "0.6167599", "0.615...
0.78148973
0
Is a Gemfile present in this project? Returns a binary integer.
def gemfile_lock_present tree = repository.repo.lookup(revision).tree locks = tree.select{|item| item[:name] == 'Gemfile.lock' } binary_integer locks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gemfile_present\n tree = repository.repo.lookup(revision).tree\n gemfiles = tree.select{|item| item[:name] == 'Gemfile' }\n binary_integer gemfiles\n end", "def ruby?\n exist? 'Gemfile'\n end", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def gemfile_exists? \n Fil...
[ "0.78148973", "0.70599777", "0.7055482", "0.7055482", "0.6917134", "0.65346116", "0.64840156", "0.6443277", "0.62977225", "0.6291899", "0.6276246", "0.6276246", "0.62530035", "0.62530035", "0.62530035", "0.6213173", "0.62077135", "0.61826694", "0.6181243", "0.6167599", "0.615...
0.66831756
5
The number of gems used in this Gemfile. Returns an Integer.
def gems_used tree = repository.repo.lookup(revision).tree gemfile = tree.select{|blob| blob[:name] == 'Gemfile'}.first return 0 if !gemfile blob = gemfile[:oid] content = Rugged::Blob.lookup(repository.repo,blob).content Ripper.sexp(content).flatten.count('gem') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gems_count\n @gems_count ||= gems.count\n end", "def gems_count\n Recommendable.config.ratable_classes.inject(0) do |sum, klass|\n sum + gemd_count_for(klass)\n end\n end", "def number_of_files\n\t\tassets.length\n\tend", "def num_files_total\n command_strin...
[ "0.8741077", "0.7735626", "0.6559791", "0.63026404", "0.6220423", "0.5878095", "0.5834237", "0.5824162", "0.5754225", "0.5734276", "0.5731347", "0.5727645", "0.57044667", "0.56855774", "0.568028", "0.56778413", "0.56778413", "0.56778413", "0.5628241", "0.5613695", "0.56109345...
0.80362505
1
initialize with 3 triangle sides
def initialize(side_1,side_2,side_3) @side_1 = side_1 @side_2 = side_2 @side_3 = side_3 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def triangle(a, b, c)\n sides = [a,b,c]\n validate_sides(sides)\n\n unique_side_lengths = sides.uniq.length\n\n case unique_side_lengths\n when 1\n :equilateral\n when 2\n :isosceles\n when 3\n :scalene\n end\nend", "def triangle(side1, side2, side3)\n sides = [side1, side2, side3]\n return :i...
[ "0.710723", "0.69550025", "0.67375046", "0.6677531", "0.6619397", "0.6579915", "0.655238", "0.65388817", "0.65219855", "0.65165496", "0.6497362", "0.64747506", "0.6449648", "0.6442067", "0.6441688", "0.6438893", "0.6386807", "0.6379059", "0.637869", "0.6361798", "0.6355766", ...
0.61665064
41
def health(depth) health_stats = [] scores = score_finder(depth) scores.each do |score| right_children = find_right_children(score) left_children = find_left_children(score) children = right_children + left_children
def scores_at_a_depth all_scores = @movie_info_separated.map { |element| element[0] } all_scores.each do |score| depth = depth_of(score) if @scores_at_a_depth.include?(depth) @scores_at_a_depth[depth] << score else @scores_at_a_depth[depth] = [score] end end @scor...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def health(depth)\n health_meters = Array.new\n if 0 == depth\n health_meters.push(@head.score,\n @number_of_nodes,\n ((@number_of_nodes/@number_of_nodes) * 100))\n end\n end", "def test_health_works\n tree = BinarySearchTree.new\n ...
[ "0.8183496", "0.6509947", "0.5996234", "0.5854892", "0.57726014", "0.57726014", "0.57040167", "0.5681709", "0.56443393", "0.56325436", "0.56133944", "0.5521782", "0.54877913", "0.5485499", "0.54722124", "0.54418707", "0.5413126", "0.5387485", "0.53834116", "0.53618175", "0.53...
0.58586216
3
Le texte entier de l'analyse
def texte_entier @texte_entier ||= TextAnalyzer::Analyse::WholeText.new(self) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def texts; end", "def text text\n end", "def analysis\n @str = params[:text] ||= '解析対象の文字列'\n @words = Tag.counter(Tag.generate(@str))\n end", "def recuperationEtape()\n\t\tstring=@techniqueObjet.etape(@etapeEnCours)\n\t\t@texteContenu.set_text(string)\n\tend", "def recuperationEtape()\n\t\tstrin...
[ "0.67566156", "0.6687505", "0.6578691", "0.6557553", "0.6557553", "0.64894056", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", "0.63875574", ...
0.7253133
0
Create a new regressor with multilayer perceptron.
def initialize(hidden_units: [128, 128], dropout_rate: 0.4, learning_rate: 0.001, decay1: 0.9, decay2: 0.999, max_iter: 200, batch_size: 50, tol: 1e-4, verbose: false, random_seed: nil) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_perceptron()\n @model = Perceptron.new()\n @model.train(@training_set)\n end", "def newRegressor\r\n\t\t@trained\t\t= false\r\n\t\t@lr \t\t\t= RubyLinearRegression.new\r\n\t\tputs trainingData.getDataStructure(useHash).first\r\n\t\t@lr.load_training_data trainingData.getDataStructure(useHash), t...
[ "0.6903937", "0.614385", "0.6072454", "0.552372", "0.5444779", "0.541425", "0.5407682", "0.52266943", "0.5143344", "0.5066295", "0.50471175", "0.5036841", "0.48422468", "0.4711614", "0.47014713", "0.46875376", "0.46826872", "0.46661887", "0.46630782", "0.4617002", "0.46065563...
0.0
-1
Fit the model with given training data.
def fit(x, y) x = ::Rumale::Validation.check_convert_sample_array(x) y = ::Rumale::Validation.check_convert_target_value_array(y) ::Rumale::Validation.check_sample_size(x, y) y = y.expand_dims(1) if y.ndim == 1 n_targets = y.shape[1] n_features = x.shape[1] sub_r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit(x, y)\n x = Rumale::Validation.check_convert_sample_array(x)\n y = Rumale::Validation.check_convert_label_array(y)\n Rumale::Validation.check_sample_size(x, y)\n xx = fit_bias? ? expand_feature(x) : x\n @model = Numo::Liblinear.train(xx, y, liblinear_params)\n @wei...
[ "0.69254047", "0.68158746", "0.67085356", "0.6327001", "0.6312509", "0.62581545", "0.625486", "0.62329125", "0.6145117", "0.6088875", "0.60601145", "0.60083216", "0.5994248", "0.59900737", "0.59900737", "0.5966812", "0.5919046", "0.5836815", "0.58048713", "0.57960856", "0.579...
0.63795567
3
Predict values for samples.
def predict(x) x = ::Rumale::Validation.check_convert_sample_array(x) out, = @network.forward(x) out = out[true, 0] if out.shape[1] == 1 out end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fit_predict(x)\n x = Rumale::Validation.check_convert_sample_array(x)\n\n fit(x).predict(x)\n end", "def predict(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n if @params[:metric] == 'precomputed' && x.shape[1] != @values.shape[0]\n raise ArgumentError...
[ "0.7085236", "0.699106", "0.68530625", "0.68530625", "0.6833668", "0.6825067", "0.67064106", "0.6664679", "0.6646439", "0.65966344", "0.6561365", "0.65065193", "0.65016085", "0.6473644", "0.64537907", "0.64441603", "0.64150935", "0.6346463", "0.6328539", "0.6298465", "0.62970...
0.6422712
16
Connects to the database
def db() db = SQLite3::Database.new("db/database.db") db.results_as_hash = true return db end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _connect_database\n _send_command(\"db_connect #{@options[:db_user]}:#{@options[:db_pass]}@#{@options[:db_host]}/#{@options[:db_name]}\")\n end", "def connect\n \n if !self.connected?\n \n # connect to the MySQL server\n \n @dbh = DBI.connect(\"DBI:Mysql:#{@dataBase}:#{@ho...
[ "0.819774", "0.7907518", "0.78840667", "0.77300423", "0.7712496", "0.7712496", "0.7712195", "0.7636337", "0.76086783", "0.7591657", "0.7546557", "0.75461715", "0.74578106", "0.7444539", "0.7415602", "0.73915094", "0.7372586", "0.7329038", "0.7320436", "0.73008007", "0.7280721...
0.0
-1
Get different items from database depending on the arguments
def get_from_db(column, table, where, value) if where.nil? || value.nil? return db.execute("SELECT #{column} FROM #{table}") else return db.execute("SELECT #{column} FROM #{table} WHERE #{where} = ?",value) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_item(item_type, item_id)\n case item_type\n \n when \"weapon_id\"\n Weapon.find(item_id) \n when \"armor_id\"\n Armor.find(item_id)\n when \"potion_id\"\n Potion.find(item_id)\n end\n end", "def retrieve\n if [:area, :start_date, :end_date, :guests].all? { ...
[ "0.64151686", "0.60016614", "0.59826255", "0.5892409", "0.58456856", "0.57995427", "0.57398033", "0.57164794", "0.56954455", "0.5688222", "0.5661304", "0.5645496", "0.56274927", "0.56233096", "0.56214374", "0.5618366", "0.5595898", "0.55910474", "0.55683076", "0.55672556", "0...
0.0
-1
Gets all the public posts from a user
def get_public_posts(user_id) return db.execute("SELECT * FROM post WHERE user_id = ? AND public = ?",user_id, "on") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @posts = Post.user_posts current_user\n end", "def get_posts_for_user\n @posts = policy_scope(Post)\n end", "def index\n people_in_feed = current_user.feed_list\n @posts = Post.where(user: people_in_feed)\n end", "def index\n @posts = @current_user.posts\n end", "def get_user...
[ "0.74891835", "0.7409202", "0.7268291", "0.721392", "0.72047174", "0.71780515", "0.7176394", "0.7096305", "0.7094911", "0.7086953", "0.70666134", "0.70638597", "0.70041794", "0.6962602", "0.6957662", "0.6921681", "0.69039744", "0.6902674", "0.6886703", "0.68745136", "0.682860...
0.84305006
0
Validates input from a new post creation or a update of an post.
def validate_post(name,written) if name.empty? || written.empty? return "You missed to fill out a field" elsif name.length >= 500 || written.length >= 5000 return "U have reached the charater limit" else return nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_post_input(forum, topic, message)\n raise Impostor::PostError.new(\"forum not set\") unless forum\n raise Impostor::PostError.new(\"topic not set\") unless topic\n raise Impostor::PostError.new(\"message not set\") unless message\n true\n end", "def handle_inputs\n collect_inputs...
[ "0.65679556", "0.64210355", "0.6261961", "0.6224321", "0.61783016", "0.6174876", "0.6121998", "0.609844", "0.6064057", "0.60587275", "0.6053389", "0.60291415", "0.6013974", "0.5988823", "0.592582", "0.59082156", "0.5906023", "0.5888229", "0.58842504", "0.58132786", "0.5802237...
0.0
-1
Updates potst with updated information
def update_post(post_id,name,written) db.execute("UPDATE post SET name = ?,written = ? WHERE post_id = ?",name,written,post_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @pot.update(pot_params)\n format.html { redirect_to @pot, notice: 'Pot was successfully updated.' }\n format.json { render :show, status: :ok, location: @pot }\n else\n format.html { render :edit }\n format.json { render json: @pot.e...
[ "0.66962266", "0.6546041", "0.649832", "0.6460232", "0.6349146", "0.62636256", "0.62630725", "0.61302465", "0.609284", "0.6047373", "0.6046699", "0.59596366", "0.59415627", "0.5930675", "0.5924482", "0.5919374", "0.5919374", "0.59190273", "0.59190273", "0.59190273", "0.591902...
0.0
-1
Checks if the user is allowed to delete the post the proceeds to deletes the post.
def delete_post(post_id,current_user,rank) owner_id = get_from_db("user_id","post","post_id",post_id)[0]["user_id"] if current_user == owner_id || rank == "admin" db.execute("PRAGMA foreign_keys = ON") db.execute("DELETE FROM post WHERE post_id = ?", post_id) p "succe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_user_to_delete\n post = Post.find(params[:id])\n unless current_user == post.user || current_user.admin?\n flash[:alert] = \"You must be an admin to do that.\"\n redirect_to [post.topic, post]\n end\n end", "def destroy\n # check signed in user is the creator of post\n if @p...
[ "0.795289", "0.78683925", "0.7623329", "0.7594916", "0.75279146", "0.7519793", "0.7476689", "0.745115", "0.7369176", "0.7361214", "0.7322425", "0.7271723", "0.7258787", "0.7208657", "0.71955353", "0.7182761", "0.71805626", "0.717788", "0.71747214", "0.7172024", "0.71356726", ...
0.70813596
24
Checks if user is authenticated
def not_authenticated(user_id) if user_id == nil return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticated?\n !@user.nil?\n end", "def authenticated?\n !!session[:user]\n end", "def authenticated?\n valid? && !get_authenticated_user.nil?\n end", "def authenticated?\n true\n end", "def user_is_authenticated\r\n !!current_user\r\n end", "def user_authent...
[ "0.8345847", "0.8285958", "0.824999", "0.8163374", "0.81082135", "0.80598515", "0.8052384", "0.7998178", "0.79928565", "0.7964939", "0.793731", "0.79068536", "0.7894301", "0.7867333", "0.78660935", "0.78354067", "0.78249615", "0.7793244", "0.77580476", "0.7732704", "0.7732704...
0.0
-1
Easiest method without having my computer crash. require 'prime' answer = Prime.each(2000000).inject(:+) =>142913828922 puts answer Brute Force Method:
def summation_of_primes(limit) primes = [2] accum = 3 while primes[primes.length - 1] < limit if primes.all?{|ele| accum % ele != 0} primes << accum end accum += 2 end primes.pop # p primes sum = primes.reduce(:+) sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def problem10()\n\tsum = 0; Prime.each(2000000) {|i| sum += i}; return sum\nend", "def problem_ten\n Prime.instance.each(2_000_000).reduce(&:+)\n end", "def p10\n\tprimes = []\n\tPrime.each do |prime|\n\t\tbreak if prime >= 2000000\n\t\tprimes << prime\n\tend\n\t# puts primes\n\tprimes.reduce(:+)\nend", ...
[ "0.8158458", "0.7675994", "0.7611883", "0.7177281", "0.71151054", "0.7112915", "0.7031625", "0.69702345", "0.69605434", "0.69573295", "0.6946861", "0.6942446", "0.6937411", "0.69373107", "0.6926208", "0.6907749", "0.6907231", "0.687401", "0.6865169", "0.6808994", "0.6802624",...
0.6576062
38
overwrite the poster_image getter to return the cell poster_image if the grid_cell doesn't have one
def poster_image super.presence || cell.poster_image end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tile_image\n product_images.any? ? product_images[0].image_url : \"product-img-placeholder.jpg\"\n end", "def image\n self['image'] || self['image_src']\n end", "def get_image_or_placeholder\n return (self.image != \"\") && (self.image != nil) ? self.image : \"http://cdn.browshot.com/stati...
[ "0.64977324", "0.63472587", "0.6252285", "0.6252285", "0.60726386", "0.60678947", "0.6041425", "0.5948672", "0.5916555", "0.5901783", "0.5875073", "0.5832932", "0.5806014", "0.5799862", "0.57972956", "0.578349", "0.5775615", "0.576507", "0.573357", "0.5725435", "0.5722632", ...
0.8496781
0
GET /workflows/new GET /workflows/new.json
def new # open data/default_ecosystems.json and parse # object returned is an array of hashes... Ex: # p @ecosystems[0] # will return a Hash # p @ecosystems[0]["category"] # => "native" #@ecosystems = JSON.parse( File.open( "#{Rails.root}/public/data/default_ecosystems.json" , "r" ).read ) #@nam...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @workflow = Workflow.new(params[:workflow])\n\n respond_to do |format|\n if @workflow.save\n format.html { redirect_to @workflow, notice: 'Workflow was successfully created.' }\n format.json { render json: @workflow, status: :created, location: @workflow }\n else\n ...
[ "0.77392435", "0.77392435", "0.77392435", "0.77392435", "0.74599797", "0.73963386", "0.73002493", "0.72889715", "0.7144606", "0.70630497", "0.7050765", "0.7008631", "0.6982837", "0.68230605", "0.67988586", "0.67796874", "0.67542857", "0.6695581", "0.6662757", "0.6643828", "0....
0.0
-1
snake in 302 line of code
def game_core #frames counter for each job j1_frames = 10 j2_frames = 10 j3_frames = 10 #duration of a "frame" in s multiplier = 10 frame_duration = 0.005 #loop untill end of the game while !$game_over if(j3_frames >= frame_duration * multiplier) input = get_inputs.downcase if(input ==...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def jack_handey; end", "def sharp; accidental; end", "def probers; end", "def private; end", "def schubert; end", "def on_307; on_330; end", "def code_point=(_); end", "def slop!; end", "def slop!; end", "def sld; end", "def suivre; end", "def stderrs; end", "def p15\...
[ "0.607401", "0.6006849", "0.5987703", "0.59826064", "0.5982115", "0.59756064", "0.59422505", "0.5915663", "0.5896333", "0.5896333", "0.5855188", "0.58044034", "0.57925737", "0.5749586", "0.57362694", "0.5714532", "0.57023096", "0.56949663", "0.56949663", "0.5671483", "0.56604...
0.0
-1
Add display alphabetical for index
def employee_params params.require(:employee).permit(:name,:bio, :headshot) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_field_label(document, field)\n lookup_display_name(document, field) || super\n end", "def sort_column\n super \"Umbra::Record\", \"title_sort\"\n end", "def index_name(table_name, options) #:nodoc:\n super table_name.tr('.', '_'), options\n end", "def as_index_string\n case type\n ...
[ "0.64498866", "0.6344739", "0.62784463", "0.6184371", "0.61827505", "0.61648905", "0.61476445", "0.61375475", "0.613406", "0.61196554", "0.6119539", "0.61057556", "0.6093654", "0.606609", "0.6056078", "0.604152", "0.5993358", "0.59920377", "0.5973906", "0.59669495", "0.593310...
0.0
-1
Generic EPP exception. Accepts a response code and a message
def initialize(attributes = {}) requires!(attributes, :xml, :code, :message) @response_xml = attributes[:xml] @response_code = attributes[:code] @message = attributes[:message] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exception_with_internal_code(e, code, msg, internal_code, data = {})\n\n Result::Base.exception(\n e, {\n error: code,\n error_message: msg,\n data: data,\n http_code: internal_code\n }\n )\n end", "def error_response(sta...
[ "0.6928728", "0.68778914", "0.6642765", "0.66275775", "0.6572865", "0.65186113", "0.6507173", "0.64772105", "0.6455534", "0.6412328", "0.6379058", "0.6369304", "0.63586074", "0.63207", "0.6318725", "0.63079685", "0.63061106", "0.62956417", "0.62856597", "0.6284222", "0.628422...
0.0
-1
initializer with optional params
def initialize(params = {}) self.attributes = params end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize params = nil\n \n end", "def initialize( param, param2 , param3 = 'default value'); # can pass in an object\n @param = param\n @param2 = param2\n @param3 = param3 # has default value of nothing input\n end", "def initialize(**opt)\n super\n end", "def initialize...
[ "0.75178576", "0.73631895", "0.7301155", "0.7280296", "0.72278166", "0.7164238", "0.70619595", "0.70144856", "0.6994282", "0.69887674", "0.69621116", "0.6961169", "0.6957546", "0.69346017", "0.6877172", "0.6877172", "0.6840739", "0.678578", "0.67244965", "0.67159396", "0.6715...
0.0
-1
for views to switch between patch and post for form partials
def persisted? id && id > 0 ? true : false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n render partial: \"form\"\n end", "def patch!\n request! :patch\n end", "def patch\n req.patch?\n end", "def comment_form\n #data = params\n @comment_user_id = current_user.id\n @comment_commentable_id = params[:id]\n @comment_commentable_type = 'Matter'\n @comment_title ...
[ "0.633653", "0.61242944", "0.61086196", "0.6068498", "0.6054223", "0.6034498", "0.6031299", "0.6019464", "0.59837145", "0.59837145", "0.59586006", "0.5945856", "0.5935611", "0.5928714", "0.5899224", "0.58967847", "0.58739007", "0.586767", "0.5820558", "0.58123386", "0.5803574...
0.0
-1
attribute setter by param
def attributes=(params) params.each_pair do |k, v| setter = "#{k}=".to_sym public_send(setter, v) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_attribute(name, value); end", "def attribute=(_arg0); end", "def attribute=(_arg0); end", "def method_missing(meth, *args, &blk)\n match = meth.to_s.match(/^([a-zA-Z\\_]+)(=|$)$/)\n if match\n attribute, setter = match[1], !match[2].blank?\n if setter\n writ...
[ "0.81856954", "0.7597628", "0.7597628", "0.72580594", "0.71393824", "0.7077748", "0.7077748", "0.7051863", "0.69782466", "0.6941898", "0.6930929", "0.6893521", "0.6883806", "0.6882242", "0.6882242", "0.6867165", "0.68487144", "0.68472725", "0.683003", "0.6817719", "0.677224",...
0.6725425
26
Method overridden from HttpClient.
def execute_as_string(http_request) response = @connection.send( http_request.http_method.downcase, http_request.query_url ) do |request| request.headers = http_request.headers unless http_request.parameters.empty? request.body = http_request.parameters ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http; end", "def net_http_res; end", "def http(method, *args)\n args.last.merge!(self.default_headers).merge!(\"X-Auth-Token\" => self.auth_token)\n response = RestClient.send(method, *args)\n @retried = false\n response\n rescue RestClient::Unauthorized\n @auth_response = nil\n...
[ "0.6263459", "0.62180036", "0.59052426", "0.5738301", "0.57162565", "0.5704708", "0.5621952", "0.56132233", "0.5591172", "0.5553702", "0.5553702", "0.5548763", "0.5523133", "0.5507572", "0.54649675", "0.54526496", "0.5445295", "0.54440224", "0.54440224", "0.54440224", "0.5444...
0.0
-1
Method overridden from HttpClient.
def execute_as_binary(http_request) response = @connection.send( http_request.http_method.downcase, http_request.query_url ) do |request| request.headers = http_request.headers unless http_request.parameters.empty? request.body = http_request.parameters ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http; end", "def net_http_res; end", "def http(method, *args)\n args.last.merge!(self.default_headers).merge!(\"X-Auth-Token\" => self.auth_token)\n response = RestClient.send(method, *args)\n @retried = false\n response\n rescue RestClient::Unauthorized\n @auth_response = nil\n...
[ "0.6261813", "0.621673", "0.59038126", "0.57371813", "0.5714006", "0.5702983", "0.5621921", "0.5611658", "0.5590343", "0.5551679", "0.5551679", "0.554791", "0.55217385", "0.5507253", "0.54630834", "0.5450479", "0.5445304", "0.5442701", "0.5442701", "0.5442701", "0.5442701", ...
0.0
-1
Method overridden from HttpClient.
def convert_response(response) HttpResponse.new(response.status, response.headers, response.body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http; end", "def net_http_res; end", "def http(method, *args)\n args.last.merge!(self.default_headers).merge!(\"X-Auth-Token\" => self.auth_token)\n response = RestClient.send(method, *args)\n @retried = false\n response\n rescue RestClient::Unauthorized\n @auth_response = nil\n...
[ "0.6262624", "0.62169486", "0.590398", "0.5737776", "0.57159793", "0.5703964", "0.56229746", "0.5611949", "0.55914253", "0.55526614", "0.55526614", "0.5547845", "0.55229396", "0.5506923", "0.5464568", "0.5452559", "0.54450196", "0.5444212", "0.5444212", "0.5444212", "0.544421...
0.0
-1
Define presentationspecific methods here. Helpers are accessed through `helpers` (aka `h`). You can override attributes, for example: def created_at helpers.content_tag :span, class: 'time' do object.created_at.strftime("%a %m/%d/%y") end end
def work_type_name model.work_type&.name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def created_at_tag\n\t\th.content_tag :span, class: \"time\" do\n\t\t\th.record_time(self.created_at)\n\t\tend\n\tend", "def time_to_show\n \n end", "def helper_attr(*attrs); end", "def helpers; end", "def helpers; end", "def helpers; end", "def helper_method(*methods); end", "def generic_datetim...
[ "0.56242824", "0.5594298", "0.5579356", "0.55774415", "0.55774415", "0.55774415", "0.5485416", "0.54617923", "0.5420506", "0.5388448", "0.5386777", "0.53248996", "0.5260087", "0.5259468", "0.52586246", "0.52575874", "0.5252026", "0.5243078", "0.52382714", "0.52369815", "0.522...
0.0
-1
Activates the user in the database.
def activate @activated = true self.activated_at = Time.now.utc self.activation_code = nil save! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activate\r\n Marketplace::Database.instance.delete_deactivated_user(self)\r\n Marketplace::Database.instance.add_user(self)\r\n Marketplace::Activity.create(Activity.USER_REACTIVATE, self, \"#{self.name} has been reactivated\")\r\n end", "def activate_user(user_id)\n post(\"/users/#{us...
[ "0.7746603", "0.77337503", "0.750554", "0.74590904", "0.7389596", "0.73547816", "0.7308838", "0.72856855", "0.7264758", "0.72618395", "0.7260988", "0.7222055", "0.72197217", "0.7215781", "0.72018164", "0.7118911", "0.7095531", "0.70851445", "0.7053755", "0.704818", "0.703194"...
0.6692429
48
Returns true if the user has just been activated.
def pending? @activated end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activated?\n self.user && self.user.activated?\n end", "def recently_activated?\n @activated\n end", "def recently_activated?\n @activated\n end", "def recently_activated?\n @activated\n end", "def recently_activated?\n @activated\n end", "def recently_...
[ "0.82779944", "0.7811497", "0.78046334", "0.7778806", "0.7778806", "0.7754977", "0.7733789", "0.77285266", "0.76869", "0.76713103", "0.76694673", "0.76535684", "0.76535684", "0.76535684", "0.76535684", "0.76535684", "0.76535684", "0.76535684", "0.76535684", "0.76535684", "0.7...
0.0
-1
These create and unset the fields required for remembering users between browser closes
def remember_me remember_me_for 2.weeks end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forgets\n update_attribute(:remember_digest, nil)\n end", "def after_save\n cookies['global_properties_for_user'] = nil\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n \tupdate_attribute(:remember_digest, nil)\n end", "def forget\n update_attribute(:...
[ "0.6562163", "0.64569265", "0.643535", "0.643535", "0.63210243", "0.6320825", "0.6300447", "0.6300447", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.62688625", "0.6...
0.0
-1
CanCanCan method checked current user and raises exception if not a match
def dashboard # shows data for just current user @user = current_user @writings = Writing.all @worksheets = Worksheet.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can?\n current_user\n end", "def can_access?(user)\n user == self.user\n end", "def can_look\n if @user.can( :read , @board ||= Board.find_from( params ) )\n return true\n else\n redirect_to login_url \n end# if\n end", "def can_access user\n return self.users.includ...
[ "0.75379914", "0.73960763", "0.71506226", "0.70421916", "0.6933038", "0.6909457", "0.6902306", "0.6898101", "0.68608326", "0.68479216", "0.68071264", "0.67820233", "0.67375726", "0.6725274", "0.67146087", "0.6687152", "0.6674838", "0.6668374", "0.6665104", "0.6642787", "0.661...
0.0
-1
boolean for changing between daughter nodes and interior nodestrue for daughter false for interior other e values must be greater than equal to t
def initialize(height, branching_factor, approx) @height = height #get inputs @height_count = height @branching_factor = branching_factor#get inputs @approx = approx#get inputs @node_array = []#initialise empty array of nodes @node_type = true # set to build daughters first get_t_value#get r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def travel_nodes_confirmed?\n self.previous_travel_node.present? &&\n self.previous_travel_node.confirmed? &&\n self.current_travel_node.present? &&\n self.current_travel_node.confirmed? #&&\n # self.next_travel_node.present? &&\n # self.next_travel_node.confirmed?\n end", "def elv_tygnon\n ...
[ "0.6073336", "0.6058012", "0.5975452", "0.5820201", "0.5814054", "0.5810769", "0.5809033", "0.57880527", "0.5772475", "0.56577927", "0.5656634", "0.561764", "0.56086826", "0.558451", "0.55630904", "0.55630904", "0.5558474", "0.55461335", "0.55364686", "0.5534715", "0.5505259"...
0.0
-1
Base64 decode and try also to inflate a SAML Message
def decode_raw_saml(saml) return saml unless base64_encoded?(saml) decoded = decode(saml) begin inflate(decoded) rescue decoded end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_raw_saml(saml)\n return saml unless base64_encoded?(saml)\n\n decoded = decode(saml)\n begin\n inflate(decoded)\n rescue\n decoded\n end\n end", "def decode_saml_request_payload(unauth_url)\n payload = CGI.unescape(unauth_url.split(\"SAMLRequest=\").last)\n...
[ "0.7614954", "0.70828044", "0.7065208", "0.6570719", "0.65681505", "0.65681505", "0.65351653", "0.65170175", "0.63809824", "0.63131106", "0.62950927", "0.62823176", "0.623073", "0.6222165", "0.6047325", "0.60226494", "0.5971667", "0.5949041", "0.59323585", "0.59323585", "0.59...
0.7634835
0
Deflate, base64 encode and urlencode a SAML Message (To be used in the HTTPredirect binding)
def encode_raw_saml(saml, settings) saml = deflate(saml) if settings.compress_request CGI.escape(Base64.encode64(saml)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_saml_request\n auth_request = OneLogin::RubySaml::Authrequest.new\n auth_url = auth_request.create(saml_settings)\n CGI.unescape(auth_url.split(\"=\").last)\n end", "def encode_SAMLResponse(nameID, opts = {})\n now = Time.now.utc\n response_id, reference_id = UUID.generat...
[ "0.672438", "0.6230455", "0.6213291", "0.59325254", "0.5884183", "0.58463395", "0.58463395", "0.5827265", "0.57604474", "0.5688255", "0.5662642", "0.56363267", "0.56363267", "0.557469", "0.5528281", "0.5520074", "0.5511473", "0.5506664", "0.5502405", "0.5484702", "0.5464931",...
0.721096
0
Base 64 decode method
def decode(string) Base64.decode64(string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode(b)\n Base64.decode64(b)\n end", "def decoded\n Base64.decode64(@base64 || \"\")\n end", "def base64_decode\n unpack('m').first\n end", "def decode_base64\n #self.unpack(\"m*\").first\n # This should be the above line but due to a bug in the ruby base64 decoder\n # ...
[ "0.84567654", "0.845654", "0.82913995", "0.8204924", "0.80445886", "0.7989198", "0.79872024", "0.79872024", "0.7886266", "0.7832456", "0.7646351", "0.7641931", "0.75445306", "0.75445306", "0.74501854", "0.7308526", "0.7308526", "0.7254448", "0.7243165", "0.72300804", "0.71461...
0.80539364
4
Base 64 encode method
def encode(string) Base64.encode64(string).gsub(/\n/, "") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode\n ::Base64.encode64(@string)\n end", "def base64_encode\n [self].pack('m').chop\n end", "def base64_encode value\n encoded_str = Base64.urlsafe_encode64 value, padding: false\nend", "def encode(str)\n @base64 = Base64.encode64(str)\n end", "def encode_base6...
[ "0.8548579", "0.83403814", "0.8227451", "0.8223839", "0.81955177", "0.8102018", "0.79512244", "0.79249823", "0.78950644", "0.78950644", "0.7870396", "0.7856137", "0.7812242", "0.7719977", "0.7700984", "0.76087177", "0.7604993", "0.75942147", "0.74706966", "0.7450297", "0.7443...
0.74445605
20
Check if a string is base64 encoded
def base64_encoded?(string) !!string.gsub(/[\r\n]|\\r|\\n/, "").match(BASE64_FORMAT) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_base64?(string)\n return false unless string.is_a?(String)\n return false unless string.start_with?('base64:')\n\n return true\n end", "def base64?\n !!@options[:base64]\n end", "def binary?\n @encoding == 'base64'\n end", "def safe_string(str)\n b64st...
[ "0.88188475", "0.7148154", "0.71058345", "0.67434126", "0.6532114", "0.6525913", "0.6518298", "0.64967275", "0.6461542", "0.6421127", "0.6411673", "0.64050674", "0.63071835", "0.6305801", "0.6305801", "0.6291883", "0.6251042", "0.6243456", "0.6243456", "0.61442536", "0.612956...
0.8872149
0
GET /contents GET /contents.json
def index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contents = Content.all\n render json: @contents\n end", "def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def index\n\n @contents = Content.all\n\n respond_to do |f...
[ "0.74268705", "0.7270441", "0.7267421", "0.7218472", "0.70382047", "0.6932601", "0.69112045", "0.6656425", "0.66527015", "0.66441536", "0.6599895", "0.6599895", "0.6579412", "0.65759706", "0.64812726", "0.64798766", "0.6304301", "0.63020414", "0.6278676", "0.6274572", "0.6274...
0.0
-1
GET /contents/1 GET /contents/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contents = Content.all\n render json: @contents\n end", "def index\n @contents = Content.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @contents }\n end\n end", "def index\n\n @contents = Content.all\n\n respond_to do |f...
[ "0.7337962", "0.72771823", "0.72729874", "0.7242928", "0.69509673", "0.6893205", "0.67762524", "0.67762524", "0.67579806", "0.6703063", "0.6670591", "0.6638352", "0.6602084", "0.65537834", "0.6455138", "0.6454024", "0.6454024", "0.6454024", "0.6454024", "0.6454024", "0.645402...
0.0
-1
POST /contents POST /contents.json
def create respond_to do |format| if @content.save format.html { redirect_to @content, notice: 'Content was successfully created.' } else format.html { render action: 'new' } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @contents = Content.all\n render json: @contents\n end", "def create(contents, params = {:language => \"Plain Text\", :private => false})\n params = params.merge({:contents => contents}.merge(@base_params))\n self.class.post(\"/paste\", :body => params).parsed_response\n end", "...
[ "0.6282009", "0.62486786", "0.620182", "0.60974866", "0.60562325", "0.6044423", "0.6020207", "0.5959216", "0.59045476", "0.5900914", "0.58946466", "0.58662325", "0.5840403", "0.5793481", "0.5786892", "0.5785959", "0.57757515", "0.5762252", "0.5748183", "0.5742464", "0.5740254...
0.0
-1
PATCH/PUT /contents/1 PATCH/PUT /contents/1.json
def update if @content.update(content_params) redirect_to @content, notice: 'Content was successfully updated.' else redirect_to @content end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end", "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n end", "def update!(**args)\n @contents = args[:contents] if args.key?(:contents)\n @path = args[:path]...
[ "0.66924775", "0.66924775", "0.6624396", "0.65706676", "0.6523222", "0.6439974", "0.63398", "0.6213639", "0.62122375", "0.6207268", "0.61986667", "0.61820537", "0.6175216", "0.6175216", "0.6175216", "0.6125858", "0.61070347", "0.61045074", "0.60744965", "0.60727596", "0.60444...
0.0
-1
DELETE /contents/1 DELETE /contents/1.json
def destroy redirect_to contents_url, alert: "Akcja niedozwolona" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @content = Content.find(params[:id])\n @content.destroy\n\n respond_to do |format|\n format.html { redirect_to contents_url }\n format.json { head :ok }\n end\n end", "def destroy...
[ "0.7508528", "0.734377", "0.73066396", "0.73066396", "0.73066396", "0.72924906", "0.72924906", "0.72924906", "0.7073485", "0.7073485", "0.70593846", "0.7046281", "0.70352846", "0.7026785", "0.6990942", "0.6968309", "0.6968309", "0.6968309", "0.6957546", "0.694398", "0.6918344...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def content_params params.require(:content).permit(:title, :body, :image_url, :place) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Admin panel required SSL by default
def ssl_required? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def force_ssl; end", "def force_ssl; end", "def ssl_option\n super\n end", "def ssl\n conf['dashboard']['ssl']\n end", "def serverssl\n super\n end", "def use_ssl?; end", "def disable_ssl; end", "def configure_ssl(http); end", "def ssl?; end", "def ssl?; end", "def ssl; end"...
[ "0.75205415", "0.75205415", "0.74586535", "0.74416786", "0.7354362", "0.73441863", "0.727235", "0.717762", "0.7128905", "0.7128905", "0.7117298", "0.71104354", "0.7023543", "0.70204586", "0.6964995", "0.69606245", "0.6960133", "0.6931453", "0.6904917", "0.6904917", "0.689772"...
0.7118907
10
Automatically respond with 404 for ActiveRecord::RecordNotFound
def record_not_found render :file => File.join(RAILS_ROOT, 'public', '404.html'), :status => 404 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_found\n respond_with 404\n end", "def record_not_found\n render json: \"Record not found\", status: 404\n end", "def record_not_found\n render json: { error: { message: 'Record not found.' }}, status: :not_found\n end", "def record_not_found!\n render partial: 'errors/404', sta...
[ "0.79775155", "0.7909316", "0.78999805", "0.78900415", "0.78881943", "0.78798044", "0.7864947", "0.78609824", "0.7850811", "0.78257775", "0.77630645", "0.7757685", "0.7750025", "0.77304447", "0.77151644", "0.7625157", "0.7611287", "0.7611287", "0.7611287", "0.7611287", "0.761...
0.7611394
18
4. Convert your driver test code from that challenge into Assert Statements
def assert raise "Assertion failed!" unless yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertions; end", "def assertions; end", "def assert_equal(actual, expected)\n\tif actual == expected\n\t\tputs \"pass\"\n\telse\n\t\tputs \"fail\"\nend\n \nassert_equal(1,1) #=> pass\nassert_equal(2,1) #=> fail\n \n# Use assert to test the following:\n \n# define a method to sum the values of an array. Ma...
[ "0.71446353", "0.71446353", "0.66367483", "0.66332626", "0.65089625", "0.65061116", "0.64846504", "0.6471524", "0.6451119", "0.6368837", "0.63520277", "0.63493896", "0.6348002", "0.6343534", "0.63392156", "0.63392156", "0.63392156", "0.63229984", "0.6317599", "0.6276746", "0....
0.0
-1
This initializes the plugin. This function is called by Sabre\DAV\Server, after addPlugin is called. This method should set up the required event subscriptions.
def setup(server) server.on('schedule', method(:schedule), 120) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n\t\t\tplugins.init(self)\n\t\tend", "def plugin_setup!; end", "def after_initialize(plugins); end", "def init_plugins\n\t\t\tmethods.grep(/^init_plugin_/).each{|method_name| send(method_name) }\n\t\tend", "def plugin_init\n arm_subscribe('ricer/messaged') do |sender, message|\n ...
[ "0.73266935", "0.6674165", "0.6395595", "0.629343", "0.62820417", "0.61250925", "0.608846", "0.5947595", "0.5940671", "0.5940671", "0.59074736", "0.5869701", "0.5856342", "0.58392054", "0.57769215", "0.57670754", "0.5708679", "0.5696061", "0.568629", "0.568629", "0.568629", ...
0.0
-1
Returns a plugin name. Using this name other plugins will be able to access other plugins using \Sabre\DAV\Server::getPlugin
def plugin_name 'imip' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_name\n name.split('::').last.underscore.to_sym\n end", "def plugin_name\n @plugin_name ||= instance[:name]\n end", "def plugin_name\n instance[:name]\n end", "def plugin_name\n @@name || self.class.name\n end", "def plugin_name\n s = @event.at('@pluginN...
[ "0.83314645", "0.7881166", "0.78111", "0.7722512", "0.7526759", "0.74359274", "0.7414494", "0.7157317", "0.68823963", "0.6871244", "0.6769277", "0.67598736", "0.6758391", "0.6627354", "0.63714135", "0.6365459", "0.6333212", "0.63240296", "0.6273711", "0.62600756", "0.62538457...
0.5741989
44
Event handler for the 'schedule' event.
def schedule(i_tip_message) # Not sending any emails if the system considers the update # insignificant. unless i_tip_message.significant_change unless i_tip_message.schedule_status i_tip_message.schedule_status = '1.0;We got the message, but it\'s not significant...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schedule\n # implemented by subclass\n end", "def schedule=(value)\n @schedule = value\n end", "def schedule=(value)\n @schedule = value\n end", "def schedule=(value)\n @schedule = value\n end", "def schedule(schedule...
[ "0.7262393", "0.713437", "0.713437", "0.713437", "0.690077", "0.6885711", "0.68075156", "0.6784189", "0.6616801", "0.6590737", "0.6556692", "0.64628685", "0.6451474", "0.642659", "0.642659", "0.642659", "0.642659", "0.642659", "0.642659", "0.642659", "0.642659", "0.642659",...
0.0
-1
This is deemed untestable in a reasonable manner This function is responsible for sending the actual email.
def mail(to, subject, body, headers) headers['to'] = to mail = Mail.new mail.subject = subject mail.body = body headers.each do |_key, value| mail[header] = value end mail.deliver! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_email\n return true unless RunLevel.is_normal?\n\n log_msg = \"SEND #{flavor} \" \\\n \"from=#{user&.login || \"nil\"} \" \\\n \"to=#{to_user&.login || \"nil\"} \" +\n queued_email_integers.map { |x|\n \"#{x.key}=#{x.value}\"\n }.join(\" \") +\n ...
[ "0.7677185", "0.7028266", "0.7024667", "0.70212245", "0.7011582", "0.6979743", "0.6979116", "0.69770443", "0.6964861", "0.695963", "0.6933942", "0.6918436", "0.6916794", "0.6907184", "0.69021595", "0.68785524", "0.68777686", "0.68674654", "0.68590605", "0.6858982", "0.6847558...
0.0
-1
Returns a bunch of metadata about the plugin. Providing this information is optional, and is mainly displayed by the Browser plugin. The description key in the returned array may contain html and will not be sanitized.
def plugin_info { 'name' => plugin_name, 'description' => 'Email delivery (rfc6037) for CalDAV scheduling', 'link' => 'http://sabre.io/dav/scheduling/' } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => nil,\n 'link' => nil\n }\n end", "def plugin_info\n {\n 'name' => plugin_name,\n 'description' => 'Generates HTML indexes and debug information for your sabre/dav se...
[ "0.74599427", "0.7310387", "0.69772995", "0.67811143", "0.67118317", "0.6655683", "0.65325224", "0.65322304", "0.65229446", "0.64939153", "0.6400941", "0.63971585", "0.63965976", "0.63927853", "0.6346834", "0.6332577", "0.6318381", "0.6307829", "0.6272821", "0.6272821", "0.62...
0.60914886
41
def title was created automatically because you didn't specify a string field when you ran the refinery:engine generator. <3 <3 Refinery CMS.
def title "Override def title in vendor/extensions/subscriptions/app/models/refinery/subscriptions/subscription.rb" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def title_name; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title; end", "def title;...
[ "0.7596195", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74192184", "0.74111146",...
0.69842196
65
Check if the current user is subscribed to (following) a topic (hashtag)
def to_topic id, options={}, headers={} @connection.get "subscriptions/to_topic/#{id}.json", options, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def own_topic?(topic)\n topic.read_attribute(:user_id) == self.id\n end", "def subscribed?(user)\n user.subscription.subscribed==true\n end", "def is_subscribed?(user)\n fan_channel_id_youtube = self.channel_id_youtube\n subscriber = user.subscribers.find_by(channel_id_youtube: fan_channel_id_you...
[ "0.76940125", "0.71855104", "0.7119656", "0.70144707", "0.70144707", "0.6996341", "0.6864067", "0.6834801", "0.6768137", "0.67509127", "0.67371976", "0.6711312", "0.6597602", "0.65727675", "0.6544608", "0.65434045", "0.65378904", "0.6535111", "0.6534425", "0.6534425", "0.6527...
0.0
-1
Subscribe to a user or topic. This usually involves setting target_id and target_type in the JSON body.
def post body=nil, headers={} @connection.post "subscriptions.json", body, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subscribe! (user_id)\n check_auth :subscribe\n \n response = connection.post do |req|\n req.url \"/user/subscribe/#{user_id}\"\n req.body = { :format => @format }\n end\n response\n end", "def request!\n self.type = :subscribe\n reply_if_needed!\n e...
[ "0.6596712", "0.6566636", "0.6362647", "0.6038725", "0.60274947", "0.60082066", "0.59915704", "0.5948123", "0.5924204", "0.58995074", "0.5824835", "0.581257", "0.5783276", "0.57556653", "0.5692274", "0.5600405", "0.5598788", "0.55776393", "0.55776066", "0.55775046", "0.557076...
0.5790749
12
Unsubscribe from a user or topic. This usually involves setting target_id and target_type in the options hash.
def delete options={}, headers={} @connection.delete "subscriptions.json", options, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsubscribe(user, target)\n user.personal_subscriptions.where(target_id: target.id, target_type: target.class).destroy_all\n end", "def unsubscribe!\n self.type = :unsubscribe\n reply_if_needed!\n end", "def unsubscribe_to_optional_target\n @subscription.unsubscribe_...
[ "0.75044763", "0.72995037", "0.72564095", "0.7110014", "0.69896173", "0.67948705", "0.66033566", "0.6512923", "0.6512923", "0.64887303", "0.64884245", "0.6469162", "0.63107955", "0.6278432", "0.6271007", "0.62245744", "0.6178548", "0.61670095", "0.614291", "0.6120834", "0.609...
0.0
-1
It is not neccessary to convert the binary strings to a polynomial to add them.
def addEncoded(char1, char2) char1 ^ char2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(chars)\n result = chars[0]\n \n for i in 1...chars.length\n result = binaryAdd(result, chars[i])\n end\n \n result\n end", "def split_to_polynomial_terms\n left_and_right_sides = @raw_arg.split(/=/)\n unless left_and_right_sides.length == 2\n ...
[ "0.62401223", "0.60519063", "0.58097184", "0.57452583", "0.57235307", "0.56529903", "0.56444764", "0.56029564", "0.55907774", "0.55376756", "0.5533437", "0.5413102", "0.5342874", "0.5334175", "0.53306", "0.5326614", "0.53133285", "0.5309081", "0.52657336", "0.52581775", "0.52...
0.5686933
5
Takes a list of elements and adds them.
def add(chars) result = chars[0] for i in 1...chars.length result = binaryAdd(result, chars[i]) end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(*args); elements.add(*args); end", "def add(*args)\n @list << args\n @list.flatten!\n end", "def add(element)\n @element_list << element\n end", "def add_to_list(list)\n\n end", "def add_to_list(list)\n\n end", "def add_to_list(list)\n\n end", "def add(*elems)\r\n e...
[ "0.7977973", "0.7175971", "0.71555173", "0.7054681", "0.7054681", "0.7054681", "0.7018266", "0.6787125", "0.65676594", "0.6549064", "0.6545353", "0.64449865", "0.637153", "0.6348802", "0.6348802", "0.6308779", "0.6284711", "0.62671834", "0.62586457", "0.6238893", "0.6171318",...
0.0
-1
To multiply we do need to convert the binary strings to polynomials
def multiplyEncoded(ec1, ec2) poly1 = binaryToPoly(ec1) poly2 = binaryToPoly(ec2) product = multiplyPolys(poly1, poly2) polyToBinary(product) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def GF_product_p(a, b)\n (a.polynomial * b.polynomial).to_byte\nend", "def multiply(chars)\n result = chars[0]\n \n for i in 1...chars.length\n result = binaryMultiply(result, chars[i])\n end\n \n result\n end", "def decode1(str)\n num = 0\n i = 0\n w...
[ "0.6778375", "0.6687146", "0.6417944", "0.632389", "0.6247939", "0.6195433", "0.6077855", "0.6022842", "0.5976899", "0.5938255", "0.5937422", "0.58660424", "0.58644366", "0.5832771", "0.5819718", "0.58168864", "0.5795929", "0.57922626", "0.5789336", "0.5763621", "0.57559246",...
0.6135716
6
Takes a list of elements and multiplies them
def multiply(chars) result = chars[0] for i in 1...chars.length result = binaryMultiply(result, chars[i]) end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply_element(array)\n array.each do |x|\n x=x*x\n end\n end", "def multiply(nums)\r\n nums.reduce(:*)\r\nend", "def multiply_els(list)\n list.my_inject(1) { |product, i| product * i }\nend", "def custom_multiply(array, number)\n result = []\n number.times { array.each { |element| re...
[ "0.79020524", "0.7848545", "0.76833725", "0.76472926", "0.7618767", "0.76049644", "0.7602874", "0.7580301", "0.7577074", "0.75636315", "0.75511914", "0.7516593", "0.75002325", "0.74805135", "0.7477211", "0.73953974", "0.7376512", "0.7374969", "0.7371494", "0.7355836", "0.7352...
0.0
-1
multiplies 2 polynomials with coefs in Z(2^m)
def multiplyPolys(poly1, poly2) newPoly = poly1.*(poly2) newPoly = modX(newPoly, 2) newPoly = reduce(newPoly) newPoly = modX(newPoly, 2) newPoly end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def * other\n result = Polynomial.new\n @coeffs.each_with_index do |c, i|\n result.plus! other.scale(c).shift(i)\n end\n result\n end", "def + other\n if @coeffs.count > other.coeffs.count\n Polynomial.new @coeffs.zip(other.coeffs).map{ |a| a.map(&:to_f).inject(&:+) }\n else\n P...
[ "0.6905835", "0.65900594", "0.6126133", "0.5887424", "0.58507496", "0.5838798", "0.58248985", "0.5804885", "0.5756919", "0.56674296", "0.5628882", "0.56215954", "0.56203485", "0.56067306", "0.5551696", "0.5537804", "0.54843324", "0.5464294", "0.54475266", "0.5445121", "0.5435...
0.75632346
0
reduce the degree of a polynomial using the fact that x^6 = x + 1
def reduce(poly) degree = poly.degree() newPoly = poly while degree > 5 do newPoly = reduceHelper(newPoly, degree) degree = newPoly.degree() end newPoly end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def distinct_degree_factorization\n result = []\n i = 1\n fstar = self\n x = GCMPoly.x\n while fstar.degree >= 2*i\n xqix = x.powmod(2**(128*i), fstar) - x\n g = fstar.gcd(xqix)\n unless g.one?\n result << [g, i]\n fstar = fstar / g\n end\n i += 1\n end\n ...
[ "0.6007689", "0.59852195", "0.5700688", "0.55234945", "0.5514899", "0.5508076", "0.5501659", "0.5491469", "0.5484299", "0.5455779", "0.54455024", "0.54447514", "0.5431137", "0.54140264", "0.53924316", "0.53300726", "0.53286487", "0.52787346", "0.5255608", "0.52411634", "0.523...
0.7150676
0
This method raises a character to a given power
def exp(char, power) toReturn = char for i in 2..power toReturn = multiply([toReturn, char]) end toReturn end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power(num, power)\n\tnum**power\nend", "def **(power)\n unless power.is_a?(Integer) && power > 0\n raise ArgumentError, \"Quantities can only be raised to fixed powers (given #{power})\"\n end\n if power == 1\n self\n else\n self * self**(power - 1)\n end\n end", "def power(b...
[ "0.65844965", "0.65828127", "0.656898", "0.65415037", "0.653194", "0.65282965", "0.65251875", "0.64994943", "0.6498016", "0.649477", "0.6421925", "0.6417255", "0.64159614", "0.6306365", "0.62861204", "0.6282252", "0.623884", "0.6237721", "0.6224327", "0.621819", "0.62115866",...
0.7649169
0
This function does reduces the coefficients mod x
def modX(poly, mod) coefs = poly.coefs.dup coefs = coefs.map! {|x| x % mod} Polynomial[coefs] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modpow(a, x, mod)\n return 1 if x == 0\n return a if x == 1\n half = modpow(a, x/2, mod)\n val = half*half\n val *= a if x.odd?\n val % mod\nend", "def evaluate(x)\n eval_sum = Rallot::Integer(0, @sub_prime)\n\n @coefficients.each_with_index do |coeff, index|\n eval_sum = eval_sum + co...
[ "0.66699964", "0.5867176", "0.5651468", "0.55652577", "0.5527282", "0.5527282", "0.5444989", "0.5413503", "0.53911555", "0.5387855", "0.5375479", "0.53373426", "0.53297675", "0.5308331", "0.52724004", "0.52592736", "0.52545345", "0.52161855", "0.5213874", "0.5186921", "0.5180...
0.6999391
0
This method is given a character and returns true if that character is a primitive element
def isPrimitive(char) encodedChar = @encoder.encode(char) count = 1 current = multiplyEncoded(encodedChar, encodedChar) while current != encodedChar do current = multiplyEncoded(current, encodedChar) count += 1 end count == 63 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include_char?(char)\n return false unless char.respond_to?(:each_byte)\n\n char.each_byte do |b|\n return include?(b)\n end\n end", "def self_is_letter?(character)\n\n if character.length > 1\n return false\n elsif character.to_i != 0\n return fals...
[ "0.69778526", "0.66165733", "0.65025336", "0.64893186", "0.6479296", "0.6429158", "0.6267112", "0.6223987", "0.6209219", "0.6179324", "0.6174765", "0.61617357", "0.6157243", "0.6152651", "0.6150187", "0.61366373", "0.6078206", "0.606444", "0.6013603", "0.6005374", "0.6000265"...
0.8131299
0
This method creates a Hashmap of multiplicative inverses
def generateInverses() toReturn = Hash.new() @validCharacters.each do |x| @validCharacters.each do |y| if (multiply([x,y]) == '!') toReturn[x] = y break end end end toReturn ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(map)\n @map = map.collect do |name| name.to_s.to_sym end\n @inverse = {}\n @map.each.with_index do |name, i| @inverse[name] = i end\n end", "def pandigidictcreator()\n\tref_dict = {}\n\t(1..9).each do |num|\n\t\tsecond_dict = {}\n\t\t(1..num).each do |num2|\n\t\t\tsecond_dict[num2] = 0\n...
[ "0.6126003", "0.612108", "0.58958966", "0.5851281", "0.5827807", "0.5788293", "0.57586026", "0.56527036", "0.5631572", "0.5622333", "0.56139874", "0.55925864", "0.5538321", "0.5491046", "0.5473554", "0.5466443", "0.54618007", "0.5437175", "0.5430467", "0.542369", "0.54061246"...
0.66796863
0
This method finds the inverse by looking it up in the table
def findInverse(char) @inverses[char] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inverse\n end", "def inverse; end", "def inverse; end", "def inverse\n return @inverse if defined?(@inverse)\n\n if kind_of_inverse?(options[:inverse])\n return @inverse = options[:inverse]\n end\n\n relationships = target_model.relationships(relative_target_reposito...
[ "0.69557685", "0.6905529", "0.6905529", "0.67659414", "0.6539745", "0.64924145", "0.63938075", "0.638295", "0.63569844", "0.6291826", "0.62826884", "0.6242693", "0.6226235", "0.6133596", "0.6091043", "0.6017822", "0.5980334", "0.59800506", "0.5979955", "0.5966497", "0.5963353...
0.6805622
3
This method divides two elements (by multiplying by the inverse of the divisor)
def binaryDivide(dividend, divisor) inverse = findInverse(divisor) multiply([dividend, inverse]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div(other)\n divmod(other).first\n end", "def divmod(other)\n raise TypeError unless other.kind_of?(self.class)\n if other.zero?\n raise ZeroDivisionError; end\n q = @@Zero\n tmp = other\n while self >= tmp\n q = q.next\n tmp += other\n end\n ...
[ "0.7263439", "0.70179355", "0.6961002", "0.68908954", "0.6862211", "0.680428", "0.67911524", "0.6753348", "0.6728092", "0.671261", "0.6655137", "0.66523606", "0.6581939", "0.6578015", "0.655551", "0.6552234", "0.65333843", "0.6531998", "0.6515972", "0.650548", "0.6428516", ...
0.6465032
20
Prints a Multiplication Table
def printMultTable() print " " @validCharacters.each do |x| print x + " " end puts @validCharacters.each do |x| xBin = @encoder.encode(x) print x @validCharacters.each do |y| yBin = @encoder.encode(y)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_table\n dimension_length = (@numbers_to_multiply.length)\n topColumn = \"\"\n for i in 0..dimension_length\n topColumn += \" #{@multiplication_table[0][i]} |\"\n end\n for x in 0..dimension_length \n rowValues = \"\"\n for y in 0..dimension_length\n nextEntry = @multi...
[ "0.8515518", "0.8437228", "0.8169459", "0.80547696", "0.79866135", "0.7696817", "0.7555882", "0.7553639", "0.74021703", "0.7223788", "0.7200141", "0.7161172", "0.7156394", "0.71355635", "0.70476526", "0.7003008", "0.69763094", "0.69643044", "0.6806969", "0.6792036", "0.677193...
0.73889893
9
Prints an Addition Table
def printAddTable() print " " @validCharacters.each do |x| print x + " " end puts @validCharacters.each do |x| xBin = @encoder.encode(x) print x @validCharacters.each do |y| yBin = @encoder.encode(y) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_table(rows, columns)\n\tputs \"\\nYour Multiplication table:\"\n\tputs_labels(columns)\n puts_divider(columns)\n 1.upto(rows) do |row|\n \tputs_row(row, columns)\n end\nend", "def display_stats\n #Table of dragon stats\n table = Terminal::Table.new do |t|\n t.headings = ['Typ...
[ "0.70825535", "0.70085245", "0.69553494", "0.68396926", "0.68253815", "0.66878223", "0.66804445", "0.6646413", "0.66296005", "0.6604905", "0.65918976", "0.6591302", "0.6580237", "0.6540145", "0.6455835", "0.64191955", "0.64138895", "0.6389576", "0.63683623", "0.63612443", "0....
0.6870369
3
Allows both reader & writer attr_reader :holder_name, :balance, :type Gets things out of class attr_writer :holder_name, :balance, :type Changes things in class Holder Name = John Balance = 500 Type = business
def initialize(input_name, input_balance, input_type) # .new in the spec needs an initialize. @holder_name = input_name # @symbol is global. @balance = input_balance @type = input_type end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(holder_name , balance , type)\n @holder_name =holder_name\n @balance = balance\n @type = type\n end", "def initialize(holder_name, amount, type)\n @holder_name = holder_name\n @amount = amount\n @type = type\n end", "def initialize(input_holder_name, input_amount, input_type)...
[ "0.7252149", "0.67985827", "0.6265593", "0.625038", "0.612873", "0.61016405", "0.59202653", "0.5705197", "0.56227344", "0.55756944", "0.55410975", "0.5453755", "0.5431088", "0.53907275", "0.5351951", "0.5337022", "0.53227127", "0.53113073", "0.5285821", "0.5281035", "0.527453...
0.54023665
13
end GET actions POST actions
def create @name = "I am the Create action" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def POST; end", "def post\r\n end", "def post; end", "def post\n end", "def GET; end", "def submit\n\t\tset_post_data\n get_response @url\n parse_response\n\tend", "def post(action, **args); end", "def params\n self.GET.update(self.POST)\n rescue EOFError => boom\n self.GET\n e...
[ "0.7703917", "0.7284218", "0.7257429", "0.70372295", "0.69740796", "0.6597364", "0.65930706", "0.63526404", "0.63506037", "0.61476296", "0.61476296", "0.61476296", "0.61476296", "0.61476296", "0.614391", "0.61257106", "0.61123425", "0.6037094", "0.6024982", "0.59772474", "0.5...
0.0
-1
Note: args of pod method, there're 3 cases case 1: pod 'xxx'. So args are case 2: pod 'xxx', 'version'. So args are , case 3: pod 'xxx', :path => 'yyy'/:git => 'zzz'/... So args are ,
def pod(*args) # dump_object(args) pod_name = args[0] pod_arg_hash = {} if args[1] and args[1].is_a?(Hash) pod_arg_hash.merge(args[1]) elsif args[1] and args[1].is_a?(String) pod_arg_hash[:version] = args[1] end should_ignore_pod = false ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def local_pod(name, *args)\r\n path = File.expand_path name, '../..'\r\n\r\n if File.exist? path\r\n pod name, :path => path\r\n else\r\n pod name, *args\r\n end\r\nend", "def feature_pods\n ### ONLY FOR DEVELOP PURPOSES ###\n feature_branch = \"develop\" # <- HERE: Change this line to setup ALL ...
[ "0.7119306", "0.6425151", "0.63352853", "0.6324387", "0.61717826", "0.61377114", "0.6072718", "0.58995754", "0.58826464", "0.58516324", "0.58353174", "0.5832831", "0.58316404", "0.5784678", "0.576142", "0.574978", "0.5738187", "0.5736038", "0.5718471", "0.57176316", "0.571405...
0.823911
0
The lowest common ancestor of two nodes v and w in a tree is the lowest (i.e. deepest) node that has both v and w as descendants.
def lowest_common_ancestor(node1, node2) parents = Set.new parent1 = node1.parent parent2 = node2.parent until parents.include?(parent1) || parents.include?(parent2) parents.merge [parent1, parent2] parent1 = parent1.parent parent2 = parent2.parent end parents.include? parent1 ? parent1 : parent...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ancestor(v, w)\n all_ancestors = []\n min_dst = Float::INFINITY\n lcas = []\n v.each do |a|\n w.each do |b|\n all_ancestors.push(lowest_common_ancestor(a, b))\n end\n end\n ancestor_exists = false\n all_ancestors.each do |arr|\n ancestor_exists = true if arr[0].size > 0\n cu...
[ "0.8090643", "0.76934606", "0.7602793", "0.7590584", "0.7559263", "0.7547261", "0.75112855", "0.7497584", "0.74923164", "0.7475951", "0.7315902", "0.7261145", "0.71766454", "0.70857304", "0.6982563", "0.6856614", "0.6774592", "0.67719644", "0.674241", "0.6589113", "0.64980876...
0.73466897
10
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) smallest = 1000000 value = '' if name_hash == {} return nil else name_hash.each { |key, valueNumber| if valueNumber < smallest smallest = valueNumber value = key end } end value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n...
[ "0.88225716", "0.87791526", "0.87779355", "0.87472314", "0.8690887", "0.8656373", "0.8653365", "0.8617534", "0.85888296", "0.85730934", "0.8568526", "0.85522825", "0.8530813", "0.8530813", "0.8519404", "0.84942126", "0.84763813", "0.84763813", "0.8466587", "0.845011", "0.8449...
0.0
-1
NOTE: Allow for associating an account to a system user
def user User.unscoped{ super } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_user_account\n Account.create(user_id: self.id) \t\n end", "def add_account_user account_user\n \n \n # find or create catalog user\n catalog_user = CatalogUser.where( user_id: account_user.user_id, \n catalog_id: self.id,\n ...
[ "0.7275742", "0.69403255", "0.6785618", "0.6435213", "0.64117914", "0.63936275", "0.6359846", "0.63590956", "0.63220596", "0.6265984", "0.62492824", "0.6235946", "0.6201157", "0.6176631", "0.6163705", "0.6147238", "0.61339754", "0.61339754", "0.6132829", "0.6127757", "0.61224...
0.0
-1
Returns +true+ or +false+ if an API parameter is recognised as a boolean value, or +nil+ otherwise. +value+ should be a string as it is expected to be a member of the +params+ hash. api_boolean('false') => false api_boolean('1') => true api_boolean('YES') => true api_boolean('X') => nil
def api_boolean(value) { "0" => false, "false" => false, "no" => false, "1" => true, "true" => true, "yes" => true }[value.try(:downcase)] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def boolean_param(key, default = false)\n key = key.to_s.intern\n value = params[key]\n return default if value.blank?\n case value.strip.downcase\n when 'true', '1' then true\n when 'false', '0' then false\n else raise 'Invalid value'\n end\n end", "def param_ch...
[ "0.71102226", "0.69425416", "0.6858176", "0.68481475", "0.68429506", "0.683779", "0.68190974", "0.6817596", "0.6774069", "0.6764265", "0.6733257", "0.6728695", "0.672014", "0.66973436", "0.66909975", "0.6665636", "0.6635594", "0.66000086", "0.66000086", "0.6516125", "0.650939...
0.75900805
0
Returns the default number of items to include in a collection request.
def default_page_size 50 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item_count\n @item_count ||= except(:includes, :limit, :offset).count\n end", "def item_count\n collection.length\n end", "def item_count\n @collection.size\n end", "def item_count\n @collection.length\n end", "def item_count\n @collection.count\n end", "def page_count\n ...
[ "0.7063474", "0.70079625", "0.6945081", "0.69180304", "0.68670464", "0.6768081", "0.6672513", "0.66684383", "0.6545354", "0.64819545", "0.6456211", "0.6416308", "0.6408622", "0.6395636", "0.6372966", "0.6323787", "0.6307291", "0.629643", "0.62790483", "0.62643486", "0.625188"...
0.0
-1
GET /configurations/new GET /configurations/new.xml
def new @base_rom = BaseRom.find(params[:base_rom_id]) @configuration = @base_rom.configurations.new @extra_apks = Apk.all.select {|a| a.base_rom.nil?} respond_to do |format| format.html # new.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @app_config = AppConfig.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @app_config }\n end\n end", "def new\n @config_file = ConfigFile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml...
[ "0.7230896", "0.72300696", "0.71674466", "0.7018996", "0.7014986", "0.6896507", "0.6848574", "0.682684", "0.68194926", "0.6752454", "0.6708901", "0.67038745", "0.6700628", "0.66971076", "0.6681922", "0.66111106", "0.6593239", "0.65914583", "0.65441656", "0.651955", "0.6498324...
0.0
-1
POST /configurations POST /configurations.xml
def create @base_rom = BaseRom.find(params[:base_rom_id]) @configuration = Configuration.new(params[:configuration]) @configuration.base_rom = @base_rom # Add packages packages = params[:packages] || [] packages.each do |package| package_id = package.first package_selected = package...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_config(url_prefix, xml)\n post_data(url_prefix, xml, 'application/xml;charset=UTF-8')\n end", "def create body = {}\n @connection.request(method: :post, path: \"/configs/create\", headers: {\"Content-Type\": \"application/json\"}, body: body.to_json)\n end", "def create \n Configu...
[ "0.6693397", "0.64447206", "0.6357883", "0.62024486", "0.61926574", "0.61436117", "0.61191255", "0.60196346", "0.60182625", "0.5974605", "0.5967068", "0.5967068", "0.59625256", "0.5943912", "0.58675665", "0.58583647", "0.5850779", "0.5807745", "0.5772287", "0.5720699", "0.571...
0.0
-1
the "calls itself recursively" spec may say that there is no method named "and_call_original" if you are using an older version of rspec. You may ignore this failure. Also, be aware that the first factorial number is 0!, which is defined to equal 1. So the 2nd factorial is 1!, the 3rd factorial is 2!, etc.
def factorials_rec(num) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def factorial(number)\n if number == 0 #(limit)\n 1\n else\n number * factorial(number-1) #first number * number - 1 but the factorial calls the same method on the number - 1\n end\nend", "def recursive_factorial(number)\n\nend", "def recursive_factorial(number)\n\nend", "def factorial_non_recursion...
[ "0.6578974", "0.6294623", "0.6294623", "0.6286333", "0.6231544", "0.61104816", "0.6070837", "0.606304", "0.60377175", "0.60240614", "0.60129166", "0.600312", "0.6002449", "0.6002399", "0.59739465", "0.59733015", "0.59720194", "0.5971348", "0.59593356", "0.5958074", "0.5954940...
0.0
-1
builds link for Facebook Send Dialog (not to be confused with Facebook Send button)
def construct_fb_send(path = "") return "https://www.facebook.com/dialog/send?app_id="+ENV['FB_APP_ID']+"&link="+get_url(path)+"&redirect_uri="+get_url(path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def facebook_ref_link\n url = u(root_url(:ref_id => current_user.id))\n \"https://www.facebook.com/dialog/feed?app_id=#{ENV['FACEBOOK_APP_ID']}&display=page&link=#{url}&redirect_uri=#{root_url}&caption=#{u(Setting::get('Facebook invitation text'))}\"\n end", "def ezm_link_to_send_message\r\n link_to \"...
[ "0.68390787", "0.6512405", "0.63754386", "0.63178104", "0.62507176", "0.62507176", "0.6239616", "0.6167726", "0.61373484", "0.6095759", "0.6095759", "0.60141975", "0.5996201", "0.59752345", "0.59617865", "0.59326893", "0.58942807", "0.58934957", "0.5829789", "0.57878405", "0....
0.8270571
0
builds link for Custom Share button
def construct_fb_share(path = "") return "https://www.facebook.com/sharer/sharer.php?u="+get_url(path).to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def share_button(options = {}, &block)\n defaults = {\n url: default_url,\n label: 'Share',\n target: '_blank',\n class: 'facebook-share-button'\n }\n\n settings = defaults.merge options\n\n url = \"#{SHARE_URL}?u=#{CGI.escape settings[:url]}\"\n label = setting...
[ "0.7044972", "0.6938773", "0.6931867", "0.6817349", "0.6741689", "0.6723737", "0.6709976", "0.6700869", "0.6613233", "0.64466345", "0.6438493", "0.64221656", "0.638993", "0.6302969", "0.62807083", "0.62703615", "0.62576276", "0.62544686", "0.6230125", "0.6216752", "0.62159204...
0.6807236
4
builds link for Custom Tweet button
def construct_tweet(path = "", text = ENV["TWEET_COPY_GENERAL"]) return "https://twitter.com/share?url="+u(get_url(path))+"&text="+text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def button_link_to( title, url, options={} )\n\t\tclasses = ['link']\n\t\tclasses << options[:class]\n\t\ts = \"<a href='#{url_for(url)}' style='text-decoration:none;'>\"\n\t\ts << \"<button type='button'>\"\n\t\ts << title\n\t\ts << \"</button></a>\\n\"\n\tend", "def tweet_link_for_new_free_episode_vland\n \t...
[ "0.66967267", "0.6679661", "0.6648658", "0.66326684", "0.6592591", "0.63612103", "0.6324615", "0.6301499", "0.6299308", "0.6284328", "0.62589276", "0.62589276", "0.6238816", "0.6215289", "0.62090874", "0.6193952", "0.618008", "0.61466736", "0.61442465", "0.60715413", "0.60440...
0.6578972
5
Most to least staticContextParams contextParam clientContextParams BuiltIn Bindings Builtin binding default values
def endpoint_parameter_value(operation, param_name, param_data) value, source = [ static_context_param(operation, param_name), 'staticContextParam' ] value, source = [ context_param_value(operation, param_name), 'contextParam' ] unless value value, source = [ ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_params\n {}\n end", "def context_overrides()\n {\n :current_environment => environment,\n :global_scope => @topscope, # 4x placeholder for new global scope\n :loaders => @loaders, # 4x loaders\n :rich_data => true,\n }\n end", "def intern...
[ "0.5641444", "0.56260675", "0.5566122", "0.55637556", "0.5484963", "0.54622084", "0.5453295", "0.54252183", "0.5405519", "0.5372956", "0.5359486", "0.5340286", "0.5336719", "0.52978534", "0.52886885", "0.5286546", "0.5286546", "0.5275524", "0.5274388", "0.5273989", "0.5236737...
0.0
-1
def update end def destroy end
def resend @pirateMail = PirateMail.find(params[:id]) UserMailer.with(pirate_mail: @pirateMail).welcome_email.deliver_now end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update \n end", "def update\r\n end", "def update;end", "def update\r\n\r\n end", "def update \n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n ...
[ "0.75881505", "0.75830644", "0.7517725", "0.7511638", "0.75072753", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", "0.7487825", ...
0.0
-1
def send(message) user.stream.send message end def set_state name
def destroy if @user != nil @user.quit end super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _send_message state\n stream.with_stream! do | io |\n state.in_stream = io\n _write(state.message_payload, io, state)\n end\n end", "def send_stream_state(state, streaming_user)\n WebSocket::Client::Simple.connect(\n Rails.configuration.x.saber.chat_server,\n ...
[ "0.7582219", "0.75076586", "0.6687546", "0.6687546", "0.630632", "0.6224984", "0.6087994", "0.5995531", "0.59665906", "0.5964972", "0.5955178", "0.59519696", "0.5927558", "0.59168", "0.58971536", "0.5893672", "0.58832437", "0.5847218", "0.5793891", "0.57698846", "0.5714825", ...
0.0
-1
override exhibit_params method to convert tag_list params from array to comma separated list
def exhibit_params permitted_params = params.require(:exhibit).permit( :title, :subtitle, :description, :published, tag_list: [], contact_emails_attributes: [:id, :email], languages_attributes: [:id, :public] ) permitted_params[:tag_list] = simplify_tag_list(permitt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end", "def tag_list= value\n self.tags = value.split(',').map(&:strip)\n end", "def tag_list\n tags.join(\", \")\n end", "def tags_from_params\n search_filter_params[:tagged_with].to_s.split(\",\")\n end", "def ...
[ "0.66816866", "0.66816866", "0.6594489", "0.65009975", "0.64978415", "0.64531845", "0.64049464", "0.64049464", "0.64049464", "0.6391845", "0.63678676", "0.63678676", "0.6335389", "0.6334725", "0.6317221", "0.6294995", "0.62866515", "0.6258791", "0.62174654", "0.6183245", "0.6...
0.5784946
47
convert tag_list params from array to comma separated list
def simplify_tag_list(tag_list) tag_list&.delete_if { |t| t.empty? }&.join(",") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_list\n tags.join(\", \")\n end", "def tag_list\n #tags sie bierze z asocjacji\n tags.map { |t| t.name }.join(\",\")\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def tag_list\n tags.collect(&:name).join(', ')\n end", "def tag_list\n tags.map(&:name).jo...
[ "0.7488839", "0.7477491", "0.74360514", "0.74360514", "0.740889", "0.740889", "0.740889", "0.74024326", "0.7398177", "0.725838", "0.71028435", "0.70870066", "0.70870066", "0.7043158", "0.6973023", "0.69491464", "0.6936488", "0.6905465", "0.6904342", "0.689586", "0.6857224", ...
0.6877886
20
Callable form to allow passing in options: include Poise(ParentResource) include Poise(parent: ParentResource) include Poise(container: true)
def Poise(options={}) # Allow passing a class as a shortcut if options.is_a?(Class) options = {parent: options} end # Create a new anonymous module mod = Module.new # Fake the name. mod.define_singleton_method(:name) do super() || 'Poise' end mod.define_singleton_method(:included) do |klass...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parent_api; end", "def parent_api; end", "def parent; @options[:parent]; end", "def method_missing(method, *args)\n child_resource_template = resource_template.find_by_rel(method.to_s).first\n if child_resource_template && (child_class = child_class_for(self, method, params, child_resource_...
[ "0.5357067", "0.5357067", "0.5305386", "0.5244774", "0.5222111", "0.5202955", "0.51897156", "0.5124019", "0.505885", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50543445", "0.50...
0.61909616
0
GET /user_data or /user_data.json
def index @user_data = UserDatum.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response ...
[ "0.71281224", "0.67900544", "0.6777063", "0.6689013", "0.6652761", "0.6652761", "0.6607026", "0.6507581", "0.64933276", "0.64449215", "0.6380529", "0.6358144", "0.635416", "0.6326442", "0.6326442", "0.63204235", "0.6298871", "0.6277108", "0.62722486", "0.624854", "0.62300426"...
0.0
-1
GET /user_data/1 or /user_data/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_one_user_data\n get_url(\"/api/v1/users/#{@filter}\")\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response ...
[ "0.75472766", "0.6863564", "0.67348945", "0.65116125", "0.64831454", "0.6273778", "0.62734294", "0.62657285", "0.62568885", "0.62087643", "0.62037987", "0.62037987", "0.6165277", "0.6165139", "0.61400646", "0.6058368", "0.60535175", "0.6040451", "0.6040146", "0.6020719", "0.6...
0.0
-1
POST /user_data or /user_data.json
def create @user_datum = UserDatum.new(user_datum_params) respond_to do |format| if @user_datum.save format.html { redirect_to @user_datum, notice: "User datum was successfully created." } format.json { render :show, status: :created, location: @user_datum } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(path, data = {})\n request 'POST', path, body: data.to_json\n end", "def send_user_data(user)\n end", "def post(path, data={})\n request(:post, path, data)\n end", "def api_post(path, data = {})\n api_request(:post, path, :data => data)\n end", "def post(path, data=nil)\...
[ "0.6831586", "0.65335846", "0.6463449", "0.64314115", "0.63558674", "0.6303097", "0.62935174", "0.6280291", "0.627367", "0.62396646", "0.6218593", "0.62150055", "0.6207357", "0.6198965", "0.6171073", "0.6134101", "0.60874945", "0.60792667", "0.6074954", "0.60648996", "0.60432...
0.56394434
98
PATCH/PUT /user_data/1 or /user_data/1.json
def update respond_to do |format| if @user_datum.update(user_datum_params) format.html { redirect_to @user_datum, notice: "User datum was successfully updated." } format.json { render :show, status: :ok, location: @user_datum } else format.html { render :edit, status: :unprocessa...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update(data = :object || :json)\n end", "def patch(path, data)\n request 'PATCH', path, body: data.to_json\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "d...
[ "0.66799843", "0.66341454", "0.6525933", "0.64977485", "0.64832723", "0.6414158", "0.6386674", "0.63665986", "0.6347986", "0.6345447", "0.6342465", "0.6338281", "0.6335466", "0.6331618", "0.63248235", "0.63248235", "0.6318979", "0.6309398", "0.63072675", "0.6304795", "0.63014...
0.0
-1
DELETE /user_data/1 or /user_data/1.json
def destroy @user_datum.destroy respond_to do |format| format.html { redirect_to user_data_url, notice: "User datum was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def api_delete(path, data = {})\n api_request(:delete, path, :data...
[ "0.6954161", "0.6814292", "0.6808612", "0.68081546", "0.68003434", "0.6735224", "0.6734582", "0.6662326", "0.66461825", "0.6642424", "0.65716904", "0.656454", "0.65581125", "0.6552557", "0.6540004", "0.6539716", "0.6528868", "0.65281063", "0.6513656", "0.649401", "0.6475589",...
0.6544878
14
Use callbacks to share common setup or constraints between actions.
def set_user_datum @user_datum = UserDatum.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 user_datum_params params.require(:user_datum).permit(:owner_id, :full_name, :religion, :political_affiliation, :height, :hometown, :age, :job_title, :school, :gender, :drinking, :smoking, :undergrad_school, :daily_photo_reveals, :interested_in_men, :interested_in_women, :interested_in_men_and_women) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
Override with your own usage banner.
def banner "Usage: #{$0} salva_scaffold ModelName [ControllerName]" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def usage; end", "def usage; end", "def banner\n \"#{basename} #{self_command.formatted_usage(self, false)}\"\n end", "def display_usage\n end", "def print_usage; end", "def banner\n unless @banner\n @banner = +\"Usage: #{program_name} [options]\"\n visit(:add_banner, @banner)\n ...
[ "0.7710316", "0.7710316", "0.7697554", "0.7587186", "0.7539476", "0.7451061", "0.7229624", "0.71674734", "0.70253825", "0.7023844", "0.6986619", "0.6954408", "0.6836677", "0.6796711", "0.6765467", "0.67318904", "0.67304283", "0.6592271", "0.65819216", "0.65733546", "0.6547449...
0.0
-1
Return the user's current cart, pulled alternately from session or from the user's record as necessary TODO: this should not find carts that are already paid for!
def current_cart return Cart.find(session[:current_cart]) if session[:current_cart] return Cart.find_by_user_id(current_user.id) if logged_in? rescue ActiveRecord::RecordNotFound clear_cart nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_cart\n #ORDER_ID IN PARAMS BECAUSE HAVE EMAIL SEND IN PAST\n cart_id_session = session[:cart_id]\n cart_id_params = params[:cart_id]\n cart_id_legacy = params[:order_id]\n\n cart = @user.carts.find_by_id(cart_id_params) if @user && cart_id_params\n cart = @user.carts.find_by_legacy_i...
[ "0.81345105", "0.80564964", "0.7979261", "0.78786093", "0.78672004", "0.78590107", "0.78376716", "0.78329825", "0.78301275", "0.7799203", "0.7793166", "0.7728606", "0.76618004", "0.7661095", "0.7656987", "0.76265574", "0.76165545", "0.7615595", "0.7599611", "0.7564105", "0.75...
0.77484876
11