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
The delete_link was made so that we could pass it in to return_bid (below). What delete_link does, is it passes the html that makes up the "delete" bid button. So that we can use it only if the dealer is a current dealer.
def delete_link first_half_link = "<a data-confirm='Are you sure?' id='destroy' rel='nofollow' \ data-method='delete' href='http://localhost:3000/bids/2?auction_id=2&amp;bid_id=330&amp;user_id=2'>" first_half_link += "<button class='top-cta-button btn-user-auc btn-delete' type='button'>Delete Bid</but...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_link(target, confirm, title, divider)\n if current_user && current_user.admin?\n @link = divider + link_to(\"delete\", target, :method => :delete, :confirm => confirm, :title => title)\n @link.html_safe\n end\n end", "def delete_link\n button_tag(t('.delete_row'), name: 'delete...
[ "0.65570986", "0.6489847", "0.6456894", "0.63427144", "0.63211954", "0.62880343", "0.62414443", "0.62369555", "0.6176137", "0.6171365", "0.61483175", "0.6145453", "0.61317587", "0.60769045", "0.60721946", "0.60453004", "0.6034792", "0.60210735", "0.6018854", "0.601487", "0.60...
0.80300635
0
GET /products GET /products.json
def index @products = Product.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "def products\n request :public, :get, :products\n end", "def index\n @products = Product.all\n render json: @products\n end", "def index\n begin\n ...
[ "0.79500145", "0.7929853", "0.79054135", "0.77477723", "0.76619905", "0.7622153", "0.762195", "0.762195", "0.762195", "0.76070404", "0.75873625", "0.75828224", "0.7578298", "0.75750685", "0.7565435", "0.7565435", "0.7565435", "0.7565435", "0.7530454", "0.7523024", "0.75097287...
0.0
-1
GET /products/1 GET /products/1.json
def show @user=User.find(@product.user_id) @info=@user.info respond_to do |format| format.html format.pdf {send_data @product.receipt.render, filename: "#{@product.title}-receipt.pdf", type: "application/pdf", disposition: :attachment} format.js end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def product(name)\n get(\"/apiproducts/#{name}\")\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def show\n @product = Product.find(params[:id])\n\n render json: @product\n end", "def index\n @api_v1_products = Product.all\n jso...
[ "0.77235323", "0.7633036", "0.7631867", "0.76078486", "0.7576577", "0.7553569", "0.7507231", "0.74852717", "0.7456652", "0.7451191", "0.7438723", "0.7421645", "0.7362207", "0.73200786", "0.7319866", "0.7319866", "0.7319866", "0.7316551", "0.7313048", "0.7309769", "0.7294826",...
0.0
-1
POST /products POST /products.json
def create @angular = Product.new @angular.title=params[:products][:title] @angular.description=params[:products][:description] if user_signed_in? @angular.update_attributes(user_id: current_user.id) end if @angular.valid? @angular.save! end respond_to do |format| f...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @product = Product.new(product_args)\n\n if @product.save\n render json: Product.all, status: :created\n else\n render json: @product.errors, status: :unprocessable_entity\n end\n end", "def create\n if params[:products]\n params[:products].each do |product|\n @...
[ "0.7675232", "0.759164", "0.7561976", "0.7532859", "0.7532595", "0.75084615", "0.74228996", "0.73923856", "0.73757577", "0.73570025", "0.73236287", "0.7288349", "0.71455485", "0.70521015", "0.70491886", "0.7041947", "0.703893", "0.703893", "0.703893", "0.70338047", "0.7027190...
0.0
-1
PATCH/PUT /products/1 PATCH/PUT /products/1.json
def update @angular = Product.find(params[:id]) @angular.update_attributes(title: params[:products][:title], description: params[:products][:description]) respond_to do |format| if @angular.valid? format.html { redirect_to store_index_path, notice: 'Product was successfully updated.' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "def update\n if @product.update(product_params)\n render json: @product, status: :ok#, location: @colle...
[ "0.7269931", "0.6935652", "0.68690825", "0.6846676", "0.68126076", "0.67678404", "0.6749974", "0.6741848", "0.67151767", "0.6700884", "0.6686023", "0.66597176", "0.6654553", "0.66536564", "0.664067", "0.664067", "0.66382414", "0.6631012", "0.6631012", "0.6627257", "0.6620688"...
0.6477706
55
DELETE /products/1 DELETE /products/1.json
def destroy @product.destroy respond_to do |format| format.html { redirect_to root_path, notice: 'Product was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n product = Product.find(params[:id])\n product.destroy\n\n render json: { deleted: params[:id] }\n end", "def delete_product(name)\n delete(\"/apiproducts/#{name}\")\n end", "def destroy\n p @product.destroy!\n render json: { result: 'deleted' }, status: :ok\n end", ...
[ "0.7716767", "0.7593029", "0.7548404", "0.75026053", "0.7501899", "0.74741083", "0.7439505", "0.7417943", "0.74088925", "0.7370336", "0.73533446", "0.73478407", "0.73357344", "0.73357344", "0.73357344", "0.73308176", "0.73308176", "0.73308176", "0.73308176", "0.73308176", "0....
0.7125609
78
Use callbacks to share common setup or constraints between actions.
def set_product begin @product = Product.find(params[:id]) rescue raise Cinema::NotFound end 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.6165422", "0.60457647", "0.5946384", "0.5916027", "0.58905005", "0.583495", "0.5777223", "0.56995213", "0.56995213", "0.56532377", "0.5621348", "0.5422839", "0.54118705", "0.54118705", "0.54118705", "0.53935355", "0.5379617", "0.53577393", "0.53407264", "0.53398263", "0.53...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def product_params params.require(:product).permit(:user_id, :category, :title, :full_description,:description, :uploaded_file, :price) 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.6981273", "0.6783789", "0.67460483", "0.6742222", "0.67354137", "0.65934366", "0.65028495", "0.6497783", "0.64826745", "0.6479415", "0.6456823", "0.6440081", "0.63800216", "0.6376521", "0.636652", "0.6319898", "0.6300256", "0.62994003", "0.6293621", "0.6292629", "0.6291586...
0.0
-1
GET /shows GET /shows.json
def index @semester = Semester.where(month: params[:month], year: params[:year])[0] @semester ||= Semester.current_semester # @shows = Show.where("name != 'ALL FREEFORM'").includes(:slots).select{ |s| s.slots.collect{ |e| e.semester }.include? @semester.to_f } @slots = @semester.slots.to_a.uniq { |s| s....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n\t\tShow.includes( :links, :songs, :artists, :presses )\n\t\t@shows = Show.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shows }\n end\n end", "def shows\n res = call(\n 'shows',\n {}\n )\n res.body['Itasa_Rest...
[ "0.78805876", "0.7877602", "0.77299565", "0.757674", "0.7516941", "0.7516941", "0.7368452", "0.733613", "0.73318255", "0.732692", "0.72918516", "0.7288134", "0.72450614", "0.7172215", "0.71323", "0.71112794", "0.7028291", "0.69990677", "0.6958135", "0.6955225", "0.69486535", ...
0.0
-1
GET /shows/1 GET /shows/1.json
def show @show = Show.find(params[:id]) @slots = (@show.slots).sort_by { |s| s.semester }.reverse[0..3].reverse @slots = @slots.map do |s| [s, s.donations.map { |d| d.amount }.reduce(:+).to_f, s.donations.sort_by { |x| x.amount }.reverse]end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @shows = Show.all\n respond_to do |format|\n format.html { render :index }\n format.json { render json: @shows, status: 200}\n end\n end", "def index\n\t\tShow.includes( :links, :songs, :artists, :presses )\n\t\t@shows = Show.all\n\n respond_to do |format|\n format.html # ...
[ "0.75581115", "0.75445014", "0.74733186", "0.743514", "0.743514", "0.74002445", "0.73533237", "0.7266569", "0.72022253", "0.71759725", "0.7146307", "0.70783514", "0.70771", "0.70651764", "0.704944", "0.7023761", "0.6998502", "0.69776654", "0.69504577", "0.6933013", "0.6911106...
0.0
-1
GET /shows/new GET /shows/new.json
def new @show = Show.new respond_to do |format| format.html { render layout: !request.xhr? } format.json { render json: @show } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @show = Show.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show }\n end\n end", "def new\n @show = Show.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show }\n end\n end", "d...
[ "0.77592385", "0.77592385", "0.74303067", "0.73233145", "0.7112321", "0.70036614", "0.6983819", "0.69681025", "0.69681025", "0.69681025", "0.6965712", "0.6961047", "0.6915305", "0.6909489", "0.6873775", "0.6871793", "0.68568754", "0.68568754", "0.68568754", "0.68568754", "0.6...
0.71105963
5
POST /shows POST /shows.json
def create @show = Show.new(params[:show]) respond_to do |format| if @show.save format.html { redirect_to @show, notice: 'Show was successfully created.' } format.json { render json: @show, status: :created, location: @show } else format.html { render action: 'new' } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n\t\tresult = Tmdb::TV.detail(show_params[:tmdbid])\n\t\t@show = Show.new(show_params)\n\t\t@show.title = result[\"name\"]\n\t\t@show.description = result[\"overview\"]\n\t\t@show.seasons = result[\"number_of_seasons\"]\n\t\t@show.episodes = result[\"number_of_episodes\"]\n\t\t@show.episoderuntime = res...
[ "0.7090245", "0.69874924", "0.68574864", "0.68128264", "0.6810996", "0.6810348", "0.6780591", "0.6780179", "0.67438644", "0.6730843", "0.670167", "0.66577274", "0.66354007", "0.6586092", "0.6558976", "0.65305185", "0.65305185", "0.65305185", "0.646569", "0.64260846", "0.64260...
0.6802925
6
PUT /shows/1 PUT /shows/1.json
def update @show = Show.find(params[:id]) respond_to do |format| if @show.update_attributes(params[:show]) format.html { redirect_to @show, notice: 'Show was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\trespond_to do |format|\n\t\t\tresult = Tmdb::TV.detail(show_params[:tmdbid])\n\t\t\t@show.title = result[\"name\"]\n\t\t\t@show.description = result[\"overview\"]\n\t\t\t@show.seasons = result[\"number_of_seasons\"]\n\t\t\t@show.episodes = result[\"number_of_episodes\"]\n\t\t\t@show.episoderuntime ...
[ "0.66714674", "0.6445267", "0.6444996", "0.6444996", "0.6378103", "0.637141", "0.637141", "0.6305252", "0.6282397", "0.61939186", "0.616379", "0.6144003", "0.61326903", "0.61163205", "0.60921234", "0.60826564", "0.60332125", "0.5956754", "0.59334475", "0.5907587", "0.5860528"...
0.63821113
4
DELETE /shows/1 DELETE /shows/1.json
def destroy @show = Show.find(params[:id]) @show.destroy respond_to do |format| format.html { redirect_to shows_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tv_show = TvShow.find(params[:id])\n @tv_show.destroy\n\n respond_to do |format|\n format.html { redirect_to tv_shows_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @show.destroy\n respond_to do |format|\n format.html { redirect_to shows_url...
[ "0.77830184", "0.7615877", "0.7506696", "0.7506696", "0.74540997", "0.744454", "0.744454", "0.744454", "0.7391212", "0.73817", "0.72914714", "0.72735435", "0.7210868", "0.7126504", "0.70861596", "0.7065633", "0.70438385", "0.7024931", "0.70234585", "0.7013925", "0.70117474", ...
0.7744592
2
Heroku users don't need to specify application_id if they have ENV['BLITLINE_URL'] defined
def add_job(image_source, function_name, function_params, image_identifier, application_id = nil) job = Blitline::Job.new(image_source) environment_app_id = ENV['BLITLINE_URL'] && ENV['BLITLINE_URL'].split("/").last job.application_id = environment_app_id || application_id job.add_function(function_name...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fb_app_id\n ENV['facebook_app_id']\n end", "def bc_client_id\n ENV['BC_CLIENT_ID']\nend", "def app_key \n 'app-id-9bb5f1c77f0df722a9b1bc650a41988a'\n end", "def app_id; end", "def app_id; end", "def app_url\n ENV['APP_URL']\nend", "def bc_client_secret\n ENV['BC_CLIENT_SECRET']\nend", ...
[ "0.69874835", "0.6840295", "0.6495854", "0.6403111", "0.6403111", "0.6250635", "0.62248236", "0.61225146", "0.6112339", "0.5830982", "0.5826384", "0.58244365", "0.57949364", "0.5767963", "0.5729319", "0.56936735", "0.5690685", "0.567616", "0.5667968", "0.56247425", "0.5623686...
0.0
-1
Heroku users don't need to specify application_id if they have ENV['BLITLINE_URL'] defined
def add_job_with_callback(image_source, function_name, function_params, image_identifier, postback_url, application_id = nil) job = Blitline::Job.new(image_source) environment_app_id = ENV['BLITLINE_URL'] && ENV['BLITLINE_URL'].split("/").last job.application_id = environment_app_id || application_id jo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fb_app_id\n ENV['facebook_app_id']\n end", "def bc_client_id\n ENV['BC_CLIENT_ID']\nend", "def app_key \n 'app-id-9bb5f1c77f0df722a9b1bc650a41988a'\n end", "def app_id; end", "def app_id; end", "def app_url\n ENV['APP_URL']\nend", "def bc_client_secret\n ENV['BC_CLIENT_SECRET']\nend", ...
[ "0.69879574", "0.68401754", "0.6495121", "0.64042944", "0.64042944", "0.6249365", "0.6224154", "0.6122065", "0.6113359", "0.58303213", "0.5826365", "0.58235306", "0.57936746", "0.57695496", "0.5730028", "0.5693706", "0.56897193", "0.56760454", "0.56687456", "0.5625268", "0.56...
0.0
-1
vi: set ft=ruby :
def set_variable(config, variable_name) value = ENV[variable_name] if value.to_s != '' config.vm.provision 'shell' do |s| s.inline = "echo export #{variable_name}=\"\'\"\'#{value.to_s}\'\"\'\" | tee -a /home/vagrant/.bashrc" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def result_of_executing_the_commands\n @commands = \":set ft=ruby\r\" + @commands\n RobotVim::Runner.new.run(:input_file => @input, :commands => @commands)\nend", "def ruby\n unless @ruby\n @ruby = \"\"\n @body.each_line do |l|\n @commands << {:ruby => l}\n @ruby << l\n ...
[ "0.5803009", "0.5457295", "0.544725", "0.5440447", "0.540047", "0.5387971", "0.53144646", "0.520739", "0.5160547", "0.5159978", "0.5159782", "0.5146485", "0.5083554", "0.50814515", "0.5080929", "0.5077087", "0.50639117", "0.50580174", "0.50580174", "0.50380445", "0.50380445",...
0.0
-1
adds addtional move data to learnset data
def expand_learnset_data(moves, learnset) move_data = [] (0..19).each do |move| if learnset["move_id_#{move}_index"] ls_data = {"move_name" => learnset["move_id_#{move}"], "lvl_learned" => learnset["lvl_learned_#{move}"], "move_id" => learnset["move_id_#{move}_index"], "index" => move } # all data for th...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_train(train)\n trains << train\n end", "def add_train(train)\n @trains << train\n end", "def train_set\n data_input = data_output = @data_input\n data_input.delete_at(data_input.index(data_input.last))\n data_output.delete_at(data_output.index(data_output.first))\n RubyFann::TrainDa...
[ "0.6022358", "0.59270006", "0.5703337", "0.5608523", "0.53955495", "0.53706986", "0.5238608", "0.5236292", "0.5236099", "0.5213403", "0.5199677", "0.5109931", "0.5086668", "0.5081937", "0.50629234", "0.50609297", "0.50521576", "0.5040401", "0.503624", "0.50196826", "0.5017408...
0.6698489
0
Table view data source
def numberOfSectionsInTableView(tableView) @hack_list ? 1: 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @contents = DataTable.all\n\n \n end", "def index\n @datatable = ComplainsDatatable.new view_context\n end", "def index\n @datat_table_data = DatatTableDatum.all\n end", "def data_source=(val)\n PPCurses.implements_protocol( val, %w(number_of_rows_in_table object_value_for ))\n ...
[ "0.7092971", "0.67255116", "0.66212237", "0.64762366", "0.62949526", "0.6291978", "0.62858194", "0.6163798", "0.61115223", "0.6096364", "0.5997748", "0.5997748", "0.5997748", "0.5997748", "0.5985078", "0.5895799", "0.58901", "0.5889067", "0.58595294", "0.58509016", "0.5840576...
0.0
-1
check_authorization before_filter :authenticate private def authenticate
def store_location # store last url as long as it isn't a /users path session[:previous_url] = request.fullpath unless request.fullpath =~ /\/users/ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate!\n not_authorized() unless logged_in?()\n end", "def authenticate\n unauthorized unless current_user\n end", "def authenticate\n \t\tlogged_in? || access_denied\n \tend", "def authenticate\n logged_in? || access_denied\n end", "def authenticate_user\n\t\trender_unauthorized u...
[ "0.77665126", "0.77644473", "0.77012634", "0.7678428", "0.76759154", "0.7651861", "0.7640333", "0.76154196", "0.75846654", "0.7568927", "0.754053", "0.75329995", "0.7531042", "0.75201833", "0.7518839", "0.75067073", "0.7498679", "0.747182", "0.7462576", "0.74565464", "0.74379...
0.0
-1
Time Complexity: 0(n) Space Complexity: 0(n)
def is_palindrome(string) string.upcase! # this only allows alphabetic characters string.gsub!(/[^A-Z]/, "") str_array = string.chars index = str_array.length - 1 reversed = [] while index >= 0 reversed << str_array[index] index -= 1 end if reversed == str_array return true else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "def solution(a)\r\n n=a.size\r\n i=1\r\n for k in a.sort do\r\n\tif k!=i \r\n\t then \r\n\t return 0\r\n\t break;\r\n\tend\r\n i+=1;\r\...
[ "0.6664638", "0.656994", "0.64952004", "0.640336", "0.6331428", "0.6317566", "0.6304442", "0.627707", "0.627257", "0.6240756", "0.62013644", "0.6190454", "0.6171235", "0.6164897", "0.6162068", "0.6160199", "0.61476713", "0.6144543", "0.6135978", "0.6113796", "0.6096017", "0...
0.0
-1
Time Complexity: O(nm) (array length string length) ?? Space Complexity: 0(1) If no additional arrays or variables. ?? Big Oh Notation is still confusing. I struggled with this problem. I have a hard time keeping things simple. I saw a classmates solution and it was consise!
def longest_prefix(strings) if strings.length == 1 return strings end prefix = "" str_index = 0 until (strings[0][str_index] != strings[1][str_index]) || (strings[0][str_index] == nil && strings[1][str_index] == nil) prefix += strings[0][str_index] str_index += 1 end strings.each do |strin...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_by_length(my_sentence)\n array = my_sentence.split\n words_by_length = {}\n i = 0\n while i < array.length #O(m)\n if words_by_length[array[i].length] == nil\n words_by_length[array[i].length] = []\n end\n words_by_length[array[i].length] << array[i]\n i += 1\n end\n\n j = 0\n new_...
[ "0.6525914", "0.6516579", "0.63237256", "0.6310043", "0.62828493", "0.6228791", "0.62136096", "0.6185538", "0.6176066", "0.6139023", "0.61330986", "0.6113709", "0.61086994", "0.6097218", "0.6077966", "0.60554594", "0.6021381", "0.6013018", "0.59849995", "0.5982424", "0.598156...
0.0
-1
deputize.rb 100616, modified version of older script 100617, added hash methods, rescue, more accurate ou routine 100617, added dummy receipt writing, logging, simplified (i think) get_ou method 100622, edited failure output 100622, edited get_ou method to exit if the correct ou isn't found cf. cf.
def get_host begin host=%x(/usr/sbin/dsconfigad -show | /usr/bin/awk '/Computer Account/ {print $4}').chomp return host rescue puts "this machine must not be bound to AD.\n try again." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n print_status(\"Running module against #{sysinfo['Computer']}\")\n if datastore['OU_DN'] =~ /^OU=*/\n # Make sure the extension is loaded.\n if load_extapi\n domain = get_domain\n unless domain.nil?\n\n table = Rex::Ui::Text::Table.new(\n 'Indent' => 4,\n ...
[ "0.57585126", "0.55019015", "0.5469116", "0.5463395", "0.53864825", "0.5374176", "0.53402996", "0.52758515", "0.51701885", "0.51642305", "0.50395525", "0.503387", "0.5022048", "0.5009846", "0.5009309", "0.5008227", "0.50080544", "0.49896696", "0.49803436", "0.4944345", "0.491...
0.0
-1
returns a formatted string voter information
def get_info @output = "Voter, #{@name}, #{@politics}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vote_format(vote)\n /VOTE\\s\\d{10}\\sCampaign:\\w*\\sValidity:\\w*\\sChoice:\\w*/ =~ vote\n end", "def get_psv\n psv = []\n psv[0] = self.id.to_s\n psv[1] = self.username\n psv[2] = self.fullname\n psv[3] = self.nickname\n psv[4] = self.irc_nick\n psv[5] = self.email\n psv[6] = s...
[ "0.6291518", "0.62680304", "0.6228414", "0.61016923", "0.60959923", "0.6048334", "0.60344386", "0.59905857", "0.5978772", "0.5978226", "0.5973031", "0.59633905", "0.59422684", "0.5933484", "0.5932833", "0.59309447", "0.590352", "0.58884066", "0.58882624", "0.58591336", "0.583...
0.6792318
0
setup a new game
def start_new_game # TODO: increment stats # stats = GameStats.new # stats.game_number += 1 # create new player # print New game text new_game_banner = File.read('./old_code/fancy_text/new_game.txt') puts new_game_banner # display into story puts display_intro(@player_one.name) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def game_setup\n end", "def start_new_game\n x = create_player_x\n o = create_player_o\n \n @game = Game.start_game(x, o)\n end", "def start_game(game_config)\n # start a new game\nend", "def create_new_game\n create_new_party\n $pokemon_party.expand_global_var\n $trainer.rede...
[ "0.81790483", "0.75765747", "0.75459963", "0.74953187", "0.7448978", "0.7426376", "0.7417905", "0.73998594", "0.73969424", "0.7288971", "0.7278827", "0.71888614", "0.7117506", "0.7117031", "0.70494395", "0.70381093", "0.70257974", "0.7023042", "0.7022822", "0.7018836", "0.700...
0.7172531
12
def audio_recordings recordings.where(media_type: 'recording') end def video_recordings recordings.where(media_type: 'video') end if the user can edit
def editable_by user recordings.each do |recording| return true if recording.update_common_work_ids.include? user.id end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recordings\n recording_ids = self.instrument_tags.where(instrument_tagable_type: 'Recording').pluck(:instrument_tagable_id)\n Recording.where(id: recording_ids)\n end", "def audio_recordings_extract(user)\n user = Access::Validate.user(user)\n\n conditions = audio_recording_conditions(user)\n\n ...
[ "0.60822666", "0.60763943", "0.6069189", "0.60380393", "0.60277677", "0.5989004", "0.59599286", "0.588557", "0.5868281", "0.5847333", "0.58453876", "0.5809297", "0.58091295", "0.5792092", "0.5770267", "0.5745904", "0.5650103", "0.56102186", "0.56025094", "0.5578844", "0.55656...
0.5210718
71
if the user can access files
def user_can_access_files user recordings.each do |recording| return true if recording.update_common_work_ids.include? user.id end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkFileAccess(userName, fToAccess, fAccess)\n\n #return false if fAccess.end_with?(\".access\")\n if File.exist?(fAccess) && userExists(userName)\n\n fileProps = YAML.load_file(fAccess)\n fileUsers = fileProps[\"users\"]\n fileGroups = fileProps[\"groups\"]\n ...
[ "0.7656576", "0.7609099", "0.76077884", "0.74499655", "0.717406", "0.7154324", "0.7152628", "0.71232826", "0.703265", "0.7018077", "0.7009791", "0.6969276", "0.69470304", "0.6915714", "0.6885002", "0.6885002", "0.6854112", "0.68188953", "0.6763445", "0.67194486", "0.6700384",...
0.73456264
4
def update_counter_cache self.content_type = document.file.content_type end
def flush_cache update_validation unless self.destroyed? Rails.cache.delete([self.class.name, id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_content_type\n if file.present? && file_changed?\n self.content_type = file.file.content_type\n end\n end", "def update_cache_counters\n target.update_column(:reports_counter, target.reports.count) if target_type == 'Content'\n end", "def cache!(document) \n if document.is_a?(Hash...
[ "0.687297", "0.6632478", "0.63761395", "0.62832326", "0.6142162", "0.6141141", "0.6042233", "0.5995554", "0.59932977", "0.59757364", "0.5949283", "0.5929995", "0.581918", "0.57469225", "0.573885", "0.5649402", "0.56207865", "0.56156945", "0.5612175", "0.5608844", "0.56007415"...
0.0
-1
Compare 2 resources. They are == if they have the same values (attributes), regardless they are the same ruby object or not.
def ==(other) self.attributes == (other.respond(:attributes) || {} ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n other.is_a?(Resource) && type == other.type && id == other.id\n end", "def ==(other)\n self.class == other.class &&\n self.attributes == other.attributes\n end", "def ==(other)\n self.class == other.class &&\n attributes[\"_id\"] == other.attributes[\"_id\"]\n...
[ "0.7489338", "0.7248538", "0.72017527", "0.7200502", "0.7161079", "0.71218365", "0.71036035", "0.7091004", "0.7072352", "0.70627564", "0.70588845", "0.70145404", "0.6951734", "0.6941665", "0.6858757", "0.6843042", "0.6783459", "0.67515326", "0.66961116", "0.66789824", "0.6663...
0.7158386
5
Add content to compare
def ==(other) super(other) && content == (other.respond(:content) || other) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_content\n unless compare_content\n description = []\n description << \"update content in file #{@new_resource.path} from #{short_cksum(@current_resource.checksum)} to #{short_cksum(new_resource_content_checksum)}\"\n description << diff_current_from_content(@new_resource.c...
[ "0.6013182", "0.582023", "0.5805851", "0.5629531", "0.55058014", "0.54511994", "0.53931916", "0.5388995", "0.53670937", "0.53596795", "0.52665013", "0.52420586", "0.5231546", "0.5222426", "0.51686364", "0.51151973", "0.5089686", "0.50753754", "0.5071068", "0.5064323", "0.5057...
0.5417862
6
The underlying array. Use to everything which is not directly delegated
def content @content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __array__; self; end", "def array\n raise \"Not implemented\"\n end", "def array\n @@array\n end", "def array\n @array\n end", "def Array(p0) end", "def method_missing(method, *args, &block)\n self.array.send(method, *args, &block)\n end", "def array()\n\t\t@array\n\tend", "de...
[ "0.75039554", "0.73578984", "0.7082704", "0.70480335", "0.6810749", "0.67953545", "0.6783556", "0.67239755", "0.66079104", "0.659077", "0.6510604", "0.64977485", "0.649669", "0.6456771", "0.63655925", "0.63461196", "0.6323017", "0.63023955", "0.6281492", "0.62687176", "0.6266...
0.0
-1
Delegate [] to the underlying array. This is needed because Virtus redefine [] as well
def [](i) case i when Fixnum then self.content[i] else super(i) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __array__; self; end", "def array(op, len, work) # DK:P297\n\t\t\t\twarn \"array is not implemented\"\n\t\t\tend", "def &(arr)\n raise 'Not Implemented'\n end", "def [](idx)\n Ruby.primitive :array_aref\n end", "def method_missing(method, *args, &block)\n self.array.send(method, *args, &...
[ "0.7458169", "0.73369044", "0.72626144", "0.7155839", "0.71009415", "0.704654", "0.6935859", "0.68876797", "0.6806153", "0.6791846", "0.6751158", "0.6669401", "0.66174847", "0.6573967", "0.6563003", "0.65390974", "0.6537934", "0.647537", "0.6350029", "0.63314986", "0.6310934"...
0.0
-1
iterate only between non empty lanes.
def each_content @content.each do |content| yield content if content end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find this_port\n empty = nil\n this_port.ships.each{ |s|\n if s.passengers.length < s.size\n empty = s\n break\n end\n }\n empty\nend", "def contains_loop?()\n no_zeros = @hops.map { |hop| hop.ip }.find_all { |ip| ip != \"0.0.0.0\" }\n adjacents_removed = Path....
[ "0.56445026", "0.56257474", "0.55458224", "0.5544924", "0.5474548", "0.5473659", "0.5374795", "0.533859", "0.517173", "0.51548386", "0.51274127", "0.5114835", "0.5097393", "0.50887614", "0.50885993", "0.50830984", "0.50729144", "0.5067903", "0.5053495", "0.50054306", "0.49841...
0.0
-1
Authenticates an analytics user and retrives the appropriate profile.
def authenticate_for_profile begin Garb::Session.login(HHD::Config.analytics_email, HHD::Config.analytics_pwd) Garb::Profile.first(HHD::Config.analytics_profile) rescue nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def profile\n # (1) the request go into the headers and grab the key authorization and give us the value back (this's the token our server gave us originally)\n # the server only knows about the system\n # byebug/\n token = request.headers[\"Authorization\"]\n # what makes it secure? only the server...
[ "0.64733315", "0.6404214", "0.6296905", "0.62749577", "0.6269013", "0.6236943", "0.6236364", "0.6224615", "0.62235886", "0.6212748", "0.61991066", "0.619199", "0.6184529", "0.6172748", "0.61554694", "0.61333454", "0.612228", "0.61145836", "0.6077085", "0.60593456", "0.6044167...
0.74226916
0
options: profile: path to profile to run All other opts passed to InSpec::Runner.new(...) then add.target is called
def run_runner_api_process(options) # Remove profile from options. All other are passed to Runner. profile = options.delete(:profile) # Make a tmpfile Tempfile.open(mode: 0700) do |script| # 0700 - -rwx------ # Clear and concat - can't just assign, it's readonly script.puts <<~...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call(opts, profiles)\n Chef::Log.info \"Using InSpec #{::Inspec::VERSION}\"\n Chef::Log.debug \"Options are set to: #{opts}\"\n runner = ::Inspec::Runner.new(opts)\n\n # parse profile hashes for runner, see libraries/helper.rb\n tests = tests_for_runner(profiles)\n if ...
[ "0.7215627", "0.6868775", "0.6149083", "0.6120562", "0.60578245", "0.59390765", "0.5758267", "0.5733826", "0.57181716", "0.55904347", "0.55893457", "0.5573575", "0.553828", "0.5514531", "0.54936594", "0.54762137", "0.5473171", "0.5470999", "0.5422632", "0.5405533", "0.5382893...
0.6861407
2
Send an action request to start the instance.
def start create('start') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def action_start\n proxy_action(:start)\n end", "def start\n @actions << :start\n end", "def start(vmname, action = 'start')\n uri = @uri + \"/#{vmname}/#{action}?api-version=#{api_version}\"\n uri\n end", "def start\n request = Request.find(params[:id])\n req...
[ "0.73017806", "0.71449554", "0.675961", "0.66811424", "0.6467632", "0.64621115", "0.64426374", "0.64101654", "0.64101654", "0.64035064", "0.6366344", "0.63268214", "0.62715644", "0.62351304", "0.62217754", "0.62217754", "0.6195128", "0.6149255", "0.6143266", "0.61378217", "0....
0.6559621
4
Send an action request to stop the instance.
def stop(force: false) create('stop', force: force) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop_action\n action(:stop)\n end", "def stop\n action('stop')\n end", "def stop\n\t\tself.request( :stop )\n\tend", "def action_stop\n proxy_action(:stop)\n end", "def stop(vmname, action = 'stop')\n uri = @uri + \"/#{vmname}/#{action}?api-version=#...
[ "0.79355884", "0.7653475", "0.7439308", "0.73947805", "0.7364652", "0.7195799", "0.7123051", "0.7123051", "0.6992779", "0.6969853", "0.68561715", "0.68229693", "0.68192935", "0.6802054", "0.67490166", "0.6717401", "0.66541547", "0.66541547", "0.66541547", "0.6597047", "0.6581...
0.6317831
26
Send an action request to reboot the instance.
def reboot(force: false) create('reboot', force: force) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reboot_pvm_instance(instance_id)\n post(\n \"cloud-instances/#{guid}/pvm-instances/#{instance_id}/action\",\n {\"action\" => \"reboot\"}.to_json\n )\n end", "def reboot\n # There is no trackable status change for the instance being\n # rebooted, so it'...
[ "0.72058755", "0.71690226", "0.71112776", "0.7049295", "0.70429605", "0.69848716", "0.69130135", "0.6891126", "0.6860312", "0.6825496", "0.6804223", "0.67845035", "0.6741936", "0.66865575", "0.6677032", "0.6660116", "0.6654062", "0.66419756", "0.6619548", "0.6589155", "0.6554...
0.7100045
3
Send a custom action request.
def create(action, force: false) @logger.info("Sending action request for #{action} with force #{force}.") payload = { type: action } payload[:force] = force if force response = post(payload: payload) Action.new(response) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_action(action, params={})\n set_params Hash[action: action].merge params\n @response = http_send_action\n end", "def process\n send_request @action\n end", "def send_action action_name, service_name\n self.class.actions[action_name][service_name].run(self)\n end", "def pro...
[ "0.71784264", "0.7133101", "0.70362943", "0.69684446", "0.67843294", "0.67601925", "0.65581936", "0.65313965", "0.6481775", "0.63443214", "0.63426375", "0.6334284", "0.63295525", "0.6249449", "0.6206212", "0.6196452", "0.60916936", "0.60772663", "0.60772663", "0.6075657", "0....
0.0
-1
Return the DateTime the action was created.
def created_at return DateTime.parse(@created_at) if @created_at @created_at end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_action_date_time\n return @last_action_date_time\n end", "def creation_date\n @resource.creation_date\n end", "def created_date_time\n return @created_date_time\n end", "def created_date_time\n return @created_date_time\n ...
[ "0.7657957", "0.7292815", "0.7274886", "0.72657084", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", "0.7265536", ...
0.0
-1
Iterate through an array of symbols. Set the instance variable and attr_accessor for each.
def add_inst_vars(keys) keys.each do |k| instance_variable_set "@#{k}", @data[k] self.class.attr_accessor k unless respond_to?(k) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_accessor(*symbols)\n locally_assigned << symbols\n locally_assigned.flatten!\n super(*symbols)\n end", "def initialize(atts)\n atts.each do |key, val|\n accessor = \"#{key}=\"\n\n if respond_to?(accessor)\n send(accessor, val)\n end\n end\n end", "def att...
[ "0.70638746", "0.6097357", "0.6065762", "0.5994918", "0.59561247", "0.59543943", "0.5912661", "0.5905161", "0.5840926", "0.5762427", "0.5747999", "0.57395774", "0.5690401", "0.5688924", "0.5687664", "0.5682074", "0.56478465", "0.56405514", "0.5617789", "0.5601647", "0.5588987...
0.5173387
69
Remove deprecated keys from hash.
def clear_deprecated @data.each do |k, _v| @data.delete(k) if @deprecated.include?(k) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_all_keys\n deprecate # 07/31/2012\n delete(\"/user/keys\").to_s\n end", "def clean_unwanted_keys(hash)\r\n ignored_keys = [:only_path, :use_route]\r\n hash.dup.delete_if{|key,value| ignored_keys.include?(key)}\r\n end", "def _warn_deprecated_keys(updates)\n _warn_d...
[ "0.6992315", "0.69768465", "0.6778387", "0.6712584", "0.6698496", "0.64321905", "0.6429764", "0.6409374", "0.63923484", "0.63089097", "0.6184605", "0.6168453", "0.6094867", "0.6057297", "0.60068357", "0.599586", "0.59942544", "0.59734", "0.5966509", "0.59597534", "0.595851", ...
0.7372835
0
Preview this email at
def send_result_mail employee = Employee.find_by(email: "test@test.com") value = employee.values.last EmployeeMailer.send_result_mail(employee, value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = DirectEmail.find(params[:id])\n render :text => @email.body\n end", "def preview\n @email = EventEmail.find(params[:id])\n render :text => @email.body\n end", "def preview_email\r...
[ "0.71475905", "0.71186084", "0.70552814", "0.6985626", "0.6848472", "0.6848472", "0.6832406", "0.6663229", "0.64324814", "0.631654", "0.6304366", "0.6181875", "0.6167911", "0.61338973", "0.61305445", "0.6115152", "0.61100966", "0.61100966", "0.60882556", "0.60132533", "0.5982...
0.0
-1
We call insert If no root exists we make one with a new node If a root does exist, we call insert_node on the current node
def insert(score, title) depth = 0 if @tree_root.nil? @tree_root = Node.new(score, title) return depth else insert_node(score, title, @tree_root) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def insert_node\n insert_node_helper(@root)\n end", "def insert(root, node)\n\t\tif node.nil?\n\t\t\tnil\n\t\telsif root.nil? \n\t\t\tself.root = node\n\t\telse\n\t\t\tgo_to_bottom(nil,node)\n\t\t\tparent_compare(node, node.parent)\n\t\tend\n\tend", "def insert(root, node)\n\t\tif node.nil?\n\t\t\tnil\...
[ "0.8253019", "0.7977667", "0.7977667", "0.7438941", "0.7338996", "0.7316082", "0.7289844", "0.72675943", "0.7258107", "0.72086775", "0.7188062", "0.7180968", "0.7140885", "0.71105504", "0.7102024", "0.706888", "0.7055435", "0.7023083", "0.7015886", "0.6994688", "0.697082", ...
0.6124942
87
For autodeploy builds, we set the semver to the following which is derived directly from the autodeploy tag: MAJOR.MINOR.PIPELINE_ID+ See For nightly builds we fetch all GitLab components from master branch If there was no change inside of the omnibusgitlab repository, the package version will remain the same but conte...
def semver_version if Build::Check.on_tag? # timestamp is disabled in omnibus configuration Omnibus.load_configuration('omnibus.rb') Omnibus::BuildVersion.semver else latest_git_tag = Info.latest_tag.strip latest_version = latest_git_tag && !latest_git_t...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tag_version_task\n sh git, 'tag', '-a', \"#{gemspec.name}-#{gemspec.version}\", '-m', \"Released #{gemspec.name} gem version #{gemspec.version}.\"\n end", "def semver\n build_tag = version_tag\n\n # PRERELEASE VERSION\n if prerelease_version?\n # ensure all dashes are dots per p...
[ "0.63096875", "0.62188804", "0.6034773", "0.57368237", "0.5733384", "0.5684026", "0.5648803", "0.56199604", "0.55622965", "0.55515593", "0.55383205", "0.5528176", "0.5498189", "0.54758924", "0.54115194", "0.5370549", "0.5359305", "0.5357661", "0.5353672", "0.53503585", "0.534...
0.67469835
0
TODO, merge latest_tag with latest_stable_tag TODO, add tests, needs a repo clone
def latest_tag unless (fact_from_file = fetch_fact_from_file(__method__)).nil? return fact_from_file end `git -c versionsort.prereleaseSuffix=rc tag -l '#{Info.tag_match_pattern}' --sort=-v:refname | head -1`.chomp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def latest_stable_tag\n tags = `git tag`.strip.split(\"\\n\").map do |v|\n begin\n Semantic::Version.new(v)\n rescue ArgumentError\n nil\n end\n end.compact.sort.reverse\n (tags.find {|t| !t.pre} || tags.first).to_s\n end", "def update_tags\n return if master\n al...
[ "0.7310992", "0.7232015", "0.70891035", "0.70689154", "0.70014757", "0.65280706", "0.6526394", "0.649112", "0.6472556", "0.62916124", "0.62549984", "0.6248252", "0.62070227", "0.61825734", "0.6144455", "0.60863394", "0.6076138", "0.604461", "0.6013177", "0.591392", "0.5887739...
0.6795281
5
Fetch the package from an S3 bucket
def package_download_url package_filename_url_safe = Info.release_version.gsub("+", "%2B") "https://#{Info.release_bucket}.#{Info.release_bucket_s3_endpoint}/ubuntu-focal/#{Info.package}_#{package_filename_url_safe}_amd64.deb" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_s3(package)\n\tbucket = $s3client.bucket(\"rogoodpractice\")\n\t\n\t# get all objects\n obs = bucket.objects;\n \n # pull out those matching package name\n obs = obs.select { |a| a.key.match(/#{package}/) };\n\n # pull out those with .txt files\n obstxt = obs.select { |a| a.key.match(/\\.txt/) }\n\...
[ "0.84753263", "0.73755985", "0.7343483", "0.7200022", "0.7144664", "0.71378917", "0.7127465", "0.71225333", "0.7102681", "0.7072557", "0.70145386", "0.6993997", "0.6972125", "0.69212955", "0.68953425", "0.6888773", "0.6884923", "0.68725795", "0.68425673", "0.68343353", "0.678...
0.0
-1
GET /heat_logs/1 GET /heat_logs/1.json
def show @heat_log = HeatLog.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @heat_log } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @hour_logs = HourLog.all\n render json: @hour_logs, status: 200\n end", "def new\n @heat_log = HeatLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_log }\n end\n end", "def show\n @logstash = Logstash.find(params[:id])\...
[ "0.70235205", "0.6806175", "0.6664394", "0.65555996", "0.64345723", "0.6383589", "0.63832873", "0.6376605", "0.63564134", "0.6354834", "0.6354834", "0.633911", "0.632271", "0.6298279", "0.6284262", "0.6282704", "0.62776494", "0.62283784", "0.62251836", "0.6219452", "0.6191829...
0.73716986
0
GET /heat_logs/new GET /heat_logs/new.json
def new @heat_log = HeatLog.new respond_to do |format| format.html # new.html.erb format.json { render json: @heat_log } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @log = Log.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @log }\n end\n end", "def new\n @wr_log = WrLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @wr_log }\n end\n end", ...
[ "0.759604", "0.7536984", "0.7420687", "0.73933035", "0.72727215", "0.72109497", "0.72018003", "0.72011125", "0.71387285", "0.7135499", "0.70901597", "0.7068323", "0.70621765", "0.7061153", "0.70583034", "0.70393205", "0.70262986", "0.699814", "0.69917464", "0.69831854", "0.69...
0.80555654
0
POST /heat_logs POST /heat_logs.json
def create @heat_log = HeatLog.new(params[:heat_log]) respond_to do |format| if @heat_log.save format.html { redirect_to @heat_log, notice: 'Heat log was successfully created.' } format.json { render json: @heat_log, status: :created, location: @heat_log } else format.html {...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @log = current_app.logs.create(params)\n render json: @log\n end", "def new\n @heat_log = HeatLog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @heat_log }\n end\n end", "def create\n @hour_log = HourLog.new(hour_log_params)\...
[ "0.68542624", "0.6532553", "0.6477062", "0.64600706", "0.6377205", "0.6352826", "0.63010806", "0.62491643", "0.6191989", "0.6177573", "0.617527", "0.61610436", "0.6157379", "0.6128336", "0.6111616", "0.60856235", "0.6081165", "0.60741216", "0.6033518", "0.6022936", "0.6018560...
0.73235244
0
PUT /heat_logs/1 PUT /heat_logs/1.json
def update @heat_log = HeatLog.find(params[:id]) respond_to do |format| if @heat_log.update_attributes(params[:heat_log]) format.html { redirect_to @heat_log, notice: 'Heat log was successfully updated.' } format.json { head :no_content } else format.html { render action: "e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @log = Log.find(params[:id])\n\n if @log.update(log_params)\n head :no_content\n else\n render json: @log.errors, status: :unprocessable_entity\n end\n end", "def put_update\n response = self.class.put(\"/service/#{$service_id}/version/#{$service_version}/logging/sftp/#{$na...
[ "0.6454734", "0.62631917", "0.6249375", "0.621396", "0.6210942", "0.62098664", "0.6206473", "0.6161861", "0.604038", "0.6032393", "0.5980537", "0.5969304", "0.5926756", "0.58765", "0.5874582", "0.5857177", "0.5854577", "0.5851183", "0.5845636", "0.5845636", "0.5845636", "0....
0.69929314
0
DELETE /heat_logs/1 DELETE /heat_logs/1.json
def destroy @heat_log = HeatLog.find(params[:id]) @heat_log.destroy respond_to do |format| format.html { redirect_to heat_logs_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @logstash = Logstash.find(params[:id])\n @logstash.destroy\n\n respond_to do |format|\n format.html { redirect_to logstashes_url }\n format.json { head :no_content }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-tra...
[ "0.7327551", "0.702913", "0.7025208", "0.70191056", "0.70071834", "0.69677764", "0.69625115", "0.69205123", "0.6919263", "0.6904688", "0.6904688", "0.6893956", "0.6880411", "0.68727005", "0.68374634", "0.6816883", "0.6805627", "0.67827576", "0.6776477", "0.676626", "0.6752583...
0.77182364
0
def listen recording = yield if block_given? record(recording) if recording end another option/type of guard clause
def play puts @recordings.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def record(&blk)\n start_recording\n blk.call\n ensure\n stop_recording\n end", "def listen(&block)\n loop do\n block.call receive\n end\n end", "def process(record, &emit)\n yield record\n end", "def captured_by_block?; end", "def record_block\n @block = true\...
[ "0.71609545", "0.6228258", "0.621691", "0.620712", "0.6094812", "0.59055495", "0.5879183", "0.5819677", "0.5818614", "0.5803814", "0.5775337", "0.5717966", "0.5708074", "0.5698728", "0.5691856", "0.5680783", "0.5661829", "0.5650462", "0.56302375", "0.5612271", "0.55940235", ...
0.0
-1
before_action :check_current_dev [:edit, :update]
def index @devs = Dev.all.order('created_at DESC') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def can_edit_dev? \n (assigned_dev_id = params[:ticket][:assigned_dev_id]).blank? or (is_admin_or_pm? and is_team_member?(assigned_dev_id))\n end", "def edit\n #SET_CHEF method will be called form BEFORE_ACTION\n end", "def edit?\n update? # same as update - no access \n end", "def edit?\n ...
[ "0.68353504", "0.67182076", "0.6690573", "0.6432238", "0.6432238", "0.63234895", "0.6312713", "0.6306577", "0.62734807", "0.62734807", "0.62734807", "0.62734807", "0.62734807", "0.62734807", "0.62734807", "0.6269371", "0.624633", "0.624633", "0.624633", "0.624633", "0.624633"...
0.0
-1
Get the article text from the URL Implemented differently for each news site
def scrape_text end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_text(article_url)\n\t\trequire 'open-uri'\n\t\ttext = \"\"\n\t\tfile = open(article_url)\n\t\tcontents = file.readlines\n\t\tcontents.each do |line| \n\t\t\tif line =~ /<p[^>]*>/\n\t\t\t\tline.slice!(/<p[^>]*>/)\n\t\t\t\tline.slice!(/<\\/p>/)\n\t\t\t\ttext = text + line + \"<br/>\" + \"<br/>\"\n\t\t\tend...
[ "0.759397", "0.67795837", "0.6625806", "0.638407", "0.62873733", "0.62400967", "0.62000054", "0.61525726", "0.61520827", "0.61087626", "0.61004174", "0.6082367", "0.6057204", "0.6044021", "0.6028194", "0.6011187", "0.6003311", "0.5998376", "0.59898645", "0.59887105", "0.59263...
0.5671145
39
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.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.6165152", "0.60463154", "0.59467196", "0.5917112", "0.5890387", "0.58345735", "0.57773316", "0.56991524", "0.56991524", "0.565454", "0.5622282", "0.54232633", "0.54119074", "0.54119074", "0.54119074", "0.53937256", "0.53801376", "0.5358599", "0.53412294", "0.5340814", "0.5...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:email, :first_name, :last_name, :provider, :gender, :role_ids => []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
metodos de acceso (getter) metodo que inicializa la matriz
def initialize(nfil,ncol,mat) @nfil = nfil # inicializo numero de filas @ncol = ncol # inicializo numero de columnas @mat = Array.new(mat) #inicializo la matriz pasando como parametro un objeto de tipo matriz end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize( valor_entrada) \n @filas = valor_entrada.length\n\t@columnas = valor_entrada[0].length\n \t@matriz = Array.new(filas){Array.new(columnas)}\n\n \t@filas.times{ |i|\n \t\t@columnas.times{ |j|\n \t\t@matriz[i][j] = valor_entrada[i][j]\n \t\t}\n \t}\nend", "def matr...
[ "0.7108739", "0.69983244", "0.68198645", "0.68062544", "0.67535883", "0.67140645", "0.66714704", "0.65831417", "0.655432", "0.655009", "0.64000964", "0.63334495", "0.6311834", "0.621121", "0.6210409", "0.62008655", "0.6157836", "0.610155", "0.60961944", "0.60565984", "0.60564...
0.7341003
0
metodo que muestra la matriz como una cadena
def to_s cad = " " for i in 0...nfil cad << " [ " for j in 0...ncol cad << "#{mat[i][j]} " end cad << "]" cad << "\n " end return cad end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix\n end", "def to_f\n\n flotante = Array.new(matriz.size - 1)\n for i in 0...matriz.size\n flotante[i] = Array.new(matriz[i].size - 1)\n for j in 0...matriz[i].size\n flotante[i][j] = (matriz[i][j...
[ "0.6971687", "0.6555877", "0.65546364", "0.65517026", "0.65163773", "0.6506117", "0.6505215", "0.65013593", "0.6444179", "0.6369445", "0.6359986", "0.6348367", "0.6344052", "0.6343968", "0.6294316", "0.62732005", "0.62438", "0.62234414", "0.61938804", "0.61564475", "0.6127093...
0.5964793
31
metodo que suma dos matrices (Sobrecarga del operador +)
def +(other) raise ArgumentError, "Las matrices no son cuadradas." unless @nfil == other.nfil && @ncol == other.ncol m = Array.new(@nfil){Array.new(@ncol){0}} for i in 0...nfil for j in 0...ncol m[i][j] = self.mat[i][j]+ other.mat[i][j] end end return Matriz...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix_addition(m1, m2)\n rows = m1.length\n cols = m1[0].length\n result = Array.new(rows) { Array.new(cols, 0)}\n (0...rows).each do |row|\n (0...cols).each do |col|\n result[row][col] = m1[row][col] + m2[row][col]\n end\n end\n \n result\nend", "def matrix_add...
[ "0.764471", "0.76018727", "0.7507189", "0.7476412", "0.7442254", "0.74314976", "0.7381328", "0.7360459", "0.73593885", "0.734809", "0.734312", "0.7321883", "0.7276736", "0.72737485", "0.72717774", "0.7263741", "0.7180112", "0.7129728", "0.71254647", "0.70667243", "0.7058534",...
0.68248177
30
metodo que resta dos matrices (Sobrecarga del operador )
def -(other) raise ArgumentError, "Las matrices no son cuadradas." unless @nfil == other.nfil && @ncol == other.ncol m = Array.new(@nfil){Array.new(@ncol){0}} for i in 0...nfil for j in 0...ncol m[i][j] = mat[i][j]- other.mat[i][j] end end return Matriz.new(other.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def matrix\n end", "def trasponer\n\t\telemento = Array.new(0)\n\t\tfor i in 0...colum do\n\t\t\tfila = Array.new(0)\n\t\t\tfor j in 0...filas do\n\t\t\t\tfila << pos[j][i]\n\t\t\tend\n\t\t\telemento << fila\n\t\tend\n\t\tMatriz.new(@ncol, @nfil, elemento)\n\tend", "def matriz_mensaje\n @m_mensaje=Array.ne...
[ "0.72750527", "0.69873613", "0.69544005", "0.6897464", "0.6871923", "0.6788576", "0.66905797", "0.66525936", "0.6578967", "0.65753", "0.6516322", "0.6488517", "0.6480214", "0.6423806", "0.6411318", "0.6396918", "0.6376644", "0.63400936", "0.6333622", "0.63314587", "0.63287234...
0.5763028
73
metodo que multiplica dos matrices (Sobrecarga del operador )
def *(other) m = Array.new(@nfil){Array.new(@ncol){0}} for i in 0...nfil do for j in 0...other.ncol do for k in 0...ncol do m[i][j] = m[i][j] + self.mat[i][k] * other.mat[k][j] end end end return Matriz.new(self.nfil,other.ncol,m) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mult(a)\n c=Matriz.new(@n,@m,[0,0],[0,0])\n for i in 0...@n do\n for j in 0...@m do\n c.A[i][j]=@A[i][j]*a\n end\n end\n c\n end", "def multiplicar(matrizc)\n\n \t\tmatRes = Array.new(matriz.size - 1,0)\n\n\t\tfor fil in 0...matriz[0].size\n\n\t\t\tmatRes[fil] = Array.new(mat...
[ "0.73098975", "0.7168023", "0.7058372", "0.7004393", "0.6815126", "0.6799399", "0.67942524", "0.67722607", "0.67603725", "0.6759606", "0.6759271", "0.6751749", "0.67259973", "0.6697447", "0.6659681", "0.6634783", "0.6618568", "0.66076446", "0.65882176", "0.65822774", "0.65286...
0.684046
4
Aplica leyes standard de Conway
def apply_world_rules!(x, y) alive = alive?(x,y) neighbors = alive_neighbors(x,y) if alive && [2,3].include?(neighbors) @next_cells[y][x] = ALIVE elsif !alive && neighbors == 3 @next_cells[y][x] = ALIVE else @next_cells[y][x] = DEAD end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def schumann; end", "def suivre; end", "def schubert; end", "def strain; end", "def standard\n end", "def topsman_periphacitis_urosteon()\n end", "def get_vct\n \"#{@calorias} kcal\" \n end", "def winter_olympics_sport; end", "def standard_cost_code; end", "def terpene; end", "de...
[ "0.6034394", "0.59243643", "0.586014", "0.58235514", "0.5710984", "0.57070506", "0.5697374", "0.5684956", "0.56637865", "0.5617846", "0.55389893", "0.55232644", "0.5497346", "0.54783607", "0.545653", "0.545653", "0.54459494", "0.5414953", "0.5402813", "0.5398639", "0.53977144...
0.0
-1
Delete a user ==== Parameters user_name: name of the user to delete ==== Returns response: body: 'RequestId' Id of the request ==== See Also
def delete_user(user_name) request( 'Action' => 'DeleteUser', 'UserName' => user_name, :parser => Fog::Parsers::AWS::IAM::Basic.new ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_user(user_name:)\n validate_user_name(:user_name, user_name)\n\n wrap_response(@connection.delete(user_path(user_name))).fmap { |r| SftpgoClient::ApiResponse.new(r.body) }\n end", "def api_v11_users_user_name_delete(user_name, opts = {})\n api_v11_users_user_name_delete_with_http_inf...
[ "0.85504216", "0.78571665", "0.78074086", "0.7766365", "0.77490455", "0.77476245", "0.7737472", "0.76888084", "0.76760316", "0.7626938", "0.7584935", "0.75689566", "0.7536999", "0.74565446", "0.7441098", "0.742135", "0.7406259", "0.73527837", "0.7280034", "0.7227692", "0.7224...
0.85029835
1
PATCH/PUT /students/1 PATCH/PUT /students/1.json
def update @student = @user.student @subject_competency_array = params[:student][:subjects_of_interest] #remove subjects in dB before update @student[:subjects_of_interest].delete_if do |s| s != nil end @student.save @subject_competency_array.each do |s| @student.subjects_of_inte...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n if @student.update(student_params)\n render json: @student\n else\n render json: @student.errors, status: :unprocessable_entity\n end\n end", "def update\n # @student = Student.find(params[:id])\n\n respond_to do |format|\n if @student.update_attributes(params[:student])...
[ "0.7182317", "0.7118746", "0.7112766", "0.70681185", "0.70681185", "0.7049016", "0.7049016", "0.7049016", "0.7049016", "0.7049016", "0.70481044", "0.69805574", "0.69361293", "0.69361293", "0.69361293", "0.688415", "0.6873322", "0.68329144", "0.68329144", "0.68329144", "0.6832...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_student @student = Student.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 student_params params.require(:student).permit(:education_level, :description, :subjects_of_interest, :user_id) 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.69795185", "0.6782116", "0.6745877", "0.6742722", "0.67368543", "0.65932566", "0.65048057", "0.6497429", "0.6481512", "0.6478456", "0.6455591", "0.64391", "0.6379068", "0.6376498", "0.636542", "0.632084", "0.630046", "0.62998945", "0.62943697", "0.6293775", "0.629097", "...
0.0
-1
Run block in the foreground
def foreground(&block) self.set_prerun_config_defaults self.set_process_name self.chroot self.clean_fd self.redirect_io(true) yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def runblock\r\n\t\t\t@b.call\r\n\t\tend", "def foreground(id, &block)\n\t\t\t@queue.foreground(id, &block)\n\t\tend", "def run(&block); end", "def execute_block(&block)\n @currently_executing_block = true\n output \"tell session id #{name}_tty\"\n ...
[ "0.68777925", "0.68777925", "0.68194264", "0.6800379", "0.6766703", "0.67543215", "0.67142916", "0.6603381", "0.65926176", "0.6449079", "0.63373876", "0.6324506", "0.6324506", "0.63120836", "0.6297757", "0.6278117", "0.6269269", "0.62639385", "0.62008995", "0.6191013", "0.618...
0.6933865
0
Run block as a daemon
def daemonized(&block) self.set_prerun_config_defaults self.set_process_name self.drop_privileges self.daemonize self.chroot self.clean_fd self.redirect_io yield end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_daemon!(&block)\n begin\n # Only start the process as a daemon if requested\n Process.daemon(true) if daemon?\n\n # Set the process id, this will save it to @pid_file\n self.pid = Process.pid\n\n # Call the block of code passed to us\n block.call\n # Handle interruptipns...
[ "0.7418159", "0.70517886", "0.6638738", "0.6564809", "0.65129894", "0.6476817", "0.64745784", "0.6461389", "0.63896966", "0.63776046", "0.6369518", "0.6358472", "0.6296925", "0.627198", "0.62563074", "0.6256252", "0.62412876", "0.6236007", "0.62305516", "0.6215434", "0.618303...
0.73870474
1
Set default options (called prior to yield blocks)
def set_prerun_config_defaults @@config.daemon_name = File.basename(__FILE__) unless @@config.daemon_name @@config.pid_file = "#{@@config.daemon_name}.pid" unless @@config.pid_file @@config.force_kill_wait = nil unless @@config.force_kill_wait @@config.group = nil unless @@config.group @@c...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_options\n end", "def set_default_options!\n @options ||= OpenStruct.new\n @options.skip_uncovered = false\n @options.mute = false\n @options.reports = []\n end", "def default_options=(opts); end", "def set_default_options()\n @options = OpenStruct.new(\n :output_...
[ "0.7894972", "0.74347794", "0.7396802", "0.730503", "0.7180672", "0.71706855", "0.7154531", "0.70986384", "0.7065349", "0.7065349", "0.7065349", "0.7000083", "0.69971305", "0.69437504", "0.6933862", "0.6929099", "0.6926265", "0.6923728", "0.68022007", "0.678869", "0.67567056"...
0.0
-1
Release the old working directory and insure a sensible umask TODO: Make chroot directory configurable
def chroot Dir.chdir '/' File.umask 0000 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def chroot\n warn \"Path::Name#chroot is obsoleted. Use Dir.chroot.\"\n Dir.chroot(path)\n end", "def chroot(newroot)\n return if !block_given?\n raise BakerError, \"can't chroot into #{newroot}, directory dosen't exist\" if !File.directory?(newroot)\n FileUtils.mkdir(File.join(newro...
[ "0.693275", "0.6544938", "0.6516315", "0.64063686", "0.6188016", "0.61363643", "0.6081065", "0.59666866", "0.59666514", "0.5715352", "0.5711407", "0.5558775", "0.5539112", "0.55180675", "0.551723", "0.54969704", "0.5489853", "0.5461152", "0.54297924", "0.5421333", "0.5416902"...
0.7259292
0
Make sure all file descriptors are closed (with the exception of STDIN, STDOUT & STDERR)
def clean_fd ObjectSpace.each_object(IO) do |io| unless [STDIN, STDOUT, STDERR].include?(io) begin unless io.closed? io.close end rescue ::Exception end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n [@in, @out, @err].each {|f| f.close if f && !f.closed? }\n wait unless @waited\n end", "def close_fds\n # don't close stdin/out/err (0/1/2)\n 3.upto(8192).each do |i|\n begin\n IO.for_fd(i).close\n rescue Exception\n end\n end\n end", "def close\n @stdin....
[ "0.76927924", "0.7671265", "0.76538986", "0.7602453", "0.75145566", "0.7002656", "0.6704576", "0.66734236", "0.662023", "0.65804374", "0.6521656", "0.64990985", "0.62639856", "0.6210862", "0.6163115", "0.6158184", "0.6112749", "0.60900587", "0.6060499", "0.6040881", "0.601926...
0.83872306
0
Redirect our IO TODO: make this configurable
def redirect_io( simulate = false ) begin STDIN.reopen '/dev/null' rescue ::Exception end unless simulate STDOUT.reopen '/dev/null', 'a' STDERR.reopen '/dev/null', 'a' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def redirect\n orig_defout = $defout\n $stdout = StringIO.new\n yield\n $stdout.string\n ensure\n $stdout = orig_defout\n end", "def redirect\n $stdin.reopen '/dev/null'\n $stdout.reopen File.new(out, \"a\")\n $stderr.reopen File.new(err, \"a\")\n $stdout.sync = $stderr.sync ...
[ "0.7141763", "0.7118442", "0.6990669", "0.6921462", "0.6852576", "0.6836263", "0.681164", "0.67760384", "0.6753305", "0.6737236", "0.6728187", "0.6728187", "0.6718436", "0.6679288", "0.66501033", "0.6506326", "0.6506326", "0.6506326", "0.6506326", "0.6418597", "0.6333848", ...
0.65964913
15
=begin Summation of Primes The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million. =end
def is_prime?(num) for i in 2..Math.sqrt(num) if num % i == 0 return false end end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primes_sum\n primeArr = []\n num = 2\n while num < 2000000\n if is_prime num\n primeArr << num\n end\n num += 1\n end\n primeArr.reduce(:+)\nend", "def p10\n\tprimes = []\n\tPrime.each do |prime|\n\t\tbreak if prime >= 2000000\n\t\tprimes << prime\n\tend\n\t# puts primes\n\tprimes.reduce(:...
[ "0.8316922", "0.8111921", "0.81025374", "0.80799335", "0.8059635", "0.8051236", "0.8034636", "0.8033196", "0.8015935", "0.7996613", "0.7920439", "0.79144347", "0.78825665", "0.7873899", "0.78603196", "0.7837407", "0.78273773", "0.7821315", "0.78136224", "0.7809831", "0.778439...
0.0
-1
Define this method here to prove it doesn't override behavior in Datadog::Analytics::Span.
def set_tag(key, value) [key, value] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def span?; end", "def span_start; end", "def span_start=(_); end", "def span\n measure\n @span\n end", "def active_span\n raise NotImplementedError\n end", "def prepare_span(key, data, span)\n end", "def on_start(span)\n # noop\n end", "def on_start(s...
[ "0.67525", "0.63356006", "0.63135433", "0.6224392", "0.6078391", "0.6040089", "0.5917915", "0.5666832", "0.5631318", "0.56058335", "0.5602399", "0.55540913", "0.55393565", "0.5525083", "0.54345644", "0.54302514", "0.54246867", "0.53980803", "0.53779674", "0.5348116", "0.53062...
0.0
-1
= custom delete method =
def custom_delete(string, chars) new_string = "" string.each_char do |letter| new_string << letter unless chars.include?(letter) end new_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n \n end", "def delete\n end", "def delete\n\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n end", "def delete\n \n end", "def delete\n end", "def delete\n ...
[ "0.88231635", "0.87469244", "0.86715406", "0.86594385", "0.86594385", "0.86594385", "0.86594385", "0.86594385", "0.86594385", "0.86594385", "0.85921204", "0.85903025", "0.85786235", "0.85055166", "0.8343083", "0.82913005", "0.823651", "0.8212965", "0.8212965", "0.81897986", "...
0.0
-1
Run the generators with this command. This will "route" the commands to the right specific generator.
def generate *args generator = generator_for *args generator.generate end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate!\n generator.invoke_all\n end", "def call(argv)\n generate_commands.run(argv)\n end", "def run(args = [], runtime_options = {})\r\n begin\r\n parse!(args.dup, runtime_options)\r\n rescue OptionParser::InvalidOption => e\r\n # Don't cry, scrip...
[ "0.68088394", "0.6557145", "0.64874405", "0.6460963", "0.6460963", "0.6422127", "0.62913257", "0.6218378", "0.61985546", "0.61771154", "0.6166279", "0.6010579", "0.5989803", "0.5989803", "0.59710723", "0.59330827", "0.5907101", "0.5907101", "0.5872404", "0.58670557", "0.58670...
0.6239627
7
Contructor of Resque adapter
def initialize(options) Resque.redis = "#{options[:server]}:#{options[:port]}" Resque.redis.sadd(:queues, :default) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n\t@read_q = Queue.new\n\t@conn = nil\n end", "def initialize(queen=Queen.queen, config=Configuration.config)\n @config = config\n @queen = queen\n @current_params = {}\n @custom_data = {}\n @status = :wait\n @current_ant = nil\n @processed = 0\n @passe...
[ "0.6805518", "0.6530229", "0.652244", "0.65026355", "0.6497545", "0.6458517", "0.63706213", "0.63013566", "0.6269465", "0.61548287", "0.61206126", "0.6055353", "0.6020703", "0.6001784", "0.5929425", "0.5926547", "0.59132576", "0.5899472", "0.5875845", "0.58643144", "0.5847878...
0.6469551
6
Push item from Resque queue
def push(queue, value, args) if !defined?(value.queue) value.class_eval do @queue = queue end end Resque.enqueue value, args end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enqueue(item)\n\t\t@queue << item\n\tend", "def push(x)\n @queue << x\n end", "def push_to_queue(queue, item)\n queue.push(item)\nrescue Exception => e\n puts \"Rescued #{e}\"\nend", "def enqueue(item)\n end", "def push(x)\n @q << x \n end", "def push(obj)\n @queue.put(obj)\n ...
[ "0.7540263", "0.7523037", "0.7408651", "0.7293557", "0.7287811", "0.7223153", "0.7215996", "0.7144156", "0.713124", "0.7110253", "0.710282", "0.7066045", "0.7040484", "0.7036443", "0.7016487", "0.7011171", "0.69948804", "0.69878685", "0.6967961", "0.6959645", "0.69409025", ...
0.68583596
27
Push items to Resque queue to be picked up by the worker on specified time
def push_at(value, time_to_run_at, *args) if !defined?(value.queue) value.class_eval do @queue = :default end end raise "resque_scheduler is required" unless Resque.respond_to?(:enqueue_at) Resque.enqueue_at time_to_run_at, value, args end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sync_push(item, options={})\n item, options = MicroQ::Util.stringify(item, options)\n item['class'] = item['class'].to_s\n\n MicroQ.middleware.client.call(item, options) do\n if (time = options['when'])\n @later.push(\n 'when' => time.to_f,\n '...
[ "0.68723655", "0.6773717", "0.66875225", "0.6438481", "0.6436571", "0.63748246", "0.63559735", "0.6335413", "0.6288034", "0.623525", "0.6166746", "0.6155555", "0.6125923", "0.6118298", "0.6085193", "0.6082284", "0.6066063", "0.6049305", "0.6014571", "0.6012236", "0.597969", ...
0.6267664
9
Retrieve item from Resque queue
def pop(queue) job = Resque.reserve(queue) [job.payload_class, job.args] if job end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def retrieve(key); @amq.queue(key); end", "def retrieve(key)\n unless @queue\n @channel.queue_declare(:queue => key)\n @channel.queue_bind(:queue_name => key)\n bc = channel.basic_consume(:queue => key)\n @queue = client.queue(bc.consumer_tag)\n end\n \n ...
[ "0.73849386", "0.7350596", "0.72919804", "0.72638404", "0.7105013", "0.7075932", "0.6998208", "0.69963104", "0.69800967", "0.68044466", "0.67910165", "0.6767432", "0.67666066", "0.6715788", "0.6701233", "0.6633898", "0.66317475", "0.6546915", "0.6522762", "0.6518238", "0.6497...
0.58280784
96
Register worker for web interface
def register_worker(worker) Resque.redis.sadd(:workers, worker) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_worker\n super\n\n puts \"Fifo Startup - Updating worker list\"\n manager.request_refresh\n end", "def add_worker(worker)\n expect_arg :worker, Woodhouse::Layout::Worker, worker\n @workers << worker\n end", "def add_worker(worker)\n workers <...
[ "0.6924747", "0.6588296", "0.6375252", "0.6260378", "0.61227036", "0.60345036", "0.6027117", "0.5921282", "0.5882303", "0.58655024", "0.58567834", "0.58442473", "0.5808105", "0.58034897", "0.57561934", "0.56824845", "0.5658781", "0.5658781", "0.5658781", "0.5658781", "0.56587...
0.67377925
2
Functions Overrides Instance methods Class methods
def to_param slug end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def implementation; end", "def implementation; end", "def methods() end", "def methods; end", "def methods; end", "def methods; end", "def methods; end", "def private; end", "def custom; end", "def custom; end", "def method; end", "def method; end", "def method; end"...
[ "0.71468693", "0.70550835", "0.70550835", "0.7052729", "0.68913436", "0.68913436", "0.68913436", "0.68913436", "0.68118024", "0.677102", "0.677102", "0.6563277", "0.6563277", "0.6563277", "0.6563277", "0.6563277", "0.6563277", "0.6563277", "0.6563277", "0.6563277", "0.6563277...
0.0
-1
Downloads the document located at `url`.
def download(url) resp = http.get(url, :follow_redirect => true) unless resp.ok? raise( HTTPClient::BadResponseError, "Got HTTP #{resp.status}: #{resp.body}" ) end return resp.body.force_encoding('UTF-8') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download(url)\n base.get(url, @file_path)\n end", "def download(url)\n Net::HTTP.get_response(url)\n end", "def download_url(url)\n ethon = ethon_easy_requester\n ethon.url = uri_escape(url)\n ethon.perform\n check_and_raise_failure(ethon)\n {\n file_contents...
[ "0.776083", "0.7534194", "0.7499853", "0.74001366", "0.73537815", "0.7330687", "0.73277694", "0.7122024", "0.7004456", "0.69082445", "0.6868846", "0.6808389", "0.68016636", "0.67873985", "0.6784387", "0.6780636", "0.6742798", "0.6707395", "0.6658166", "0.6627434", "0.6606897"...
0.6920764
9
GET /articles/1 GET /articles/1.json
def show @article = Article.find(params[:id]) rescue (return redirect_to(root_path)) @previous_id = Article.where("category_id = ? AND id > ?", @article.category_id, @article.id) .where(:published => true).minimum(:id) @next_id = Article.where("ca...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @article = Article.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @articles }\n end\n end", "def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.er...
[ "0.7745946", "0.75169533", "0.7514653", "0.7483779", "0.74794465", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.74741095", "0.7427753", ...
0.0
-1
GET /articles/new GET /articles/new.json
def new respond_to do |format| @categories = Category.all @article = Article.new format.html { render layout: 'minimal' } format.json { render json: @article } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @article = Article.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n\n @article = Article.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render...
[ "0.81520903", "0.8133036", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045", "0.81204045",...
0.73349994
48
POST /articles POST /articles.json
def create respond_to do |format| @article = Article.new(article_params) @article.user_id = current_user.id @article.published = false # @categories = Category.all if @article.save format.html { redirect_to :controller=>'articles', :action=>'...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @article = Article.new(params[:article])\n\n respond_to do |format|\n if @article.save\n format.html { redirect_to @article, :notice => 'Article was successfully created.' }\n format.json { render :json => @article, :status => :created, :location => @article }\n else\n ...
[ "0.71538997", "0.7090667", "0.7090667", "0.7090667", "0.7090667", "0.7090667", "0.7090667", "0.7090667", "0.7090667", "0.7085137", "0.7065788", "0.7056394", "0.7056394", "0.7056394", "0.7056394", "0.7056394", "0.7056394", "0.7056394", "0.7056394", "0.7056394", "0.7056394", ...
0.0
-1
PUT /articles/1 PUT /articles/1.json
def update @article = Article.find(params[:id]) rescue (return redirect_to root_path) @created_pages = @article.pages.order('page_no') @page = nil @created_pages.each do |created_page| paras = params['page_' + created_page.id.to_s] if paras != nil created_page.update_attributes(sani...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_article(id, *args)\n options = args.last.is_a?(Hash) ? args.pop : {}\n response = put(\"articles/#{id}\",options)\n if response['success']\n return response['results']['article']\n else\n return response\n end\n end", "def update\n @article ...
[ "0.71464163", "0.7134288", "0.700237", "0.6873391", "0.68522614", "0.6785591", "0.67852634", "0.6778612", "0.677523", "0.677523", "0.677523", "0.677523", "0.6775039", "0.67738116", "0.67667145", "0.67667145", "0.67667145", "0.67667145", "0.67667145", "0.67667145", "0.67667145...
0.0
-1
DELETE /articles/1 DELETE /articles/1.json
def destroy @article = Article.find(params[:id]) @article.destroy respond_to do |format| format.html { redirect_to articles_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @article = Article.find(params[:id]) \n @article.destroy\n\n respond_to do |format|\n format.html { redirect_to articles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @article = Article.where(id: params[:id]).last\n @article.destroy\n\n res...
[ "0.7844117", "0.7832465", "0.78176606", "0.78176606", "0.78176606", "0.78176606", "0.78176606", "0.78176606", "0.7812717", "0.7772706", "0.7772706", "0.7760549", "0.7760549", "0.7760549", "0.7760549", "0.77592236", "0.7735811", "0.76818407", "0.7666867", "0.7641783", "0.76235...
0.78202105
17
This Method returns the requested cards
def hand_query(row,col,auto) if auto == 1 return @hand[(@cards_held - 1)][col] else return @hand[row][col] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_cards(deck)\n\n end", "def cards\n @cards\n end", "def fetch_cards\n log 'fetch_cards'\n data = get(PRODUCTS_ENDPOINT, fields: { carteras: false,listaSolicitada: 'TODOS',indicadorSaldoPreTarj: false })\n data['datosSalidaTarjetas']['tarjetas'].map{ |data| build_card(dat...
[ "0.8015776", "0.8006697", "0.79446256", "0.77216053", "0.7672448", "0.7621803", "0.73335385", "0.7302966", "0.7205191", "0.7169022", "0.70676315", "0.7052829", "0.7048663", "0.7022408", "0.69950676", "0.69873315", "0.6986046", "0.69731903", "0.6966608", "0.69503736", "0.69452...
0.0
-1
This Method returns the total card values of this players hand
def total_query @total = 0 @cards_held.times do |x| @total += hand_query(x,1,0) end return @total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def player_hand_total\n players_hand.inject(0) {|sum, card| sum + card.value}\n end", "def get_player_total(player_hand)\n\tplayer_total = 0 \t\t# Total value of player's hand\n\n\tfor i in 0..player_hand.length - 1\n\t\tplayer_total += $cards[player_hand[i]]\n\tend\n\treturn player_total\nend", "def hand_...
[ "0.87877554", "0.8466766", "0.7998324", "0.7978761", "0.79364", "0.79148746", "0.7862647", "0.77457625", "0.7702184", "0.7602761", "0.7532437", "0.7508998", "0.75063103", "0.7486355", "0.7433723", "0.74200404", "0.74172187", "0.74069506", "0.740517", "0.7380466", "0.7357732",...
0.7699498
9
Block invoked with Faraday builder when creating a connection
def http_builder(&block) @connection_builder = block || nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __build_connection(host, options={}, block=nil)\n client = ::Faraday::Connection.new(__full_url(host), options, &block)\n Connections::Connection.new :host => host, :connection => client\n end", "def create_connection\n\t\t@connection = Faraday.new(:url => @base_url) do |farada...
[ "0.75904465", "0.7371991", "0.7145166", "0.7007723", "0.6909909", "0.6850974", "0.6844759", "0.6785926", "0.6775513", "0.6770452", "0.6733803", "0.67157", "0.67109317", "0.6707126", "0.6697998", "0.6674939", "0.6671772", "0.6649052", "0.66301274", "0.66199857", "0.6559161", ...
0.621482
76
Invoke a chain's pivot handler
def call(request) handler.call(request) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delegate( txn, chain, *args )\n\t\t\tself.log.debug \"Delegating to chain: %p\" % [ chain ]\n\n\t\t\twith_authorization( txn, chain ) do\n\t\t\t\tyield( chain )\n\t\t\tend\n\t\tend", "def delegate( txn, chain, *args )\n\t\tyield( chain )\n\tend", "def process( chain, context )\n if @log.debug? && matc...
[ "0.5543562", "0.5509176", "0.53304636", "0.53062725", "0.5304171", "0.5239173", "0.5239173", "0.51790494", "0.5161254", "0.5153407", "0.5132843", "0.5108091", "0.50851864", "0.50657606", "0.50527006", "0.49940884", "0.49821845", "0.49745166", "0.49396542", "0.493519", "0.4930...
0.0
-1
Get the list of inactive approvers.
def inactive_approvers recently_promoted_approvers = UserFeedback.where("created_at >= ?", APPROVAL_PERIOD.ago).where_like(:body, "*You gained the ability to approve posts*").pluck(:user_id) # XXX remove in two months recently_promoted_approvers += UserFeedback.where("created_at >= ?", APPROVAL_PERIOD.ago).wher...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approvals\n approvals_list = []\n if params[:count]\n if params[:skip]\n approvals_list = current_user.db_user.approval_approvers.order('created_at desc').offset(params[:skip].to_i).take(params[:count].to_i)\n else\n approvals_list = current_user.db_user.approval_approvers.order('...
[ "0.6309939", "0.60736674", "0.60171974", "0.58916026", "0.5875404", "0.57809144", "0.5751016", "0.57194793", "0.56887954", "0.56868786", "0.56780905", "0.56409174", "0.56215054", "0.56065434", "0.5603687", "0.5522839", "0.5522839", "0.55054986", "0.54909277", "0.5473902", "0....
0.7281552
0
Demote all inactive approvers
def prune! inactive_approvers.each do |user| CurrentUser.scoped(User.system) do user.update!(level: User::Levels::CONTRIBUTOR) user.feedback.create!(category: "neutral", body: "Lost approval privileges", creator: User.system, disable_dmail_notification: true) Dmail.create_automated( ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inactive_approvers\n recently_promoted_approvers = UserFeedback.where(\"created_at >= ?\", APPROVAL_PERIOD.ago).where_like(:body, \"*You gained the ability to approve posts*\").pluck(:user_id) # XXX remove in two months\n recently_promoted_approvers += UserFeedback.where(\"created_at >= ?\", APPROVAL_PER...
[ "0.7039649", "0.6837961", "0.64077824", "0.62608653", "0.6016789", "0.5993809", "0.5987132", "0.58666843", "0.57315105", "0.5711056", "0.5679302", "0.5634676", "0.55612874", "0.55368215", "0.5506292", "0.54935557", "0.54664487", "0.54452956", "0.5440433", "0.54375434", "0.543...
0.73999757
0
Send a warning dmail to approvers who are pending demotion.
def dmail_inactive_approvers! days_until_next_month = (Date.current.next_month.beginning_of_month - Date.current).to_i return unless days_until_next_month <= 21 inactive_approvers.each do |user| Dmail.create_automated(to: user, title: "You will lose approval privileges soon", body: <<~BODY) Y...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rejected_loan(loan, options = {})\n to_email = 'MB Servicing <MBservicing@mbmortgage.com>'\n subject = (Rails.env == 'development') ? \"TESTING -- MBWEB/TSS: #{options[:reason]} Loan Notification\" : \"MBWEB/TSS: #{options[:reason]} Loan Notification\"\n @loan = loan\n @options = options\n mail...
[ "0.68217397", "0.66332126", "0.65720564", "0.6518021", "0.65040416", "0.6496176", "0.64456624", "0.64243287", "0.6416389", "0.63058114", "0.62903357", "0.62802154", "0.62758136", "0.6273793", "0.6252769", "0.62484246", "0.6230173", "0.6226344", "0.6223889", "0.6204508", "0.62...
0.6074188
32
You are going to be given a word. Your job is to return the middle character of the word. If the word's length is odd, return the middle character. If the word's length is even, return the middle 2 characters. Examples: Kata.getMiddle("test") should return "es" Kata.getMiddle("testing") should return "t" Kata.getMiddle...
def get_middle(s) if (s.length.odd?) return (s[(s.length / 2).ceil]) else return (s[(s.length / 2) - 1] + s[(s.length/2)]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def middle_word(string)\n words = string.split\n case words.size.odd?\n when true\n index = (words.size/2) \n words[index]\n when false\n \"Unable to determine middle word. An odd number of words are necessary.\"\n end\nend", "def middle_word(string)\n words = string.split\n word_count = words.le...
[ "0.82221735", "0.8138811", "0.8114782", "0.80625445", "0.7974886", "0.7924248", "0.78695077", "0.785336", "0.78333366", "0.7811115", "0.77220845", "0.7687362", "0.7684473", "0.7663211", "0.76538926", "0.76513636", "0.75542796", "0.7538817", "0.75004107", "0.74857545", "0.7483...
0.73975474
30
Used to allow mass assignment
def status_params params.permit(:name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mass_assign(new_attrs = {})\n case self.class.assignment_mode\n when :whitelist\n whitelist_assign(new_attrs)\n when :carefree\n carefree_assign(new_attrs)\n end\n end", "def mass_assign(new_attrs = {})\n case self.class.assignment_mode\n when :whitelist\n whitelist_as...
[ "0.712653", "0.6967476", "0.67537093", "0.6715448", "0.6586764", "0.64559436", "0.64559436", "0.63197863", "0.62660426", "0.6261887", "0.6218515", "0.6186609", "0.6171614", "0.6129386", "0.6101407", "0.6054052", "0.6054052", "0.60279924", "0.60201544", "0.60178757", "0.600048...
0.0
-1
Horribly kludgy but that's GNTP for you...
def update_message_state!(line) if line[/^\s*Notifications-Count\s*:\s*(\d+)/i] @sections_left += $1.to_i end if line[/^.+:\s*x-growl-resource:/i] @sections_left += 1 end if line.empty? @sections_left -= 1 end #puts line ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tld; end", "def tld; end", "def g; end", "def g; end", "def tgr; sparam(0); end", "def trd; end", "def probers; end", "def gounod; end", "def private; end", "def blg; end", "def terpene; end", "def tt; end", "def guct\n end", "def nn\n end", "def wagner; end", "def weber; end"...
[ "0.61790717", "0.61790717", "0.6017956", "0.6017956", "0.5955514", "0.59312236", "0.58713424", "0.5789783", "0.5738865", "0.5705371", "0.5658821", "0.55803984", "0.55572253", "0.55247", "0.5433784", "0.5430384", "0.5394387", "0.5392205", "0.53655034", "0.53655034", "0.5365503...
0.0
-1
eventually replace with Responsedump, quick & dirty for now
def prepare_register_response_for(req, meth, err) env, hdrs = req[ENVIRONMENT_KEY], req[HEADERS_KEY] out = [] out << "#{env[(GNTP_PROTOCOL_KEY)]}" + "/#{env[(GNTP_VERSION_KEY)]} "+ "#{meth} "+ "#{env[(GNTP_ENCRYPTION_ID_KEY)]}" out << ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump(response)\n raise NotImplementedError\n end", "def dump_response(response)\n return unless @output_buffer\n puts \"> dump_response\"\n terms = %w()\n longest = terms.map(&:size).max\n \n @output_buffer.puts '-' * 80\n @output_buffer.puts \"Response:\"\n terms.each...
[ "0.7448318", "0.6979115", "0.6630298", "0.6630189", "0.63940394", "0.636214", "0.6338313", "0.6304976", "0.6271216", "0.6234758", "0.62068474", "0.62068474", "0.61819136", "0.61819136", "0.61819136", "0.61819136", "0.61819136", "0.61819136", "0.61819136", "0.61819136", "0.618...
0.0
-1