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
With the code, prepend the id (with two spaces to avoid escaping weirdness if the following text starts with a slash (like terminal code), and append the id, with two padding also. This means we are sending over the 8 characters + code + 8 characters.
def add_ids(code, id) code.freeze code = id + " #{code} #{id}" code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string=(code); end", "def as_code(text)\n '/code ' + sanitze_for_chat(text)\n end", "def code_to_id(code)\n (code.to_s.tr('a-z', '0-9a-p').to_i(26) - pad) / factor\n end", "def code_with_trailing_space\n code.chomp+\" \"\n end", "def add_transaction_code\n unless transaction_...
[ "0.6374139", "0.63500524", "0.6336794", "0.6150634", "0.61324894", "0.5936559", "0.5900634", "0.59003025", "0.5896608", "0.58906823", "0.586815", "0.5867636", "0.5851342", "0.58307153", "0.58203197", "0.58174556", "0.58142364", "0.5791793", "0.5747184", "0.5747", "0.5737561",...
0.6093686
5
Write data to mentos, the Python Process. Returns nothing.
def write_data(out_header, code=nil) @in.write(out_header) @log.info "[#{Time.now.iso8601}] Out header: #{out_header.to_s}" @in.write(code) if code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write data\n _data[:out].write data\n _data[:out].flush\n end", "def write\n write_data\n end", "def write(data)\n end", "def write(data); end", "def write(data); end", "def write(data); end", "def write(data); end", "def write!\n ensure_mode(:privileged)\n exec('writ...
[ "0.6422427", "0.6419304", "0.64034647", "0.63361394", "0.63361394", "0.63361394", "0.63361394", "0.63254344", "0.6284704", "0.6171339", "0.59938234", "0.5970613", "0.5893063", "0.5889292", "0.5812164", "0.5795222", "0.5795222", "0.57580936", "0.57520586", "0.57520586", "0.575...
0.0
-1
Sanity check for size (32arity of 0's and 1's)
def size_check(size) size_regex = /[0-1]{32}/ if size_regex.match(size) true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def aligned_ok(size)\n (size & (2 * size_t - 1)).zero?\n end", "def size?() end", "def have_size?(size)\n @buckets[size] && @buckets[size].size != 0\n end", "def validate_entry_sizes=(_arg0); end", "def validate_size\n @num_mines <= MAX_SIZE\n end", "def test_004_length()\n TestVals....
[ "0.6922136", "0.6826354", "0.666846", "0.6485629", "0.6465301", "0.63810545", "0.6353507", "0.6353507", "0.6317776", "0.63067186", "0.63035303", "0.63035303", "0.63016444", "0.6279726", "0.6211685", "0.6200098", "0.6180445", "0.6157675", "0.61402416", "0.61341333", "0.6130375...
0.7361767
0
Read the header via the pipe. Returns a header.
def get_header begin size = @out.read(33) size = size[0..-2] # Sanity check the size if not size_check(size) @log.error "[#{Time.now.iso8601}] Size returned from mentos.py invalid." stop "Size returned from mentos.py invalid." raise MentosError, "Size...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def grab_header\n return @header if (@header and !@header.empty?)\n @file.rewind\n fields.each_with_index do |field_name, i|\n @header[i]= field_name.strip\n end\n @header\n end", "def header\n @raw.split(\"--\" + boundary)[0]\n end", "def header\n chunk_header = nil\n File.o...
[ "0.68364114", "0.658286", "0.6541095", "0.6490946", "0.6485989", "0.6406533", "0.63904047", "0.6383517", "0.6324691", "0.63240147", "0.63013905", "0.62978196", "0.62453324", "0.6186393", "0.61775833", "0.61209106", "0.60856014", "0.6084755", "0.6066141", "0.6034061", "0.60277...
0.677718
1
Return the final result for the API. Return Ruby objects for the methods that want them, text otherwise.
def return_result(res, method) unless method == :lexer_name_for || method == :highlight || method == :css res = Yajl.load(res, :symbolize_keys => true) end res = res.rstrip if res.class == String res end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results\n return error if error?\n return response if response?\n end", "def result\n end", "def results\n return error if error?\n response if response?\n end", "def result; end", "def result; end", "def result; end", "def result; end", "def result; end...
[ "0.64322096", "0.6264926", "0.6239807", "0.6220921", "0.6220921", "0.6220921", "0.6220921", "0.6220921", "0.6220921", "0.6220921", "0.6220921", "0.614071", "0.60824805", "0.6034901", "0.60194683", "0.59861875", "0.59716624", "0.59665996", "0.5931307", "0.5921423", "0.5895883"...
0.5999729
15
Convert a text header into JSON for easy access.
def header_to_json(header) @log.info "[#{Time.now.iso8601}] In header: #{header.to_s} " header = Yajl.load(header) if header["error"] # Raise this as a Ruby exception of the MentosError class. # Stop so we don't leave the pipe in an inconsistent state. @log.error "[#{Time.now....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_header(s); s; end", "def header_to_hash data\n header = {}\n data = data.split(@opts[:delimiter])\n self.req[\"Verb\"], self.req[\"Url\"], self.req[\"Version\"] = data.shift.split(\" \", 3)\n data.each do |line|\n k,v = line.split(\":\", 2)\n if !@opts[:header_bl] || !(HEADER_BLA...
[ "0.63836765", "0.6289384", "0.62424815", "0.6155245", "0.6069392", "0.6008182", "0.5936942", "0.5912183", "0.58548325", "0.5799663", "0.578786", "0.57753026", "0.5750937", "0.56840384", "0.56767344", "0.55866474", "0.55790263", "0.5573838", "0.5571317", "0.5570193", "0.556978...
0.7454925
0
GET /ficha_muscs GET /ficha_muscs.json
def index @ficha_muscs = FichaMusc.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end", "def index\n @mencions = Mencion.order(\"escuela_id\").paginate(:page => params[:page])\n\n respond_to do |format|\n format...
[ "0.6432475", "0.6189162", "0.61746603", "0.6173734", "0.61526966", "0.6143067", "0.61227393", "0.6121624", "0.60991806", "0.604083", "0.5983747", "0.59702855", "0.5915469", "0.5880483", "0.58627504", "0.5850379", "0.58273405", "0.5813302", "0.58132553", "0.5809612", "0.580764...
0.6312022
1
GET /ficha_muscs/1 GET /ficha_muscs/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @musique = Musique.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @musique }\n end\n end", "def show\n @ficha = Ficha.find(params[:id])\n \n respond_to do |format| \n format.html # show.html.erb\n form...
[ "0.68141216", "0.64738595", "0.6423299", "0.63652563", "0.63387454", "0.6324132", "0.63165855", "0.6308682", "0.6275128", "0.6239828", "0.6228979", "0.6217006", "0.62003326", "0.6183736", "0.6181303", "0.61803234", "0.61626714", "0.61591995", "0.6156471", "0.61526966", "0.614...
0.0
-1
POST /ficha_muscs POST /ficha_muscs.json
def create @ficha_musc = FichaMusc.new(ficha_musc_params) respond_to do |format| if @ficha_musc.save format.html { redirect_to @ficha_musc, notice: 'Ficha musc was successfully created.' } format.json { render :show, status: :created, location: @ficha_musc } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @musico = Musico.new(musico_params)\n\n respond_to do |format|\n if @musico.save\n format.html { redirect_to @musico, notice: 'Musico was successfully created.' }\n format.json { render :show, status: :created, location: @musico }\n else\n format.html { render :new...
[ "0.6404541", "0.6294913", "0.6156692", "0.60727394", "0.60397536", "0.5918847", "0.58888614", "0.5882925", "0.5843277", "0.57998735", "0.5773084", "0.5764686", "0.5720435", "0.571997", "0.56720173", "0.5667824", "0.5657402", "0.56526417", "0.56505096", "0.56474805", "0.564748...
0.63926065
1
PATCH/PUT /ficha_muscs/1 PATCH/PUT /ficha_muscs/1.json
def update respond_to do |format| FichaExer.create({ficha_musc_id: @ficha_musc.id}) if @ficha_musc.update(ficha_musc_params) format.html { redirect_to @ficha_musc, notice: 'Ficha musc was successfully updated.' } format.json { render :show, status: :ok, location: @ficha_musc } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @ficha = Ficha.find(params[:id])\n\n respond_to do |format|\n if @ficha.update_attributes(params[:ficha])\n format.html { redirect_to @ficha, notice: 'Ficha alterada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }...
[ "0.6421718", "0.64205134", "0.63344496", "0.63148504", "0.6311222", "0.6311222", "0.6273585", "0.6214514", "0.62111795", "0.6194217", "0.6179727", "0.6176106", "0.6160484", "0.6156757", "0.61471635", "0.61437684", "0.61080027", "0.61004835", "0.6097199", "0.60952365", "0.6086...
0.6294905
6
DELETE /ficha_muscs/1 DELETE /ficha_muscs/1.json
def destroy @ficha_musc.destroy respond_to do |format| format.html { redirect_to ficha_muscs_url, notice: 'Ficha musc was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ficha = Ficha.find(params[:id])\n @ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to fichas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @fichacortum.destroy\n respond_to do |format|\n format.html { redirect_to fichacort...
[ "0.715116", "0.70449996", "0.7004166", "0.69966984", "0.6966757", "0.6954026", "0.6948662", "0.6948662", "0.69482183", "0.69261247", "0.6910276", "0.68454456", "0.6843568", "0.6830725", "0.68152237", "0.67915964", "0.6777882", "0.6775915", "0.676703", "0.6765241", "0.67635", ...
0.7131673
1
Use callbacks to share common setup or constraints between actions.
def set_ficha_musc @ficha_musc = FichaMusc.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 ficha_musc_params params.require(:ficha_musc).permit(:data, :validade, :obs, :usuario_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.6981269", "0.6783559", "0.6746007", "0.67423046", "0.6735905", "0.6593568", "0.6504213", "0.649792", "0.6482664", "0.6478558", "0.64566684", "0.64392304", "0.6380194", "0.6376366", "0.636562", "0.63208145", "0.63006365", "0.63001287", "0.6292953", "0.62927175", "0.62911004...
0.0
-1
This will only offer weapons with tokens available
def decide_which_weapon_token_to_discard weapons weapons[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def melee_weapon; end", "def melee_weapon\n fetch('dnd.melee_weapons')\n end", "def weapon; end", "def weapon; end", "def weapon; end", "def weapons\n broadsword = header_for_id('F4 65 03 01')\n two_handed_sword = header_for_id('01 66 03 01')\n war_sword = header_for_id('02 66 03...
[ "0.6712179", "0.6636613", "0.6615268", "0.6615268", "0.6615268", "0.65806085", "0.6354625", "0.63349247", "0.6321411", "0.630006", "0.62715507", "0.6249502", "0.62262124", "0.6187506", "0.6151717", "0.61266345", "0.6121353", "0.6117041", "0.60137236", "0.6010787", "0.59867615...
0.7093011
0
Called if used as the lhs of an ||=. Expected to yield if the value was not found, so the bytecode for it to be emitted.
def or_bytecode(g) found = g.new_label bytecode(g) g.dup g.git found g.pop yield found.set! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def or_else(&blk)\n yield value\n end", "def value_or(val = nil)\n if block_given?\n yield\n else\n val\n end\n end", "def map_if?(val, &block)\n if val\n yield val\n end\n end", "def force!\n return @value if defined?(@va...
[ "0.59897107", "0.5503734", "0.54643273", "0.5420201", "0.5155404", "0.5155404", "0.5150191", "0.5076406", "0.50738925", "0.5046596", "0.50427115", "0.49590668", "0.4944049", "0.48888603", "0.48859158", "0.48804244", "0.48693898", "0.48629075", "0.48300353", "0.48194662", "0.4...
0.56723535
3
Disk path is used to build repository and project's wiki path on disk
def disk_path project.full_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path\n File.join Dubya.root_path, 'vendor/wiki'\n end", "def source(disk)\n \"#{disk.sysds_path}/#{disk.vm_id}/disk.#{disk.id}\"\n end", "def save_wiki_path( wikipath )\n filename = wikipath.split( ':' ).last\n extension = filename.split( '.' ).last\n case extension\n ...
[ "0.6934347", "0.60075", "0.5957146", "0.59541976", "0.5941358", "0.5883995", "0.585154", "0.5830626", "0.58083576", "0.5799466", "0.57860327", "0.57792073", "0.57775205", "0.57616514", "0.5728702", "0.57268053", "0.57093346", "0.5700055", "0.5681212", "0.56640893", "0.5653065...
0.7585051
0
Ex 1 1. false 2. false 3. false 4. true 5. true Ex 2
def upcase_string(string) if string.length > 10 puts string.upcase else puts string end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iq_test(numbers)\n x = numbers.split.map(&:to_i).map(&:even?)\n x.count(true) > 1 ? x.index(false) : x.index(true)\nend", "def process_true(exp)\n return \"1\"\n end", "def sequential\n return true if hand_to_val.last - hand_to_val.first == 4\n return false \n end", "def exercise_1...
[ "0.651709", "0.6268713", "0.6163715", "0.61402154", "0.605868", "0.6056421", "0.6034002", "0.5977487", "0.5929495", "0.5918474", "0.5857984", "0.5829635", "0.57854414", "0.5763123", "0.57621014", "0.5695407", "0.56743264", "0.56707394", "0.5670354", "0.5670209", "0.5651042", ...
0.0
-1
Ex 4 1. "FALSE" 2. (TRUE) "Did you get it right" 3. "Alright now!" Ex 5
def num_checker2 puts "Please choose a number" num = 0 num = gets.chomp.to_i case when num <= 50 puts "Number is 0-50" when num <= 100 puts "Number is 51-100" else puts "Number is 100+" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_true(exp)\n \"Qtrue\"\n end", "def process_true(exp)\n return \"1\"\n end", "def prologify\n \"false\"\n end", "def feedback\n # check to see if correct is true\n if correct?\n # if correct is true return \"Correct!\"\n \"Correct!\"\n # or else return \"Incorrec...
[ "0.69885427", "0.68512684", "0.6824301", "0.6730877", "0.6675985", "0.6674411", "0.6642122", "0.6592231", "0.65507925", "0.65205896", "0.64807403", "0.64778566", "0.6414071", "0.6378906", "0.635523", "0.63268125", "0.6293336", "0.62545836", "0.620063", "0.6173457", "0.6167919...
0.0
-1
def add_to_cart id = params[:id].to_i session[:cart] << id unless session[:cart].include?(id) redirect_to request.referrer end
def add_to_cart id = params[:id].to_i is_in_cart = false session[:cart].delete(1) session[:cart].each do |ct| if defined?(ct['id']) Product.find(ct['id'].to_i) if ct['id'].to_i == id is_in_cart = true ct['quantity'] = ct['quantity'].to_i + 1 end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add\n # we need the id of the product to be added\n # lets get it now\n \n id = params[:id]\n # if the cart exists already use it if not make a new one\n if session[:cart] then\n \n cart = session[:cart]\n else\n session[:cart] = {}\n cart = session[:cart]\n end\n ...
[ "0.8780519", "0.873815", "0.8640476", "0.8565352", "0.8376547", "0.826475", "0.82259804", "0.815843", "0.8133918", "0.79504555", "0.7933874", "0.79209155", "0.78106767", "0.7714226", "0.7660775", "0.76070875", "0.7591904", "0.7504977", "0.7490523", "0.7469078", "0.7459119", ...
0.905311
0
GET /projects/1 GET /projects/1.json
def show @project = Project.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @project } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n get 'projects'\n end", "def listprojects\n get('listprojects.json')['projects']\n end", "def show\n @project = @client.projects.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @project }\n end\n end", "def projects\n...
[ "0.7870224", "0.7698525", "0.7682052", "0.76132977", "0.75346726", "0.7527069", "0.7494355", "0.7494355", "0.7494355", "0.7494355", "0.7494355", "0.7494355", "0.7494355", "0.749413", "0.74854463", "0.7480681", "0.74456125", "0.74312216", "0.74241936", "0.7416241", "0.73864067...
0.73629695
33
GET /projects/new GET /projects/new.json
def new @project = Project.new respond_to do |format| format.html # new.html.erb format.json { render json: @project } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @project = current_user.projects.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @project }\n end\n end", "def new\n @project = Project.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @...
[ "0.81725097", "0.81171846", "0.80850273", "0.80848", "0.8061288", "0.8030936", "0.79504395", "0.792672", "0.79045373", "0.7865987", "0.7758509", "0.7751187", "0.77291125", "0.7706384", "0.7698888", "0.7685731", "0.7672869", "0.7655707", "0.76342", "0.7632482", "0.7619905", ...
0.8165836
21
POST /projects POST /projects.json
def create @project = Project.new(params[:project]) respond_to do |format| if @project.save format.html { redirect_to @project, notice: 'Project was successfully created.' } format.json { render json: @project, status: :created, location: @project } else format.html { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @project = Project.new(params[:project])\n\n respond_to do |format|\n if @project.save\n format.json { render :json => @project, :status => :created, :location => @project }\n format.html { redirect_to(projects_path) }\n else\n format.html { render :action => \"new...
[ "0.7338293", "0.73130125", "0.7307476", "0.7298852", "0.7226645", "0.7225086", "0.71968895", "0.7115993", "0.7104099", "0.70948637", "0.7070004", "0.7039725", "0.7034717", "0.70244694", "0.7018911", "0.7008889", "0.6983907", "0.6974434", "0.6963028", "0.69624406", "0.69433033...
0.6948445
28
PUT /projects/1 PUT /projects/1.json
def update @project = Project.find(params[:id]) respond_to do |format| if @project.update_attributes(params[:project]) format.html { redirect_to @project, notice: 'Project was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project_update(project)\n raise Client::FileboundClientException.new('Id is required', 0) unless project[:projectId].greater_than_zero?\n put('/projects', nil, project)\n end", "def update\n if @project.update(project_params)\n render json: @project, status: 200\n else\n re...
[ "0.7380123", "0.7308916", "0.7181629", "0.7167707", "0.7132476", "0.7125153", "0.7081923", "0.7008695", "0.700572", "0.70002675", "0.69908255", "0.6989358", "0.6989358", "0.6989358", "0.6989358", "0.6983146", "0.69805205", "0.69805205", "0.6977218", "0.6963203", "0.69558555",...
0.6970257
32
DELETE /projects/1 DELETE /projects/1.json
def destroy @project = Project.find(params[:id]) @project.destroy respond_to do |format| format.html { redirect_to projects_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @project.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @pr...
[ "0.78953695", "0.7859735", "0.7778282", "0.77720326", "0.77590084", "0.77312934", "0.7730913", "0.7730913", "0.7730913", "0.7730913", "0.7730913", "0.77248126", "0.7718709", "0.7718709", "0.7718709", "0.7718709", "0.7700385", "0.7699713", "0.7683079", "0.76693183", "0.7659974...
0.7705103
35
3.2 super expects (name)
def column(name, type = nil, options = {}) super column = self[name] # NOTE: <= 3.1 no #new_column_definition hard-coded ColumnDef.new : # column = self[name] || ColumnDefinition.new(@base, name, type) # thus we simply do not support array column definitions on <= 3.1 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name; super; end", "def name; super; end", "def inherited(base); end", "def superclass() end", "def name\n super\n end", "def super_class; end", "def super_class; end", "def type; super; end", "def super_method; end", "def foo(...)\n super(...)\nend", "def initialize(name:)\n su...
[ "0.7717045", "0.7717045", "0.73572254", "0.72090846", "0.71659195", "0.71427983", "0.71427983", "0.7129261", "0.712589", "0.71168244", "0.7075345", "0.68945605", "0.6835889", "0.6801212", "0.67312574", "0.6729086", "0.6729086", "0.6680861", "0.66617054", "0.6635625", "0.66337...
0.0
-1
no create_column_definition on 3.2
def new_column_definition(base, name, type) definition = ColumnDefinition.new base, name, type @columns << definition @columns_hash[name] = definition definition end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_column_def_table()\r\n table_def_name = \"column_definitions\"\r\n # If the table doesn't already exist, create it\r\n puts \"Creating column definition table (#{table_def_name}) if it doesn't exist.\" if @enable_debug_logging\r\n db_column_size_limits = @db_column_size_limits\r\n @db.t...
[ "0.68813354", "0.6680691", "0.6539555", "0.65254116", "0.646669", "0.64347935", "0.64072776", "0.6397978", "0.63780165", "0.63419914", "0.6341947", "0.6320762", "0.63023514", "0.62738425", "0.6226234", "0.6208656", "0.6196473", "0.6182551", "0.6149142", "0.61296487", "0.61269...
0.6836902
1
there was a bug Marshaling Bignums, so
def test_s_dump_load4 b1 = 123456789012345678901234567890 b2 = -123**99 b3 = 2**32 assert_equal(b1, Marshal.load(Marshal.dump(b1))) assert_equal(b2, Marshal.load(Marshal.dump(b2))) assert_equal(b3, Marshal.load(Marshal.dump(b3))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def marshal_dump; end", "def convert_binary\n end", "def pack\n end", "def bsb_number; end", "def marshall_dump\n end", "def binary_representation(allow_z=true,allow_m=true) #:nodoc:\r\n bin_rep = [@x,@y].pack(\"EE\")\r\n bin_rep += [@z].pack(\"E\") if @with_z and allow_z #Defa...
[ "0.63645077", "0.62450725", "0.61548644", "0.6147664", "0.6146377", "0.6063525", "0.60380423", "0.59385574", "0.5930173", "0.592673", "0.59241146", "0.59120464", "0.58870935", "0.58654124", "0.585549", "0.585549", "0.58385754", "0.58385754", "0.58080274", "0.5763234", "0.5741...
0.5361705
51
Given a hash with numeric values, return the key for the smallest value the equal (=) is always an assignment double equal(==) is always a comparison
def key_for_min_value(name_hash) empty_hash = nil lowest_value = 10000000000000000000000 name_hash.collect do |name, value| if value < lowest_value lowest_value = value empty_hash = name end end empty_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key_for_min_value(hash)\n smallest_key = nil\n tiny_value = nil\n hash.each do |key, value|\n if tiny_value == nil || value < tiny_value\n tiny_value = value\n smallest_key = key\n end\n end\n smallest_key\nend", "def key_for_min_value(hash)\n \n if hash.empty?\n return nil\...
[ "0.748202", "0.7460143", "0.7447442", "0.7446854", "0.74202836", "0.7391455", "0.7384255", "0.735961", "0.7358763", "0.7354792", "0.73544085", "0.7348865", "0.73374", "0.73101425", "0.72973007", "0.7277392", "0.72759247", "0.72738767", "0.7244962", "0.72316545", "0.72303164",...
0.7138336
33
IN PROGRESS. NOT COMPLETE!
def possible_moves(location) # something that returns legal_destinations, minus blocked paths # print "legal dest are: #{legal_destinations(location)}\n" possible_moves = legal_destinations(location).select do |legal_move| # print "current legal move is #{legal_move}\n" legal_move_obj = @board[l...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def progress; end", "def progressable; end", "def finished; end", "def running; end", "def running; end", "def pausable; end", "def complete?; end", "def done; end", "def waiting; end", "def waiting; end",...
[ "0.75821686", "0.75821686", "0.75821686", "0.75821686", "0.75821686", "0.7273638", "0.70062965", "0.6883531", "0.6883531", "0.66822547", "0.66788447", "0.6618551", "0.65204424", "0.65204424", "0.6453268", "0.6437209", "0.6437209", "0.6437209", "0.6437209", "0.6415963", "0.640...
0.0
-1
if sql contains 'now()' set expires to 1 minute or :cache_now_for value of config.cache if defined
def cache_options(sql = nil) options = Influxer.config.cache.dup options[:expires_in] = (options[:cache_now_for] || 60) if sql =~ /\snow\(\)/ options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cache_on?; end", "def cache_on?; end", "def expires_now; end", "def now\n cache\n end", "def now\n cache\n end", "def now\n cache\n end", "def cached?; end", "def cache_timeout\n super\n end", "def invalidate_cache! now\n end", "def default...
[ "0.6943338", "0.6943338", "0.6840566", "0.67980605", "0.6745687", "0.6745687", "0.6607994", "0.65386045", "0.64626133", "0.6374942", "0.6353998", "0.62967855", "0.6293663", "0.6293663", "0.62493443", "0.6180584", "0.6180584", "0.61617315", "0.61617315", "0.6134111", "0.613063...
0.7484958
0
add prefix; remove whitespaces
def normalized_cache_key(sql) "influxer:#{sql.gsub(/\s*/, '')}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix=(_); end", "def append_without_prefix(string); end", "def prefix(value)\n merge(aguprefix: value.to_s)\n end", "def prefix\n ''\n end", "def prefixes; end", "def prefixes; end", "def prefix( *pf )\r\n tokens.unshift(*TokenString.linearize_tokens(pf))\r\n self\r\...
[ "0.71612084", "0.71467304", "0.71210104", "0.70908237", "0.70575434", "0.70575434", "0.7020752", "0.70194745", "0.7000185", "0.69653213", "0.69653213", "0.69653213", "0.69653213", "0.69653213", "0.69653213", "0.69653213", "0.69653213", "0.69653213", "0.69653213", "0.6963673", ...
0.0
-1
Use splat when you do not know the number of arguments there will be
def what_up(greeting, *bros) bros.each { |bro| puts "#{greeting}, #{bro}!" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __splat(x) end", "def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end", "def not_just_splat(x, *args, y)\n puts x\n puts y\n puts args.inspect\nend", "def function(argument1, argument2, *splat)\n puts argument1\n puts...
[ "0.8054614", "0.78105843", "0.72828346", "0.7211867", "0.7167973", "0.7062793", "0.6997871", "0.69578475", "0.69237924", "0.6897929", "0.68701786", "0.6793079", "0.6778789", "0.67557", "0.6653226", "0.66473454", "0.6641542", "0.66110766", "0.6582463", "0.6582463", "0.64831614...
0.0
-1
How to define a Method
def by_five?(n) return n % 5 == 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method; end", "def method\r\nend", "def method(*args)\n define_expr...
[ "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.81570226", "0.78038514", "0.75170743", "0.7415637", "0.7365887", "0.73612034", "0.7287042", "0.726852", "0.726852", "0....
0.0
-1
How blocks differs from methods Method
def capitalLetter(string) puts "#{string[0].upcase}#{string[1..-1]}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def blocks() end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; end", "def block; en...
[ "0.83764386", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", "0.8279856", ...
0.0
-1
By default parameters in methods
def alphabetize(arr, rev=false) if rev arr.sort { |item1, item2| item2 <=> item1 } else arr.sort { |item1, item2| item1 <=> item2 } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameters=(_); end", "def parameters=(_arg0); end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def parameters; end", "def params=(_); end", "def params=(_arg0); end", ...
[ "0.75459623", "0.75163597", "0.74535394", "0.74535394", "0.74535394", "0.74535394", "0.74535394", "0.74535394", "0.74535394", "0.74535394", "0.74110067", "0.7361002", "0.7361002", "0.73093027", "0.72462726", "0.72370315", "0.72370315", "0.72370315", "0.72370315", "0.72370315", ...
0.0
-1
Other way of doing the same
def alphabetize(arr, rev=false) arr.sort! if rev arr.reverse! else arr end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def probers; end", "def schubert; end", "def suivre; end", "def formation; end", "def wrapper; end", "def probers=(_arg0); end", "def custom; end", "def custom; end", "def weber; end", "def a...
[ "0.70675087", "0.6329821", "0.6329821", "0.6329821", "0.6329821", "0.6315544", "0.62722945", "0.60714406", "0.60020596", "0.5994316", "0.5948346", "0.5920651", "0.5920651", "0.59097683", "0.58743113", "0.58743113", "0.58705246", "0.58705246", "0.58705246", "0.58705246", "0.58...
0.0
-1
Authenticate to the web service. You don't have to do this because authentication will happen on the first request if you don't do it here.
def authenticate self.get && true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate!\n response = self.AuthenticateUser(\n { :username => config[:username], :password => config[:password] },\n :is_authenticate => true,\n :allow_reauthenticate => false)\n\n auth_data = {\n :retailer_guid => response['RetailerGuid'],\n :authenticated => response['Auth...
[ "0.76371896", "0.73088306", "0.7267672", "0.7154139", "0.71507215", "0.71441424", "0.7019346", "0.7006784", "0.70011497", "0.6980784", "0.6955436", "0.6949261", "0.68891656", "0.68620086", "0.68074954", "0.6802305", "0.67904854", "0.67767096", "0.672452", "0.67187434", "0.671...
0.6646566
29
Every Connection class must have the dispatch method. It is what sends the SOAP request to the server and calls the parser method on the EWS instance. This was originally in the ExchangeWebService class but it was added here to make the processing chain easier to modify. For example, it allows the reactor pattern to ha...
def dispatch(ews, soapmsg, opts) respmsg = post(soapmsg) @log.debug <<-EOF.gsub(/^ {6}/, '') Received SOAP Response: ---------------- #{Nokogiri::XML(respmsg).to_xml} ---------------- EOF opts[:raw_response] ? respmsg : ews.parse_soap_response(respmsg, opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dispatch\n self.class.dispatch_connection.call self\n self\n end", "def dispatch!\n \n # negotiates initial configuration\n @meta = self.negotiate!\n \n # dispatches hash set to the server\n self.dispatch_hashing!\n self.di...
[ "0.73337495", "0.6983148", "0.6205021", "0.6052839", "0.605069", "0.60174555", "0.59055126", "0.58892673", "0.58034635", "0.5774435", "0.57425547", "0.5679256", "0.56108445", "0.56079954", "0.5598134", "0.5575125", "0.55606496", "0.54879415", "0.54321694", "0.54300755", "0.54...
0.62434834
2
Send a GET to the web service
def get check_response( @httpcli.get(@endpoint) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n start { |connection| connection.request http :Get }\n end", "def send_get(uri)\n _send_request('GET', uri, nil)\n end", "def get endpoint\n do_request :get, endpoint\n end", "def http( *args )\n p http_get( *args )\n end", "def get\n url = prefix + \"get\"\n ...
[ "0.73724514", "0.7351566", "0.7296917", "0.7281293", "0.714949", "0.714949", "0.7068085", "0.7046638", "0.70346355", "0.6988747", "0.6971341", "0.6971341", "0.6969686", "0.6948997", "0.69379395", "0.6909677", "0.68855894", "0.6882658", "0.6876729", "0.68563515", "0.67440903",...
0.7148581
6
Send a POST to the web service
def post(xmldoc) headers = {'Content-Type' => 'text/xml'} check_response( @httpcli.post(@endpoint, xmldoc, headers) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post endpoint, data\n do_request :post, endpoint, data\n end", "def post\n uri = URI.parse(self.url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.open_timeout = 10\n http.read_timeout = 10\n http.use_ssl = true\n http.verify_mode = ...
[ "0.76793295", "0.7327262", "0.72649795", "0.7205599", "0.71272725", "0.7095947", "0.7009052", "0.6996991", "0.6985719", "0.69594723", "0.695904", "0.69428563", "0.6927907", "0.69243324", "0.6921909", "0.6891337", "0.6888504", "0.68849057", "0.6884003", "0.68574804", "0.683654...
0.0
-1
Count layer check files and compute a states per second number for the blog post.
def count_layer_check_files %w[01 02 03].map do |number| folder = File.join('data', 'layer_check', "build-#{number}") puts "CHECK #{folder}" num_states = 0 LayerPartInfoName.glob(folder).each do |layer_part_info| info_string = File.read(File.join(folder, layer_part_info.to_s)) info = JSON....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instance_count\n repository.files(:pattern => /.rb/).map do |file|\n content = repository.read(file)\n count_calls(:def,content)\n end.sum\n end", "def count\n Dir.glob(File.join(@dir, '*.{yml,yaml}')).size\n end", "def update_counters(kind = \"\")\n self.post_type.ful...
[ "0.57164097", "0.5701142", "0.5680948", "0.5663919", "0.5660757", "0.55673677", "0.55629075", "0.55494773", "0.5518702", "0.551419", "0.5493258", "0.5492277", "0.5452917", "0.54254645", "0.54252124", "0.5409915", "0.54061764", "0.5397667", "0.53403753", "0.53103524", "0.52952...
0.71646583
0
Write state summary table for blog post.
def write_summary_table targets = [ [2, 5], [3, 10], [4, 6], [4, 11] ] layers_truncated_total = CSV.read( 'data/combinatorics/layers_truncated_total.csv', headers: true, converters: :integer ) bounds = targets.map do |board_size, max_exponent| target_row = layers_truncated_tot...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_summary_table\n header = [\"Date\", \"Issue Number\", \n \"Total Subscribers\", \"Change in Subscribers\"]\n\n body = report.table(:date,:number,:count,:delta)\n\n document.table([header]+body) do |t|\n t.header = true\n t.style(t.colu...
[ "0.5958261", "0.5628139", "0.55603045", "0.54977965", "0.5372145", "0.5337223", "0.5328698", "0.52774763", "0.5244213", "0.5244213", "0.52405345", "0.52405345", "0.52405345", "0.52405345", "0.52025473", "0.51817197", "0.5170964", "0.51235026", "0.51232666", "0.5120531", "0.51...
0.5407943
4
def swap_elements_from_to(array, index, dest_index) elem1 = array[index] elem2 = array[dest_index] array[index] = elem2 array[dest_index] = elem1 array end
def reverse_array(array) reversed_array = [] array.each {|e| reversed_array.unshift(e)} reversed_array #could just use #reverse but don't think that's what the lab was asking for # reversed_array = array.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def swap_elements_from_to(arr, index, dest_index)\n arr[index], arr[dest_index] = arr[dest_index], arr[index] \n arr\nend", "def swap_elements_from_to(array, index, destination_index)\n array[index], array[destination_index] = array[destination_index], array[index]\n array\nend", "def swap_elemen...
[ "0.93106234", "0.92823875", "0.9276459", "0.92680585", "0.92274904", "0.89571136", "0.8596776", "0.847649", "0.84697807", "0.84382856", "0.84382856", "0.8402957", "0.8379133", "0.8324288", "0.8324288", "0.8289201", "0.82780105", "0.82195103", "0.8189", "0.81573683", "0.815438...
0.0
-1
You don't put an end to a private access modifier, if you want to make a method private just put them below this.
def require_same_user if current_user != @article.user && !current_user.admin? flash[:alert] = "You can only edit or delete your own article" redirect_to @article end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def a_private_method\n\tend", "def private_method; end", "def private_method\n\tend", "def private_method\n\tend", "def private_method\n end", "def private_method\n end", "def a_private_method\n end", "def method3 # will be 'private'\r\n\t\t# ...\r\n\tend", "def m2\n# private def m2 ## cham...
[ "0.83775204", "0.8375068", "0.8335626", "0.8335626", "0.8177297", "0.81023383", "0.80246574", "0.75912577", "0.7540833", "0.7495548", "0.7490434", "0.72670406", "0.72374785", "0.7168896", "0.70236975", "0.6979628", "0.69148624", "0.68989414", "0.68989414", "0.68989414", "0.68...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_db @db = Db.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 db_params params.require(:db).permit(:name, resource_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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
Gets the primary email address of the user.
def email multi_email.primary_email_record.try(:email) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_email_address\n response = get_current_user_meta('email')\n email = response['query']['userinfo']['email']\n return if email == ''\n\n email\n end", "def me_user_email\n email = Email.find_primary(me).take if auth?\n email.email || ''\n end", "def prima...
[ "0.8090988", "0.8025203", "0.796103", "0.7852335", "0.78075886", "0.7784699", "0.7753468", "0.7722356", "0.7567077", "0.7556649", "0.7444266", "0.7385524", "0.7303197", "0.72646177", "0.72646177", "0.72134227", "0.71970844", "0.71753407", "0.7155389", "0.7099708", "0.7051652"...
0.7474388
10
Sets the default email address of the user.
def email=(new_email) multi_email.change_primary_email_to(new_email, allow_unconfirmed: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_default_user_email\n Cadenero.default_user_email = options[\"default-user-email\"].presence ||\n ask(\"What will be the email for the default user owner of the default account? [testy@example.com]\").presence ||\n 'testy@example.com'\n end", "de...
[ "0.8143339", "0.78687155", "0.7731521", "0.7311279", "0.7223379", "0.7088337", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70567405", "0.70555496", "0.70451736", "0.70451736", "...
0.5897547
95
CL3339Contig1:T509C AvocetS chromosome_specific exon 4D forward
def parse_header @snp, @line, @type, @in, @polymorphism, @chromosome, @orientation = self.sequence_id.split(" ") @type = @type.to_sym if @in @in = @in.to_sym == :exon else @exon = false end if @polymorphism.to_sym == :homoeologous @homoeologous = true else @homo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hit_to; @genomic.to; end", "def hit_from; @genomic.from; end", "def coverage\n if Experiment.find(params[:id]).uses_bam_file #return a pileup from samtools...\n\n else #return a position keyed hash of Positions objects\n features = Feature.find_in_range(params[:reference_id], p...
[ "0.55410403", "0.5404955", "0.5366766", "0.5224335", "0.5127981", "0.5108139", "0.50338894", "0.49809396", "0.49620193", "0.49601066", "0.4951067", "0.49463773", "0.48651597", "0.48643744", "0.48413047", "0.48210585", "0.4813069", "0.48091722", "0.48066726", "0.4803636", "0.4...
0.4395107
61
private methods for strong params set car is basically a helper method that I use to find a specific id. It's called automatically by my before_action on the routes that require an id
def set_barber @barber = Barber.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_car\n @car = Car.find(params[:car_id]) if params[:car_id]\n end", "def set_car\n @car = Car.find_by_id(params[:id])\n end", "def set_car\n puts \"#{params[:id]}yeeeeeeee\" \n @car = Car.find(params[:id])\n \n end", "def set_car\n \n @car = Car.find(params[:id]...
[ "0.7579796", "0.7509362", "0.74902254", "0.73773557", "0.7374029", "0.7374029", "0.73659205", "0.72993267", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815", "0.729815"...
0.0
-1
more strong params stuff
def barber_params params.require(:barber).permit(:name, :shop) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_params?; end", "def valid_params_request?; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", ...
[ "0.73784745", "0.7114451", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7054895", "0.7018909", "0.6984924", ...
0.0
-1
TODO: rename to should_raise_exception_telling_what_message_was_not_received
def test_should_raise_exception_on_verify_if_call_counts_not_as_expected @mock.should.receive(:random_call).twice.with("a","b","c").and.return("booh") @mock.random_call("a","b","c") assert_raise(MockExpectationError) do @mock.__verify end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_bogus_message(message)\n # This needs a good solution\n end", "def receive_message(message)\n raise NoMethodError\n end", "def receive(message)\n raise \"Define me!\"\n end", "def handle_thrift_exceptions_with_missing_message\n begin\n yield\n res...
[ "0.724693", "0.70124567", "0.695446", "0.6767419", "0.6712956", "0.66352206", "0.6589843", "0.6397386", "0.6397386", "0.6384366", "0.63648546", "0.63406956", "0.6332171", "0.6332171", "0.63104606", "0.6277269", "0.62451327", "0.62181365", "0.61759216", "0.61621755", "0.610873...
0.0
-1
this version will automatically create a div inline for you. note that if it is in the middle of the page, the javascript will try to execute before the page load completes
def inline_annotated_timeline(daily_counts_by_type, width = 750, height = 300, div_id_to_create = 'graph', options = {}) html = "<script type=\"text/javascript\" src=\"http://www.google.com/jsapi\"></script>" html << annotated_timeline(daily_counts_by_type, div_id_to_create, options) html << "<div id=\"#{di...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_inline_javascripts\n #write out any inline javascript\n return '' if @content_for_inline_javascripts.blank?\n js_code = \"\\n<!-- Inline Javascripts -->\\n#{@content_for_inline_javascripts}\"\n end", "def insert_to_page(tag, inner, first = true)\n where = get_where(first)\n if ...
[ "0.61491466", "0.5769774", "0.5700848", "0.5691406", "0.56791085", "0.5649894", "0.5648887", "0.5618975", "0.5610196", "0.5579936", "0.55596143", "0.55236405", "0.5515144", "0.549367", "0.5454518", "0.54510254", "0.54510254", "0.5412734", "0.5411265", "0.53910905", "0.5375237...
0.6116721
1
you must create a div on your page and pass in the div id
def annotated_timeline(daily_counts_by_type, div_id = 'graph', options = {}) @time_zone = options.delete(:timeZone) daily_graph = is_daily?(daily_counts_by_type) google_graph_html = google_graph_data(daily_counts_by_type, daily_graph, options) google_options = format_options_for_javascript(options, da...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def div_by_id(id_name)\n return @browser.div(:id, id_name)\nend", "def newportal_modal\n @ui.div(id: \"guestportals_newportal\")\nend", "def div_by_id_click(id_name)\n div_by_id(id_name).click\nend", "def render\n \"<div id=\\\"#{self.area_type}_#{self.id}\\\">#{self.html}</div>\"\n end", "def rende...
[ "0.67207146", "0.63642335", "0.63240755", "0.6065193", "0.6065193", "0.5930781", "0.5895617", "0.5875178", "0.5848268", "0.5819004", "0.5801058", "0.578782", "0.57795787", "0.5729129", "0.5708583", "0.5636205", "0.5636205", "0.56237715", "0.5606534", "0.558875", "0.5587127", ...
0.0
-1
Push an item onto the stack
def push(element) @top = LinkedListNode.new(element.value, @top) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(item)\n @stack.unshift(item)\n self.top = @stack[0]\n end", "def push(item)\n @mini_stack.push(item)\n @maxx_stack.push(item)\n @stak.push(item)\n end", "def push(item); end", "def push(x)\n @stack << x\n end", "def push(x)\n @stack << x \n end", "def push(x)\n ...
[ "0.87735486", "0.8647874", "0.8397242", "0.82131743", "0.82066756", "0.80809706", "0.8060416", "0.8047517", "0.80000883", "0.7933324", "0.7931474", "0.79051787", "0.7876502", "0.78622556", "0.78472614", "0.7842305", "0.78181946", "0.78058964", "0.7782047", "0.777767", "0.7734...
0.0
-1
Pop an item off the stack. Remove the last item that was pushed onto the stack and return it to the user
def pop return false if @top.nil? temp = @top @top = temp.next_node temp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop()\n @stack.pop\n end", "def pop()\n\t\t@stack.pop\n\tend", "def pop()\n @stack.pop \n end", "def pop()\n @stack.pop\n end", "def pop()\n @stack.pop\n end", "def pop()\n @stack.shift\n end", "def pop\...
[ "0.82743317", "0.82216406", "0.8215507", "0.8212985", "0.8144619", "0.81201315", "0.80789405", "0.80789405", "0.8041244", "0.8041244", "0.80378544", "0.80204844", "0.7999036", "0.79791147", "0.797297", "0.7964965", "0.7933254", "0.7916048", "0.7911932", "0.7909746", "0.790730...
0.0
-1
GET /departments GET /departments.json
def index @search = Department.metasearch(params[:search]) @departments = @search.order(sort_column + " " + sort_direction).paginate(:page => params[:page]) respond_to do |format| format.html # index.html.erb format.json { render json: @departments } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def department\n @departments = @company.departments\n respond_to do |format|\n format.json { render json: @departments}\n end\n end", "def index\n @departments = Department.all\n respond_to do |format|\n format.json{ render json: @departments}\n end\n end", "def index\n @depar...
[ "0.7713334", "0.7423522", "0.7245592", "0.7209394", "0.7208652", "0.7079816", "0.7031743", "0.6988861", "0.6986917", "0.6846436", "0.68302447", "0.68302447", "0.68302447", "0.6685874", "0.66050524", "0.6577016", "0.6566344", "0.6559162", "0.65384007", "0.65168375", "0.6516032...
0.60033804
48
GET /departments/1 GET /departments/1.json
def show @search = Department.metasearch(params[:search]) @department = Department.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @department } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def department\n @departments = @company.departments\n respond_to do |format|\n format.json { render json: @departments}\n end\n end", "def index\n @departments = Department.all\n respond_to do |format|\n format.json{ render json: @departments}\n end\n end", "def department\n ...
[ "0.74850136", "0.7172221", "0.70811534", "0.7078993", "0.702642", "0.6977408", "0.69625586", "0.6869822", "0.6844496", "0.679255", "0.67015696", "0.66595864", "0.665178", "0.6637464", "0.66309816", "0.66309816", "0.66309816", "0.65782666", "0.6535272", "0.65312874", "0.651577...
0.5979118
63
GET /departments/new GET /departments/new.json
def new @department = Department.new respond_to do |format| format.html # new.html.erb format.json { render json: @department } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @departure = Departure.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @departure }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @department }\n end\n end", "def ...
[ "0.7652509", "0.76474196", "0.76013607", "0.7326709", "0.7170239", "0.712517", "0.7054622", "0.7054169", "0.7042885", "0.7040897", "0.7023897", "0.6990382", "0.6981578", "0.6981578", "0.6971927", "0.69345284", "0.69018763", "0.6875216", "0.6851009", "0.6851009", "0.6823236", ...
0.7745415
1
POST /departments POST /departments.json
def create @department = Department.new(params[:department]) respond_to do |format| if @department.save format.html { redirect_to @department, notice: 'Department was successfully created.' } format.json { render json: @department, status: :created, location: @department } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @departamento = Departamento.new(departamento_params)\n\n if @departamento.save\n render json: @departamento, status: :created, location: @departamento\n else\n render json: @departamento.errors, status: :unprocessable_entity\n end\n end", "def create_department\n @departme...
[ "0.7154371", "0.7094246", "0.7042513", "0.68374413", "0.6819022", "0.67997104", "0.67975885", "0.6747585", "0.67359436", "0.67332244", "0.6627598", "0.6577802", "0.65672445", "0.65309364", "0.6473736", "0.6414749", "0.6406918", "0.6301541", "0.6299639", "0.62944734", "0.62763...
0.67250746
11
PUT /departments/1 PUT /departments/1.json
def update @department = Department.find(params[:id]) respond_to do |format| if @department.update_attributes(params[:department]) format.html { redirect_to @department, notice: 'Department was successfully updated.' } format.json { head :no_content } else format.html { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @dept = Dept.find(params[:id])\n\n if @dept.update(dept_params)\n head :no_content\n else\n render json: @dept.errors, status: :unprocessable_entity\n end\n end", "def update\n if @department.update(department_params)\n render json: @department, status: :ok\n else\n...
[ "0.6956223", "0.6840661", "0.68336576", "0.6760222", "0.67212033", "0.6633058", "0.65585333", "0.65373", "0.64736146", "0.6424954", "0.6391927", "0.63583994", "0.63190603", "0.62986356", "0.6211013", "0.6197702", "0.6194969", "0.61920947", "0.617793", "0.61604005", "0.6151609...
0.6594393
7
DELETE /departments/1 DELETE /departments/1.json
def destroy @department = Department.find(params[:id]) @department.destroy respond_to do |format| format.html { redirect_to departments_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @departure = Departure.find(params[:id])\n @departure.destroy\n\n respond_to do |format|\n format.html { redirect_to departures_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @department_entry.destroy\n respond_to do |format|\n format.json { ...
[ "0.7552986", "0.745143", "0.74510956", "0.73477304", "0.73275393", "0.72613406", "0.7243758", "0.7233528", "0.72038877", "0.71979046", "0.71831614", "0.717375", "0.7171448", "0.71647704", "0.71101993", "0.7100042", "0.7066437", "0.7010042", "0.69874626", "0.6980838", "0.69786...
0.7532858
1
get 1 card and remove from deck
def get_card @deck.pop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_card\n @cards.shift\n end", "def remove_card\n @cards.shift\n\n end", "def remove_card\n cards.shift\n return cards\n end", "def pull(card)\n card = self.cards.delete(card)\n raise \"Cannot find card. May already have been dealt\" unless card\n return card\n ...
[ "0.84190613", "0.8341632", "0.83007455", "0.81955594", "0.8153215", "0.81252533", "0.81088835", "0.810153", "0.80326074", "0.7973919", "0.79701424", "0.7902235", "0.78654796", "0.77739275", "0.7755765", "0.76663053", "0.765509", "0.76045513", "0.7602523", "0.7578254", "0.7573...
0.81825733
4
returns card to deck
def return_card( card ) @deck.unshift( card ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_card(deck)\n self.cardify(deck)\n end", "def get_cards(deck)\n\n end", "def card_deck\n CardDeck.new(card: @subject)\n end", "def get_card\n @deck.pop\n end", "def deal_card\n @deck.pop\n end", "def get_card()\n card = @cards[@deck_index % @max_deck_mod]\n @deck_index += 1\...
[ "0.82747144", "0.76617086", "0.74779", "0.7446912", "0.7335945", "0.73235375", "0.7287668", "0.71621907", "0.7159307", "0.71534526", "0.7027918", "0.70121485", "0.69891804", "0.69825494", "0.69761753", "0.6900055", "0.689986", "0.68874097", "0.68786407", "0.6877641", "0.68499...
0.74962723
2
def start_download Delayed::Job.enqueue NewDownload.new(self), :queue => 'fast' end
def to_jq_upload(error=nil) { files: [ { name: read_attribute(:upload_file_name), size: read_attribute(:upload_file_size), url: upload.url(:original), delete_url: Rails.application.routes.url_helpers.fu_path(self), delete_type: "DELETE" } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue_to_download\n self.save!\n end", "def queue_job; end", "def import\n Delayed::Job.enqueue(self, {:queue => \"transport\"})\n end", "def download\n track = tracks.joins(:library).where(:libraries => {:online => true}).first\n if track\n DownloadWorker.enqueue(:url => track.url, :s...
[ "0.7112391", "0.6884028", "0.6772962", "0.6701002", "0.6547544", "0.64239156", "0.6245796", "0.6230268", "0.6229457", "0.61457074", "0.61351144", "0.6069353", "0.6053351", "0.60096425", "0.60035515", "0.59932834", "0.5987746", "0.5967291", "0.59471136", "0.5932507", "0.584700...
0.0
-1
GET /complains GET /complains.json
def index @datatable = ComplainsDatatable.new view_context end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all\n get(\"#{domain}/complaints\")\n end", "def index\n @complains = Complain.all\n end", "def index\n @complains = Complain.all\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def credit\n handle_response(get(\"/credit....
[ "0.6367852", "0.62889916", "0.62889916", "0.6163582", "0.607665", "0.60320014", "0.6009397", "0.60087544", "0.6000668", "0.59748733", "0.59730744", "0.5970494", "0.5914351", "0.5829113", "0.5812055", "0.58038694", "0.5803558", "0.57744604", "0.5773626", "0.57658976", "0.57643...
0.0
-1
GET /complains/1 GET /complains/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @complaint = Complaint.find(params[:id])\n\n render json: @complaint\n end", "def show\n @complaint = Complaint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @complaint }\n end\n end", "def show\n @cec_complaint ...
[ "0.70091206", "0.6633476", "0.64701253", "0.6417217", "0.6381423", "0.6262305", "0.6231709", "0.6205509", "0.6200931", "0.61371034", "0.60729957", "0.6069453", "0.6056151", "0.6031929", "0.6030601", "0.6027298", "0.6025042", "0.60186714", "0.60133684", "0.60113204", "0.598630...
0.0
-1
POST /complains POST /complains.json
def create @complain = Complain.new(complain_params.merge( created_by: current_user, )) if @complain.save flash[:notice] = '@complain is created successfully. ' else flash.now[:alert] = @complain.errors.full_messages.first end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @complaint = Complaint.new(params[:complaint])\n\n if @complaint.save\n render json: @complaint, status: :created, location: @complaint\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def create\n @complaint = @complaintable.last.compla...
[ "0.65398616", "0.64882255", "0.63368773", "0.6206153", "0.6121799", "0.60072315", "0.5867555", "0.5848723", "0.5754023", "0.57415867", "0.57227176", "0.5659336", "0.5576813", "0.5573848", "0.5556446", "0.5541138", "0.55395275", "0.5531964", "0.5530814", "0.55240923", "0.55240...
0.0
-1
PATCH/PUT /complains/1 PATCH/PUT /complains/1.json
def update respond_to do |format| if @complain.update complain_params notice = if params[:complain][:status_event] != Constant.TICKET_EVENTS[:EDIT] "Ticket #{@complain.status} successfully." else 'Ticket updated successfully.' end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @complaint = Complaint.find(params[:id])\n\n if @complaint.update_attributes(params[:complaint])\n head :no_content\n else\n render json: @complaint.errors, status: :unprocessable_entity\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:ci...
[ "0.692412", "0.6508058", "0.6502208", "0.6321696", "0.6224514", "0.6224514", "0.61946744", "0.61625594", "0.6098076", "0.6056512", "0.6044511", "0.6039345", "0.60270655", "0.60122615", "0.6007619", "0.60002345", "0.5963855", "0.59607714", "0.59572816", "0.59333235", "0.591589...
0.0
-1
DELETE /complains/1 DELETE /complains/1.json
def destroy @complain.destroy respond_to do |format| format.html { redirect_to complains_url, notice: 'Complain was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @cec_complaint = CecComplaint.find(params[:id])\n @cec_complaint.destroy\n\n respond_to do |format|\n format.html { redirect_to cec_complaints_url }\n format.json { head :ok }\...
[ "0.7033504", "0.6846378", "0.67915756", "0.67429787", "0.6699855", "0.66977507", "0.66845834", "0.6666263", "0.6658335", "0.6633166", "0.65908873", "0.6587573", "0.65686893", "0.6566602", "0.6534164", "0.6531601", "0.6528814", "0.65210444", "0.65190846", "0.65190846", "0.6511...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_complain @complain = Complain.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a list of trusted parameters through.
def complain_params params.require(:complain).permit( *Complain::FIELDS ).merge( updated_from_ip: request.remote_ip, updated_by: current_user, ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
GET /log_load_times GET /log_load_times.json
def index @log_load_times = LogLoadTime.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_load_time_params\n params.fetch(:log_load_time, {})\n end", "def load_time\n @time_counter = Time.new.to_i\n end", "def response_time_metrics\n result = {}\n @urls.each do |url|\n result[url[:name]] = get_metrics(url[:path])\n end\n print result\n end", "def query_lo...
[ "0.70200294", "0.6375261", "0.6345156", "0.6336643", "0.63257056", "0.62683606", "0.60454094", "0.5956359", "0.5866802", "0.5803026", "0.5771144", "0.5763465", "0.574501", "0.57221246", "0.56845653", "0.5661353", "0.55890524", "0.55519634", "0.55433", "0.5540303", "0.5526231"...
0.7680051
0
GET /log_load_times/1 GET /log_load_times/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @log_load_times = LogLoadTime.all\n end", "def log_load_time_params\n params.fetch(:log_load_time, {})\n end", "def response_time_metrics\n result = {}\n @urls.each do |url|\n result[url[:name]] = get_metrics(url[:path])\n end\n print result\n end", "def query_load\n...
[ "0.7551682", "0.66421443", "0.64266187", "0.6412287", "0.64022785", "0.6219345", "0.60763305", "0.60709614", "0.60662204", "0.5870377", "0.58471984", "0.5831628", "0.5810082", "0.57435614", "0.572441", "0.56861264", "0.5672889", "0.56593627", "0.56563336", "0.5615185", "0.559...
0.0
-1
POST /log_load_times POST /log_load_times.json
def create @log_load_time = LogLoadTime.where(app_name: params['app_name']).first_or_create @log_load_time.download_from_server_wo_hg = params['download_from_server_wo_hg'] || @log_load_time.download_from_server_wo_hg @log_load_time.render_webpage_wo_hg = params['render_webpage_wo_hg'] || @log_load_time.r...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_load_time_params\n params.fetch(:log_load_time, {})\n end", "def index\n @log_load_times = LogLoadTime.all\n end", "def load_time\n @time_counter = Time.new.to_i\n end", "def set_log_load_time\n @log_load_time = LogLoadTime.find(params[:id])\n end", "def load_time\n \...
[ "0.7208557", "0.6701481", "0.62198925", "0.6204298", "0.57656664", "0.56418735", "0.5620432", "0.5620066", "0.5557169", "0.5538144", "0.55278057", "0.5525186", "0.5523198", "0.54880095", "0.5472829", "0.5465273", "0.54316145", "0.54011786", "0.53477377", "0.53014565", "0.5276...
0.52531594
24
PATCH/PUT /log_load_times/1 PATCH/PUT /log_load_times/1.json
def update respond_to do |format| if @log_load_time.update(log_load_time_params) format.html { redirect_to @log_load_time, notice: 'Log load time was successfully updated.' } format.json { render :show, status: :ok, location: @log_load_time } else format.html { render :edit } ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_log_load_time\n @log_load_time = LogLoadTime.find(params[:id])\n end", "def update\n @time_log = TimeLog.find(params[:id])\n\n respond_to do |format|\n if @time_log.update_attributes(params[:time_log])\n format.html { redirect_to @time_log, notice: 'Time log was successfully upd...
[ "0.62191886", "0.5869159", "0.5802701", "0.5750544", "0.5691026", "0.5643234", "0.55972725", "0.5531214", "0.5531214", "0.5480779", "0.5462191", "0.5400274", "0.5372074", "0.5371961", "0.53609633", "0.5335888", "0.53017396", "0.52924424", "0.5274926", "0.52657765", "0.5260924...
0.7061334
0
DELETE /log_load_times/1 DELETE /log_load_times/1.json
def destroy @log_load_time.destroy respond_to do |format| format.html { redirect_to log_load_times_url, notice: 'Log load time was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @time_log = TimeLog.find(params[:id])\n @time_log.destroy\n\n respond_to do |format|\n format.html { redirect_to time_logs_url }\n format.json { head :ok }\n end\n end", "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json...
[ "0.6575236", "0.6439261", "0.619218", "0.61805326", "0.6174103", "0.6131136", "0.60513735", "0.60391736", "0.60223395", "0.60083485", "0.59980106", "0.5995409", "0.5985298", "0.59848243", "0.5973564", "0.59722626", "0.59622145", "0.59622145", "0.5956965", "0.59353113", "0.593...
0.7384429
0
Use callbacks to share common setup or constraints between actions.
def set_log_load_time @log_load_time = LogLoadTime.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def log_load_time_params params.fetch(:log_load_time, {}) 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
add a point to the track
def add_point(lat:, lon:, elevation:, time:) time = Time.parse(time) if ! time.is_a?(Time) current = [lat, lon, elevation] if @start_time.nil? || time < @start_time @start_time = time @start_location = current end if @end_time.nil? || time > @end_time @end_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_point\n end", "def add_to_point point\n add_to_point! point.dup\n end", "def add point\n self.x += point.x\n self.y += point.y\n self\n end", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def add_point(player)\n end", "def addPoint( x, y) \n poi...
[ "0.8112042", "0.7918362", "0.78341997", "0.77294517", "0.74916965", "0.7489287", "0.733402", "0.73277307", "0.72451556", "0.72254694", "0.7220237", "0.72030514", "0.71359617", "0.69704777", "0.6947174", "0.69277453", "0.68161136", "0.6814487", "0.68112737", "0.68112737", "0.6...
0.637308
34
the time range covered by this track
def time_range start_time..end_time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def within_range\n @site.loads.desc(:time).where(:time.gt => @timeframe.from, :time.lt => @timeframe.to)\n end", "def time_range\n return 0 if start_hour.blank? || start_minute.blank?\n\n return 0 if end_hour.blank? || end_minute.blank?\n\n hours_between_times\n end", "def relevant_time?\...
[ "0.692386", "0.6734674", "0.65751153", "0.65195674", "0.65074927", "0.65074927", "0.63840526", "0.6337942", "0.6309955", "0.61945295", "0.6176985", "0.61685586", "0.6153874", "0.6152231", "0.6109918", "0.60965294", "0.60168797", "0.599861", "0.5981329", "0.597856", "0.5934260...
0.7517985
0
is the supplied time covered by this track?
def in_time_range?(time) time = Time.parse(time) if ! time.is_a?(Time) time_range.cover?(time) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def covers?(time)\n start_time <= time && time < end_time\n end", "def covers?(time)\n start_time <= time && time < end_time\n end", "def includes(time)\n return (@beginTime < time && time < @endTime) ;\n end", "def time_passed?(_event, time)\n Time.now > time\n end", "def relev...
[ "0.8513577", "0.8513577", "0.7703856", "0.74693245", "0.7335425", "0.7272049", "0.7230247", "0.72174764", "0.718111", "0.718111", "0.7138772", "0.7105228", "0.7078262", "0.70617026", "0.70108175", "0.69040453", "0.69032854", "0.6864373", "0.6736994", "0.6729349", "0.67257625"...
0.69654137
15
Public: Run a command and get its output. cmd Strings with name of executable and the command arguments. stdin A String to write as the commands stdin. Returns String with stdout and stderr from the command.
def pipe(*cmd, stdin: nil) IO.popen(cmd, "r+", err: %i[child out]) do |io| io.write stdin if stdin io.close_write io.read end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_command(cmd, *args)\n r,w = IO.pipe\n\n pid = fork do\n r.close\n STDIN.close\n STDOUT.reopen(w)\n STDERR.reopen(w)\n\n exec(cmd, *args)\n end\n\n w.close\n output = r.read.force_encoding('binary')\n pid, status = Process::wait2(pid)\n\n [output, status]\n end...
[ "0.7211942", "0.70124245", "0.6986864", "0.69212866", "0.6893136", "0.67471206", "0.6699803", "0.6699423", "0.6689873", "0.66156256", "0.6541055", "0.6528879", "0.6461807", "0.6436912", "0.6394442", "0.63409513", "0.63226825", "0.6287096", "0.625514", "0.6253713", "0.6245831"...
0.5756732
74
GET /admin/lotteries GET /admin/lotteries.xml
def index @lotteries = Lottery.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @lotteries } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lotteries = Lottery.all\n end", "def index\n @lotteries = Lottery.all \n end", "def index\n @loans = @tool.loans.all\n end", "def show\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @lot }\n ...
[ "0.5988085", "0.5841375", "0.5745081", "0.5634349", "0.55872977", "0.55587864", "0.54996544", "0.5463416", "0.5436859", "0.5436323", "0.5420055", "0.54166114", "0.537363", "0.53611374", "0.5354232", "0.5349021", "0.5340439", "0.5327275", "0.5317761", "0.5314572", "0.5311332",...
0.647132
0
GET /admin/lotteries/1 GET /admin/lotteries/1.xml
def show @lottery = Lottery.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @lottery } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @lotteries = Lottery.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lotteries }\n end\n end", "def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lie...
[ "0.6324821", "0.5679504", "0.56639737", "0.56421876", "0.5597395", "0.55659807", "0.55531335", "0.55489147", "0.5531902", "0.5509285", "0.5470176", "0.5407319", "0.53622437", "0.53417057", "0.53417057", "0.5326894", "0.5319417", "0.5319044", "0.52990055", "0.5294079", "0.5282...
0.5428323
11
GET /admin/lotteries/new GET /admin/lotteries/new.xml
def new @lottery = Lottery.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @lottery } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @lotto_type = LottoType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lotto_type }\n end\n end", "def new\n @geoname = Geoname.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ge...
[ "0.69371176", "0.67339504", "0.6605826", "0.6568752", "0.6564626", "0.656386", "0.65321815", "0.65182775", "0.65153563", "0.6492592", "0.6485942", "0.6485567", "0.6426365", "0.6398253", "0.6393431", "0.6386825", "0.6383273", "0.6367464", "0.6346065", "0.63460237", "0.63333327...
0.6482264
12
POST /admin/lotteries POST /admin/lotteries.xml
def create @lottery = Lottery.new(params[:lottery]) respond_to do |format| if @lottery.save format.html { redirect_to([:admin,@lottery], :notice => 'Lottery was successfully created.') } format.xml { render :xml => @lottery, :status => :created, :location => @lottery } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @lot = Lot.new(params[:lot])\n\n respond_to do |format|\n if @lot.save\n format.html { redirect_to myadmin_lots_path, :notice => 'Lot was successfully created.' }\n format.json { render :json => @lot, :status => :created, :location => @lot }\n else\n format.html { ...
[ "0.62806404", "0.5480542", "0.5374994", "0.5267898", "0.522621", "0.5144454", "0.5089655", "0.50829846", "0.5081942", "0.5060755", "0.5045586", "0.4976771", "0.49689254", "0.49634048", "0.49529305", "0.49351442", "0.49295807", "0.49262205", "0.49262205", "0.49240428", "0.4916...
0.5521858
1
PUT /admin/lotteries/1 PUT /admin/lotteries/1.xml
def update @lottery = Lottery.find(params[:id]) respond_to do |format| if @lottery.update_attributes(params[:lottery]) format.html { redirect_to([:admin,@lottery], :notice => 'Lottery was successfully updated.') } format.xml { head :ok } else format.html { render :action =>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @lot = Lot.find(params[:id])\n\n respond_to do |format|\n if @lot.update_attributes(params[:lot])\n format.html { redirect_to myadmin_lots_path, :notice => 'Lot was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action =>...
[ "0.6247689", "0.5760854", "0.56563115", "0.53996843", "0.5368429", "0.5361211", "0.532997", "0.53174156", "0.52915454", "0.5278801", "0.5266075", "0.5261113", "0.5258498", "0.5221212", "0.52047944", "0.52009964", "0.5200022", "0.5188523", "0.5188523", "0.51805633", "0.5169497...
0.5643168
3
DELETE /admin/lotteries/1 DELETE /admin/lotteries/1.xml
def destroy @lottery = Lottery.find(params[:id]) @lottery.destroy respond_to do |format| format.html { redirect_to(admin_lotteries_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @lot = Lot.find(params[:id])\n @lot.destroy\n\n respond_to do |format|\n format.html { redirect_to myadmin_lots_url }\n forma...
[ "0.65686595", "0.6564991", "0.64377993", "0.6317481", "0.62854105", "0.6217842", "0.62152356", "0.620284", "0.6202192", "0.61990756", "0.61986387", "0.61986387", "0.61961144", "0.6185415", "0.6183315", "0.6174145", "0.6172851", "0.61701536", "0.6159615", "0.6132565", "0.61294...
0.6334919
3
def generate_authentication_token loop do self.authentication_token = SecureRandom.base64(64) break unless User.find_by(authentication_token: authentication_token) end end Activates an account.
def activate update_attribute(:activated, true) update_attribute(:activated_at, Time.zone.now) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_authentication_token\n loop do\n self.authentication_token = SecureRandom.base64(64)\n break if !Admin::User.find_by(authentication_token: authentication_token)\n end\n end", "def generate_authentication_token!\n begin\n self.auth_token = SecureRandom.hex(2...
[ "0.86915165", "0.82351506", "0.81866515", "0.81560636", "0.7825165", "0.7802449", "0.77390695", "0.7706414", "0.7706414", "0.75506854", "0.7530045", "0.75296825", "0.75296825", "0.75296825", "0.75296825", "0.7520026", "0.75125647", "0.748058", "0.7295039", "0.7285345", "0.728...
0.0
-1
a method to push values into the array
def add_value(item) array.push(item) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(values)\n underlying_array.push(values)\n values\n end", "def push(val)\n \n end", "def add_to_array(arr, value)\n arr.push(value)\nend", "def push(value); end", "def push_elements_into_array(arr, ele)\n arr.push(ele)\n arr\nend", "def push_ary ary\n ary.each do |eleme...
[ "0.8025476", "0.74022907", "0.73997873", "0.7396486", "0.71816176", "0.7028757", "0.69774115", "0.6971731", "0.6945943", "0.6928762", "0.6912322", "0.6907768", "0.69056815", "0.69007874", "0.6898913", "0.68596977", "0.68347156", "0.68346524", "0.6795411", "0.6764222", "0.6760...
0.7248809
4
Returns a new sampler.
def parent_consistent_probability_based(root:) OpenTelemetry::SDK::Trace::Samplers::ParentConsistentProbabilityBased.new(root) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_sampler(settings)\n if (sampler = settings.tracing.sampler)\n if settings.tracing.priority_sampling == false\n sampler\n else\n ensure_priority_sampling(sampler, settings)\n end\n elsif (rules = settings.tracing.sampling.rules)\n pos...
[ "0.66349995", "0.6488265", "0.6302386", "0.56561905", "0.5551672", "0.55499786", "0.5538545", "0.55223244", "0.54701376", "0.54531264", "0.54307884", "0.5380808", "0.5364366", "0.5300468", "0.52991915", "0.52617884", "0.52617884", "0.52617884", "0.52617884", "0.52617884", "0....
0.0
-1
Calls the playerprofile API and returns a PlayerProfile resource.
def player_profile( player_id, season, graph_start_season, graph_end_season, graph_stat=NbaStats::Constants::GRAPH_STAT_POINTS, season_type=NbaStats::Constants::SEASON_TYPE_REGULAR, league_id=NbaStats::Constants::LEAGUE_ID_NBA ) NbaStats::Resources::Play...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_playerprofile\n @playerprofile = Playerprofile.find(params[:id])\n end", "def set_player_profile\n @player_profile = PlayerProfile.where(user_id: params[:user_id])[0]\n end", "def get_player(nickname)\n response = get(RESOURCE_PATH, nickname, headers: { 'API-VERSION': 'v2' })\n...
[ "0.672795", "0.65705866", "0.6355838", "0.62678933", "0.6258951", "0.6175282", "0.6151631", "0.610961", "0.6097108", "0.6030582", "0.60156155", "0.59410536", "0.5897132", "0.58966243", "0.58860916", "0.58852875", "0.5844608", "0.5749036", "0.57446116", "0.5714243", "0.5708022...
0.67503995
0
=begin :rtype: Character =end
def next() return " " unless has_next() if(@count <= 0) @char = @compressed_string[@i] @i += 1 @count = get_count() end @count -= 1 return @char end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def character; end", "def...
[ "0.7251198", "0.7251198", "0.7251198", "0.7251198", "0.7251198", "0.7251198", "0.7251198", "0.7251198", "0.7251198", "0.725108", "0.725108", "0.725108", "0.725108", "0.725108", "0.725108", "0.725108", "0.725108", "0.725108", "0.725108", "0.7147115", "0.70698977", "0.7046626...
0.58387494
95
=begin :rtype: Boolean =end
def has_next() return @i < @compressed_string.length || @count > 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def semact?; false; end", "def success?() end", "def complete?\n end", "def eof?()\n #This is a stub, used for indexing\n end", "def issn; end", "def entire?\n entire\n end", "def check ; true ; end", "def valid?\n return true\n end", "def valid?\n return...
[ "0.6938447", "0.6824057", "0.68203723", "0.6728698", "0.6727102", "0.6725595", "0.66520333", "0.662565", "0.662565", "0.662565", "0.662565", "0.662565", "0.66234535", "0.6601683", "0.6577346", "0.65698755", "0.6540739", "0.6528295", "0.6524544", "0.6524544", "0.6524544", "0...
0.0
-1
Based on hungryblank's version in the comments see
def find_dups2 uniq.select{ |e| (self-[e]).size < self.size - 1 } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def anchored; end", "def schubert; end", "def terpene; end", "def stderrs; end", "def berlioz; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def formation; end", "def rassoc(p0) end", "def offences_by; end", "d...
[ "0.6651279", "0.63240653", "0.6243529", "0.6082854", "0.5974401", "0.5929712", "0.587744", "0.58719677", "0.58719677", "0.58719677", "0.58719677", "0.58089286", "0.57594585", "0.56910783", "0.56710285", "0.5631653", "0.561357", "0.5609549", "0.5608619", "0.5588943", "0.557529...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user p params @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.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def user_params params.require(:user).permit(:first_name, :last_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7122899", "0.7054107", "0.69478", "0.6902101", "0.67359334", "0.67178756", "0.66889167", "0.6677724", "0.6661157", "0.6555896", "0.6527207", "0.64584696", "0.64517015", "0.6450208", "0.644749", "0.6435074", "0.6413329", "0.6413329", "0.6391818", "0.6380081", "0.6380081", ...
0.0
-1
GET /critiques GET /critiques.json
def index if !current_user redirect_to '/' end if current_user.email == 'samir@test.com' || current_user.email == 'priyatham.ven@gmail.com' @critiques = Critique.all else redirect_to '/' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @critic = Critic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @critic }\n end\n end", "def index\n @conseilles = Conseille.all\n respond_to do |format|\n format.html\n format.json { render json: @conseilles}...
[ "0.6917557", "0.64635026", "0.6453011", "0.6366252", "0.63477385", "0.6220512", "0.61601573", "0.6139401", "0.61109525", "0.6087491", "0.6080522", "0.6078946", "0.60634995", "0.60481364", "0.60397726", "0.60397726", "0.6029944", "0.60285705", "0.599939", "0.59883404", "0.5965...
0.0
-1
POST /critiques POST /critiques.json
def create @critique = Critique.new(critique_params) respond_to do |format| if @critique.save format.html { redirect_to @critique, notice: 'Critique was successfully created.' } format.json { render :show, status: :created, location: @critique } else format.html { render :ne...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @critic = Critic.new(params[:critic])\n\n respond_to do |format|\n if @critic.save\n format.html { redirect_to @critic, notice: 'Critic was successfully created.' }\n format.json { render json: @critic, status: :created, location: @critic }\n else\n format.html { r...
[ "0.6567436", "0.6453611", "0.63635546", "0.63625675", "0.6291372", "0.6229047", "0.6218149", "0.6212664", "0.6208599", "0.61970204", "0.6181715", "0.6175815", "0.616542", "0.6151637", "0.6144078", "0.61130756", "0.60946923", "0.60933274", "0.60657525", "0.60492796", "0.604586...
0.73504734
0