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
DELETE /certificateinfos/1 DELETE /certificateinfos/1.json
def destroy @certificateinfo.destroy respond_to do |format| format.html { redirect_to certificateinfos_url, notice: 'Certificateinfo was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @certificate.destroy\n respond_to do |format|\n format.html { redirect_to certificates_path}\n format.json { head :no_content }\n end\n end", "def destroy\n @certificate.destroy\n respond_to do |format|\n format.html { redirect_to certificates_url, notice: 'Довідка ви...
[ "0.76105046", "0.75933903", "0.7464629", "0.74117583", "0.73583394", "0.7316105", "0.71583873", "0.7152156", "0.71171963", "0.70835584", "0.69955707", "0.69955707", "0.6974766", "0.69424504", "0.6932407", "0.6833698", "0.6824287", "0.6824287", "0.6824287", "0.6810706", "0.680...
0.77310354
0
Use callbacks to share common setup or constraints between actions.
def set_certificateinfo @certificateinfo = Certificateinfo.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 certificateinfo_params params.require(:certificateinfo).permit(:do_you_have_blindness, :blindness_issued_dr_name, :place, :certificate_no, :certificate_date, :percent_blindness_stated, :do_you_know_braille, :member_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.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
Write a method that takes in a string. Your method should return the most common letter in the array, and a count of how many times it appears.
def most_common_letter(string) arr = string.split("") letters = Hash.new arr.each do |x| letters[x] = arr.count["x"] end puts letters end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def most_common_letter(string)\n # #create array, letter and count to return \n # mostCommon = []\n # count = 0\n # #assign the first letter to a variable\n # i = 0\n # #loop through array\n # while i < string.length\n # count = string.count(string[i])\n # for j in string\n # #count how many times ...
[ "0.84678876", "0.82632875", "0.8254441", "0.8136161", "0.808991", "0.8043598", "0.80323106", "0.80254155", "0.8012902", "0.7995119", "0.79123074", "0.7870433", "0.7845957", "0.7822375", "0.7759017", "0.7741251", "0.770223", "0.76853573", "0.76809895", "0.7630532", "0.7606239"...
0.79931706
10
before_action :authorize_user GET /purchases GET /purchases.json
def index @group = Group.find(params[:group_id]) @purchases = Purchase.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @purchases=current_user.purchases\n end", "def index\n @purchases = current_user.purchases\n end", "def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end", "def index\n @purchases = current_user.purchases.all\n end", "def...
[ "0.74160093", "0.74123484", "0.7330316", "0.7304469", "0.7140516", "0.7005164", "0.6923248", "0.6867082", "0.68514884", "0.676335", "0.6753577", "0.66920626", "0.66465867", "0.66151816", "0.65981793", "0.65431607", "0.6516926", "0.6516926", "0.64671123", "0.638996", "0.637605...
0.0
-1
GET /purchases/1 GET /purchases/1.json
def show @group = Group.find(params[:group_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @purchases = Purchase.where(user_id: get_current_user.id.to_i)\n\n render json: @purchases\n end", "def index\n @purchases = Purchase.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @purchases }\n end\n end", "def index\n @pur...
[ "0.7712415", "0.75218415", "0.75218415", "0.75007874", "0.7361645", "0.72956914", "0.72956914", "0.72956914", "0.7228107", "0.7134358", "0.70168436", "0.6990306", "0.69710284", "0.69553524", "0.69553524", "0.69553524", "0.6903255", "0.68663627", "0.682562", "0.6805715", "0.67...
0.0
-1
POST /purchases POST /purchases.json
def create @group = Group.find(params[:group_id]) @purchase = @group.purchases.build(purchase_params) @purchase.user = current_user if @purchase.make_purchase(purchase_params[:item_ids]) redirect_to group_purchase_path(@group, @purchase), notice: 'purchase was successfully created!' else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_purchase\n user.purchases.create!(\n amount_in_cents: purchase_amount,\n employee_id: purchase_params.dig(:employee_id),\n qty: purchase_params.dig(:qty).to_i,\n venue_id: purchase_params.dig(:venue_id),\n tap_id: purchase_params.dig(:tap_id),\n description: purchase_params....
[ "0.7372497", "0.7361999", "0.71180695", "0.6974874", "0.6905323", "0.6883787", "0.688361", "0.68291336", "0.68291336", "0.68291336", "0.6828237", "0.6822894", "0.6724764", "0.6648243", "0.663833", "0.6632912", "0.6583054", "0.65470576", "0.6493291", "0.6436755", "0.643611", ...
0.6317957
32
PATCH/PUT /purchases/1 PATCH/PUT /issues/1.json
def update @group = Group.find(params[:group_id]) if @purchase.update(purchase_params) redirect_to group_purchase_path(@group,@purchase), notice: 'purchase was successfully updated!' else render action: 'edit' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n if @issue.update_attributes(params[:issue])\n format.html { redirect_to @issue, notice: 'Issue was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit...
[ "0.67826116", "0.67826104", "0.6741813", "0.66737187", "0.6673534", "0.6653088", "0.65992415", "0.65992415", "0.65992415", "0.65992415", "0.65992415", "0.655765", "0.65176904", "0.6509914", "0.65049857", "0.6477551", "0.64764285", "0.6364701", "0.635042", "0.633703", "0.63370...
0.0
-1
DELETE /purchases/1 DELETE /purchases/1.json
def destroy @group = Group.find(params[:group_id]) @purchase.destroy redirect_to group_purchases_path(@group) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |format|\n format.html { redirect_to purchases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @purchase = Purchase.find(params[:id])\n @purchase.destroy\n\n respond_to do |for...
[ "0.7574", "0.7574", "0.75626475", "0.75580645", "0.75580645", "0.75580645", "0.75580645", "0.75580645", "0.75561535", "0.7414119", "0.74132", "0.74080545", "0.73999935", "0.72549087", "0.7220104", "0.7220104", "0.7220104", "0.7220104", "0.72099346", "0.718575", "0.7115289", ...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_purchase @purchase = Purchase.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 purchase through.
def purchase_params params.require(:purchase).permit(:cost, :user_id, :group_id, :receipt_photo, item_ids: [] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_buy_token\n # Whitelist parameters for buying tokens\n purchase_params \n end", "def can_request_purchase?\n true # TODO: Should this be !virginia_borrower? ?\n end", "def purchaser_params\n \tparams.require(:purchaser).permit(:p_code, :d_name, :d_region, :d_street, :pay, :status)\n para...
[ "0.6718938", "0.64595085", "0.6196932", "0.61207503", "0.60981035", "0.60455656", "0.5964552", "0.58493495", "0.5846344", "0.581521", "0.58021337", "0.5795813", "0.5791877", "0.57897794", "0.5788847", "0.5766543", "0.57582307", "0.57535285", "0.5735953", "0.57279634", "0.5720...
0.5795284
12
Initialize with customizable unit tile size Default value: 256
def initialize unit_size = 256 # defaults to 256 @unit_size = unit_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(width, height, tile_width, tile_height)\n @max_tile_x = width/tile_width\n @max_tile_y = height/tile_height\n @max_subgrid_x = (width/tile_width)*3\n @max_subgrid_y = (height/tile_height)*3\n @tiles = Array.new(max_tile_y) {|i| Array.new(max_tile_x)}\n end", "def initialize(width, ...
[ "0.73621947", "0.703141", "0.6895081", "0.68728274", "0.6743476", "0.6701525", "0.6680334", "0.66558117", "0.64973605", "0.64316326", "0.6393688", "0.6382444", "0.63659763", "0.62957084", "0.6285845", "0.6246055", "0.6221864", "0.61515", "0.61226004", "0.6047417", "0.60473925...
0.7946376
0
Read in raw dimension to be processed
def read_raw_dimension width, height @raw_width = width @raw_height = height end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read(region)\n f = field_name\n f = f + \"[\" + extra_dim.join(\"][\") + \"]\" if(extra_dim.size > 0)\n MtkField.field_read(grid.file.file_name, grid.grid_name, \n f, region)\n end", "def dimensions\n data[:dimensions]\n end", "def read_dimensions\n if uploaded...
[ "0.59147674", "0.58684665", "0.5653722", "0.5593326", "0.55657893", "0.55233914", "0.5501222", "0.54978436", "0.5479144", "0.54529375", "0.5440085", "0.5408094", "0.53903884", "0.5351414", "0.5349256", "0.53489274", "0.5348235", "0.5315649", "0.5289476", "0.52886724", "0.5288...
0.7729429
0
Calculates level size of the raw dimensions Basically, it calculates level from width and height respectly, and return the bigger number
def max_level [to_level(@raw_width), to_level(@raw_height)].max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end", "def level_size level\n\t\t\t@unit_size * tile_size(level)\n\t\tend", "def tile_size level\n\t\t\t2 ** level\n\t\tend", "def norm...
[ "0.83024687", "0.8301916", "0.79760003", "0.7970828", "0.7187222", "0.7080219", "0.70766526", "0.7003966", "0.6980867", "0.67663765", "0.6699319", "0.662856", "0.6599879", "0.65799814", "0.65799814", "0.65521944", "0.65431994", "0.65071833", "0.65071833", "0.6497034", "0.6490...
0.6909428
9
Returns the normalized number Sometimes, the image is not so well prepared in dimension so, we need to calculate the normalized size
def normalized_size tile_size(max_level) * @unit_size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalized_sizes(width, height)\n if width.to_i > @image.width\n width = @image.width\n end\n if height.to_i > @image.height\n height = @image.height\n end\n \"#{width}x#{height}\"\n end", "def normalize_x x\n (x.to_f + ((@width - @height) / @height) / 2) * @widt...
[ "0.68923014", "0.6557463", "0.6454261", "0.6404666", "0.62525266", "0.61398375", "0.6127203", "0.6116444", "0.60969317", "0.6089997", "0.60827094", "0.6068228", "0.60587394", "0.60177827", "0.60001487", "0.5979453", "0.59464025", "0.5921952", "0.5921639", "0.59173685", "0.591...
0.7484903
0
Returns the number of tile as for rows/columns in a level
def tile_size level 2 ** level end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level_size level\n\t\t\t@unit_size * tile_size(level)\n\t\tend", "def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end", "def width\n TILE_WIDTH\n end", "def count_tiles(type)\...
[ "0.76697797", "0.72453165", "0.70038015", "0.6951412", "0.67859125", "0.6775707", "0.671118", "0.6635614", "0.66340816", "0.66199374", "0.6558338", "0.6524901", "0.6509571", "0.64921355", "0.6483328", "0.6476971", "0.64598405", "0.6422346", "0.64130473", "0.6412193", "0.63889...
0.8268957
0
Returns the size of the level image
def level_size level @unit_size * tile_size(level) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tile_size level\n\t\t\t2 ** level\n\t\tend", "def image_size\n end", "def levelsize\n w=@width-(2*@border)\n h=@height-(2*@border)\n return [w, w * gridwidth / gridheight ] if fit_width()\n return [h * gridheight / gridwidth, h]\n end", "def height\n image.size\n end", "de...
[ "0.7617774", "0.76102614", "0.7497429", "0.7411752", "0.7301929", "0.72461116", "0.71941733", "0.71532375", "0.71457165", "0.7103434", "0.7047134", "0.70275044", "0.6995348", "0.6954204", "0.6876151", "0.6871806", "0.68583703", "0.68028176", "0.6796992", "0.6762356", "0.67518...
0.81488186
0
Returns the pixel offset in the image
def tile_offset index @unit_size * index end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_offset( image )\n offset_value = offset.is_a?( Rational ) ? image.size( axis ) * offset.to_f : offset\n return offset_value.to_i\n end", "def byte_offset(loc) loc.y * line_byte_size + loc.x * pixel_byte_size; end", "def image_position\n (@row * 6) + @column\n end", "def...
[ "0.8319193", "0.77044", "0.7252445", "0.6808803", "0.67498213", "0.6731959", "0.66849977", "0.6640605", "0.66188747", "0.6611436", "0.65979046", "0.65880316", "0.65570843", "0.65369314", "0.6443711", "0.64151776", "0.639212", "0.6378712", "0.6357925", "0.6316095", "0.6259343"...
0.63505536
19
Calculates quadkey for tile (, ) on level The process is kind of complex, here's what it does: 1. Converts x, y to binary string 2. Interleave the bits of y and x coordinates 3. Interprate the result as a base4 number (with leading zeros maintained)
def quadkey level, x, y x_chars = x.bin_str(level).split "" y_chars = y.bin_str(level).split "" y_chars.zip(x_chars).flatten.join("").to_i(2).to_s(4).rjust(level, "0") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hashed_coord(x, y)\n num = 0\n num += 65536 if x < 0\n num += 65536 * y\n num += x\n num\nend", "def quad_tree_key(tx, ty, zoom)\n quad_key = \"\"\n ty = (2**zoom - 1) - ty\n i = zoom\n while i > 0\n digit = 0\n mask = 1 << (i - 1)\n digit += 1 if (tx & mask) != ...
[ "0.71535265", "0.70629495", "0.6973121", "0.6036833", "0.5980283", "0.5795721", "0.56998044", "0.5589444", "0.5568513", "0.5532638", "0.5528975", "0.54389477", "0.54198396", "0.5357204", "0.53430796", "0.5332323", "0.5264014", "0.52475893", "0.5230657", "0.52063274", "0.51977...
0.78799736
0
Returns the list of possible levels
def each_level (1..max_level).each do |level| yield level if block_given? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def levels\n Access::Core.levels_hash.keys\n end", "def getLevels\n @level\n end", "def levels\n @levels ||= {}\n end", "def levels\n levels = [\n \"1.1.1\",\n \"1.2.2\",\n \"1.3.1\",\n \"1.3.2\",\n ...
[ "0.78736514", "0.77437687", "0.7742778", "0.77188146", "0.735455", "0.7336268", "0.7248812", "0.68019134", "0.675925", "0.674503", "0.67354304", "0.6726792", "0.6707532", "0.6590975", "0.65239817", "0.6518331", "0.6474351", "0.6474351", "0.6372964", "0.6368996", "0.63015723",...
0.0
-1
Builds the "x, y" pairs, and returns these pairs in block
def each_tile level size = tile_size level (0...size).each do |y| (0...size).each do |x| yield(x, y) if block_given? end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gen_coordinates\n [@gen_x, @gen_y] if generator?\n end", "def get_block_coords(x, y)\n return (@padding + x * @cell_size), (@padding + y * @cell_size)\n end", "def coord(a, b)\n final_array = []\n first_array = (1..a).to_a\n second_array = (1..b).to_a\n first_array.each do |first_num|\n ...
[ "0.6432461", "0.6382463", "0.63168055", "0.62567246", "0.6176829", "0.6174164", "0.6098776", "0.6043964", "0.5917393", "0.5910302", "0.58924645", "0.58717334", "0.5850624", "0.5850624", "0.58504134", "0.58454967", "0.5827054", "0.5825175", "0.5816952", "0.5803704", "0.57347",...
0.0
-1
Builds the "x, y, index" pairs, and returns these pairs in block
def each_tile_with_index level idx = 0 size = tile_size level (0...size).each do |y| (0...size).each do |x| yield(x, y, idx) if block_given? idx += 1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hint_idx_to_coord(i)\n j = i % SIZE\n\n if i >= 0 && i < SIZE\n # top\n r = (0..(SIZE-1)).to_a.map{ |a| {x: j, y: a} }\n elsif i >= SIZE && i < (SIZE * 2)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: a, y: j} }\n elsif i >= (SIZE * 2) && i < (SIZE * 3)\n r = (0..(SIZE-1)).to_a.reverse.ma...
[ "0.6820345", "0.6820345", "0.6791505", "0.67661506", "0.6535457", "0.6499563", "0.64318633", "0.6366998", "0.62963194", "0.62961483", "0.6250869", "0.6207936", "0.612839", "0.6078046", "0.6066379", "0.60286343", "0.60286343", "0.6019508", "0.6005874", "0.60008943", "0.5992372...
0.57262874
39
Generates meta info for current TileSystem
def meta { total_level: max_level, unit_size: @unit_size, raw_width: @raw_width, raw_height: @raw_height } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def site_meta\n end", "def site_meta\n end", "def get_meta_data\r\n MetaData.new(:':curr-id' => Node.current_id,\r\n :':curr-quest-flag' => QuestMaker.current_quest_flag)\r\n end", "def meta_information\n @meta_hash ||= {}\n end", "def set_meta\n meta.tap do |m|\n ...
[ "0.6144304", "0.6144304", "0.6127029", "0.60741466", "0.5968413", "0.5942043", "0.5894022", "0.58670396", "0.57468116", "0.5675578", "0.5655589", "0.56519395", "0.56519395", "0.5647539", "0.564067", "0.5636611", "0.55725586", "0.5563017", "0.55603415", "0.5552185", "0.5549134...
0.535214
42
Calculate level size from raw size with the following fomula: level = ceil(log2(raw size / unit_size))
def to_level raw_size Math.log2(1.0 * raw_size / @unit_size).ceil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def level_size level\n\t\t\t@unit_size * tile_size(level)\n\t\tend", "def normalized_size\n\t\t\ttile_size(max_level) * @unit_size\n\t\tend", "def tile_size level\n\t\t\t2 ** level\n\t\tend", "def levels_for(max_pixel_length)\n return 0 if max_pixel_length < 192\n max_tiles = (max_pixel_length.to_f...
[ "0.79776996", "0.7704683", "0.7155107", "0.66350687", "0.6608158", "0.6350047", "0.6277", "0.6236583", "0.6199075", "0.61920184", "0.6180929", "0.6152943", "0.6086631", "0.60363704", "0.59675246", "0.59564584", "0.58436817", "0.58431715", "0.5838503", "0.5822669", "0.58137375...
0.8681999
0
TODO: find a default image for product and update here
def product_image(size) images.presence && images[0].url(size) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def simple_image(style)\n product_image_by_spree( wrapped_product.model, style )\n end", "def default_image\n end", "def software_image\n super\n end", "def safe_default_image\n if default_image.try(:filename).present? \n default_image\n elsif self.images.present?\n self.imag...
[ "0.70911515", "0.7070084", "0.6995142", "0.68563676", "0.678181", "0.6760042", "0.67017335", "0.66787297", "0.66603583", "0.66117257", "0.6563269", "0.6538122", "0.6521878", "0.6502522", "0.6411329", "0.63978565", "0.63898206", "0.6383694", "0.6371153", "0.636808", "0.6362212...
0.6375284
18
This is the method we use to turn the options into a string to build the main puppet manifests
def option_type(ns=[]) a_template = (self =~ /template/) == 0 a_service = self =~ /^[A-Z][a-zA-Z]*\[[a-zA-Z0-9\-\.\"\'_\$\{\}\/]*\]/i a_function = self =~/(.)*\((.)*\)(.)*/ if is_a?(PoolParty::Resources::Resource) self.to_s else (a_service || a_template || a_function) ? sel...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def manifest() @opts.manifest; end", "def expand_options(options)\n # its deprecated but still work to do to deprecate it fully\n # Chef.deprecated(:package_misc, \"expand_options is deprecated, use shell_out instead\")\n if options\n \" #{options.is_a?(Array) ? Shellwo...
[ "0.6760519", "0.65975994", "0.63402027", "0.63319814", "0.63117963", "0.61944765", "0.61212015", "0.60845137", "0.6056899", "0.60403687", "0.60091305", "0.6006496", "0.59906316", "0.59752506", "0.58971566", "0.5893192", "0.5893007", "0.58838123", "0.5876844", "0.5875833", "0....
0.0
-1
untested because I couldn't find when this applies. It is pre 2.7 definitely, but unsure when. this URL scheme was noted in the secsignal writeup
def cve_2019_9960_pre25(cookie, ip) vprint_status('Attempting to retrieve file') traversal = '../' * datastore['DEPTH'] res = send_request_cgi({ 'method' => 'GET', 'uri' => normalize_uri(uri, 'index.php'), 'cookie' => cookie, 'vars_get' => { 'sZip' => "#{traversal}#{datastore...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def http_minor; end", "def request_uri; end", "def resolved_uri; end", "def uri_host; end", "def ios; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", "def uri; end", ...
[ "0.61590964", "0.60102683", "0.5804391", "0.57790357", "0.57313293", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.56640905", "0.5637721", "0.5619131", "0.5619108", ...
0.0
-1
For when user decides to make a random tree
def random_tree #range of possible angle separations between branches #big range seems to be ok, 30 to 60 works nice $angle_of_separation = (30..60).to_a #range of possible shrinkage values, will have a decimal in front of it #shrink determines how short each branch is $shrink_range = (4..6).to_a #split d...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_tree\n root =\tTreeNode.new(3)\n root.left =\tTreeNode.new(9)\n right = \t\tTreeNode.new(20)\n right.left = \tTreeNode.new(15)\n right.right = TreeNode.new(7)\n root.right = \tright\n root\nend", "def create\n @node.is_root = true\n\n if @node.save\n flash[:notice] = \"Successfully...
[ "0.68606263", "0.6191294", "0.61840314", "0.6163733", "0.6115843", "0.6112119", "0.6047462", "0.60268474", "0.5992153", "0.59139967", "0.5895867", "0.5822032", "0.581244", "0.57849574", "0.5782475", "0.5782066", "0.57485986", "0.5738438", "0.57180995", "0.5695721", "0.5666172...
0.70229703
0
For when user decides to customize their own tree
def custom_tree #if they haven't made a shrink range/trunk yet, make one for them if $shrink_range.empty? $shrink_Range = (4..6).to_a end if $trunk.empty? $trunk = (175..250).to_a end @shrink = "0.#{$shrink_range[0]}".to_f #Height is 600, so y is in (0,600) $angle_of_separation = (@window.m...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_tree\n\tend", "def render\n return ro_standard if @readonly \n set_initial_value('html','value')\n require 'sort_alphabetical' \n \n record = record_text_for(@yaml['name'])\n p '******', \"<div id=\\\"#{@yaml['name']}\\\" class=\\\"tree-select\\\" #{set_style()} >\"\n @html << \"<div id=\\\"#{@...
[ "0.74303323", "0.6540772", "0.6440769", "0.63351387", "0.63137805", "0.6286149", "0.627237", "0.62638843", "0.6251174", "0.6179745", "0.6141802", "0.6110184", "0.60880154", "0.601912", "0.60128343", "0.5999322", "0.5990898", "0.59830487", "0.598123", "0.59805954", "0.5980343"...
0.58248866
40
function to output the lines as a drawing
def draw @branches.each do |a| a.each do |b| @window.draw_line(b[0][0], b[0][1], @color, b[1][0], b[1][1], @color, @layer) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def draw_line\n print H_SEP * columns\n end", "def how_to_render_lines args\n # Render a horizontal line at the bottom\n args.nokia.lines << { x: 0, y: 0, x2: 83, y2: 0 }\n\n # Render a vertical line at the left\n args.nokia.lines << { x: 0, y: 0, x2: 0, y2: 47 }\n\n # Render a diagonal line starting ...
[ "0.76985085", "0.74865097", "0.74477446", "0.7329003", "0.7152078", "0.71108073", "0.7046872", "0.70430875", "0.7012054", "0.69602877", "0.6946096", "0.6930904", "0.6924219", "0.6921416", "0.6903929", "0.68928224", "0.6863676", "0.6858823", "0.6821821", "0.67991763", "0.67946...
0.722636
4
all the instructions for pressing different buttons
def button_down(id) if button_down? Gosu::KbEscape close end if button_down? Gosu::KbR @tree.random_tree end if button_down? Gosu::KbC @tree.custom_tree end #F1/F2 are split range if button_down? Gosu::KbF2 $split_range = $split_range + 1 @tree.custom_tree end if button_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def buttons; end", "def _button_4_command(*args)\n\n end", "def button_down; end", "def _button_3_command(*args)\n\n end", "def button_actions\n case state\n when :scroll\n [\n -> { self.state = :select },\n -> { self.state = :canceled },\n -> { sel...
[ "0.7721178", "0.6970368", "0.68364584", "0.6812605", "0.67641515", "0.66861284", "0.6681829", "0.6654166", "0.6654166", "0.6633917", "0.66261643", "0.6616244", "0.6609485", "0.6609485", "0.6609485", "0.6494045", "0.64917165", "0.64576185", "0.6449926", "0.6433503", "0.6429620...
0.0
-1
GET /presses GET /presses.xml
def index @presses = Press.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @presses } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addresses\n message = { nodes: { item: resource[:name]}}\n transport[wsdl].get(:get_address, message)\n end", "def get_listings_xml(url)\n @client.get_content(url)\n end", "def addresses\n IbmCloudRest.get \"#{@uri}/addresses\"\n end", "def index\n @adresses = Adress.all\n end"...
[ "0.62170446", "0.606099", "0.58904594", "0.5763685", "0.57131106", "0.5709674", "0.5702092", "0.5680386", "0.56613046", "0.56457275", "0.5561773", "0.55509573", "0.5532738", "0.55229235", "0.55214995", "0.5482518", "0.54651916", "0.54651916", "0.5448622", "0.5444083", "0.5418...
0.69614744
0
GET /presses/1 GET /presses/1.xml
def show @press = Press.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @press } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @presses = Press.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @presses }\n end\n end", "def show\n @pneighbour = Pneighbour.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { re...
[ "0.63859427", "0.58110136", "0.5797087", "0.5679858", "0.56430167", "0.56056464", "0.5583362", "0.55829555", "0.5572978", "0.55549026", "0.5531751", "0.5515136", "0.55079913", "0.54577523", "0.5435212", "0.5435212", "0.54256624", "0.54200923", "0.5407167", "0.5377195", "0.536...
0.0
-1
GET /presses/new GET /presses/new.xml
def new @press = Press.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @press } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @pneighbour = Pneighbour.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @pneighbour }\n end\n end", "...
[ "0.6814846", "0.6790014", "0.6502205", "0.6397887", "0.6382789", "0.6382789", "0.633008", "0.63287336", "0.6321895", "0.63081926", "0.6301884", "0.62860966", "0.6280577", "0.6280577", "0.62492275", "0.6248779", "0.6240532", "0.6219617", "0.6207952", "0.61893755", "0.6186917",...
0.6325387
8
POST /presses POST /presses.xml
def create @press = Press.new(params[:press]) respond_to do |format| if @press.save flash[:notice] = 'Press was successfully created.' format.html { redirect_to(@press) } format.xml { render :xml => @press, :status => :created, :location => @press } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def post(url, post_vars={})\n send_request url, post_vars, 'POST'\n end", "def post(*args)\n request :post, *args\n end", ...
[ "0.58567786", "0.5785169", "0.5692427", "0.5669738", "0.56526893", "0.564215", "0.56268424", "0.56085473", "0.5598124", "0.552678", "0.5489879", "0.54836184", "0.54576194", "0.5455615", "0.5408896", "0.539395", "0.5365364", "0.5356465", "0.5349251", "0.53374016", "0.5325134",...
0.0
-1
PUT /presses/1 PUT /presses/1.xml
def update @press = Press.find(params[:id]) respond_to do |format| if @press.update_attributes(params[:press]) flash[:notice] = 'Press was successfully updated.' format.html { redirect_to(@press) } format.xml { head :ok } else format.html { render :action => "edit" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def upd...
[ "0.6682384", "0.6364852", "0.5943701", "0.584355", "0.57806045", "0.5631393", "0.55254006", "0.54994994", "0.5332869", "0.5317707", "0.5302974", "0.5261258", "0.5252452", "0.52471876", "0.5240611", "0.5239729", "0.52047247", "0.5197602", "0.5194315", "0.5165295", "0.516131", ...
0.0
-1
DELETE /presses/1 DELETE /presses/1.xml
def destroy @press = Press.find(params[:id]) @press.destroy respond_to do |format| format.html { redirect_to(presses_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n en...
[ "0.65615857", "0.6481809", "0.63664526", "0.6321595", "0.62636405", "0.61650765", "0.6130632", "0.61284274", "0.6097081", "0.6095914", "0.6090434", "0.6050303", "0.6009251", "0.6006096", "0.5997441", "0.59941936", "0.59941936", "0.5978881", "0.59747434", "0.5973214", "0.59685...
0.57798094
42
GET /questions GET /questions.json def index
def index question = Question.all if user_signed_in? question.each do |a| current_user.assigns.each do |b| if b.question_id == a.id a.update_attributes(assign: 1) end end end end if @is_mentor == false if params[:sort] =="qpoint1" ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @questions }\n end\n end", "def index\n @questions = Question.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json...
[ "0.8479222", "0.8430983", "0.79864043", "0.7950962", "0.76824164", "0.76319593", "0.76203465", "0.7597233", "0.75729114", "0.7559279", "0.75589794", "0.7541312", "0.75206906", "0.75206906", "0.75206906", "0.75206906", "0.75206906", "0.75206906", "0.75206906", "0.75206906", "0...
0.0
-1
POST /questions POST /questions.json
def create @category = Category.find_by_id(params[:category_id]) @question = Question.new(question_params) @question.user_id = current_user.id @question.category_id = params[:category_id] if @question.save current_user.increment!(:question_count,1) redirect_to category_question_pat...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @question = Question.new(question_params)\n\n if @question.save\n render json: @question\n else\n render status: 400, nothing: true\n end\n end", "def create\n json = params[:survey]\n json[:questions] = JSON.parse(json[:questions])\n json[:questions].each_with_index ...
[ "0.7366109", "0.72979563", "0.7059195", "0.7000753", "0.6956294", "0.68727475", "0.67733675", "0.6729471", "0.67116046", "0.6706642", "0.6705714", "0.6689426", "0.6647686", "0.6635359", "0.662669", "0.662669", "0.662669", "0.662669", "0.662669", "0.662669", "0.662669", "0.6...
0.0
-1
PATCH/PUT /questions/1 PATCH/PUT /questions/1.json
def update if @question.update(question_params) redirect_to category_question_path(params[:category_id],@question.id), notice: 'Question was successfully updated.' else render :edit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n format.html { redirect_to api_v1_question_path(@question), notice: 'Question was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ "0.7183878", "0.70814127", "0.6957284", "0.6923744", "0.68906844", "0.68804014", "0.6879913", "0.6822023", "0.6822023", "0.6822023", "0.6822023", "0.6822023", "0.68145245", "0.6813764", "0.68119574", "0.6738467", "0.6735036", "0.6731612", "0.67240965", "0.6694623", "0.6679640...
0.0
-1
DELETE /questions/1 DELETE /questions/1.json
def destroy id = @question.category_id @question.destroy current_user.decrement!(:question_count,1) redirect_to category_path(id), notice: 'Question was successfully destroyed.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @question = Question.find(params[:id])\n @question.destroy\n\n respond_to do |format|\n format.html { redirect_to api_v1_questions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n if @v1_question.destroy\n render json: {'message': 'Deleted questio...
[ "0.78011775", "0.7775935", "0.76255584", "0.76093596", "0.76093596", "0.75924885", "0.7591619", "0.7591619", "0.7591619", "0.7591619", "0.7591619", "0.7591619", "0.7590869", "0.7587682", "0.75844985", "0.75844985", "0.75844985", "0.75844985", "0.75844985", "0.75844985", "0.75...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_question @question = Question.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 question_params params.require(:question).permit(:title,:content) 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
Method that test the DarkRoast class and some condiments with decorator pattern.
def test_dark_roast beverage = DarkRoast.new beverage = Milk.new(beverage) beverage = Mocha.new(beverage) beverage = Mocha.new(beverage) beverage = Whip.new(beverage) assert_equal("Dark Roast Coffee, Milk, Mocha, Mocha, Whip", beverage.description) assert_equal(1.59, beverage...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_dark_roast\n beverage = DarkRoast.new\n beverage = Milk.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"Dark Roast Coffee, Milk, Mocha, Mocha, Whip\",\n beverage.description)\n assert_equa...
[ "0.64717674", "0.64300454", "0.5912414", "0.57807904", "0.5732417", "0.5695183", "0.56617635", "0.56351167", "0.56170523", "0.5552096", "0.5488665", "0.5462629", "0.54521585", "0.5447986", "0.54456204", "0.5432535", "0.5431407", "0.5415329", "0.5401758", "0.5390233", "0.53363...
0.64446425
1
Method that test the HouseBlend class and some condiments with decorator pattern.
def test_house_blend beverage = HouseBlend.new beverage = Soy.new(beverage) beverage = Mocha.new(beverage) beverage = Whip.new(beverage) assert_equal("House Blend Coffee, Soy, Mocha, Whip", beverage.description) assert_equal(1.34, beverage.cost) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_house_blend\n beverage = HouseBlend.new\n beverage = Soy.new(beverage)\n beverage = Mocha.new(beverage)\n beverage = Whip.new(beverage)\n assert_equal(\"House Blend Coffee, Soy, Mocha, Whip\",\n beverage.description)\n assert_equal(1.34, beverage.cost)\n end", "def tes...
[ "0.68803895", "0.683695", "0.5627279", "0.5370707", "0.53168446", "0.5199839", "0.5159679", "0.5102431", "0.5094468", "0.50941086", "0.5084741", "0.506487", "0.50351536", "0.50351536", "0.5023896", "0.50179374", "0.49879628", "0.49675968", "0.49622172", "0.495552", "0.4935795...
0.6862791
1
Helper that reads lines from a file and adds them to Entries
def read_file pn pn.readlines.map(&:chomp) .each do |line| @entries.add line, pn end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_entries\n @lines = IO.readlines(@filename)\n @lines.each_with_index do |line,idx|\n if entry_klass.is_entry?(line) then\n entry = entry_klass.from_line(line)\n v = { 'entry' => entry, 'line_index' => idx }\n @entries[entry.key] = v\n end\n end\...
[ "0.77788824", "0.71825844", "0.64878345", "0.6482381", "0.63363206", "0.6291451", "0.6234319", "0.62156355", "0.6207433", "0.61898863", "0.61578727", "0.6142758", "0.60097146", "0.6005883", "0.5997412", "0.5952099", "0.5949073", "0.5939044", "0.5934835", "0.59344107", "0.5927...
0.69766426
2
Make the entries ready to format into a path
def ready @interim = @entries.map{|entry,_| entry } if @additional @interim += @additional end @interim.freeze path_format end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __build_path(entries)\n parts = entries[0][:path].split('/')\n parts.pop(entries[0][:chunks].length)\n parts.join('/') # stitch parts together to form a path\n end", "def entries_to_dir entries, path\n if File.exists? path\n raise \"directory #{path} already exists\"\n else\n ...
[ "0.7223209", "0.6433321", "0.62490183", "0.609486", "0.60783833", "0.58314323", "0.57875216", "0.5714991", "0.5689015", "0.5679964", "0.5657302", "0.5628025", "0.56179595", "0.56047016", "0.55990833", "0.5570988", "0.5536122", "0.5536122", "0.55335253", "0.552216", "0.5510682...
0.5722197
7
Function that takes the sign of the probability that something will happen, the parameters are the string of the conditional and the probability the probability that the node will happen
def assign_Prob(sign,parameters,probability) if @parents.length > 1 lookArray = Array.new(parameters.split(',').length) parameters.split(',').each do |par_name| parSign = par_name[0] parName = par_name.gsub(/\+/,'').gsub(/-/,'') Nodes.length.times do |nodePosition| if...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def conditional_probability\nend", "def should_invent?\n rand(100) < @probability * 100\n end", "def with_prob probability, action = \"\"\n if rand < probability\n if block_given?\n yield\n else\n act action\n end\n true\n else\n false\n end\n end", "def c...
[ "0.7797039", "0.6550714", "0.6541756", "0.6327351", "0.6279979", "0.6194072", "0.61906415", "0.61891884", "0.6183854", "0.61270005", "0.6042832", "0.60198647", "0.6017371", "0.5998797", "0.5991408", "0.5958332", "0.5935122", "0.5906462", "0.58716667", "0.5870191", "0.5848578"...
0.586554
20
Method that swaps the first name with the last name
def name_swap puts "Please enter your name: " @name = gets.chomp @rev_name = @name.reverse p @rev_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def first_last_name_swap(first_last_name)\n first_last_name.split.reverse.join(' ')\nend", "def swap_name(full_name)\n first_name, last_name = full_name.split(' ')\n\n altered_name = \"#{last_name}, #{first_name}\"\nend", "def name_swap\n\tuser_name = first_last.split(' ')\n\nend", "def swap_name(first_la...
[ "0.8464054", "0.822913", "0.8183329", "0.80657405", "0.8019325", "0.80139023", "0.801094", "0.801094", "0.8007576", "0.7987416", "0.79495984", "0.78240466", "0.78111607", "0.7717887", "0.74717337", "0.74658984", "0.7458109", "0.7451752", "0.74464583", "0.7423603", "0.7423603"...
0.0
-1
This method breaks down the string into an array of characters
def split p @rev_name @split_name = @rev_name.split('') p @split_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_char(string, character)\n i = 0\n temp = \"\"\n output = []\n while i < string.length\n if string[i] != character\n temp << string[i]\n else\n output << temp\n temp = \"\"\n end\n i += 1\n end\n output << temp\n return outp...
[ "0.7068989", "0.7003912", "0.69634956", "0.69634956", "0.6675839", "0.66540647", "0.6555372", "0.6475318", "0.6472833", "0.6454417", "0.64180297", "0.6371533", "0.6355519", "0.6351203", "0.6350763", "0.6348362", "0.63313234", "0.6297353", "0.62676793", "0.6266658", "0.6265867...
0.0
-1
This method takes each vowel and replaces it with the very next vowel
def vowel_switch vowels = ["a", "e", "i", "o", "u", "A", "E", "I", "O", "U"] @split_name.map! do |char| if vowels.include?(char) char = vowels[vowels.index(char)+1] else char = char.next end end p @split_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_vowel(last_first)\n last_first.map! do |word|\n word.gsub(/[aeiou]/, 'a' => 'e', 'e' => 'i', 'i' => 'o', 'o' => 'u', 'u' => 'a')\n end\nend", "def next_vowel(name)\n name = name.split('')\n name.each do |indivLetter| \n if indivLetter == \"a\"\n indivLetter.replace(\"e\")\n elsif indiv...
[ "0.81133693", "0.80672103", "0.77432936", "0.7679515", "0.76326", "0.7604149", "0.759862", "0.75608355", "0.75314164", "0.75225157", "0.7491503", "0.74702334", "0.7461829", "0.7387922", "0.7387144", "0.73836285", "0.7382702", "0.73497653", "0.7347451", "0.73354644", "0.733094...
0.712537
47
This method turns the array of single characters into a string
def name_join @code_name = @split_name.join('') p @code_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string(arr)\n arr.join(\" \")\nend", "def back_to_s(array)\n array.join(\"\")\nend", "def array_to_string(arr)\n arr.map { |e| \"'#{sanitize(e)}'\" }.join(\",\")\n end", "def assembled_characters\n characters_in_split_arrays.map {|array| array.join}\n end", "def to_s\n @chars.join\n e...
[ "0.714699", "0.7021087", "0.6931274", "0.67976606", "0.66737163", "0.6581839", "0.6578277", "0.655008", "0.6529814", "0.63984317", "0.633017", "0.63122815", "0.6304063", "0.6299251", "0.6276145", "0.6273532", "0.62416077", "0.6237358", "0.6228276", "0.6184511", "0.61721003", ...
0.0
-1
GET /moods GET /moods.json
def index @moods = current_user.moods.order("date DESC") respond_to do |format| format.html do @moods_grouped_by_date = @moods.group_by { |m| m.date } end format.json { render json: @moods } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mood }\n end\n end", "def index\n @moods = Mood.all\n end",...
[ "0.74688864", "0.7254595", "0.72246754", "0.72246754", "0.70756406", "0.69875145", "0.69242096", "0.68870205", "0.662942", "0.65850365", "0.65480644", "0.643572", "0.63048106", "0.6278722", "0.62780255", "0.62780255", "0.62780255", "0.62780255", "0.6193657", "0.61685234", "0....
0.6843758
8
GET /moods/1 GET /moods/1.json
def show respond_to do |format| format.html # show.html.erb format.json { render json: @mood } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @mood = Mood.find(params[:id])\n respond_to do |format|\n format.any { render :json => @mood }\n end\n end", "def show\n # @mood = Mood.find(params[:id])\n @mood = @user.moods.find(params[:id])\n respond_to do |format|\n format.html # show.rhtml\n format.xml { rende...
[ "0.79970825", "0.724269", "0.7147576", "0.7147576", "0.68942136", "0.6882141", "0.686367", "0.686367", "0.686367", "0.686367", "0.68076336", "0.67735916", "0.671021", "0.6560165", "0.6478864", "0.6457758", "0.63997316", "0.63847125", "0.6358275", "0.6356479", "0.63207006", ...
0.7572983
1
GET /moods/new GET /moods/new.json
def new @mood = Mood.new @mood.date = Date.current respond_to do |format| format.html # new.html.erb format.json { render json: @mood } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mood = Mood.new(mood_params)\n\n respond_to do |format|\n if @mood.save\n format.html { redirect_to @mood, notice: 'Mood was successfully created.' }\n format.json { render action: 'show', status: :created, location: @mood }\n else\n format.html { render action: '...
[ "0.77558386", "0.7698325", "0.75842655", "0.75204474", "0.740065", "0.7351664", "0.7215001", "0.7118622", "0.7064235", "0.7015694", "0.700684", "0.69961685", "0.69684196", "0.69684196", "0.69476885", "0.6945887", "0.694203", "0.69381535", "0.693807", "0.69311297", "0.6925895"...
0.7886907
0
POST /moods POST /moods.json
def create @mood = current_user.moods.new(mood_params) respond_to do |format| if @mood.save format.html { redirect_to moods_path, notice: 'Mood was successfully created.' } format.json { render json: @mood, status: :created, location: @mood } else format.html { render action...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @mood = Mood.new(mood_params)\n @mood.user = current_user\n respond_to do |format|\n if @mood.save\n format.html { redirect_to moods_path, notice: \"Mood was successfully created.\" }\n format.json { render :show, status: :created, location: @mood }\n else\n for...
[ "0.75872505", "0.75208765", "0.74665445", "0.7118295", "0.7004723", "0.69763935", "0.6922576", "0.6875202", "0.6874528", "0.6857558", "0.67224735", "0.66041696", "0.6438693", "0.64113367", "0.64113367", "0.64113367", "0.64113367", "0.6399845", "0.63226765", "0.62977934", "0.6...
0.7677242
0
PUT /moods/1 PUT /moods/1.json
def update respond_to do |format| if @mood.update_attributes(mood_params) format.html { redirect_to moods_path, notice: 'Mood was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @mood.errors, ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @mood = Mood.find(params[:id])\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n if @mood.update_attributes(params[:mood])\n format.json { head :ok }\n else\n format.json { render :xml => @mood.errors, :status => :unprocessable_entity }\n end\n ...
[ "0.7665775", "0.75998765", "0.7410807", "0.73380995", "0.7301402", "0.7301402", "0.7301402", "0.7301402", "0.7240684", "0.7165262", "0.7153471", "0.71390957", "0.71345043", "0.71272546", "0.70141315", "0.6687641", "0.6668201", "0.659241", "0.65405124", "0.65212286", "0.651705...
0.7502636
2
DELETE /moods/1 DELETE /moods/1.json
def destroy @mood.destroy respond_to do |format| format.html { redirect_to moods_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @mood.destroy\n respond_to do |format|\n format.html { redirect_to moods_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @dish_mood.destroy\n respond_to do |format|\n format.html { redirect_to dish_moods_url }\n format.json { head :no_conten...
[ "0.799258", "0.7717359", "0.76976717", "0.7561092", "0.7553874", "0.75335175", "0.74237883", "0.73639977", "0.72341245", "0.70084053", "0.7004372", "0.6934721", "0.6845711", "0.6836282", "0.6803854", "0.679157", "0.67896503", "0.67810047", "0.6774127", "0.6763564", "0.6761637...
0.8005423
0
Use callbacks to share common setup or constraints between actions.
def set_mood @mood = Mood.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def mood_params params.require(:mood).permit(:date, :rating, :description) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Method qui commence le jeu
def game_again while true # On demande a l'utilisateur ce qu'il veut faire puts "Bienvenue dans le menu" puts "1. Démarrer une partie" puts "2. Quitter le Game" continued = gets.chomp.to_i case continued when 1 # On demarre la partie puts "La partie démarre" game = Application.new when 2 ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def suivre; end", "def zuruecksetzen()\n end", "def saluda()\n\t\tputs \"-------------------\"\n\t\tputs \"hola mundo dos\"\n\tend", "def finish\r\n #\r\n end", "def jeuTermine\n\t\tlancementAventure(@tailleGrille+1)\n\tend", "def mi_carrera\n\n\tend", "def end\n end", "def celebratio...
[ "0.7440348", "0.6953881", "0.64983886", "0.6445165", "0.6442233", "0.6396215", "0.63571876", "0.6298867", "0.62630767", "0.62595725", "0.62530124", "0.6247197", "0.6247197", "0.62451226", "0.6241539", "0.62163156", "0.61973804", "0.6178958", "0.61751795", "0.61751795", "0.617...
0.0
-1
We don't move these code into model because this is too tight with form We don't want to be model tightly couple with the form
def update_queue_items ActiveRecord::Base.transaction do params[:queue_items].each do |queue_item_data| #queue_item = QueueItem.find(queue_item_data["id"]) #queue_item.update_attributes!(position: queue_item_data["position"]) if queue_item.user == current_user queue_item = current_user...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def form; end", "def ing_form; end", "def forms; end", "def form\n end", "def form_setup\n\tend", "def relation_condition_option_form\n # Nothing to do here\n end", "def default_form_builder; end", "def fbo_updated_form\n end", "def form_data?; end", "def setup_form\n build_form\n sup...
[ "0.7378665", "0.7315219", "0.7250923", "0.65641844", "0.65359104", "0.6402953", "0.6332451", "0.6308546", "0.62511665", "0.6194924", "0.6172008", "0.6152211", "0.61442596", "0.6135418", "0.605021", "0.60303485", "0.59989536", "0.5949375", "0.5907646", "0.5885546", "0.588526",...
0.0
-1
What is the output? the most frequest values What are the steps needed to solve the problem? Define the method, calling it mode. It'll pass in an array as an argument. Create variable called max = 1 Create a hash to store the items in the mode Iterate over the array to find the mode IF the hash has a key then we can ad...
def mode(numbers) counts = {} numbers.each do |num| if counts.has_key?(num) counts[num] = counts[num] + 1 else counts[num] = 1 end end num_list = counts.values highest_count = num_list.max modes = [] counts.each do |key, count| if count == highest_count modes.push(key) end end return modes...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mode(array)\n hash = Hash.new {|hash,key| hash[key] = 0} #creates a default value of 0 for all hash values\n\n array.each {|num| #iterate through the array and count +1 for each value\n hash[num] += 1\n }\n\n\n\n values = [] # Declare array of all values\n hash.each do |key, value|\n values...
[ "0.79212064", "0.7860517", "0.7826181", "0.7823206", "0.7811387", "0.77874905", "0.7783238", "0.7772816", "0.7752474", "0.7734889", "0.76838166", "0.7625407", "0.7613148", "0.76100606", "0.7593199", "0.7591714", "0.7587043", "0.757409", "0.7573696", "0.7546356", "0.7539042", ...
0.7283912
41
create checkin that logs your time
def check_in(db) currentArr = Time.new.to_s.split(' ') dayArr = currentArr[0].split('-').join('').to_i timeArr = currentArr[1].split(':').join('').to_i db.execute("INSERT INTO log (day, time) VALUES (?, ?)", [dayArr, timeArr]) log = db.execute("SELECT * FROM log") # Return true if its the first check-in of the...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkin_user\n\t entry_exist = time_entries.where(\"DATE(signin_time)=?\", Date.today)\n\t if entry_exist.blank?\n\t time_entries.create(signin_time: DateTime.now)\n\t end\n\tend", "def checkin\n if self.current_user == nil\n redirect_to \"/account/login\"\n end\n @workout = Workout.n...
[ "0.6949724", "0.6920375", "0.6773877", "0.65063524", "0.64655393", "0.6451043", "0.6393717", "0.62132215", "0.62068623", "0.61717075", "0.6115724", "0.58997136", "0.5856048", "0.585399", "0.58106697", "0.57851636", "0.57807297", "0.5779745", "0.57680357", "0.5754616", "0.5748...
0.56045294
28
create method to add activities
def add_activity(db, name) db.execute("INSERT INTO activities (name) VALUES (?)", [name]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_activity(activity)\n self.activities << activity\n end", "def add_activity(activity)\n @activities << activity\n return self\n end", "def add_activity(activity)\n @activities.push activity\n end", "def add_activity(data)\n add_child('activity', data)\n end", "de...
[ "0.7781998", "0.71398044", "0.7133603", "0.68124574", "0.6780066", "0.6747813", "0.6682193", "0.6637236", "0.6590382", "0.65710384", "0.6523093", "0.64765024", "0.6461073", "0.64255726", "0.63669854", "0.63570154", "0.6345835", "0.6327133", "0.6300919", "0.6289926", "0.626557...
0.5748911
55
create method to delete activities
def delete_activity(db, act_id) db.execute("DELETE FROM activities WHERE id=?", [act_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_activities\n self.activities.delete_all\n end", "def destroy_activity\n @activity = Activity.find(params[:id])\n @activity.destroy\n end", "def destroy_activities\n self.activities.all.each {|a| a.destroy}\n end", "def destroy\n\n if @activity.nil?\n send_error_json(nil,...
[ "0.7765192", "0.75148654", "0.7445872", "0.7325413", "0.7266554", "0.7266554", "0.7233107", "0.7116812", "0.71146876", "0.70181245", "0.7012572", "0.7005131", "0.6912318", "0.6882999", "0.68721664", "0.684939", "0.684939", "0.684939", "0.684939", "0.684939", "0.6832479", "0...
0.7297562
4
create method to add activities to the todo list
def add_todo(db, act_id) db.execute("INSERT INTO todo (activity_id, done) VALUES (?,'false')", [act_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_activity(activity)\n self.activities << activity\n end", "def add_activity(activity)\n @activities.push activity\n end", "def add_activity(activity)\n @activities << activity\n return self\n end", "def add_activity(text, user, type: :log)\n activity_obj = {\n text...
[ "0.7283488", "0.67733896", "0.66110563", "0.6574855", "0.6457678", "0.64500046", "0.64393497", "0.6406696", "0.6387872", "0.63718694", "0.6351907", "0.6351907", "0.6295128", "0.62626237", "0.62405807", "0.6234288", "0.6218446", "0.6135372", "0.6132625", "0.6132316", "0.612719...
0.5704372
52
create method to delete activities from the todo list
def delete_todo(db, act_id) db.execute("DELETE FROM todo WHERE activity_id=?", [act_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_activities\n self.activities.delete_all\n end", "def delete_activity(db, act_id)\n\tdb.execute(\"DELETE FROM activities WHERE id=?\", [act_id])\nend", "def destroy_activities\n self.activities.all.each {|a| a.destroy}\n end", "def delete\n newTodos = []\n\n @@allTodos.each { |ite...
[ "0.737347", "0.7050996", "0.69353294", "0.68532765", "0.6835951", "0.68108004", "0.68014467", "0.68014467", "0.6550154", "0.65456647", "0.6509389", "0.64835316", "0.6470398", "0.6452804", "0.644805", "0.6447756", "0.64382523", "0.6408116", "0.6404085", "0.6401137", "0.6379643...
0.72353965
1
create method to complete activity
def complete_activity(db, act_id) db.execute("UPDATE todo SET done='true' WHERE activity_id = ?", [act_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def activity\n end", "def finish\r\n #\r\n end", "def finish\n #\n end", "def finish\n #\n end", "def finish\n end", "def action_complete() self.finished = true; end", "def completed()\n end", "def complete\n end", "def completed\n end", "def finish; end", "def fi...
[ "0.6750859", "0.66701514", "0.66195565", "0.6603947", "0.654435", "0.6451142", "0.6437863", "0.63473123", "0.63063633", "0.6188611", "0.6188611", "0.6188611", "0.6188611", "0.6188611", "0.6188611", "0.6188611", "0.6188611", "0.61827296", "0.61166364", "0.60508966", "0.6001270...
0.0
-1
PRETTY PRINT METHODS create method to print unfinished activities
def print_todo_list(db) todo_list = db.execute("SELECT * FROM todo JOIN activities ON activities.id = todo.activity_id AND todo.done='false'") today = Time.new.strftime("%B %d, %Y") puts "\nYour daily To-Do List for #{today}:" puts '*~'*20+'*' todo_list.each { |act| puts act['name'] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def beginprint(*)\n super\n end", "def trail_printer(trail_instance)\n trail_instance.print_info\n 15.times {print \"*\"}\n print \"\\n\"\n end", "def print\n \"#{id}-#{start}-#{duration}-#{body}\"\n end", "def pretty_print_job\n raise NotImplementedError\n end", "de...
[ "0.6089231", "0.6034316", "0.59314716", "0.5916555", "0.5768321", "0.57591695", "0.5750277", "0.57356125", "0.57076657", "0.56843525", "0.5663547", "0.5663547", "0.5663547", "0.5636262", "0.563381", "0.5617239", "0.5596111", "0.5589612", "0.55780435", "0.55743706", "0.5565331...
0.0
-1
create method to print detailed todo_list
def print_full(db) print_todo_list(db) todo_list = db.execute("SELECT * FROM todo JOIN activities ON activities.id = todo.activity_id AND todo.done='true'") todo_list.each { |act| puts "#{act['name']} - COMPLETE" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_out_all_items\n list_header(title)\n to_do_list.each do |item|\n item.print_details\n end\n puts (\"Task list completed #{to_do_list_completed?}\")\n end", "def print_list(type='all')\n\n\t\tputs \"{#name} List - #{type} items\"\n\t\tprint '-' * 30 + \"\\n\"\n\n\n\n\t\ttod...
[ "0.75358593", "0.7444768", "0.71558994", "0.68299204", "0.68024606", "0.6718382", "0.6654535", "0.66476876", "0.6644851", "0.6600592", "0.6598798", "0.6594368", "0.6541958", "0.6483632", "0.64457065", "0.64068156", "0.6383681", "0.6374901", "0.6353249", "0.6320081", "0.631852...
0.0
-1
create method to print activities
def print_activities(db) todo_list = db.execute("SELECT * FROM activities") puts "\nHere are the available activities:" puts '*~'*20+'*' # is_included = to show if the activity is in the todolist todo_list.each { |act| puts "#{act['id']} - #{act['name']}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print\n\n end", "def beginprint(*)\n super\n end", "def print\n end", "def trail_printer(trail_instance)\n trail_instance.print_info\n 15.times {print \"*\"}\n print \"\\n\"\n end", "def print\n end", "def print\n end", "def print\n end", "def beginprintext(...
[ "0.64480793", "0.6431065", "0.6327249", "0.62822527", "0.62731403", "0.62731403", "0.62731403", "0.62618023", "0.6192764", "0.616114", "0.6153718", "0.6120101", "0.6109375", "0.60774815", "0.6067659", "0.60542583", "0.60486215", "0.6038049", "0.6029656", "0.59677994", "0.5945...
0.5591451
56
create method to print unfinished activities with id's
def print_unfinished(db) todo_list = db.execute("SELECT * FROM todo JOIN activities ON activities.id = todo.activity_id AND todo.done='false'") puts "\nUnfinished Activities for Today:" puts '*~'*20+'*' puts "ALL ACTIVITIES HAVE BEEN COMPLETED" if todo_list.empty? todo_list.each { |act| puts "#{act['id']} - #{a...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_activities(db)\n\ttodo_list = db.execute(\"SELECT * FROM activities\")\n\tputs \"\\nHere are the available activities:\"\n\tputs '*~'*20+'*'\n\t# is_included = to show if the activity is in the todolist\n\ttodo_list.each { |act| puts \"#{act['id']} - #{act['name']}\" }\nend", "def print_activities_csv(...
[ "0.5837653", "0.57852656", "0.55097866", "0.5421355", "0.54154515", "0.5410592", "0.5407604", "0.54035336", "0.5397716", "0.5377341", "0.53460413", "0.5340124", "0.5323956", "0.5323956", "0.53119236", "0.5295875", "0.5266054", "0.52642584", "0.5230542", "0.5222624", "0.520341...
0.6099105
0
create method to print items in the todo list with id's
def print_todo_ids(db) todo_list = db.execute("SELECT * FROM todo JOIN activities ON activities.id = todo.activity_id") puts "\nActivities in Your To-Do List:" puts '*~'*20+'*' puts "NO ACTIVITIES FOUND" if todo_list.empty? todo_list.each { |act| puts "#{act['id']} - #{act['name']}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_todo(id)\n filename = find_filename_for_todo(id)\n todo = create_todo_hash_from_file(filename)\n pretty_print_todo(todo)\nend", "def print_out_all_items\n list_header(title)\n to_do_list.each do |item|\n item.print_details\n end\n puts (\"Task list completed #{to_do_l...
[ "0.729896", "0.72466946", "0.6913432", "0.68411124", "0.67338187", "0.6722822", "0.65272987", "0.6420783", "0.63925785", "0.6356236", "0.63381577", "0.62940747", "0.6272757", "0.6272706", "0.6241795", "0.6229248", "0.619484", "0.61882985", "0.6178188", "0.6153014", "0.6124411...
0.70954776
2
create method to print activities NOT on the todo list
def print_unused(db) act_list = db.execute("SELECT * FROM activities") todo_list = db.execute("SELECT activity_id FROM todo") puts "\nActivities Available (i.e. Not Being Used):" puts '*~'*20+'*' act_list.each { |act| exists = false todo_list.each{ |todo_act| exists = true if act["id"] == todo_act["activi...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_activities(db)\n\ttodo_list = db.execute(\"SELECT * FROM activities\")\n\tputs \"\\nHere are the available activities:\"\n\tputs '*~'*20+'*'\n\t# is_included = to show if the activity is in the todolist\n\ttodo_list.each { |act| puts \"#{act['id']} - #{act['name']}\" }\nend", "def printNotDone\n not...
[ "0.6752307", "0.6708826", "0.62648845", "0.61091053", "0.6073099", "0.6060141", "0.60104525", "0.59674263", "0.595976", "0.5870818", "0.5824139", "0.58098936", "0.580161", "0.57471734", "0.5739016", "0.5710414", "0.5699977", "0.5675491", "0.5657247", "0.5654133", "0.562836", ...
0.5791534
13
create method to print a menu (return choice)
def print_menu(db) puts "\nDaily To-Do List Menu" puts '*~'*20+'*' puts "Choose 1, 2, 3, or 4:" puts '1 - Add/Delete an activity to the activities list' puts '2 - Add/Delete an activity from the to-do list' puts '3 - Mark an activity as complete' puts '4 - Exit' choice = gets.chomp until ['1','2','3','4'].inde...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_menu\n puts \"Choose from the following options: \\n\n to find a candidate, type 'find id' (ex. find 1)\n to view all candidates, type 'all'\n to view all qualified candidates, type 'qualified'\n to exit, type 'quit' \n to view menu, type 'menu' \\n\\n\"\nend", "def print_menu\n puts \"Which a...
[ "0.8087462", "0.8062311", "0.7997447", "0.79343915", "0.7892585", "0.7869365", "0.78335726", "0.78223556", "0.7820456", "0.78117174", "0.77985847", "0.7770919", "0.7706984", "0.7702548", "0.7597218", "0.75859034", "0.7585326", "0.7520418", "0.75171435", "0.74949783", "0.74813...
0.0
-1
create method to add/delete activities
def add_delete puts "Would you like to ADD or DELETE? (or EXIT)" add_delete = gets.chomp.upcase until ["ADD","DELETE","EXIT"].index(add_delete) puts "Please select ADD, DELETE, or EXIT" add_delete = gets.chomp.upcase end add_delete end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_activity(activity)\n self.activities << activity\n end", "def activity\n end", "def add_activity(activity)\n @activities.push activity\n end", "def create_activity\n player = Player.find_or_create_by(email:req_params[:email])\n project = Project.find_by(name:req_params[:project])\...
[ "0.70978326", "0.6356792", "0.62846124", "0.6228803", "0.61993927", "0.6191703", "0.6149299", "0.6148722", "0.612424", "0.6047075", "0.60438323", "0.60412484", "0.5988405", "0.59823626", "0.5975831", "0.59740674", "0.5970184", "0.593079", "0.59249645", "0.5920347", "0.5916344...
0.0
-1
create method to wipe table clean (always double checks!)
def delete_table(db) puts ('Are you sure you want to wipe the table? (y/n)') if gets.chomp == 'y' db.execute("DELETE FROM todo") db.execute("DELETE FROM log") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clean\n tables.clean if tables\n end", "def clear!\n transaction do\n Schema::TABLES.each do |table|\n execute(\"DELETE FROM #{table}\")\n execute(\"DELETE FROM sqlite_sequence WHERE name = '#{table}'\") # reset the auto-increment sequence\n end\n end\n self...
[ "0.7901885", "0.7515926", "0.74645084", "0.7411571", "0.7339178", "0.7339178", "0.7333546", "0.7314411", "0.7298825", "0.72504383", "0.7246644", "0.71530396", "0.7121897", "0.7060673", "0.6994745", "0.6982442", "0.69094425", "0.6905058", "0.6902693", "0.68975234", "0.6892051"...
0.0
-1
That is, each substring must consist of the same sequence of characters forwards as it does backwards. The return value should be arranged in the same sequence as the substrings appear in the string. Duplicate palindromes should be included multiple times. You may (and should) use the substrings method you wrote in the...
def substrings(str) results = [] list_of_chars = str.chars next_index = 0 loop do break if list_of_chars[next_index] == nil list_of_chars.each_with_index do |char, index| next if index < next_index results << list_of_chars.slice(next_index..index).join end next_index += 1 end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindromes(string)\n all_substrings = all_substrings(string)\n palindromes = []\n all_substrings.each do |substring|\n palindromes << substring if substring == substring.reverse && substring.length > 1\n end\n palindromes\nend", "def palindromes(string)\n all_substrings = substrings(string)\n resu...
[ "0.84193134", "0.8350783", "0.83448", "0.8255617", "0.82379454", "0.8193817", "0.8175227", "0.81724036", "0.81286305", "0.80718994", "0.8002615", "0.7940234", "0.78660643", "0.783553", "0.7819947", "0.7815859", "0.78008103", "0.7778751", "0.77723664", "0.776401", "0.77524316"...
0.0
-1
Returns an array object of the friend ids of your friends. ==== Examples current_user.friend!(target_user) current_user.friend_ids.include?(target_user.id) => true
def friend_ids @_friend_ids ||= (@_raw_friend_hashes ? @_raw_friend_hashes.keys : raw_friend_ids).map(&:to_i) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend_ids(options={})\n perform_get(\"friends/ids.#{Twitter.format}\", options)\n end", "def friends_ids(user = nil, params = {})\n args = [user, params]\n get path_from_args('friends/ids', args), params_from_args(params)\n end", "def friends_ids\n self.friends_ids_hash.keys rescue []\n ...
[ "0.75614804", "0.75157446", "0.73958796", "0.7327516", "0.7266665", "0.72547525", "0.7228474", "0.72210324", "0.72125703", "0.71789837", "0.7173268", "0.71665436", "0.71392065", "0.71264696", "0.7107919", "0.707553", "0.70312065", "0.7004226", "0.69710296", "0.69521487", "0.6...
0.77336663
0
Returns an collection of user ressources(ActiveRecord::Relation). ==== Examples current_user.friends => [, , ...] current_user.friends.first => current_user.friends.class => ActiveRecord::Relation
def friends @_friends ||= Friendable.resource_class.where(:id => friend_ids) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_friends\n return self.users\n end", "def get_friends_list\n friends = self.friendships\n friends = friends.map do |friendship|\n User.find(friendship.friend_id)\n end\n end", "def users\n\t\t\telems = []\n\t\t\tget_resource_link(:users, \"users\", \"user\").each do |data|\n\t\t\t\tel...
[ "0.69392425", "0.6729528", "0.6307261", "0.6205045", "0.62006533", "0.6192535", "0.6152565", "0.6118506", "0.6107898", "0.6084926", "0.6053103", "0.603469", "0.603062", "0.6027738", "0.59870505", "0.5986474", "0.5982892", "0.59807676", "0.5976477", "0.5964808", "0.5924116", ...
0.6814591
1
Returns an array of friendship objects. Currently this method does not support pagination. ==== Examples current_user.friendships => [, ...] current_user.friendships.first => current_user.friendships.class => Array
def friendships @_friendships ||= Friendable.resource_class.find(raw_friend_hashes.keys).map do |resource| Friendship.deserialize!(self, resource, raw_friend_hashes[resource.id.to_s]) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_friends_list\n friends = self.friendships\n friends = friends.map do |friendship|\n User.find(friendship.friend_id)\n end\n end", "def friends\n all_friends = [];\n self.friendships.each do |ship|\n if ship.status == 'approved'\n friend_id = get_friend_id_from_friendship(...
[ "0.7728204", "0.76766676", "0.74570173", "0.7417317", "0.71987695", "0.7069577", "0.7045572", "0.69550234", "0.6923778", "0.68169856", "0.6815617", "0.6815617", "0.6815617", "0.6815617", "0.68033415", "0.6733484", "0.6692573", "0.66665846", "0.66457343", "0.6633361", "0.65934...
0.7411228
4
Returns the number of the user's friends. ==== Examples current_user.friends_count => 0 current_user.friend!(target_user) current_user.friends_count => 1
def friends_count @_raw_friend_ids.try(:count) || @_raw_friend_hashes.try(:count) || redis.hlen(friend_list_key) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_friends\n self.invited(false).count + self.invited_by(false).count\n end", "def total_friends\n (friend_ids + inverse_friend_ids).count\n end", "def get_counts\n #1 - @friend_count -> gets the number of current friends you have.\n @friend_count = current_user.active_friends.size...
[ "0.79203266", "0.7897694", "0.7698246", "0.7347775", "0.71903193", "0.7079192", "0.7057469", "0.6766661", "0.6613669", "0.6563853", "0.65260583", "0.65177345", "0.6493448", "0.64569014", "0.642903", "0.63853717", "0.6375521", "0.63388604", "0.6332101", "0.6323639", "0.63207",...
0.7988645
0
Returns if the given user is friend of you or not. ==== Examlpes current_user.friend?(target_user) => false current_user.friend!(target_user) current_user.friend?(target_user) => true
def friend?(resource) @_raw_friend_ids.try(:include?, resource.id.to_s) || @_raw_friend_hashes.try(:has_key?, resource.id.to_s) || redis.hexists(friend_list_key, resource.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend_of?(user)\n friends.include?(user)\n end", "def friend?(user)\n friends.include?(user)\n end", "def friend_with?(user)\n friends.include?(user)\n end", "def friend?(other_user)\n friends_with.include?(other_user)\n end", "def mutual_friend?(user)\n if !user.i...
[ "0.8572355", "0.84683573", "0.84187645", "0.83897865", "0.8334408", "0.8312309", "0.8226882", "0.8195263", "0.8190715", "0.8175868", "0.8074951", "0.8049076", "0.8029754", "0.80134547", "0.8011438", "0.78495175", "0.7725318", "0.7711681", "0.7694759", "0.7693456", "0.76823944...
0.69788563
52
Removes the given user from your friend list. If the given user is not a friend of you, it doesn't affect anything. ==== Examples current_user.friend!(target_user) current_user.friends.include?(target_user) => true current_user.unfriend!(target_user) current_user.friends.include?(target_user) => false
def unfriend!(resource) redis.multi do redis.hdel(friend_list_key, resource.id) redis.hdel(resource.friend_list_key, self.id) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unfriend(user)\n friend_name = extract_string(user, :username)\n friend_request 'unfriend', :container => current_user.full_name, :name => friend_name, :type => :friend\n end", "def removeFriend(user)\n method = 'removeFriend'\n type = Boolean\n args = {:user=>user}\n r...
[ "0.7708889", "0.758356", "0.7532463", "0.75101024", "0.7492596", "0.73663086", "0.72547925", "0.71783185", "0.7167073", "0.7154622", "0.71411294", "0.7116158", "0.7113098", "0.70425403", "0.7035603", "0.7012798", "0.701164", "0.6964128", "0.69155025", "0.6911738", "0.6842733"...
0.66411096
32
This is an internal method called every time Notifications needs to send a notification/mail.
def send_devise_notification(notification, *args) ActiveSupport::Deprecation.warn "send_devise_notification" =begin ActiveSupport::Deprecation.warn "#{notification}" ActiveSupport::Deprecation.warn "#{self}" ActiveSupport::Deprecation.warn "po zmianach" =end method = self.class.n...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_notifications\n end", "def send_notification\n\n\n end", "def send_notifications!\n NotificationMailer.job_notification(account_manager, self).deliver_later\n end", "def send_notification\n unless development?\n recipient_email = Hacker.first(:username => self.recipient).email\...
[ "0.7684343", "0.76061225", "0.73854125", "0.7295207", "0.7234911", "0.7115451", "0.7064101", "0.7024194", "0.698333", "0.69586253", "0.6951491", "0.69477344", "0.69449806", "0.6933715", "0.6923101", "0.6888699", "0.68805313", "0.6872127", "0.6866028", "0.68585926", "0.684031"...
0.6583188
37
add to movies_controller.rb, anywhere inside 'class MoviesController < ApplicationController':
def search_tmdb # hardwire to simulate failure flash[:warning] = "'#{params[:search_terms]}' was not found in TMDb." redirect_to movies_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_movie\n # create an instance variable that can be accessed in\n # every action.\n @movie = Movie.find(params[:movie_id])\n end", "def show\n @movie = Movie.find(params[:id])\n @movie.extend Europe::Currency\n #class << @movie\n # include Europe::Currency\n #end \n ...
[ "0.6235438", "0.62118703", "0.6178408", "0.61047626", "0.61047626", "0.61047626", "0.61047626", "0.61047626", "0.61047626", "0.61047626", "0.61047626", "0.61047626", "0.61047626", "0.6049501", "0.6044343", "0.6031106", "0.6016884", "0.6016884", "0.6016884", "0.6016884", "0.60...
0.0
-1
use FIELDS.join(", ") instead of uid to select other datas
def friends Fql.query("SELECT uid FROM user WHERE uid IN (SELECT uid2 FROM friend WHERE uid1=#{self.fb_id}) AND has_added_app = 1") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc_field_joiner(document, field, joiner = \", \")\n Array.wrap(document.fetch(field, [])).join(joiner)\n end", "def string_field_names\n # database_field_names.join(', ')\n database_field_names.to_s[1...-1]\n end", "def join_query(from, to, field, value)\n \"_query_:\\\"{!join from=#{from} to...
[ "0.623509", "0.60771096", "0.5885297", "0.5871128", "0.585471", "0.5852548", "0.5848508", "0.57560027", "0.5733461", "0.56974924", "0.5609746", "0.55639833", "0.5557834", "0.55356985", "0.5535649", "0.55182654", "0.5517723", "0.5501518", "0.5497223", "0.5490499", "0.54904824"...
0.0
-1
GET /water_points GET /water_points.xml
def index =begin list of water points, paginated. filter by up_score (default), commented, recent. up_score, commented: pagination only while num is greater than zero -------- But also, reuse this for the JSON calls used to populate homepage map. “all”, “most verified”, “most visited”, “most commented” “most ver...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end", "def index\n @page_title = \"Data Points\"\n @data_points = DataPoint.all\n\n respond_to do |format|\n format.html # index.ht...
[ "0.660494", "0.61900705", "0.6112338", "0.6107947", "0.6089268", "0.59018326", "0.5892811", "0.5890958", "0.58139974", "0.5802383", "0.57383126", "0.5722937", "0.5662698", "0.5662641", "0.56401575", "0.5639857", "0.5637348", "0.5637256", "0.56332296", "0.56330806", "0.5611793...
0.0
-1
GET /water_points/1 GET /water_points/1.xml
def show @water_point = WaterPoint.visible.find(params[:id]) rescue (redirect_to water_points_path; return) @comments = @water_point.comments.visible @current_vote = current_user && Vote.find_by_user_id_and_water_point_id(@current_user.id, @water_point.id) @subscribed = current_user && Follower.find_by_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @points = Point.all\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @points }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", ...
[ "0.6449487", "0.63030136", "0.61735106", "0.6162044", "0.6020682", "0.60133094", "0.60082984", "0.59679013", "0.59204", "0.5861297", "0.58442473", "0.5825758", "0.5816385", "0.5708536", "0.56993705", "0.5696469", "0.56880265", "0.5680243", "0.56392044", "0.56370157", "0.56266...
0.5457343
46
GET /water_points/new GET /water_points/new.xml
def new @water_point = WaterPoint.new respond_to(:html,:iphone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @point = Point.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n end", "def new\n @point = Point.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @point }\n end\n en...
[ "0.7251791", "0.7237775", "0.7090446", "0.70502555", "0.6992207", "0.68938875", "0.6881321", "0.6814966", "0.6767217", "0.67444307", "0.6706505", "0.6705518", "0.6658031", "0.6612994", "0.6596815", "0.6572635", "0.6572635", "0.656524", "0.6564974", "0.65470403", "0.6540962", ...
0.0
-1
POST /water_points POST /water_points.xml
def create params[:water_point][:user_id] = @current_user.id # If GPS coords found, save as confirmed and skip confirmation page? if params[:photo_file] && !params[:photo_file].blank? @photo = Photo.new(:uploaded_data => params[:photo_file]) @coords = @photo.getGPS # If photo GP...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @point = Point.new(params[:point])\n\n respond_to do |format|\n if @point.save\n format.html { redirect_to(@point, :notice => 'Point added') }\n format.xml { render :xml => @point, :status => :created, :location => @point }\n else\n format.html { render :action =>...
[ "0.6104459", "0.60528517", "0.5966691", "0.5926846", "0.5873609", "0.58628213", "0.5835942", "0.5828252", "0.58236027", "0.5717078", "0.5716798", "0.5699469", "0.56950885", "0.5669812", "0.5658417", "0.56314814", "0.5551148", "0.554493", "0.553241", "0.55196095", "0.5504863",...
0.5974009
2
PUT /water_points/1 PUT /water_points/1.xml
def update @water_point = WaterPoint.find_by_id_and_user_id(params[:id], @current_user.id) ####Begin: adjust for an update #@user = current_user @photo = @water_point.photo #default is whatever photo (if any) already exists if params[:photo_file] && !params[:photo_file...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @point = Point.find(params[:id])\n \n respond_to do |format|\n if @point.update_attributes(params[:point])\n format.html { redirect_to(@point, :n...
[ "0.6563839", "0.6333827", "0.63063854", "0.62154037", "0.6071682", "0.6062792", "0.6037789", "0.6014172", "0.6011791", "0.59782827", "0.59311736", "0.5919805", "0.58778864", "0.5876153", "0.5872165", "0.58650434", "0.5851904", "0.5834794", "0.5796335", "0.57892257", "0.576333...
0.6233651
3
DELETE /water_points/1 DELETE /water_points/1.xml
def destroy @water_point = WaterPoint.find_by_id(params[:id]) @water_point.destroy respond_to do |format| format.any(:html,:iphone) { redirect_to(water_points_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.html { redirect_to(points_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @point = Point.find(params[:id])\n @point.destroy\n\n respond_to do |format|\n format.h...
[ "0.6536861", "0.6536861", "0.6536861", "0.644524", "0.6422725", "0.63937306", "0.63504833", "0.63151777", "0.6311458", "0.6238154", "0.62341475", "0.62105644", "0.61894894", "0.6169015", "0.6166753", "0.61525744", "0.6103941", "0.6040514", "0.6040429", "0.60403585", "0.603549...
0.6702665
0
Hide waterpoint from view
def disable @water_point = WaterPoint.find_by_id_and_user_id(params[:id], @current_user.id) @water_point.delete! respond_to do |format| format.any(:html,:iphone) { redirect_to water_points_path } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide\n self.visible = false\n clear_dmg_preview\n end", "def hide_object\n @location.opacity = 0\n @circlel.opacity = 0\n end", "def hide!\n visible(false)\n end", "def hide!\n visible(false)\n end", "def hide; end", "def hide; end", "def unhide!\n update_at...
[ "0.69195443", "0.6793941", "0.67929316", "0.67929316", "0.67229706", "0.67229706", "0.6604883", "0.6604883", "0.6604883", "0.65721977", "0.65283", "0.64932686", "0.6464146", "0.64420027", "0.64229226", "0.64229226", "0.6411165", "0.63992953", "0.6371736", "0.6350978", "0.6347...
0.0
-1
:nodoc: converts an object into an event. The object must be a hash or a String.
def marshal(object) expect! object => [ String, Hash ] if object.is_a?(String) object = { :data => object } end # sort all entries in a way, that make sure that event, id, data # are at the end. This makes sure that confirming clients just # ignore the extra entries. If we would ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def type_from_object( object, block=nil )\n\t\tcase object\n\t\twhen Module\n\t\t\tself.log.debug \"Deriving a type from module %p\" % [ object ]\n\t\t\treturn self.type_from_module( object )\n\n\t\twhen Method, UnboundMethod\n\t\t\tself.log.debug \"Deriving a type from method %p\" % [ object ]\n\t\t\treturn self....
[ "0.602635", "0.5887981", "0.5887516", "0.58450335", "0.58263266", "0.5643125", "0.5600897", "0.5600897", "0.5568503", "0.5567319", "0.556724", "0.5541754", "0.55343455", "0.5529086", "0.55191565", "0.54861903", "0.5465431", "0.5461909", "0.5393767", "0.53596336", "0.5345236",...
0.542081
18
Unmarshals a single event in data. The string SHOULD NOT contain multipe events, or else the returned hash somehow mangles all these events into a single one.
def unmarshal(data) event = Hash.new { |hash, key| hash[key] = [] } data.split("\n").each do |line| key, value = line.split(/: ?/, 2) next if key =~ /^\s*$/ event[key.to_sym] << value end event.inject({}) do |hash, (key, value)| hash.update key => value.join("\n") end en...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_hash(e)\n timber_hash = {\"$schema\" => JSON_SCHEMA}\n event_hash = e.to_hash\n\n # Delete unused logstash specific attributes\n event_hash.delete(\"@version\")\n\n # Map the timber key first since we merge in values\n # later.\n timber = event_hash.delete(\"timber\")\n...
[ "0.6095066", "0.59918064", "0.59263605", "0.58738875", "0.5742203", "0.5739154", "0.5726891", "0.5695844", "0.5633391", "0.55948776", "0.5576572", "0.5557505", "0.5456383", "0.5428907", "0.5393831", "0.5379302", "0.5356766", "0.53193635", "0.5303784", "0.529286", "0.5288544",...
0.6298207
0
Extract all events from a data stream.
def unmarshal_all(data) data.split(/\n\n/). map { |event| unpack(event) }. reject(&:empty?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_events(stream, max_events, start_time, end_time, filter)\n result = @backend.read_events(stream.joule_id, max_events, start_time, end_time, filter)\n {id: stream.id, valid: true, count: result[:count], events: result[:events]}\n end", "def append_events(type_identifier, stream)\n if ...
[ "0.635683", "0.62508297", "0.58565664", "0.5835209", "0.5830066", "0.57674634", "0.57611483", "0.57537615", "0.5650108", "0.5641807", "0.56188655", "0.5609542", "0.5567474", "0.5538365", "0.55272853", "0.5518313", "0.5472932", "0.5462593", "0.5441747", "0.5435835", "0.5379231...
0.6622877
0
request.format.html? returns 5 when the request format is video.
def treat_as_standard_html_request? !request.format.json? and !request.format.print? and !request.format.video? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def video?\n !!( content_type =~ Transit.config.video_regexp )\n end", "def video?\n codec_type == 'video'\n end", "def preview_type\n return \"video\" if %w(mp4 m4v mov flv avi asf).include?(format)\n return \"audio\" if !format.blank?\n return nil\n end", "def is_video_type?\n ...
[ "0.74495554", "0.72337365", "0.72107244", "0.72092646", "0.7093452", "0.7088194", "0.6816326", "0.6802817", "0.6698725", "0.65160424", "0.65001625", "0.65001625", "0.64803576", "0.6440621", "0.634792", "0.6343862", "0.6306375", "0.63019764", "0.62669986", "0.62599725", "0.624...
0.59426296
31
Percentage of the urban area land area.
def percent_urban_area_land_area land_area / urban_area.land_area end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def percent_land\n land_area / total_area if land_area\n end", "def percent_urban_area_total_area\n total_area / urban_area.total_area\n end", "def percent_county_subdivision_land_area\n land_area / county_subdivision.land_area\n end", "def percent_county_subdivision_total_area\n ...
[ "0.886322", "0.85859", "0.8389706", "0.75462794", "0.6906102", "0.6779425", "0.6725737", "0.6306506", "0.620698", "0.6204981", "0.62001216", "0.61514205", "0.61283547", "0.61173093", "0.6093943", "0.6038868", "0.6038868", "0.60282683", "0.5995994", "0.59726596", "0.59460807",...
0.9198237
0