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
Formats a CarbonDate::Date with billion_years precision Returns: A humanreadable string representing the Date
def billion_years(date) coarse_precision(date.year, 1e9.to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ten_million_years(date)\n coarse_precision(date.year, 10e6.to_i)\n end", "def born_date\n super.to_s(:long)\n end", "def hundred_million_years(date)\n coarse_precision(date.year, 100e6.to_i)\n end", "def million_years(date)\n coarse_precision(date.year, 1e6.to_i)\n end", "de...
[ "0.62779206", "0.6269726", "0.6256434", "0.6193199", "0.6075388", "0.6039006", "0.59714353", "0.59678423", "0.5964613", "0.5924666", "0.58241886", "0.58034986", "0.5721897", "0.57174057", "0.5687389", "0.5676393", "0.5662646", "0.5645062", "0.5645062", "0.5620154", "0.5607685...
0.6634146
0
A helper function used to format dates that have less than millenium precision Params: +date_year+ The year component of the CarbonDate::Date being formatted +interval+ The precision in years Returns: A humanreadable string representing the Date
def coarse_precision(date_year, interval) date_year = date_year.to_i interval = interval.to_i year_diff = date_year - ::Date.today.year return "Within the last #{number_with_delimiter(interval)} years" if (-(interval - 1)..0).include? year_diff return "Within the next #{number_with_delim...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_year(year)\n \"#{year}-#{year+1}\"\n end", "def year_display_str(date_el_array)\n result = date_parsing_result(date_el_array, :date_str_for_display)\n return result if result\n\n _ignore, orig_str_to_parse = self.class.earliest_year_str(date_el_array)\n DateParsing....
[ "0.6280327", "0.6059551", "0.5932191", "0.5856547", "0.58483297", "0.5831654", "0.5743017", "0.57356036", "0.5716297", "0.5713683", "0.5687473", "0.5682759", "0.5666735", "0.56667316", "0.56667316", "0.56612724", "0.56084424", "0.5565997", "0.5554113", "0.5546421", "0.5546087...
0.72255886
0
Converts an integer number into a humanreadable string with thousands delimiters. Example: number_with_delimiter(1234567890, ',') => 1,234,567,890 Params: +n+ the number to be delimited. Will be converted to an integer +delim+ the string to be used as the thousands delimiter. Defaults to ','
def number_with_delimiter(n, delim = ',') n.to_i.to_s.reverse.chars.each_slice(3).map(&:join).join(delim).reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number_with_delimiter(number, delimiter=\",\", separator=\".\")\n begin\n parts = number.to_s.split('.')\n parts[0].gsub!(/(\\d)(?=(\\d\\d\\d)+(?!\\d))/, \"\\\\1#{delimiter}\")\n parts.join separator\n rescue\n number\n end\n end", "def number_with_delimiter(number, delimiter=',...
[ "0.7326732", "0.72563124", "0.7165631", "0.69503784", "0.6702533", "0.6702533", "0.65833974", "0.65534914", "0.65467596", "0.65204567", "0.63578504", "0.6355236", "0.62852895", "0.6274327", "0.62351584", "0.6188494", "0.6182683", "0.6159662", "0.61479753", "0.6138624", "0.613...
0.79559654
0
Pad a string with '0' to ensure it has two characters. If a string of 2 or more characters is used as parameter, will not alter the string. Example: pad('1') => "01" Params: +s+ The string to pad. Returns: A string of at least 2 characters
def pad(s) s.rjust(2, '0') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pad(s)\n s.to_s.rjust(3,\"0\")\nend", "def pad_string(s)\n # s = s[0..80]\n b = s.bytes\n b << 0\n b << 0 while b.size % 4 > 0\n b.pack(\"c*\")\n end", "def pad(p=0, s=0, c=0, from=g_from_direction)\n prefix(p, c, from) unless p.zero?\n suffix(s, c, from) unless s.zero?\n end"...
[ "0.73824114", "0.67277753", "0.65294373", "0.6359395", "0.63288176", "0.62704307", "0.6252459", "0.62415195", "0.6169826", "0.6131705", "0.61214495", "0.61131394", "0.6092477", "0.6088558", "0.60070175", "0.5998051", "0.5961358", "0.59270835", "0.5920687", "0.59139615", "0.58...
0.80405915
0
Carry out static testing on the code below. Read through the code. Comment any errors you can see without correcting them. def func1 val if val = 1 should be == return true else return false end end dif max a b should be def, not dif : should be a , between parameters if a > b return a else b end end end one too many e...
def func1 val if val = 1 #should be == return true #needs an indent else return false#needs an indent end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test\n\n puts \"Performing test tasks:\"\n\n puts \"Test 1 \" + (generate_intcode([1, 0, 0, 0, 99]) === [2, 0, 0, 0, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 2 \" + (generate_intcode([2, 3, 0, 3, 99]) === [2, 3, 0, 6, 99] ? \"succeeded\": \"failed\") + \"!\"\n puts \"Test 3 \" + (generate_int...
[ "0.6729847", "0.6594663", "0.65522534", "0.6532254", "0.6532254", "0.6404845", "0.6273686", "0.6273686", "0.6273686", "0.60651094", "0.58850956", "0.58219326", "0.58219326", "0.5820772", "0.5806792", "0.5806693", "0.5766599", "0.5756864", "0.5718025", "0.5716829", "0.56990564...
0.0
-1
one too many 'end'
def looper for i in 1..10 puts i #needs an indent end # needs to return the final result of the loop to fulfil the test. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def end; end", "def end; end", "def end; end", "def end() end", "def _end!; end", "def end_point; end", "def end\n end", "def end\n end", "def end\n end", "def at_end; end", "def end_pos; end", "def end_pos; end", "def exclude_end?() end", "def end(p0) end", "def main_end ; ...
[ "0.73886913", "0.73886913", "0.73886913", "0.7337829", "0.7031426", "0.6915463", "0.6901355", "0.6811325", "0.6811325", "0.6797141", "0.6766308", "0.6766308", "0.6735132", "0.67226917", "0.67000717", "0.6648142", "0.6526664", "0.6526664", "0.6526664", "0.6523811", "0.65078634...
0.0
-1
NB: supplied by enum scope :basic scope :moderator scope :admin
def name "#{first_name.strip} #{last_name.strip}".strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def permissions = {}", "def index\n @moderations = @course.moderations.all\n authorize Moderation\n end", "def admin_status\n if self.user_admin\n if self.user_admin.level == 1\n return \"Contributor\"\n elsif self.user_admin.level == 2\n return \"Administrator\"\n elsif ...
[ "0.603844", "0.60086983", "0.5978943", "0.59244776", "0.58998626", "0.588817", "0.58838844", "0.5875513", "0.5869507", "0.5838373", "0.5838373", "0.583434", "0.5820915", "0.5808943", "0.58060676", "0.58038723", "0.58038723", "0.57948697", "0.5754242", "0.574636", "0.5734701",...
0.0
-1
=begin def won?(board) xs = [] os = [] board.each do |position| if board[position] == "X" xs << position elsif board[position] == "O" os << position end end end =end
def won?(board) win_combination = [] WIN_COMBINATIONS.each do |line| if line.all? { |pos| board[pos] == "X" } win_combination = line end if line.all? { |pos| board[pos] == "O" } win_combination = line end end if win_combination != [] win_combination else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner(board)\r\n #return token x or o that won the game\r\n \r\n if ( won?(board) )\r\n position_array = []\r\n (won?(board)).each do |element|\r\n position_array << board[element]\r\n end\r\n choice_X = position_array.all? do|element|\r\n element == \"X\"\r\n end\r\n if (choi...
[ "0.85926086", "0.8454342", "0.8345333", "0.83436817", "0.83436817", "0.828746", "0.8274003", "0.8226527", "0.8225868", "0.82063174", "0.82012546", "0.82012546", "0.81948066", "0.8183431", "0.8172323", "0.816214", "0.8160101", "0.81568503", "0.8137166", "0.81353813", "0.813227...
0.79903084
49
diff a +Roomorama::Diff+ object On initialization the +validate!+ method of the diff is called therefore, an operation cannot be built unless the property given is conformant to the basic validations performed on that class.
def initialize(diff) @property_diff = diff property_diff.validate! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def diff=(o); end", "def validations_for_diff\n []\n end", "def set_diff\n @diff = Diff.find(params[:id])\n end", "def diff(other)\n Distance.diff_total(self, other, true)\n end", "def set_diff\n @diff = Diff.find(params[:id])\n end", "def create\n @diff = Diff.new(diff...
[ "0.5888004", "0.579868", "0.5742015", "0.5716486", "0.5702969", "0.5677127", "0.5677127", "0.5672885", "0.56115377", "0.5599995", "0.55511904", "0.54775083", "0.54403776", "0.539374", "0.5368911", "0.5368604", "0.53400016", "0.53202206", "0.53082556", "0.5255844", "0.521863",...
0.78430396
0
Helpers / Methods used in other actions
def current_user if session[:current_user_id] @current_user ||= User.find(session[:current_user_id]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def actions; end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def helpers; end", "def helpers; end", "def helpers; end", "def action_hook; end", "def action args = {}\n\t\tend", "def lookup_action; end", "def action\n end", "def acti...
[ "0.7130285", "0.6954717", "0.6954717", "0.6954717", "0.6954717", "0.6954717", "0.6764997", "0.6764997", "0.6764997", "0.6710499", "0.6671329", "0.6482468", "0.6465909", "0.6358732", "0.63319266", "0.63175964", "0.63175964", "0.63175964", "0.62950355", "0.62941855", "0.6292105...
0.0
-1
will move an element in one direction. will do nothing if the square is not open.
def move(cell, direction) return unless cell.contents target = look(cell, direction) if target.open? target.contents = cell.contents cell.contents = nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move\n return unless placed?\n # no need to use a loop since the length is only 2\n new_x = @pos_x + @direction[:x]\n new_y = @pos_y + @direction[:y]\n\n return unless valid_position?(new_x, new_y)\n set_position(new_x, new_y)\n end", "def move_west\n @x -= 1\n end", "d...
[ "0.7189829", "0.7043522", "0.70141757", "0.69395417", "0.6904383", "0.6904383", "0.68614054", "0.6852561", "0.6852561", "0.6840791", "0.68325526", "0.68153256", "0.6808262", "0.67724425", "0.6761426", "0.6752897", "0.67108047", "0.6705584", "0.6634333", "0.6581305", "0.658075...
0.64437324
41
start server, when data received it pushed to queue
def run (queue) loop do @LOG.debug "waiting on #{@port_num}" Thread.start(@server.accept) do |client| addr = client.addr addr.shift # removes "AF_INET" @LOG.info("accept connection addr: #{addr.join(":")}") peer_addr = client.peeraddr peer_addr.shift # removes "...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start\n # subscribe is like a callback\n @server_queue.subscribe(block: @block) do |delivery_info, properties, payload|\n consume(delivery_info, properties, payload)\n end\n end", "def run\n @connection.queue do |queue|\n puts(\"Server started. Broadcasting to queue: “#{queue.name}...
[ "0.7599562", "0.73800045", "0.7235019", "0.72137785", "0.71722174", "0.7051511", "0.7006254", "0.69239086", "0.6809442", "0.6805284", "0.6781217", "0.6776131", "0.67333055", "0.67168164", "0.6701319", "0.6700658", "0.6697984", "0.668121", "0.668121", "0.66726387", "0.66317666...
0.7187638
4
Asynchronously upgrade an environment
def async_upgrade(environment, plugin, options = {}) job = Job.new(:upgrade) async(:upgrade, job, environment, plugin, options) job.ticket end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade\n project.run \"apk upgrade\"\n end", "def sync_gem_environments\n resync = []\n environments.each do |name|\n env = environment(name)\n if env.has_gems? \n resync << name\n env.sync\n env.save\n end\n end\n resyn...
[ "0.5700588", "0.57000464", "0.5667662", "0.558769", "0.5553724", "0.55006737", "0.5499875", "0.5497845", "0.5472101", "0.5423413", "0.5419721", "0.5418028", "0.537472", "0.5369072", "0.5360261", "0.5308547", "0.5270156", "0.5191247", "0.51744026", "0.51669115", "0.51506543", ...
0.68890375
0
Synchronously upgrade an environment
def upgrade(job, environment, plugin, options = {}) worker = Worker.new(job, environment.freeze, plugin.freeze, options.freeze) worker.run ensure worker.terminate if worker && worker.alive? job.terminate if job && job.alive? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def async_upgrade(environment, plugin, options = {})\n job = Job.new(:upgrade)\n\n async(:upgrade, job, environment, plugin, options)\n\n job.ticket\n end", "def sync_gem_environments\n resync = []\n environments.each do |name|\n env = environment(name)\n if env....
[ "0.61047447", "0.60789025", "0.60721666", "0.5880113", "0.58174473", "0.58148444", "0.57299036", "0.56761396", "0.56761396", "0.5537906", "0.55287504", "0.5527607", "0.55258554", "0.5523668", "0.5511452", "0.5483043", "0.5467233", "0.5448819", "0.54292864", "0.5388834", "0.53...
0.5295485
25
other_blank = Array.new num = Array(1..10) p num letters = Array('a'..'z') puts letters
def some_array_methods teachers = ['James', 'Jim', 'Adriana'] # p teachers.first # p teachers.last # p teachers.sample # reverse_teachers = teachers.reverse # teachers.delete_at(0) # p teachers.index('aldskjflskdjf') teachers.insert(0 , 'Angie') # p teachers.count do |name| # name == 'Jim' # end...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def array\n \t(1..size).map{ |i| \"#{fill}\" }\n end", "def array_print_10\n array = []\n array = \"0\".upto(\"9\").to_a\n array.each do |x|\n puts x\n end\nend", "def letter_array (name)\n\tname.chars\nend", "def show_blanks\n\t\t@result_array = \"_\"*@word_array.length\n\t\tputs @result_array\n\te...
[ "0.67710537", "0.6764101", "0.64956707", "0.64810294", "0.64810294", "0.64646775", "0.644215", "0.63635486", "0.63495564", "0.62783855", "0.61448395", "0.61351824", "0.6131533", "0.61181843", "0.6113717", "0.6097159", "0.60707396", "0.6045975", "0.60433096", "0.6042731", "0.6...
0.0
-1
Does the actual HTTP level interaction.
def request(post_body, headers) request = Net::HTTP::Post.new(endpoint_uri.path, headers) authenticate(request) if username request.body = post_body response = @client.request(request) { status: response.code.to_i, body: response.body, content_type: response.content_type } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http; end", "def process_http_request\n # the http request details are available via the following instance variables:\n # @http_protocol\n # @http_request_method\n # @http_cookie\n # @http_if_none_match\n # @http_content_type\n # @http_path_info\n...
[ "0.7098088", "0.69166136", "0.67771244", "0.6718485", "0.6660947", "0.66214466", "0.64833695", "0.64720815", "0.6429008", "0.63898075", "0.63898075", "0.63898075", "0.63898075", "0.63898075", "0.63898075", "0.63898075", "0.63898075", "0.63898075", "0.63898075", "0.63898075", ...
0.0
-1
create a new db if needed and connect to it db file is named procname.db
def connect(processName) @procName = processName @db_name = processName + ".db" # create the new db if it doesn't exist if(!File.exists?(@db_name)) create_db end @db = SQLite3::Database.open(@db_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def db_setup\n log_debug\n db_file = find_db\n db_tmp = '/tmp/plex_missing_tmp.db'\n @db = ''\n \n # cp to tmp as the db is locked if being used\n `cp \"#{db_file}\" #{db_tmp}`\n \n # not too sure why but i was having a problem where a 0 byte file was cp'd\n # def a local issue i a...
[ "0.73275596", "0.7162998", "0.71568614", "0.70539486", "0.7011821", "0.68559784", "0.68365496", "0.68266004", "0.6735692", "0.67164546", "0.67127913", "0.669797", "0.6668326", "0.66460973", "0.6619451", "0.6619274", "0.6617997", "0.66170704", "0.6579083", "0.65660304", "0.650...
0.7631058
0
Define an inline mapper for the embedded resources
def mapper(&block) syncer = HALSyncer.new syncer.instance_exec(&block) mapper = syncer.to_mapper @mapper = Mappers::ArrayMapper.new(mapper) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_mapping(resource, options); end", "def map(&block)\n resources.map(*args, &block)\n end", "def to_resource(mapper)\n Resource::Form::Field.new(\n resource_attributes.each_with_object({}) do |attr, attrs|\n attrs[attr] = mapper.expand_value(public_send(attr))\n ...
[ "0.6798828", "0.6326486", "0.6311076", "0.6039028", "0.5744177", "0.5744177", "0.5724731", "0.5688071", "0.55396974", "0.55255574", "0.5437613", "0.5374058", "0.53535026", "0.53463423", "0.5342611", "0.5337548", "0.5323412", "0.5312719", "0.5302005", "0.52952915", "0.52569455...
0.51111454
35
GET /raw_foods GET /raw_foods.json
def index if params[:ordering_method].present? @ordering_method_id = OrderingMethod.find_by(name: params[:ordering_method]).id @raw_foods = RawFood.joins(:booking_methods).where(booking_methods: {ordering_method_id: @ordering_method_id}) @search_raw_foods = RawFood.ransack(params[:q]) elsif params[...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recipes # /v1/user/:id/recipes (GET)\n recipes = ::Recipe.all\n render json: recipes, :each_serializer => RecipeSmallSerializer, root: false, status: 200\n end", "def index\n @recipes_foods = RecipesFood.all\n end", "def index\n info = Aws.get_recipes_from_db\n render :json => info\n...
[ "0.6102828", "0.6073179", "0.6066163", "0.6046955", "0.60209143", "0.5993838", "0.59853595", "0.59044284", "0.58988947", "0.5885538", "0.5860099", "0.58509797", "0.5846837", "0.58295476", "0.5821436", "0.5818018", "0.5809477", "0.57992476", "0.57975304", "0.5795081", "0.57936...
0.0
-1
GET /raw_foods/1 GET /raw_foods/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def show\n @data = @recipe.read(params[:id])\n render json: @data\n end", "def show\n @food_recipe = FoodRecipe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json...
[ "0.6206109", "0.6187155", "0.617324", "0.61045915", "0.6079559", "0.60547745", "0.60542583", "0.6038859", "0.6030761", "0.6027731", "0.6018408", "0.6017089", "0.5996283", "0.59912103", "0.5987212", "0.59770024", "0.59596664", "0.59274936", "0.58990127", "0.58911735", "0.58888...
0.0
-1
POST /raw_foods POST /raw_foods.json
def create @raw_food = current_merchant.raw_foods.new(raw_food_params) respond_to do |format| if @raw_food.save format.html { redirect_to @raw_food, notice: 'Raw food was successfully created.' } format.json { render :show, status: :created, location: @raw_food } else format...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def raw_food_params\n params.require(:raw_food).permit(:logo, :brand_name, :general_contact_number, :general_email, :website_online_ordering_page, :facebook_page, :instagram_handl...
[ "0.5834344", "0.56350017", "0.5504638", "0.5488984", "0.5409885", "0.5323871", "0.5315756", "0.5282409", "0.5252079", "0.51908445", "0.516067", "0.51442134", "0.51230174", "0.5121342", "0.50928193", "0.5090981", "0.5085941", "0.5080582", "0.5047763", "0.5043355", "0.5017928",...
0.641323
0
PATCH/PUT /raw_foods/1 PATCH/PUT /raw_foods/1.json
def update respond_to do |format| if @raw_food.update(raw_food_params) format.html { redirect_to @raw_food, notice: 'Raw food was successfully updated.' } format.json { render :show, status: :ok, location: @raw_food } else format.html { render :edit } format.json { render...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n json_response(@food_item.update!(food_item_params))\n end", "def update\n recipe.update(recipe_params)\n render json: recipe\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if ...
[ "0.6269646", "0.6135182", "0.6102308", "0.60302705", "0.6026093", "0.6010721", "0.5987157", "0.58914167", "0.58581334", "0.58580786", "0.58523566", "0.5844323", "0.5838271", "0.58190477", "0.5804856", "0.57876974", "0.5785911", "0.5782582", "0.5778885", "0.577814", "0.5761568...
0.59445083
7
DELETE /raw_foods/1 DELETE /raw_foods/1.json
def destroy @raw_food.destroy respond_to do |format| format.html { redirect_to raw_foods_url, notice: 'Raw food was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.6853021", "0.6853021", "0.68415916", "0.67407715", "0.6728383", "0.66623205", "0.66603744", "0.6655749", "0.65936875", "0.6577978", "0.65777415", "0.6572667", "0.65724736", "0.65669763", "0.65552306", "0.6555091", "0.6550582", "0.65429556", "0.653768", "0.6510496", "0.6510...
0.71584624
0
Use callbacks to share common setup or constraints between actions.
def set_raw_food @raw_food = RawFood.friendly.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 raw_food_params params.require(:raw_food).permit(:logo, :brand_name, :general_contact_number, :general_email, :website_online_ordering_page, :facebook_page, :instagram_handle, :featured_image, :self_collection_address, :question_1, :expiry_date, :halal_expiry, :draft, :verified, :merchant_id, :listing_id, :pr...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Clears the content on the terminal.
def clear_screen print "\e[2J" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear\n Vedeu::Terminal.clear\n end", "def clear\n writeln(\"clear\")\n end", "def clear\n say \"\\e[2J\\e[H\"\n end", "def clear\n $stdout.print \"\\n\"\n $stdout.flush\n end", "def clear; puts \"\\e[2J\" end", "def clear_screen\n output(Esc.string('clear'...
[ "0.8359948", "0.8284612", "0.81729245", "0.8137704", "0.80802065", "0.8023881", "0.790318", "0.78844434", "0.7856834", "0.7841468", "0.7751501", "0.77504057", "0.77225745", "0.7680787", "0.7658171", "0.7630129", "0.7626044", "0.757768", "0.7562108", "0.75187033", "0.75185066"...
0.72979015
45
Moves the insert point in the terminal to the upper left.
def move_to_home print "\e[H" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def undo_move(move)\n self.cells[move.to_i - 1] = \" \"\n end", "def winsertln\n Ncurses.winsertln(pointer)\n end", "def move_to(x, y); puts \"\\e[#{y};#{x}G\" end", "def move_left\n # @dx = -8\n @x -= 8\n end", "def insert_segment_below()\n if @handle.ptr == nil\n ...
[ "0.62482226", "0.6220207", "0.61496633", "0.61180115", "0.60645413", "0.6051825", "0.6044276", "0.60351044", "0.5999422", "0.5970508", "0.59461266", "0.5942571", "0.5930691", "0.5925796", "0.59088063", "0.58950347", "0.5892893", "0.5890113", "0.5880026", "0.5880026", "0.58703...
0.0
-1
Downloads file to local directory
def download_s3_file run_callbacks :download_s3_file do @s3_local_object = download(@directory, @key) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download_file\n info(\"Downloading file \" + @filename + \" started.\")\n \n open(local_file, 'wb') do |file|\n file << open(remote_file).read\n end\n\n info(\"Downloading file \" + @filename + \" completed successfully.\")\n rescue StandardError => e\n error(\"Unable to download file #...
[ "0.78321725", "0.77712536", "0.7633965", "0.7514661", "0.74702036", "0.7461339", "0.7458432", "0.7415958", "0.73507667", "0.7324215", "0.7223812", "0.7194163", "0.7183809", "0.7172112", "0.71469283", "0.7141993", "0.7111587", "0.710493", "0.70385844", "0.7033032", "0.7031481"...
0.0
-1
Deletes the downloaded file
def clean_local_file File.delete(@file_path) if File.exist? @file_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n ::File.unlink(@path)\n end", "def del\n File.delete(@file)\n end", "def delete!\n safe_close\n File.delete(@file_path)\n end", "def delete_file\n File.unlink file\n end", "def delete_file\n File.unlink file\n end", "def delete(filename); end", ...
[ "0.769393", "0.7683738", "0.7631318", "0.7604688", "0.7604688", "0.75804925", "0.7571996", "0.7511983", "0.74589753", "0.7448586", "0.7414083", "0.74071664", "0.7403581", "0.7401358", "0.7401358", "0.73304623", "0.7283587", "0.7270029", "0.7270029", "0.72592586", "0.72437745"...
0.0
-1
Sets the local path of the s3 downloaded object file
def set_path @file_path = @s3_local_object.body.path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pull_from_s3\n FileUtils.mkdir_p File.dirname local_path\n file = open(local_path, \"wb\") {|f| f << open(s3_url(:orig=>true)).read }\n end", "def download_s3_file\n run_callbacks :download_s3_file do\n @s3_local_object = download(@directory, @key)\n end\n end", "def setup_file_p...
[ "0.71206", "0.7113829", "0.69821626", "0.6779674", "0.6777625", "0.65644497", "0.6512893", "0.6484955", "0.6462759", "0.6286961", "0.6222474", "0.62119514", "0.6195475", "0.61765605", "0.61729413", "0.6168541", "0.61659765", "0.6162605", "0.61619717", "0.6139611", "0.611468",...
0.8764995
0
Creates directory for downloading the file to
def provision_directory Dir.mkdir(@directory) unless Dir.exists?(@directory) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_directory\n FileUtils.mkdir_p output_directory unless File.exist? output_directory\n end", "def create_dir path\n sftp.mkdir! path\n end", "def make_file_dir(folder, path=\"public/temp/#{@current_user.user_name}\")\n @file_dir= \"#{path}/#{folder}\"\n FileUtils.mkdir_p(\"#{@f...
[ "0.7344339", "0.7090044", "0.70176315", "0.7009148", "0.7009148", "0.69782895", "0.6887349", "0.6885262", "0.68646556", "0.6845633", "0.68074155", "0.6789333", "0.67712027", "0.6760689", "0.6737601", "0.6716044", "0.6715127", "0.67087954", "0.6692436", "0.66458535", "0.664047...
0.0
-1
Render and deliver the chart
def getchart() # The XYZ points for the bubble chart dataX0 = [170, 300, 1000, 1700] dataY0 = [16, 69, 16, 75] dataZ0 = [52, 105, 88, 140] dataX1 = [500, 1000, 1300] dataY1 = [40, 58, 85] dataZ1 = [140, 202, 84] # Create a XYChart object of size 540 x 48...
{ "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.655061
36
GET /train_locomotives GET /train_locomotives.json
def index @train_locomotives = TrainLocomotive.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_train_locomotive\n @train_locomotive = TrainLocomotive.find(params[:id])\n end", "def index\n @lovs = Lov.all\n end", "def train_locomotive_params\n params.require(:train_locomotive).permit(:operator_id, :locomotive_class_name, :locomotive_class_number, :make_id, :locomotive_type_id, :...
[ "0.6873654", "0.6431473", "0.6411481", "0.6360179", "0.6149085", "0.6086077", "0.6008904", "0.58638084", "0.5842019", "0.57886094", "0.5773354", "0.5773354", "0.5773354", "0.5725371", "0.57190377", "0.57012564", "0.56764406", "0.5670292", "0.564198", "0.5622961", "0.56053895"...
0.7539062
0
GET /train_locomotives/1 GET /train_locomotives/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @train_locomotives = TrainLocomotive.all\n end", "def set_train_locomotive\n @train_locomotive = TrainLocomotive.find(params[:id])\n end", "def create\n @train_locomotive = TrainLocomotive.new(train_locomotive_params)\n\n respond_to do |format|\n if @train_locomotive.save\n ...
[ "0.7254195", "0.6970627", "0.628692", "0.62204504", "0.6132865", "0.59856725", "0.59009105", "0.57601684", "0.5720219", "0.56837976", "0.56837976", "0.56837976", "0.56652904", "0.566071", "0.5658275", "0.56497526", "0.5634683", "0.5609373", "0.5605274", "0.5602404", "0.559743...
0.0
-1
POST /train_locomotives POST /train_locomotives.json
def create @train_locomotive = TrainLocomotive.new(train_locomotive_params) respond_to do |format| if @train_locomotive.save format.html { redirect_to @train_locomotive, notice: 'Train locomotive was successfully created.' } format.json { render action: 'show', status: :created, location:...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def train_locomotive_params\n params.require(:train_locomotive).permit(:operator_id, :locomotive_class_name, :locomotive_class_number, :make_id, :locomotive_type_id, :box_number, :owner_id, :price, :decoder_id, :decoder_address, :picture, :delete_image)\n end", "def set_train_locomotive\n @train_loc...
[ "0.73694175", "0.6655743", "0.6409231", "0.6277444", "0.5920519", "0.58733624", "0.5848118", "0.5694255", "0.5684281", "0.56644297", "0.56611776", "0.5643515", "0.56361026", "0.5604862", "0.5596765", "0.5580859", "0.55543876", "0.5537083", "0.5474386", "0.54426485", "0.544048...
0.7266716
1
PATCH/PUT /train_locomotives/1 PATCH/PUT /train_locomotives/1.json
def update respond_to do |format| if @train_locomotive.update(train_locomotive_params) format.html { redirect_to @train_locomotive, notice: 'Train locomotive was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.js...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_train_locomotive\n @train_locomotive = TrainLocomotive.find(params[:id])\n end", "def update\n respond_to do |format|\n if @train.update(train_params)\n format.html { redirect_to @train, notice: 'Train was successfully updated.' }\n format.json { head :no_content }\n el...
[ "0.6536184", "0.6357123", "0.618267", "0.60848886", "0.59190786", "0.58316636", "0.578761", "0.5693497", "0.56687945", "0.564483", "0.5623751", "0.5618357", "0.5604889", "0.55923617", "0.55620104", "0.5559002", "0.5546083", "0.55364674", "0.5530723", "0.5515432", "0.54840666"...
0.7199848
0
DELETE /train_locomotives/1 DELETE /train_locomotives/1.json
def destroy @train_locomotive.destroy respond_to do |format| format.html { redirect_to train_locomotives_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @train.destroy\n respond_to do |format|\n format.html { redirect_to trains_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trainmodel.destroy\n respond_to do |format|\n format.html { redirect_to trainmodels_url, notice: 'Trainmodel was successfu...
[ "0.7041086", "0.6773462", "0.67307425", "0.65346986", "0.652068", "0.6480476", "0.64546114", "0.64508146", "0.6449621", "0.64413637", "0.6400375", "0.6396486", "0.63844264", "0.63705254", "0.6368457", "0.63485277", "0.63458973", "0.63179535", "0.6300191", "0.62915015", "0.628...
0.7771623
0
Use callbacks to share common setup or constraints between actions.
def set_train_locomotive @train_locomotive = TrainLocomotive.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 train_locomotive_params params.require(:train_locomotive).permit(:operator_id, :locomotive_class_name, :locomotive_class_number, :make_id, :locomotive_type_id, :box_number, :owner_id, :price, :decoder_id, :decoder_address, :picture, :delete_image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
sanity checkpoint for some methods, checking for existing countdown
def method_missing(method, *args) method = "_#{method}" # super secret shadow method # first check if method exists raise NoMethodError unless respond_to?(method) # check if specified countdown timer exists - reason for this method_missing insist_countdown_exists(*args) # finally run method ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countdown\n i = view_status\n if i == 1\n return self.start\n elsif i == 2\n return self.end\n end\n nil\n end", "def timer_checkpoints\n t = self.time_remaining\n if @timer_checkpoint_hash[30] < 3 && t <= 40\n @timer_checkp...
[ "0.6510178", "0.6322076", "0.6277634", "0.62722796", "0.62595224", "0.6195557", "0.6183818", "0.61551476", "0.61173564", "0.60478765", "0.60458106", "0.6045587", "0.6041269", "0.6006775", "0.60042506", "0.5982692", "0.5971898", "0.59332144", "0.59113073", "0.590749", "0.59000...
0.6280518
2
these methods all require a sanity check for existing countdown
def _countdown_abort(name = @@default_name) self[get_zero_key(name)] = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countDown\n # how many seconds left from 3 second countdown\n timeRemaining = 3 - (Time.now - curPauseTime).to_i\n # updates the countdown time string to render\n @countdownTime = timeRemaining.to_s\n @countdownTimeWidth = font.getWidth(countdownTime)\n # countdown is done\n if timeRemaini...
[ "0.69358623", "0.6861365", "0.68275356", "0.6781", "0.67202926", "0.66190976", "0.6618744", "0.6555036", "0.6509066", "0.6447609", "0.64395577", "0.6421112", "0.6391356", "0.6383833", "0.637979", "0.63741124", "0.62832797", "0.6275088", "0.6268035", "0.6242317", "0.6239234", ...
0.5719216
76
GET /renders GET /renders.json
def index @slug = params[:slug] @page = Page.where(:slug => @slug).includes(:page_component).first @components = Hash.new @page.page_component.each_with_index do |component, index| props_hash = Hash.new component.component_content.each_with_index do |prop, prop_index| props_hash.me...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def renders\n @_renders ||= {}\n end", "def get_render_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: RenderApi#get_render ...\"\n end\n \n # verify the required parameter 'id' is set\n fail \"Missing the re...
[ "0.65371275", "0.64774287", "0.64562863", "0.6390929", "0.635654", "0.63530034", "0.6314059", "0.6221889", "0.62100387", "0.620491", "0.6152918", "0.6137841", "0.6116287", "0.6108881", "0.60920453", "0.6078564", "0.60766464", "0.60678875", "0.6041831", "0.6027102", "0.6023683...
0.0
-1
Date: May 23, 2010 Time: 4:04:33 AM
def run_tests File.open "output_CC.txt", "w" do |output| File.open "C-small-practice.in" do |input| number_of_tests = input.gets.to_i number_of_tests.times do |test_number| test = input.gets.chomp.split /\s+/, 2 m = test[0].to_i n = test[1].to_i board = [] ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def FormatTimesDates\n\ttime = Time.new\n\tputs time.to_s\n\tputs time.ctime\n\tputs time.localtime\n\tputs time.strftime(\"%Y-%m-%d %H:%M:%S\")\n\tputs time.strftime(\"%d/%m/%Y\")\nend", "def detail_date( date )\n date.strftime( '%H:%M - %b %d, %Y')\n end", "def date; end", "def date; end", "def date;...
[ "0.6478149", "0.6454746", "0.6383002", "0.6383002", "0.6383002", "0.6383002", "0.63566524", "0.62891686", "0.62356013", "0.6136304", "0.61299574", "0.6124442", "0.61162955", "0.6115497", "0.6110439", "0.6103863", "0.60918355", "0.6090808", "0.6083229", "0.60692734", "0.606637...
0.0
-1
=== list Shows list of Workflows.
def list Log.add_info(request, params.inspect) @tmpl_folder, @tmpl_workflows_folder = TemplatesHelper.get_tmpl_subfolder(TemplatesHelper::TMPL_WORKFLOWS) my_wf_folder = WorkflowsHelper.get_my_wf_folder(@login_user.id) sql = WorkflowsHelper.get_list_sql(@login_user.id, my_wf_folder.id) @workflows ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @workflows = Workflow.all\n end", "def list_workflows\n perform(\"/registries/current/workflows?status=true&versions=true\", :get, content_type: :json)\n end", "def index\n @active_workflow_steps = ActiveWorkflowStep.all\n end", "def index\n @workflow_types = WorkflowType.a...
[ "0.7911187", "0.73713714", "0.70894897", "0.7035903", "0.7029", "0.69790167", "0.69790167", "0.6966519", "0.6957868", "0.65759414", "0.65173435", "0.646704", "0.646704", "0.63368285", "0.62941515", "0.6287932", "0.6248686", "0.62406117", "0.6227208", "0.6188371", "0.61869586"...
0.7583458
1
=== create Creates a Workflow Item in 'My Folder/$Workflows'.
def create Log.add_info(request, params.inspect) raise(RequestPostOnlyException) unless request.post? my_wf_folder = WorkflowsHelper.get_my_wf_folder(@login_user.id) tmpl_item = Item.find(params[:select_workflow]) item = tmpl_item.copy(@login_user.id, my_wf_folder.id) attrs = ActionControll...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n params[:workflow]['project_id'] = session[:project]\n @workflow = Workflow.new(params[:workflow])\n\n respond_to do |format|\n if @workflow.save\n flash[:notice] = 'Workflow was successfully created.'\n format.html { redirect_to(@workflow) }\n format.xml { render :x...
[ "0.7052993", "0.69674337", "0.69674337", "0.69674337", "0.69674337", "0.67945206", "0.6757799", "0.66946924", "0.66652304", "0.6494174", "0.6467244", "0.634644", "0.6294952", "0.6276438", "0.61853456", "0.61554503", "0.60976905", "0.603969", "0.5880176", "0.5860548", "0.58562...
0.6879383
5
=== destroy Destroys specified local template.
def destroy Log.add_info(request, params.inspect) raise(RequestPostOnlyException) unless request.post? workflow = Workflow.find(params[:id]) begin workflow.item.destroy rescue => evar Log.add_error(nil, evar) end my_wf_folder = WorkflowsHelper.get_my_wf_folder(@login_user.id)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n destroy_resource @template, templates_url, t('templates.delete_success')\n end", "def destroy\n @template.destroy\n end", "def destroy\n if @template.destroy\n respond_ok \"template\", @template\n else\n respond_err \"template\", @template, @template.errors\n end\n end...
[ "0.7769075", "0.77509815", "0.772174", "0.7510035", "0.7242697", "0.7232937", "0.7226018", "0.7215207", "0.720553", "0.71929616", "0.71929616", "0.71929616", "0.7151924", "0.71414536", "0.71254134", "0.71156627", "0.70989144", "0.7057851", "0.70512575", "0.7033664", "0.702313...
0.0
-1
=== move Moves Workflow to the specified Folder.
def move Log.add_info(request, params.inspect) raise(RequestPostOnlyException) unless request.post? unless params[:tree_node_id].nil? folder_id = params[:tree_node_id] SqlHelper.validate_token([folder_id]) workflow = Workflow.find(params[:id]) workflow.item.update_attribute(:fold...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_folder_ind\n create_process(process: \"MOVE_FOLDER\")\n end", "def move_to_folder=(value)\n @move_to_folder = value\n end", "def move_to_folder\n return @move_to_folder\n end", "def move\n Log.add_info(request, params.inspect)\n\n raise(R...
[ "0.69756305", "0.69457257", "0.6902316", "0.674207", "0.67033726", "0.668712", "0.6659796", "0.6640023", "0.660863", "0.6579934", "0.65643215", "0.654911", "0.64717376", "0.6439497", "0.6395395", "0.6313434", "0.62796766", "0.6197552", "0.6120866", "0.61008525", "0.60747707",...
0.73864174
0
=== check_owner Filter method to check if the current User is owner of the specified Workflow.
def check_owner return if params[:id].blank? or @login_user.nil? begin owner_id = Workflow.find(params[:id]).user_id rescue owner_id = -1 end if !@login_user.admin?(User::AUTH_WORKFLOW) and owner_id != @login_user.id Log.add_check(request, '[check_owner]'+request.to_s) flas...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owner? (user)\n user == owner\n end", "def is_owner?(this_user)\n user == this_user\n end", "def is_owner?(user)\n !user.nil? && (self.user_id == user.id)\n end", "def is_owner?(user)\n user.id == self.user_id\n end", "def is_owner\n object == current_user\n end", "def check_o...
[ "0.706881", "0.70162773", "0.6976861", "0.69431376", "0.6885486", "0.68266034", "0.6812583", "0.67592037", "0.67589796", "0.6750887", "0.6750887", "0.6728272", "0.67271197", "0.67206115", "0.6711435", "0.6706952", "0.66907084", "0.6682494", "0.66795677", "0.66601604", "0.6644...
0.8005436
0
Expected output: ['tea', 'water', 'soda water'] psuedo create my method going with are_you_in_here use select method to pull out items in array see how to use value to use includes method perhaps p my result with test arrays first snag .includes only returns true or false not sure how to get that to retrurn the array i...
def are_you_in_here letter, arr arr.select { |arr| arr.include?(letter) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containLetter(array, letter)\n # Iterate through the array of words\n # Use select to check if that letter is in the word\n selected_array = array.select { |value| value.include?(letter) }\n # Implicity return an array of words that contain that letter with the statement above\nend", "def spec_le...
[ "0.7152421", "0.6728156", "0.66312426", "0.6630551", "0.6612763", "0.6591329", "0.6573575", "0.65725553", "0.6512464", "0.65020436", "0.64821684", "0.6460714", "0.64529634", "0.64365506", "0.639186", "0.63915336", "0.6374461", "0.635798", "0.6351547", "0.63234234", "0.6316446...
0.6759249
1
API method should be derived from the class name. eg: Host => "host.get"
def api_method @_api_method ||= "#{method_from_class_name}.get" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method\n self.class.name.split('::').last || ''\n end", "def class_name method_name\n segments = method_name.split('::')\n return segments[0..-2].join('::') if segments.count > 1\n \"Object\"\nend", "def sanitize_api_class( controller )\n controller.name.split(\"::\").last\n ...
[ "0.6901805", "0.6729382", "0.6533643", "0.64508957", "0.6434392", "0.640022", "0.63625926", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62706524", "0.62278336", "0...
0.7395332
0
returns a single item
def find(value) key = \ if value.to_s =~ /^[0-9\.]*$/ default_search_param + "id" else default_search_param end where(key => value).first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def item\n @item ||= item_class.where(id: item_id).first if item_class\n end", "def item(id)\n Item.find(id)\n end", "def first_item\n items.first\n end", "def first\n @items.first\n end", "def get_single_item(item_id, payload = {})\n payload = payload.merge('ItemID' => ite...
[ "0.807031", "0.8000251", "0.77138287", "0.7709345", "0.7590318", "0.7431052", "0.7431052", "0.7380822", "0.73661894", "0.7305587", "0.7283863", "0.72504276", "0.7243551", "0.7192222", "0.7173931", "0.7156628", "0.71257156", "0.706315", "0.70436156", "0.7021621", "0.69864976",...
0.0
-1
GET /mt_manufacturings/1 GET /mt_manufacturings/1.xml
def show @mt_product = MtProduct.find(params[:id]) @product = @mt_product.product add_breadcrumb _("My products").html_safe, :products_url add_breadcrumb @mt_product.product.name, edit_product_url(@product) add_breadcrumb _("Environmental Assessment").html_safe, mt_production_init_path(@mt_product)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @mt_manufacturing = MtManufacturing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mt_manufacturing }\n end\n end", "def show\n @manufacturer_line = ManufacturerLine.find(params[:id])\n\n respond_to do |format|\n format.html # ...
[ "0.68529755", "0.62235135", "0.62174946", "0.61933935", "0.6171388", "0.6088808", "0.60660595", "0.59791726", "0.59476775", "0.5927604", "0.5915659", "0.5890816", "0.58623147", "0.58226407", "0.5819429", "0.5814041", "0.57995105", "0.57995105", "0.57923806", "0.5784295", "0.5...
0.0
-1
GET /mt_manufacturings/new GET /mt_manufacturings/new.xml
def new @mt_manufacturing = MtManufacturing.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @mt_manufacturing } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mt_manufacturing = MtManufacturing.new(params[:mt_manufacturing])\n\n respond_to do |format|\n if @mt_manufacturing.save\n format.html { redirect_to(@mt_manufacturing, :notice => 'Mt manufacturing was successfully created.') }\n format.xml { render :xml => @mt_manufacturing,...
[ "0.7324403", "0.7020698", "0.7000215", "0.6961111", "0.6942203", "0.6931576", "0.69245714", "0.69040763", "0.68989307", "0.68692374", "0.68227935", "0.6812638", "0.6789996", "0.6789502", "0.6781747", "0.6781747", "0.6781747", "0.67767364", "0.6772498", "0.6754028", "0.6742879...
0.7875078
0
POST /mt_manufacturings POST /mt_manufacturings.xml
def create @mt_manufacturing = MtManufacturing.new(params[:mt_manufacturing]) respond_to do |format| if @mt_manufacturing.save format.html { redirect_to(@mt_manufacturing, :notice => 'Mt manufacturing was successfully created.') } format.xml { render :xml => @mt_manufacturing, :status =>...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @mt_manufacturing = MtManufacturing.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @mt_manufacturing }\n end\n end", "def manufacturing_params\n params.fetch(:manufacturing, {}).permit(:code, :manufacturing_date, :product_id, :q...
[ "0.6243059", "0.5801658", "0.57229203", "0.56237304", "0.5608113", "0.56042343", "0.55512124", "0.54054254", "0.5387497", "0.53700304", "0.53185505", "0.52805436", "0.52801526", "0.52642375", "0.52593", "0.52543503", "0.52483827", "0.5245466", "0.5234892", "0.52237755", "0.51...
0.701045
0
PUT /mt_manufacturings/1 PUT /mt_manufacturings/1.xml
def update @mt_manufacturing = MtManufacturing.find(params[:id]) return_url = '' if params[:arrow] if params[:arrow] == 'next' return_url = mt_distribution_path(@mt_manufacturing.mt_product) end if params[:arrow] == 'previous' return_url = mt_raw_material_path(@...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_manufacturing\n @manufacturing = Manufacturing.find(params[:id])\n \n end", "def create\n @mt_manufacturing = MtManufacturing.new(params[:mt_manufacturing])\n\n respond_to do |format|\n if @mt_manufacturing.save\n format.html { redirect_to(@mt_manufacturin...
[ "0.6089919", "0.5983263", "0.59295326", "0.5895975", "0.5779716", "0.5732381", "0.5709892", "0.57053393", "0.56797874", "0.5637898", "0.5631896", "0.56283045", "0.56087583", "0.55946165", "0.55797243", "0.5531921", "0.55140656", "0.543775", "0.54250216", "0.5411286", "0.53989...
0.54821163
17
DELETE /mt_manufacturings/1 DELETE /mt_manufacturings/1.xml
def destroy @mt_manufacturing = MtManufacturing.find(params[:id]) @mt_manufacturing.destroy respond_to do |format| format.html { redirect_to(mt_manufacturings_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @manufacturer_line = ManufacturerLine.find(params[:id])\n @manufacturer_line.destroy\n\n respond_to do |format|\n format.html { redirect_to(manufacturer_lines_url) }\n format.xml { head...
[ "0.6890203", "0.6556167", "0.64369136", "0.63576245", "0.6337912", "0.6330838", "0.63070613", "0.6278583", "0.62609607", "0.6232366", "0.6207174", "0.620576", "0.6205208", "0.6204459", "0.619083", "0.61841786", "0.61829627", "0.61820513", "0.6179404", "0.6164728", "0.6160919"...
0.745034
0
return auth token once user is authenticated
def authenticate auth_token = AuthenticateUser.new(auth_params[:email], auth_params[:password]).call # kindly refactor and add more keys to the response object when needed response = { status: Message.success, data: { token: auth_token } } json_response(response, 20...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token\n authenticated\n end", "def auth_token\n return regenerate_auth_token if expired?\n\n authentication.auth_token\n end", "def auth_token\n @@auth_token\n end", "def auth_token\n @auth_token ||= ActionController::HttpAuthentication::Token.token_and_options...
[ "0.8565935", "0.80645263", "0.8033518", "0.79531187", "0.7941286", "0.7870694", "0.7866866", "0.78328985", "0.7800592", "0.77756053", "0.7730517", "0.77039945", "0.770132", "0.7682521", "0.76709354", "0.7640957", "0.76166993", "0.7575638", "0.75748223", "0.7572745", "0.755367...
0.0
-1
Returns a string of all the log output from the import. Or returns nothing if a custom logger was used.
def log @log_output.string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logger_output; end", "def log\n @output || []\n end", "def log\n @log ||= Logging.logger[File.basename($0)]\n end", "def output\n App.settings.log_output\n end", "def error_output\n where = Array.new\n where << 'below' if @logger.prints_errors\n where << 'with increased verbosity...
[ "0.6808813", "0.6136016", "0.59732157", "0.59679055", "0.58576655", "0.5819999", "0.5804947", "0.577453", "0.5722508", "0.5718833", "0.5688028", "0.5626797", "0.56227845", "0.56185174", "0.56185174", "0.56165624", "0.55849195", "0.55806226", "0.5565969", "0.5549522", "0.55282...
0.6786407
1
Add includes options which will be used when querying records. Useful to avoid N+1 type problems. Configured has_manys are automaticaly included and don't need to be specified here.
def includes(options) @includes = options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_includes(&block)\n if include_associations = options.delete(:include)\n base_only_or_except = { :except => options[:except],\n :only => options[:only] }\n\n include_has_options = include_associations.is_a?(Hash)\n associations = include_has...
[ "0.7109436", "0.7109436", "0.6859788", "0.6843337", "0.68427396", "0.68026507", "0.6795185", "0.6787254", "0.67393464", "0.6674961", "0.6658092", "0.66100204", "0.6592239", "0.65871704", "0.6539394", "0.65090835", "0.64750785", "0.64722246", "0.64481205", "0.6440471", "0.6378...
0.7436749
0
Add eager_load options which will be used when querying records.
def eager_load(options) @eager_load = options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def eager(*associations)\n opts = @opts[:eager]\n association_opts = eager_options_for_associations(associations)\n opts = opts ? Hash[opts].merge!(association_opts) : association_opts\n clone(:eager=>opts)\n end", "def eager_load_results(opts, eo, &block)\n op...
[ "0.7316349", "0.71250415", "0.7011839", "0.689377", "0.689377", "0.689377", "0.684639", "0.6749361", "0.66854", "0.6651473", "0.6651473", "0.6651473", "0.6651473", "0.66439027", "0.6615689", "0.6588866", "0.6545853", "0.64361507", "0.64246935", "0.63189435", "0.63061595", "...
0.8293553
0
Returns a unique identifier for this node
def node_id() @node_id ||= Config.slanger_id || SecureRandom.uuid end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def neo_node_id\n @internal_node.getId()\n end", "def id\n @node.id\n end", "def id\n @id ||= node.attr :tid\n end", "def generate_node_id\n # a little bit more creative\n if @registry.respond_to? :unique\n @registry.unique\n else\n digest = Digest...
[ "0.78998065", "0.78110117", "0.7805569", "0.75708795", "0.7539006", "0.7507768", "0.73733443", "0.7372559", "0.73653615", "0.730425", "0.7294966", "0.7197694", "0.71783954", "0.71783954", "0.713737", "0.71168625", "0.70981795", "0.7047158", "0.7045424", "0.7045424", "0.703944...
0.7704028
3
Process a cluster message
def process_message(message) # Extract fields from message begin data = JSON.parse message rescue JSON::ParserError Logger.error log_message("JSON Parse error on cluster message: '" + msg + "'") return end sender = data['sender'] return if sender == no...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_stanza(message)\n node = Nokogiri::XML(message[STANZA]).root rescue nil\n return unless node\n log.debug { \"Received cluster stanza: %s -> %s\\n%s\\n\" % [message[FROM], @cluster.id, node] }\n\n recources = @cluster.connected_resources(node[TO])\n if recources.empty?...
[ "0.668477", "0.6542275", "0.60334563", "0.60098904", "0.59353536", "0.5857898", "0.57631296", "0.5696706", "0.5690921", "0.56630033", "0.5610191", "0.5501912", "0.5491493", "0.5482179", "0.5474287", "0.5471767", "0.54225063", "0.54127574", "0.5386338", "0.5381757", "0.5380451...
0.7622374
0
The node_id of the current master
def master_id() @master_id ||= "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def master_node\n {:nodename => @master_nodename}\n end", "def flume_master_id\n flume_masters.find_index( ClusterChef::NodeUtils.private_ip_of( node ) )\n end", "def neo_node_id\n @internal_node.getId()\n end", "def ext_id id\n \"#{@master_node}|#{id}\"\n end", "def master_nid(nid)...
[ "0.800542", "0.7987816", "0.77484244", "0.7692792", "0.7689161", "0.7587133", "0.7584213", "0.75250876", "0.7519579", "0.7382893", "0.71400213", "0.7113706", "0.70939934", "0.70452034", "0.70216316", "0.70202845", "0.69715834", "0.6863264", "0.6851109", "0.6815256", "0.672765...
0.80219966
0
Sends a cluster message
def send_message(event, payload = nil, destination = nil) Redis.publish('slanger:cluster', {sender: node_id, destination: destination, event: event, payload: payload}.to_json) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_mess(mess)\n\t@client.puts(mess)\t\nend", "def route(stanza, node)\n log.debug { \"Sent cluster stanza: %s -> %s\\n%s\\n\" % [@cluster.id, node, stanza] }\n redis.publish(\"cluster:nodes:#{node}\", {\n from: @cluster.id,\n type: STANZA,\n stanza: stanza.to_s\n ...
[ "0.6175749", "0.60076463", "0.5997445", "0.5972619", "0.59325415", "0.59008354", "0.5856145", "0.5842123", "0.5840385", "0.58380795", "0.58019197", "0.5761676", "0.5759539", "0.5756291", "0.5732476", "0.5677439", "0.5661516", "0.564475", "0.5621653", "0.56207925", "0.5616041"...
0.63335854
0
The last time a "election victory" occured. Upon receiving a new election victory, if the last one is old we forget the old master If he's still around and still the highest key he'll send a fresh election victory anyway.
def master_last_seen_unix_timestamp() @master_last_seen_unix_timestamp ||= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_message_age\n return unless @mode == :max_age\n\n @history_mutex.synchronize do\n @history.each do |key|\n @history[key].delete_if{|entry| Time.now - entry.time > @max_age}\n end\n end\n end", "def last_checkin; end", "def update_lastlyUsed(chall)\n $game_temp.lbchll_las...
[ "0.5505666", "0.5441476", "0.5419344", "0.54145247", "0.53953594", "0.53839177", "0.5366166", "0.5363971", "0.5363971", "0.5355854", "0.5347706", "0.53130364", "0.5309644", "0.5309316", "0.5307484", "0.53068066", "0.5295403", "0.52938366", "0.5293259", "0.5285846", "0.5284312...
0.5707952
0
Master election messages, as described in
def send_enquiry() # Send election enquiry message. The master will reply if its node_id is greater than this node's send_message(:election_enquiry) # Wait for the master's response for a few seconds @master_response_timeout = EM::Timer.new(5) do # No response, asume we are the master ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_message(message)\n # Extract fields from message\n begin\n data = JSON.parse message\n rescue JSON::ParserError\n Logger.error log_message(\"JSON Parse error on cluster message: '\" + msg + \"'\")\n return \n end\n sender = data['sender']\n retu...
[ "0.640789", "0.5611028", "0.5611028", "0.55595225", "0.5550524", "0.5536341", "0.55021524", "0.55009073", "0.54608387", "0.5429329", "0.5360532", "0.5326926", "0.5307757", "0.5307757", "0.52955383", "0.5270941", "0.5233649", "0.5233649", "0.5233649", "0.52305675", "0.5151914"...
0.5457552
9
Reply to enquiry. Sent by the master if its key is greater than the enquirer's
def send_enquiry_reply(enquirer) send_message(:election_enquiry_reply, nil, enquirer) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_enquiry()\n # Send election enquiry message. The master will reply if its node_id is greater than this node's\n send_message(:election_enquiry)\n # Wait for the master's response for a few seconds\n @master_response_timeout = EM::Timer.new(5) do\n # No response, asume we are the...
[ "0.6780247", "0.61642396", "0.60089475", "0.5975008", "0.5964609", "0.5849009", "0.58025247", "0.574858", "0.574858", "0.5633289", "0.5633289", "0.56029093", "0.55762976", "0.5546961", "0.55153644", "0.55040205", "0.54820776", "0.5471102", "0.5471102", "0.54651105", "0.544822...
0.7220513
0
Victory message, sent by a node which believe it is the master. if another has a greater key, it will send a victory message in return. At the end the node with the greatest key will be the master
def send_victory() send_message(:election_victory) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pick_random_key\n satisfied = false\n keys = @@dynamo_nodes.map { |_k,v| v['hash_key']}.sort\n while !satisfied do\n generated_key = SecureRandom.random_number(ENV['DYNAMO_MAX_KEY'].to_i)\n collision = false\n keys.each do |key|\n if (key.to_i - generated_key).abs <= 100\n ...
[ "0.55812454", "0.5436373", "0.53083295", "0.5308235", "0.5295639", "0.52043873", "0.5133733", "0.5088186", "0.50850445", "0.50462794", "0.504278", "0.5034225", "0.5011499", "0.49593276", "0.493974", "0.493974", "0.49277312", "0.48786247", "0.48714232", "0.48714232", "0.486589...
0.52458435
5
Counterparty pays `amount` eth for some tokens
def buy(amount) ether = amount.to_f @ether_reserve += ether new_token_reserve = @konst / @ether_reserve tokens_bought = @token_reserve - new_token_reserve price = sprintf("%0.4f", ether / tokens_bought) log "You get #{tokens_bought} tokens for #{ether} ether, price #{price}" # this is where we...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activemerchant_amount\n (amount * 100).to_i\n end", "def buy(counterparty, amount)\n ether = amount.to_f\n tokens_bought, @ether_reserve, @token_reserve = trade(ether, @ether_reserve, @token_reserve)\n price = sprintf(\"%0.4f\", ether / tokens_bought)\n log \"#{counterparty.name} gets #{token...
[ "0.72216815", "0.68613243", "0.6836567", "0.68127555", "0.68014234", "0.676774", "0.66442186", "0.65993166", "0.63698995", "0.6355061", "0.6337102", "0.6317684", "0.6305919", "0.62956876", "0.6286983", "0.6255539", "0.62277126", "0.61957914", "0.6192802", "0.6175861", "0.6175...
0.6858055
2
Counterparty sells `amount` tokens for some eth
def sell(amount) tokens_sold = amount.to_f @token_reserve += tokens_sold new_ether_reserve = @konst / @token_reserve ether = @ether_reserve - new_ether_reserve price = sprintf("%0.4f", ether / tokens_sold) log "You get #{ether} ether for #{tokens_sold} tokens, price #{price}" # This is where w...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buy(amount)\n ether = amount.to_f\n\n @ether_reserve += ether\n new_token_reserve = @konst / @ether_reserve\n\n tokens_bought = @token_reserve - new_token_reserve\n price = sprintf(\"%0.4f\", ether / tokens_bought)\n log \"You get #{tokens_bought} tokens for #{ether} ether, price #{price}\" #...
[ "0.77640545", "0.7612286", "0.7566534", "0.6924881", "0.66707015", "0.6606152", "0.64538217", "0.6340684", "0.63370204", "0.63045245", "0.62785304", "0.61866736", "0.61866033", "0.61626756", "0.6133012", "0.61182386", "0.61151576", "0.6091296", "0.6087048", "0.6071513", "0.60...
0.7490833
3
domainName SOAP::SOAPString hostName SOAP::SOAPString recordType SOAP::SOAPString data SOAP::SOAPString ttl SOAP::SOAPInt priority SOAP::SOAPInt
def create_domain_record(domainName = nil, hostName = nil, recordType = nil, data = nil, ttl = 0, priority = 0) valid_ttls = [0, 1, 60, 300, 600, 900, 1800, 2700, 3600, 7200, 14400, 28800, 43200, 64800, 86400, 172800] raise "Ttl must be one of #{valid_ttls.join(',')}" if ttl && ! valid_ttls.include?(ttl) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_domain_name(payload)\n\t\tif(payload) then\n\t\t domain_name = \"\"\n while(true)\n \t\n \t len = payload[0].unpack('H*')[0].to_i\n \t # to understand below you might need to read up on dns packets. they take the form of [length][string][length][string][.....
[ "0.6073174", "0.5886176", "0.58774704", "0.57893085", "0.5782167", "0.5773545", "0.57708484", "0.57665884", "0.55520725", "0.5544492", "0.5528443", "0.552372", "0.55121875", "0.55064607", "0.54421383", "0.54165506", "0.53927433", "0.5386217", "0.5373017", "0.5341667", "0.5339...
0.57836735
4
bubble things up/heapify using recursion; parent scalar is always greater than the child scalars.
def bubble_up(index) parent_index = (index/2) #return if we reach the root element return if index <= 1 return if @elements[parent_index] >= @elements[index] #otherwise exchange(index, parent_index) #recurse bubble_up(parent_index) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def heapify_up\n # Swap the current_node (starting with last child) with it's parent if it is smaller\n previous_current_node = nil\n current_node = @nodes.size - 1\n # When the current_node is not changing, then it has swapped as many times as it can\n until previous_current_node == curren...
[ "0.6906113", "0.68568057", "0.6649417", "0.65117496", "0.64866954", "0.64651227", "0.64370656", "0.6383037", "0.63221794", "0.62376314", "0.6236717", "0.62291586", "0.6184827", "0.6110269", "0.60967284", "0.6089074", "0.6060234", "0.60569954", "0.60406417", "0.60253", "0.5999...
0.5815371
32
topological sort with detection
def visit(graph, node, deps, visited, &block) v = visited[node] if v == :just return true elsif v == :once return false else visited[node] = :just deps.each do |dep| if visit(graph, dep, graph[dep], visited, &block) return true end end visited[node] = :once block....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def topological_sort\n\t\tcount = size\n\t\t@explored_nodes = Array.new(count, false)\n\t\t@current_label = count\n\t\t@topological_order = Array.new(count, nil)\n\t\tcount.times do |label|\n\t\t\tdfs_topological_order(label) unless @explored_nodes[label]\n\t\tend\n\t\ttopological_order\n\tend", "def topological...
[ "0.7850025", "0.75066644", "0.73835063", "0.7166876", "0.70556283", "0.7047158", "0.69856656", "0.69748807", "0.68704563", "0.6776259", "0.67748487", "0.67352796", "0.67024595", "0.6699119", "0.66936755", "0.66870826", "0.6683316", "0.6644918", "0.66356987", "0.6633423", "0.6...
0.0
-1
GET /traits/:id GET /traits/:id.json
def show @trait = api_resource.find(params[:id], :root => :trait ) @items = Vger::Resources::Mrf::Item.where(query_options: { trait_type: "Mrf::Trait", trait_id: @trait.id }).all.to_a respond_to do |format| format.html # new.html.erb end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @trait_type\n end", "def index\n @traits = Trait.all\n end", "def show\n @trait = Trait.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @trait }\n end\n end", "def set_trait\n @trait = Trait.fin...
[ "0.68932074", "0.67570806", "0.6550297", "0.6501676", "0.6501676", "0.64433414", "0.6343675", "0.6204353", "0.6138971", "0.6011674", "0.5945116", "0.5899775", "0.5888561", "0.5876859", "0.58590496", "0.585418", "0.58434135", "0.58269906", "0.5798926", "0.5795788", "0.57936275...
0.6345522
6
Canonical Amazon Resource Number for this resource
def arn end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def amazon_resource_id\n return @amazon_resource_id\n end", "def physical_resource_id\n \"#{self.class.name.split('::').last}-#{Carnivore.uuid}\"\n end", "def resource_id\n @arn\n end", "def amazon_resource_id=(value)\n @amazon_resource_id = value\n ...
[ "0.72549725", "0.7089714", "0.6907937", "0.6620241", "0.64311254", "0.6381002", "0.6380002", "0.63775927", "0.63775927", "0.63775927", "0.61853594", "0.61557806", "0.61386865", "0.6121694", "0.6121694", "0.60676485", "0.6032264", "0.60119957", "0.6003505", "0.5999176", "0.597...
0.0
-1
Return the metadata for this log configuration
def notify { } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.metadata\n end\n end", "def metadata\n if config.metadata.include?(:all)\n [:pid, :date, :time, :file]\n else\n config.met...
[ "0.7776346", "0.7776346", "0.7726193", "0.7033487", "0.68863666", "0.6844524", "0.6844524", "0.68424433", "0.6634418", "0.6632295", "0.6578957", "0.65361327", "0.6455556", "0.6452643", "0.64458096", "0.64182603", "0.6413668", "0.6405686", "0.6404224", "0.63285494", "0.6322111...
0.0
-1
Method to see whether all of the predictions on a tip are won or not and if they are, this will set the tip to won
def tip_won @tip = Tip.find(params[:tip][:tip_id]) @prediction = [] @tip.predictions.each do |prediction| @prediction.push(prediction.result.betWon) end if @prediction.all? @tip.won = true elsif @prediction.include? false @tip.won = false else @tip.won = nil end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def over?\n won? || tied?\n end", "def predicting?\r\n @predict_state != :none\r\n end", "def someone_won?\n !!winnning_marker\n end", "def mark_winner\n winning_team = teams.reject{|team| team.goals < 10}.sort_by(&:goals).last\n winning_team.is_winner = true unless winning_team...
[ "0.6044951", "0.5992322", "0.59607303", "0.59495956", "0.57922506", "0.57332104", "0.57151306", "0.5704553", "0.5680663", "0.5662677", "0.55470484", "0.5523279", "0.55175656", "0.55175656", "0.54338604", "0.54236966", "0.5413962", "0.54102594", "0.5410117", "0.53982127", "0.5...
0.7335609
0
Test the creation of the find args count only
def test_count_find_articles_for_user_args_with_feed feed = UserFeed.find(5) #New York Times args = VwArticlesForUser.find_articles_for_user_args(true, feed, :feed, 3, nil, nil) assert args[:select] == "DISTINCT id" assert args[:conditions] == ["feed_id = ? AND (article_user_id = ? OR article_user_id IS...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(args, mode); end", "def test_find_count\n assert_equal(6, @coll.find().limit(2).count())\n end", "def test_args_check_less\n\t\targs_checker = ArgsChecker::new\n\t\tarr = []\n\t\tassert_raises(\"I need one number bud, try again\") { args_checker.check_args arr }\n\tend", "def test_check_num_args...
[ "0.6233466", "0.6064041", "0.60208136", "0.59895474", "0.5964296", "0.5853693", "0.5852976", "0.5827197", "0.5819177", "0.5819115", "0.581673", "0.5810822", "0.5810556", "0.5779797", "0.577442", "0.57544684", "0.5750544", "0.57358986", "0.57112926", "0.57071894", "0.5704918",...
0.62450075
0
Test the creation of the find args
def test_find_articles_for_user_args_with_feed feed = UserFeed.find(8) #Digg args = VwArticlesForUser.find_articles_for_user_args(false, feed, :feed, 3, nil, nil) assert args[:select] == "DISTINCT id, title, link, description, content, unread,user_article_id, rating" assert args[:conditions] == ["feed_i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(args, mode); end", "def find(*args, **options, &optional_filter_block)\n LOG.info(\"Capybara find #{args.join(' ')}\")\n super\n end", "def search(args)\n raise NotImplementedError, \"Not implemented\"\n end", "def search(*args)\n end", "def find(input)\n end", "def find; end"...
[ "0.7359585", "0.63324624", "0.6324831", "0.6148019", "0.6129577", "0.6037184", "0.5972356", "0.593886", "0.5832144", "0.5820041", "0.5819185", "0.581424", "0.579393", "0.57616323", "0.57462543", "0.57260907", "0.566965", "0.56670856", "0.56310946", "0.56155074", "0.55991983",...
0.549128
33
Test counting articles now
def test_count_articles_for_user_with_feed feed = UserFeed.find(6) #NErr the Blog count = VwArticlesForUser.count_articles_for_user(feed, :feed, 3) assert count == 2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def how_many?\n return default_article_sync if articles.length == 0\n last_db = articles.last.published\n count = 0\n feed.entries.each do |entry|\n count += 1 if entry.published > last_db\n end\n count > 20 ? 20 : count\n end", "def test_count_find_articles_for_user_args_with_feed\n f...
[ "0.653821", "0.65060407", "0.63467366", "0.6325941", "0.63191587", "0.6227495", "0.6171253", "0.6129673", "0.61212873", "0.6094264", "0.60913837", "0.60743654", "0.6015664", "0.59964204", "0.5993536", "0.5945016", "0.5944026", "0.5926869", "0.5912753", "0.59084845", "0.589109...
0.7160953
0
Test finding the articles
def test_find_articles_for_user_with_feed feed = UserFeed.find(6) #Err the Blog articles = VwArticlesForUser.find_articles_for_user(feed, :feed, 3) assert articles.size == 2 assert !articles.has_next_page assert !articles.has_prev_page assert articles.prev_page.nil? assert articles.next_page...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_articles(*args)\n (1..@how_many).each { |n| Article.create(:name => n, :author_id => 1) }\n results = Article.find(*args)\n if results.size > results.page_size\n page_count, num_on_last_page = how_many.divmod(results.page_size)\n page_count = page_count + 1 if num_on_last_page > 0\n ...
[ "0.6749496", "0.67161655", "0.6697678", "0.6686039", "0.6683691", "0.66740173", "0.66222036", "0.65760094", "0.6539714", "0.6514489", "0.65023726", "0.6470288", "0.6454364", "0.64371675", "0.6431779", "0.639554", "0.6394885", "0.6390838", "0.6366575", "0.63268214", "0.6324389...
0.7091233
0
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge with: Bill Deng. 0. total Pseudocode make sure all pseudocode is commented out! Input: array (list of numbers) Output: number Steps t...
def total(list) sum = 0 for i in list sum = sum + i end p sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution(a)\n return 0 if a.uniq.size != a.size\n \n max = a.size \n sum = (1 + max) * max / 2\n \n array_sum = a.inject(0, &:+) \n sum == array_sum ? 1 : 0 \nend", "def solution(number)\n sum = 0\n Array(1..number-1).each do |i|\n if i % 3 == 0 || i % 5 == 0\n sum += i\n end\n end\n sum\ne...
[ "0.6856004", "0.6842338", "0.67922467", "0.67525995", "0.6751706", "0.6692171", "0.6654565", "0.6618813", "0.6601736", "0.6572141", "0.6560876", "0.6555876", "0.65202457", "0.6518311", "0.6515971", "0.6511436", "0.65025055", "0.6497835", "0.64853543", "0.64801127", "0.6477914...
0.0
-1
3. total refactored solution
def total(list) p list.reduce(:+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def anchored; end", "def solution4(input)\n end", "def suivre; end", "def private; end", "def probers; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def algorithms; end", "def stderrs; end", "def schubert; end", "def transformations; end...
[ "0.614783", "0.59552205", "0.58631617", "0.5817628", "0.5803303", "0.5688251", "0.5688251", "0.5688251", "0.5688251", "0.5688251", "0.5668896", "0.5657474", "0.56524754", "0.562926", "0.5584554", "0.5583142", "0.55335104", "0.55295557", "0.55000037", "0.549499", "0.5478271", ...
0.0
-1
4. sentence_maker pseudocode make sure all pseudocode is commented out! Input: array (list of strings) Output: string (sentence) Steps to solve the problem. transform list into a sentence by concatenating array elements, then capitalizing and adding a period to the end 5. sentence_maker initial solution
def sentence_maker(array_of_strings) sentence = array_of_strings[0].capitalize for i in array_of_strings[1..-1] sentence += " " + i end p sentence + "." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sentence_maker(array)\n\tarray[0].capitalize!\n\tfinalString = array.join(' ')\n\tfinalString = finalString + '.'\nend", "def sentence_maker(array)\n\tcomplete = \"\"\n\tarray.each do |i|\n\t\tcomplete = complete + i.to_s + \" \"\n\tend\n\tcomplete.insert(-2, \".\")\n\treturn complete.strip.capitalize\nend",...
[ "0.8601385", "0.8530494", "0.8483632", "0.84825075", "0.8474188", "0.84703845", "0.8470044", "0.8464469", "0.84567046", "0.8453144", "0.8449295", "0.8447128", "0.8447128", "0.843675", "0.84342337", "0.8427202", "0.8397537", "0.83938146", "0.8388802", "0.83871686", "0.83865803...
0.8275823
33
6. sentence_maker refactored solution
def sentence_maker(array_of_strings) p array_of_strings.join(' ').capitalize + "." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def\n \nend\n\n\n# 6. sentence_maker refactored solution", "def generate_sentence\n\n if @array_words.length < 3\n return \"Length of the input_file is too small to produce trigrams\"\n\n # This function results in an error message if there are no capital\n # words or no end of s...
[ "0.8855691", "0.70719296", "0.70076495", "0.7005185", "0.6995376", "0.69695127", "0.68714696", "0.6835763", "0.68160456", "0.6799819", "0.6795405", "0.67920643", "0.6792004", "0.67893285", "0.6781017", "0.6771953", "0.6764923", "0.6727412", "0.6697308", "0.66861355", "0.66604...
0.0
-1
Purpose: print string for all attributes of DueTask object
def to_s super + " Task is due: #{@due_date.to_s}." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_task()\n puts @task_name\n puts \" Assigned to: #{@assigned_to}\"\n puts \" Priority: #{@priority}\"\n print \" Start Date: #{@date_start.month}/\"\n print \"#{@date_start.day}/\"\n puts \"#{@date_start.year}\"\n print \" End Date: #{@date_end.month}/\"\n print \"#{@dat...
[ "0.7513576", "0.7165069", "0.6902165", "0.6829049", "0.6681728", "0.6550361", "0.654912", "0.650237", "0.6490485", "0.6378167", "0.63497293", "0.6291157", "0.6281578", "0.6277279", "0.6275156", "0.6230306", "0.62095195", "0.61869776", "0.6148436", "0.61408347", "0.61386114", ...
0.6341131
11
Purpose: due_date setter Signature: takes date string in "YYYYMMDD" format
def set_due_date(date_string) @due_date = Date.parse(date_string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def change_due_date(date)\n @due_date = Date.parse(date)\n end", "def due_date=(date)\n @due_date = date\n end", "def changeDueDate(date)\n @dueDate = Date.parse(date)\n return @dueDate\n end", "def setDueDate(date)\n @dueDate = date\n end", "def due_date\n if @values[:due_date] != ...
[ "0.81394213", "0.78250265", "0.7823772", "0.76514715", "0.73983264", "0.7312813", "0.7236758", "0.7097227", "0.70676446", "0.70676446", "0.6960214", "0.6890273", "0.66367626", "0.6595858", "0.65756327", "0.65756327", "0.65426445", "0.65368193", "0.64763474", "0.64713824", "0....
0.8109237
1
validates_format_of email not suck TODO
def github_projects Rails.cache.fetch("/users/#{self.id}/github_projects", :expires_in => 1.day) { gh = Github.new(authentications.where(:provider => 'github').first.provider_token) gh.repos } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def email_format\n\t\terrors.add(:email, :invalid) unless email.match(EMAIL_REGEXP)\n\tend", "def email_validator\n [\n ActiveModel::Validations::FormatValidator,\n {\n :allow_blank => true,\n :with => /\\A[^@\\s]+@[^@\\s]+\\.(\\S+)\\z/,\n :message => :invalid_email\n }\n ...
[ "0.85296863", "0.7799724", "0.7739717", "0.772209", "0.7518012", "0.75094306", "0.74322784", "0.74284035", "0.7425211", "0.73561263", "0.7344548", "0.7316031", "0.7310379", "0.73024666", "0.72654617", "0.72611123", "0.725008", "0.72492737", "0.72479534", "0.724438", "0.721764...
0.0
-1
This stuff isn't in the decorator, because it's used for current_user, which isn't decorated.
def to_s username || sanitized_email || 'Anonymous' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_user\n UserDecorator.decorate(super) unless super.nil?\n end", "def current_user\n UserDecorator.decorate(super) unless super.nil?\n end", "def current_user\n @_decorated_current_user ||= super&.decorate\n end", "def current_user\n return @current_user if @current_user\n \n @...
[ "0.753915", "0.753915", "0.74921376", "0.71783066", "0.71653736", "0.71653736", "0.6968321", "0.6942579", "0.6813484", "0.6813484", "0.6736346", "0.6665685", "0.6621751", "0.6538904", "0.6482635", "0.6478495", "0.64734", "0.64447355", "0.6436747", "0.64123327", "0.6386318", ...
0.0
-1
collection_of_pegs is a multidimensional array
def initialize(args) @collection_of_pegs = args.fetch(:collection_of_pegs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def galleries\n paintings.map do |p|\n p.gallery\n end\n end", "def galleries\n self.paintings.map{|painitng| painitng.gallery}.uniq\n end", "def galleries\n paintings.map {|painting| painting.gallery}\n end", "def galleries\n galleries = self.paintings.map do |pi|\n pi.gallery\...
[ "0.64855164", "0.6484457", "0.6404683", "0.6375099", "0.6371604", "0.6326745", "0.6326745", "0.6326745", "0.6310757", "0.6289266", "0.6286084", "0.6167558", "0.6089037", "0.6076401", "0.6050659", "0.59479475", "0.54815066", "0.534312", "0.5336717", "0.5327151", "0.52634346", ...
0.5590779
16
ACCOUNT UPDATING NOT AVAILABLE. SEE UPDATE_PASSWORD BELOW. def update
def update_password @user = current_user old_password = params[:old_password] new_password = params[:new_password] if old_password == '' or new_password == '' flash[:notice] = I18n.t('accounts.password_blank') elsif @user.valid_password?(old_password) flash[:notice] = I18n.t('accounts....
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_account(options)\n password = options[:new_password]\n parameters = { :curpass => options[:current_password], :email => options[:email], :newpass => password, :verpass => password, :api_type => :json }\n\n post('api/update', parameters)\n end", "def update_account\n\n @use...
[ "0.760233", "0.73360735", "0.7308667", "0.72889686", "0.7275016", "0.7261177", "0.71997327", "0.714115", "0.7103841", "0.70977366", "0.7079649", "0.7075114", "0.70672464", "0.70431846", "0.6981953", "0.69756687", "0.6969654", "0.6962244", "0.694402", "0.6922594", "0.6908755",...
0.0
-1
be a positive integer and return its additive persistence which is the number of times you must add the digits in num until ou reach a single digit. For example: if num is 2718 then your program should return 2 because 2 + 7 + 1 + 8 = 18 and 1 + 8 = 9 and you stop at 9. Input:4 Output:0 Input:19 Output:2
def AdditivePersistence(num) # code goes here return num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def AdditivePersistence(num)\n addv_pers = 0\n until num < 10\n num = num.digits.sum\n addv_pers += 1\n end\n addv_pers\nend", "def AdditivePersistence(num)\n count = 0\n\n while num > 9\n num = num.to_s.split(\"\").map{|i| i.to_i}.inject(:+)\n count += 1\n end\n\n count\nend", "def Additiv...
[ "0.80574244", "0.7754592", "0.7739138", "0.75053585", "0.7475106", "0.7472973", "0.741312", "0.70866585", "0.701512", "0.69973403", "0.6989919", "0.69793016", "0.69322294", "0.69288236", "0.69277036", "0.6909376", "0.68795925", "0.68738145", "0.68556494", "0.6826433", "0.6822...
0.0
-1
The default bonus point for a rent is 1 If the car is an SUV, it should return the default bonus points + 1 There was a condition where the bonus points were supposed to be decreased by 10 if the total amount were negative, but the amount can never be negative
def bonus_points_for_days(days) raise 'Error: days invalid' unless valid_days?(days) return 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def natural_bonus\n 0\n end", "def deflection_bonus\n 0\n end", "def defense_bonus(lv)\n (80 * 3 * lv.to_f / 2 + 250) / 100 + 5\n end", "def getBonus\r\n @bonus = super.getSalario / (2*100)\r\n end", "def calculate_bonus(amount, bonus)\n bonus ? amount / 2 : 0\nend", "def...
[ "0.70437384", "0.7017262", "0.6772011", "0.6704881", "0.6688063", "0.66795784", "0.65565395", "0.65213734", "0.6519631", "0.65092486", "0.65091854", "0.6497602", "0.6458027", "0.64510334", "0.64487284", "0.64338624", "0.6414028", "0.64074206", "0.64074206", "0.64074206", "0.6...
0.0
-1
Adding points against and points for to rankings hash
def add_points(team) games_played = Game.where("team_one = #{team.id} or team_two = #{team.id}") @rankings[team.name]["points_for"] = 0 @rankings[team.name]["points_against"] = 0 if !games_played.nil? games_played.each do |game| if !game.winner.nil? && !game.winner_score.nil? if ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n @points.inject(0) { |sum, point| sum += point.x + point.y }\n end", "def get_rankings\n #create tmp hash storage for all the rows in the rankings table\n row_holder = Hash.new { |hash, key| hash[key] =\n {'played' => 0, '3_points' => 0, '2_points' => 0, '1_point' => 0,\n ...
[ "0.7090035", "0.668032", "0.64619905", "0.6367482", "0.6328738", "0.63134146", "0.6300063", "0.62820774", "0.62566304", "0.62551385", "0.6237811", "0.6234838", "0.6215865", "0.6177377", "0.6174329", "0.6102681", "0.6089473", "0.60692024", "0.60599667", "0.6032594", "0.601428"...
0.7001565
1
Useful for setting js in one view and rendering it in another
def javascript(js=nil) @javascript ||= [] @javascript << js @javascript.join("\n") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inject_js; end", "def inject_js=(_arg0); end", "def call_js_init(something_js)\n content_for :javascript do\n \"<script type='text/javascript'>\n $(document).ready(function(){\n #{something_js}\n });\n </script>\".html_safe\n end\n end", "def js_includes\n e...
[ "0.7581255", "0.68121856", "0.67976415", "0.652503", "0.6430133", "0.6424622", "0.63792324", "0.63500494", "0.6325136", "0.6292612", "0.62878555", "0.62751305", "0.6248278", "0.6220473", "0.62197196", "0.6183433", "0.61679447", "0.61606544", "0.61429614", "0.6136029", "0.6133...
0.0
-1
Create alerts with custom classes
def alert(id, msg, *classes) flash[rand(9999).to_s] = {:msg => msg, :classes => classes} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def container_class\n string = 'alert '\n string += @context == 'default' ? 'alert-info' : \"alert-#{@context}\"\n string += \" #{@class}\"\n string\n end", "def container_class\n \"alert alert-#{@context} #{@class}\"\n end", "def alert_helper(*args, &block)\n Alert.new(self, ...
[ "0.6694163", "0.65749335", "0.65026635", "0.64409816", "0.64355475", "0.64298034", "0.62995327", "0.6254261", "0.6146238", "0.6124005", "0.59250563", "0.58062875", "0.57916653", "0.57615536", "0.57615536", "0.5754141", "0.5677368", "0.5677368", "0.5674681", "0.56524885", "0.5...
0.5940275
10
GET /plans/1 GET /plans/1.json
def show @plan = Plan.find(params[:id]) @plan_days = @plan.plan_days respond_to do |format| format.html # show.html.erb format.json { render json: @plan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plans(params = {})\n scope 'default'\n get('plans/', params)\n end", "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def show\n @plan = Plan.find(params[:id])\n\n render json: @plan\n end", "def index\n @plans = Plan.all\n\n respond_to do |format|\n f...
[ "0.80668986", "0.80299073", "0.7866424", "0.7828984", "0.75015014", "0.75013804", "0.747925", "0.7453174", "0.7453174", "0.7383227", "0.7175319", "0.715803", "0.7094077", "0.708701", "0.7042046", "0.7042046", "0.70326114", "0.701462", "0.70041215", "0.6973513", "0.69346154", ...
0.6676116
39
GET /plans/new GET /plans/new.json
def new @plan = Plan.new respond_to do |format| format.html # new.html.erb format.json { render json: @plan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @plantype = Plantype.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plantype }\n end\n end", "def new\n @test_plan = TestPlan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @test_plan ...
[ "0.77204925", "0.763047", "0.75800633", "0.7458137", "0.7445357", "0.74205977", "0.7374848", "0.735784", "0.73191124", "0.7316831", "0.729417", "0.72682375", "0.7251034", "0.7231949", "0.72115386", "0.7203763", "0.7140014", "0.7132095", "0.71313137", "0.7099442", "0.7099442",...
0.8117777
1
POST /plans POST /plans.json
def create @plan = Plan.new(params[:plan]) @plan.user = current_user @plan.request = Request.find( params[:request_id] ) respond_to do |format| if @plan.save @plan.request.days.times do |day| @plan.plan_days << PlanDay.create( { plan_id: @plan.id, day: day+1 } ) ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @plan = Plan.new(params[:plan])\n\n if @plan.save\n render json: @plan, status: :created, location: @plan\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def create\n @plan = Plan.new(plan_params)\n\n if @plan.save\n render json: @pl...
[ "0.7666621", "0.7620931", "0.7418079", "0.7331516", "0.7331516", "0.71364665", "0.71306527", "0.7088523", "0.70765185", "0.7063694", "0.70289785", "0.7000881", "0.69677114", "0.6897479", "0.68451", "0.6844818", "0.6837134", "0.6835583", "0.6835583", "0.6828154", "0.67873955",...
0.65843475
40
PUT /plans/1 PUT /plans/1.json
def update @plan = Plan.find(params[:id]) respond_to do |format| if @plan.update_attributes(params[:plan]) format.html { redirect_to @plan, notice: 'Plan was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.j...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(params[:plan])\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n ...
[ "0.7365375", "0.7338878", "0.7073428", "0.69984865", "0.6909138", "0.6909138", "0.6909138", "0.6909138", "0.6909138", "0.6866961", "0.6855511", "0.6833389", "0.68260497", "0.6782745", "0.6776423", "0.67730236", "0.6692281", "0.66217965", "0.6599027", "0.65917325", "0.6584588"...
0.7144361
3