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
DELETE /critiques/1 DELETE /critiques/1.json
def destroy @critique.destroy respond_to do |format| format.html { redirect_to critiques_url, notice: 'Critique was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @critic = Critic.find(params[:id])\n @critic.destroy\n\n respond_to do |format|\n format.html { redirect_to critics_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dynamique = Dynamique.find(params[:id])\n @dynamique.destroy\n\n respond_to do |...
[ "0.7159598", "0.7124697", "0.70255303", "0.6931801", "0.6877614", "0.68447155", "0.6841139", "0.6838537", "0.6811321", "0.6798597", "0.6798213", "0.67880535", "0.67880535", "0.6780399", "0.6775634", "0.6758863", "0.6741041", "0.6726524", "0.6721098", "0.6721098", "0.6721098",...
0.74114895
0
Use callbacks to share common setup or constraints between actions.
def set_critique @critique = Critique.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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def critique_params params.require(:critique).permit(:comment, :author_id, :instructor_code, :positive) 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
spaces, producing a new string that capitalizes the first letter of each word. You'll want to use the `split` and `join` methods. Also, the String method `upcase`, which converts a string to all upper case will be helpful. Difficulty: medium.
def capitalize_words(string) substrings = string.split(" ") # ["this", "is", "a", "sentence"] idx = 0 while idx < substrings.length # 1 < 4 word = substrings[idx] # word = "this" word[0] = word[0].upcase # word[0] = T idx += 1 end return substrings.join(" ") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def capitalize_words\n self.split.collect{ |s| s.capitalize_first }.join(\" \")\n end", "def word_cap2(str) # Without Using .capitalize method\n str.split.each { |word| word[0] = word[0].upcase }.join(\" \")\nend", "def capitalize_words(string)\n new = string.split\n i = 0\n first = \"\"\n str = \"\"...
[ "0.8546147", "0.8530084", "0.841012", "0.8347417", "0.8235312", "0.82296103", "0.82138264", "0.82127404", "0.8183591", "0.81624025", "0.8155938", "0.81457007", "0.81449777", "0.81426865", "0.8133022", "0.8116643", "0.81107956", "0.80997974", "0.80868214", "0.8085165", "0.8083...
0.0
-1
Created by: PuNk1nPo0p Configuration Items CONFIGURABLE FUCNTIONS DHCP
def config_dhcp system("echo > /etc/dnsmasq.leases") dhcp = File.new("conf/#@dhcpfile","w+") dhcp.puts("interface=#@interface") dhcp.puts("dhcp-range=192.168.10.5,192.168.10.20\n") dhcp.puts("dhcp-leasefile=/etc/dnsmasq.leases\n") dhcp.puts("dhcp-authoritative\n") dhcp.puts("address=/#/192.168.10.1\n") dhcp.cl...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def genConf\n conf=\"auto #{@device}\\n\"\n if (ip != nil && netmask != nil)\n conf+=%(iface #{@device} inet static\n address #{@ip}\n netmask #{@netmask}\n)\n else\n conf+=\"iface #{@device} inet dhcp\\n\"\n end\n end", "def network_objects_add_dhcp_option(rule_name,data)\n\n ...
[ "0.6231921", "0.6183075", "0.6150131", "0.59027946", "0.5898508", "0.5839992", "0.58249116", "0.5801406", "0.57784426", "0.5775252", "0.5755998", "0.5714952", "0.5708762", "0.5695828", "0.5684957", "0.5677914", "0.56335735", "0.55536103", "0.55390126", "0.5537008", "0.5484777...
0.62532276
0
A mutable Hash of the identifiers
def to_h hash = {} if doi.present? hash['doi'] = doi hash['doi_uri'] = doi_uri end if isbn.present? hash['isbn'] = isbn hash['isbn_uri'] = isbn_uri end if issn.present? hash['issn'] = issn hash['issn_uri'] = issn_uri end if pmid.present? ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def identifiers_hash\n @identifiers_hash ||= {:default => [:uuid]}\n end", "def identifier_keys\n @identifier_keys ||= [:selected, model_id_key, :id].uniq\n end", "def identifier_hash(columns)\n h = {}\n columns.each{|k,v| h[Sequel.identifier(k)] = v}\n h\n end...
[ "0.823812", "0.7389313", "0.7188899", "0.715722", "0.7016341", "0.69878244", "0.6987741", "0.6954939", "0.68718064", "0.682176", "0.6818718", "0.68173563", "0.68173563", "0.68173563", "0.68173563", "0.68173563", "0.68173563", "0.68173563", "0.68173563", "0.68173563", "0.67925...
0.0
-1
Returns array of promoted products
def promoted_products promoted.is_a?(Product) ? [promoted] : promoted.products.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def products\n @products ||= rules.of_type('Spree::Promotion::Rules::Product').map(&:products).flatten.uniq\n end", "def products\n @products ||= [].tap { |prods| each { |prod| prods << prod } }\n end", "def products\n products_at_market = []\n vendors_at_market = self.vendors\n vendor...
[ "0.69522005", "0.69496435", "0.69235444", "0.68957627", "0.68411565", "0.68373275", "0.6828538", "0.6714624", "0.6593833", "0.65902936", "0.6477776", "0.6463701", "0.6439144", "0.6370237", "0.6344962", "0.62866116", "0.6282225", "0.6263252", "0.6256273", "0.6236106", "0.62349...
0.87355983
0
Responds with the 10 most recent commits. Routes `GET /projects/:project_id/commits` Path Parameters | | | |:|:| | `project_id` | The Project's slug. |
def index @commits = @project.repo.log(10) respond_with @commits end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commits(project, options={})\n get(\"/projects/#{project}/repository/commits\", :query => options)\n end", "def commits(project, options={})\n get(\"/projects/#{project}/repository/commits\", :query => options)\n end", "def commits\n if !@commits\n @commits = []\n x = 0\n...
[ "0.75569046", "0.75569046", "0.7224693", "0.71272093", "0.7126948", "0.7035777", "0.70214987", "0.6998514", "0.69436055", "0.69107443", "0.6883566", "0.67904717", "0.67523825", "0.66985923", "0.66677064", "0.6648333", "0.6631141", "0.6593306", "0.65392375", "0.6479969", "0.64...
0.72951037
2
Execute KeyReaderOn subcommand taking input from a input stream and writing to output stream sample: output.puts 'OK'
def execute(input: $stdin, output: $stdout) heading 'Only press [a,s,d,f or x]' reader = TTY::Reader.new exiting = false reader.on(:keypress) do |event| prompt.say event.value if event.value == 'a' prompt.warn event.value if event.value == 's' prompt.erro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_command_with_input(local_run_method, shell_command, input_query, response=nil)\n send(local_run_method, shell_command, {:pty => true}) do |channel, stream, data|\n if data =~ input_query\n if response\n logger.info \"#{data} #{\"*\"*(rand(10)+5)}\", channel[:host]\n channel.send_d...
[ "0.6443703", "0.6274194", "0.6260292", "0.60034627", "0.59992087", "0.5968706", "0.5848485", "0.5848262", "0.58448535", "0.58301157", "0.57806826", "0.5774287", "0.5774287", "0.5756984", "0.5756014", "0.57405466", "0.5738151", "0.57350624", "0.5711313", "0.5658391", "0.562275...
0.64539135
0
validates :trackid, :uniqueness => true
def transform_data latitude = self.latitude longitude = self.longitude tempLat = latitude/100 floatLat = (latitude - (tempLat.to_i * 100))/60 lat = tempLat.to_i + floatLat tempLng = longitude/100 floatLng = (longitude - (tempLng.to_i * 100))/60 lng = tempLng.to_i + floatLng self.latitude = lat self...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video_is_unique\n if self.new_record? && self.external_id.present? && Video.where(:external_id => self.external_id, :type => self.class.to_s).count > 0\n self.errors.add(:external_id, 'is not unique')\n false\n else\n true\n end\n end", "def validate_challonge_id_uniqueness\n ...
[ "0.6490942", "0.63275623", "0.6302792", "0.6287983", "0.61452895", "0.61328703", "0.60954905", "0.6042144", "0.5920416", "0.5894913", "0.5876326", "0.5818779", "0.5818179", "0.5754577", "0.57409155", "0.57376325", "0.5736595", "0.5726274", "0.5726274", "0.5724781", "0.5722154...
0.0
-1
method to check if user has already favorited this piece
def user_has_favorite(image_id) if self.favorites.find_by(image_id: image_id) return true else return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def favorited_by?(user)\n favorites.where(user_id: user.id).exists?\n end", "def favoriter?\n true\n end", "def favoring?(article)\n favorites.include?(article)\n end", "def favored?(user_id)\n return self.favorites.exists?(user_id: user_id)\n end", "def favorited_by?(...
[ "0.8082293", "0.7981697", "0.77382874", "0.77355254", "0.7731051", "0.7710035", "0.76383007", "0.75768346", "0.7531411", "0.75009125", "0.74889743", "0.74695444", "0.7443938", "0.7434947", "0.73459345", "0.7259719", "0.7241759", "0.7226604", "0.722571", "0.7207989", "0.720309...
0.7485066
11
Get a github user object
def valid_user?(repo, options = {}) response = get(repo.public_users_path, options) if response[:id].present? true else raise Github::UserNotFound, [NO_USER, '[', response[:message].to_s, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user(user, use_ssl=false) \n url = @base_url + \"/#{user}\"\n GitHub::User.new(JSON.parse(open(url).read)[\"user\"])\n end", "def github\n self.account.blank? ? nil : GitHub::API.user(self.account)\n end", "def fetch!\n github_user = client.user(login)\n\n @name = (gi...
[ "0.7875538", "0.76323634", "0.7493792", "0.7484502", "0.7340265", "0.7179132", "0.71397495", "0.71397495", "0.7050854", "0.7014028", "0.6929964", "0.68949854", "0.68262166", "0.67280555", "0.66641104", "0.6604106", "0.6590555", "0.6534809", "0.6534158", "0.65304", "0.6526333"...
0.0
-1
Get a github user public repositories
def repositories(repo, options = {}) paginate repo.public_user_repos_path, options if valid_user?(repo) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_public_repos(user_name)\n get(\"/users/#{user_name}/repos\")\n end", "def user_repos\n @repos = @github.repos.list user: params[:username]\n render json: @repos\n end", "def get_all_user_repos\n user = User.find_by(uuid: params[:uuid])\n\n client = Octokit::Client.new(:access_token...
[ "0.84862965", "0.7693896", "0.7677439", "0.7582981", "0.742619", "0.73417765", "0.7292514", "0.7260511", "0.7203811", "0.7194732", "0.71930856", "0.71093076", "0.7077832", "0.7054728", "0.70321697", "0.7010082", "0.70060796", "0.6994676", "0.69861174", "0.6914498", "0.6912887...
0.6823464
25
not exceed four million, find the sum of the evenvalued terms. Project Eulers problem
def fib sum = 0 a = 1 b = 2 while b < 4000000 sum += b if b % 2 == 0 a, b = b, a + b # sum += b if b % 2 == 0 end puts sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute_sum_of_threes_and_fives\r\n sum = 0\r\n (1...1000).each do |n|\r\n sum += n if n % 3 == 0 || n % 5 == 0\r\n end\r\n sum\r\nend", "def euler002\n sum = 0\n fib = [1, 1]\n while fib[1] < 4e6\n sum += fib[1] if fib[1].even?\n fib = [fib[1], fib[0] + fib[1]]\n end\n sum\nend", "def eu...
[ "0.709411", "0.70898646", "0.70698404", "0.69408125", "0.67774", "0.6761479", "0.67299026", "0.669496", "0.66533184", "0.6651337", "0.6627234", "0.66201764", "0.6519001", "0.64643544", "0.64502245", "0.6431253", "0.64165205", "0.64133847", "0.6409346", "0.6408848", "0.6408613...
0.0
-1
Fibonacci with users input
def fib(num) sequence = [1,2] if num < 2 num else 0.upto(num) do sequence << sequence[-1] + sequence[-2] end end sequence end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nthFibonacci (n)\n # Your code here \nend", "def q9_fibonacci(num)\n f1 = 0\n f2 = 1\n (num-1).times {|_|\n tmp = f2\n f2 += f1 \n f1 = tmp\n }\n f2\nend", "def iterative_fib(num)\r\n a = 0\r\n b = 1\r\n\r\n num.to_i.times do\r\n temp = a\r\n a = b\r\n # Add up previous two nu...
[ "0.7795879", "0.778234", "0.77184296", "0.7703662", "0.7700521", "0.76786286", "0.76730895", "0.76722455", "0.7665801", "0.76640683", "0.7661655", "0.76547974", "0.7653819", "0.7650809", "0.7641655", "0.7621889", "0.76051176", "0.75930727", "0.75813776", "0.7576644", "0.75764...
0.0
-1
return batch name by concating course name,batch name and section name
def batch_name [batch.course.course_name, batch.course.section_name, batch.name].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_job_name(course, assessment, submission)\n \"#{course.name}_#{assessment.name}_#{submission.version}_#{submission.course_user_datum.email}\"\n end", "def student_batch_names student_rec, report_hash = nil\n report_hash ||= @report_hash\n batch_ids = student_rec.batch_ids.split(\",\").map(&:to_i...
[ "0.65549356", "0.6502605", "0.6430337", "0.62331176", "0.6091681", "0.5973774", "0.5869564", "0.56881064", "0.56794626", "0.56547433", "0.5580081", "0.5580081", "0.55639327", "0.55283594", "0.54971176", "0.5449642", "0.5402243", "0.5359801", "0.535869", "0.5355664", "0.534270...
0.8688928
0
return student name by concating first name and last name
def student_name [first_name, last_name].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name \n [first_name, last_name].join(' ')\n end", "def stud_full_name\n [first_name, middle_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(' ')\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [...
[ "0.8252499", "0.8249234", "0.8237493", "0.8236949", "0.8236949", "0.8236949", "0.8236949", "0.8236949", "0.8236949", "0.82314503", "0.82314503", "0.82314503", "0.82314503", "0.82314503", "0.82019496", "0.81840754", "0.8182047", "0.81800866", "0.817893", "0.8170821", "0.817082...
0.87044096
0
return student full name by concating first_name, middle_name, last_name
def stud_full_name [first_name, middle_name, last_name].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n \"#{first_name} #{middle_name} #{last_name}\".split.join(' ')\n end", "def full_name\n \"#{last_name}, #{first_name} #{middle_name}\"\n end", "def full_name\n # if @middle_name.nil?\n # \"#{@first_name} #{@last_name}\"\n # else\n # \"#{@first_name} #{@middle_name...
[ "0.8798347", "0.8685326", "0.86520857", "0.8630799", "0.85790366", "0.8555565", "0.8543826", "0.85417336", "0.8537739", "0.8537739", "0.8537739", "0.8537739", "0.8537739", "0.8531443", "0.8531443", "0.8531443", "0.8531443", "0.8531443", "0.8531443", "0.8529863", "0.8509605", ...
0.868176
2
return address line by concating address_line1, address_line2
def address_line [address_line1, address_line2].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_1\n [address1, address2].compact.join(', ')\n end", "def address_one_line\n \"%s, %s, %s %s\" % [self.address_line_1, self.city, self.state_abbr, self.zipcode]\n end", "def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end", "def full_bill_add...
[ "0.79598075", "0.78419673", "0.7297608", "0.7281159", "0.7247614", "0.7234268", "0.7231813", "0.70132226", "0.7007375", "0.69762504", "0.6940144", "0.68789685", "0.67181355", "0.6711178", "0.6711178", "0.67020357", "0.6690068", "0.66590476", "0.66398567", "0.6594575", "0.6590...
0.89568585
0
return address line by concating first_name,last_name,relation
def guard_name(p) [p.first_name, p.last_name, p.relation].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def address_line\n [address_line1, address_line2].join(' ')\n end", "def address\n [address_line_1, address_line_2, town_city, county, postcode].join(\", \")\n end", "def address_one_line\n \"%s, %s, %s %s\" % [self.address_line_1, self.city, self.state_abbr, self.zipcode]\n end", "def addres...
[ "0.7836422", "0.7586697", "0.7412798", "0.73997885", "0.7320136", "0.7229983", "0.7229608", "0.7203474", "0.7143867", "0.7111868", "0.70697004", "0.70476174", "0.7011231", "0.6997576", "0.6971296", "0.69564515", "0.6888943", "0.6817128", "0.6797572", "0.67970425", "0.6785954"...
0.0
-1
This method for create archived student, get all student attributes add student id, call create method on ArchivedStudent and pass student attributes and create archived student
def archived_student student_attributes = attributes student_attributes['student_id'] = id archived_student = ArchivedStudent.create(student_attributes) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\t#for each student, create student params\n\t\t@student = Student.create!(student_params)\n\t\t#once created, go back to students path\n\t\tredirect_to students_path\n\t#wrap up \"create\" action\n\tend", "def create\n\t\tp = params[:student]\n\t\thash = { :original_name => p['original_name'], :so...
[ "0.6380484", "0.62992287", "0.6212919", "0.6199238", "0.59618765", "0.59562683", "0.58378446", "0.5834855", "0.5790845", "0.57681096", "0.5765636", "0.57454556", "0.5740708", "0.5728998", "0.57254654", "0.57234883", "0.5716555", "0.5708038", "0.56931305", "0.56875867", "0.568...
0.8518651
0
return full name by concating first_name,last_name
def full_name [first_name, last_name].join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join(\" \")\n end", "def full_name\n [first_name, last_name].join...
[ "0.9133307", "0.9133307", "0.9133307", "0.9133307", "0.9133307", "0.9133307", "0.91289866", "0.9123486", "0.9031406", "0.9013353", "0.8985748", "0.89785814", "0.89785814", "0.8952526", "0.8945029", "0.8945029", "0.89442503", "0.8942452", "0.89282495", "0.89191985", "0.8916969...
0.91221565
11
This method for send mail to user
def mail(subject, recipient, message) user = User.discover(id, recipient).take UserMailer.student_email(user, subject, message).deliver end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mail(user)\n @greeting = \"Hi #{user.name}\"\n\n mail to: user.email\n end", "def mail_sent_to_admin(user)\n subject \"4D Techlab - New user\"\n from \"4d Techlab Notifier <noreply@4dtechlab.com>\"\n headers \"Reply-to\" => \"info@4dtechlab.com\"\n recipients 'pavel.krusek@gmail.com'\...
[ "0.78462076", "0.78249824", "0.7725268", "0.77233255", "0.7713617", "0.76585317", "0.7657622", "0.7646666", "0.76213133", "0.76076305", "0.7603339", "0.7599248", "0.75824904", "0.7564698", "0.7552426", "0.7536497", "0.75359446", "0.75328124", "0.75315064", "0.7512261", "0.747...
0.0
-1
Fetch the record from student according to selected exam and student.
def exam_scores(exam) ExamScore.where(exam_id: exam, student_id: id).take end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_student\n @student = Student.find(params[:student_id])\n end", "def qualified_student\n @company = Company.find(params[:id])\n @placement_exam = PlacementExam.find(params[:exam_id])\n @score = StudentScore.where(placement_exams_id: @placement_exam)\n @student_score = @score.where(is_quali...
[ "0.6659264", "0.65365237", "0.65326023", "0.6470881", "0.6449267", "0.6398209", "0.63755023", "0.633198", "0.63067865", "0.6274839", "0.622926", "0.621878", "0.6106125", "0.61047596", "0.60893", "0.60867697", "0.6067669", "0.60662705", "0.6056543", "0.6052414", "0.6043801", ...
0.65419143
1
GET /food_reviews GET /food_reviews.json
def index @food_reviews = FoodReview.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def review\n fetch('restaurant.review')\n end", "def index\n @reviews = Review.all\n\n respond_to do |format|\n format.html # inde...
[ "0.75177515", "0.7284525", "0.71237177", "0.71237177", "0.7076798", "0.7045581", "0.7045581", "0.69951266", "0.697693", "0.69609267", "0.69285566", "0.6906874", "0.68381965", "0.68098444", "0.68027055", "0.6754488", "0.67537224", "0.67406785", "0.67406785", "0.67406785", "0.6...
0.73675686
1
GET /food_reviews/1 GET /food_reviews/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @reviews = reviewable.reviews\n\n respond_to do |format|\n format.html\n format.json { render json: @reviews }\n end\n end", "def index\n @food_reviews = FoodReview.all\n end", "def review\n fetch('restaurant.review')\n end", "def index\n @reviews = Review.a...
[ "0.73940563", "0.7161582", "0.70875865", "0.7083965", "0.7083965", "0.70294094", "0.70294094", "0.7028331", "0.6941543", "0.6930515", "0.69232655", "0.6914518", "0.68677205", "0.6855593", "0.6855593", "0.6855593", "0.6855593", "0.6855593", "0.68094176", "0.6743258", "0.673248...
0.0
-1
POST /food_reviews POST /food_reviews.json
def create @food_review = FoodReview.new(food_review_params) respond_to do |format| if @food_review.save format.html { redirect_to @food_review, notice: 'Food review was successfully created.' } format.json { render :show, status: :created, location: @food_review } else form...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @review = Review.new(review_params)\n\n if @review.save\n render json: @review, status: :created, location: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\n end", "def create\n @review = Review.new(review_params)\n\n if @review.save\n ...
[ "0.7070475", "0.7070475", "0.7070475", "0.69039476", "0.6857917", "0.68079317", "0.6790586", "0.67893595", "0.67893595", "0.6780928", "0.6770462", "0.6749413", "0.67441875", "0.6734356", "0.6710058", "0.6676536", "0.66659445", "0.6665823", "0.6659288", "0.6571034", "0.6559571...
0.7538779
0
PATCH/PUT /food_reviews/1 PATCH/PUT /food_reviews/1.json
def update respond_to do |format| if @food_review.update(food_review_params) format.html { redirect_to @food_review, notice: 'Food review was successfully updated.' } format.json { render :show, status: :ok, location: @food_review } else format.html { render :edit } forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @review = Review.find(params[:id])\n @review.update(review_params)\n render json: @review\n end", "def update\n if @review.update(review_params)\n render json: @review\n else\n render json: @review.errors, status: :unprocessable_entity\n end\nend", "def update\n @review...
[ "0.73301744", "0.6935673", "0.68173677", "0.68173677", "0.68173677", "0.6748366", "0.67265344", "0.6676892", "0.66646177", "0.66646177", "0.66646177", "0.66646177", "0.6622598", "0.6622598", "0.6622598", "0.6555501", "0.655078", "0.65446776", "0.65446776", "0.65446776", "0.65...
0.69724214
1
DELETE /food_reviews/1 DELETE /food_reviews/1.json
def destroy @food_review.destroy respond_to do |format| format.html { redirect_to food_reviews_url, notice: 'Food review was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _reviews_delete(id)\n delete id.to_s\n _response_status(204, last_response)\n end", "def destroy\n @review.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @review = Review.find(params[:id])\n @review.destroy\n\n respond_to do |...
[ "0.7400669", "0.7306523", "0.7283023", "0.7283023", "0.7283023", "0.7283023", "0.7283023", "0.7274549", "0.72613704", "0.72592324", "0.72145134", "0.72145134", "0.72145134", "0.72042155", "0.7134909", "0.70703477", "0.701038", "0.69972694", "0.69813305", "0.6980717", "0.69769...
0.7336884
1
Use callbacks to share common setup or constraints between actions.
def set_food_review @food_review = FoodReview.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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def food_review_params params.require(:food_review).permit(:food_id, :user_id, :title, :body, :rating) 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
TODO: Encapsulate in class (subclass of `Project`) ============================================================================= xcodeproj utilities =============================================================================
def target(project, name, platform, isTest) test_suffix = isTest ? ' Tests' : '' target_name = "#{name} #{platform}#{test_suffix}" return project.targets.find { |x| x.name == target_name } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project; end", "def project_filename; end", "def xcodeproj(path)\n proejct_filename = File.join(self.root_path, path)\n self.project = Xcodeproj::Project.open(proejct_filename)\n self.validate_project\n end", "def project=(_arg0); end", "def projects ; end", "def lookup_proj...
[ "0.71561325", "0.71122", "0.7054454", "0.68078035", "0.6654884", "0.65467733", "0.6426544", "0.6405592", "0.6405592", "0.63296765", "0.6293343", "0.61944616", "0.61944616", "0.61682665", "0.60702324", "0.60609657", "0.6013979", "0.60042", "0.5997365", "0.5979841", "0.59429425...
0.0
-1
============================================================================= update frameworks command =============================================================================
def update_frameworks(name) path = "#{Dir.pwd}/#{name}.xcodeproj" if !Dir.exist?(path) then puts "No project!" return end update_carthage() inject_frameworks(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_the_framework\n if repo_is_clean?\n pull_latest_changes and run 'reload_dots'\n else\n say \"You have uncommitted changes in ~/.dots. Please resolve them before updating.\"\n end\n end", "def update\n install\n end", "def prebuild_frameworks!\n UI.puts \"Star...
[ "0.6626899", "0.6470579", "0.6386194", "0.63723546", "0.6316917", "0.628257", "0.62791884", "0.6206007", "0.61999154", "0.6192638", "0.6192638", "0.6180442", "0.6142414", "0.61043406", "0.60649127", "0.60573715", "0.6038833", "0.60342383", "0.60022014", "0.6001513", "0.599975...
0.74874943
0
Create and return embed frameworks phase for a given target
def create_embed_frameworks_phase(project, t) t.build_phases.delete_if { |phase| phase.to_s == 'Embed Frameworks' } embed_frameworks_build_phase = project.new( Xcodeproj::Project::Object::PBXCopyFilesBuildPhase ) embed_frameworks_build_phase.name = 'Embed Frameworks' embe...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_embed_frameworks_script_phase\n unless target.includes_frameworks? || (target.xcframeworks_by_config.values.flatten.any? { |xcf| xcf.build_type.dynamic_framework? })\n native_targets_to_embed_in.each do |native_target|\n TargetIntegrator.remove_embed_frameworks_script_phase...
[ "0.72488064", "0.67909", "0.66156787", "0.64635444", "0.6042001", "0.5932285", "0.5894258", "0.5770955", "0.57508886", "0.5611607", "0.54606444", "0.5453748", "0.5453331", "0.53897834", "0.5338016", "0.524196", "0.51932377", "0.51563096", "0.51332104", "0.5131038", "0.5124780...
0.73676276
0
TODO: Add knowledge of frameworks!
def add_framework_search_paths(project, name) ['iOS', 'macOS'].each do |platform| [true, false].each do |isTest| t = target(project, name, platform, isTest) # Add carthage build dir to framework search paths t.build_configuration_list.set_setting( 'FRAMEWORK_S...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_frameworks; end", "def framework\n @framework\n end", "def framework_name; registered_framework_name; end", "def backends; end", "def apis; end", "def framework\n\t\treturn self.class.framework\n\tend", "def libs; end", "def framework\n\t\treturn driver.framework\n\tend", "def ...
[ "0.6664214", "0.65824264", "0.6384349", "0.6376408", "0.6360237", "0.6334028", "0.6286079", "0.619353", "0.61621326", "0.6158426", "0.6073428", "0.6073428", "0.6065182", "0.6057024", "0.6031867", "0.6007493", "0.59932894", "0.59932894", "0.59932894", "0.59720093", "0.5967684"...
0.0
-1
Add carthage run script for test targets
def create_carthage_script_phase_for_test_targets(project, name) frameworks.each do |platform, fs| t = target(project, name, platform, true) add_carthage_script(t, platform, fs) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub_test\n shell(test_script, source_dir)\n end", "def run_test\n # Add your code here...\n end", "def run_test\n # Add your code here...\n end", "def test\n if phase.has_key?('test')\n execute(\"test\", phase['test'])\n end\n end", "def run_all\n deploy_code\n run...
[ "0.62426376", "0.6121004", "0.6121004", "0.59433067", "0.5913195", "0.5904674", "0.5753883", "0.5745802", "0.5713441", "0.5693925", "0.56907964", "0.5636155", "0.5636155", "0.5617745", "0.5609203", "0.55986077", "0.5573574", "0.55606526", "0.55578953", "0.5553938", "0.5545762...
0.79064566
0
Take ['iOS', 'macOS'] platform
def carthage_build_path(platform, framework) return "#{carthage_build_dir_for_platform(platform)}/#{framework}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platforms; platform_names; end", "def os\n app = app_with_comments\n if app\n if IDEVICES.include?(app.comment[0]) && app.comment[1]\n return OperatingSystems.normalize_os(app.comment[1])\n elsif matches = OSX_VERSION_REGEX.match(app.comment[0])\n return ...
[ "0.75937295", "0.7515642", "0.75137275", "0.75102806", "0.74890834", "0.74798405", "0.7445698", "0.7416614", "0.740889", "0.73831546", "0.7313855", "0.7269415", "0.722506", "0.72194254", "0.7204331", "0.71786475", "0.7167864", "0.715365", "0.71140856", "0.70892435", "0.706900...
0.0
-1
============================================================================= init command =============================================================================
def init(name, platforms, type) # Create environment git_init(name) config(name, platforms) create_file_structure(name) # Create xcodeproj project = new_project(name) configure_PBXGroups(project, name) create_info_plists(name, type, platforms) add_info_plist_refs(project, name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init\n end", "def init\n end", "def init\n end", "def init; end", "def init; end", "def init; end", "def init; end", "def init\n\n end", "def init; end", "def init\n\nend", "def local_init(args)\n end", "def at_init\n\n\t\tend", "def initialize\n init\n end", "d...
[ "0.805405", "0.805405", "0.805405", "0.79499507", "0.79499507", "0.79499507", "0.79499507", "0.792037", "0.7665683", "0.7575554", "0.73890775", "0.7383199", "0.736137", "0.73403835", "0.7293035", "0.728186", "0.72603357", "0.7167495", "0.71166575", "0.7100308", "0.7100308", ...
0.0
-1
============================================================================= Build Configuration TODO: Add platform variables =============================================================================
def configure_build_configuration_settings(project, name, platforms) configure_project_build_configuration_settings(project, name) configure_primary_build_configuration_settings(project, name, platforms) configure_tests_build_configuration_settings(project, name, platforms) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_platform_opts\n\n # Expand any embedded variables (like '$(CC)')\n CONFIG[\"CC\"] = RbConfig::CONFIG[\"CC\"]\n CONFIG[\"LDSHARED\"] = RbConfig::CONFIG[\"LDSHARED\"]\n\n # Make sure we have a CXX value (sometimes there isn't one)\n CONFIG[\"CXX\"] = CONFIG[\"CC\"] unless CONFIG.has_key?(\"CXX\")\n\n #...
[ "0.7222987", "0.6704186", "0.67020243", "0.6516634", "0.65149933", "0.64355963", "0.6359481", "0.63090354", "0.6282963", "0.6248473", "0.61816233", "0.6145808", "0.6120117", "0.6089048", "0.60685605", "0.60487396", "0.60435796", "0.603958", "0.6039442", "0.6026411", "0.602641...
0.6936188
1
TODO: Add platform variables
def configure_primary_build_configuration_settings(project, name, platforms) platforms.each do |platform| # FIXME: abstract away target = project.targets.find { |y| y.name == "#{name} #{platform}" } settings = { 'INFOPLIST_FILE' => "#{name}/Info.plist", 'ALWAYS_EMB...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform; end", "def platform; end", "def platform; end", "def host_os; end", "def host_os; end", "def user_os_complex\r\n end", "def platform_end_point; end", "def platform\n data.platform\n end", "def platform\n raise NotImplementedError\n end", "def platform\n raise NotImplemen...
[ "0.75981045", "0.75981045", "0.75981045", "0.73639333", "0.73639333", "0.69489855", "0.6922734", "0.6689873", "0.66745454", "0.66745454", "0.662752", "0.6517895", "0.65144217", "0.6503693", "0.6451415", "0.6363022", "0.6353111", "0.63466793", "0.6302391", "0.6302035", "0.6297...
0.0
-1
TODO: Add platform variables
def configure_tests_build_configuration_settings(project, name, platforms) platforms.each do |platform| target = project.targets.find { |y| y.name == "#{name} #{platform} Tests" } settings = { 'INFOPLIST_FILE' => "#{name}Tests/Info.plist", 'COMBINE_HIDPI_IMAGES' => 'YES' ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform; end", "def platform; end", "def platform; end", "def host_os; end", "def host_os; end", "def user_os_complex\r\n end", "def platform_end_point; end", "def platform\n data.platform\n end", "def platform\n raise NotImplementedError\n end", "def platform\n raise NotImplemen...
[ "0.75981045", "0.75981045", "0.75981045", "0.73639333", "0.73639333", "0.69489855", "0.6922734", "0.6689873", "0.66745454", "0.66745454", "0.662752", "0.6517895", "0.65144217", "0.6503693", "0.6451415", "0.6363022", "0.6353111", "0.63466793", "0.6302391", "0.6302035", "0.6297...
0.0
-1
============================================================================= Schemes ============================================================================= TODO: Add platform variables
def configure_schemes(project, name, platforms) share_schemes(project, name, platforms) add_testable_entries(project, name, platforms) Xcodeproj::Project.schemes("#{Dir.pwd}/#{$project_name}.xcodeproj").each do |scheme| puts "Scheme: #{scheme}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform; end", "def platform; end", "def platform; end", "def platform_end_point; end", "def host_os; end", "def host_os; end", "def platform\n raise NotImplementedError\n end", "def platform\n raise NotImplementedError\n end", "def platform\n @platform ||= data.platform\n end", ...
[ "0.7431254", "0.7431254", "0.7431254", "0.68219864", "0.67604244", "0.67604244", "0.64754045", "0.64754045", "0.6424095", "0.6402923", "0.6273314", "0.6273209", "0.62716484", "0.6249996", "0.61517674", "0.6144414", "0.61325985", "0.6122832", "0.61068535", "0.60787654", "0.606...
0.0
-1
TODO: Add platform variables
def add_testable_entries(project, name, platforms) platforms.each do |platform| # FIXME: abstract away target = project.targets.find { |y| y.name == "#{name} #{platform} Tests" } # Scheme scheme_name = "#{name} #{platform}.xcscheme" scheme_path = "#{Dir.pwd}/#{name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform; end", "def platform; end", "def platform; end", "def host_os; end", "def host_os; end", "def user_os_complex\r\n end", "def platform_end_point; end", "def platform\n data.platform\n end", "def platform\n raise NotImplementedError\n end", "def platform\n raise NotImplemen...
[ "0.75981045", "0.75981045", "0.75981045", "0.73639333", "0.73639333", "0.69489855", "0.6922734", "0.6689873", "0.66745454", "0.66745454", "0.662752", "0.6517895", "0.65144217", "0.6503693", "0.6451415", "0.6363022", "0.6353111", "0.63466793", "0.6302391", "0.6302035", "0.6297...
0.0
-1
TODO: Add platform variables
def share_schemes(project, name, platforms) project.recreate_user_schemes(true) platforms.each do |platform| Xcodeproj::XCScheme.share_scheme( "#{Dir.pwd}/#{name}.xcodeproj", "#{name} #{platform}" ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def platform; end", "def platform; end", "def platform; end", "def host_os; end", "def host_os; end", "def user_os_complex\r\n end", "def platform_end_point; end", "def platform\n data.platform\n end", "def platform\n raise NotImplementedError\n end", "def platform\n raise NotImplemen...
[ "0.75981045", "0.75981045", "0.75981045", "0.73639333", "0.73639333", "0.69489855", "0.6922734", "0.6689873", "0.66745454", "0.66745454", "0.662752", "0.6517895", "0.65144217", "0.6503693", "0.6451415", "0.6363022", "0.6353111", "0.63466793", "0.6302391", "0.6302035", "0.6297...
0.0
-1
============================================================================= Header TODO: iOS macOS / framework / app options =============================================================================
def configure_header(project, name, platforms) header_path = "#{name}/#{name}.h" create_empty_header(header_path) add_header_build_files(project, name, header_path, platforms) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ios; end", "def darwin_app_list; end", "def flutter_additional_macos_build_settings(target)\n return unless target.platform_name == :osx\n\n # [target.deployment_target] is a [String] formatted as \"10.8\".\n deployment_target_major, deployment_target_minor = target.deployment_target.match(/(\\d+).?(\\d...
[ "0.7002533", "0.69334584", "0.6382068", "0.6360737", "0.6341288", "0.6339661", "0.612207", "0.60993975", "0.6039311", "0.595974", "0.5949691", "0.5907015", "0.5897262", "0.5870247", "0.58366776", "0.5823192", "0.5797988", "0.57979316", "0.57959914", "0.5767673", "0.5764892", ...
0.0
-1
============================================================================= Supporting Files =============================================================================
def add_info_plist_refs(project, name) [name, "#{name}Tests"].each do |group| project[group]["Supporting Files"].new_file("#{group}/Info.plist") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_utils; end", "def applicable_files; end", "def ext; end", "def ext; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def files; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file; end", "def file...
[ "0.74709255", "0.7048244", "0.69896746", "0.69896746", "0.68720853", "0.68720853", "0.68720853", "0.68720853", "0.68720853", "0.68720853", "0.6698871", "0.6698871", "0.6698871", "0.6698871", "0.6698871", "0.6698871", "0.6698871", "0.6698871", "0.6698871", "0.6698871", "0.6698...
0.0
-1
The contents shared between all Info.plist files
def shared_plist_contents return %{ <?xml version=\"1.0\" encoding=\"UTF-8\"?> <!DOCTYPE plist PUBLIC \"-//Apple//DTD PLIST 1.0//EN\" \"http://www.apple.com/DTDs/PropertyList-1.0.dtd\"> <plist version=\"1.0\"> <dict> <key>CFBundleDevelopmentRegion</key> <string>en</string> <k...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plist; nil; end", "def plist; nil; end", "def plist name\n File.open(File.dirname(__FILE__) + \"/plist/#{name}.plist\").read\nend", "def catalogs\n [\"#{unit.id}-#{environment}.plist\"]\n end", "def darwin_app_list; end", "def library_start\n @filehandle << '<plist version=\"1.0\">'\n end", ...
[ "0.6248895", "0.6248895", "0.6129528", "0.60107726", "0.59194976", "0.5756413", "0.5723393", "0.5705737", "0.567256", "0.562804", "0.55611014", "0.5556367", "0.5550824", "0.54985815", "0.5456939", "0.5430736", "0.54177177", "0.5412402", "0.5385502", "0.5375716", "0.53627336",...
0.78392583
0
============================================================================= config command =============================================================================
def config(name, platforms=['iOS', 'macOS']) create_gitignore create_travis(name, platforms) create_swift_lint create_hound create_cartfile create_readme(name, platforms) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config(command)\n ensure_mode(:configuration)\n run(command)\n end", "def config\n\n end", "def configure\n send_command \"--configure\"\n end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config; end", "def config...
[ "0.75934464", "0.74749494", "0.74286187", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336", "0.74194336"...
0.0
-1
TODO: Store build hardware, OS versions, etc. in Hash somewhere
def create_travis(name, platforms) File.open('.travis.yml', 'w') { |file| file.puts("language: objective-c") file.puts("osx_image: xcode8.2") file.puts("env:") file.puts(" matrix:") platforms.each do |platform| scheme = "#{name} #{platform}" case...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_build\n if defined?(@major) and defined?(@minor) and defined?(@build) then\n return @major, @minor, @build\n else\n @major, @minor, @build = nil\n end\n search = File.join(@path, '{*/system32,{i386,amd64}}/ntdll.dll')\n ntdlls = Dir.glob(search, File::FNM_CASEFOLD)\n ...
[ "0.66311544", "0.64372253", "0.63691694", "0.6359622", "0.62425584", "0.62425584", "0.62356436", "0.62264806", "0.6184949", "0.6167968", "0.61152023", "0.6069158", "0.6001553", "0.5967427", "0.5945723", "0.59272826", "0.5911955", "0.58689505", "0.58668584", "0.5849325", "0.58...
0.0
-1
Define the variables to be used on the view
def index @message = "User List" @users = [{name: "Nitesh", age: 12}, {name: "Nilesh", age: 14}, {name: "Anil", age: 14}] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_variables\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\tLOG.debug(fname) {\">>>>params=#{params.inspect}\"}\n\t\t@views = View.all\n\t\t@current_user= current_user\n\t\t@clipboard = session[:clipboard] ||= Clipboard.new\n\t\t#LOG.info(fname) {\"**** clipboard=#{@clipboard.inspect}\"}\n\t\t@...
[ "0.7800894", "0.7029568", "0.69602466", "0.69602466", "0.69557196", "0.6905696", "0.6905696", "0.68204266", "0.6624755", "0.6621843", "0.65616715", "0.655535", "0.6541571", "0.6532885", "0.646786", "0.64578557", "0.6425996", "0.63288575", "0.6324951", "0.62523484", "0.6234432...
0.0
-1
Given a hash with numeric values, return the key for the smallest value
def key_for_min_value(name_hash) if name_hash == {} nil else number = 0 keyName = "" name_hash.each do |key, value| if number == 0 number = value keyName = key else if value < number number = value keyName = key end end end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n hash.each do |key, value|\n if value < lowest_value\n lowest_value = value\n lowest_key = key\n end\n end\n lowest_key\nend", "def key_for_min_value(hash)\n lowest_key = nil\n lowest_value = Float::INFINITY\n...
[ "0.8821222", "0.8777674", "0.87769854", "0.8745862", "0.8689437", "0.86553806", "0.865241", "0.86165065", "0.8587693", "0.8572328", "0.85674095", "0.8550907", "0.8529734", "0.8529734", "0.85182345", "0.84936565", "0.8475531", "0.8475531", "0.8466132", "0.8449126", "0.84490585...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_project @project = Project.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def project_params params.require(:project).permit( :id, :name, :information, :default_spectrum_importer, :default_spectrum_renderer, :default_spectrum_exporter) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
(surtout pour les tests de featest)
def sheets_steps= value ; @sheets_steps = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tests; end", "def tests; end", "def testing\n # ...\n end", "def my_tests\n end", "def run_fe_tests\n end", "def test_cases; end", "def test_setup\r\n \r\n end", "def generate_alltest\n\n end", "def test_case; end", "def _it( test )\n puts \"--- On saute les ...
[ "0.809055", "0.809055", "0.76526177", "0.7359371", "0.7313143", "0.73008054", "0.72761685", "0.7263683", "0.72003746", "0.7083373", "0.69354266", "0.68720907", "0.6843386", "0.6835032", "0.6834659", "0.6834659", "0.6834659", "0.6810046", "0.67965496", "0.67695856", "0.6755969...
0.0
-1
(surtout pour les tests de featest)
def users_types= value ; @users_types = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tests; end", "def tests; end", "def testing\n # ...\n end", "def my_tests\n end", "def run_fe_tests\n end", "def test_cases; end", "def test_setup\r\n \r\n end", "def generate_alltest\n\n end", "def test_case; end", "def _it( test )\n puts \"--- On saute les ...
[ "0.80903476", "0.80903476", "0.76518744", "0.73588043", "0.73147345", "0.7300437", "0.7276057", "0.7262814", "0.72000164", "0.7082415", "0.69346607", "0.6871554", "0.6843152", "0.6834736", "0.6834126", "0.6834126", "0.6834126", "0.68094325", "0.67957205", "0.6769162", "0.6755...
0.0
-1
Lists all of your available buckets in this AWS Region.
def list_my_buckets(s3) resp = s3.list_buckets() puts "My buckets now are:\n\n" resp.buckets.each do |bucket| puts bucket.name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_buckets\n puts '> AWS Buckets'.yellow\n response = s3_client.list_buckets\n buckets = response.buckets.map do |bucket|\n \"#{bucket.name.yellow} - created: #{bucket.creation_date.to_s.greenish}\"\n end\n buckets.each do |bucket|\n puts bucket\n end\n end", ...
[ "0.8178805", "0.81308746", "0.792783", "0.7919638", "0.7530339", "0.7527059", "0.74888873", "0.7478711", "0.739537", "0.7350453", "0.72634923", "0.7234411", "0.7228369", "0.7227314", "0.7221011", "0.72123104", "0.7191317", "0.71728235", "0.710109", "0.7069833", "0.70194465", ...
0.7231398
12
Used by mailboxer for notification Returns the name of the user
def mailboxer_name return "#{name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_name\n @message[:user][:name]\n end", "def user_name\n @user_name ||= SlackUtils::SingletonClient.instance.find_user_name(@user_id)\n end", "def get_user_name client, event\n # calls users_info on slack\n info = client.users_info(user: event.user_id ) \n info['user']['na...
[ "0.840913", "0.7702708", "0.7676202", "0.7648876", "0.7526545", "0.75232786", "0.7519631", "0.73160666", "0.72554845", "0.72554845", "0.72405636", "0.72232234", "0.71882683", "0.71420807", "0.7124334", "0.71108496", "0.71088994", "0.7105581", "0.7085648", "0.7072586", "0.7065...
0.7236702
11
Evaluate the actual statements; this only gets called if our test was true matched.
def evaluate(scope) @statements.safeevaluate(scope) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate\r\n @status = PASS\r\n @assert = true\r\n @num_executed = 0;\r\n @num_evaluated = 0;\r\n \r\n get_relevant_rules()\r\n logger.debug(\"no relevant rules\") if logger && @relevant_rules.size==0\r\n \r\n #begin #rescue\r\n \r\n # loop through the...
[ "0.5967849", "0.5929533", "0.59104174", "0.5854792", "0.5834043", "0.5825008", "0.5803758", "0.57987547", "0.5622532", "0.56066066", "0.5533751", "0.5506137", "0.5501207", "0.54500973", "0.53979254", "0.53959525", "0.539298", "0.5335678", "0.5316044", "0.5292249", "0.5286632"...
0.53506535
17
final image dimension in pixels
def generic_rotate90(image) # Rotates a square image 90 degrees clockwise. d = image.length new_image = d.times.map { "x"*d } (0...d).each do |r| (0...d).each do |c| new_image[c][d-1-r] = image[r][c] end end new_image end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pixel_size; size.x * size.y; end", "def image_size\n end", "def getDimensions\r\n @imageheights = @image.length\r\n @imagewidth = @image[0].length\r\n puts \"image dimensions are #{@imagewidth} by #{@imageheights}\"\r\n end", "def image_width\n end", "def width\n imag...
[ "0.7892865", "0.7533743", "0.75154054", "0.7392801", "0.7334999", "0.73347354", "0.7277525", "0.72313637", "0.71590286", "0.71006775", "0.702915", "0.7028922", "0.7012342", "0.70012635", "0.6985984", "0.6972078", "0.69568187", "0.6934424", "0.6916607", "0.68961495", "0.685281...
0.0
-1
GET /logins or /logins.json
def index @logins = Login.all #cookies[:current_user] = "user" login_user = Login.find_by_id(session[:login_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def login\n @users = User.all\n render json: User.all\n end", "def index\n @log_ins = LogIn.all\n end", "def auto_login\n render json: lo...
[ "0.6480222", "0.6480222", "0.6266379", "0.62022847", "0.6179137", "0.61561626", "0.6059948", "0.6031757", "0.6024849", "0.6019666", "0.6015887", "0.60006666", "0.59641", "0.596313", "0.59454143", "0.5909148", "0.5900606", "0.58931154", "0.58931154", "0.5892892", "0.58720505",...
0.60572714
7
GET /logins/1 or /logins/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def get_current_logged_in_user \n get(\"/users.json/current\")\nend", "def index\n @log_ins = LogIn.all\n end", "def show\n @login = Login.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n fo...
[ "0.6412586", "0.6412586", "0.61659974", "0.6117802", "0.60861313", "0.60731006", "0.60252374", "0.59696305", "0.59615123", "0.5940384", "0.5940335", "0.5905465", "0.58929425", "0.58855903", "0.5832183", "0.58051425", "0.58051425", "0.57826614", "0.57634103", "0.57561755", "0....
0.0
-1
POST /logins or /logins.json
def create @login = Login.new(login_params) if @login.save session[:login_id] = @login.id redirect_to @login, notice: 'Login successfully created.' else render :new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login(email, password)\n post api_v1_user_session_path, \n headers: { 'CONTENT_TYPE' => 'application/json', 'ACCEPT' => 'application/json' },\n params: { email: email, password: password }.to_json\nend", "def login_request(username, password)\n post(data['hosts']['auth'] + '/login', {\n ...
[ "0.65336496", "0.6514639", "0.6212515", "0.61981845", "0.6194729", "0.61927044", "0.6168025", "0.6166186", "0.613384", "0.6096967", "0.60950875", "0.6092387", "0.6067965", "0.6050574", "0.6050574", "0.5996858", "0.5984203", "0.5977975", "0.597349", "0.5973376", "0.59549457", ...
0.0
-1
DELETE /logins/1 or /logins/1.json
def destroy @login.destroy respond_to do |format| format.html { redirect_to logins_url, notice: "Login was successfully destroyed." } format.json { head :no_content } end cookies.delete(:current_user_id) @_current_user = nil flash[:notice] = "You have successfully logged out" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deleteLogin( login_id)\n params = Hash.new\n params['login_id'] = login_id\n return doCurl(\"delete\",\"/login\",params)\n end", "def destroy\n @log_in.destroy\n respond_to do |format|\n format.html { redirect_to log_ins_url, notice: 'Log in was successfully destroyed.' }\n format.j...
[ "0.7001545", "0.6752955", "0.66952646", "0.6595803", "0.6587329", "0.6456162", "0.6456162", "0.6456162", "0.6319715", "0.63193345", "0.627984", "0.6264095", "0.6207425", "0.615732", "0.61534977", "0.61534977", "0.6144432", "0.61426514", "0.61153454", "0.61153454", "0.61148983...
0.58729035
60
Use callbacks to share common setup or constraints between actions.
def set_login @login = Login.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 login_params params.require(:login).permit(:username, :password) 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
Join table with a row for every pair (where the merge request closes the given issue) with issue and merge request metrics included. The metrics are loaded with an inner join, so issues / merge requests without metrics are automatically excluded.
def base_query_for(name) # Load issues query = mr_closing_issues_table.join(issue_table).on(issue_table[:id].eq(mr_closing_issues_table[:issue_id])). join(issue_metrics_table).on(issue_table[:id].eq(issue_metrics_table[:issue_id])). where(issue_table[:project_id].eq(@project.id)). ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_metrics(merge_request)\n # There's no need to query and serialize metrics data for merge requests that are not\n # merged or closed.\n return unless merge_request.merged? || merge_request.closed?\n return merge_request.metrics if merge_request.merged? && merge_request.metrics&.merged_by_id\n ...
[ "0.5702935", "0.5232214", "0.51209027", "0.5108657", "0.50221044", "0.49976823", "0.49963763", "0.49769095", "0.48755196", "0.4859364", "0.4852905", "0.48217162", "0.48181114", "0.47997627", "0.4744386", "0.47372842", "0.47289574", "0.47193846", "0.47154626", "0.4707758", "0....
0.4334081
60
generate auth_token for authentication
def generate_auth_token! begin self.auth_token = Devise.friendly_token end while self.class.exists?(auth_token: auth_token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_auth_token\n self.auth_token = SecureRandom.hex\n end", "def generate_auth_token\n\t token = SecureRandom.hex\n\t #self.update_columns(token_key: token)\n\t token\n\t end", "def generate_authentication_token\n self.auth_token = User.new_token\n\t\t\tself.auth_expires_at = Time....
[ "0.83500016", "0.8341021", "0.8337323", "0.8313182", "0.83040786", "0.82441413", "0.822416", "0.8098335", "0.8025669", "0.79983425", "0.7993865", "0.79609555", "0.7945332", "0.7923375", "0.7921695", "0.7914691", "0.7878139", "0.7837285", "0.7832141", "0.7827728", "0.7815018",...
0.7794935
21
checks whether a user is following other user
def following?(tw_user) following.include?(tw_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?(other_user)\n following.include?(other_user)\n end", "def following?( other_user )\n followings.include?( other_user )\n end", "def following?(other_user)\n\t following.include?(other_user)\n \tend", "def following?(other_user)\n following.include?(other_user)\n ...
[ "0.8780463", "0.87361956", "0.87330455", "0.8717467", "0.8717467", "0.8717467", "0.87105423", "0.87105423", "0.87105423", "0.87105423", "0.8697731", "0.86754847", "0.86754847", "0.86754847", "0.86754847", "0.86754847", "0.86754847", "0.86754847", "0.86754847", "0.86754847", "...
0.0
-1
to avoid returning auth_token in other requests
def as_json(options = {}) super(options.merge({ except: [:auth_token, :created_at, :updated_at] })) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token\n authenticated\n end", "def tokenizing\n authenticate_api || unauthorized_api\n end", "def request_authenticity_tokens; end", "def authenticate_token\n render_401 if @token.blank? || !@token.active?\n end", "def authenticate\n # if valid_access_token?\n # fetch_access_t...
[ "0.7432605", "0.7368648", "0.73669505", "0.73584104", "0.72608393", "0.7237344", "0.72286123", "0.72220707", "0.72212994", "0.72131974", "0.72062594", "0.7201689", "0.71660066", "0.71529615", "0.71414095", "0.7140875", "0.7132955", "0.7117652", "0.7097805", "0.7086511", "0.70...
0.0
-1
This is not a thread safe operation, if you have to set new properties at runtime make sure to use a mutex.
def define_property(name, options={}) # check if this property is going to casted options[:casted] = !!(options[:cast_as] || options[:type]) property = CouchRest::Property.new(name, (options.delete(:cast_as) || options.delete(:type)), options) create_property_getter(prope...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_properties\n self.properties ||= {}\n listing_properties.each do |prop|\n self.properties[prop.key] ||= prop.value\n end\n end", "def apply_properties!(properties)\n # Non-commutitivity etc. eventually.\n end", "def assign_property(name, value); end", "def set_property(*...
[ "0.6997883", "0.6853548", "0.6388952", "0.6339376", "0.62283754", "0.6220547", "0.6209596", "0.6161787", "0.6131242", "0.61303794", "0.61043686", "0.60897934", "0.608146", "0.60783345", "0.6060821", "0.60527194", "0.60495603", "0.6020658", "0.6004602", "0.6004602", "0.6004602...
0.0
-1
defines the getter for the property (and optional aliases)
def create_property_getter(property) # meth = property.name class_eval <<-EOS, __FILE__, __LINE__ + 1 def #{property.name} self['#{property.name}'] end EOS if property.type == 'boolean' class_eval <<-EOS, __FILE__...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_getter_for(name, property_name: name)\n return if getters.include?(name)\n define_method(name) { |&block| self.[](property_name, &block) }\n getters << name\n end", "def get(property)\n self.send(property.to_sym)\n end", "def getter\r\n @getter ||= Field....
[ "0.7179248", "0.7077174", "0.70637953", "0.70560855", "0.70496225", "0.6943405", "0.68595064", "0.68399334", "0.6708926", "0.67053413", "0.666672", "0.66534626", "0.6643984", "0.66166264", "0.660727", "0.6601169", "0.6583625", "0.6575671", "0.6548319", "0.65203804", "0.649099...
0.74033916
0
defines the setter for the property (and optional aliases)
def create_property_setter(property) property_name = property.name class_eval <<-EOS def #{property_name}=(value) self['#{property_name}'] = value cast_property_by_name('#{property_name}') end EOS if property.al...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_setter\n name = @name\n klass.send :define_method, \"#{name}=\" do |unit|\n send \"#{name}_value=\", unit.value\n send \"#{name}_unit=\", unit.unit.to_s\n end\n end", "def setter\n @setter ||= :\"#{@name}=\"\n end", "def setter\n @setter...
[ "0.75697047", "0.7479445", "0.7435038", "0.7374368", "0.7328681", "0.7318499", "0.72898364", "0.7251693", "0.72409374", "0.7173965", "0.7124759", "0.71035886", "0.7082337", "0.70717555", "0.7064602", "0.6999733", "0.69811815", "0.69603133", "0.69342095", "0.69248617", "0.6915...
0.7400221
3
Add our own customizations to the Sprockets context class
def enhance_context_class! app = @app env = self # Make the app context available to Sprockets context_class.send(:define_method, :app) { app } context_class.send(:define_method, :env) { env } context_class.class_eval do def asset_path(path, options={}) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 context_overrides()\n {\n :current_en...
[ "0.5889935", "0.56540936", "0.5568807", "0.55629724", "0.55095726", "0.54664314", "0.54549927", "0.5446408", "0.54423726", "0.5432334", "0.53708625", "0.5356699", "0.5351929", "0.53102237", "0.52460665", "0.52361226", "0.52296984", "0.51973677", "0.5188333", "0.51749235", "0....
0.7072926
0
These helpers are already defined in later versions of Sprockets, but we define them ourself to help older versions and to provide extra options that Sass wants. Expand logical image asset path.
def image_path(path, options={}) asset_path(path, :type => :image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def image_path(source, options = {})\n asset_path source, sprockets_helpers_settings.default_path_options[:image_path].merge(options)\n end", "def production_opening\n @images_path = \"/../../assets/images\"\n end", "def image_path_with_engine_additions(source, options={})\r\n options.stringify_...
[ "0.6631332", "0.6524828", "0.64151365", "0.63102984", "0.62051535", "0.6198366", "0.6086761", "0.59803694", "0.59685415", "0.5953375", "0.592443", "0.59213173", "0.58920753", "0.5882679", "0.5876045", "0.58369184", "0.5813331", "0.58035135", "0.57715607", "0.5765328", "0.5765...
0.623712
4
Expand logical font asset path.
def font_path(path, options={}) # Knock .fonts off the end, because Middleman < 3.1 doesn't handle fonts # in asset_path asset_path(path, :type => :font).sub(/\.fonts$/, '') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asset_font_path(font_name)\n File.expand_path(\"../../assets/fonts/#{font_name}\", __FILE__)\n end", "def asset_path(filename)\n super(File.join(FONTS_DIR, filename))\n end", "def set_font_path()\n Dir.entries(@output_styles).each do |filename|\n next if filename =~ /^\\.\\.?$/\n ...
[ "0.70776707", "0.68746537", "0.66515124", "0.6449798", "0.6261417", "0.6217455", "0.6160987", "0.6062966", "0.6047869", "0.5986967", "0.59761333", "0.59021544", "0.58813846", "0.5875892", "0.58686125", "0.583336", "0.57798284", "0.5763387", "0.57309717", "0.5702785", "0.56826...
0.68362194
2
Expand logical javascript asset path.
def javascript_path(path, options={}) asset_path(path, :type => :javascript) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def javascript_path(source, options={})\n path = compute_public_path(source, 'assets', options.merge(:ext => 'js'))\n options[:body] ? path + \"?body=1\" : path\n end", "def short_path\n self.path =~ /^(javascripts|stylesheets|fonts)\\/(.*)$/\n $2\n end", "def javasc...
[ "0.6853705", "0.66794235", "0.657008", "0.65573466", "0.651387", "0.64582205", "0.642774", "0.64235556", "0.6416146", "0.64041847", "0.63783824", "0.63224924", "0.63209283", "0.63205105", "0.62994415", "0.6295386", "0.6295386", "0.6241486", "0.61821425", "0.6175331", "0.61753...
0.6732884
1
Expand logical stylesheet asset path.
def stylesheet_path(path, options={}) asset_path(path, :type => :stylesheet) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_assets_relative!\n @style.gsub! \"url(/assets\", \"url(assets\"\n @style.gsub! \"url(../\", \"url(assets/\"\n end", "def stylesheets_path\n @stylesheets_path ||= File.expand_path 'stylesheets/', assets_path\n end", "def path_to_stylesheet(*args)\n path = super\n if @generate_u...
[ "0.7170023", "0.6585951", "0.649444", "0.63974446", "0.6359896", "0.6359896", "0.6339436", "0.62468225", "0.6206247", "0.61666894", "0.614522", "0.609693", "0.60896784", "0.5930694", "0.5926572", "0.59152204", "0.5908292", "0.5906228", "0.5899743", "0.58854944", "0.5853185", ...
0.64942026
3
Needed so that method_missing makes sense
def respond_to?(method, include_private = false) super || app.respond_to?(method, include_private) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method_missing(meth, *args); end", "def method_missing(method, *args, &blk); end", "def method_missing(method_name, *args); end", "def method_missing(method_name, *args); end", "def method_missing(method, *args, &block); end", "def method_missing(*args, &block); end", "def method_missing(method, *a...
[ "0.854442", "0.8518773", "0.8498434", "0.8498434", "0.8491642", "0.84406686", "0.8356277", "0.8319003", "0.8319003", "0.8319003", "0.83168244", "0.83168244", "0.828123", "0.828123", "0.8242998", "0.8242998", "0.8242998", "0.8242998", "0.8195092", "0.8168199", "0.80796456", ...
0.0
-1
Override Sprockets' default digest function to not change depending on the exact Sprockets version. It still takes into account "version" which is a usersuppliable version number that can be used to force assets to have a new hash.
def digest @digest ||= Digest::SHA1.new.update(version.to_s) @digest.dup end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def digest_key(digest)\n \"asset-uri-digest:#{compressed_path}:#{digest}\"\n end", "def path_with_fingerprint(digest)\n if Rails.env.development?\n pathname.to_s\n else\n sprockets_path_with_fingerprint(digest)\n end\n end", "def version_for_cache\n \"download_url:#{source[:url...
[ "0.68578506", "0.65262926", "0.6482788", "0.6449523", "0.6421448", "0.6279616", "0.6161674", "0.6156922", "0.6015039", "0.5913083", "0.589641", "0.5891951", "0.5891951", "0.5891169", "0.58906466", "0.58708197", "0.58415943", "0.5811172", "0.57956046", "0.5788881", "0.5786317"...
0.71686435
0
Strip our custom 8char hex/sha
def path_fingerprint(path) path[/-([0-9a-f]{8})\.[^.]+$/, 1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tns_unhexify(d=/\\s*/)\n self.strip.gsub(/([A-Fa-f0-9]{1,2})#{d}?/) { $1.hex.chr }\n end", "def strip str\n str.gsub /(\\x0F|\\x1D|\\02|\\03([0-9]{1,2}(,[0-9]{1,2})?)?)/, \"\"\n end", "def filter_string(string)\n string.gsub(/[^0-9a-fA-F]/, '').upcase\n end", "def hex() end", "d...
[ "0.68397653", "0.65744907", "0.64769495", "0.6461806", "0.64538974", "0.6442567", "0.6433199", "0.6427558", "0.6409362", "0.6310838", "0.6288324", "0.62673926", "0.62673926", "0.61928165", "0.6183167", "0.61800396", "0.6171888", "0.6164915", "0.6150976", "0.6134064", "0.61204...
0.0
-1
Invalidate sitemap when users mess with the sprockets load paths
def append_path(path) @app.sitemap.rebuild_resource_list!(:sprockets_paths) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(site)\n puts \"Generating sitemap...\"\n @site = site\n @site.config[\"time\"] = Time.new\n @site.config[\"html_files\"] = html_files.map(&:to_liquid)\n unless sitemap_exists?\n write\n @site.keep_files ||= []\n @site.keep_files << \"sitemap.xml\...
[ "0.6418225", "0.6395269", "0.61868507", "0.611785", "0.60700804", "0.60690176", "0.58372754", "0.58200806", "0.58087504", "0.58087504", "0.57976127", "0.5658813", "0.56381595", "0.56167024", "0.55939984", "0.5553827", "0.55531585", "0.5548001", "0.55176854", "0.55089456", "0....
0.6008507
6
Never return 304s, downstream may want to manipulate data.
def etag_match?(asset, env) false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def not_modified_response(env, etag)\n [ 304, cache_headers(env, etag), [] ]\n end", "def not_modified!\n body.close if body.respond_to?(:close)\n self.status = 304\n self.body = []\n NOT_MODIFIED_OMIT_HEADERS.each { |name| headers.delete(name) }\n nil\n end", "def is_no...
[ "0.74984473", "0.74471545", "0.73057806", "0.6841979", "0.64762527", "0.636819", "0.63011765", "0.6296796", "0.6289226", "0.6285612", "0.6282784", "0.62038976", "0.6190665", "0.6171304", "0.60643226", "0.6018072", "0.5975123", "0.59259033", "0.5902828", "0.58982664", "0.58982...
0.0
-1
Tell Middleman to build this asset, referenced as a logical path.
def import_asset(asset_logical_path, &determine_output_dir) args = [] args << asset_logical_path args << determine_output_dir if block_given? imported_assets << ImportedAsset.new(*args) @app.sitemap.rebuild_resource_list!(:sprockets_import_asset) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_path\n end", "def target_asset_path(asset)\n File.join('public', asset.folder, asset.filename)\n end", "def build_assets\n end", "def build_path\n Pathname.new(self.config[:build_path]) \n end", "def asset path\n @app.asset path\n end", "def create_sta...
[ "0.61482936", "0.60069674", "0.5977283", "0.5949753", "0.5912475", "0.5863548", "0.5803591", "0.5754747", "0.57428503", "0.5692922", "0.56473106", "0.56294394", "0.56219", "0.561757", "0.561757", "0.56085956", "0.56085956", "0.5592717", "0.5575628", "0.55578595", "0.55345803"...
0.0
-1
currently only chrome headless at 1x scaling
def get_driver case meta.engine when "chrome" options = Selenium::WebDriver::Chrome::Options.new options.add_argument('--disable-gpu') options.add_argument('--headless') options.add_argument('--device-scale-factor=1') # have to change cropping for 2x. also this is faster options.ad...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def headless!; end", "def headless!; end", "def chrome_headless?\n (ENV['CHROME_HEADLESS'] =~ /^(false|no|0)$/i) != 0\n end", "def headless\n @data[\"headless\"]\n end", "def scrapping_options\n opts = {\n headless: true\n }\n\n if Rails.env.production?\n if (chrome_bin = ENV.f...
[ "0.7724585", "0.7724585", "0.7015428", "0.693427", "0.6903384", "0.68546546", "0.68546546", "0.66404784", "0.6137105", "0.6050727", "0.6019821", "0.5967508", "0.5951731", "0.59404653", "0.5875429", "0.57558393", "0.56590885", "0.5640529", "0.56397223", "0.56045735", "0.557046...
0.65198976
8
resize to fit entire page
def resize_to_fit_page driver width = driver.execute_script("return Math.max(document.body.scrollWidth, document.body.offsetWidth, document.documentElement.clientWidth, document.documentElement.scrollWidth, document.documentElement.offsetWidth);") height = driver.execute_script("return Math.max(document.body.s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resize(width, height); end", "def resize_to(width, height); end", "def resize(width, height)\n end", "def resize\n check_page_element(params) do |page_element|\n page_element.\n update_attributes({ :x => params[:x], :y => params[:y], \n :width =...
[ "0.73012173", "0.7077057", "0.6822589", "0.6779908", "0.67307454", "0.6704882", "0.6670712", "0.6666823", "0.65900224", "0.6378641", "0.6332667", "0.63317287", "0.63125616", "0.63069725", "0.6279732", "0.62452793", "0.62452793", "0.62140983", "0.61851436", "0.61734027", "0.61...
0.7290847
1
crop an image around the coordinates of an element
def crop_selector driver, selector, image_location el = driver.find_element(:css, selector) image = MiniMagick::Image.open(image_location) image.crop "#{el.rect.width}x#{el.rect.height}+#{el.rect.x}+#{el.rect.y}" image.write(image_location) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crop image, x0 = 0, y0 = 0, w = 100, h = 100, scale = 1\n x0 = (x0.to_f * scale).to_i\n y0 = (y0.to_f * scale).to_i\n\n w = (w.to_f * scale).to_i\n h = (h.to_f * scale).to_i\n\n image.crop \"#{ w }x#{ h }+#{ x0 }+#{ y0 }\"\n image\n end", "def with_crop(left, top, right, bottom); end", "...
[ "0.7912743", "0.7709638", "0.7499912", "0.7471306", "0.7400196", "0.73334104", "0.72073126", "0.7197897", "0.7129314", "0.7050012", "0.69879186", "0.69513357", "0.6950939", "0.6940753", "0.690011", "0.688426", "0.6868178", "0.6862416", "0.6757631", "0.6757334", "0.6755024", ...
0.7194616
8
=begin examples (see tests below): the index of the first fibo number that has two digits is 7 (i.e., the 7th fibo number). the index of the first fibo number that has 10 digits is 45 (i.e., the 45th fibo number). approach: iteratively build an array of fibonacci numbers return the size of the array if the last element...
def number_of_digits(number) number.to_s.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_fibonacci_index_by_length(digits)\n fibonacci_series = [1, 1]\n\n while fibonacci_series.last < 10 ** (digits - 1)\n fibonacci_series << fibonacci_series[-1] + fibonacci_series[-2]\n end\n fibonacci_series.size\nend", "def find_fibonacci_index_by_length(num)\n fib = [1, 1]\n until fib.last.digi...
[ "0.8313855", "0.82504874", "0.8166992", "0.8063379", "0.80385214", "0.802828", "0.8020362", "0.80177426", "0.7990924", "0.7962851", "0.7922549", "0.790724", "0.776263", "0.7761458", "0.7761458", "0.7758475", "0.7756489", "0.7731282", "0.7704539", "0.77012384", "0.7692391", ...
0.0
-1
GET /feedbacks GET /feedbacks.json
def index @feedbacks = Feedback.all @topics = Topic.all for topic in @topics if @topicstats @topicstats = @topicstats + [[FeedbackItem.where(:topic_id => topic.id).sum(:position).to_f / @feedbacks.length, FeedbackItem.where(:topic_id => topic.id).sum(:percentage).to_f / @feedbacks.length, to...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end", "def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end", "def index\n @feedbacks = Feedback.all\n ...
[ "0.7826549", "0.77483714", "0.729931", "0.7205469", "0.7205469", "0.7205469", "0.7205469", "0.7205469", "0.7205469", "0.7205469", "0.7205469", "0.7204222", "0.71323884", "0.71269554", "0.71092725", "0.71042246", "0.7046424", "0.6971945", "0.69489086", "0.69489086", "0.6948908...
0.5932684
66
GET /feedbacks/1 GET /feedbacks/1.json
def show @feedback = Feedback.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @feedback } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @feedbacks = Feedback.find(params[:id])\n render json: @feedbacks\n end", "def index\n @feedbacks = Feedback.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @feedbacks }\n end\n end", "def show\n render json: @feedback\n end",...
[ "0.8084961", "0.7709738", "0.76061434", "0.7471453", "0.7189152", "0.7148919", "0.7148919", "0.7148919", "0.7148919", "0.7148919", "0.7148919", "0.7148919", "0.7148919", "0.71125585", "0.7077423", "0.70773584", "0.7049349", "0.7028018", "0.7028018", "0.7028018", "0.69929963",...
0.75460005
6
GET /feedbacks/new GET /feedbacks/new.json
def new @feedback = Feedback.new @topics = Topic.all.shuffle @p_range = -5..5 priority = 0 for topic in @topics do priority = priority + 1 @feedback.feedback_items.build(:topic => topic, :position => priority, :percentage => 0) end respond_to do |format| format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback }\n end\n end", "def new\n @feedback = Feedback.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @feedback ...
[ "0.81394166", "0.81394166", "0.81394166", "0.7860077", "0.754165", "0.75054866", "0.7487445", "0.7426492", "0.73528785", "0.73528785", "0.7318737", "0.72937036", "0.72937036", "0.7270693", "0.7270693", "0.72694206", "0.726671", "0.7250116", "0.72089595", "0.718436", "0.713078...
0.6780966
41
POST /feedbacks POST /feedbacks.json
def create @feedback = Feedback.new(params[:feedback]) respond_to do |format| if @feedback.save format.html { redirect_to @feedback, notice: 'Feedback was successfully created.' } format.json { render json: @feedback, status: :created, location: @feedback } else forma...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @feedback = Feedback.new(feedback_params)\n\n if @feedback.save\n render json: @feedback, status: :created\n else\n render json: @feedback.errors, status: :unprocessable_entity\n end\n end", "def create\n @feedback = Feedback.create!(\n name: params['feedback']['...
[ "0.7405319", "0.7111513", "0.7035612", "0.7035612", "0.70182526", "0.70023906", "0.6944214", "0.6905904", "0.6880969", "0.68790954", "0.6835451", "0.68139035", "0.6782018", "0.6698734", "0.66881603", "0.66775805", "0.6674108", "0.66724", "0.66621387", "0.6653467", "0.6641613"...
0.7113384
1
PUT /feedbacks/1 PUT /feedbacks/1.json
def update @feedback = Feedback.find(params[:id]) respond_to do |format| if @feedback.update_attributes(params[:feedback]) format.html { redirect_to @feedback, notice: 'Feedback was successfully updated.' } format.json { head :ok } else format.html { render action: "edit" } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @feedback = Feedback.find(params[:id])\n @feedback.update_attributes(params[:feedback])\n respond_with(@feedback)\n end", "def update\n \n respond_to do |format|\n if @feedback.update(feedback_params)\n format.html { redirect_to action: \"index\", notice: 'Feedback was su...
[ "0.72290516", "0.7165893", "0.7110678", "0.7110678", "0.7110678", "0.7073145", "0.7073145", "0.7073145", "0.7073145", "0.70329297", "0.70125586", "0.70125586", "0.70125586", "0.70125586", "0.6942769", "0.6837687", "0.680333", "0.67489016", "0.6739889", "0.6689558", "0.6635308...
0.7144991
2
DELETE /feedbacks/1 DELETE /feedbacks/1.json
def destroy @feedback = Feedback.find(params[:id]) @feedback.destroy respond_to do |format| format.html { redirect_to feedbacks_url } format.json { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @feedback.destroy\n respond_to do |format|\n format.html { redirect_to feedbacks_url }\n format.json { head :no_...
[ "0.7907736", "0.7907736", "0.7907736", "0.7907736", "0.7907736", "0.7850403", "0.7850403", "0.7850403", "0.768565", "0.7647416", "0.7647416", "0.7647416", "0.7647416", "0.7647416", "0.7647416", "0.75828654", "0.7564629", "0.7544788", "0.7540366", "0.75014454", "0.75014454", ...
0.7880491
5
no new no edit thats JS job /animals/:id DELETE
def destroy @animal = Animal.find(params[:id]) @animal.destroy render json: { message: "Congrats youve won"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @animal.destroy\n respond_to do |format|\n format.html { redirect_to animals_url, notice: 'Publicación eliminada correctamente.' }\n format.json { head :no_content }\n format.js\n end\n end", "def destroy\n @animal = Animal.find(params[:id])\n @animal.destroy\n\n r...
[ "0.7698936", "0.7667708", "0.76523834", "0.7651287", "0.7650332", "0.76040447", "0.7575361", "0.75715655", "0.75590223", "0.75503683", "0.7538616", "0.75071275", "0.7463633", "0.7438085", "0.7384929", "0.7347971", "0.73239577", "0.73239577", "0.7310744", "0.7310744", "0.72484...
0.7509784
11
Tempted to do some method_missing magic here, but guessing when to send to_i to the value seems fragile and I don't (yet) want to define it programmatically.
def current_price; self['CurrentPrice'].to_i; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_int(attr); end", "def value; super.to_i; end", "def to_i_with_method\n to_x_with_method.to_i\n end", "def to_i(*) end", "def to_i()\n #This is a stub, used for indexing\n end", "def get_int(key)\n get(key, \"i\")\n end", "def to_i; end", "def to_i; end", "def t...
[ "0.68954647", "0.6831028", "0.66463405", "0.66096383", "0.65495455", "0.64666677", "0.6446128", "0.6446128", "0.6446128", "0.6446128", "0.6446128", "0.6446128", "0.6438102", "0.641338", "0.64013934", "0.6393399", "0.6393399", "0.6393399", "0.6393399", "0.6393399", "0.63460714...
0.0
-1
Adds a new index to the current stack frame.
def add(idx) # Don't need to worry about duplicates thanks to Set data structure. stack.last << idx end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increase_index\n @i +=1\n end", "def <<(index)\n @indexes[index.name] = index\n end", "def index\n push stack[-(pop + 1)]\n end", "def add_at_index(index, val)\n \n end", "def raise_index!\n @index += 1\n end", "def add_to_index(item)\n @content << '\\...
[ "0.65888846", "0.6556176", "0.64959854", "0.6443135", "0.6439251", "0.6329468", "0.61934", "0.6148202", "0.610925", "0.60911554", "0.6090497", "0.6048543", "0.5948899", "0.5948811", "0.5916615", "0.5912683", "0.5902649", "0.5896616", "0.58692485", "0.58447444", "0.579364", ...
0.7474214
0
Build a `times` method
def times(num) counter = 0 while counter < num yield(counter) counter += 1 end num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def times(*args)\n\t\t\t\t\trepeat *args\n\t\t\t\tend", "def using_times\n $num.times do\n puts \"Wingardium Leviosa\"\n end\nend", "def call_times(times)\n i = 0\n while i < times\n yield\n i += 1\n end\n end", "def my_times\n\t\tfor i in 1..self\n\t\t\tyiel...
[ "0.7623791", "0.7084371", "0.69378453", "0.6788835", "0.6756435", "0.6695345", "0.6661287", "0.66513085", "0.66222537", "0.660902", "0.6571286", "0.653324", "0.6516395", "0.6498554", "0.6422922", "0.6379711", "0.62995493", "0.62791115", "0.6277827", "0.6272782", "0.623672", ...
0.57631207
44
Build an `each` method
def each(array) for elem in array do yield(elem) end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(*) end", "def each(&a_proc); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each(&block); end", "def each; end", "def each; end", "def each; end", "def each; end", "def each; end", "def each;...
[ "0.7491712", "0.73695445", "0.7300482", "0.7300482", "0.7300482", "0.7300482", "0.7300482", "0.7300482", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.72988963", "0.71922976", "0....
0.0
-1
Build an `select` method
def select(array) final_selections = [] for elem in array do result = yield(elem) final_selections << elem if result end final_selections end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select(*) end", "def select(*args)\n @results = nil\n except(:select)\n @builder = builder.select(*args)\n self\n end", "def select; end", "def select; end", "def select(*rest) end", "def select(*rest) end", "def select_by(how, what); end", "def select(&block)\n @selec...
[ "0.782956", "0.78161275", "0.7796043", "0.7796043", "0.761918", "0.761918", "0.731068", "0.71569586", "0.71401495", "0.7095765", "0.6999362", "0.699622", "0.6955823", "0.69408554", "0.69263047", "0.6905083", "0.6876375", "0.683794", "0.6837358", "0.6822572", "0.68125", "0.6...
0.0
-1
Build an `reduce` method (for an array of numbers)
def reduce(array, initial_acc=0) accumulator = initial_acc for elem in array do accumulator = yield(accumulator, elem) end accumulator end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reduce\n _reduce = ->(acc, f, xs){\n xs == [] ? acc : _reduce.(f.(acc, xs[0]), f, xs[1..-1])\n }\n\n curry.(->(f, xs) {\n _reduce.(xs[0], f, xs[1..-1])\n })\n end", "def reduce arr, val\n output = val\n arr.each do |n|\n output = yield(output, n)\n end\n output\nend"...
[ "0.7071271", "0.7039515", "0.69878703", "0.68761927", "0.68400717", "0.6785514", "0.67654884", "0.6755087", "0.6755087", "0.6755087", "0.67447305", "0.67447305", "0.67277604", "0.67277604", "0.6720017", "0.6720017", "0.6719787", "0.67087144", "0.6706592", "0.67039603", "0.669...
0.6709842
17