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
PUT /driver_records/1 PUT /driver_records/1.json
def update @driver_record = DriverRecord.find(params[:id]) respond_to do |format| if @driver_record.update_attributes(params[:driver_record]) format.html { redirect_to @driver_record, notice: 'Driver record was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @driver_record.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\t\t\t\trespond_with Driver.update(params[:id],params[:driver])\n\t\t\tend", "def update\n #@driver = Driver.find(params[:id])\n @driver = @event.drivers.find(params[:id])\n\n respond_to do |format|\n if @driver.update_attributes(params[:driver])\n format.html { redirect_to [@eve...
[ "0.66712904", "0.6377764", "0.63377064", "0.60311097", "0.5984553", "0.5977846", "0.5977846", "0.59686136", "0.59617054", "0.5920817", "0.58608276", "0.58064646", "0.5797752", "0.57845855", "0.57702583", "0.57278895", "0.56001943", "0.55585754", "0.55535144", "0.55468", "0.55...
0.653862
1
DELETE /driver_records/1 DELETE /driver_records/1.json
def destroy @driver_record = DriverRecord.find(params[:id]) @driver_record.destroy respond_to do |format| format.html { redirect_to driver_records_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n # Logic to delete a record\n @driver = Driver.find(params[:id])\n @driver.destroy\n\n respond_to do |format|\n format.html { redirect_to drivers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\t\t\trespond_with Driver.destroy(params[:id])\n end...
[ "0.7188934", "0.7096676", "0.7003741", "0.6833237", "0.6816964", "0.6704521", "0.66454375", "0.66403776", "0.66403776", "0.66403776", "0.6638277", "0.6633604", "0.66118133", "0.6610802", "0.66096276", "0.65934575", "0.6559825", "0.6555986", "0.6537249", "0.6534184", "0.651305...
0.75246847
0
GET /users/1DIS GET /users/1.json
def show @user = User.find(params[:id]) @clock_times = @user.clock_times.all @clock_times_by_week = separate_by_weeks @clock_times puts "farg..." + @clock_times_by_week.inspect @clock_time = @user.clock_times.new respond_to do |format| format.html # show.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.7568498", "0.7428059", "0.7406899", "0.734745", "0.7303857", "0.70768505", "0.69802237", "0.693383", "0.6929189", "0.69154674", "0.6912279", "0.6893862", "0.68163985", "0.68140846", "0.6804745", "0.67887205", "0.6758953", "0.6754927", "0.67462033", "0.6733165", "0.6718727"...
0.0
-1
GET /users/new GET /users/new.json
def new @user = User.new respond_to do |format| format.html # new.html.erb format.json { render json: @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @newuser = Newuser.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newuser }\n end\n end", "def new\n @usernew = Usernew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @usernew }\n ...
[ "0.82876", "0.81695044", "0.81553495", "0.8048313", "0.80221504", "0.8020816", "0.80092996", "0.7950455", "0.7929954", "0.7929954", "0.7872814", "0.7872814", "0.7872814" ]
0.7860219
97
POST /users POST /users.json
def create params[:user]["_id"] = params[:user][:name] @user = User.new(params[:user]) respond_to do |format| if @user.save() format.html { redirect_to @user, notice: 'User was successfully created.' } format.json { render json: @user, status: :created, location: @user } else format.html { render action: "new" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.6538697
74
PUT /users/1 PUT /users/1.json
def update @user = User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.74114245", "0.73920554", "0.73041475", "0.7254177", "0.7202618", "0.70756376", "0.70535713", "0.7029043", "0.70075685", "0.69883573", "0.6983195", "0.694263", "0.69409895", "0.692315", "0.6909438", "0.687742", "0.68486536", "0.6834162", "0.6821841", "0.6801179", "0.6770304...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to users_url } format.json { head :no_content } puts "*************:" + @user.inspect format.js { render nothing: true } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.78750366", "0.7750983", "0.7714552", "0.760911", "0.7471576", "0.7406053", "0.7406053", "0.7368785", "0.7344947", "0.733919", "0.73272926", "0.7308574", "0.73084617", "0.73053783", "0.72965413", "0.7290662", "0.7290503", "0.7287583", "0.72832316", "0.72497493", "0.72497493...
0.0
-1
Print the status line and make sure there is nothing left from the last line
def print_line(line) @maxlinelength = line.length if line.length > @maxlinelength print line.ljust(@maxlinelength) << "\r" $stdout.flush end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commit_status()\n if @status_line\n if @ping_from\n # Debug mode show final line value as history.\n puts @status_line\n else\n # Normal mode advance to the next line leaving this line as history.\n puts\n end\n STDOUT.flush\n @status_line = nil\n end\...
[ "0.76561373", "0.73701465", "0.7199338", "0.68716294", "0.670236", "0.6658726", "0.6638777", "0.6451151", "0.6408656", "0.6394571", "0.63861805", "0.6381459", "0.63300073", "0.6328831", "0.63007075", "0.6243855", "0.6224607", "0.62158304", "0.62158304", "0.62118864", "0.62070...
0.0
-1
Fetch the size of an url
def fetch_filesize(url) uri = URI.parse(url) header = { 'User-Agent' => "A tiny script in ruby to analyse your videos :) - But don't worry a user is also there.", } h = Net::HTTP.new uri.host, uri.port getfile = uri.path getfile << '?' << uri.query if not uri.query.nil? res = h.request_head(getfile, header) # If this is only a redirect follow it return fetch_filesize(res['location']) if res.key? 'location' res.content_length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_size(url)\n Rails.cache.fetch(\"/content_size/#{url}\", expires_in: 10.minutes) do\n begin\n meta = meta_file(url)\n size_text = meta.xpath(\"//m:metalink//m:file//m:size[1]//text()\", 'm' => 'urn:ietf:params:xml:ns:metalink')\n size = Integer(size_text.to_s)\n size\...
[ "0.81279415", "0.78865814", "0.7780762", "0.77487236", "0.76869905", "0.76749206", "0.7631035", "0.75966054", "0.7353377", "0.72136194", "0.7048881", "0.693597", "0.6932003", "0.69188637", "0.6882509", "0.68779504", "0.6874736", "0.68506676", "0.6802141", "0.6795249", "0.6780...
0.81690514
0
Doing everything to fetch the video to the HDD (Don't look at this if you are easyly confusable.)
def download_file(url, filename, start = 0) # Define some default values uri = URI.parse(url) len = start size = start perc = 0 header = { 'User-Agent' => "A tiny script in ruby to fetch your videos :) - But don't worry a user is also there.", } header['Range'] = "bytes=#{start}-" if start > 0 start = DateTime.now.strftime('%s').to_i begin # Open the target file File.open(filename, 'a') do |file| # Start the download h = Net::HTTP.new uri.host, uri.port getfile = uri.path getfile << '?' << uri.query if not uri.query.nil? h.request_get(getfile, header) do |r| # If there is a redirect header follow it and continue downloading there return download_file(r['location'], filename) if r.key? 'location' # Read the download size len = len + r.content_length if not r.content_length.nil? r.read_body do |s| # Write the downloded part to the file file.write s if not /2[0-9][0-9]/.match(r.code).nil? file.flush # Calculate downloaded size size = size + s.length len = size if r.content_length.nil? # Do some calculations for the nice status line perc = (size.to_f / len.to_f * 100).to_i if len > 0 lines = (perc / 4).to_i timegone = DateTime.now.strftime('%s').to_i - start bps = size.to_f / timegone.to_f sleft = ((len - size).to_f / bps).to_i print_line "DL: #{filename} - [#{'=' * lines}#{' ' * (25 - lines)}] #{perc}% (#{transform_byte(size)} / #{transform_byte(len)}) ETA: #{transform_secs(sleft)}" end end end rescue Exception => ex if @debug print_line "\a\a\a" << ex.message sleep 2 end if ex.message.include? 'Interupt' print_line "You interupted me. Skipping this file..." return end # Something went wrong? Simply try again... (Hope the user want this to...) print_line "Connection failture. Trying again..." return download_file(url, filename, size) end # Finished but did not got everything? Should not happen. Try to get the rest if size < len return download_file(url, filename, size) end # Tell the user that we are done :) print_line "Completed. See your file at #{filename}" puts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_video\n\t\t# preview_video_url = \"https://video.tvspielfilm.de/ivideo/video/10/9700610_1.mp4\"\n\n\t\tif preview_video_url.present?\t\n\t\t\tfilename = Pathname.new(preview_video_url).basename\n\t\t\tfilename = filename.to_s rescue \"#{Time.now.to_i}.mp4\"\n\t\t\t\n\t\t\tfilename = \"#{id}_#{filename...
[ "0.6857345", "0.65862954", "0.64283955", "0.637391", "0.63454497", "0.6229927", "0.6198828", "0.6177422", "0.61542165", "0.61429685", "0.60249317", "0.60194224", "0.5987404", "0.59856683", "0.5982497", "0.59382236", "0.5936411", "0.59192616", "0.59005713", "0.58758307", "0.58...
0.53658766
83
Transforms the float number to something with max. 2 digits after the colon
def two_digits(number) (number * 100.0).to_i.to_f / 100.0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_with_precision\n\t\t\"%.2f\" % number\n\tend", "def float2maxima(value)\n str = value.to_s ;\n str.gsub!(/^0\\./,'.') ;\n str.gsub!(/^-0\\./,'-.') ;\n return str ;\n end", "def number_with_lformat(number)\n number_with_precision(number.to_f, :precision => 2, :separator => \...
[ "0.6582721", "0.6469831", "0.6390959", "0.625258", "0.6171198", "0.60232675", "0.60074866", "0.5983188", "0.5983188", "0.5952108", "0.5894121", "0.58310544", "0.5828855", "0.5824589", "0.5810024", "0.57838947", "0.57730305", "0.5740375", "0.57302934", "0.5701605", "0.56780225...
0.0
-1
No one wants to read 123secs so tell them what this is in human readable time
def transform_secs(seconds) time = '' h = (seconds.to_f / 3600.0).floor seconds = seconds - (h * 3600) time << "#{h.to_s.rjust(2, '0')}:" if h > 0 m = (seconds.to_f / 60.0).floor seconds = seconds - (m * 60) time << "#{m.to_s.rjust(2, '0')}:" time << "#{seconds.to_s.rjust(2, '0')}" time end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_time # :nodoc:\n\t rt_sec, rt_usec = rio.read(TIME_SIZE).unpack('VV')\n\t Time.at(rt_sec, rt_usec)\n\tend", "def read_time\n (number_of_words.to_f / WORDS_PER_MINUTE).ceil\n end", "def tv_sec() end", "def sec() time[2] end", "def time\n a=[1, 1000, 60000, 3600000]*2\n ms = dura...
[ "0.6949369", "0.6926923", "0.69215083", "0.6906641", "0.6809054", "0.67765385", "0.6753894", "0.6739984", "0.6722098", "0.66422457", "0.6477977", "0.64709616", "0.64535004", "0.6431178", "0.64310145", "0.64257765", "0.6413693", "0.64007914", "0.6389182", "0.636378", "0.634952...
0.0
-1
Transform amount of bytes in humanreadable format
def transform_byte(byte) byte = byte.to_f return two_digits(byte / 1073741824).to_s << " GB" if byte > 1073741824 return two_digits(byte / 1048576).to_s << " MB" if byte > 1048576 return two_digits(byte / 1024).to_s << " KB" if byte > 1024 return two_digits(byte).to_s << " B" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def human_bytes(bytes)\n number_to_human bytes, units: BYTE_UNITS\n end", "def human_bytes(bytes)\n s = ['bytes', 'kb', 'MB', 'GB', 'TB', 'PB'];\n #indicates if thousands, millions ...\n place = (Math.log(bytes)/Math.log(1024)).floor\n (bytes/(1024 ** place.floor)).to_s+\" \"+s[place];\n end", ...
[ "0.70848453", "0.70743954", "0.6750771", "0.6711211", "0.66790736", "0.66623867", "0.6643506", "0.6584201", "0.6547346", "0.6420426", "0.6404685", "0.6282758", "0.62650555", "0.62376094", "0.6218412", "0.621097", "0.6174452", "0.6171634", "0.61682737", "0.61593324", "0.6157",...
0.73856795
0
Wheter this user is a super admin. Short for has_permission(:is_super_admin)
def is_super_admin? ((!user_group_id.nil?) && has_permission(:is_super_admin)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_super_admin?\n user_type == 'super_admin'\n end", "def is_super_admin?\n self.is_admin?\n end", "def is_super_admin?\n if admin_type == 1\n return true\n else\n return false\n end\n end", "def is_superadmin\n user = UserAdmin.find_by_user_id(current_user.id)\n if user...
[ "0.8697247", "0.8686085", "0.8585433", "0.8503495", "0.8499921", "0.8472378", "0.83544934", "0.8305156", "0.82714045", "0.8228453", "0.8224789", "0.8162704", "0.8150583", "0.8124374", "0.80108666", "0.7961289", "0.79499114", "0.79121536", "0.7907736", "0.78979313", "0.7895682...
0.8830652
0
Whether this user is an admin. Short for has_permission(:is_admin)
def is_admin? ((!user_group_id.nil?) && has_permission(:is_admin)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin?\n user_signed_in? && current_user.admin?\n end", "def admin_user?\n if current_user != nil\n !!current_user.admin\n end\n end", "def is_admin?(user)\n user.admin > 0\n end", "def admin?\n current_user.admin?\n end", "def is_admin?\n determine_user_role\...
[ "0.86431015", "0.8620019", "0.8609989", "0.8607026", "0.85214525", "0.8516616", "0.8508861", "0.8483408", "0.8480497", "0.8472581", "0.8457309", "0.8447519", "0.84435105", "0.8438134", "0.843688", "0.8429784", "0.8428747", "0.8387753", "0.8387197", "0.8365594", "0.8360546", ...
0.83427614
21
true if has booking between 2 dates (format date or string)
def has_bookings_at_period(checkin_date, checkout_date) # convert to date if string checkin_date = Date.parse(checkin_date) if checkin_date.is_a? String checkout_date = Date.parse(checkout_date) if checkout_date.is_a? String # if no consistency in period return true if checkout_date < checkout_date # prevent charging dataset for more than 100 days long return true if (checkout_date-checkin_date) >= 100 # raise error ? self.bookings.each do |booking| (booking.checkin..booking.checkout).each do |d| # booking for this outfit at these dates return true if (checkin_date..checkout_date).include? d end end # no booking at this date return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def availability?(start_date, end_date)\n start_date = Date.parse(start_date)\n end_date = Date.parse(end_date)\n bookings = self.get_bookings(id: self.id)\n if bookings.length > 0\n bookings.each do |booking|\n if (start_date > booking.start_date && start_date < booking.end_date) || (end_d...
[ "0.7811179", "0.7527403", "0.73640716", "0.7221717", "0.72079784", "0.71533626", "0.7150685", "0.714059", "0.7134902", "0.71034175", "0.7064304", "0.70228076", "0.7005362", "0.699471", "0.69600844", "0.69454503", "0.69338346", "0.68948674", "0.6894289", "0.6885256", "0.684889...
0.64822793
44
Render and deliver the chart
def getchart() # The data for the chart dataY0 = [4, 4.5, 5, 5.25, 5.75, 5.25, 5, 4.5, 4, 3, 2.5, 2.5] dataX0 = [Time.mktime(1997, 1, 1), Time.mktime(1998, 6, 25), Time.mktime(1999, 9, 6), Time.mktime(2000, 2, 6), Time.mktime(2000, 9, 21), Time.mktime(2001, 3, 4 ), Time.mktime(2001, 6, 8), Time.mktime(2002, 2, 4), Time.mktime(2002, 5, 19), Time.mktime(2002, 8, 16), Time.mktime(2002, 12, 1), Time.mktime(2003, 1, 1)] dataY1 = [7, 6.5, 6, 5, 6.5, 7, 6, 5.5, 5, 4, 3.5, 3.5] dataX1 = [Time.mktime(1997, 1, 1), Time.mktime(1997, 7, 1), Time.mktime(1997, 12, 1), Time.mktime(1999, 1, 15), Time.mktime(1999, 6, 9), Time.mktime(2000, 3, 3 ), Time.mktime(2000, 8, 13), Time.mktime(2001, 5, 5), Time.mktime(2001, 9, 16 ), Time.mktime(2002, 3, 16), Time.mktime(2002, 6, 1), Time.mktime(2003, 1, 1)] # Create a XYChart object of size 500 x 270 pixels, with a pale blue (e0e0ff) # background, black border, 1 pixel 3D border effect and rounded corners c = ChartDirector::XYChart.new(600, 300, 0xe0e0ff, 0x000000, 1) c.setRoundedFrame() # Set the plotarea at (55, 60) and of size 520 x 200 pixels, with white (ffffff) # background. Set horizontal and vertical grid lines to grey (cccccc). c.setPlotArea(50, 60, 525, 200, 0xffffff, -1, -1, 0xcccccc, 0xcccccc) # Add a legend box at (55, 32) (top of the chart) with horizontal layout. Use 9 # pts Arial Bold font. Set the background and border color to Transparent. c.addLegend(55, 32, false, "arialbd.ttf", 9).setBackground( ChartDirector::Transparent) # Add a title box to the chart using 15 pts Times Bold Italic font. The text is # white (ffffff) on a deep blue (000088) background, with soft lighting effect # from the right side. c.addTitle("Long Term Interest Rates", "timesbi.ttf", 15, 0xffffff).setBackground( 0x000088, -1, ChartDirector::softLighting(ChartDirector::Right)) # Set the y axis label format to display a percentage sign c.yAxis().setLabelFormat("{value}%") # Add a red (ff0000) step line layer to the chart and set the line width to 2 # pixels layer0 = c.addStepLineLayer(dataY0, 0xff0000, "Country AAA") layer0.setXData(dataX0) layer0.setLineWidth(2) # Add a blue (0000ff) step line layer to the chart and set the line width to 2 # pixels layer1 = c.addStepLineLayer(dataY1, 0x0000ff, "Country BBB") layer1.setXData(dataX1) layer1.setLineWidth(2) # Output the chart send_data(c.makeChart2(ChartDirector::PNG), :type => "image/png", :disposition => "inline") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_chart\n assert_privileges(\"view_graph\")\n\n if params[:report]\n rpt = MiqReport.for_user(current_user).find_by(:name => params[:report])\n rpt.generate_table(:userid => session[:userid])\n else\n rpt = if session[:report_result_id]\n MiqReportResult.for_user(curre...
[ "0.73793256", "0.71304905", "0.70487463", "0.7032319", "0.69694126", "0.69295007", "0.69255656", "0.69129133", "0.69128174", "0.68344223", "0.6826156", "0.68255234", "0.6810791", "0.6803158", "0.6785608", "0.67432153", "0.67410535", "0.6721165", "0.67112935", "0.67078435", "0...
0.66887486
22
Print the version of iTunes
def show_version puts "iTunes version: #{@iTunes.version}" @logger.info "iTunes version: #{@iTunes.version}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_version()\n (version,packager,name) = get_version()\n puts name+\" v. \"+version+\" \"+packager\n exit\nend", "def print_version\n puts VERSION\n \n exit\n end", "def show_version\n puts format('JRubyArt version %s', JRubyArt::VERSION)\n end", "def print_version_info()\...
[ "0.65963435", "0.6577111", "0.65505254", "0.65398264", "0.6528015", "0.64972866", "0.6479126", "0.6469703", "0.64344853", "0.628872", "0.6227733", "0.6093266", "0.60480416", "0.6046116", "0.5966573", "0.59488386", "0.59069866", "0.58627456", "0.58528763", "0.58112365", "0.578...
0.8646498
0
Get a list of all possible iTunes sources
def sources @iTunes.sources.each do |source| @sources << source end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sources\n @sources.names\n end", "def get_sources\n @page.all(input_elements[:sources_list])\n end", "def sources\n []\n end", "def sources\n @sources ||= []\n end", "def sources\n @sources ||= AVAILABLE_SOURCES.each_with_object({}) do |source_class, list|\n ...
[ "0.6552776", "0.6322853", "0.6287629", "0.6234077", "0.6230914", "0.6189557", "0.61244214", "0.60867286", "0.59995264", "0.59594893", "0.59584624", "0.5896845", "0.585722", "0.58501995", "0.58476985", "0.5754696", "0.5724293", "0.57051915", "0.5647997", "0.5635674", "0.561590...
0.83333707
0
Find a playlist by its name
def find_playlist_by_name name @playlists.each do |playlist| return playlist.index if name == playlist.name end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_playlist\n @playlist = Playlist.find(params[:id])\n end", "def item_find\n find(playlist_url(@response.old_index))\n end", "def find_by_name(name)\r\n @internal_list.find {|album| album.name == name}\r\n end", "def find_playlists_for_song(song_name)\n track_array = s...
[ "0.69710803", "0.6940758", "0.68536437", "0.67400104", "0.647235", "0.643509", "0.6434064", "0.6405076", "0.6315739", "0.6255049", "0.6187526", "0.6138805", "0.6124344", "0.6102551", "0.60900825", "0.60815686", "0.60704964", "0.60665536", "0.60312784", "0.60115546", "0.600960...
0.7819258
0
Find all the tracks with an empty location (aka path)
def find_dead_tracks playlist playlist.fileTracks.each do |track| next unless track.location == nil puts "Dead track: #{track.databaseID}: #{track.artist}/#{track.album}/#{track.name}" @logger.info "Dead track: #{track.databaseID}: #{track.artist}/#{track.album}/#{track.name}" #@dead_track_list << track end #return @dead_track_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def songs_never_played\n return @tracks.find_all {|s| s.play_count == 0}\n end", "def test_track_id_nil\n oh = LIBRARY.tracks.find_all {|s| s.track_id == nil}\n assert oh.none?\n end", "def get_empty_location()\n for i in 10..20\n if self.players.where(:location => i).length == 0\n re...
[ "0.6371481", "0.629223", "0.6066787", "0.60268354", "0.5981722", "0.5958237", "0.58627117", "0.55814177", "0.5577122", "0.550616", "0.5488234", "0.5453588", "0.5451669", "0.541234", "0.53852075", "0.5383593", "0.5358553", "0.53521633", "0.5313146", "0.527729", "0.5251823", ...
0.59118336
6
Return the number of dead tracks
def count_dead_tracks @dead_track_list.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_count\n return @tracks.length\n end", "def track_count\n self.tracks.count\n end", "def num_of_tracks\n\t\t@tracks.count\t \n\tend", "def incomplete_count\n incomplete.count\n end", "def number_of_tracklists\n tracklists.size\n end", "def track_count\n @ole.TrackCount...
[ "0.7729222", "0.7510872", "0.74920726", "0.6840377", "0.6794566", "0.6771973", "0.6727374", "0.6718701", "0.6544453", "0.6544453", "0.64508843", "0.64395803", "0.6374396", "0.63047314", "0.6283432", "0.6241958", "0.6239872", "0.62331903", "0.62202245", "0.6212775", "0.6198936...
0.90659004
0
Remove tracks from the track_list from the iTunes database
def rem_dead_tracks playlist begin playlist.fileTracks.each do |track| #puts "#{track.index}: #{track.location}" next unless track.location == nil puts "Deleting dead track: #{track.artist} - #{track.album} - #{track.name}" @logger.info "Deleting dead track: #{track.artist} - #{track.album} - #{track.name}" track.delete end rescue Exception => e puts e.message end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_tracks(tracks)\n\n tracks.each do |track|\n self.tracks.destroy(track) # remove association\n end\n\n tracks\n end", "def remove_track_from_tracklist(playlist_id=1439475515)\n \t url = \"playlist/#{playlist_id}/tracks\"\n request_data = {:params=>{'access...
[ "0.73032564", "0.69318926", "0.6711813", "0.66769016", "0.6638574", "0.66019875", "0.6216058", "0.613805", "0.6134288", "0.605465", "0.6035624", "0.600622", "0.59619135", "0.59495777", "0.5910261", "0.58891296", "0.5883125", "0.585527", "0.58225507", "0.58147", "0.57582915", ...
0.6958975
1
This is a nasty hack. If we didn't have PORO models, we could just use ApplicationRecord.descendants, but that wouldn't pick up e.g. CaseRequest Grepping through the source code seemed to be the most pragmatic solution so that developers don't need to remember to add new classes to a list for mutation testing, but it's not ideal
def grep_model_files_for_classes re = /class (?<klass>\w+)/ Dir.glob(Rails.root.join('app/models/*.rb')). map { |f| File.readlines(f).grep(/\bclass /) }.flatten. map { |s| re.match(s)[:klass] }.map(&:constantize). reject do |klass| klass.respond_to?(:abstract_class?) && klass.abstract_class? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end", "def models\n children = []\n Mongoid.models.each do |model|\n children << model.to_s\n model.descendants.each do |child|\n inh = [child.to_s]...
[ "0.70746", "0.6688687", "0.62822956", "0.6050729", "0.6009372", "0.59131706", "0.5895144", "0.5895144", "0.58925205", "0.5885518", "0.5838802", "0.5833704", "0.5832198", "0.58307815", "0.58263284", "0.58234364", "0.5816049", "0.58147687", "0.57984734", "0.5789123", "0.578812"...
0.6335589
2
Load the dependencies file.
def load source = self.depfile.read self.instance_eval( source, self.depfile.to_s, 1 ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_dependencies\n dependencies.each { |dependency| dependency }\n end", "def load_dependencies( file_list, force_require=true )\r\n loader = DependencyLoader.new( file_list, force_require )\r\n loader.load_dependencies\r\nend", "def load!\n contents = File.read(filepath).strip\n h...
[ "0.76913065", "0.76774323", "0.73476964", "0.71030635", "0.7047796", "0.6935037", "0.68620163", "0.68116766", "0.66445124", "0.6644166", "0.65944886", "0.65821755", "0.65745914", "0.653909", "0.65299064", "0.645695", "0.6456933", "0.6388073", "0.63791734", "0.6330047", "0.632...
0.7262908
3
Gem Dependency API methods Declare a dependency on a gem. Ignores every option except :group.
def gem( name, *requirements, **options ) if options[:group] == :development || options[:groups]&.include?( :development ) || self.current_groups.include?( :development ) requirements.push( :development ) end dependency = Gem::Dependency.new( name, *requirements ) self.dependencies.add( dependency ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gem(name, *reqs)\n if dep = @dependency_names[name]\n dep.requirement.concat reqs\n else\n dep = Gem::Dependency.new name, *reqs\n @dependency_names[name] = dep\n @dependencies << dep\n end\n end", "def gem(name, *reqs)\n @dependencies << Gem::Dependency.new(name, reqs)\n ...
[ "0.6867321", "0.6728805", "0.6728805", "0.6662304", "0.6561729", "0.6559748", "0.6436301", "0.639025", "0.6329641", "0.6286518", "0.62733144", "0.6232861", "0.62017846", "0.61180526", "0.6117555", "0.6104101", "0.6091112", "0.6083656", "0.6057914", "0.6037483", "0.59764814", ...
0.7401856
0
Declare a group block.
def group( *names ) options = names.pop if names.last.is_a?( Hash ) previous_groups = self.current_groups.dup self.current_groups.replace( names ) yield ensure self.current_groups.replace( previous_groups ) if previous_groups end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group(name, &block)\n namespace = Namespace.new(name, &block)\n @blocks << namespace\n namespace\n end", "def group(name = nil, &block)\n make_child(name, nil, &block)\n end", "def group!( &block )\n\t\tn = new!( true )\n\t\tblock.call(n)\n\t\tn\n\tend", "def group(name, &bl...
[ "0.78581864", "0.7367328", "0.721182", "0.6974353", "0.662404", "0.64993775", "0.64918506", "0.648655", "0.6374337", "0.6291941", "0.6258515", "0.6253804", "0.6122607", "0.60891384", "0.6083531", "0.60789657", "0.60784197", "0.6044039", "0.6043522", "0.6039209", "0.6030055", ...
0.0
-1
Raise, as the gemdeps file should be the authoritative source.
def gemspec( * ) raise "Circular dependency: can't depend on the gemspec to build itself" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def test_bad_chicken_deps\n check_deps_fail \"notapackage\" => :chicken if which('csc')\n end", "def validate!\n File.exist?(gemfile) or raise MissingGemfile, \"Gemfile not found: #{gemfile}\"\n ...
[ "0.6724499", "0.6724499", "0.66882056", "0.66457987", "0.6574887", "0.6574887", "0.6569999", "0.6400102", "0.6347521", "0.63227403", "0.6306154", "0.6276875", "0.6249284", "0.6249284", "0.61831915", "0.6126752", "0.6122544", "0.6116536", "0.6113339", "0.61018604", "0.61018604...
0.64553404
7
Ignore a gem dependency API call.
def no_op_method( * ) # :nodoc: yield if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def excluded_deps\n missing_deps_for(upstream_gem)\n end", "def enabled_dependencies\n @dependencies.reject(&:ignore?)\n end", "def allow_missing?(dependency)\n false\n end", "def excluded_dev_deps\n missing_dev_deps_for(upstream_gem)\n end", "def excludes_de...
[ "0.67253166", "0.619571", "0.619176", "0.616641", "0.61537457", "0.6069599", "0.6069599", "0.6041873", "0.60235244", "0.5940439", "0.59284616", "0.58688396", "0.5813702", "0.57521874", "0.57307374", "0.5716537", "0.5680987", "0.56657743", "0.56621003", "0.56396055", "0.563560...
0.0
-1
Public: Stops the Honeybadger service. Examples: Honeybadger.stop => nil Returns nothing
def stop Agent.stop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop\n DRb.stop_service\n end", "def service_stop; end", "def stop_service\n DRb.stop_service\n end", "def terminate!\n DRb.stop_service\nend", "def stop\r\n DRb.stop_service\r\n @log.info(\"Provider stopped on : #{@drb_server_uri}\")\r\n end", "def stop\n @builder.terminate\n ...
[ "0.72559756", "0.702745", "0.6960373", "0.6931874", "0.6613953", "0.6559665", "0.65080166", "0.638478", "0.63624275", "0.6361757", "0.63569176", "0.6356461", "0.63346195", "0.6313708", "0.63101226", "0.62923825", "0.62743783", "0.6272089", "0.6258252", "0.62534255", "0.622846...
0.61755747
35
Public: Callback to filter backtrace lines. One use for this is to make additional [PROJECT_ROOT] or [GEM_ROOT] substitutions, which are used by Honeybadger when grouping errors and displaying application traces. block A block which can be used to modify the Backtrace lines sent to Honeybadger. The block expects one argument (line) which is the String line from the Backtrace, and must return the String new line. Examples: Honeybadger.backtrace_filter do |line| line.gsub(/^\/my\/unknown\/bundle\/path/, "[GEM_ROOT]") end Returns nothing.
def backtrace_filter(&block) Agent.backtrace_filter(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter(backtrace); end", "def filter(backtrace); end", "def filter_backtrace(backtrace)\n ## remove backtraces that match any pattern in IGNORE_CALLERS\n trace = backtrace.reject{|b| IGNORE_CALLERS.any?{|i| i=~b}}\n ## remove `:in ...` portion of backtraces\n trace = trace.map do |bt| \...
[ "0.7130077", "0.7130077", "0.7024147", "0.69362855", "0.68944085", "0.6633929", "0.65367573", "0.6326931", "0.632211", "0.6288927", "0.61718094", "0.6166607", "0.6138041", "0.6028372", "0.57720876", "0.5744469", "0.5744032", "0.5703542", "0.55516654", "0.55077255", "0.5500343...
0.7388833
0
Internal: Clears the global context
def clear! Thread.current[:__honeybadger_context] = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_context\n @current_context = nil\n end", "def clear_current\n all_contexts.delete(Thread.current.object_id)\n end", "def clear!\n contexts.clear\n end", "def clear!\n contexts.clear\n end", "def clear!\n context_manager.clear!\n end", "def res...
[ "0.8546618", "0.81780964", "0.8075689", "0.8075689", "0.7952407", "0.78832823", "0.777144", "0.7615259", "0.7615259", "0.74167573", "0.74140745", "0.7372963", "0.7230976", "0.7230976", "0.7019988", "0.70135087", "0.69684714", "0.69677633", "0.6827737", "0.6783115", "0.6716638...
0.70591193
14
Initialize the engine instance
def initialize(fact_class) @fact_class = fact_class end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(engine = default_engine)\n @engine = engine\n end", "def start_engine\n @engine.start_engine\n end", "def initialize_engine\n require_template_library 'eco'\n end", "def initialize(engine, interactive = true)\n @engine = engine\n @interactive = interactive\n en...
[ "0.79950374", "0.7389908", "0.7230665", "0.7178654", "0.71286577", "0.7058527", "0.70458996", "0.6987274", "0.6987274", "0.6987274", "0.69570947", "0.69389486", "0.6865608", "0.6865608", "0.6814687", "0.6790047", "0.6739879", "0.6739879", "0.673828", "0.6730506", "0.6730506",...
0.0
-1
Populate the prejoined fact table.
def populate(options={}) populate_prejoined_fact_table(options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_prejoined_fact_table(options={})\r\n fact_columns_string = columns.collect {|c|\r\n \"#{table_name}.\" + c.name unless excluded_foreign_key_names.include?(c.name)\r\n }.compact.join(\",\\n\") \r\n \r\n prejoined_columns = []\r\n \r\n tables_and_joins = \"#{table_n...
[ "0.84082294", "0.74827445", "0.6295784", "0.58048487", "0.55817306", "0.5358085", "0.5300262", "0.5279212", "0.5266691", "0.5205254", "0.51967645", "0.5195885", "0.5181098", "0.5102876", "0.5089507", "0.50233686", "0.5011442", "0.50093275", "0.49745193", "0.49037144", "0.4902...
0.80255306
1
Drop the storage table
def drop_prejoin_fact_table connection.drop_table(prejoined_table_name) if connection.tables.include?(prejoined_table_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_table\n db.drop_table(table_name)\n end", "def drop_table\n self.connection.drop_table table_name\n end", "def drop_table(name)\n not_exist(name)\n\n ORM::DBConnection.new(model_name(name)).remove_table(name)\n File.delete(\"app/services/db/tables/#{name}.jso...
[ "0.7861428", "0.75350136", "0.7481387", "0.7394846", "0.7380593", "0.7354598", "0.7313839", "0.7272783", "0.7263349", "0.7079708", "0.7041613", "0.6985817", "0.6972179", "0.6960047", "0.69326204", "0.6920041", "0.68648213", "0.68438196", "0.68410397", "0.6819557", "0.6815129"...
0.0
-1
Get foreign key names that are excluded.
def excluded_foreign_key_names excluded_dimension_relations = prejoined_fields.keys.collect {|k| dimension_relationships[k]} excluded_dimension_relations.collect {|r| r.foreign_key} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def foreign_key_fields\n keys = []\n database_field_names.each do |param|\n if self.send(param).is_a? ForeignKey\n keys << param\n end\n end\n keys\n end", "def non_foreign_key_fields\n self.database_field_names - self.foreign_key_fields\n end", "def foreign_keys\n vals = [...
[ "0.6926847", "0.6741855", "0.67373955", "0.65991753", "0.64413625", "0.63550436", "0.62120456", "0.61069524", "0.60865986", "0.60457295", "0.6005258", "0.5979622", "0.59685093", "0.59685093", "0.5932059", "0.59176356", "0.59096026", "0.59076685", "0.58819073", "0.5847478", "0...
0.863032
0
Construct the prejoined fact table.
def create_prejoined_fact_table(options={}) connection.transaction { drop_prejoin_fact_table connection.create_table(prejoined_table_name, :id => false) do |t| # get all columns except the foreign_key columns for prejoined dimensions columns.each do |c| t.column(c.name, c.type) unless excluded_foreign_key_names.include?(c.name) end #prejoined_columns prejoined_fields.each_pair do |key, value| dclass = dimension_class(key) dclass.columns.each do |c| t.column(c.name, c.type) if value.include?(c.name.to_sym) end end end } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_prejoined_fact_table(options={})\r\n fact_columns_string = columns.collect {|c|\r\n \"#{table_name}.\" + c.name unless excluded_foreign_key_names.include?(c.name)\r\n }.compact.join(\",\\n\") \r\n \r\n prejoined_columns = []\r\n \r\n tables_and_joins = \"#{table_n...
[ "0.81337154", "0.6465175", "0.6194726", "0.60960203", "0.53838074", "0.53418994", "0.53412735", "0.52600896", "0.52530104", "0.52224874", "0.5216368", "0.51703537", "0.5150687", "0.5143182", "0.51354873", "0.51294726", "0.5122486", "0.5099326", "0.5083423", "0.50702107", "0.5...
0.80051035
1
Populate the prejoined fact table.
def populate_prejoined_fact_table(options={}) fact_columns_string = columns.collect {|c| "#{table_name}." + c.name unless excluded_foreign_key_names.include?(c.name) }.compact.join(",\n") prejoined_columns = [] tables_and_joins = "#{table_name}" prejoined_fields.each_pair do |key, value| dimension = dimension_class(key) tables_and_joins += "\nJOIN #{dimension.table_name} as #{key}" tables_and_joins += "\n ON #{table_name}.#{dimension_relationships[key].foreign_key} = " tables_and_joins += "#{key}.#{dimension.primary_key}" prejoined_columns << value.collect {|v| "#{key}." + v.to_s} end if connection.support_select_into_table? drop_prejoin_fact_table sql = <<-SQL SELECT #{fact_columns_string}, #{prejoined_columns.join(",\n")} FROM #{tables_and_joins} SQL sql = connection.add_select_into_table(prejoined_table_name, sql) else create_prejoined_fact_table(options) sql = <<-SQL INSERT INTO #{prejoined_table_name} SELECT #{fact_columns_string}, #{prejoined_columns.join(",\n")} FROM #{tables_and_joins} SQL end connection.transaction { connection.execute(sql) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate(options={})\r\n populate_prejoined_fact_table(options)\r\n end", "def create_prejoined_fact_table(options={})\r\n connection.transaction {\r\n drop_prejoin_fact_table\r\n\r\n connection.create_table(prejoined_table_name, :id => false) do |t|\r\n # get all columns ...
[ "0.80255306", "0.74827445", "0.6295784", "0.58048487", "0.55817306", "0.5358085", "0.5300262", "0.5279212", "0.5266691", "0.5205254", "0.51967645", "0.5195885", "0.5181098", "0.5102876", "0.5089507", "0.50233686", "0.5011442", "0.50093275", "0.49745193", "0.49037144", "0.4902...
0.84082294
0
this page allows you to add food items to a participant
def edit @food_item = @participant.food_items.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_food(food)\n food_meals.create(food_id: food.id)\n end", "def update\n @food_item = @restaurant.food_items.find_by(name: params[:new_food_item])\n if @food_item.nil?\n # here we are taking user input and inserting it into the flash, thus the flash needs to be sanitized before displayed\n ...
[ "0.6631024", "0.6522788", "0.6497612", "0.64098877", "0.6310791", "0.6310409", "0.6297878", "0.6289299", "0.6271286", "0.6214466", "0.61955434", "0.61719424", "0.6122305", "0.6105413", "0.60910183", "0.6056701", "0.6052904", "0.6041875", "0.6040316", "0.6033282", "0.6021365",...
0.6902602
0
posts to here should add a food item to a participant
def update @food_item = @restaurant.food_items.find_by(name: params[:new_food_item]) if @food_item.nil? # here we are taking user input and inserting it into the flash, thus the flash needs to be sanitized before displayed # this happens automatically with rails and should not be disabled flash[:danger] = "Sorry we were not able to find the food item #{params[:new_food_item]} at the restaurant." else @participant.food_items << @food_item @participant.processed = true @participant.save end respond_to do |format| format.js { render partial: 'add_food_item', food_item: @food_item } format.json { render json: food_item } format.html { redirect_to edit_meal_participant_path(@meal, @participant) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_food(food)\n food_meals.create(food_id: food.id)\n end", "def create\n\t\t food_params = params.require(:food).permit(:name, :exercise, :calories, :time)\n\t\t food = Food.create(food_params)\n\t\t current_user.foods << food\n\t\t if food.save\n\t\t \tredirect_to \"/users/#{current_user.id}\"\n\t\t e...
[ "0.6984389", "0.65566176", "0.650754", "0.63522476", "0.6317013", "0.62996984", "0.62992465", "0.62980515", "0.6276073", "0.62479335", "0.61999863", "0.61997306", "0.61840165", "0.61717063", "0.6166774", "0.6131458", "0.61282486", "0.60976136", "0.60473317", "0.6045609", "0.6...
0.6390024
3
Exports data to a CSV formatted file, using columns directly from a table table_name: name of the table exporting. Column names are pulled from it. data_array: an array of hashes (link from a find)
def csv_export_rawtable(table_name, data_array, options = {}) column_definitions = [] eval("#{table_name}.content_columns").each do |column| column_definitions << [column.name, column.name] end csv_export(column_definitions, data_array, options) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_data(array, name = \"data\")\n CSV.open(\"public/data/\" + name + \"_\" + Time.now.strftime(\"%m_%d_%Y_%H:%M:%S\") + \".csv\", \"w\") do |csv|\n csv << array\n end\n end", "def export_data(array, name = \"data\")\n CSV.open(\"public/data/\" + name + \"_\" + Time.now.strftime(\"%m_%d_%Y_...
[ "0.73341936", "0.73341936", "0.69036597", "0.65343547", "0.65272987", "0.6493118", "0.6469194", "0.632637", "0.62658876", "0.623132", "0.62234145", "0.62212783", "0.62028", "0.6189768", "0.618202", "0.60957974", "0.60957974", "0.6062983", "0.6034636", "0.6026678", "0.6009424"...
0.8191336
0
Use the column_options to change data to a specific type
def convert_value(value, column_options) if column_options case column_options[:type] when 'Number' return value.to_i end end value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_column(table_name, column_name, type, options = {})\n begin\n execute \"ALTER TABLE #{table_name} ALTER COLUMN #{quote_column_name(column_name)} #{type_to_sql(type, options[:limit], options[:precision], options[:scale])}\"\n rescue ActiveRecord::StatementInvalid\n # This ...
[ "0.71148425", "0.701191", "0.68691784", "0.68393767", "0.6827363", "0.6787256", "0.66701823", "0.66531485", "0.66143113", "0.66076595", "0.65629375", "0.65298116", "0.64940614", "0.6430979", "0.64124805", "0.64124805", "0.6408913", "0.640504", "0.6404931", "0.6399527", "0.638...
0.6140565
42
Older Excel limited to 32 char filenames removed filename length limit put back if problems occur
def to_excel_filename(title) the_time = Time.now file_prefix = "#{the_time.year}_#{the_time.mon}_#{the_time.day}_" filename = (file_prefix + title.gsub(/[^\w.\-]/, '_')).squeeze('_') # --- removed filename length limit - put back if problems occur : (filename.length > 27 ? filename[0...27] : filename) + '.xls' filename + '.xls' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trim_filename(filename)\n filename_length = filename.length\n \n #trim 'n' splice if necessary\n if filename_length > MAX_FILENAME_LENGTH\n filename = filename.to_s[0..MAX_FILENAME_LENGTH] + '...' + filename.to_s[(filename_length - FILENAME_TAIL_LENGTH)..filename_length]\n end\n \n return filename\ne...
[ "0.6036188", "0.5801818", "0.5786523", "0.5732437", "0.57285184", "0.5618781", "0.55944943", "0.55806315", "0.55549175", "0.5546898", "0.5445526", "0.5429091", "0.54183054", "0.53831494", "0.53813446", "0.5372781", "0.5344138", "0.5341651", "0.5328573", "0.5327912", "0.532252...
0.50657207
44
Completes the transfer by creating inventory entries corresponding to the changes made to the source and destination inventories by the transfer items.
def complete! now = Time.current transaction do transfer_items.each do |item| source.present? && source.destock!(item, now, self) destination.present? && destination.restock!(item, now, self) end update completed_at: now end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def complete_transactions!\n pending_transactions.each do |transaction|\n ActiveRecord::Base.transaction do\n transaction.entries.create!(amount: transaction.amount, entry_type: 'D', transaction: transaction, account: Account.mimo_assets)\n transaction.entries.create!(amount: transaction.amou...
[ "0.6582895", "0.63096386", "0.5977841", "0.5905514", "0.58127666", "0.5804521", "0.5718544", "0.56545705", "0.55839056", "0.55536807", "0.5511493", "0.5504977", "0.5487107", "0.5475895", "0.5421679", "0.5414727", "0.5402404", "0.5346618", "0.52448153", "0.52358997", "0.521074...
0.70786023
0
Transfer is considered feasible only if all its items can be transferred, given current stock levels. Immediately returns true if the source is nil denoting an external source or if the source uses a stock gateway, which will not be queried.
def feasible? return true if source.nil? || source.enable_gateway? transfer_items.each do |item| return false unless item.feasible? end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feasible?\n return true if amount < 0 || source.nil? || !product.tracked_stock? || source.enable_gateway?\n inventory_item = source_item\n inventory_item.present? && inventory_item.available >= amount\n end", "def can_buy_ship?(other)\n return false unless @credits >= (other.price - @start_ship....
[ "0.69510263", "0.60551435", "0.5973509", "0.59410405", "0.58941346", "0.5849367", "0.5816457", "0.5791938", "0.56999266", "0.5693581", "0.56742793", "0.56690663", "0.56568885", "0.5652399", "0.56424236", "0.5602203", "0.55789673", "0.5552804", "0.5547144", "0.55413353", "0.55...
0.73438925
0
Loads the given order items into the transfer. To keep track of inventory during the load, matching inventory items are preloaded and updated by each load_item! call.
def load!(order_items) transaction do products = order_items.map(&:product) stock = source.inventory_items.for(products) order_items.each do |order_item| load_item!(order_item, stock) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load!\n transfer = find_or_create_transfer\n transfer.load!(order.items_waiting)\n end", "def load_item_from_stock(order_item, stock_items)\n amount = order_item.waiting\n stock_items.each do |item|\n all = item.available\n next if all <= 0\n\n if amount <= all\n # This inv...
[ "0.7143785", "0.65659773", "0.6305985", "0.60799503", "0.60450166", "0.59311044", "0.5776516", "0.57490283", "0.5734592", "0.56506526", "0.55872136", "0.55603206", "0.5530761", "0.5525726", "0.55232835", "0.5515011", "0.5450952", "0.5434968", "0.5424652", "0.54147923", "0.539...
0.85636306
0
Creates a new transfer item based on given order item, specifying the product, lot code, and amount, if not overridden by arguments.
def create_item_from(order_item, lot_code = nil, expires_at = nil, amount = nil) transfer_items.create!( order_item: order_item, product: order_item.product, lot_code: lot_code || order_item.lot_code, expires_at: expires_at, amount: amount || order_item.waiting ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_order(order_item, qty, order)\r\n if order_item == \"latte\"\r\n item = Item.new(\"latte\", $latte_cost, $latte_price)\r\n elsif order_item == \"tea\"\r\n item = Item.new(\"tea\", $tea_cost, $tea_price)\r\n elsif order_item == \"scones\"\r\n item = Item.new(\"scones\", $scones...
[ "0.6691924", "0.6266502", "0.62314475", "0.6195867", "0.61193067", "0.6056103", "0.6008871", "0.5976084", "0.5946891", "0.5939792", "0.59351736", "0.59328204", "0.59294873", "0.58686465", "0.5860523", "0.58581656", "0.5846601", "0.5842059", "0.5814926", "0.5803405", "0.578219...
0.8461544
0
Duplicates given existing transfer items into this transfer, useful for creating return transfers.
def duplicate_items_from(items) transaction do items.each do |item| transfer_items << item.dup end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_duplicate(attrs)\n # Note that the duplication is *ONLY* the cart items and no attributes from\n # the originating cart are retained\n cloned = Cart.new(attrs)\n\n # Nor are the cart items fully cloned. Only the fabric variant is\n # retained (and associated denormalized columns)\n car...
[ "0.605014", "0.60479575", "0.5778689", "0.57436013", "0.55729043", "0.5521336", "0.55010784", "0.5485309", "0.54599166", "0.5440926", "0.54229176", "0.5409679", "0.538437", "0.5382901", "0.53795326", "0.53790027", "0.53771126", "0.5372685", "0.5371709", "0.5361232", "0.535303...
0.82348144
0
Loads a single order item from given stock into the transfer as one or more transfer items. Updates the stock accordingly. Attempts several strategies until one returns true to denote the item has been loaded or the item is left (partially) unloaded.
def load_item!(order_item, stock) if !order_item.product.tracked_stock? || source.enable_gateway? load_item_from_infinite_stock(order_item) && return end stock_items = stock.select { |item| item.product == order_item.product } return false if stock_items.none? if order_item.lot_code.present? load_item_by_lot_code(order_item, stock_items) else load_item_from_stock(order_item, stock_items) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_item_from_stock(order_item, stock_items)\n amount = order_item.waiting\n stock_items.each do |item|\n all = item.available\n next if all <= 0\n\n if amount <= all\n # This inventory item satisfies the amount, we're done.\n item.reserved += amount\n return create_i...
[ "0.74615616", "0.70915425", "0.69880384", "0.6798755", "0.59630257", "0.5661048", "0.5522546", "0.544738", "0.5381362", "0.5239705", "0.5188291", "0.5172124", "0.51267564", "0.5115782", "0.5044405", "0.4995173", "0.4985708", "0.4950463", "0.4935117", "0.48869804", "0.4881234"...
0.78892595
0
Loading from infinite stock always succeeds. Order number is used as lot code for the transfer item.
def load_item_from_infinite_stock(order_item) create_item_from(order_item, order_item.order.number) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_item!(order_item, stock)\n if !order_item.product.tracked_stock? || source.enable_gateway?\n load_item_from_infinite_stock(order_item) && return\n end\n stock_items = stock.select { |item| item.product == order_item.product }\n return false if stock_items.none?\n\n if order_item.lot_co...
[ "0.7569398", "0.7144613", "0.67937493", "0.67354023", "0.65367925", "0.6056922", "0.5861945", "0.5587089", "0.54921794", "0.54418737", "0.5432402", "0.5432042", "0.53774035", "0.5306669", "0.52873474", "0.5270145", "0.5215932", "0.52012783", "0.51901776", "0.51871717", "0.518...
0.7764891
0
Loading an item by lot code selects an inventory item by code, and only loads the item if a match is found.
def load_item_by_lot_code(order_item, stock_items) item = stock_items.find { |item| order_item.lot_code == item.code } # If the order item has a serial number, try lot code part only. if item.nil? && order_item.lot_code['-'] lot_code_part = order_item.lot_code.split('-').first item = stock_items.find { |item| lot_code_part == item.code } end # If a match was found, load the item and return. If a partial # match set a lot code part above, use that, or provide nil # to use the code on the order item. if item.present? item.reserved += order_item.amount return create_item_from(order_item, lot_code_part, item.expires_at) end false # Failed to load the item. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source_item\n source.item_by_product_and_code(product, lot_code)\n end", "def find_by_code(code)\n record = fetch(code)\n return unless record\n\n Models::InventoryItem.new(**record.merge(code: code,\n discount: @discounts_rep.find_by_c...
[ "0.65136737", "0.6332236", "0.6300958", "0.61952794", "0.6193434", "0.5958836", "0.5933638", "0.5852383", "0.5797833", "0.5743802", "0.5683368", "0.56575394", "0.565443", "0.56279033", "0.5621907", "0.5619759", "0.5562339", "0.5548164", "0.55050683", "0.54750896", "0.545956",...
0.80378413
0
Default strategy: loads the order item from given stock items.
def load_item_from_stock(order_item, stock_items) amount = order_item.waiting stock_items.each do |item| all = item.available next if all <= 0 if amount <= all # This inventory item satisfies the amount, we're done. item.reserved += amount return create_item_from(order_item, item.code, item.expires_at, amount) else # Load all of this item and continue with the remaining amount. item.reserved += all create_item_from(order_item, item.code, item.expires_at, all) amount -= all end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load!(order_items)\n transaction do\n products = order_items.map(&:product)\n stock = source.inventory_items.for(products)\n order_items.each do |order_item|\n load_item!(order_item, stock)\n end\n end\n end", "def load_item!(order_item, stock)\n if !order_item.product.tr...
[ "0.75004685", "0.73562926", "0.68975836", "0.6496159", "0.58743876", "0.5844464", "0.5844464", "0.57095766", "0.56721216", "0.5621166", "0.559142", "0.5583651", "0.5574895", "0.5574895", "0.5574895", "0.5574895", "0.5548346", "0.5531116", "0.5512123", "0.54989743", "0.5484707...
0.7040457
2
Define a custom model with a UUID key
def heffalump_model @model ||= Class.new { include DataMapper::Resource property :id, DataMapper::Property::SimpleUUID property :color, DataMapper::Property::String property :num_spots, DataMapper::Property::Integer property :striped, DataMapper::Property::Boolean # This is needed for DataMapper.finalize def self.name() 'Heffalump' end }.tap { DataMapper.finalize } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def populate_uuid\n self.uuid = SecureRandom.uuid()\n end", "def set_uuid\n self.id = SecureRandom.uuid\n end", "def set_uuid\n self.uuid = SecureRandom.uuid\n end", "def set_uuid\n self.uuid = SecureRandom.uuid\n end", "def create_uuid\n self.uuid = SecureRandom.hex(12)\n end", "def ...
[ "0.68468714", "0.67764723", "0.6723268", "0.6723268", "0.6704489", "0.6674335", "0.665937", "0.66423947", "0.65382326", "0.6537561", "0.6532744", "0.6523552", "0.6489476", "0.6489476", "0.6474152", "0.6464125", "0.6411354", "0.6405148", "0.6402602", "0.6376676", "0.63421744",...
0.0
-1
Define a custom model with an Integer key
def heffalump_model @model ||= Class.new { include DataMapper::Resource property :id, DataMapper::Property::Serial property :color, DataMapper::Property::String property :num_spots, DataMapper::Property::Integer property :striped, DataMapper::Property::Boolean # This is needed for DataMapper.finalize def self.name() 'Heffalump' end }.tap { DataMapper.finalize } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key\n raise MissingID if not defined?(@id)\n model.key[id]\n end", "def integer(key, opts={})\n @attrs[key.to_sym] = Attributes::IntegerAttr.new(key, opts)\n end", "def default_key\n :\"#{underscore(demodulize(self[:model].name))}_id\"\n end", "def id\n key\n end"...
[ "0.6720784", "0.666855", "0.6541495", "0.64091", "0.6388466", "0.6317858", "0.62648356", "0.61169046", "0.6099205", "0.6097988", "0.6094806", "0.6094806", "0.6052079", "0.5998992", "0.5998329", "0.5993525", "0.5992326", "0.596866", "0.596866", "0.596866", "0.5931119", "0.59...
0.0
-1
encoding: muleutf8 Define a navi for contecting to sakamoto san's website
def navi(rel_pos="/~kunolab/") puts "<ul class='menuBar'>" puts "<li><a href=\"/~sakamoto/kunolab/MiniWorkshop/2nd/index.html\">Mini-Workshop</a>" puts "<li><a href=\"https://calendar.google.com/calendar/embed?src=kunogroup%40gmail.com&ctz=Asia%2FTokyo\">久野研カレンダー(KunoLabCalendar)</a>" puts "<li><a href=\"/~kunolab/seminar/ronbun/2018/index.html\">論文紹介(Paper Presentation)</a>" puts "<li><a href=\"/~kunolab/seminar/kenkyu/2018/index.html\">研究紹介(Research Presentation)</a>" puts "<li><a href='#'>ゼミ(Seminar) <image src=\"image/sita3.png\" class=\"headImg\"></a>" puts "<ul>" puts "<li><a href=\"/~kunolab/seminar/Lepton_2017/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Leptonゼミ(2017)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Modern_2016/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Thomsonゼミ(2016)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Modern_2015/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Thomsonゼミ(2015)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Perkins_2015/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Perkinsゼミ(2015)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Mann_2014/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Mannゼミ(2014)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Mann/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Mannゼミ(2013)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Elementary_2013/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> 素粒子物理学ゼミ(2013)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Leo_2012/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Leoゼミ(2012)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Perkins_2012/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Perkinsゼミ(2012)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Elementary/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> 素粒子物理学ゼミ(2012)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Knoll/index.html\"> <image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Knollゼミ(2011)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Knoll_en/index.html\"> <image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Knoll(en)ゼミ(2011)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Roe/index.html\"> <image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Roeゼミ(2011)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Leo/index.html\"> <image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Leoゼミ(2010)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Perkins_en/index.html\"><image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Perkins(en)ゼミ(2010)</a></li>" puts "<li><a href=\"/~sakamoto/kunolab/Leo_en/index.html\"> <image src=\"#{rel_pos}img/yoko3.png\" class=\"headImg\"> Leo(en)ゼミ(2010)</a></li>" puts "</ul>" puts "</ul>" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def utf_page(url)\t\n Hpricot(Iconv.new('utf-8', 'windows-1257').iconv(open(@@WWW+url).read))\n end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", "def encoding; end", ...
[ "0.66995645", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.58150536", "0.5733221", "0.5733221", "0.56812507", "0.5677913", ...
0.5490137
26
A function to read slide path
def read_slide(fname) hash={} File.open(fname,'r') do |f| f.each_line do |line| line.chomp! a1,a2 = line.split(/\s*==\s*/) hash[a1] = a2 # a1:id, a2:path end end hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def path() end", "def path() end", "def path() end", "def path\n @reader.path\n end", "def read_path_with_own_path\n File.join(read_path, path)\n end", "def path_section\n $1 if @basename.to_s =~ /\\.(\\d\\w*)\\./\n end", "def read_path(path)\n File.read(path)\n ...
[ "0.61731964", "0.61731964", "0.61731964", "0.61456704", "0.6084605", "0.60776776", "0.60620546", "0.601105", "0.59851295", "0.5976377", "0.59317535", "0.5889492", "0.58782643", "0.58782643", "0.5853616", "0.5844539", "0.5841976", "0.5812183", "0.5812183", "0.5812183", "0.5811...
0.0
-1
Read Data A function to read summary path
def read_summary(fname) hash={} # Read file File.open(fname,'r') do |f| # Loop over line f.each_line do |line| line.chomp! index,content = line.split(/\s*==\s*/) hash[index] = content # index:id, content:path end end return hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_data_file(path); end", "def data name\n File.read data_path(name)\nend", "def read_metadata; end", "def summarize_file(path); end", "def read(path); end", "def read\n IO.read(full_path)\n end", "def parse_from_summary(data)\n # \n end", "def read\n self.re...
[ "0.6683467", "0.6334066", "0.6097599", "0.60357463", "0.5965562", "0.5940172", "0.5874988", "0.5801263", "0.57817864", "0.57148975", "0.56931293", "0.56931293", "0.56892806", "0.56694525", "0.5619701", "0.56122977", "0.55611265", "0.5526575", "0.54714274", "0.5470373", "0.544...
0.5781134
9
A function to read data Arg: fname: file name (text file) The format is like this id | name | title | reference | slide Define Read data
def read_data(fname) ents=[] if ( File.exist?(fname) ) File.open(fname,'r') do |f| f.each_line do |line| line.chomp! a1,a2,a3,a4,a5,a6 = line.split(/\s*==\s*/) hash={} hash["1"] = a1 hash["2"] = a2 hash["3"] = a3 hash["4"] = a4 hash["5"] = a5 hash["6"] = a6 ents.push(hash) end end end ents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_file(filename); end", "def read_data_file(path); end", "def readFile()\n\t#This is assuming the file name will be used\n\tfilename = 'names-data.txt'\n\topen(filename, 'r') {|f| f.read}\nend", "def my_file_reader(fname)\n fstream = File.open(fname, 'r')\n data = fstream.read\n fstream.close\n \n...
[ "0.6743158", "0.66980904", "0.6688931", "0.6547904", "0.6420694", "0.623779", "0.6237525", "0.6228019", "0.61477125", "0.6127539", "0.6127539", "0.6085452", "0.60843104", "0.6037993", "0.60239553", "0.5988194", "0.5975208", "0.5961383", "0.59195316", "0.5913285", "0.59058404"...
0.5424846
86
A function to read schedule .txt
def read_schedule2(fname) ents=[] File.open(fname,'r') do |f| f.each_line do |line| line.chomp! a1,a2,a3,a4 = line.split(/\s*==\s*/) hash={} hash["1"] = a1 hash["2"] = a2 hash["3"] = a3 hash["4"] = a4 ents.push(hash) end end ents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_schedule\n schedule = {}\n File.open(SCHEDULE_FILE, 'r') do |f|\n f.each_line do |line|\n m = /^(\\d+)\\s+(\\S+)/.match(line)\n next if m.nil?\n week = m[1]\n server = m[2]\n schedule[server] = week.to_i\n end\n end\n\n schedul...
[ "0.7165557", "0.6616428", "0.6464286", "0.6092501", "0.60570586", "0.60412633", "0.6032724", "0.6025103", "0.60056823", "0.59381217", "0.58323586", "0.58003163", "0.57709646", "0.5670735", "0.5614807", "0.56066287", "0.56003714", "0.5568436", "0.55491984", "0.55422306", "0.54...
0.672207
1
A function to read time table
def read_time_table(fname) ents=[] File.open(fname,'r') do |f| f.each_line do |line| line.chomp! a1,a2,a3,a4,a5 = line.split(/\s*==\s*/) hash={} hash["1"] = a1 # id hash["2"] = a2 # start time hash["3"] = a3 # end time hash["4"] = a4 # person hash["5"] = a5 # title ents.push(hash) end end ents end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_time fn=nil\n time = read_single_line(fn)\n if time.size == 2 # vector of two integers\n time.map { |t| t.to_i }\n else # single number\n single = time.first\n single =~ float_re ? single.to_f : single.to_i\n [single, nil]\n end\n end",...
[ "0.62877005", "0.59484184", "0.588952", "0.5858403", "0.5856105", "0.5802663", "0.5800128", "0.5799782", "0.5752518", "0.5727681", "0.5693217", "0.5658559", "0.5654533", "0.5636147", "0.56288266", "0.5618865", "0.55988264", "0.55954945", "0.5577572", "0.55742943", "0.5570156"...
0.70969385
0
This checks if the schools need to log in to sign up competitors, or if it's open sign up
def school_password_required Setting.find_by(key: "require_school_password").value == "yes" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def canSignUp(u)\n ret = {}\n ts = Time.now.utc\n shop_info = u.workshops.collect {|w| [w.session, w.name]}\n if u.workshop_ids.count >= 3\n # Can't have more than 3 workshops\n ret[:status] = \"You can't more than three workshops.\"\n ret[:result] = false\n elsif shop_info.map(&:firs...
[ "0.6519415", "0.64361525", "0.63620067", "0.630236", "0.62322503", "0.62223345", "0.6175254", "0.6172759", "0.6172146", "0.6137977", "0.61055636", "0.6084167", "0.6084167", "0.6077931", "0.6064437", "0.6037957", "0.60218525", "0.59957254", "0.5983902", "0.59413975", "0.593578...
0.0
-1
GET /my_exams GET /my_exams.json
def index @my_exams = MyExam.all respond_to do |format| format.html # index.html.erb format.json { render json: @my_exams } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @exams = Exam.all\n end", "def index\n @course = Course.find(params[:course_id])\n @exams = @course.exams \n end", "def index\n\n\t\t@resource =\tUser.find_by_authentication_token(params[:auth_token])\n\t\t# byebug\n\t\treturn invalid_user unless @resource\n\t\t@exams = Exam.all\n\t\t...
[ "0.69597405", "0.6736313", "0.643277", "0.63711256", "0.6279522", "0.62561756", "0.62325245", "0.60618776", "0.6056022", "0.60445017", "0.5982109", "0.59747404", "0.5951909", "0.59491444", "0.5907248", "0.5858777", "0.5805613", "0.57967013", "0.5796345", "0.5753043", "0.57529...
0.74871546
0
GET /my_exams/1 GET /my_exams/1.json
def show @my_exam = MyExam.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @my_exam } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end", "def index\n @exams = Exam.all\n end", "def show\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n format.html # sho...
[ "0.74351555", "0.6804366", "0.67775935", "0.66019934", "0.6292801", "0.6272089", "0.6157554", "0.61472136", "0.613771", "0.6120837", "0.60940826", "0.6082671", "0.60677797", "0.6046901", "0.6037483", "0.6015028", "0.5993006", "0.5988773", "0.5975579", "0.5975579", "0.59754854...
0.6599216
4
GET /my_exams/new GET /my_exams/new.json
def new @my_exam = MyExam.new respond_to do |format| format.html # new.html.erb format.json { render json: @my_exam } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @exam = Exam.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @exam }\n end\n end", "def new\n @sentence = Sentence.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sentence }\n end\n...
[ "0.7593478", "0.71986675", "0.7113014", "0.70557946", "0.70039195", "0.69941354", "0.69941354", "0.69941354", "0.69941354", "0.6951249", "0.6947157", "0.69334483", "0.69263786", "0.691952", "0.6895242", "0.68790585", "0.68790585", "0.6874897", "0.6874568", "0.6839693", "0.683...
0.7325477
1
POST /my_exams POST /my_exams.json
def create @my_exam = MyExam.new(params[:my_exam]) respond_to do |format| if @my_exam.save format.html { redirect_to @my_exam, notice: 'My exam was successfully created.' } format.json { render json: @my_exam, status: :created, location: @my_exam } else format.html { render action: "new" } format.json { render json: @my_exam.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @my_exams = MyExam.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @my_exams }\n end\n end", "def create\n @exam = current_user.exams.new(exam_params)\n respond_to do |format|\n if @exam.save\n format.html { redirect_to ...
[ "0.61441857", "0.6086509", "0.59997255", "0.59955865", "0.59955865", "0.59372014", "0.58337593", "0.5766544", "0.57370776", "0.56390977", "0.5620361", "0.55895036", "0.55798846", "0.5563627", "0.55165786", "0.5514264", "0.55109465", "0.5504571", "0.5500483", "0.5494432", "0.5...
0.5986983
5
PUT /my_exams/1 PUT /my_exams/1.json
def update @my_exam = MyExam.find(params[:id]) respond_to do |format| if @my_exam.update_attributes(params[:my_exam]) format.html { redirect_to @my_exam, notice: 'My exam was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @my_exam.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @exam = Exam.find(params[:id])\n\n respond_to do |format|\n if @exam.update_attributes(params[:exam])\n format.html { redirect_to exams_path, notice: 'Exam was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\...
[ "0.64303535", "0.63440514", "0.6166141", "0.61212033", "0.6035428", "0.60242563", "0.60242563", "0.60242563", "0.60242563", "0.5959499", "0.5910932", "0.5886689", "0.5871076", "0.5867297", "0.5799167", "0.57983476", "0.57724565", "0.5735059", "0.57146245", "0.5683933", "0.568...
0.6154803
3
DELETE /my_exams/1 DELETE /my_exams/1.json
def destroy @my_exam = MyExam.find(params[:id]) @my_exam.destroy respond_to do |format| format.html { redirect_to my_exams_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @exam = Exam.find(params[:id])\n @exam.destroy\n\n respond_to do |format|\n format.html { redirect_to exams_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @exam.destroy\n respond_to do |format|\n format.html { redirect_to exams_url }\n f...
[ "0.73418057", "0.71732163", "0.70905197", "0.692606", "0.691144", "0.6909299", "0.6881308", "0.6849361", "0.6839646", "0.6839646", "0.6839646", "0.68239444", "0.67956245", "0.67746824", "0.675569", "0.6749452", "0.67456764", "0.67290425", "0.66978794", "0.66743493", "0.665517...
0.7298862
1
GET /checklocations/1 GET /checklocations/1.json
def show @checklocation = Checklocation.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @checklocation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locations\n get('locations')\n end", "def get_location\n as_json(get_results('/locations.json'))\n end", "def index\n locations = Location.all\n render json: locations\n end", "def index\n @api_v1_locations = Api::V1::Location.all\n respond_to do |format|\n format.html { @api_v1...
[ "0.67741096", "0.6695241", "0.65326035", "0.6521637", "0.63815725", "0.6380121", "0.6329414", "0.6285283", "0.62847316", "0.62704057", "0.6257463", "0.6232984", "0.6215145", "0.61881995", "0.6181893", "0.6178184", "0.61647683", "0.6142148", "0.6132089", "0.6120561", "0.609616...
0.70227426
0
GET /checklocations/new GET /checklocations/new.json
def new @checklocation = Checklocation.new respond_to do |format| format.html # new.html.erb format.json { render json: @checklocation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @loc = current_user.locs.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loc }\n end\n end", "def new\n @location_have_location = LocationHaveLocation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json ...
[ "0.7326898", "0.7140238", "0.71116495", "0.71116495", "0.71116495", "0.71116495", "0.71116495", "0.7072644", "0.7057065", "0.70568", "0.70568", "0.70374763", "0.69907475", "0.69710684", "0.696086", "0.6918263", "0.6904993", "0.6895286", "0.68744946", "0.6860864", "0.6849603",...
0.7804917
0
POST /checklocations POST /checklocations.json
def create @checklocation = Checklocation.new(params[:checklocation]) respond_to do |format| if @checklocation.save format.html { redirect_to @checklocation, notice: 'Checklocation was successfully created.' } format.json { render json: @checklocation, status: :created, location: @checklocation } else format.html { render action: "new" } format.json { render json: @checklocation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @location = Location.new(location_params)\n authorize @location\n if @location.save\n check_active_locations\n ok_status\n else\n error_status\n end\n end", "def create\n @location_have_location = LocationHaveLocation.new(params[:location_have_location])\n\n resp...
[ "0.61141616", "0.58627456", "0.5854386", "0.58495474", "0.5847235", "0.5788752", "0.57777876", "0.5777498", "0.57715297", "0.57215303", "0.56990874", "0.5698953", "0.56949586", "0.5674815", "0.565803", "0.56263936", "0.56254256", "0.56242496", "0.5610269", "0.5572539", "0.557...
0.6602425
0
PUT /checklocations/1 PUT /checklocations/1.json
def update @checklocation = Checklocation.find(params[:id]) respond_to do |format| if @checklocation.update_attributes(params[:checklocation]) format.html { redirect_to @checklocation, notice: 'Checklocation was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @checklocation.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_location(params)\n @client.put(\"#{path}/location\", nil, params, \"Content-Type\" => \"application/json\")\n end", "def update\n render json: Location.update(params[\"id\"], params[\"location\"])\n end", "def create\n @checklocation = Checklocation.new(params[:checklocation])\n\n resp...
[ "0.648955", "0.6414245", "0.6151873", "0.6077711", "0.6064187", "0.5968042", "0.5915312", "0.5865967", "0.58075815", "0.57981247", "0.57776487", "0.57734776", "0.5769888", "0.5757061", "0.5748443", "0.5743139", "0.5731062", "0.57206774", "0.5700789", "0.5700789", "0.5700243",...
0.67213523
0
DELETE /checklocations/1 DELETE /checklocations/1.json
def destroy @checklocation = Checklocation.find(params[:id]) @checklocation.destroy respond_to do |format| format.html { redirect_to checklocations_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Location.delete(params[\"id\"])\n end", "def destroy\n @record = Location.find(params[:id])\n @record.trash\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n #@items_location = ItemsLocation.find(params[:id])\n #@items...
[ "0.69042605", "0.67305315", "0.6674951", "0.66638136", "0.6660653", "0.66491914", "0.66388047", "0.6622575", "0.6600498", "0.65997493", "0.65913284", "0.6581632", "0.6563891", "0.6561262", "0.6554776", "0.6554426", "0.6549019", "0.6548426", "0.6548426", "0.65432316", "0.65348...
0.75030154
0
Concatenate strings using an operator
def string_concat_infix(operator, *args) if args.blank? || args.size < 2 fail ArgumentError, "string concatenation requires operator and two or more arguments, given '#{args.size}'" end result = Arel::Nodes::InfixOperation.new(operator, args[0], args[1]) if args.size > 2 args.drop(2).each do |a| result = Arel::Nodes::InfixOperation.new(operator, result, a) end end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cmd_concat_operator\n\t\t\" & \"\n\tend", "def operator_c_string\n operator_string + \" \"\n end", "def operator_ruby_string\n operator_string + \" \"\n end", "def join_terms(op, *terms)\n [terms.map { |t| t.first.presence }.compact.join(\" #{op} \"),\n terms.map(&:second).redu...
[ "0.73667884", "0.73354244", "0.7304202", "0.6864403", "0.68610144", "0.6741919", "0.6715501", "0.6635938", "0.6606676", "0.65955436", "0.65381765", "0.6432006", "0.6428878", "0.63948524", "0.6383927", "0.6324063", "0.63008976", "0.6263552", "0.62539715", "0.62539715", "0.6253...
0.7225854
3
Construct a SQL literal. This is useful for sql that is too complex for Arel.
def sql_literal(value) Arel::Nodes::SqlLiteral.new(value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sql(string)\n ::Arel::Nodes::SqlLiteral.new(string)\n end", "def sql_literal(ds)\n ds.literal(sql_expr)\n end", "def sql_literal(object)\n object.literal(to_s)\n end", "def sql_literal(*)\n @dataset.sql\n end", "def literal_string_append(sql, v)\n sql << \"'\"...
[ "0.7736763", "0.76860034", "0.7586923", "0.73519284", "0.72554016", "0.7220023", "0.72013044", "0.7135038", "0.708184", "0.6977372", "0.6962823", "0.68229246", "0.67857265", "0.67269695", "0.6726387", "0.67204005", "0.6716745", "0.6714795", "0.67112356", "0.66904217", "0.6679...
0.8052894
0
Construct a SQL quoted string. This is used for fragments of SQL.
def sql_quoted(value) Arel::Nodes.build_quoted(value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string\n @sql_string = \"SELECT #{@select} FROM #{@from}#{@join} WHERE #{@where};\"\n end", "def quoted_identifier_append(sql, c)\n sql << '`%s`' % c\n end", "def escaped_sql\n sql % binds.reduce({}) { |a, (col, val)|\n a[col.to_sym] = if val.is_a? Array\n ...
[ "0.7503615", "0.7257309", "0.71583223", "0.70563316", "0.7047856", "0.7003093", "0.7003093", "0.69992816", "0.6699972", "0.6696728", "0.6689568", "0.6659244", "0.6655971", "0.662139", "0.65766203", "0.6499731", "0.6451111", "0.6422716", "0.6410513", "0.6401725", "0.6389198", ...
0.73625314
1
Construct a SQL EXISTS clause.
def exists(node) Arel::Nodes::Exists.new(node) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists(opts = nil)\n \"EXISTS (#{select_sql(opts)})\"\n end", "def exists(table, where = {})\n count(table, where) > 0\n end", "def exists(*args); end", "def exist? \n !DB.execute(\"SELECT name FROM students WHERE Id = ? \", @id).empty?\n end", "def prepare_for_sql_in_clause\n \"...
[ "0.7812344", "0.6293995", "0.59380126", "0.5665825", "0.56566733", "0.56529945", "0.5576356", "0.5492517", "0.5490903", "0.54658306", "0.5446944", "0.5446695", "0.53890246", "0.53038657", "0.5272023", "0.52305394", "0.5213588", "0.5200785", "0.5200785", "0.5168884", "0.516795...
0.4955571
39
Construct an Arel representation of a SQL function.
def named_function(name, expression, function_alias = nil) Arel::Nodes::NamedFunction.new(name, expression, function_alias) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def function_sql(f)\n args = f.args\n \"#{f.f}#{args.empty? ? '()' : literal(args)}\"\n end", "def irregular_function_sql(f)\n \"#{f.f}(#{literal(f.arg1)} #{f.joiner} #{literal(f.arg2)})\"\n end", "def create_function_sql(name, definition, opts=OPTS)\n args = opts[:args]\n if...
[ "0.72114253", "0.72029746", "0.7162768", "0.70845366", "0.69390935", "0.67026633", "0.64334005", "0.6325903", "0.62504846", "0.6182804", "0.6076468", "0.6029248", "0.60250694", "0.5994138", "0.59470236", "0.59458596", "0.59052366", "0.58389825", "0.56853765", "0.56518453", "0...
0.5795503
18
returns booleaan value overdue or not
def overdue? @due_date < Date.today end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overdue?\n due < Date.current\n end", "def overdue?\r\n @overdue = Time.now > @due_date\r\n end", "def overdue?\n return true if @past_due\n false\n end", "def overdue? ()\n\t\t@due_date < Time.now\n end", "def overdue?\n return false if due_at.nil?\n due_at < Time.now...
[ "0.7580483", "0.7530549", "0.752278", "0.7413455", "0.72838765", "0.7162273", "0.713849", "0.7117427", "0.6955074", "0.6895525", "0.6884943", "0.6877265", "0.6823064", "0.68216264", "0.680051", "0.67260766", "0.672285", "0.67214656", "0.6651268", "0.66407436", "0.65936893", ...
0.70379734
8
returns booleaan value duetoday or not
def due_today? @due_date == Date.today end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def due_today?\n @date == Date.today.to_s\n end", "def due_today?\n due_date == Date.due_today\n end", "def due_later?\n @due_date > Date.today\n end", "def overdue\n @date > Date.today\n end", "def overdue?\n @due_date < Date.today\n end", "def overdue?\n due < Date.current\n end...
[ "0.78485334", "0.78431356", "0.7580038", "0.7518905", "0.7500144", "0.7436945", "0.7378778", "0.725885", "0.7258464", "0.72386867", "0.7127824", "0.70372593", "0.69187444", "0.6889206", "0.6868523", "0.6867858", "0.6867445", "0.68260235", "0.6823145", "0.6823145", "0.6813691"...
0.7860707
0
returns booleaan value duelater or not
def due_later? @due_date > Date.today end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_if_false\n return @value_if_false\n end", "def value_if_true\n return @value_if_true\n end", "def value_bill_movement\n value ? value : 'N/a'\n end",...
[ "0.6748725", "0.66375077", "0.64534223", "0.643141", "0.6367481", "0.6268652", "0.609677", "0.6090259", "0.60746455", "0.6061701", "0.6042729", "0.5998619", "0.5972934", "0.59575474", "0.5951036", "0.59450835", "0.5893244", "0.5877842", "0.5877842", "0.5862989", "0.58574384",...
0.55799085
63
retuns the string what pattern user wants
def to_displayable_string display_status = @is_completed ? "[X]" : "[ ]" display_date = due_today? ? nil : @due_date "#{display_status} #{@text} #{display_date}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pattern_template\n pattern\n end", "def pattern_template\n pattern\n end", "def pattern\n @pattern\n end", "def pattern_template\n \"*\"\n end", "def to_regex_str\n pattern\n end", "def simplified_pattern\n pattern\n end", ...
[ "0.69192666", "0.69192666", "0.6883831", "0.6836314", "0.6817363", "0.6809142", "0.6809142", "0.67848635", "0.67848635", "0.67848635", "0.6654333", "0.65936637", "0.64952683", "0.63998526", "0.6375007", "0.6333256", "0.6200795", "0.6169713", "0.6099506", "0.609021", "0.605535...
0.0
-1
it will push the todo in the todolist
def add(todo) @todos.push(todo) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_todo\n puts\n desc = description('Todo description (required):')\n return if desc.nil?\n due = due_date\n priority = item_priority\n @list.add('todo',desc, { due: due, priority: priority})\n puts\n end", "def add_item_to_list(item)\n @to_do_item.push(item)\n end", "def add(tod...
[ "0.7107332", "0.7011871", "0.685573", "0.6837604", "0.6781269", "0.67708915", "0.6696298", "0.6645877", "0.6641652", "0.66268045", "0.66237235", "0.6609636", "0.6584491", "0.65521884", "0.6505387", "0.6469069", "0.64397347", "0.6439244", "0.6432675", "0.63712054", "0.63649863...
0.74936455
0
it will return the todolist of overdue
def overdue TodosList.new(@todos.filter { |todo| todo.overdue? }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def client_tasks_overdue\n self.find_all {|e| (e.completed.nil? or !e.completed) and e.complete_by < Time.zone.now }\n end", "def due_later\n TodosList.new(@todos.filter { |todo| todo.due_later? })\n end", "def dueToday\n dueTodayList = \"\"\n @toDoListArray.each do |e|\n if !e.status && e.d...
[ "0.7387114", "0.7348554", "0.72605664", "0.7171583", "0.7082553", "0.707628", "0.7039311", "0.6990257", "0.6685462", "0.6665459", "0.6647593", "0.6630727", "0.65986794", "0.6557406", "0.6529509", "0.6522506", "0.6505251", "0.64968306", "0.6437389", "0.6434519", "0.64197487", ...
0.83248234
0
it will return the todolist of duetoday
def due_today TodosList.new(@todos.filter { |todo| todo.due_today? }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dueToday\n dueTodayList = \"\"\n @toDoListArray.each do |e|\n if !e.status && e.dueDate == Date.today\n dueTodayList = dueTodayList + e.printItem + \" \"\n end\n end\n dueTodayList\n end", "def due_later\n TodosList.new(@todos.filter { |todo| todo.due_later? })\n end", "de...
[ "0.83781195", "0.80639076", "0.80233085", "0.7953399", "0.7519282", "0.7334585", "0.7211269", "0.7080071", "0.7056554", "0.70332956", "0.7003077", "0.6950114", "0.6912658", "0.6840903", "0.6753067", "0.6731556", "0.66811657", "0.6605121", "0.6572694", "0.6509702", "0.65023226...
0.8575246
0
it will return the todolist of duelater
def due_later TodosList.new(@todos.filter { |todo| todo.due_later? }) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def due_date_task_list\n @due_date_task_list\n end", "def dueToday\n dueTodayList = \"\"\n @toDoListArray.each do |e|\n if !e.status && e.dueDate == Date.today\n dueTodayList = dueTodayList + e.printItem + \" \"\n end\n end\n dueTodayList\n end", "def due_today\n TodosList....
[ "0.76600075", "0.7425", "0.7318131", "0.6905841", "0.6836603", "0.6794105", "0.67571825", "0.66352", "0.6619828", "0.6590634", "0.6586511", "0.65522486", "0.65361786", "0.65172076", "0.6468035", "0.6465515", "0.63964725", "0.6368936", "0.6341448", "0.63335764", "0.63125783", ...
0.8177851
0
Add diagram with Array
def add(type, *data) df = DataFrame.new({x: data[0], y: data[1], z: data[2]}) return add_with_df(df, type, :x, :y, :z) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot_array ary, type, options = {}\n\n options[:colors] ||= :category10\n colors = Rubyvis::Colors.send(options[:colors])\n\n options[:panel] = vis(options) # set up panel\n ary.each_index do |i|\n options[:panel] = ary[i].vis(type, options.merge({:line_color => c...
[ "0.59914404", "0.5876526", "0.57600933", "0.5715361", "0.5532969", "0.55228394", "0.5518061", "0.55106366", "0.5486477", "0.54860175", "0.5481736", "0.5452358", "0.5425963", "0.54224515", "0.53932595", "0.5371062", "0.5355002", "0.53539366", "0.53473085", "0.5339255", "0.5332...
0.0
-1
Show plot on IRuby notebook
def show Frame.new.tap {|f| f.add(self) }.show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot; end", "def show_in_iruby\n @adapter.show_in_iruby @chart\n end", "def beanplot\n end", "def view\n Rubyplot::Plotspace.new(self).view!\n end", "def configurePlot\n end", "def plot(data=[], options={})\n plot_to_image(data, options).to_blob\n end", "def display_...
[ "0.70270705", "0.6580019", "0.6541519", "0.6401503", "0.63217396", "0.6113924", "0.60458314", "0.6037573", "0.6013541", "0.59443295", "0.593125", "0.5924139", "0.58871317", "0.58349884", "0.58332187", "0.5793367", "0.57504535", "0.5736102", "0.5728279", "0.57273006", "0.56886...
0.0
-1
Show plot automatically on IRuby notebook
def to_iruby Frame.new.tap {|f| f.add(self) }.to_iruby end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot; end", "def configurePlot\n end", "def beanplot\n end", "def show_in_iruby\n @adapter.show_in_iruby @chart\n end", "def view\n Rubyplot::Plotspace.new(self).view!\n end", "def dpShow(rangeopt = \"\", styles = DfltPlotStyle) \n styles = \"using 1:2 \" + styles if(@timeM...
[ "0.7185896", "0.6795179", "0.6734516", "0.6483372", "0.63882226", "0.62924856", "0.6226456", "0.620727", "0.60776013", "0.60666865", "0.5918921", "0.5918042", "0.5914553", "0.58983797", "0.58823425", "0.58738077", "0.5865408", "0.58526534", "0.57181", "0.5704645", "0.5680771"...
0.0
-1
Shortcut method to configure plot
def configure(&block) self.instance_eval(&block) if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configurePlot\n end", "def plot; end", "def config\n PlotsConfig.instance\nend", "def configure(x: nil, y: nil, scale: nil)\n @x = x if x\n @y = y if y\n @scale = scale if scale\n self\n end", "def set_plot\n @plot = Plot.find(params[:id])\n end", "def set_plot\n @plot =...
[ "0.91367275", "0.69612473", "0.69358647", "0.6410552", "0.6312978", "0.6312978", "0.6312978", "0.6312978", "0.61700505", "0.6160832", "0.6160349", "0.61043495", "0.60529655", "0.60326385", "0.59564346", "0.58714366", "0.58498967", "0.5799983", "0.57948774", "0.5788942", "0.57...
0.0
-1
Natural Language Understanding is the subdomain of Natural Language Processing where people used to design AI based applications have ability to understand the human languages. HashInclude Speech Processing team has a project named Virtual Assistant. For this project they appointed you as a data engineer (who has good knowledge of creating clean datasets by writing efficient code). As a data engineer your first task is to make vowel recognition dataset. In this task you have to find the presence of vowels in all possible substrings of the given string. For each given string you have to return the total number of vowels. Example Given a string "baceb" you can split it into substrings: b, ba, bac, bace, baceb, a, ac, ace, aceb, c, ce, ceb, e, eb, b. The number of vowels in each of these substrings is 0, 1, 1, 2, 2, 1, 1, 2, 2, 0, 1, 1, 1, 1, 0; if you sum up these number, you get 16 the expected output. Note: your solution should have linear time complexity.
def vowel_recognition input input, count = input.split("").map! {|x| x =~ /[a,e,i,o,u,A,E,I,O,U]/ ? x = 1 : x = 0 }, 0 input.each_with_index { |x, ind| x == 0 ? 0 : count += ((ind + 1) * (input.length - ind)) } p count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vowel_count (str)\n sentence = str.downcase\n letters = sentence.split(\"\")\n count = 0\n vowels = %w{a e i o u}\n letters.each do |letter|\n if vowels.include?(letter) \n count += 1\n end\n end\n puts count\nend", "def Vowel_Count(string)\n a_count=0\n e_count=0\n i_count=0\n o_count=...
[ "0.7823777", "0.7781706", "0.7780768", "0.7766419", "0.7670706", "0.76624256", "0.76400393", "0.763531", "0.7625979", "0.76021266", "0.75598127", "0.75511575", "0.75477743", "0.75397444", "0.7539731", "0.7512922", "0.7495083", "0.74829054", "0.74731475", "0.74580646", "0.7455...
0.757697
10
Use callbacks to share common setup or constraints between actions.
def set_item @item = Item.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def item_params params.fetch(:item, {}).permit(:position, :lesson_id, :teacher_id, :week_number, :day_number).merge(group_id: params[:group_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.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 /join_user_to_assistants GET /join_user_to_assistants.json
def index @join_user_to_assistants = JoinUserToAssistant.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end", "def create\n @join_user_to_assistant = JoinUserToAssistant.new(join_user_to_assistant_params)\n\n respond_to do |format|\n if @join_user_to_assistant.save\n format.html { redirect_t...
[ "0.6488062", "0.61186546", "0.59869283", "0.59228635", "0.5900942", "0.56274027", "0.5619459", "0.55861795", "0.5528946", "0.5519544", "0.54990375", "0.5449441", "0.54196227", "0.5401511", "0.53953344", "0.5351622", "0.5315177", "0.5307044", "0.5305458", "0.5287998", "0.52729...
0.7344257
0
GET /join_user_to_assistants/1 GET /join_user_to_assistants/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @join_user_to_assistants = JoinUserToAssistant.all\n end", "def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end", "def create\n @join_user_to_assistant = JoinUserToAssistant.new(join_user_to_assistant_params)\n\n respond_to do |fo...
[ "0.72808343", "0.65550655", "0.6102001", "0.59393704", "0.5917495", "0.58264613", "0.56129616", "0.55842435", "0.5569549", "0.55627906", "0.5508365", "0.53591853", "0.5349518", "0.5330689", "0.5327412", "0.53187305", "0.5304142", "0.5303415", "0.52918595", "0.5279743", "0.527...
0.0
-1
POST /join_user_to_assistants POST /join_user_to_assistants.json
def create @join_user_to_assistant = JoinUserToAssistant.new(join_user_to_assistant_params) respond_to do |format| if @join_user_to_assistant.save format.html { redirect_to @join_user_to_assistant, notice: 'Join user to assistant was successfully created.' } format.json { render :show, status: :created, location: @join_user_to_assistant } else format.html { render :new } format.json { render json: @join_user_to_assistant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end", "def index\n @join_user_to_assistants = JoinUserToAssistant.all\n end", "def join_user_to_assistant_params\n params.require(:join_user_to_assistant).permit(:cpfk_user_id, :cpfk_assistant_id...
[ "0.6666518", "0.66353935", "0.64586884", "0.6028437", "0.5963533", "0.5916752", "0.57810825", "0.5778081", "0.57468504", "0.56878847", "0.5668315", "0.5657118", "0.56373066", "0.5594424", "0.55942625", "0.5583349", "0.5573002", "0.55658644", "0.5560405", "0.555374", "0.553897...
0.6986184
0
PATCH/PUT /join_user_to_assistants/1 PATCH/PUT /join_user_to_assistants/1.json
def update respond_to do |format| if @join_user_to_assistant.update(join_user_to_assistant_params) format.html { redirect_to @join_user_to_assistant, notice: 'Join user to assistant was successfully updated.' } format.json { render :show, status: :ok, location: @join_user_to_assistant } else format.html { render :edit } format.json { render json: @join_user_to_assistant.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_join_user_to_assistant\n @join_user_to_assistant = JoinUserToAssistant.find(params[:id])\n end", "def update\n user = User.where(:invite_token => params[:id], :status => \"invitee\").first\n role = user.roles.first\n if current_user\n role.user_id = current_user.id\n role.join_...
[ "0.64857167", "0.59643155", "0.59431946", "0.5797829", "0.5788901", "0.5696062", "0.5667351", "0.563272", "0.55762", "0.5535458", "0.5522331", "0.55185026", "0.5503112", "0.550089", "0.5489815", "0.54843533", "0.5478842", "0.54710406", "0.5464877", "0.5463294", "0.5452236", ...
0.6742016
0
DELETE /join_user_to_assistants/1 DELETE /join_user_to_assistants/1.json
def destroy @join_user_to_assistant.destroy respond_to do |format| format.html { redirect_to join_user_to_assistants_url, notice: 'Join user to assistant was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @assist = Assist.find(params[:id])\n @assist.destroy\n\n respond_to do |format|\n format.html { redirect_to assists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @guidances_user.destroy\n respond_to do |format|\n format.html { redirect_to gu...
[ "0.66305023", "0.65866286", "0.65855944", "0.6518632", "0.64724064", "0.64334816", "0.64238405", "0.6421914", "0.6395352", "0.6389911", "0.6377326", "0.63713765", "0.6355604", "0.6353042", "0.6338573", "0.6330434", "0.63176066", "0.6313337", "0.63094944", "0.63054067", "0.629...
0.7291304
0
Use callbacks to share common setup or constraints between actions.
def set_join_user_to_assistant @join_user_to_assistant = JoinUserToAssistant.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 join_user_to_assistant_params params.require(:join_user_to_assistant).permit(:cpfk_user_id, :cpfk_assistant_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.69780594", "0.678054", "0.6742781", "0.67387927", "0.67346025", "0.6590683", "0.6501642", "0.6495788", "0.6479752", "0.64763314", "0.645457", "0.6437739", "0.6377168", "0.6372484", "0.6363871", "0.63179374", "0.62981373", "0.6297456", "0.62916917", "0.6290227", "0.628954",...
0.0
-1
Prevent sentitive data from being accidentally logged to console
def inspect to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suppress; @write = false end", "def autoflush_log; end", "def autoflush_log; end", "def logged?; false end", "def logged?; false end", "def silence!\n IO.console.raw!\n end", "def log\r\n false\r\n end", "def log_without_running\n log\n end", "def log; end", "def log; ...
[ "0.6903036", "0.66703516", "0.66703516", "0.66479856", "0.66479856", "0.6392523", "0.6382992", "0.62872", "0.6256819", "0.6256819", "0.6256819", "0.6256819", "0.6256819", "0.6256819", "0.6256819", "0.6256819", "0.624584", "0.6227292", "0.61632216", "0.61414635", "0.61414635",...
0.0
-1