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
Simply make sure that `opts` can be converted into a Hash, then does so. Then returns `opts` as a HashWithIndifferentAccess.
def sanitize_options(opts) opts = opts.to_hsh rescue opts.to_h HashWithIndifferentAccess.new(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_opts(opts)\n {}.tap do |o|\n o[:serialize] = if opts[:serialize] && opts[:serialize].is_a?(Array)\n opts[:serialize].map(&:to_s)\n else\n []\n end\n\n o[:only] = opts[:only] || [\"add\", \"remove\"]\n o[:notify] = opts[:notify] |...
[ "0.6497648", "0.62586224", "0.6141342", "0.612988", "0.61116034", "0.60891175", "0.60677", "0.60211694", "0.60211694", "0.59898317", "0.59881794", "0.5985856", "0.59845215", "0.5969746", "0.5966751", "0.5882005", "0.5870401", "0.5862344", "0.58554083", "0.58532906", "0.583563...
0.7970074
0
Raises an error if `opts` does not contain the `key`
def validate_option_key(opts, key) raise "opts[:#{key}] or opts['#{key}'] must be given" unless opts.has_key?(key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key; @opts['key'] end", "def required_option(options, key)\n result = get_option(options, key)\n raise ArgumentError, \"Missing required option: #{key}\" if result == \"\"\n result\n end", "def assert_bad_or_good_if_key(key, value, missing, message_key = :message)\n return true unless @opt...
[ "0.7309869", "0.6836964", "0.672941", "0.6708919", "0.6691647", "0.6531362", "0.6530075", "0.6465956", "0.6425331", "0.6342309", "0.6336891", "0.6311184", "0.62602305", "0.6217104", "0.61788005", "0.6177685", "0.61524093", "0.61458796", "0.61087173", "0.60677516", "0.60348254...
0.8797754
0
Converts the input entertrack (probably from barcode scanner) into the computer_id
def track_to_id self.computer_id = (entertrack - 10000000) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def char_to_id(ch); end", "def determine_name\n name = nil\n\n case @type\n when :computer\n name = `sudo dmidecode -s system-serial-number`.chomp\n when :hard_drive\n `sudo smartctl -i #{@options['device']}`.each_line do |line|\n line =~ /^Serial\\sNumber:\\s...
[ "0.6026348", "0.58002263", "0.5672722", "0.5344034", "0.52405816", "0.52302474", "0.52178574", "0.51649517", "0.51032585", "0.5098331", "0.50870067", "0.50818", "0.5061149", "0.5052782", "0.50460136", "0.50144506", "0.4973266", "0.49655682", "0.49583212", "0.49554807", "0.495...
0.73323953
0
Ensures that a computer's status can only be either scrapped or sold
def scrapped_or_sold if (scrapped.blank? and sold.blank?) # Do nothing elsif !(scrapped.blank? ^ sold.blank?) errors.add(:base, "Please indicate whether a computer has been scrapped or sold, not both.") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def power_safety_status\n unless powered_up or is_empty?\n errors.add(:powered_up, \"Cannot have a dinosaur in a cage that is powered off. \")\n end\n end", "def reserved?(product)\n product.status == 'Reserved'\n end", "def can_be_assigned?\n\t\t(!status.include? STATUS[\"Assigned\"]) && (!sta...
[ "0.6342658", "0.6252511", "0.62040097", "0.60894203", "0.6016636", "0.5940866", "0.5861526", "0.58253396", "0.5807886", "0.5807163", "0.5791245", "0.5789773", "0.5771152", "0.57687783", "0.57543445", "0.5749269", "0.5724948", "0.5718888", "0.57077575", "0.5704767", "0.5692924...
0.6944911
0
Ensures that a customer and price can only be assigned for sold computers
def been_sold if (customer.present? or price.present?) and sold != true errors.add(:base, "Only sold computers can have customers or prices.") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def customer_can_afford_pet(supplied_customer, new_pet)\n supplied_customer[:cash] < new_pet[:price] ? false : true\nend", "def customer_can_afford_pet(customer, new_pet)\n if customer[:cash] >= new_pet[:price]\n true\n else\n false\n end\nend", "def customer_can_afford_pet(customer, new_pet)\n if c...
[ "0.66864747", "0.64822686", "0.64427733", "0.64427733", "0.6417069", "0.64124364", "0.6412113", "0.63891304", "0.63891304", "0.63840896", "0.63685167", "0.63636523", "0.6358056", "0.6326425", "0.6315005", "0.62852156", "0.62250865", "0.62083805", "0.61884385", "0.616832", "0....
0.7172353
0
Ensures that statuses can only be made for exisiting computers that don't already have statuses
def existing_turingtrack if !Computer.exists?(:id => (self.entertrack - 10000000)) errors.add(:base, "Please enter a valid TuringTrack ID.") #elsif Status.exists?(:entertrack => self.entertrack) # errors.add(:base, "There is already a status record for that TuringTrack ID.") end rescue NoMethodError end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_final_state\n return unless status_changed?\n return unless %w(denied missed returned archived).include?(status_was)\n errors.add(:base, \"Cannot change status of #{status_was}\"\\\n \" reservation.\\n\")\n end", "def can_be_assigned?\n\t\t(!status.include? STATUS[\"Assigned\"]) && (!stat...
[ "0.62184644", "0.59657353", "0.5925415", "0.5841411", "0.5831159", "0.58267087", "0.5817106", "0.5798977", "0.57908404", "0.5775065", "0.5766504", "0.57292897", "0.5725456", "0.5708677", "0.5697616", "0.5685117", "0.5670358", "0.56604445", "0.5651553", "0.5650323", "0.5642182...
0.0
-1
Returns boolean for user being/not being considered a military person, by eMIS, based on their Title 38 Status Code.
def military_person? title38_status == 'V3' || title38_status == 'V6' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status\n return :not_authorized unless user_loa3\n\n mvi_response&.status\n end", "def detect_protect_on_status(pkmn, check_status = true)\n return true if check_status and pkmn.status != 0\n return true if pkmn.battle_effect.has_substitute_effect? and pkmn != @IA_Info[:launcher]\n retu...
[ "0.6440953", "0.615688", "0.6069206", "0.6055143", "0.6004144", "0.5953719", "0.59451836", "0.5884087", "0.5873185", "0.5828828", "0.58201045", "0.5808816", "0.57922435", "0.57781124", "0.5767824", "0.57117885", "0.57112074", "0.57019615", "0.56921774", "0.5679763", "0.567937...
0.75771916
0
GET / List all available brainstorming root terms.
def index render json: Term.roots .includes(:user) .map(&:serialize_list), status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @terms = Term.all\n end", "def get_terms(params)\n send_get \"get_terms\", params\n end", "def terms\n end", "def terms\n\n end", "def terms\n\n end", "def terms\n @api_v1_pages = Api::V1::Page.where('title = \"terms\"').first\n\n render json: @api_v1_pages\n end", ...
[ "0.6666361", "0.6659874", "0.63759017", "0.6335374", "0.6335374", "0.6273438", "0.6257915", "0.6236808", "0.62298465", "0.6228213", "0.6200435", "0.6191978", "0.61299896", "0.611317", "0.6063667", "0.60073745", "0.6000226", "0.5996079", "0.5961561", "0.5954884", "0.59212047",...
0.6299913
5
GET /terms/:id Show a complete brainstorming tree with all corresponding terms.
def show term = Term.roots.find params[:id] render_item term, :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def terms id, date = Date.today.to_s, page = 1\n uri = \"#{BASE_URL}/gauges/#{id}/terms?date=#{date}&page=#{page}}\"\n fetch uri\n end", "def get_terms(params)\n send_get \"get_terms\", params\n end", "def index\n @terms = Term.all\n end", "def terms\n @api_v1_pages = Api::V1:...
[ "0.7231781", "0.6942354", "0.6662163", "0.66050357", "0.65300614", "0.6374906", "0.63370514", "0.63340974", "0.6250527", "0.623081", "0.6216881", "0.62079513", "0.6174947", "0.61503637", "0.61503637", "0.61195266", "0.61195266", "0.6119446", "0.6079326", "0.60476995", "0.6044...
0.6661379
3
POST /terms Create a new root brainstorming term.
def create parent = params[:parent_id] ? Term.find(params[:parent_id]) : nil term = Term.new term_params term.user = current_user term.parent = parent term.save render_item term, :created end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @term = Term.new(term_params)\n\n if @term.save\n render :show, status: :created, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end", "def create\n @errors = []\n term_prms = term_params\n validate_new_term_...
[ "0.7436761", "0.73706234", "0.7178922", "0.70608336", "0.6961743", "0.6843471", "0.6795263", "0.66004944", "0.6580697", "0.64785534", "0.64660734", "0.64509296", "0.6393909", "0.6361838", "0.63575643", "0.6316643", "0.6212432", "0.61307275", "0.6099507", "0.60683954", "0.6063...
0.65617
9
PUT /terms/:id Updates the name of an existing term.
def update @term.update_attributes(term_params) render_item @term, :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @term.update(term_params)\n render :show, status: :ok, location: api_v1_term_url(@term)\n else\n render json: @term.errors, status: :unprocessable_entity\n end\n end", "def update\n @term = Term.find(params[:id])\n\n respond_to do |format|\n if @term.update_attribut...
[ "0.73154896", "0.73013026", "0.70600253", "0.70378083", "0.70367265", "0.6750758", "0.6655617", "0.6655617", "0.66122", "0.6597772", "0.6587295", "0.6490345", "0.647302", "0.6408494", "0.6307197", "0.626842", "0.6266872", "0.61839366", "0.61793053", "0.61727405", "0.6141003",...
0.68481183
5
DELETE /terms/:id Delete a term an it child terms.
def destroy @term.destroy! head :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @term = Term.find(params[:id])\n @term.destroy\n\n respond_to do |format|\n format.html { redirect_to(terms_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @term = Term.find(params[:id])\n @term.destroy\n\n respond_to do |format|\n format.html { r...
[ "0.7253014", "0.7253014", "0.7092509", "0.7032645", "0.7016878", "0.68859416", "0.6811473", "0.66936654", "0.6676381", "0.6673951", "0.66433626", "0.660455", "0.6602387", "0.6553555", "0.65066344", "0.6463287", "0.6456382", "0.645206", "0.6379143", "0.6317264", "0.62916094", ...
0.6669707
10
This action is used to retrieve data to be display on the IDSR MONTHLY REPORT Is called by Ajax and renders results in json
def idsr_monthly_report_summary date = params[:year_month].split('-') @start_date = Date.new(date[0].to_i,date[1].to_i) @end_date = @start_date + 1.month - 1.day @disaggregated_diagnosis = {} idsr_monthly_set = ConceptName.where(["name IN (?)",["Idsr Monthly Summary"]]).map(&:concept_id) idsr_monthly_set_members = ConceptSet.where(["concept_set IN (?)",idsr_monthly_set]).map(&:concept_id) concept_ids = ConceptName.where(["concept_name.concept_id IN (?)", idsr_monthly_set_members]).map(&:concept_id) observation = Observation.where(["obs.obs_datetime >= ? AND obs.obs_datetime <= ? AND obs.value_coded IN (?)",@start_date, @end_date,concept_ids]).includes({:person=>{}}) observation.each do | obs| next if obs.person.blank? next if obs.answer_concept.blank? previous_date = obs.obs_datetime.strftime('%Y-%m-%d').to_date sex = obs.person.gender age = PatientService.age(obs.person, previous_date) diagnosis_name = obs.answer_concept.fullname rescue '' @disaggregated_diagnosis[diagnosis_name]={ "=<4" =>0, "=>5" =>0 } # if @disaggregated_diagnosis[diagnosis_name] != nil if age.to_i < 5 @disaggregated_diagnosis[diagnosis_name]["=<4"]+=1 else @disaggregated_diagnosis[diagnosis_name]["=>5"]+=1 end # end # end @diaggregated_paginated = [] @disaggregated_diagnosis.each { | diag, value | @diaggregated_paginated << [diag, value] } end #raise @diaggregated_paginated.inspect render :json=> @diaggregated_paginated end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def data\n d = Date.new(0, 1, 1)-1\n months = params[:months].to_i\n respond_to do |format|\n format.json { render json: JournalEntry.build_stairs(months).to_json }\n #format.csv {render csv: 'foo'}\n format.text { render :text => JournalEntry.all.map { |j| \"#{(j.entry_date - d).to_i} #{j....
[ "0.70137846", "0.6785619", "0.6720179", "0.6631924", "0.6617991", "0.6590482", "0.65688187", "0.65620434", "0.6554017", "0.65317035", "0.6530003", "0.6527418", "0.6514168", "0.648938", "0.64826316", "0.6481623", "0.6471996", "0.6471361", "0.6462856", "0.6459926", "0.6455072",...
0.6801321
1
This action is used to display form content on the IDSR MONTHLY REPORT
def idsr_monthly_summary @report_name = 'IDSR Monthly Summary' @logo = CoreService.get_global_property_value('logo').to_s @current_location_name =Location.current_health_center.name @obs_start_year = Observation.first.obs_datetime.year render :layout => 'report' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @report_lines = @monthly_report.report_lines\n end", "def new\n @silicaship = Silicaship.new\n @form_code = \"PKI-\"+Date.current.strftime('%Y%m%d')+\"-\"+\"#{Silicaship.where('created_at BETWEEN ? and ?', Date.current.beginning_of_month, Date.current.end_of_month).count+1}\"\n\n respond_...
[ "0.6275323", "0.61825", "0.6169359", "0.61175704", "0.6067816", "0.60425353", "0.6011588", "0.5957585", "0.5946823", "0.59013975", "0.58804923", "0.5849079", "0.5801529", "0.5789817", "0.5763517", "0.57531786", "0.57516295", "0.57463527", "0.57455254", "0.5720824", "0.5716822...
0.6418573
0
Write a method that accepts one argument, but doesn't require it. The parameter should default to the string "Bob" if no argument is given. The method's return value should be the value of the argument. puts assign_name == 'Bob' puts assign_name('Kevin') == 'Kevin' The code should output true twice. ANSWER
def assign_name(name = 'Bob') name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_name(arg='Bob')\n return arg # don't need return\nend", "def assign_name(name='Bob')\n name \nend", "def assign_name(name='Bob')\n name\nend", "def assign_name(name = 'bob')\n assigned_name = name\nend", "def assign_name(name = 'Bob')\n\tname\nend", "def assign_name(name = \...
[ "0.82815725", "0.81830883", "0.8169967", "0.81344676", "0.8126803", "0.80801815", "0.80801815", "0.80740523", "0.8052803", "0.7980741", "0.7607288", "0.6816771", "0.67075294", "0.6676121", "0.6616323", "0.651702", "0.64806545", "0.64405984", "0.64352566", "0.63301647", "0.628...
0.8070574
9
Parse out a teamweek file and return an array of players
def get_team_for_week(team, week) file = "#{@teamweek_dir}/#{team}_#{week}.html" n = Nokogiri.HTML(File.open(file)) players = [] [0,1,2].each do |i| t0 = n.css("#statTable#{i}") t0.css('tr').each do |tr| opts = {} next unless tr.css('td.pos').text =~ /\S/ opts[:name] = tr.css('td.player a.name').text (pteam, ppos) = tr.css('li.ysf-player-team-pos span').text.gsub(/[() ]/, '').split('-') ppos ||= '' ppos.gsub! /,.*/, '' ppos.gsub! /(IR|NA)/, '' opts[:pos] = ppos opts[:points] = tr.css('td.pts').text.to_i slot = tr.css('td.pos').text slot = 'WRRB' if slot == 'W/R' opts[:slot] = slot players.push(YahooFF::Player.new(opts)) end end return YahooFF::Team.new(team, week, players) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def by_season_team_parser\n by_season_team_data = []\n target_dir = by_season_team_dir\n Dir.foreach(target_dir) do |file|\n next if file == '.' or file == '..'\n json_file = File.open(target_dir + file)\n parsed_file = JSON.parse(File.read(json_file))\n pla...
[ "0.6817765", "0.637809", "0.6128131", "0.6094855", "0.60939497", "0.6004025", "0.5923187", "0.5913318", "0.58579904", "0.57875556", "0.5769979", "0.5762732", "0.57520354", "0.57518446", "0.5742133", "0.57237667", "0.5708538", "0.56871444", "0.56789535", "0.56763893", "0.56627...
0.71144485
0
load_and_authorize_resource :except => [:show]
def index @properties = @user.properties.all # if params[:search] # @properties = @user.properties.search(params[:search], params[:page]).order("created_at DESC") # respond_to do |format| # format.html # index.html.erb # format.json { render json: @properties } # end # else # @properties = Property.order("created_at DESC") # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n authorize User\n end", "def show\n authorize User\n end", "def show\n # authorize Admin\n end", "def show\n authorize!\n end", "def show\n authorize!\n end", "def show\n authorize!\n end", "def show\n authorize! :show, @user\n end", "def show\n authorize! :crea...
[ "0.776869", "0.776869", "0.75682133", "0.7502523", "0.7502523", "0.7502523", "0.74358374", "0.7412419", "0.7398362", "0.7398362", "0.7394138", "0.7281659", "0.724541", "0.72380006", "0.7234317", "0.72066826", "0.71533483", "0.7125319", "0.7096403", "0.70925975", "0.70908904",...
0.0
-1
in future I would add a transaction for this whole method, so that transaction and bank_guarantee are ensured to be deactivated together however for now it looks redundant, and specs ensure all's well
def deactivate! update!(active: false) bank_guarantee.try(:deactivate!) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transaction_disabled; end", "def within_transaction; end", "def within_transaction; end", "def use_transactions; end", "def use_transactions; end", "def transaction_disabled=(_arg0); end", "def transaction; end", "def transaction; end", "def transaction; end", "def set_bank_guarantee\n @...
[ "0.68218946", "0.6698865", "0.6698865", "0.6656882", "0.6656882", "0.66298", "0.65229255", "0.65229255", "0.65229255", "0.6493164", "0.6320061", "0.6313874", "0.62596196", "0.62454325", "0.6223254", "0.6211027", "0.6165052", "0.6146641", "0.61082757", "0.6107393", "0.6107393"...
0.66460717
5
GET /solutions GET /solutions.json
def index @solutions = Solution.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f...
[ "0.77688867", "0.7308382", "0.67705363", "0.6600122", "0.6597075", "0.6508489", "0.64890707", "0.64498717", "0.63750976", "0.6354698", "0.6287679", "0.623368", "0.61995995", "0.61232305", "0.61224574", "0.6097867", "0.6092867", "0.60293007", "0.60293007", "0.59834206", "0.597...
0.6823754
3
GET /solutions/1 GET /solutions/1.json
def show @solution = Solution.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @solutions = @idea.solutions.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @solutions }\n end\n end", "def show\n @solution = @idea.solutions.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n f...
[ "0.75871086", "0.75095385", "0.69770825", "0.6890578", "0.67686564", "0.67686564", "0.67686564", "0.6619587", "0.655043", "0.65149266", "0.64279115", "0.63966733", "0.6391543", "0.6352886", "0.628824", "0.62604916", "0.6244843", "0.62029654", "0.6200472", "0.61984986", "0.614...
0.6210185
17
POST /solutions POST /solutions.json
def create @solution = Solution.new(solution_params) @solution.user_id = @current_user.id @solution.solution_id = 0 @solution.accepted = false respond_to do |format| if @solution.save format.html { redirect_to @solution, notice: 'Solution was successfully created.' } format.json { render :show, status: :created, location: @solution } SolutionGraph.create({:code => @solution.id, :desc => @solution.description}).save @solution_graph = SolutionGraph.find_by(code: @solution.id) @individual = Individual.find_by(login: @current_user.login ) @solution_graph.creator = @individual @service_graph = ServiceGraph.find_by(code: @solution.service_id) @solution_graph.service = @service_graph else format.html { render :new } format.json { render json: @solution.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @solution = @idea.solutions.new(feature: params[:toSent]) #@idea.solutions.new(params[:solution])\n\n if @solution.save\n render json: { text: \"success\", id: \"#{@solution.id}\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def new\n @solution = @idea.solutions...
[ "0.6826486", "0.6716825", "0.6661932", "0.66395503", "0.66299057", "0.6606454", "0.642049", "0.63882184", "0.6370658", "0.6158524", "0.6145016", "0.614362", "0.60685176", "0.6052824", "0.60358685", "0.601223", "0.596002", "0.59373003", "0.59373003", "0.59373003", "0.59239566"...
0.618341
9
PATCH/PUT /solutions/1 PATCH/PUT /solutions/1.json
def update respond_to do |format| if @solution.update(solution_params) format.html { redirect_to @solution, notice: 'Solution was successfully updated.' } format.json { render :show, status: :ok, location: @solution } else format.html { render :edit } format.json { render json: @solution.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @solution = @idea.solutions.find(params[:id])\n\n if @solution.update_attributes(params[:solution])\n render json: { text: \"success\" }\n else\n render json: { text: \"fail\"}\n end\n end", "def update\n @solution = Solution.find(params[:id])\n\n respond_to do |format|\...
[ "0.72454935", "0.66407543", "0.6391327", "0.63379794", "0.63365626", "0.62712806", "0.6269803", "0.62656844", "0.62369734", "0.6181246", "0.6132598", "0.6088409", "0.60666347", "0.598517", "0.598072", "0.59526217", "0.59238976", "0.5923328", "0.5919974", "0.590858", "0.585263...
0.6455272
2
DELETE /solutions/1 DELETE /solutions/1.json
def destroy @solution.destroy respond_to do |format| format.html { redirect_to solutions_url, notice: 'Solution was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @solution.destroy\n render json: {solutions: @solution}, status: 200\n end", "def destroy\n @solution.destroy\n respond_to do |format|\n format.html { redirect_to solutions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @solution = Solution.fin...
[ "0.7864415", "0.75774145", "0.7555733", "0.75061536", "0.72574353", "0.7144156", "0.7115537", "0.711246", "0.69710326", "0.69710326", "0.69703645", "0.6970164", "0.68471247", "0.68289363", "0.68050957", "0.6802883", "0.6802161", "0.6802161", "0.6802161", "0.6802161", "0.68017...
0.7288376
5
Use callbacks to share common setup or constraints between actions.
def set_solution @solution = Solution.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 solution_params params.require(:solution).permit(:solution_id, :user_id, :service_id, :description) 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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
Attachments for showed project
def project_index? # user_activities.include? 'attachment:index' # user_activities.include? 'attachment:project_index' (user_activities.include? 'attachment:project_index') || (event_activities(@model).include? 'attachment:project_index') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n #@attachment = Project.find(15)\n #@attachment.file.attach(params[:files])\n @comment = Comment.new\n end", "def show\n @taskas = Task.find(params[:assigned_to_id])\n @task = Task.find(params[:id])\n @project = Project.find(params[:project_id])\n @attachments = @task.attachments\...
[ "0.6918907", "0.6762226", "0.6754845", "0.65792745", "0.6515298", "0.65098864", "0.64899796", "0.64877605", "0.6417551", "0.6321038", "0.6295837", "0.6288628", "0.62362015", "0.623185", "0.6191549", "0.6191549", "0.618245", "0.6158283", "0.6129276", "0.60639817", "0.605752", ...
0.0
-1
Attachments for showed user
def user_index? # user_activities.include? 'attachment:index' user_activities.include? 'attachment:user_index' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @user_attachments = UserAttachment.all\n end", "def show\n # These are expected and required by the file_handler route: \"file_attachments/:content_type/:parent_id/:id\"\n id = params[:id]\n parent_id = params[:parent_id]\n \n case params[:content_type]\n ...
[ "0.6921741", "0.66746294", "0.6649789", "0.6642741", "0.64651316", "0.6372987", "0.63102055", "0.6254466", "0.6222039", "0.6192564", "0.6173309", "0.61507106", "0.61493415", "0.6125249", "0.61247486", "0.6068663", "0.6068663", "0.6065979", "0.6056258", "0.60561734", "0.605617...
0.0
-1
Attachments for showed event
def event_index? # user_activities.include? 'attachment:index' # user_activities.include? 'attachment:event_index' (user_activities.include? 'attachment:event_index') || (event_activities(@model).include? 'attachment:event_index') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @event_attachments = EventAttachment.all\n end", "def show\n @document = Attached.find(params[:id])\n\n rootString = root_url.to_s.gsub(\"?locale=\", \"\")\n\n if request.referer\n if request.referer.include?(rootString + \"events/\" + @document.event_id.to_s) or request.referer.inc...
[ "0.6643311", "0.63417053", "0.6196092", "0.61932373", "0.61595", "0.6128413", "0.6124721", "0.6111166", "0.6079773", "0.60492986", "0.6030016", "0.60283476", "0.60089684", "0.60027313", "0.5995348", "0.5979958", "0.5979958", "0.5970079", "0.59382313", "0.5937771", "0.589741",...
0.0
-1
reset session and other
def reset reset_session redirect_to root_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_session!\n raw_session.clear\n end", "def reset_session!\n request.reset_session\n end", "def reset_session!\n request.reset_session\n end", "def reset!\n @session_key = nil\n end", "def sessions_reset\n self.sessions_flush\n @sessions = {}\n end", ...
[ "0.8241069", "0.7826838", "0.7826838", "0.7817339", "0.78161067", "0.7787506", "0.7481623", "0.7460084", "0.7452106", "0.7449858", "0.7426106", "0.72550815", "0.72262806", "0.7223491", "0.71642435", "0.7163155", "0.714617", "0.71420133", "0.71261406", "0.7118419", "0.7082083"...
0.7883568
1
For example: the summation of 3 is 6 because 1 + 2 + 3 = 6, the summation of 6 is 21 because 1 + 2 + 3 + 4 + 5 + 6 = 21. Write a method summation_sequence that takes in a two numbers: start and length. The method should return an array containing length total elements. The first number of the sequence should be the start number. At any point, to generate the next element of the sequence we take the summation of the previous element. You can assume that length is not zero.
def summation_sequence(start, length) arr = [start] i = 1 while i < length arr << summation(arr[i-1]) i += 1 end return arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def summation_sequence(start, length)\n sequence = [start]\n while sequence.length < length\n sequence << summation(sequence[-1])\n end\n return sequence\nend", "def summation_sequence(start, length)\n sequence = [start]\n while sequence.length < length\n sequence << summation(sequence[-1])\n end\n ...
[ "0.9032482", "0.9031881", "0.90134704", "0.8991493", "0.8931953", "0.88800484", "0.8856925", "0.8836007", "0.88068587", "0.77654916", "0.7759579", "0.7733978", "0.7499312", "0.7348537", "0.7255668", "0.72519195", "0.7043504", "0.6892303", "0.686528", "0.6832037", "0.6831154",...
0.9049595
0
Get badge info for a specific level.
def business(level = 3) data = @data['families'].find { |type| type['name'] == 'Business' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.6723961", "0.66933936", "0.6603226", "0.6565971", "0.65559864", "0.63579124", "0.633213", "0.62759507", "0.6237093", "0.61848927", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.5969156", "0.59688...
0.6439381
9
Get badge info for a specific level.
def entertainment(level) data = @data['families'].find { |type| type['name'] == 'Entertainment' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.6723961", "0.66933936", "0.6603226", "0.6565971", "0.6439381", "0.63579124", "0.633213", "0.62759507", "0.6237093", "0.61848927", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.5969156", "0.596886...
0.65559864
8
Get badge info for a specific level.
def geography(level) data = @data['families'].find { |type| type['name'] == 'Geography' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7768895", "0.772176", "0.76727927", "0.67242724", "0.6693487", "0.6604061", "0.65658516", "0.65564007", "0.64404315", "0.6356935", "0.63318", "0.627536", "0.6236951", "0.6184562", "0.6177006", "0.6168414", "0.6153305", "0.60096705", "0.60018986", "0.5969468", "0.59681857",...
0.68235976
3
Get badge info for a specific level.
def history(level) data = @data['families'].find { |type| type['name'] == 'History' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.6723961", "0.66933936", "0.6565971", "0.65559864", "0.6439381", "0.63579124", "0.633213", "0.62759507", "0.6237093", "0.61848927", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.5969156", "0.59688...
0.6603226
6
Get badge info for a specific level.
def literature(level) data = @data['families'].find { |type| type['name'] == 'Literature' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.6723961", "0.66933936", "0.6603226", "0.6565971", "0.65559864", "0.6439381", "0.63579124", "0.62759507", "0.6237093", "0.61848927", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.5969156", "0.5968...
0.633213
11
Get badge info for a specific level.
def movies(level) data = @data['families'].find { |type| type['name'] == 'Movies' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.6723961", "0.66933936", "0.6603226", "0.6565971", "0.65559864", "0.6439381", "0.63579124", "0.633213", "0.62759507", "0.6237093", "0.61848927", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.59691...
0.57188964
28
Get badge info for a specific level.
def music(level) data = @data['families'].find { |type| type['name'] == 'Music' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7768895", "0.772176", "0.76727927", "0.68235976", "0.67242724", "0.6693487", "0.6604061", "0.65658516", "0.65564007", "0.64404315", "0.6356935", "0.63318", "0.627536", "0.6236951", "0.6184562", "0.6177006", "0.6168414", "0.60096705", "0.60018986", "0.5969468", "0.59681857"...
0.6153305
17
Get badge info for a specific level.
def nature(level) data = @data['families'].find { |type| type['name'] == 'Nature' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.66933936", "0.6603226", "0.6565971", "0.65559864", "0.6439381", "0.63579124", "0.633213", "0.62759507", "0.6237093", "0.61848927", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.5969156", "0.59688...
0.6723961
4
Get badge info for a specific level.
def science(level) data = @data['families'].find { |type| type['name'] == 'Science' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.6723961", "0.66933936", "0.6603226", "0.6565971", "0.65559864", "0.6439381", "0.63579124", "0.633213", "0.62759507", "0.6237093", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.5969156", "0.596886...
0.61848927
14
Get badge info for a specific level.
def sports(level) data = @data['families'].find { |type| type['name'] == 'Sports' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7769182", "0.772284", "0.76725006", "0.68234193", "0.6723961", "0.66933936", "0.6603226", "0.6565971", "0.65559864", "0.6439381", "0.63579124", "0.633213", "0.62759507", "0.61848927", "0.61770594", "0.61673075", "0.6152637", "0.6009323", "0.60020727", "0.5969156", "0.59688...
0.6237093
13
Get badge info for a specific level.
def tv(level) data = @data['families'].find { |type| type['name'] == 'TV' } badge = data['earnedAchievements'].find { |le| le['familyOrder'] == (level - 1) } HQTrivia::Badge.new(badge) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def badge\n if @badge.nil?\n badges = Badge.by_name(badge_name)\n badges = badges.by_level(level) unless level.nil?\n @badge = badges.first\n end\n @badge\n end", "def [](level)\n raise ArgumentError unless valid?(level)\n\n @badges ||= {}\n @badges[level] ||...
[ "0.7768895", "0.772176", "0.76727927", "0.68235976", "0.67242724", "0.6693487", "0.6604061", "0.65658516", "0.65564007", "0.64404315", "0.6356935", "0.63318", "0.627536", "0.6236951", "0.6184562", "0.6168414", "0.6153305", "0.60096705", "0.60018986", "0.5969468", "0.59681857"...
0.6177006
15
hours function of TimeEntry(base class) is overrided to use amount column of WkExpenseEntry
def validate_time_entry errors.add :amount, :invalid if amount && (amount < 0 || amount >= 100000) errors.add :project_id, :invalid if project.nil? errors.add :issue_id, :invalid if (issue_id && !issue) || (issue && project!=issue.project) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hours\n self.to_i * 3_600\n end", "def hours; self * HOUR; end", "def hours; self * HOUR; end", "def hours\n \n end", "def hours\n self * SECONDS_IN_HOUR\n end", "def hours ; Duration[self * 3600] ; end", "def hours() 60 * minutes end", "def get_hours()\n\n return self.h...
[ "0.7555828", "0.73370266", "0.73366743", "0.7177668", "0.7168024", "0.71437913", "0.71062195", "0.7038088", "0.7037582", "0.7002182", "0.67679894", "0.67529017", "0.66829306", "0.6669139", "0.6669139", "0.66133606", "0.65524334", "0.6552089", "0.6552089", "0.65364176", "0.648...
0.0
-1
set atom event link path
def event_url(options = {}) option = Proc.new {|o| {:controller => 'wkexpense', :action => 'reportdetail', :project_id => o.project, :issue_id => o.issue}} if option.is_a?(Proc) option.call(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link\n \"/events/#{id}\"\n end", "def path=(link_path)\n @link.TargetPath = link_path.tr('/', \"\\\\\")\n end", "def emit_link(cur_mtg_dir, f, desc)\n _a desc, href: f.include?('/') ? f : File.join(cur_mtg_dir, f)\nend", "def follow_symlinks=(_arg0); end", "def follow_symlinks; end", ...
[ "0.6419111", "0.63757646", "0.6041246", "0.6006476", "0.5897606", "0.5880626", "0.58707464", "0.5859742", "0.57800186", "0.5723776", "0.56983644", "0.5681471", "0.5647914", "0.561111", "0.5602524", "0.56015784", "0.555367", "0.5515978", "0.55062544", "0.55062544", "0.5494156"...
0.0
-1
set atom event title
def event_title() option = Proc.new {|o| "#{"%.2f" % o.hours} (#{(o.issue || o.project).event_title})"} if option.is_a?(Proc) option.call(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_title(title)\n @title = title\n end", "def set_window_title(window, title)\n window.custom_title.set(title)\n end", "def set_window_title(window, title)\n window.custom_title.set(title)\n end", "def set_window_title(window, title)\n window.custom_title.set(title)\n end", ...
[ "0.7404074", "0.72713625", "0.72713625", "0.72713625", "0.71675825", "0.7103806", "0.7064173", "0.7064173", "0.7064173", "0.7064173", "0.7064173", "0.7064173", "0.7064173", "0.70459616", "0.70356494", "0.7011419", "0.69654435", "0.69571877", "0.6935968", "0.6929483", "0.69284...
0.63413924
99
Retrieve the RASD item that specifies memory properties of a VM.
def get_memory_rasd_item(id) request( :expects => 200, :idempotent => true, :method => 'GET', :parser => Fog::ToHashDocument.new, :path => "vApp/#{id}/virtualHardwareSection/memory" ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memory\n flavor[1]\n end", "def query(base)\n request = Packet.create_request(COMMAND_ID_STDAPI_SYS_PROCESS_MEMORY_QUERY)\n\n request.add_tlv(TLV_TYPE_HANDLE, process.handle)\n request.add_tlv(TLV_TYPE_BASE_ADDRESS, base)\n\n response = process.client.send_request(request)\n\n # Build out ...
[ "0.6056893", "0.57646495", "0.57121444", "0.56995195", "0.56995195", "0.5681972", "0.56463814", "0.5639503", "0.55555516", "0.554191", "0.5517495", "0.5515491", "0.55139035", "0.54963505", "0.5422232", "0.54161584", "0.5366832", "0.5352788", "0.52860767", "0.5276052", "0.5264...
0.764388
0
Alternative interface, because when the attr is called "password_hashed", the end user might think they need to hash the password themselves
def password=(passwd) @password_hashed = Digest::SHA256.hexdigest(passwd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash_password\n self.password = Digest::MD5.hexdigest(self.password)\n end", "def password # This is what is called whenever @user.password is referenced. Returns a Password object from the data in a stored encrypted hash\n if password_hash != nil\n @password ||= Password.new(password_hash)\n ...
[ "0.7638675", "0.76014477", "0.76014477", "0.7531649", "0.75026226", "0.74939394", "0.7429286", "0.7422193", "0.7417756", "0.73984075", "0.7327573", "0.73274666", "0.73148143", "0.72998154", "0.72847927", "0.7259636", "0.7251514", "0.7224307", "0.7222039", "0.7216457", "0.7216...
0.0
-1
wait for ajax request to complete
def wait_for_ajax counter = 0 while page.execute_script("return $.active").to_i > 0 counter += 1 sleep(0.1) raise "AJAX request took longer than 20 seconds." if counter >= 400 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_ajax\n Timeout.timeout(Capybara.default_wait_time) do\n loop until finished_all_ajax_requests?\n end\n end", "def wait_for_ajax\n Capybara.default_wait_time = 100\n Timeout.timeout(Capybara.default_wait_time) do\n loop until finished_all_ajax_reques...
[ "0.77657145", "0.7603037", "0.73839015", "0.73839015", "0.7306454", "0.7226458", "0.7157456", "0.71100587", "0.7091194", "0.6991323", "0.6866141", "0.6844231", "0.6638644", "0.65507823", "0.6464531", "0.6464531", "0.64436394", "0.6398106", "0.63327354", "0.6210259", "0.603213...
0.7242013
5
dynamicly wait for the page to load usage: Zpg.wait_for(page_has_loaded)
def wait_for_dom_has_loaded Capybara.default_max_wait_time = 40 Timeout.timeout(Capybara.default_max_wait_time) do loop until page_has_loaded? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until_page_loads(path)\n @wait.until { @driver.current_url == path}\n @wait.until { @driver.execute_script('return PAGE_RENDERED;') == true }\n $verbose ? puts(\"#{path} successfully loaded\") : nil\n end", "def wait_page_load\n @browser.wait_for_load\n end", "def wait_for_page_to_load\n...
[ "0.8252146", "0.82348764", "0.8176", "0.81157035", "0.7664376", "0.7506195", "0.7490176", "0.7466791", "0.74619377", "0.74402004", "0.72430384", "0.71987534", "0.71987534", "0.7163143", "0.7007876", "0.69922346", "0.69584763", "0.69213456", "0.68949145", "0.68949145", "0.6833...
0.8121017
3
return [true/false, [error notifications]]
def check(cache) target = cache.get(@service_name, @section_name, @graph_name) if target.nil? return false, ["target path #{@service_name}/#{@section_name}/#{@graph_name} not exists"] elsif self.complex? ^ target.complex? return false, ["complex type is not match"] end if self.complex? self.check_complex(cache, target) else self.check_graph(cache, target) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def error?\n true\n end", "def error?; end", "def error?; end", "def error?; end", "def has_error?\n status == ERROR \n end", "def success?() end", "def error?\n false\n end", "def error?\n !success?\n end", "def error?()\n #This is a stub, used fo...
[ "0.74053717", "0.72249746", "0.72249746", "0.72249746", "0.72064716", "0.71666086", "0.7148653", "0.71360713", "0.71198606", "0.70378894", "0.70378894", "0.70378894", "0.70378894", "0.70378894", "0.70378894", "0.70378894", "0.70378894", "0.70378894", "0.7007957", "0.6964817", ...
0.0
-1
GET /skill_user_profiles GET /skill_user_profiles.json
def index @skill_user_profiles = SkillUserProfile.all render json: @skill_user_profiles end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @skill_user_profile\n end", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def find_skills\n @user = User.find(params[:id])\n @user_skill = UserSkill.where(\"user_id = @user.id\")\n end", "def profile(user_id: '-')\...
[ "0.7359693", "0.73411167", "0.68477875", "0.68435335", "0.6801662", "0.6649178", "0.65548605", "0.65348184", "0.65195537", "0.6508138", "0.6503332", "0.64921105", "0.64660364", "0.6422087", "0.6382217", "0.6382217", "0.6376064", "0.63727033", "0.6358367", "0.63502324", "0.633...
0.76519805
0
GET /skill_user_profiles/1 GET /skill_user_profiles/1.json
def show render json: @skill_user_profile end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @skill_user_profiles = SkillUserProfile.all\n\n render json: @skill_user_profiles\n end", "def my_profiles\n @user = User.find(params[:user_id])\n @profiles = @user.profiles\n end", "def show\n @user_skill = UserSkill.find(params[:id])\n\n respond_to do |format|\n format.ht...
[ "0.7540472", "0.72380435", "0.6891493", "0.68833876", "0.6773084", "0.6703959", "0.6617603", "0.6580237", "0.6506313", "0.6501368", "0.6499838", "0.64959013", "0.6494269", "0.64883816", "0.64490336", "0.6437379", "0.6426821", "0.64254457", "0.64235854", "0.6380797", "0.633752...
0.74593276
1
POST /skill_user_profiles POST /skill_user_profiles.json
def create byebug @skill_user_profile = SkillUserProfile.new(skill_user_profile_params) if @skill_user_profile.save render json: @skill_user_profile, status: :created, location: @skill_user_profile else render json: @skill_user_profile.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n respond_to do |format|\n begin\n if params[\"skills_user\"][\"user_id\"]\n skill_id = params[\"skills_user\"][\"skill_id\"]\n user_ids = params[\"skills_user\"][\"user_id\"].reject{ |c| c.empty? }\n user_ids.each do |user_id|\n SkillsUser.create(ski...
[ "0.7002764", "0.67209226", "0.6702857", "0.66788155", "0.6667141", "0.6573299", "0.65645134", "0.6552559", "0.65306515", "0.6505235", "0.6467825", "0.64630437", "0.6426796", "0.64245105", "0.64229363", "0.64203393", "0.6418879", "0.6416533", "0.64134467", "0.64090407", "0.640...
0.77314943
0
PATCH/PUT /skill_user_profiles/1 PATCH/PUT /skill_user_profiles/1.json
def update @skill_user_profile = SkillUserProfile.find(params[:id]) if @skill_user_profile.update(skill_user_profile_params) head :no_content else render json: @skill_user_profile.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @user_skill = UserSkill.find(params[:id])\n\n respond_to do |format|\n if @user_skill.update_attributes(params[:user_skill])\n format.html { redirect_to @user_skill, notice: 'User skill was successfully updated.' }\n format.json { head :no_content }\n else\n format...
[ "0.7215414", "0.7133178", "0.7074115", "0.7019957", "0.6900675", "0.67652017", "0.6746017", "0.6702953", "0.67025644", "0.66894346", "0.66782457", "0.66709757", "0.6657884", "0.6657884", "0.66356015", "0.66048175", "0.6593843", "0.6578351", "0.6568655", "0.6542333", "0.653621...
0.790409
0
DELETE /skill_user_profiles/1 DELETE /skill_user_profiles/1.json
def destroy @skill_user_profile.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @user_skill = UserSkill.find(params[:id])\n @user_skill.destroy\n\n respond_to do |format|\n format.html { redirect_to user_skills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n profileSkill = ProfileManager.find_by_skill_id(@skill.id)\n if profil...
[ "0.74844587", "0.7300922", "0.72757494", "0.72757494", "0.7270497", "0.7195045", "0.7182725", "0.7151382", "0.7121585", "0.70660055", "0.70649016", "0.7027839", "0.69821835", "0.6973593", "0.69674", "0.69589704", "0.6921344", "0.6915201", "0.68976235", "0.6895558", "0.6895548...
0.79608434
0
Invokes the view for the given model, passing the assigns as instance variables.
def view( model, view, assigns = {} ) self << Waves.main::Views[ model ].process( request ) do send( view, assigns ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view(model_name, *args)\n orange[model_name].view(self, *args)\n end", "def method_missing(*args, &block)\n @_view.send(*args, &block)\n end", "def execute(*args)\n \n # Verify if the controller answers to the @view_name value\n if args[0].respond_to? lookup_method_to_call(@vie...
[ "0.63349307", "0.5727461", "0.5683393", "0.55732816", "0.5539871", "0.547029", "0.5461702", "0.5348249", "0.5338373", "0.52163655", "0.5191867", "0.51638395", "0.5134275", "0.5130592", "0.50653106", "0.5046084", "0.5044053", "0.5034385", "0.50319874", "0.50297946", "0.5021908...
0.72150844
0
Use a list of special fields to format fields that should either be converted from YAML, or which should be in a specific field type.
def format_value(category, field, value) if YAML_FIELDS.key?(category) && YAML_FIELDS[category].include?(field) return {} if value.nil? return YAML.load(value) elsif INT_FIELDS.key?(category) && INT_FIELDS[category].include?(field) return {} if value.nil? return value.to_i elsif NUM_FIELDS.key?(category) && NUM_FIELDS[category].include?(field) return {} if value.nil? return value.to_f end value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pulp_special_fields(*fields)\n [*fields].each{|f| pulp_special_field(f) }\n end", "def custom_fields_safe_setters\n custom_fields_recipe['rules'].map do |rule|\n case rule['type'].to_sym\n when :date, :date_time, :money then \"formatted_#{rule['name']}\"\n when :fil...
[ "0.6403052", "0.63593787", "0.6224082", "0.61150545", "0.6103187", "0.57921743", "0.572367", "0.5697712", "0.5667349", "0.5560499", "0.5549364", "0.55409074", "0.55353624", "0.55212075", "0.54769385", "0.5476269", "0.5426196", "0.54233557", "0.53854114", "0.53650624", "0.5364...
0.0
-1
Take a number of server/detail records for hosts, then format it into a data structure with standardized fields for display.
def convert_yaml(servers) serverdata = {} servers.each do |server| hostname = server.hostname # Initialize our root fields so that there won't be any surprises from # hosts that don't have data. serverdata[hostname] = {} fields = %w(general netdb puppetfacts puppetstatus advisories vmware upgrades managed) fields.each do |root| serverdata[hostname][root] = {} end server.details.each do |detail| category = detail.category field = detail.name value = format_value(category, field, detail.value) serverdata[hostname][category][field] = value end end serverdata end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatted_servers\n static_ips = connect.describe_addresses.addresses.map(&:public_ip)\n\n servers.select { |server| include_server? server }.map do |server|\n o = {\n date: server.launch_time.to_s,\n az: server.placement.availability_zone,\n id: server.instance_id,\...
[ "0.65381384", "0.65141135", "0.6379995", "0.6336167", "0.6336167", "0.63080657", "0.6054485", "0.60374767", "0.5977949", "0.5946662", "0.58972645", "0.58563995", "0.5850363", "0.5833558", "0.57789594", "0.57771313", "0.5771989", "0.57710767", "0.57526517", "0.57496554", "0.57...
0.67029256
0
Convert ourself to PDF Returns:: A long string with the PDF data
def to_pdf unless id then raise ::ArgumentError, 'Could not find id for this Invoice, are you trying '\ 'to convert an invoice to PDF without creating it?' end encoded = NSConnector::Restlet.execute!( :action => 'invoice_pdf', :invoice_id => id ).first Base64::decode64(encoded) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_pdf_data; end", "def to_pdf\n to_prawn.render\n end", "def get_pdf(x)\n end", "def back_office_pdf_data\n pdf_response = ''\n success = call_ok?(:view_case_pdf, request_pdf_elements) do |body|\n break if body.blank?\n\n pdf_response = body\n end\n\n ...
[ "0.8151852", "0.7173774", "0.7137421", "0.6937948", "0.6875497", "0.6831707", "0.67829734", "0.66935146", "0.6652085", "0.654102", "0.64779013", "0.6469895", "0.6463897", "0.6443894", "0.6426133", "0.6415775", "0.64146245", "0.64083904", "0.6405504", "0.64028656", "0.63964474...
0.6934764
4
Array of classes that should be casted to Strings
def convert_to_ruby_time_classes [Java::JavaSql::Timestamp, Java::JavaSql::Date] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friendly_types_list(arr)\n fixed_arr = Array(arr).map do |x|\n case x\n when \"TrueClass\"\n \"true\"\n when \"FalseClass\"\n \"false\"\n else\n x\n end\n end\n fixed_arr.compact.join(\", \")\n end", "def java_types(params)\n ...
[ "0.72384167", "0.6225202", "0.6183904", "0.61441875", "0.5995277", "0.5917221", "0.5807932", "0.57985723", "0.57623357", "0.56867236", "0.55650556", "0.5564124", "0.5560529", "0.5558528", "0.5505633", "0.5473086", "0.54470575", "0.54464483", "0.54313844", "0.54252136", "0.542...
0.0
-1
converts a JDBC recordset to an array of hashes, with one hash per record
def rs_to_array(rs) # creates an array of hashes from a jdbc record set arr = [] # get basic metadata for the recordset meta = rs.getMetaData cols = meta.getColumnCount.to_i # loop through the records to add them into hash while rs.next do # r is a temporary hash for the row being processed r = {} # add each row to r (1..cols).each do |c| r[meta.get_column_name(c)] = rs.getObject(c) if convert_to_ruby_time_classes.include?(r[meta.get_column_name(c)].class) r[meta.get_column_name(c)] = Time.at(r[meta.get_column_name(c)].get_time / 1000).utc end end # each cols # append hash to array arr << r end # while # completed hash is returned return arr end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resultset_to_hash(resultset)\n meta = resultset.meta_data\n rows = []\n\n while resultset.next\n row = {}\n\n (1..meta.column_count).each do |i|\n name = meta.column_name i\n row[name] = case meta.column_type(i)\n when -6, -5, 5, 4\n # TINYINT, B...
[ "0.7396678", "0.6852979", "0.68526137", "0.67747927", "0.67481357", "0.6468946", "0.6457917", "0.6401315", "0.6384862", "0.63340676", "0.6262384", "0.61914194", "0.61816084", "0.6106723", "0.60552233", "0.60021657", "0.5940283", "0.58896726", "0.584722", "0.57943976", "0.5793...
0.7760621
0
converts a JDBC recordset to an array of hashes, with one hash per record creates a hash from a jdbc record set index_key_field is the field you want to use as the top level hash key... and should exist in the record set multi_val=true will create an array below each index_key_filed, false will create a hash as the child
def rs_to_hash(rs, index_key_field, multi_val) # setting default hash value is necessary for appending to arrays hash=Hash.new{ |h, k| h[k] = [] } # get basic metadata for the recordset meta = rs.getMetaData cols = meta.getColumnCount.to_i # loop through the records to add them into hash while rs.next do # if multi_val is not true... create new hash value as an empty hash if it doesn't already exist hash[rs.getString(index_key_field)]={} if (!hash[rs.getString(index_key_field)] and !multi_val) # if multi_val is true... create new hash value as an empty array if it doesn't already exist hash[rs.getString(index_key_field)]=[] if (!hash[rs.getString(index_key_field)] and multi_val) # r is a temporary hash for the row being processed r=Hash.new # add each row to r (1..cols).each do |c| r[meta.get_column_name(c)] = rs.getObject(c) if convert_to_ruby_time_classes.include?(r[meta.get_column_name(c)].class) r[meta.get_column_name(c)] = Time.at(r[meta.get_column_name(c)].get_time / 1000).utc end end # each cols # set hash value to r if not multi_val hash[rs.getString(index_key_field)] = r if !multi_val # append hash to r if multi_val hash[rs.getString(index_key_field)] << r if multi_val end # while # completed hash is returned return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resultset_to_hash(resultset)\n meta = resultset.meta_data\n rows = []\n\n while resultset.next\n row = {}\n\n (1..meta.column_count).each do |i|\n name = meta.column_name i\n row[name] = case meta.column_type(i)\n when -6, -5, 5, 4\n # TINYINT, B...
[ "0.63470525", "0.6316901", "0.6035682", "0.59250784", "0.59112215", "0.58994716", "0.5812303", "0.5791376", "0.56319875", "0.5567946", "0.5563927", "0.5560006", "0.5557613", "0.54811406", "0.54792386", "0.5462003", "0.54352885", "0.54093677", "0.54042464", "0.539987", "0.5396...
0.7308031
0
outputs a JDBC result set to a formatted file formatter defaults to JSON output unless you provide your own proc
def rs_to_json_file(rs, file_object, formatter) # default formatter outputs json objects for each row formatter = json_formatter unless formatter # get basic metadata for the recordset meta = rs.getMetaData cols = meta.getColumnCount.to_i record_count = 0 # loop through the records to add them into hash while rs.next do # r is a temporary hash for the row being processed r = Hash.new # add each row to r (1..cols).each do |c| r[meta.get_column_name(c)] = rs.getObject(c) if convert_to_ruby_time_classes.include?(r[meta.get_column_name(c)].class) r[meta.get_column_name(c)] = Time.at(r[meta.get_column_name(c)].get_time / 1000).utc end end # each cols # formatter handles output of r to file formatter.call(file_object, r) record_count += 1 end # while return record_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_output(result, format)\n case format\n when :json\n JSON.pretty_generate(result)\n when :yaml\n YAML.dump(result)\n when :text\n result = result.keys if result.respond_to?(:keys)\n result.join(\" \")\n else\n raise ArgumentError, \"Unknown outp...
[ "0.573599", "0.5730984", "0.5653076", "0.5626883", "0.5584541", "0.55663943", "0.5487415", "0.53582895", "0.5343643", "0.5322585", "0.52930725", "0.5291068", "0.52810764", "0.525809", "0.5253949", "0.524335", "0.52348226", "0.5223327", "0.52182007", "0.52170575", "0.5212134",...
0.59093994
0
proc must handle two inputs, |file_object, record hash|
def json_formatter Proc.new do |f,h| h.keys.each do |k| if h[k].class == Float h[k] = nil if (h[k].nan? or h[k].infinite?) end end f.puts h.to_json end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uploaded_file(object, &block)\n if (hash = object).is_a?(Hash) && !hash.key?(\"storage\")\n hash.inject({}) do |result, (name, data)|\n result.update(name.to_sym => uploaded_file(data, &block))\n end\n else\n super\n end\n end", ...
[ "0.6191298", "0.61468464", "0.5899491", "0.5899491", "0.5894899", "0.55915934", "0.55567044", "0.5491611", "0.54639256", "0.5451455", "0.5432953", "0.5428782", "0.5368441", "0.5368441", "0.5368441", "0.5329064", "0.53167045", "0.5300311", "0.52994436", "0.5292541", "0.5266478...
0.0
-1
before_filter :check_active_club, :only => :create
def new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\n @club = Club.new(club_params)\n if (@club.active == true and current_user.has_role? :admin)\n @club.active = true\n else\n @club.active = false\n end\n if (current_user.has_role? :admin)\n #@club.user = club_params.user <- so wars vorher thorsten\n @club.user = Use...
[ "0.71802306", "0.68428546", "0.6786297", "0.676424", "0.6653604", "0.65931195", "0.6585565", "0.6582078", "0.6551983", "0.6546125", "0.6546125", "0.6545225", "0.65092844", "0.64947945", "0.64297515", "0.6412811", "0.6411355", "0.6392397", "0.6378934", "0.63692194", "0.636722"...
0.0
-1
resource_provider should not be allowed.
def test_resource_provider_not_ok assert_raises(ArgumentError) { AzureContainerRegistry.new(resource_provider: "some_type") } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prevent_manager_removal(resource, permission)\n permission.access_type==Policy::MANAGING && permission.contributor==current_user.person && resource.contributor != current_user\n end", "def skip_load_and_authorize_resource(*args)\n skip_load_resource(*args)\n skip_authorize_resource(*arg...
[ "0.63187426", "0.6317294", "0.6277989", "0.6277468", "0.6251333", "0.6210117", "0.6187446", "0.6187446", "0.61353064", "0.61332226", "0.60994405", "0.60974705", "0.6052836", "0.6033207", "0.59970504", "0.59884226", "0.59803236", "0.59800655", "0.59326583", "0.5926553", "0.592...
0.5660148
46
The digits are stored in reverse order and each of their nodes contain a single digit. Add the two numbers and return it as a linked list. You may assume the two numbers do not contain any leading zero, except the number 0 itself. Input: (2 > 4 > 3) + (5 > 6 > 4) Output: 7 > 0 > 8 Input: (2 > 4 > 3) + (1 > 1) Output: (3 > 5 > 3) we want to traverse both input nodes as we traverse, we sum the values of node and have that be the value of a new node in the output list if the sum is greater than 9 we need to carry the 1 to the next node in the result initialize result head dummy set current to result head dummy set current1 and current2 to head1 and head2 initialize tens to 0 while current1 or current2 are not nil or tens is 1 add the values at current1 and current 2 and tens after adding, set tens to 0 if the sum is greater than 9 set tens to 1 set the current nodes next to a new node with value = sum % 10 current = current.next current1 = current1.next current2 = current2.next sum = 0 return result head dummy.next my solution beats 96% on leetcode!
def add_two_numbers(head1, head2) result_dummy = ListNode.new(nil) current, current1, current2 = result_dummy, head1, head2 tens = 0 while current1 && current2 sum = current1.val + current2.val + tens tens = sum > 9 ? 1 : 0 current.next = ListNode.new(sum % 10) current, current1, current2 = current.next, current1.next, current2.next end while current1 sum = current1.val + tens current.next = ListNode.new(sum % 10) tens = sum > 9 ? 1 : 0 current, current1 = current.next, current1.next end while current2 sum = current2.val + tens current.next = ListNode.new(sum % 10) tens = sum > 9 ? 1 : 0 current, current2 = current.next, current2.next end if tens == 1 current.next = ListNode.new(1) end result_dummy.next end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_two_number(l1, l2)\n m, n = l1, l2\n result = ListNode.new(0)\n curr = result\n carry = 0\n while(!m.nil? || !n.nil?)\n x = m.nil? ? 0 : m.val\n y = n.nil? ? 0 : n.val\n sum = x + y + carry\n curr.next = ListNode.new(sum % 10)\n carry = sum / 10\n curr = curr.next\n m = m.next if...
[ "0.80926156", "0.8011175", "0.7946918", "0.78408176", "0.7772548", "0.77425724", "0.766689", "0.76340985", "0.74667794", "0.7416486", "0.7333097", "0.72953606", "0.7196797", "0.7180074", "0.71260834", "0.7053395", "0.680556", "0.6800919", "0.67467386", "0.6723095", "0.6577235...
0.83210474
0
The Order Books channel allow you to keep track of the state of the Bitfinex order book. It is provided on a price aggregated basis, with customizable precision.
def books(symbol="btcusd", precision="P0", params = {}) check_params(params, %i{len}) get("book/#{symbol}/#{precision}", params: params).body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def order_books *markets, &b\n @update_book_state ||= {}\n \n markets.each do |m|\n @update_book_state[m] = b\n end\n \n subscribe *markets\n end", "def orderbook\n Fyb.public.orderbook.perform.parse\n end", "def order_book(params)\n Client.current.get(\"#{r...
[ "0.594006", "0.56894517", "0.557276", "0.5456961", "0.54207736", "0.53878194", "0.5345059", "0.52692515", "0.526555", "0.5232492", "0.5202735", "0.5194791", "0.5181118", "0.5162786", "0.51259065", "0.5104325", "0.5077379", "0.50472796", "0.5045644", "0.50438863", "0.501318", ...
0.6108757
0
Trades endpoint includes all the pertinent details of the trade, such as price, size and time.
def trades(symbol="tBTCUSD", params={}) check_params(params, %i{limit start end sort}) get("trades/#{symbol}", params).body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trades\n Client.current.get(\"#{resource_url}/trades\")\n end", "def trades(options)\n request :public, :get, :trades, options\n end", "def historical_trades(options)\n request :verified, :get, :historicalTrades, options\n end", "def order_trades(order_id, symbol=\...
[ "0.7681636", "0.76265866", "0.67428595", "0.65676385", "0.65676385", "0.64705616", "0.6465185", "0.64600855", "0.64122796", "0.64122796", "0.6399435", "0.6313089", "0.61560106", "0.6057506", "0.6016625", "0.5981335", "0.59667236", "0.59570336", "0.5948715", "0.5885916", "0.58...
0.6594893
3
Get active orders example: client.orders
def orders authenticated_post("auth/r/orders").body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def orders\n return [] if !is_client?\n client.orders\n end", "def orders\n params = { command: 'account_orders' }\n get('/json.php', params)\n end", "def get_orders\n return ShopifyAPI::Order.all\n end", "def invoiced_orders\n return [] if !is_client?\n client.orders\...
[ "0.7704743", "0.77021444", "0.7662757", "0.7491428", "0.7490886", "0.7442856", "0.7375289", "0.7301172", "0.72697365", "0.72041476", "0.71414965", "0.70695806", "0.6999457", "0.69752705", "0.6972367", "0.693029", "0.693029", "0.6920138", "0.6809262", "0.67480963", "0.6729153"...
0.73683786
7
Get Trades generated by an Order
def order_trades(order_id, symbol="tBTCUSD") authenticated_post("auth/r/order/#{symbol}:#{order_id}/trades").body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trades(tid = nil)\n params = { since: tid } unless tid.nil?\n params ||= {}\n\n plain_orders = Fyb.public.trades(params).perform.parse\n\n return [] if plain_orders.empty?\n\n plain_orders.map do |data|\n Order.new data['amount'], data['price'], :undefined, data['tid']\n en...
[ "0.6892253", "0.67314035", "0.65653855", "0.64675975", "0.63530725", "0.61540365", "0.60067284", "0.5973736", "0.59522605", "0.5948502", "0.5883387", "0.5826811", "0.58229923", "0.58169246", "0.57317895", "0.5721638", "0.56706995", "0.5669753", "0.56558037", "0.56540126", "0....
0.68308395
2
Get active positions return [Array]
def active_positions authenticated_post("auth/positions").body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_available_positions\n @state.each.with_index(1).select { |mark, index| mark.nil? }.map { |mark, index| index }\n end", "def current_pos\n\t\treturn arr = [pos_x, pos_y]\n\tend", "def get_available_positions\n\t\tpositions = []\n\t\tfor i in (1..9) do\n\t\t\tx = ((i - 0.1) / 3).truncate\n\t\t\ty = (...
[ "0.701823", "0.67625785", "0.66894484", "0.6672783", "0.6540751", "0.646897", "0.645351", "0.6355815", "0.6198254", "0.6185264", "0.6078444", "0.60753644", "0.60666585", "0.6051508", "0.60495335", "0.6049066", "0.60448986", "0.60087186", "0.59601533", "0.5910466", "0.5875664"...
0.6932113
1
array = [] if array.size == 1 return array[0] elsif array.size == 2 return array.join(" and ") else return array[0..2].join(", ") + ", and " + array[1] end end
def oxford_comma(array) case array.length when 1 "#{array[0]}" when 2 array[0..1].join(" and ") else array[0...-1].join(", ") << ", and #{array[-1]}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_comma_and(array)\n return array.join if array.length <= 1\n array[0..-2].join(', ') + \" and #{array[-1]}\"\nend", "def oxford_comma(array)\n if array.length == 1\n array.join\n elsif array.length == 2\n array.join(\" and \")\n elsif array.length > 2\n element_storage = array.pop\n ne...
[ "0.8817381", "0.87850916", "0.8783364", "0.8672317", "0.86502385", "0.8619752", "0.85513765", "0.84947544", "0.84351546", "0.84203255", "0.83673567", "0.7994148", "0.7987542", "0.7894754", "0.7823151", "0.76368093", "0.76368093", "0.763606", "0.76291895", "0.7420303", "0.7345...
0.8794363
1
Finds all embeds based on the css class the FE uses to identify the embedded content, removing only unnecessary nodes.
def call nodes.each do |node| embed = embeds_by_node[node] user_has_access = user_access_by_embed[embed] node.remove unless user_has_access end doc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_embedded_player\n content&.gsub %(id=\"player\"), %(class=\"player\")\n end", "def nodes\n strong_memoize(:nodes) do\n nodes = doc.xpath(XPATH)\n nodes.drop(EMBED_LIMIT).each(&:remove)\n\n nodes\n end\n end", "def remove_unwanted_nodes!\n # Se...
[ "0.5721283", "0.55783427", "0.5541191", "0.5503434", "0.54839134", "0.5418112", "0.5334216", "0.5320692", "0.5252384", "0.5238315", "0.5207241", "0.5195336", "0.5164493", "0.5156005", "0.5156005", "0.5140594", "0.5070767", "0.50388193", "0.5037241", "0.50359005", "0.49952072"...
0.4465255
65
Returns all nodes which the FE will identify as a metrics embed placeholder element Removes any nodes beyond the first 100
def nodes strong_memoize(:nodes) do nodes = doc.xpath(XPATH) nodes.drop(EMBED_LIMIT).each(&:remove) nodes end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_nodes_used_by_barclamp(role)\n role.elements.values.flatten.compact.uniq\n end", "def unused_nodes\n s = []\n (0..7).each do |i|\n if position[i] && !position[i].used\n s << i\n end\n end\n s\n end", "def blank_nodes\n bindings.values.select {|v| v.is_a?(RDF::Node...
[ "0.5992009", "0.5867051", "0.55657506", "0.55183196", "0.5480147", "0.5459047", "0.54403377", "0.53421336", "0.53418565", "0.532333", "0.52880627", "0.52473325", "0.523446", "0.52164924", "0.5213894", "0.5209335", "0.5198474", "0.5192336", "0.5168889", "0.51537853", "0.515344...
0.69686943
0
Maps a node to key properties of an embed. Memoized so we only need to run the regex to get the project full path from the url once per node.
def embeds_by_node strong_memoize(:embeds_by_node) do nodes.each_with_object({}) do |node, embeds| embed = Embed.new url = node.attribute('data-dashboard-url').to_s permissions_by_route.each do |route| set_path_and_permission(embed, url, route.regex, route.permission) unless embed.permission end embeds[node] = embed if embed.permission end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare_key(node)\n node = node.name if node.is_a? Deployment::Node\n node.to_s.to_sym\n end", "def node_hash(node_id)\n \n end", "def key_for(node)\n \"#{id}-#{node.id}\"\n end", "def node_get(node)\n nodes.fetch prepare_key(node), nil\n end", "def get_node(key); end",...
[ "0.55087274", "0.54031813", "0.53443235", "0.53390694", "0.5290109", "0.5203178", "0.5202327", "0.5169662", "0.5152272", "0.50218284", "0.5009764", "0.49615878", "0.49175355", "0.4910432", "0.48833722", "0.4856148", "0.48459575", "0.4839225", "0.48351142", "0.48011926", "0.47...
0.6592307
0
Attempts to determine the path and permission attributes of a url based on expected dashboard url formats and sets the attributes on an Embed object
def set_path_and_permission(embed, url, regex, permission) return unless path = regex.match(url) do |m| "#{$~[:namespace]}/#{$~[:project]}" end embed.project_path = path embed.permission = permission end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_url\n set_url_type_and_command\n generate_field\n set_domain\n end", "def normalize_url\n return if self.url.blank?\n normalized = self.url.normalize\n if normalized.blank?\n self.errors.add(:url, \"is invalid\")\n return false\n elsif normalized.match(\"archiveof...
[ "0.5481789", "0.5149962", "0.5120458", "0.50904936", "0.50897175", "0.5065979", "0.505942", "0.5042535", "0.49857998", "0.49514598", "0.49513608", "0.49290696", "0.48927814", "0.4890938", "0.4875103", "0.48588884", "0.48439834", "0.4840636", "0.48381987", "0.48188874", "0.480...
0.6149344
0
Returns a mapping representing whether the current user has permission to view the embed for the project. Determined in a batch
def user_access_by_embed strong_memoize(:user_access_by_embed) do unique_embeds.each_with_object({}) do |embed, access| project = projects_by_path[embed.project_path] access[embed] = Ability.allowed?(user, embed.permission, project) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_authorized(current_user)\n return self.goal.public? || self.edit_authorized(current_user)\n end", "def can_edit?(project)\n current_user.id == project.created_by\n end", "def has_embed_permission?\n return get_bot_profile.permission?(:embed_links, command.event.channel)\n end", "...
[ "0.6519714", "0.64993", "0.64456755", "0.6415356", "0.64080507", "0.6336924", "0.6296164", "0.6266389", "0.6262047", "0.62307996", "0.62229747", "0.6189747", "0.61837846", "0.61821437", "0.6144973", "0.6138494", "0.61232483", "0.6101368", "0.60974395", "0.60775936", "0.607688...
0.75265586
0
Returns a unique list of embeds
def unique_embeds embeds_by_node.values.uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def embedments\n model.embedments\n end", "def embeddables\n page_items.map(&:embeddable)\n end", "def embeddables\n self.page_items.collect{|qi| qi.embeddable}\n end", "def embeddings\n @embeddings ||= {}\n end", "def tracked_embeds_many\n @tracked_embeds_many ...
[ "0.6652065", "0.653032", "0.6295075", "0.6067385", "0.5988965", "0.58692795", "0.5819951", "0.55615884", "0.5556146", "0.54799247", "0.5437159", "0.5429653", "0.5420964", "0.5338043", "0.5325094", "0.5319032", "0.52821004", "0.5276762", "0.5276582", "0.5270719", "0.52617794",...
0.8026379
0
Maps a project's full path to a Project object. Contains all of the Projects referenced in the metrics placeholder elements of the current document
def projects_by_path strong_memoize(:projects_by_path) do Project.eager_load(:route, namespace: [:route]) .where_full_path_in(unique_project_paths) .index_by(&:full_path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_project\n @id ||= @project.at('id').inner_html\n @api_url ||= \"#{CONFIG[:api_location]}/projects/#{@id}\"\n @url ||= \"http://www.pivotaltracker.com/projects/#{@id}\"\n @name = @project.at('name').inner_html\n @iteration_length = @project.at...
[ "0.59914744", "0.5985843", "0.5985813", "0.5985813", "0.59412974", "0.5934773", "0.5837891", "0.5812077", "0.5778879", "0.5731566", "0.5714118", "0.56905466", "0.5689402", "0.56801474", "0.56801474", "0.56639034", "0.56637335", "0.5658622", "0.5652741", "0.564035", "0.5613948...
0.62221426
0
Returns a list of the full_paths of every project which has an embed in the doc
def unique_project_paths embeds_by_node.values.map(&:project_path).uniq end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def referenced_files\r\n\t\t(\r\n\t\t\t[file] +\r\n\t\t\t%w[sourcepath importfile].flat_map do |att|\r\n\t\t\t\tfind(att=>/./).flat_map do |asset|\r\n\t\t\t\t\tasset[att].values.compact.map do |path|\r\n\t\t\t\t\t\tpath.sub!(/#.+/,'')\r\n\t\t\t\t\t\tabsolute_path(path) unless path.empty?\r\n\t\t\t\t\tend.compact\r...
[ "0.62346786", "0.5918912", "0.5874733", "0.584984", "0.5781054", "0.57483196", "0.56905484", "0.56779635", "0.56759006", "0.5595686", "0.5595335", "0.55889183", "0.5551173", "0.5548125", "0.5531814", "0.5517835", "0.5515088", "0.5497157", "0.5496448", "0.5496117", "0.54947495...
0.70257634
0
:nodoc: Creates a new Cartage instance. If provided a Cartage::Config object in +config+, sets the configuration and resolves it. If +config+ is not provided, the default configuration will be loaded.
def initialize(config = nil) self.config = config || Cartage::Config.load(:default) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cartage(config = nil)\n if defined?(@cartage) && @cartage && config\n fail \"Cannot provide another configuration after initialization.\"\n end\n @cartage ||= Cartage.new(config)\n end", "def initialize(config = {})\n init_config(config)\n end", "def initialize(config =...
[ "0.80554163", "0.6134293", "0.6134293", "0.6134293", "0.6127044", "0.6127044", "0.6104844", "0.6104844", "0.6104844", "0.605249", "0.6028437", "0.6014652", "0.6005664", "0.59873104", "0.5975472", "0.5953757", "0.5924136", "0.58803815", "0.5823752", "0.5809698", "0.5765067", ...
0.7609528
1
:attr_accessor: compression The compression to be applied to any tarballs created (either the final tarball or the dependency cache tarball).
def compression unless defined?(@compression) @compression = :bzip2 reset_computed_values end @compression end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression\n configuration[:copy_compression] || :gzip\n end", "def compression\n type = configuration[:copy_compression] || :gzip\n case type\n when :gzip, :gz then Compression.new(\"tar.gz\", %w(tar czf), %w(tar xzf))\n when :bzip2, :bz2 t...
[ "0.70987284", "0.7081034", "0.7068281", "0.7027188", "0.6960356", "0.6873269", "0.6820189", "0.6676352", "0.6646644", "0.6611192", "0.655306", "0.6543042", "0.65274256", "0.6490417", "0.6485131", "0.64782757", "0.6372748", "0.6372748", "0.63488275", "0.63266504", "0.6288815",...
0.7153924
0
:attr_reader: dependency_cache The path to the tarball of vendored dependencies in the working path. Vendored dependencies vary by build system. With Ruby and Bundler, this would be the vendor/bundle path; with npm, this would be the node_modules path.
def dependency_cache self.dependency_cache_path = tmp_path unless defined?(@dependency_cache) @dependency_cache end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependency_cache_path\n self.dependency_cache_path = tmp_path unless defined?(@dependency_cache_path)\n @dependency_cache_path\n end", "def dependency_paths\n @dependency_paths ||= [\n *Dir.glob(config.pwd.join(\"**/node_modules/*/package.json\")),\n *Dir.glob(config.pwd.j...
[ "0.6941708", "0.69055873", "0.61196625", "0.6114443", "0.608575", "0.5978488", "0.5899363", "0.58494145", "0.58476746", "0.583105", "0.5794821", "0.5755118", "0.5748979", "0.57454056", "0.57259506", "0.55958134", "0.5591558", "0.5569972", "0.55435646", "0.5539654", "0.5535877...
0.67258745
2
:attr_accessor: dependency_cache_path Reads or sets the vendored dependency cache path. This is where the tarball of vendored dependencies in the working path will reside. On a CI system, this should be written somewhere that the CI system uses for build caching. On Semaphore CI, this would be $SEMAPHORE_CACHE.
def dependency_cache_path self.dependency_cache_path = tmp_path unless defined?(@dependency_cache_path) @dependency_cache_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dependency_cache\n self.dependency_cache_path = tmp_path unless defined?(@dependency_cache)\n @dependency_cache\n end", "def cache_path\n @cache_path ||= Pathname.new(Berkshelf.berkshelf_path).join('.cache', 'halite', dependency.name)\n end", "def dependency_cache\n @dependency_cache ||...
[ "0.76007575", "0.7082776", "0.6601134", "0.6575435", "0.6549439", "0.6465902", "0.643242", "0.639735", "0.63759977", "0.63399404", "0.62761533", "0.62516564", "0.61948854", "0.61614484", "0.61614484", "0.61582416", "0.61439896", "0.61391", "0.6113455", "0.60837907", "0.603766...
0.7770697
0
The cartage configuration object, implemented as a recursive OpenStruct. This can return just the subset of configuration for a command or plugin by providing the +for_plugin+ or +for_command+ parameters.
def config(for_plugin: nil, for_command: nil) if for_plugin && for_command fail ArgumentError, "Cannot get config for plug-in and command together" elsif for_plugin @config.dig(:plugins, for_plugin.to_sym) || OpenStruct.new elsif for_command @config.dig(:commands, for_command.to_sym) || OpenStruct.new else @config end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configuration\n @configuration ||= RecursiveOpenStruct.new\n end", "def configuration\n config = {}\n tag_configuration_plugins.each do |p|\n # the first submodule listed is the one which accepts the configuration\n key = p.plugin.modules.first.submodule_name\n config[key] = p.pa...
[ "0.67473197", "0.6521486", "0.6501981", "0.6461292", "0.6258252", "0.6168597", "0.61253613", "0.608895", "0.60242337", "0.6011729", "0.6007466", "0.59719926", "0.5948451", "0.5947815", "0.59307784", "0.59228456", "0.59129924", "0.5882594", "0.5881301", "0.5881301", "0.5881301...
0.6817802
0
The config file. This should not be used by clients.
def config=(cfg) # :nodoc: fail ArgumentError, "No config provided" unless cfg @plugins = Plugins.new @config = cfg resolve_config! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config_file\n CONFIG_FILE\n end", "def config_file\n @config_file\n end", "def config_file\n @config_file ||= File.join( home_dir, TyrantManager.config_file_basename )\n end", "def config_file\n File.join AppRoot, ConfigFile\n end", "def config\n @config_file\n e...
[ "0.88446945", "0.8732641", "0.8275755", "0.82696533", "0.82634556", "0.825553", "0.81756157", "0.8075817", "0.8058318", "0.8023191", "0.7974412", "0.78031284", "0.7539627", "0.7500866", "0.74866647", "0.7473225", "0.7307393", "0.7282229", "0.7278182", "0.7262936", "0.72606367...
0.0
-1
The release metadata that will be written for the package.
def release_metadata @release_metadata ||= { package: { name: name, repo: { type: "git", # Hardcoded until we have other support url: repo_url }, hashref: release_hashref, timestamp: timestamp } } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def final_release_metadata_json\n @final_release_metadata_json ||= Pathname(\"#{final_name}-release-metadata.json\")\n end", "def metadata_for(package)\n {\n 'omnibus.project' => package.metadata[:name],\n 'omnibus.platform' => publish_platform(package),\n 'omnibus....
[ "0.7370195", "0.704034", "0.6974283", "0.6931723", "0.687603", "0.6865384", "0.68415904", "0.6788328", "0.6764603", "0.6728841", "0.6558144", "0.65011644", "0.64920175", "0.6459338", "0.6448915", "0.6416685", "0.6378653", "0.6378653", "0.6352862", "0.63475406", "0.6345276", ...
0.86120516
0
Return the release hashref.
def release_hashref @release_hashref ||= `git rev-parse HEAD`.chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release_info\n @release_info ||= @connection.get(RELEASE_INFO_PATH)['release']\n end", "def release\n variables[:release]\n end", "def get_release(release_id)\n query_and_build \"releases/#{release_id}\"\n end", "def hash\n return @revision.hash if @revision\n return...
[ "0.6629636", "0.64458394", "0.621137", "0.6109361", "0.5998346", "0.5909543", "0.59017736", "0.5836455", "0.57948226", "0.5766315", "0.57381177", "0.5732085", "0.5723467", "0.5696285", "0.56712866", "0.5638505", "0.56241345", "0.5613825", "0.561206", "0.5600599", "0.5599641",...
0.80670696
0
The working path for the job, in tmp_path.
def work_path @work_path ||= tmp_path.join(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tmp_path\n return @tmp_path if @tmp_path\n\n raise NotImplementedError.new (\"implement this before running on the cluster!\")\n\n end", "def tmp_path\n File.join gem_root, 'tmp'\n end", "def tmp_path(path)\n return File.expand_path(File.join(@@config['tmpPath'], path))\n end",...
[ "0.7774178", "0.7678143", "0.74410623", "0.73712856", "0.72641516", "0.7232138", "0.72193927", "0.7189407", "0.7179259", "0.71389437", "0.71087044", "0.7107827", "0.7095835", "0.70888895", "0.703683", "0.7003822", "0.69759995", "0.69213796", "0.688066", "0.67916536", "0.67849...
0.83223426
0
The path to the resulting releasemetadata.json file.
def final_release_metadata_json @final_release_metadata_json ||= Pathname("#{final_name}-release-metadata.json") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path_for(package)\n \"#{package.path}.metadata.json\"\n end", "def path_for(package)\n \"#{package.path}.metadata.json\"\n end", "def save_release_metadata(local: false)\n display \"Saving release metadata...\"\n json = JSON.generate(release_metadata)\n\n if local\n ...
[ "0.77460736", "0.7704511", "0.7180564", "0.70426124", "0.7034589", "0.68961227", "0.6814203", "0.6727422", "0.6727008", "0.67100906", "0.6627003", "0.6492116", "0.6325937", "0.63027555", "0.6253498", "0.62166125", "0.61987066", "0.61975974", "0.61975974", "0.6139154", "0.6114...
0.84361136
0
A utility method for Cartage plugins to display a +message+ only if verbose is on. Unless the command implemented by the plugin is output only, this should be used.
def display(message) __display(message) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def verbose text\n message(text) if @options[:verbose]\n end", "def verbose text\n message(text) if @options[:verbose]\n end", "def verbose(msg = nil)\n say(clean_text(msg || yield)) if Gem.configuration.really_verbose\n end", "def verbose_message(msg)\n\t\t\t\tUI.message(msg) if (@verbose)\n\t\t...
[ "0.7754133", "0.7754133", "0.7534742", "0.73765224", "0.71681106", "0.7131517", "0.7077157", "0.7043062", "0.7043062", "0.70364", "0.7033772", "0.7029334", "0.68519056", "0.6781266", "0.6774808", "0.67433506", "0.6718149", "0.66981995", "0.66818964", "0.66798705", "0.6650936"...
0.0
-1
A utility method for Cartage plugins to run a +command+ in the shell. Uses IO.popen.
def run(command) display command.join(" ") IO.popen(command + [err: %i[child out]]) do |io| __display(io.read(128), partial: true, verbose: true) until io.eof? end fail StandardError, "Error running '#{command.join(" ")}'" unless $?.success? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run(*command)\n IO.popen(command) { |io| io.read.strip }\n end", "def run(command)\n if !command.kind_of?(Array)\n cmd = [command]\n else\n cmd = command\n end\n\n cmd.each { |line|\n puts line\n IO.popen(line) { |io|\n io.each_char do |c|\n print c\n end\n }\n }...
[ "0.7388119", "0.7218038", "0.7160022", "0.7160022", "0.7095856", "0.69853926", "0.69639444", "0.69479007", "0.69479007", "0.6928651", "0.69023323", "0.6870257", "0.68451625", "0.6845134", "0.67952555", "0.6788669", "0.67872506", "0.6777063", "0.67479104", "0.67164063", "0.670...
0.6563563
33
Returns the registered plugins, once configuration has been resolved.
def plugins @plugins ||= Plugins.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plugins\n @plugins ||= begin\n plugin_names = (config.plugins || [:all]).map { |p| p.to_sym }\n Railtie.plugins.select { |p|\n plugin_names.include?(:all) || plugin_names.include?(p.plugin_name)\n }.map { |p| p.new } + Plugin.all(plugin_names, config.paths.vendor.plugins)\n ...
[ "0.79258525", "0.7908091", "0.7842666", "0.78225625", "0.782019", "0.780643", "0.77075565", "0.77065486", "0.7691079", "0.76895905", "0.7687014", "0.76656026", "0.74337703", "0.7415589", "0.7391794", "0.73826253", "0.737016", "0.72403294", "0.7186255", "0.71715355", "0.715322...
0.7643335
12
Create the release package(s). Requests: +:vendor_dependencies+ (vendor_dependencies, path) +:pre_build_package+ +:build_package+ +:post_build_package+
def build_package # Force timestamp to be initialized before anything else. This gives us a # stable timestamp for the process. timestamp # Prepare the work area: copy files from root_path to work_path based on # the resolved Manifest.txt. prepare_work_area # Anything that has been modified locally needs to be reset. restore_modified_files # Save both the final release metadata and the in-package release metadata. save_release_metadata # Vendor the dependencies for the package. vendor_dependencies # Request that supporting plug-ins build the package. request_build_package end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_package_tasks\n prerelease_version\n\n Gem::PackageTask.new spec do |pkg|\n pkg.need_tar = @need_tar\n pkg.need_zip = @need_zip\n end\n\n desc \"Install the package as a gem. (opt. NOSUDO=1)\"\n task :install_gem => [:clean, :package, :check_extra_deps] do\n install_gem Dir...
[ "0.7017179", "0.68987334", "0.68424535", "0.68273526", "0.6779996", "0.6650517", "0.64741325", "0.6452508", "0.6430756", "0.6377577", "0.6262525", "0.6233674", "0.61593926", "0.61492634", "0.61390024", "0.6132946", "0.6100692", "0.6081724", "0.602151", "0.60104483", "0.599980...
0.72996867
0
Just save the release metadata.
def save_release_metadata(local: false) display "Saving release metadata..." json = JSON.generate(release_metadata) if local Pathname(".").join("release-metadata.json").write(json) else work_path.join("release-metadata.json").write(json) final_release_metadata_json.write(json) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release\n fail AlreadyRelease unless prerelease?\n @special = ''\n @metadata = ''\n end", "def release_metadata\n @release_metadata ||= {\n package: {\n name: name,\n repo: {\n type: \"git\", # Hardcoded until we have other support\n url: repo_url\n ...
[ "0.6915536", "0.67203814", "0.66205096", "0.6428404", "0.63915217", "0.6343135", "0.6320992", "0.6207279", "0.6163682", "0.6148982", "0.6146405", "0.61162776", "0.60762054", "0.6056135", "0.603418", "0.602915", "0.6024174", "0.6023661", "0.60146034", "0.5988743", "0.5916445",...
0.8056552
0
Returns the flag to use with +tar+ given the value of +compression+.
def tar_compression_flag case compression when :bzip2, "bzip2", nil "j" when :gzip, "gzip" "z" when :none, "none" "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tar_compression_flag(path)\n case path\n when /\\.tar\\.bz2$/\n return \"-j\"\n when /\\.tar\\.gz$|\\.tgz$/\n return \"-z\"\n when /\\.tar\\.xz$/\n return \"-J\"\n else\n return nil\n end\n end", "def tar_compression_extension\n case compression\n ...
[ "0.81088746", "0.76863986", "0.7069913", "0.6714602", "0.62748426", "0.6239286", "0.61987615", "0.6151005", "0.61487615", "0.60653067", "0.60653067", "0.60440516", "0.6039443", "0.600582", "0.599921", "0.5957356", "0.589299", "0.58805084", "0.5847525", "0.58454776", "0.582538...
0.86584175
0
Returns the extension to use with +tar+ given the value of +compression+.
def tar_compression_extension case compression when :bzip2, "bzip2", nil ".bz2" when :gzip, "gzip" ".gz" when :none, "none" "" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compression_extension\n case compression\n when :gzip, :gz then \"tar.gz\"\n when :bzip2, :bz2 then \"tar.bz2\"\n when :zip then \"zip\"\n else raise ArgumentError, \"invalid compression type #{compression.inspect}\"\n end\n e...
[ "0.88780177", "0.7630842", "0.7230568", "0.65677327", "0.65666264", "0.6450668", "0.6192784", "0.6192784", "0.6192784", "0.5966159", "0.59362817", "0.59341556", "0.5931738", "0.5915673", "0.5915673", "0.583386", "0.58309007", "0.58104515", "0.580815", "0.57887346", "0.5722649...
0.88721985
1
Recursively copy a provided +path+ to the work_path, using a tar pipeline. The target location can be amended by the use of the +to+ parameter as a relative path to work_path. If a relative +path+ is provided, it will be treated as relative to root_path, and it will be used unmodified for writing to the target location. If an absolute path is provided, only the last part of the path will be used as the target name. An error will be raised if either +path+ or +to+ contains a parentrelative reference (../), or if the tar pipeline fails. === Examples cartage.recursive_copy('public/assets') This will cause root_path/public/assets to be copied into work_path/public/assets. cartage.recursive_copy('/tmp/public/assets') This will cause /tmp/public/assets to be copied into work_path/assets. cartage.recursive_copy('/tmp/public/assets', to: 'public') This will cause /tmp/public/assets to be copied into work_path/public/assets.
def recursive_copy(path, to: nil) path = Pathname(path) to = Pathname(to) if to if path.to_s =~ %r{\.\./} || (to && to.to_s =~ %r{\.\./}) fail StandardError, "Recursive copy parameters cannot contain '/../'" end if path.relative? parent = root_path else parent, path = path.split end target = work_path target /= to if to tar_cf_cmd = ["tar", "cf", "-", "-h", "-C", parent, path].map(&:to_s) tar_xf_cmd = ["tar", "xf", "-", "-C", target].map(&:to_s) IO.popen(tar_cf_cmd) do |cf| IO.popen(tar_xf_cmd, "w") do |xf| xf.write cf.read end fail StandardError, "Error running #{tar_xf_cmd.join(" ")}" unless $?.success? end fail StandardError, "Error running #{tar_cf_cmd.join(" ")}" unless $?.success? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def copy(source, destination_path)\n # TODO: Honor file mode\n\n source = Pathname.new(source) unless source.is_a?(Pathname)\n random = random_dir\n\n # Add Dockerfile instruction\n if source.directory?\n self << 'ADD ' + random + ' ' + destination_path\n ...
[ "0.5896885", "0.5759824", "0.5518162", "0.54922396", "0.5378837", "0.5352244", "0.52944356", "0.5287502", "0.5257331", "0.5234744", "0.5151499", "0.51333517", "0.5127549", "0.51213557", "0.5119133", "0.51166093", "0.50594896", "0.5042769", "0.5019281", "0.5015522", "0.4985219...
0.8040494
0
Dividing 1 by the distance because the closer the point is to the center, the bigger should it's score be If we have distances 2 and 4 then the scores will become 1/2=0.5 and 1/4=0.25, which makes 1st one better as 0.5 > 0.25 When
def score(words) 1.0 / @clusterer.distance(@clusterer.centroids[0], vector_from_line(words)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compute x, distance\n (x / distance).round - 1\n end", "def score_with_phrf_time_on_distance\n cf = self.rating\n et = self.elapsed_time\n d = self.distance\n\n (et - (d * cf)).round\n end", "def weight\n num_motions.zero? ? 0.5 : total_score.fdiv(max_score)\n end", "def dist...
[ "0.67352486", "0.65866834", "0.6487966", "0.634649", "0.6240171", "0.6237455", "0.6150616", "0.6136689", "0.6103726", "0.6092958", "0.6092958", "0.60846466", "0.5987221", "0.59474707", "0.5939597", "0.5927139", "0.5912", "0.5893026", "0.58628994", "0.5852091", "0.5839931", ...
0.6074312
12
This started out as a straight line drawn to step barbs, but at a certain point it also started being used to draw straight lines with no arrow heads from step barbs to calm barbs.
def render_to_step_barb(calm=false) stroke ARROW_STROKE_COLOR stroke_weight ARROW_STROKE_WEIGHT # Initial trig calculations for the arrow head adj = @to_barb.pos.x - @from_barb.pos.x opp = @to_barb.pos.y - @from_barb.pos.y angle = Math.atan(opp/adj) if adj>0 and opp<0.001 and opp>-0.001 line_from = Point.new(@from_barb.pos.x+OFFSET_LENGTH, @from_barb.pos.y) line_to = Point.new(@to_barb.pos.x-OFFSET_LENGTH, @to_barb.pos.y) elsif adj<0 and opp<0.001 and opp>-0.001 line_from = Point.new(@from_barb.pos.x-OFFSET_LENGTH, @from_barb.pos.y) line_to = Point.new(@to_barb.pos.x+OFFSET_LENGTH, @to_barb.pos.y) elsif adj<0.001 and adj>-0.001 and opp<0 line_from = Point.new(@from_barb.pos.x, @from_barb.pos.y-OFFSET_LENGTH) line_to = Point.new(@to_barb.pos.x, @to_barb.pos.y+OFFSET_LENGTH) elsif adj<0.001 and adj>-0.001 and opp>0 line_from = Point.new(@from_barb.pos.x, @from_barb.pos.y+OFFSET_LENGTH) line_to = Point.new(@to_barb.pos.x, @to_barb.pos.y-OFFSET_LENGTH) elsif adj>0 and opp<0 line_from = Point.new(@from_barb.pos.x+OFFSET_LENGTH*(Math.cos(angle)).abs, @from_barb.pos.y-OFFSET_LENGTH*(Math.sin(angle)).abs) line_to = Point.new(@to_barb.pos.x-OFFSET_LENGTH*(Math.cos(angle)).abs, @to_barb.pos.y+OFFSET_LENGTH*(Math.sin(angle)).abs) elsif adj<0 and opp<0 line_from = Point.new(@from_barb.pos.x-OFFSET_LENGTH*Math.cos(angle), @from_barb.pos.y-OFFSET_LENGTH*(Math.sin(angle)).abs) line_to = Point.new(@to_barb.pos.x+OFFSET_LENGTH*Math.cos(angle), @to_barb.pos.y+OFFSET_LENGTH*(Math.sin(angle)).abs) elsif adj<0 and opp>0 line_from = Point.new(@from_barb.pos.x-OFFSET_LENGTH*Math.cos(angle), @from_barb.pos.y+OFFSET_LENGTH*(Math.sin(angle)).abs) line_to = Point.new(@to_barb.pos.x+OFFSET_LENGTH*Math.cos(angle), @to_barb.pos.y-OFFSET_LENGTH*(Math.sin(angle)).abs) elsif adj>0 and opp>0 line_from = Point.new(@from_barb.pos.x+OFFSET_LENGTH*Math.cos(angle), @from_barb.pos.y+OFFSET_LENGTH*(Math.sin(angle)).abs) line_to = Point.new(@to_barb.pos.x-OFFSET_LENGTH*Math.cos(angle), @to_barb.pos.y-OFFSET_LENGTH*(Math.sin(angle)).abs) else puts "default arrow" line_from = @from_barb.pos line_to = @to_barb.pos end # Draw a line from one point to the next. line line_from.x, line_from.y, line_to.x, line_to.y # Draw the arrow head if !calm push_matrix translate line_to.x, line_to.y rotate calculate_rotation(adj, opp, angle) line 0, 0, ARROW_WIDTH, -ARROW_HEIGHT line 0, 0, -ARROW_WIDTH, -ARROW_HEIGHT pop_matrix end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def straight\n @line_type = '--'\n self\n end", "def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end", "def line(x0, y0, x1, y1)\n # clean params\n x0, y0, x1, y1 = x0.to_i, y0.to_i, x1.to_i, y1.to_i\n y0, y1, x0, x1 = y1, y0, x1, x0 if y0>y1\n sx = (dx = x1-x0...
[ "0.7066812", "0.67349887", "0.6514534", "0.64701605", "0.6394434", "0.63000363", "0.61088437", "0.60969186", "0.6061821", "0.60171723", "0.60125303", "0.5992418", "0.59683186", "0.59341025", "0.5927244", "0.59172577", "0.59150565", "0.5903107", "0.586656", "0.5856103", "0.583...
0.7237108
0