query stringlengths 7 6.41k | document stringlengths 12 28.8k | metadata dict | negatives listlengths 30 30 | negative_scores listlengths 30 30 | document_score stringlengths 5 10 | document_rank stringclasses 2
values |
|---|---|---|---|---|---|---|
Returns product and sets the selection if idle and is passed an avilable product name. Returns error message otherwise. | def set_product(product_name)
if can_select_product?(product_name)
@selection = product_from_name(product_name)
else
get_selection_error(product_name)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select_product\n puts Rainbow(' > ').black.underline.bg(:yellow) + 'Type your choice:'\n choice = ''\n coins = false\n while choice\n choice = gets.chomp\n @machine.check_for_product(choice) == 1 ? buy_product(choice, coins) : [intro, menu_setting]\n end\n end",
"def getProduct(sele... | [
"0.6322214",
"0.631357",
"0.6093309",
"0.609074",
"0.5943327",
"0.58666825",
"0.58143026",
"0.57797986",
"0.5766186",
"0.5718333",
"0.56373525",
"0.5622989",
"0.56113183",
"0.55957174",
"0.5548305",
"0.5544715",
"0.5528961",
"0.5524318",
"0.55130875",
"0.55033576",
"0.5498128... | 0.7986049 | 0 |
Verifies that all commits on the master are found correct and only commit from master. | def test_check_commit_found_on_master
pp "******************************************************"
pp " test_check_commit_found_on_master"
pp "******************************************************"
require_relative '../../../lib/core'
settings_file = File.join(File.dirname(__FILE__), '../.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify_commits expected_commits\n expected_commits.diff! commits_in_current_repo(expected_commits.headers)\nend",
"def check_commit\n return if @tree\n \n data = @base.lib.commit_data(@objectish)\n set_commit(data)\n end",
"def check_for_clean\n # can't believ... | [
"0.6296082",
"0.6279788",
"0.6250148",
"0.6159221",
"0.61335546",
"0.6014643",
"0.6010535",
"0.59902745",
"0.58553904",
"0.58553904",
"0.5667437",
"0.5625265",
"0.5604339",
"0.56021476",
"0.55866754",
"0.5549274",
"0.55182916",
"0.55079675",
"0.54852587",
"0.54807633",
"0.546... | 0.7039958 | 0 |
The PageSetUpPr for this sheet pr object | def page_setup_pr
@page_setup_pr ||= PageSetUpPr.new
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def write_page_setup(writer) # :nodoc:\n return unless @page_setup_changed\n\n attributes = []\n attributes << ['paperSize', @paper_size] if @paper_size\n attributes << ['scale', @scale] if @scale != 100\n attributes << ['fitToWidth', @fit_width] ... | [
"0.6380353",
"0.61611927",
"0.5849215",
"0.5825996",
"0.5808553",
"0.56277966",
"0.55965996",
"0.55284935",
"0.550111",
"0.5480966",
"0.5465234",
"0.54491436",
"0.54381704",
"0.5410607",
"0.54049593",
"0.53826904",
"0.53826904",
"0.53455436",
"0.5336388",
"0.53250945",
"0.531... | 0.7918555 | 0 |
The board at the current state of the game. | def board
game.board
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def current_board\n @current_board\n end",
"def get_board\n @board\n end",
"def get_board\n return @board_of_stone\n end",
"def board\n # Returns a printed copy of the board\n end",
"def board\n @board = Trello::Board.find(@board_id) if @board == nil\n\n @board\n end",
"def g... | [
"0.8009747",
"0.7911797",
"0.7841565",
"0.7690836",
"0.7607766",
"0.76053476",
"0.75678205",
"0.7537692",
"0.7534143",
"0.75050807",
"0.7472906",
"0.74450684",
"0.7444721",
"0.74221164",
"0.74207026",
"0.72905356",
"0.72904944",
"0.72636724",
"0.7222657",
"0.7077769",
"0.7059... | 0.8448132 | 0 |
Returns true if the capturing pawn can en passant in the file provided. | def opportunity_in_file?(file)
game_has_started? &&
capturing_pawn_at_its_fifth_rank? &&
opponent_pawn_in_same_rank_at_file?(file) &&
opponent_pawn_was_in_starting_rank_last_move_at_file?(file)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opponent_pawn_in_same_rank_at_file?(file)\n at_square = board.at_square(\"#{file}#{current_position.rank}\")\n opponent_pawn?(at_square)\n end",
"def valid?\n return false if preservation_file.nil?\n (parent.try(:recording?) || parent.try(:image_resource?)) && supported_format?\n end",
... | [
"0.6375396",
"0.6323349",
"0.62485325",
"0.6216181",
"0.62088394",
"0.6171151",
"0.6105363",
"0.5998749",
"0.59722143",
"0.59676296",
"0.5967046",
"0.59298164",
"0.5897494",
"0.5888597",
"0.58868",
"0.58820164",
"0.5865745",
"0.5847405",
"0.58447284",
"0.5841724",
"0.58337015... | 0.6939494 | 0 |
Returns true if the capturing pawn is at its fifth rank. | def capturing_pawn_at_its_fifth_rank?
fifth_rank = capturing_pawn.starting_rank + (3 * capturing_pawn.rank_direction)
current_position.rank == fifth_rank
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def straight(ranks)\n return (ranks.max - ranks.min) == 4 && ranks.uniq.size == 5\nend",
"def someone_has_won_5_games?(game_count)\n if game_count[:player_wins] >= WINNING_SCORE\n false\n elsif game_count[:dealer_wins] >= WINNING_SCORE\n false\n else\n true\n end\nend",
"def five_of_a_kind?\n ... | [
"0.66014266",
"0.6443576",
"0.644146",
"0.64284754",
"0.6406987",
"0.63220644",
"0.62927157",
"0.62927157",
"0.62927157",
"0.6285737",
"0.6237941",
"0.6206722",
"0.6204836",
"0.6170376",
"0.61534274",
"0.615311",
"0.6142112",
"0.6133193",
"0.6122073",
"0.60951173",
"0.6094266... | 0.9352944 | 0 |
Returns true if there is an opposite color pawn in the same rank as the capturing pawn and in the file specified. | def opponent_pawn_in_same_rank_at_file?(file)
at_square = board.at_square("#{file}#{current_position.rank}")
opponent_pawn?(at_square)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opposing_piece?(rank, file, data)\n return unless valid_location?(rank, file)\n\n piece = data[rank][file]\n piece && piece.color != color\n end",
"def opponent_pawn_was_in_starting_rank_last_move_at_file?(file)\n last_board = board_at_last_move\n at_square = last_board.at_square(\"#{fil... | [
"0.7637191",
"0.72793525",
"0.68939596",
"0.64303595",
"0.5982324",
"0.5969338",
"0.5937941",
"0.5902356",
"0.5884996",
"0.5854278",
"0.5834539",
"0.5826995",
"0.58095235",
"0.5732082",
"0.5724402",
"0.5693152",
"0.56903124",
"0.56643283",
"0.56568044",
"0.5626106",
"0.562346... | 0.79808235 | 0 |
Returns true if there was an opposite color pawn in the file specified last move at its starting rank. | def opponent_pawn_was_in_starting_rank_last_move_at_file?(file)
last_board = board_at_last_move
at_square = last_board.at_square("#{file}#{opponent_pawn_starting_rank}")
opponent_pawn?(at_square)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opponent_pawn_in_same_rank_at_file?(file)\n at_square = board.at_square(\"#{file}#{current_position.rank}\")\n opponent_pawn?(at_square)\n end",
"def opposing_piece?(rank, file, data)\n return unless valid_location?(rank, file)\n\n piece = data[rank][file]\n piece && piece.color != colo... | [
"0.75471365",
"0.72912127",
"0.66322017",
"0.65191734",
"0.65049905",
"0.6465271",
"0.64607155",
"0.63973236",
"0.63733816",
"0.63567185",
"0.6282014",
"0.61920184",
"0.6191603",
"0.6185545",
"0.6153681",
"0.6149936",
"0.61350083",
"0.61001164",
"0.6080992",
"0.60219055",
"0.... | 0.80677754 | 0 |
The starting rank of opponent pawns. | def opponent_pawn_starting_rank
color = capturing_pawn.opposite_color
Pawn.starting_ranks[color]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_rank\n list = self.tournament.rounds.to_a;\n #this list will be chronological already\n\n i = 0;\n while list[i].id != self.id\n i = i + 1;\n end\n return (i + 1);\n end",
"def determine_starting_player\n @current_player_index = rand(0..num_players - 1)\n put... | [
"0.6909989",
"0.66332746",
"0.6521211",
"0.6479681",
"0.6479681",
"0.64236677",
"0.6415711",
"0.6408862",
"0.63885725",
"0.63535666",
"0.6346675",
"0.6310281",
"0.6281516",
"0.6281516",
"0.62528026",
"0.6245796",
"0.6217372",
"0.6213504",
"0.61665726",
"0.6160451",
"0.6157335... | 0.8683185 | 0 |
Returns true if the argument is a type of pawn and is the opposite color of the capturing pawn. | def opponent_pawn?(variable)
variable.kind_of?(Pawn) && capturing_pawn.opponent?(variable)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pawn_direction? piece, square\n if piece.color == 0\n if square.coordinate[0] > piece.square.coordinate[0]\n true\n else\n false\n end\n elsif piece.color == 1\n if square.coordinate[0] < piece.square.coordinate[0]\n ... | [
"0.6942337",
"0.6712875",
"0.6689987",
"0.6627637",
"0.6611648",
"0.6595204",
"0.6560653",
"0.65022177",
"0.6470896",
"0.6421573",
"0.6387714",
"0.638242",
"0.6331785",
"0.6330295",
"0.6280089",
"0.6259179",
"0.6200421",
"0.61752313",
"0.61674845",
"0.6161425",
"0.6126603",
... | 0.6793663 | 1 |
The current position of the capturing pawn. | def current_position
board.coordinates_of(capturing_pawn)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_current_position\n [@current_X_pos, @current_Y_pos]\n end",
"def screen_position\n position\n end",
"def cur_position\n MSPhysics::Newton::Corkscrew.get_cur_position(@address)\n end",
"def pos\n @position[:current]\n end",
"def current_position\n return super if... | [
"0.7411524",
"0.7271806",
"0.70581424",
"0.7054495",
"0.70241326",
"0.699729",
"0.6955633",
"0.69354516",
"0.69248265",
"0.6869452",
"0.6869452",
"0.68417925",
"0.68332326",
"0.6826521",
"0.6769814",
"0.6769634",
"0.6758344",
"0.67298",
"0.67179275",
"0.67157054",
"0.671013",... | 0.8939672 | 0 |
Returns an array af adjacent files from the current position. | def adjacent_files
current_position.adjacent_files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def adjacent_files\n files = []\n files << file_names[x - 1] unless file == :a\n files << file_names[x + 1] unless file == :h \n files\n end",
"def files\n ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h']\n end",
"def path_array\n a = []\n each_filename { |ea| a << ea }\n a\n end",... | [
"0.7870118",
"0.6243689",
"0.60271907",
"0.56946635",
"0.56917024",
"0.5548287",
"0.5499548",
"0.5463876",
"0.54625183",
"0.5455427",
"0.5435287",
"0.5428815",
"0.5393933",
"0.53810453",
"0.53434354",
"0.5324195",
"0.5311334",
"0.53078777",
"0.5249564",
"0.5249564",
"0.523597... | 0.8106935 | 0 |
PUT /steps/1 PUT /steps/1.json | def update
@step = @guide.steps.find(params[:id])
respond_to do |format|
if @step.update_attributes(params[:step])
format.html { redirect_to [@guide, @step], notice: 'Step was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @step = Step.find(params[:id])\n\n respond_to do |format|\n if @step.update_attributes(params[:step])\n format.html { redirect_to @step, notice: 'Step was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n... | [
"0.71486837",
"0.71139836",
"0.7111173",
"0.70837206",
"0.7008954",
"0.69490093",
"0.69418067",
"0.69107723",
"0.69107723",
"0.6817372",
"0.6745666",
"0.6742958",
"0.6680867",
"0.6678082",
"0.66234124",
"0.6622548",
"0.65830725",
"0.6567716",
"0.65581816",
"0.6533348",
"0.652... | 0.72609127 | 0 |
When an order item is updated, its subitems must be updated to reflect the new amount according to the component entries of the product on this order item. | def reset_subitems!
entries = product.component_entries
subitems.each do |subitem|
component = entries.find_by(component: subitem.product)
subitem.update! amount: amount * component.quantity
end
reload
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_order_item\n \n end",
"def update_subtotal_items!\n subtotal = @customer_order.order_items.collect do |order_item|\n order_item.cache_provider_item_precio!\n order_item.subtotal\n end.sum\n @customer_order.assign_attributes(\n subtotal_item... | [
"0.74980646",
"0.68738425",
"0.682203",
"0.66537863",
"0.64607084",
"0.64203036",
"0.6419639",
"0.64191943",
"0.6380198",
"0.6362016",
"0.6296732",
"0.6252791",
"0.62257636",
"0.6217277",
"0.6216241",
"0.620981",
"0.6199507",
"0.6139914",
"0.6113993",
"0.61111253",
"0.6108923... | 0.73270386 | 1 |
Price without tax deducts the tax portion if it's included in the attribute. | def price_sans_tax
price_as_price.sans_tax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unit_price_without_tax\n unit_price - tax_amount\n end",
"def price_with_tax\n price_as_price.with_tax\n end",
"def payment_price_tax\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def cart_price_sans_tax\n return nil if part_of_package?\n return price_with_subitems(:price_sans_tax) if package?\n ... | [
"0.78263724",
"0.735478",
"0.7307823",
"0.730763",
"0.7095137",
"0.70057654",
"0.6938514",
"0.6899924",
"0.6863935",
"0.6810639",
"0.67872506",
"0.6750941",
"0.674428",
"0.6688049",
"0.6651841",
"0.664905",
"0.6545431",
"0.64545274",
"0.64523625",
"0.6430308",
"0.6399353",
... | 0.775753 | 1 |
Tax is calculated from the price attribute, which may include tax. | def tax
price_as_price.tax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calcuate_tax\n @price * 0.12\n end",
"def tax_calc\n tax = @quantity * @price * @taxe\n end",
"def price_with_tax\n price_as_price.with_tax\n end",
"def tax\n price.to_f * 0.09\n end",
"def tax\n rate = 0.09\n tax_amount = (price.to_f * rate)\n retur... | [
"0.828203",
"0.8271596",
"0.8264809",
"0.8171299",
"0.812105",
"0.79753155",
"0.7872846",
"0.7752286",
"0.7695314",
"0.7646358",
"0.7574869",
"0.75557005",
"0.7554443",
"0.7540488",
"0.7516881",
"0.7489898",
"0.747459",
"0.7450824",
"0.7417762",
"0.74139833",
"0.74055135",
... | 0.8540563 | 0 |
Price with tax adds the tax portion if it wasn't included. | def price_with_tax
price_as_price.with_tax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def taxify price\n (price * Store::tax_rate) + price\n end",
"def payment_price_tax\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"def tax\n price.to_f * 0.09\n end",
"def full_price\n price + tax_evaluation\n end",
"def calcuate_tax\n @price * 0.12\n end",
"def calculate_tax\n if... | [
"0.733431",
"0.7278556",
"0.7147785",
"0.71390265",
"0.7114381",
"0.70828813",
"0.70750344",
"0.7065401",
"0.70283574",
"0.70186645",
"0.7011363",
"0.6990594",
"0.69787115",
"0.697097",
"0.6942703",
"0.69271284",
"0.6924286",
"0.6899946",
"0.68893564",
"0.68843895",
"0.688251... | 0.78443724 | 0 |
Prices and subtotals seen in cart context, where packages show a single price for the parent item and no prices for subitems. | def cart_price_sans_tax
return nil if part_of_package?
return price_with_subitems(:price_sans_tax) if package?
price_sans_tax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_price\n # convert to array so it doesn't try to do sum on database directly\n items.to_a.select{|item|item.parent_id.nil?}.sum(&:full_price)\n end",
"def sub_total_price\n line_items.inject(0) {|sum, item| sum += item.price * item.qty }\n end",
"def sub_total\n return Applic... | [
"0.67982656",
"0.6725478",
"0.63195485",
"0.6190278",
"0.61293167",
"0.61211413",
"0.61033285",
"0.607347",
"0.607347",
"0.60527277",
"0.6010595",
"0.6000683",
"0.597173",
"0.59638697",
"0.59277654",
"0.5898477",
"0.5878856",
"0.5871485",
"0.5865854",
"0.5862001",
"0.58572793... | 0.7157394 | 0 |
Grand totals include adjustments. | def grand_total_sans_tax
(subtotal_sans_tax || 0.to_money) + adjustments_sans_tax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def grand_total\n order_lines.inject(Money.new(0)) { |grand_total, line| grand_total + line.total_price }\n end",
"def update_totals\n # update_adjustments\n self.payment_total = payments.completed.map(&:amount).sum\n self.item_total = line_items.map(&:amount).sum\n \n self.adjustment_tot... | [
"0.74700314",
"0.72715896",
"0.7122882",
"0.708798",
"0.69812185",
"0.6948964",
"0.693053",
"0.69284177",
"0.6904544",
"0.6899445",
"0.6890401",
"0.68821275",
"0.68521655",
"0.68514335",
"0.68407524",
"0.68372554",
"0.6826184",
"0.6821099",
"0.68143874",
"0.68115956",
"0.6787... | 0.7450218 | 1 |
Price including subitems using given method on each. | def price_with_subitems(method)
send(method) + subitems.map { |i| i.send(method) }.sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def subtotal\n items.map(&:price).reduce(&:+)\n end",
"def sub_total\n sum = 0\n line_items.each do |line_item|\n sum += line_item.total_price\n end\n sum\n end",
"def total_price\n self.line_items.each.sum {|li| li.total_price}\n end",
"def total_price\n items.map(&:price).sum\n... | [
"0.70894647",
"0.68723303",
"0.68477637",
"0.6810226",
"0.68075025",
"0.67088366",
"0.6660286",
"0.6592483",
"0.6569451",
"0.6517719",
"0.6501225",
"0.6404965",
"0.63926965",
"0.6391625",
"0.63500553",
"0.63435245",
"0.6331577",
"0.6301397",
"0.6301397",
"0.6301397",
"0.63013... | 0.8207534 | 0 |
Price for exported orders, always without tax. Vendor products and items from prepaid stock are listed without prices. | def price_for_export
return nil if product.vendor.present?
return nil if use_prepaid_stock? && available?
price_sans_tax
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_for_order(order)\n price\n end",
"def original_price\n order.total_price_with_taxes\n end",
"def cart_price_sans_tax\n return nil if part_of_package?\n return price_with_subitems(:price_sans_tax) if package?\n price_sans_tax\n end",
"def for_order(product)\n regular_p... | [
"0.7360594",
"0.72869915",
"0.6927398",
"0.6752067",
"0.6376007",
"0.6375535",
"0.63591206",
"0.63533324",
"0.6340056",
"0.63204604",
"0.63149285",
"0.63028574",
"0.6298732",
"0.62981814",
"0.62152934",
"0.62152934",
"0.6198714",
"0.6154993",
"0.6087671",
"0.6085424",
"0.6079... | 0.7982969 | 0 |
Updates the shipped amount from completed transfer items. | def update_shipped!
update!(shipped: completed_transfer_items.sum(:amount))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_total\n self.total = self.shipments.map(&:item_cost).sum\n end",
"def update\n update_item_count\n update_totals\n if order.completed?\n update_payment_state\n update_shipments\n update_shipment_state\n update_shipment_total\n end\n run_hook... | [
"0.74795604",
"0.67288595",
"0.6658525",
"0.6590935",
"0.6373825",
"0.63614506",
"0.63575363",
"0.63375914",
"0.6332548",
"0.6326641",
"0.62766385",
"0.62552845",
"0.6245311",
"0.6236189",
"0.62334013",
"0.6225073",
"0.6220934",
"0.6143134",
"0.6143134",
"0.6123474",
"0.61097... | 0.8688153 | 0 |
Transfer items in active shipments, shipped or not. See loaded below. | def active_transfer_items
transfer_items.joins(transfer: :shipment).merge(Shipment.active)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ship_items\n if current_user && current_user.seller\n @cart_item = CartItem.find_by(cart_id: params[:cart_id], item_id: params[:item_id])\n @cart_item.update(shipped: true)\n redirect_to buyer_orders_path\n else\n redirec_to root_path\n end\n end",
"def after_ship\n inventory... | [
"0.6889087",
"0.6701484",
"0.6698114",
"0.6579233",
"0.6556724",
"0.6542763",
"0.6540172",
"0.6456363",
"0.60990447",
"0.60509664",
"0.6031721",
"0.60072464",
"0.60023946",
"0.5982354",
"0.5941282",
"0.5899453",
"0.58751476",
"0.5870291",
"0.5848377",
"0.58470047",
"0.5839938... | 0.734731 | 0 |
This order item formatted as payload content, containing attributes that can be given to Orderinsert. See Orderapply_payload! | def as_payload
{
product: product,
amount: amount,
options: {
additional_info: additional_info
}
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def payload\n {:id => id, :body => body, :origin => origin, :original_id => original_id}\n end",
"def payload\n self.update(:payload)\n @payload\n end",
"def to_payload\n payload = [OAP_MARKER, VERSION]\n asset_quantity_count = Bitcoin::Protocol.pack_var_int(@asset_quantiti... | [
"0.6439612",
"0.62504435",
"0.61474836",
"0.6031257",
"0.60052276",
"0.600412",
"0.600412",
"0.599541",
"0.591285",
"0.5902898",
"0.5795701",
"0.57914215",
"0.57679766",
"0.57558835",
"0.5745567",
"0.5730942",
"0.5675251",
"0.5673089",
"0.56649935",
"0.56649935",
"0.56583047"... | 0.69571567 | 0 |
Date used in reports is the completion date of the order. | def report_date
order.completed_at.to_date
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def completed_date\n nil\n end",
"def invoice_date\n completed_at\n end",
"def completion_date_time\n return @completion_date_time\n end",
"def completion_date_time\n return @completion_date_time\n end",
"def date\n @completed_date = created_a... | [
"0.7098719",
"0.70841324",
"0.6891744",
"0.6891744",
"0.6733842",
"0.66609025",
"0.6568415",
"0.6516108",
"0.6516108",
"0.6516108",
"0.6516108",
"0.6516108",
"0.6516108",
"0.6496189",
"0.646447",
"0.6446446",
"0.64233994",
"0.6417559",
"0.6398433",
"0.6398433",
"0.6398433",
... | 0.83253956 | 0 |
Price represented as a Price object for tax calculations. | def price_as_price
@price_as_price ||= Price.new(price, price_includes_tax?, tax_rate)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def price_with_tax\n price_as_price.with_tax\n end",
"def price(product, amount)\n Price.new(\n amount,\n product.tax_category.tax_included?(group.price_base),\n product.tax_category.rate\n )\n end",
"def tax\n price_as_price.tax\n end",
"def price\n return 0 un... | [
"0.7357377",
"0.71618605",
"0.70509195",
"0.7011375",
"0.69860184",
"0.6919864",
"0.68012077",
"0.6794276",
"0.6780925",
"0.6774377",
"0.6760587",
"0.6698619",
"0.6696292",
"0.6693617",
"0.6673001",
"0.66723174",
"0.66419697",
"0.6639985",
"0.6623167",
"0.6616906",
"0.6607969... | 0.8621987 | 0 |
Returns the variable size of the tobegenerated sprite image. When none of the images repeat, it is simply the max variable size of all images in the sprite. When an image in the sprite is repeated, a calculation is performed based on the least common multiple of all repeated images. That least common multiple is then m... | def variable_size
@variable_size ||= if image_sets.none?(&:repeated?)
max_variable_size
else
lcm = image_sets.select(&:repeated?).collect(&variable_size_method).reduce(:lcm)
lcm * (max_variable_size / lcm.to_f).ceil
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def sprite_max\r\n (@power * 10).to_i\r\n end",
"def pre_transition_sprite_size\n return 40, 30\n end",
"def pixel_size; size.x * size.y; end",
"def tile_size level\n\t\t\t2 ** level\n\t\tend",
"def size\n \n return case \n when pixels <= (16*16)\n :tiny\n ... | [
"0.6820461",
"0.6276772",
"0.5947966",
"0.58903235",
"0.5883835",
"0.57419276",
"0.5737882",
"0.5721977",
"0.5715616",
"0.5653795",
"0.56437236",
"0.55624586",
"0.55557644",
"0.55516297",
"0.5523919",
"0.5520477",
"0.5520477",
"0.5520477",
"0.5513954",
"0.5511014",
"0.5509793... | 0.73469985 | 0 |
Merge old_user into new_user | def merge
return if old_user.nil? || new_user.nil? || old_user.id == new_user.id
copy_missing_one_to_ones
replace_old_with_new_in_groups
set_replacement_references
deactivate_old_user
faye_publisher.broadcast_to_contacts
old_faye_publisher.broadcast_to_contacts
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge_user!(other_user:)\n # these methods do not invoke callbacks, since not really needed for taking ownership\n CurationActivity.where(user_id: other_user.id).update_all(user_id: id)\n ResourceState.where(user_id: other_user.id).update_all(user_id: id)\n Resource.where(user_id: other_use... | [
"0.7306857",
"0.7011373",
"0.6930918",
"0.67998314",
"0.6545447",
"0.6420418",
"0.6394644",
"0.6335915",
"0.6330747",
"0.6279039",
"0.6213698",
"0.61062723",
"0.6079366",
"0.6011731",
"0.5996503",
"0.59286815",
"0.5876611",
"0.58487815",
"0.5745446",
"0.5742035",
"0.57294315"... | 0.7552813 | 0 |
Copy all 11s (and their messages) from the old user to the new user that the new user isn't alredy in | def copy_missing_one_to_ones
old_user.one_to_ones.each do |one_to_one|
other_user = one_to_one.other_user(old_user)
Rails.logger.debug "Attempting to copy 1-1 for user #{other_user.id} ..."
unless new_user.one_to_one_user_ids.include?(other_user.id)
Rails.logger.debug "Copying 1-1 for use... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def merge\n return if old_user.nil? || new_user.nil? || old_user.id == new_user.id\n\n copy_missing_one_to_ones\n replace_old_with_new_in_groups\n set_replacement_references\n deactivate_old_user\n faye_publisher.broadcast_to_contacts\n old_faye_publisher.broadcast_to_contacts\n end",
"def ... | [
"0.6850437",
"0.66215503",
"0.6242633",
"0.5976113",
"0.5945917",
"0.5902252",
"0.58270925",
"0.57089424",
"0.5694228",
"0.56602913",
"0.5618126",
"0.5615576",
"0.5588806",
"0.5585994",
"0.55511945",
"0.5492934",
"0.5484141",
"0.5474077",
"0.54512215",
"0.5431567",
"0.5426975... | 0.70638335 | 0 |
Add new user to groups old user was in, and remove old user from all his groups | def replace_old_with_new_in_groups
old_user.groups.each do |group|
# Add new user to group if needed
if !group.member?(new_user) && !group.banned?(new_user)
group.redis.multi do
group.member_ids << new_user.id
new_user.group_ids << group.id
new_user.group_join_times... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_user(newuser)\n @group_users.push(newuser)\n end",
"def update\n if params[:commit] == \"Remove users\"\n @usergroup.users.each do |user|\n @usergroup.users.delete(user) if params[:usergroup][\"user\" + user.id.to_s] == \"1\"\n end\n elsif params[:commit] == \"Add users\"\n ... | [
"0.7056481",
"0.69771266",
"0.6766862",
"0.66245365",
"0.6519521",
"0.6464106",
"0.64560777",
"0.6353937",
"0.63034874",
"0.62144804",
"0.61860895",
"0.6172439",
"0.61590564",
"0.61561966",
"0.609615",
"0.60732025",
"0.60672796",
"0.6065123",
"0.60608673",
"0.60432756",
"0.60... | 0.8034735 | 0 |
The special ALL id | def id
Resource::ALL
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def id() end",
"def all_ids\n @all_ids ||= @ids_fenotypes.keys\n @all_ids\n end",
"def real_id\n @id\n end",
"def real_id\n @id\n end",
"def id\n special_attribute('@rid'.freeze)\n end",
"def id_number; end",
"def id\n #NOOP\n end",
"def id()\n #Thi... | [
"0.6928612",
"0.67403203",
"0.6724428",
"0.6724428",
"0.67017853",
"0.6656",
"0.66236037",
"0.6623265",
"0.6553461",
"0.6551173",
"0.6517788",
"0.64946014",
"0.6491004",
"0.6479094",
"0.6467999",
"0.6467999",
"0.6467999",
"0.6467999",
"0.6467999",
"0.6467999",
"0.6467999",
... | 0.72164965 | 1 |
This converts the form data into an OpenStruct object so that the template rendering can be cleaner. Piping it through the JSON serializer was a quick and easy way to deeply transform the object. | def open_struct_form
@application ||= JSON.parse(form, object_class: OpenStruct)
@application.form = application_type
@application
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_struct_form\n @application ||= JSON.parse(form, object_class: OpenStruct)\n @application.confirmation_number = confirmation_number\n\n transform_form\n\n @application\n end",
"def from_form_data(params = {})\n from_params(params, false)\n end",
"def form_data\n se... | [
"0.681582",
"0.621484",
"0.60621816",
"0.58689725",
"0.5766192",
"0.57143444",
"0.5681095",
"0.5681092",
"0.5651023",
"0.5641784",
"0.56007755",
"0.5545925",
"0.55305564",
"0.5469516",
"0.5446067",
"0.5428728",
"0.542768",
"0.5395426",
"0.5369814",
"0.5346697",
"0.53429264",
... | 0.6945851 | 0 |
Loads given _units_ into this +Unit+. Raises error if any of the models does not have volume or we are out of storage in this +Unit+. All loaded units must be in same location as transporter. | def load(units)
raise GameLogicError.new(
"You did not give any units to load!"
) if units.blank?
transporter_location = location
units.each do |unit|
raise GameLogicError.new(
"Unit #{unit} must be in same location as #{self}!"
) unless unit.location == transp... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(&block)\n block.call(self) if block_given?\n raise Exceptions::InvalidArgumentError, \"A unit with the same label: #{self.name}) already exists\" if loaded?\n Quantify::Unit.load(self) if valid?\n return self\n end",
"def unload(units, planet)\n raise GameLogicError... | [
"0.5939615",
"0.5837922",
"0.55522406",
"0.52408856",
"0.50722337",
"0.5054926",
"0.505184",
"0.49923992",
"0.48146415",
"0.4814394",
"0.48075935",
"0.4783855",
"0.47651792",
"0.4759274",
"0.47541508",
"0.47375727",
"0.47344622",
"0.4732933",
"0.4732933",
"0.47225866",
"0.471... | 0.8516464 | 0 |
Unloads units in contained in this +Unit+ into _planet_. | def unload(units, planet)
raise GameLogicError.new(
"You did not give any units to unload!"
) if units.blank?
transporter_location = location_point
units.each do |unit|
raise GameLogicError.new(
"Unit #{unit} must be in #{self}!"
) unless unit.location == trans... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unstationUnit(unit)\n\t\t@db.srem('sgt-structure:' + @id + ':units', unit.id)\n\tend",
"def portal_units_for(planet)\n player_id, ally_player_ids, planet_ids, ally_planet_ids =\n get_ids_from_planet(planet)\n volume = teleported_volume_for(planet)\n\n pick_units(\n player_id, pla... | [
"0.6359525",
"0.58574826",
"0.5330633",
"0.5293256",
"0.5273596",
"0.52671254",
"0.52671254",
"0.5218241",
"0.5214566",
"0.5163494",
"0.51626635",
"0.51626635",
"0.5029311",
"0.5028548",
"0.50034213",
"0.49687755",
"0.49523616",
"0.4950405",
"0.48923978",
"0.48878944",
"0.486... | 0.7527025 | 0 |
Loads/unloads _metal_, _energy_ and _zetium_ from _source_ to/from this transporter. Increases/decreases _stored_ on transporter. Resources are taken from current location. If transporter is in space it will take them from wreckage. If unloading wreckage will either be created or updated. | def transfer_resources!(metal, energy, zetium)
raise GameLogicError.new(
"You're not trying to do anything! All resources are 0!") \
if metal == 0 && energy == 0 && zetium == 0
# Check where we are.
location = self.location
# If we are in space we need wreckage.
if locatio... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load(units)\n raise GameLogicError.new(\n \"You did not give any units to load!\"\n ) if units.blank?\n\n transporter_location = location\n units.each do |unit|\n raise GameLogicError.new(\n \"Unit #{unit} must be in same location as #{self}!\"\n ) unless unit.... | [
"0.603973",
"0.5402052",
"0.5082057",
"0.5041843",
"0.49353597",
"0.4854684",
"0.48480856",
"0.4835852",
"0.48226362",
"0.47800526",
"0.47535786",
"0.46828246",
"0.46733516",
"0.4648475",
"0.4639415",
"0.4639415",
"0.461516",
"0.46034187",
"0.4602643",
"0.4602643",
"0.4592687... | 0.5879337 | 1 |
Calculates total volume of _units_. | def calculate_volume(units)
units.reduce(0) do |sum, unit|
volume = unit.volume
raise GameLogicError.new("#{unit} does not have volume!") \
if volume.nil?
sum + volume
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def total_volume(with_unit)\n if with_unit\n (quantity * volume.to_d).to_s + unit\n else\n quantity * volume.to_d\n end\n end",
"def total_volume\n quantity * Item.find(item_id).volume\n end",
"def calculate(units)\n @price_per_unit * (units - units.to_i / 2)\n end",
"def ... | [
"0.794401",
"0.72452897",
"0.7183811",
"0.7125365",
"0.6830979",
"0.6810972",
"0.67393225",
"0.66498286",
"0.6642032",
"0.6559995",
"0.64890146",
"0.6417823",
"0.64103323",
"0.6368297",
"0.629376",
"0.6286763",
"0.62349474",
"0.6209315",
"0.62045556",
"0.614217",
"0.6135105",... | 0.8485268 | 0 |
Write a method that converts its argument to weirdcase, where every odd character is lowercase and every even is uppercase, e.g. weirdcase("weirdcase") => "wEiRdCaSe" | def weirdcase(str)
result = ""
str.chars.each_with_index do |ch, i|
result += i.odd? ? ch.upcase : ch.downcase
end
result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def weirdcase(str)\n new_str = \"\"\n str.chars.each_with_index do |c, i|\n if i%2==0 #reverse because odd characters have even indices\n new_str += c.downcase\n else\n new_str += c.upcase\n end\n end\n return new_str\nend",
"def weirdcase(str)\n (0...str.length).each do |idx|\n if id... | [
"0.8193333",
"0.8116731",
"0.809802",
"0.80648667",
"0.8024877",
"0.80099255",
"0.79283035",
"0.79018223",
"0.79009855",
"0.7861807",
"0.77833664",
"0.77666193",
"0.76194954",
"0.7536006",
"0.7524332",
"0.75214165",
"0.745441",
"0.7415433",
"0.73420644",
"0.73376244",
"0.7324... | 0.8154734 | 1 |
A method that defines how to fetch project contents to a deploy directory with fetchers. Arguments: +key+ a key identifier of a particular fetcher +options+ options for fetchers as a Hash Returns: Exit code for fetcher +key+ More information: See README.md for detailed description of fetchers | def fetch(key, options = {})
case key
when 'repository'
return 1 unless options['url']
options['branch'] ||= 'master'
if Dir.exist?('.git')
puts "Pulling changes from Git remote: origin, branch: #{options['branch']}..."
system("git pull origin #{opti... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fetch(fetcher, key)\n return if fetcher.nil?\n raise GemsBond::Fetchers::NotStartedError unless fetcher.started?\n\n fetcher.public_send(key)\n end",
"def pkg_fetch\n return if File::exists? @srcdir\n\n sysprint \"#{@name} fetch: #{@fetch_url}\"\n\n # Try to guess by package URL ex... | [
"0.591713",
"0.5735127",
"0.5408753",
"0.53185725",
"0.52253354",
"0.517233",
"0.51626354",
"0.5141249",
"0.51387596",
"0.51138186",
"0.51138186",
"0.5097961",
"0.50812566",
"0.5074349",
"0.50715417",
"0.50420403",
"0.49544525",
"0.49370885",
"0.49359924",
"0.49052057",
"0.48... | 0.675299 | 0 |
GET /expression_merge_lists GET /expression_merge_lists.json | def index
@expression_merge_lists = ExpressionMergeList.page(params[:page])
respond_to do |format|
format.html # index.html.erb
format.json { render :json => @expression_merge_lists }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @expression_merge_list = ExpressionMergeList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @expression_merge_list }\n end\n end",
"def new\n @expression_merge_list = ExpressionMergeList.new\n\n respond_to do |format... | [
"0.6498078",
"0.6294448",
"0.59137243",
"0.5779267",
"0.5701405",
"0.569683",
"0.55113584",
"0.5401401",
"0.5234504",
"0.5092167",
"0.50883746",
"0.50429976",
"0.4948536",
"0.493783",
"0.49202922",
"0.48940095",
"0.48603085",
"0.48580703",
"0.48490566",
"0.48205873",
"0.47686... | 0.68716085 | 0 |
GET /expression_merge_lists/1 GET /expression_merge_lists/1.json | def show
@expression_merge_list = ExpressionMergeList.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @expression_merge_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @expression_merge_lists = ExpressionMergeList.page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @expression_merge_lists }\n end\n end",
"def new\n @expression_merge_list = ExpressionMergeList.new\n\n respond_to do |... | [
"0.7103748",
"0.6700069",
"0.6150993",
"0.60674",
"0.5863433",
"0.5836066",
"0.58227605",
"0.5799956",
"0.548602",
"0.5436028",
"0.5373687",
"0.53470755",
"0.52323335",
"0.51973933",
"0.514899",
"0.5091556",
"0.5020969",
"0.49844295",
"0.49512154",
"0.491668",
"0.48774412",
... | 0.69774765 | 1 |
GET /expression_merge_lists/new GET /expression_merge_lists/new.json | def new
@expression_merge_list = ExpressionMergeList.new
respond_to do |format|
format.html # new.html.erb
format.json { render :json => @expression_merge_list }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @expression_merge_list = ExpressionMergeList.new(params[:expression_merge_list])\n\n respond_to do |format|\n if @expression_merge_list.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.expression_merge_list'))\n format.html { redire... | [
"0.7448852",
"0.70629936",
"0.6284935",
"0.6171058",
"0.6134343",
"0.6134343",
"0.6134343",
"0.6084311",
"0.60464376",
"0.5915113",
"0.5910462",
"0.5895099",
"0.58864605",
"0.5872469",
"0.5870468",
"0.5861657",
"0.5832929",
"0.5827814",
"0.57984364",
"0.5795771",
"0.57709527"... | 0.81887007 | 0 |
POST /expression_merge_lists POST /expression_merge_lists.json | def create
@expression_merge_list = ExpressionMergeList.new(params[:expression_merge_list])
respond_to do |format|
if @expression_merge_list.save
flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.expression_merge_list'))
format.html { redirect_to(@expr... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @expression_merge_list = ExpressionMergeList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @expression_merge_list }\n end\n end",
"def update\n @expression_merge_list = ExpressionMergeList.find(params[:id])\n\n respond_to do |forma... | [
"0.6052232",
"0.58748066",
"0.5535691",
"0.5419847",
"0.509891",
"0.50915015",
"0.5003189",
"0.4975982",
"0.49425146",
"0.49160388",
"0.49028394",
"0.48953232",
"0.48925182",
"0.48799145",
"0.4797491",
"0.47921494",
"0.47616228",
"0.47316685",
"0.47200677",
"0.46832302",
"0.4... | 0.67125756 | 0 |
PUT /expression_merge_lists/1 PUT /expression_merge_lists/1.json | def update
@expression_merge_list = ExpressionMergeList.find(params[:id])
respond_to do |format|
if @expression_merge_list.update_attributes(params[:expression_merge_list])
if params[:mode] == 'merge'
selected_expression = Expression.find(params[:selected_expression_id]) rescue nil
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @expression_merge_list = ExpressionMergeList.new(params[:expression_merge_list])\n\n respond_to do |format|\n if @expression_merge_list.save\n flash[:notice] = t('controller.successfully_created', :model => t('activerecord.models.expression_merge_list'))\n format.html { redire... | [
"0.6181206",
"0.59246665",
"0.5767538",
"0.53806335",
"0.5306885",
"0.52747995",
"0.5273329",
"0.52170956",
"0.51897913",
"0.51784533",
"0.51760536",
"0.51733935",
"0.51732886",
"0.5157808",
"0.51352674",
"0.5105741",
"0.5101841",
"0.5098594",
"0.5082278",
"0.5073242",
"0.507... | 0.69605654 | 0 |
DELETE /expression_merge_lists/1 DELETE /expression_merge_lists/1.json | def destroy
@expression_merge_list = ExpressionMergeList.find(params[:id])
@expression_merge_list.destroy
respond_to do |format|
format.html { redirect_to(expression_merge_lists_url) }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @admin_merge.destroy\n respond_to do |format|\n format.html { redirect_to admin_merges_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @work_merge_list = WorkMergeList.find(params[:id])\n @work_merge_list.destroy\n\n respond_to do |format|\n f... | [
"0.6576368",
"0.65411687",
"0.6226603",
"0.6221683",
"0.6205027",
"0.6199773",
"0.61962235",
"0.6185799",
"0.6175216",
"0.6141048",
"0.6092227",
"0.6092227",
"0.60775554",
"0.60571903",
"0.6050898",
"0.603391",
"0.603391",
"0.603391",
"0.60293174",
"0.601106",
"0.59914654",
... | 0.787413 | 0 |
wait for a specified interval and check files for changes source: ZenTest/autotest.rb | def wait
Kernel.sleep self.interval until check_files
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n puts \"Watcher RUNNING------------------->\"\n loop do\n unless (diff = build_file_list - @org_file_list).empty?\n # sleep 0.5\n diff.each do |meta|\n @callbacks[:new_file_created].call(meta[0])\n end\n exit\n end\n sleep 0.5\n end\n end",
... | [
"0.6466022",
"0.623878",
"0.6155437",
"0.61422193",
"0.6090446",
"0.6066619",
"0.6037375",
"0.6030421",
"0.60224915",
"0.5903467",
"0.5880343",
"0.5850344",
"0.5828277",
"0.5827847",
"0.58141005",
"0.57993937",
"0.57859814",
"0.5782644",
"0.5758489",
"0.5747467",
"0.5708927",... | 0.68106216 | 0 |
check files to find these that have changed | def check_files
updated = []
files.each do |filename, mtime|
begin
current_mtime = File.stat(filename).mtime
rescue Errno::ENOENT
# file was not found and was probably deleted
# remove the file from the file list
files... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def file_changes?\n all_files = git.modified_files + git.added_files\n Danger::Changelog::Config.ignore_files.each do |f|\n all_files.reject! { |modified_file| f.is_a?(Regexp) ? f.match?(modified_file) : f == modified_file }\n break if all_files.empty?\n end\n all_files.any?\n ... | [
"0.72786385",
"0.7223144",
"0.7192869",
"0.7141809",
"0.7123161",
"0.7092627",
"0.70450115",
"0.6989201",
"0.6954071",
"0.6937839",
"0.6897679",
"0.6890373",
"0.68404824",
"0.6780544",
"0.6759513",
"0.67543775",
"0.6731028",
"0.67254555",
"0.6711574",
"0.6699496",
"0.66670907... | 0.8017362 | 0 |
Find the files to process, ignoring temporary files, source configuration management files, etc., and return a Hash mapping filename to modification time. source: ZenTest/autotest.rb | def find_files
result = {}
targets = ['app'] # start simple
targets.each do |target|
order = []
Find.find(target) do |f|
next if test ?d, f
next if f =~ /(swp|~|rej|orig)$/ # temporary/patch files
next if f =~ /(\.svn|\.git)... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mtimes\n @files.inject({}) do |hash, g|\n Dir[g].each { |file| hash[file] = File.mtime(file) }\n hash\n end\n end",
"def recent_tests(source_pattern, test_path, touched_since = 10.minutes.ago)\n FileList[source_pattern].map do |path|\n if File.mtime(path) > touched_since\n ... | [
"0.688971",
"0.67224705",
"0.67224705",
"0.67224705",
"0.6630744",
"0.6483484",
"0.63935584",
"0.6302497",
"0.6293505",
"0.6265972",
"0.6252848",
"0.6234978",
"0.61823446",
"0.61725146",
"0.61681813",
"0.61273706",
"0.6105788",
"0.6100496",
"0.5989002",
"0.5976391",
"0.597204... | 0.7741753 | 0 |
Send out a notification on unboarded loans. | def unboarded_loans(loans)
return unless Rails.env == 'production'
to_email = 'MB Servicing <MBservicing@mbmortgage.com>'
subject = (Rails.env == 'development') ? 'TESTING -- MBWEB/TSS: Boarded Loans Notification' : 'MBWEB/TSS: Boarded Loans Notification'
@loan_count = loans.count
return if @loan_c... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_unlocked\n ::Notification.create!(\n from: user,\n user_id: user_id,\n seen: false,\n target: self,\n kind: :ACHIEVEMENT_UNLOCKED\n )\n end",
"def unaway\n @socket << \"AWAY\"\n end",
"def reconciled_loans(loans)\n return unless Rails.env == 'production'\n ... | [
"0.6377231",
"0.6119014",
"0.60459995",
"0.6025568",
"0.60219204",
"0.6010676",
"0.59576833",
"0.58081883",
"0.5794465",
"0.57904154",
"0.5777964",
"0.5771135",
"0.57404846",
"0.57345915",
"0.5729214",
"0.572702",
"0.5720635",
"0.57053363",
"0.5700832",
"0.56843877",
"0.56780... | 0.7653212 | 0 |
Send out a notification on multiple different loan failure types. | def rejected_loan(loan, options = {})
to_email = 'MB Servicing <MBservicing@mbmortgage.com>'
subject = (Rails.env == 'development') ? "TESTING -- MBWEB/TSS: #{options[:reason]} Loan Notification" : "MBWEB/TSS: #{options[:reason]} Loan Notification"
@loan = loan
@options = options
mail(:to => to_ema... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def failure\n Ballots::NotificationsMailer.failure\n end",
"def email_status_change_notices\n return if previously_published?\n\n case status\n when 'published', 'embargoed'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_pu... | [
"0.5766092",
"0.5654768",
"0.5483263",
"0.5479093",
"0.54479253",
"0.5443965",
"0.54181695",
"0.5351027",
"0.5331762",
"0.53074765",
"0.5238122",
"0.5214228",
"0.5182121",
"0.51657563",
"0.51657563",
"0.5127532",
"0.51128554",
"0.51000524",
"0.50814223",
"0.5068541",
"0.50623... | 0.59370744 | 0 |
loans that have been reconciled. | def reconciled_loans(loans)
return unless Rails.env == 'production'
to_email = 'MB Servicing <MBmsrpurchases@mbmortgage.com>'
subject = (Rails.env == 'development') ? 'TESTING -- MBWEB/TSS: Reconciled Loans Notification' : 'MBWEB/TSS: Reconciled Loans Notification'
@loan_count = loans.count
return ... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reap\n stale_connections = @connections.select do |conn|\n conn.in_use? && !conn.owner.alive?\n end\n\n stale_connections.each do |conn|\n if conn.active?\n conn.reset!\n checkin conn\n else\n remove conn\n end\n ... | [
"0.57236695",
"0.57138115",
"0.5470901",
"0.5408731",
"0.53945404",
"0.5382748",
"0.535958",
"0.5337535",
"0.53229034",
"0.5303955",
"0.52919346",
"0.5276895",
"0.5266153",
"0.5265416",
"0.5219729",
"0.5219729",
"0.5213516",
"0.51962936",
"0.5179581",
"0.5179581",
"0.5114449"... | 0.58743316 | 0 |
GET /personas_vinculadas GET /personas_vinculadas.json | def index
if current_user.nil?
redirect_to(log_in_path) and return
end
@personas_vinculadas = PersonaVinculada.all
respond_to do |format|
format.html # index.html.erb
format.json { render json: @personas_vinculadas }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @persona_punto_venta = PersonaPuntoVentum.all\n end",
"def index\n @personas = Persona.all\n @users = User.all\n\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @personas }\n end\n end",
"def show\n @persona = Persona.find(params[... | [
"0.68131274",
"0.67150736",
"0.66522557",
"0.66410476",
"0.6636052",
"0.6623749",
"0.6596532",
"0.6584955",
"0.6575712",
"0.65601075",
"0.65292156",
"0.6492369",
"0.64903283",
"0.6470575",
"0.6423294",
"0.6415618",
"0.6402772",
"0.6381714",
"0.63228863",
"0.6322004",
"0.63141... | 0.70638865 | 0 |
GET /personas_vinculadas/new GET /personas_vinculadas/new.json | def new
if current_user.nil?
redirect_to(log_in_path) and return
end
@persona_vinculada = PersonaVinculada.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @persona_vinculada }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.json { render json: @persona }\n end\n end",
"def new\n @persona = Persona.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @persona }\n end\n end",
"def new\n @per... | [
"0.7764644",
"0.773635",
"0.773635",
"0.773635",
"0.77140635",
"0.76641756",
"0.7592674",
"0.75880027",
"0.75831527",
"0.75831527",
"0.75831527",
"0.75831527",
"0.75831527",
"0.75831527",
"0.75831527",
"0.754302",
"0.7451614",
"0.7437125",
"0.7418042",
"0.7373918",
"0.7346726... | 0.7779286 | 0 |
The 'add' method adds a child component to the current component class. | def add_child(component)
@children.push(component)
component.parent = self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add(component)\n @children.append(component)\n component.parent = self\n end",
"def add_child(component)\n \t@children.push(component)\n \tputs \"Adding parent of #{component.class} to #{self.class}\"\n \tcomponent.parent = self\n end",
"def add_component(child_component)\n @child_com... | [
"0.77810055",
"0.7710268",
"0.76939744",
"0.76843137",
"0.7136301",
"0.69679755",
"0.69603753",
"0.689831",
"0.687951",
"0.6826482",
"0.682582",
"0.68173796",
"0.67722934",
"0.67715424",
"0.6741805",
"0.6595125",
"0.6567399",
"0.6567399",
"0.6564699",
"0.65441275",
"0.6534634... | 0.7748361 | 1 |
The 'remove' method removes a child component from the current component class. | def remove_child(component)
@children.delete(component)
component.parent = nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove(component)\n \t@children.delete(component)\n \tcomponent.parent = nil\n end",
"def remove item\n @components.remove item\n end",
"def remove_component_at(index:)\n component = @child_components.delete_at(index)\n\n @view.remove_view(component.view)\n\n compone... | [
"0.71678305",
"0.70360076",
"0.7010515",
"0.67716444",
"0.6759171",
"0.6713978",
"0.6638967",
"0.64693666",
"0.6417834",
"0.6362843",
"0.6303086",
"0.61875844",
"0.6099132",
"0.6073573",
"0.6039497",
"0.6023156",
"0.5979796",
"0.59624195",
"0.5915319",
"0.5892888",
"0.5869089... | 0.7449747 | 0 |
The 'get_child' method will return a child of this class by index. | def get_child(index)
@children[index]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_child(index)\n \t@children[index]\n end",
"def child(index)\n @children[index]\n end",
"def [](index)\n children[index]\n end",
"def [](index)\n @children[index]\n end",
"def child\n children[0]\n end",
"def child(name, index)\n define... | [
"0.8407359",
"0.8379804",
"0.7784231",
"0.7578226",
"0.7381738",
"0.71607506",
"0.71283054",
"0.70885766",
"0.7005786",
"0.6965578",
"0.69511837",
"0.69160473",
"0.6781307",
"0.6687865",
"0.66614443",
"0.6635576",
"0.66233134",
"0.6582551",
"0.6582551",
"0.64774734",
"0.64312... | 0.86053264 | 0 |
GET /api/v1/ota GET /api/v1/ota?facility=[facility_id] | def index
ota = Array.new
if params[:facility].nil?
# 自分の施設情報だけを返す
facilities = current_user.facilities
facilities.each do |facility|
ota.concat(
facility.ota.select do |otum|
otum.provider != 'default'
end
)
end
else
# facility=[... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n ota_rooms = Array.new\n if params[:room].nil? && params[:ota].nil?\n # 自分の施設情報だけを返す\n\n current_user.ota.select do |otum|\n otum.provider == 'default'\n end.each do |otum|\n ota_rooms.concat(otum.ota_rooms)\n end\n elsif params[:ota].nil?\n room = Room.fi... | [
"0.5900492",
"0.5744085",
"0.5731066",
"0.56506795",
"0.56256753",
"0.5561868",
"0.55370927",
"0.5429042",
"0.5385347",
"0.5383821",
"0.5376159",
"0.53725284",
"0.53725284",
"0.53725284",
"0.53725284",
"0.53725284",
"0.53725284",
"0.53725284",
"0.53725284",
"0.53725284",
"0.5... | 0.72087294 | 0 |
Defines a list of methods to be abbreviated. If auto = true, then all the methods are abbreviated class Test abbrev All the methods of Test will be abbreviated end class Test2 abbrev :first, :last Only the methods first and last may be abbreviated end If multiple choices are possible, a MultipleMethods exception is rai... | def abbrev(auto = true, *args)
if auto.respond_to? :to_sym
@abbreviated_methods ||= []
@abbreviated_methods += args.collect {|m| m.to_sym }.unshift auto.to_sym
elsif args.empty?
auto ? @abbreviated_methods = [] : @abbreviated_methods = nil
else
raise ArgumentError
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_abbreviations\n return @command_abbreviations if @command_abbreviations\n @command_abbreviations = Abbrev::abbrev(command_list)\n end",
"def complete name\n completions = []\n\n klass, selector, method = parse_name name\n\n complete_klass name, klass, selector, method, completi... | [
"0.5569667",
"0.5430327",
"0.541163",
"0.53042597",
"0.53042597",
"0.53042597",
"0.53042597",
"0.51866686",
"0.515743",
"0.5131481",
"0.5077465",
"0.49808872",
"0.49597153",
"0.49566704",
"0.4925812",
"0.4908982",
"0.49039108",
"0.48556015",
"0.48234415",
"0.4818572",
"0.4803... | 0.8014654 | 0 |
sort the sorting portion of the HeapSort algorithm Intuition : the last half of an array implementation of a heap is just leaves. So build the heap from there going down. after building the heap the first time, extract the root which we know is a the maximum element, due to a max heap property, and afterwards swap it w... | def sort
arr_len = @data.length
start_build_idx = arr_len / 2 - 1 # The last half of the array is just leaves
for i in (start_build_idx).downto(0)
max_heapify(@data, arr_len, i) # Build the heap from the array
end
for i in (a... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def heapsort(array)\r\n\t#create a heap from an array\r\n\theap = MaxHeap.new(array)\r\n\theap.buildMaxHeap\r\n\t\r\n\t#puts heap.array\r\n\t#puts \"_____\"\r\n\t#puts \"array size = #{heap.arraysize}\"\r\n\t\r\n\t(heap.arraysize).downto(2) do |i|\r\n\t\t#exchange of largest data point with end of the array\r\n\t... | [
"0.8363987",
"0.8037681",
"0.79111123",
"0.7826225",
"0.78201634",
"0.78148854",
"0.77936125",
"0.77834654",
"0.7661624",
"0.7627831",
"0.760954",
"0.7542968",
"0.7460648",
"0.74559873",
"0.73620105",
"0.7336948",
"0.73224676",
"0.72624725",
"0.7222861",
"0.7212612",
"0.71751... | 0.8607769 | 0 |
generate a random keypair name | def key_pair_name
# return the key_pair_name if one is already generated
return @key_pair_name if @key_pair_name
# generate on from a random string of 10 upper and lowercase letters
o = [('a'..'z'), ('A'..'Z')].map { |i| i.to_a }.flatten
@key_pair_name = (0..10).map { o[rand(o.length)] }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def random_key\n o = [('a'..'z'), ('A'..'Z')].map(&:to_a).flatten\n (0...8).map { o[rand(o.length)] }.join\n end",
"def generate_random_key\n (0...8).map { 65.+(rand(25)).chr }.join\n end",
"def random_key\n (0...10).map { ('a'..'z').to_a[rand(26)] }.join\n end",
"def generate_random_key(lengt... | [
"0.74480176",
"0.73683643",
"0.7355842",
"0.7320531",
"0.72652453",
"0.72581494",
"0.7161263",
"0.7100427",
"0.7035201",
"0.6993202",
"0.6993202",
"0.69631714",
"0.69372475",
"0.6933416",
"0.6929988",
"0.6897065",
"0.6850657",
"0.683935",
"0.6836909",
"0.6834707",
"0.67918175... | 0.89455813 | 0 |
GET /humanidades2s/1 GET /humanidades2s/1.json | def show
@humanidades2 = Humanidades2.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @humanidades2 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @humanidades1 }\n end\n end",
"def new\n @humanidades2 = Humanidades2.new\n\n respond_to do |format|\n format.html # new.html.erb\n f... | [
"0.6912622",
"0.6553604",
"0.6389437",
"0.62736726",
"0.6091211",
"0.6091211",
"0.6075609",
"0.6053727",
"0.5928542",
"0.58838576",
"0.58290595",
"0.58037865",
"0.5802723",
"0.5799599",
"0.5798685",
"0.5745887",
"0.57272816",
"0.570879",
"0.56875795",
"0.567025",
"0.5628926",... | 0.7335195 | 0 |
GET /humanidades2s/new GET /humanidades2s/new.json | def new
@humanidades2 = Humanidades2.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @humanidades2 }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @humanidades2 = Humanidades2.new(params[:humanidades2])\n\n respond_to do |format|\n if @humanidades2.save\n format.html { redirect_to @humanidades2, notice: 'Humanidades2 was successfully created.' }\n format.json { render json: @humanidades2, status: :created, location: @hum... | [
"0.76215",
"0.7591111",
"0.7471265",
"0.734955",
"0.7310988",
"0.71997505",
"0.71970975",
"0.71764374",
"0.71344775",
"0.70911866",
"0.7084632",
"0.70829445",
"0.7045333",
"0.70413494",
"0.7016763",
"0.70143545",
"0.700569",
"0.70016384",
"0.6998733",
"0.69965535",
"0.6995143... | 0.78630346 | 0 |
POST /humanidades2s POST /humanidades2s.json | def create
@humanidades2 = Humanidades2.new(params[:humanidades2])
respond_to do |format|
if @humanidades2.save
format.html { redirect_to @humanidades2, notice: 'Humanidades2 was successfully created.' }
format.json { render json: @humanidades2, status: :created, location: @humanidades2 }... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @humanidades1 = Humanidades1.new(params[:humanidades1])\n\n respond_to do |format|\n if @humanidades1.save\n format.html { redirect_to @humanidades1, notice: 'Humanidades1 was successfully created.' }\n format.json { render json: @humanidades1, status: :created, location: @hum... | [
"0.6159877",
"0.58466405",
"0.567905",
"0.55916",
"0.5539162",
"0.5494987",
"0.54577285",
"0.545591",
"0.5453515",
"0.54116905",
"0.5354698",
"0.5348361",
"0.53474885",
"0.5342397",
"0.5328943",
"0.52904207",
"0.5279082",
"0.52701306",
"0.5258187",
"0.52536553",
"0.5229789",
... | 0.6849185 | 0 |
PUT /humanidades2s/1 PUT /humanidades2s/1.json | def update
@humanidades2 = Humanidades2.find(params[:id])
respond_to do |format|
if @humanidades2.update_attributes(params[:humanidades2])
format.html { redirect_to @humanidades2, notice: 'Humanidades2 was successfully updated.' }
format.json { head :no_content }
else
format... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @humanidades1 = Humanidades1.find(params[:id])\n\n respond_to do |format|\n if @humanidades1.update_attributes(params[:humanidades1])\n format.html { redirect_to @humanidades1, notice: 'Humanidades1 was successfully updated.' }\n format.json { head :no_content }\n else\n ... | [
"0.67714435",
"0.63649267",
"0.6112728",
"0.6112728",
"0.60387886",
"0.60225874",
"0.60174966",
"0.59917885",
"0.59746575",
"0.5914785",
"0.5908784",
"0.5896556",
"0.58856833",
"0.58758193",
"0.58726805",
"0.5864236",
"0.58637047",
"0.58540624",
"0.5850858",
"0.58395493",
"0.... | 0.70842355 | 0 |
DELETE /humanidades2s/1 DELETE /humanidades2s/1.json | def destroy
@humanidades2 = Humanidades2.find(params[:id])
@humanidades2.destroy
respond_to do |format|
format.html { redirect_to humanidades2s_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @humanidades1 = Humanidades1.find(params[:id])\n @humanidades1.destroy\n\n respond_to do |format|\n format.html { redirect_to humanidades1s_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @humanidades3 = Humanidades3.find(params[:id])\n @humanidade... | [
"0.7670086",
"0.7270592",
"0.70135516",
"0.6988925",
"0.69419605",
"0.69341314",
"0.69215316",
"0.6915151",
"0.6914419",
"0.68968385",
"0.6888745",
"0.68839884",
"0.6864097",
"0.6863521",
"0.68473136",
"0.6840802",
"0.68306696",
"0.6807381",
"0.6790153",
"0.67847955",
"0.6784... | 0.7724767 | 0 |
With the help of this leap_year?() method calculate and display the number of minutes in a leap year (2000 and 2004) and the number of minutes in a nonleap year (1900 and 2005). Note: Every year whose number is divisible by four without a remainder is a leap year, excepting the full centuries, which, to be leap years, ... | def leap_year?(input_year)
((input_year % 4 == 0) && (input_year % 100 > 0)) || (input_year % 400 == 0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def leap_year? (years)\n leap = years % 4\n leaps = years % 100\n leaped = years % 400\n if leap == 0 && leaps == 0 && leaped != 0\n return false\n elsif leap == 0 && leaps != 0\n return true\n elsif leap == 0 && leaps == 0 && leaped == 0\n return true\n else\n return false\n end\nend",
"def ... | [
"0.8008179",
"0.79972327",
"0.7991354",
"0.79792756",
"0.79686457",
"0.79683787",
"0.79679495",
"0.79642725",
"0.79608774",
"0.7959541",
"0.7944424",
"0.794415",
"0.7939059",
"0.7923762",
"0.79178184",
"0.79145914",
"0.791203",
"0.7903006",
"0.79013497",
"0.7885896",
"0.78787... | 0.8044044 | 0 |
loads the data from the yamlfrontmatter and extends page.data with three key value pairs: title > contains the resource.iri rdf > contains the resource itself template > contains the path to the currenly used template | def load_data(site)
self.read_yaml(File.join(@base, '_layouts'), @template)
self.data['title'] = @resource.iri
self.data['rdf'] = @resource
self.data['template'] = @template
if(!@resource.subResources.nil?)
self.data['sub_rdf'] = @resource.subResources.values
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def load_page(resource_name, options={}) \n \n begin\n #p \"LOAD-PAGE-START\" \n resource_name = resource_name.to_s if resource_name.is_a?(Symbol)\n \n if path=get_path(resource_name) \n \n page_data = parse_page_file(path).symbolize_keys\n\n ... | [
"0.6141409",
"0.6133762",
"0.6113993",
"0.60998625",
"0.6085022",
"0.594016",
"0.5908757",
"0.58617204",
"0.5849397",
"0.58224636",
"0.57655597",
"0.5754041",
"0.5736935",
"0.5735018",
"0.56909424",
"0.56638134",
"0.5534938",
"0.54972893",
"0.54787415",
"0.5431329",
"0.540228... | 0.76800364 | 0 |
loads the prefix data passed in the layout yamlfrontmatter into page.data["rdf_prefixes"] and page.data["rdf_prefix_map"] | def load_prefixes
if !self.data["rdf_prefix_path"].nil?
begin
prefix_file=File.new(File.join(@base, 'rdf-data', self.data["rdf_prefix_path"].strip)).readlines
self.data["rdf_prefixes"] = prefix_file.join(" ")
self.data["rdf_prefix_map"] = Hash[ *(prefix_file.collect... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def define_prefixes(prefs)\n\t\t\tprefs.each do |prefix, val|\n\t\t\t @@prefixes[prefix] = RDF::Vocabulary.new(val)\n\t\t\tend\n\t\tend",
"def prefix\n @data['prefix']\n end",
"def ns_prefixes\n {\n 'jerm' => JERMVocab.to_uri.to_s,\n 'dcterms' => RDF::Vocab::DC.to_uri.to_s,\n ... | [
"0.5874601",
"0.58682686",
"0.57948965",
"0.5628968",
"0.539971",
"0.5371095",
"0.5359817",
"0.53527933",
"0.5348812",
"0.5314338",
"0.528443",
"0.52755404",
"0.52646214",
"0.52139914",
"0.52139914",
"0.52037024",
"0.5175214",
"0.5110632",
"0.50590813",
"0.50439906",
"0.50248... | 0.83509856 | 0 |
instagr.rb plugin to insert images on instagr.am !! integrated into the instagram.rb. !! Please use the instagram.rb | def instagr( short_url, size = :medium)
if respond_to?(:instagram)
instagram( short_url, size )
else
return %Q|instagr.rb was integrated into instagram.rb. Please use the instagram.rb|
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def images; end",
"def images\n end",
"def process_images\n # Split \"\" into [\"\"]\n # TODO: handle properly escaped values, escaped ) and surrounded by <>\n imgRE = /(!\\[.*?\\]\\()(.+?)(\\))/\n new_content = \"\"\n pos = 0\n source_... | [
"0.6343577",
"0.6041974",
"0.5936468",
"0.5887655",
"0.5880892",
"0.5828217",
"0.58230335",
"0.5777857",
"0.5758467",
"0.57459044",
"0.5744463",
"0.5737247",
"0.5717869",
"0.5708387",
"0.56901294",
"0.5680389",
"0.56671894",
"0.5666014",
"0.56452596",
"0.5644483",
"0.56363374... | 0.6883206 | 0 |
Move the conversation to the trash for one of the participants | def move_to_trash(participant)
return unless participant
receipts_for(participant).move_to_trash
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move_to_trash(participant)\n return unless participant\n self.receipts.recipient(participant).move_to_trash\n end",
"def move_to_trash(participant)\n return if participant.nil?\n return self.receipts_for(participant).move_to_trash\n end",
"def untrash(participant)\n return unless participa... | [
"0.8031274",
"0.76888",
"0.7456828",
"0.7202366",
"0.6906629",
"0.66589516",
"0.6555531",
"0.65019304",
"0.6352601",
"0.6226107",
"0.614864",
"0.6141821",
"0.6097434",
"0.6024658",
"0.5989648",
"0.59861904",
"0.5969597",
"0.59371233",
"0.59357214",
"0.5926713",
"0.5911419",
... | 0.7930123 | 1 |
Mark the conversation as deleted for one of the participants | def mark_as_deleted(participant)
return unless participant
deleted_receipts = receipts_for(participant).mark_as_deleted
if is_orphaned?
destroy
else
deleted_receipts
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def mark_as_deleted(participant)\n return if participant.nil?\n return receipt_for(participant).mark_as_deleted\n end",
"def mark_deleted(user)\n # self.sent_message.mark_deleted(user) if self.sender == user\n self.recipient_deleted = true if self.recipient == user\n self.save\n ... | [
"0.7263763",
"0.72064906",
"0.69997054",
"0.6915189",
"0.6678817",
"0.6506987",
"0.6491316",
"0.6399271",
"0.6398456",
"0.6358772",
"0.6290847",
"0.62758046",
"0.6253881",
"0.6227717",
"0.6227717",
"0.6215555",
"0.61967564",
"0.61967564",
"0.61772466",
"0.61346614",
"0.613229... | 0.7471716 | 0 |
Originator of the conversation. | def originator
@originator ||= original_message.sender
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def originator\n @originator = self.original_message.sender if @originator.nil?\n return @originator\n end",
"def originator\n self.user ? self.user.name : NOT_SET\n end",
"def paper_trail_originator\n @paper_trail_originator ||= previous.try(:whodunnit)\n end",
"def origin\n ... | [
"0.8307395",
"0.73202676",
"0.7174542",
"0.6856508",
"0.6587066",
"0.65410113",
"0.6505719",
"0.6505719",
"0.6505719",
"0.64617693",
"0.6436439",
"0.6373866",
"0.6371224",
"0.636117",
"0.63555753",
"0.63529444",
"0.6352505",
"0.6338771",
"0.63309216",
"0.631346",
"0.631346",
... | 0.8266509 | 1 |
Sender of the last message. | def last_sender
@last_sender ||= last_message.sender
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def last_sender\n @last_sender = self.last_message.sender if @last_sender.nil?\n return @last_sender\n end",
"def real_sender()\n\t\tself.received.last\n\tend",
"def sender_message\n return @sender_message\n end",
"def sender_user_name_of_recent_message\n message = self.me... | [
"0.84431934",
"0.7872353",
"0.74202865",
"0.71961117",
"0.6921007",
"0.6813201",
"0.67955756",
"0.6756189",
"0.6756189",
"0.6657141",
"0.66184366",
"0.6605823",
"0.65992796",
"0.65983486",
"0.65761155",
"0.6563937",
"0.65150803",
"0.6468445",
"0.64578664",
"0.645028",
"0.6449... | 0.8661455 | 0 |
Returns the receipts of the conversation for one participants | def receipts_for(participant)
Mailboxer::Receipt.conversation(self).recipient(participant)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def receipts_for(participant)\n return Receipt.conversation(self).recipient(participant)\n end",
"def receipts_for(participant)\n receipt_for(participant)\n end",
"def receipts_sent\n receipts.sent_messages_receipts\n end",
"def receipts(options = {})\n Mailboxer::Receipt.where(options).recipi... | [
"0.8554095",
"0.79576033",
"0.7376196",
"0.7150021",
"0.7115079",
"0.70151865",
"0.69676954",
"0.6769268",
"0.6183444",
"0.61611706",
"0.6041774",
"0.5959751",
"0.5940203",
"0.5933355",
"0.5889487",
"0.5888751",
"0.5807934",
"0.58035636",
"0.5698066",
"0.569658",
"0.5659456",... | 0.829059 | 1 |
Returns the number of messages of the conversation | def count_messages
Mailboxer::Message.conversation(self).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def count_messages\n return Message.conversation(self).count\n end",
"def count_messages\r\n @messages.size\r\n end",
"def NumMessages\n Builtins.size(@messages)\n end",
"def message_count\n\t s = status\n\t\t\ts[:message_count]\n\t end",
"def message_count\n 0\n end",
"de... | [
"0.8972812",
"0.85455686",
"0.8200052",
"0.7891364",
"0.7834857",
"0.77963835",
"0.7635743",
"0.7609064",
"0.7563232",
"0.75223947",
"0.751408",
"0.75097656",
"0.7292112",
"0.7286069",
"0.72421384",
"0.7193278",
"0.71781254",
"0.7137332",
"0.70818275",
"0.7055307",
"0.7031811... | 0.8726814 | 1 |
Returns true if the participant has deleted the conversation | def is_deleted?(participant)
return false unless participant
return receipts_for(participant).deleted.count == receipts_for(participant).count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_deleted?(participant)\n return false if participant.nil?\n return receipt_for(participant).first.deleted\n end",
"def deleted?\n @deleted == true\n end",
"def deleted?\n author == '[deleted]' and body == '[deleted]'\n end",
"def deleted?\n author == '[deleted]' and ... | [
"0.810039",
"0.6894289",
"0.6873364",
"0.6873364",
"0.6869105",
"0.68630654",
"0.6851534",
"0.68383783",
"0.6630438",
"0.6630438",
"0.6598784",
"0.6598784",
"0.65923226",
"0.65761536",
"0.65556705",
"0.6510128",
"0.6510128",
"0.6506143",
"0.6506143",
"0.6498909",
"0.6492439",... | 0.79737747 | 1 |
Creates a opt out object because by default all participants are opt in | def opt_out(participant)
return unless has_subscriber?(participant)
opt_outs.create(:unsubscriber => participant)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opt_in(participant)\n opt_outs.unsubscriber(participant).destroy_all\n end",
"def opt_out\n\n device_id = nil\n id_type = nil\n if(@advertising_id)\n device_id = @advertising_id\n elsif(@udid)\n device_id = @udid\n elsif(@mac_address)\n device_id = @mac_addre... | [
"0.6713088",
"0.64544046",
"0.5764327",
"0.5755072",
"0.5629231",
"0.54136294",
"0.49905995",
"0.49120814",
"0.48193958",
"0.47840086",
"0.47760853",
"0.47747552",
"0.47567126",
"0.47442818",
"0.4714914",
"0.47087103",
"0.47084495",
"0.46856943",
"0.46823266",
"0.4675639",
"0... | 0.7362114 | 0 |
Destroys opt out object if any a participant outside of the discussion is, yet, not meant to optin | def opt_in(participant)
opt_outs.unsubscriber(participant).destroy_all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def opt_out(participant)\n return unless has_subscriber?(participant)\n opt_outs.create(:unsubscriber => participant)\n end",
"def drop_off_passenger(person_obj)\n @passengers.delete(person_obj)\n end",
"def remove_chosen_presenter\n self.chosen_presenter = nil\n self.save\n end",
"def pre_... | [
"0.67614484",
"0.5975273",
"0.5864938",
"0.57908046",
"0.56975764",
"0.56818867",
"0.5680677",
"0.56800854",
"0.56765604",
"0.566757",
"0.56470853",
"0.56373864",
"0.56081283",
"0.56080747",
"0.5600944",
"0.5583099",
"0.5536315",
"0.55337465",
"0.5533433",
"0.5533073",
"0.552... | 0.76294255 | 0 |
Use the default sanitize to clean the conversation subject | def clean
self.subject = sanitize subject
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clean\n self.subject = sanitize self.subject\n end",
"def sanitize\n scrub_payload_emails\n scrub_actor_attributes\n end",
"def clean\n self.short_msg = sanitize(short_msg)\n self.long_msg = sanitize(long_msg)\n end",
"def sanitize!; end",
"def subject_clean(subject)\n return '' if... | [
"0.83199376",
"0.74845386",
"0.70840716",
"0.70732737",
"0.6929173",
"0.67906344",
"0.6757473",
"0.6665347",
"0.66518086",
"0.66293937",
"0.65846825",
"0.65659773",
"0.650561",
"0.64593625",
"0.64359456",
"0.6386474",
"0.63567746",
"0.6354129",
"0.6335928",
"0.6311008",
"0.63... | 0.82556826 | 1 |
GET /g4_dongal_board_lives GET /g4_dongal_board_lives.json | def index
@g4_dongal_board_lives = G4DongalBoardLife.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @g4_dongal_board_liberals = G4DongalBoardLiberal.all\n end",
"def index\n @lives = Life.all\n end",
"def set_g4_dongal_board_life\n @g4_dongal_board_life = G4DongalBoardLife.find(params[:id])\n end",
"def index\n @loves = Love.all\n render json: @loves\n end",
"def index\... | [
"0.6536569",
"0.63896984",
"0.608126",
"0.607918",
"0.5942871",
"0.5854975",
"0.5840504",
"0.5749848",
"0.57181627",
"0.56626785",
"0.56557846",
"0.5636484",
"0.56089646",
"0.5594803",
"0.5593698",
"0.557194",
"0.5561905",
"0.55497515",
"0.55297637",
"0.5508506",
"0.5481155",... | 0.74838257 | 0 |
POST /g4_dongal_board_lives POST /g4_dongal_board_lives.json | def create
@g4_dongal_board_life = G4DongalBoardLife.new(g4_dongal_board_life_params)
respond_to do |format|
if @g4_dongal_board_life.save
format.html { redirect_to @g4_dongal_board_life, notice: 'G4 dongal board life was successfully created.' }
format.json { render :show, status: :creat... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @g4_dongal_board_lives = G4DongalBoardLife.all\n end",
"def create\n character = Character.find_by(id: params(:character_id))\n past_life = character.past_lives.build(past_life_params)\n\n if past_life.save\n render json: past_life, status: :created, location: past_life\n else\n ... | [
"0.64986604",
"0.62156445",
"0.60071284",
"0.5738253",
"0.57323885",
"0.5703941",
"0.55586934",
"0.5516916",
"0.54771566",
"0.54702437",
"0.5450971",
"0.5430338",
"0.5398498",
"0.5394426",
"0.53703356",
"0.5349771",
"0.5344792",
"0.5330573",
"0.5327964",
"0.5317632",
"0.53148... | 0.6355195 | 1 |
PATCH/PUT /g4_dongal_board_lives/1 PATCH/PUT /g4_dongal_board_lives/1.json | def update
respond_to do |format|
if @g4_dongal_board_life.update(g4_dongal_board_life_params)
format.html { redirect_to @g4_dongal_board_life, notice: 'G4 dongal board life was successfully updated.' }
format.json { render :show, status: :ok, location: @g4_dongal_board_life }
else
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @live_aboard.update(live_aboard_params)\n format.html { redirect_to @live_aboard, notice: 'Live aboard was successfully updated.' }\n format.json { render :show, status: :ok, location: @live_aboard }\n else\n format.html { render :edit }\n ... | [
"0.6350618",
"0.6309449",
"0.62700576",
"0.62493056",
"0.6225186",
"0.61616766",
"0.61464125",
"0.61160904",
"0.61110204",
"0.61022705",
"0.60901403",
"0.60864025",
"0.6083294",
"0.6080137",
"0.6069572",
"0.60575724",
"0.60575724",
"0.6049142",
"0.6043794",
"0.60405684",
"0.6... | 0.6603124 | 0 |
DELETE /g4_dongal_board_lives/1 DELETE /g4_dongal_board_lives/1.json | def destroy
@g4_dongal_board_life.destroy
respond_to do |format|
format.html { redirect_to g4_dongal_board_lives_url, notice: 'G4 dongal board life was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @graveyard.destroy\n respond_to do |format|\n format.html { redirect_to graveyards_url }\n format.json { head ... | [
"0.6787148",
"0.6787148",
"0.6776047",
"0.66678405",
"0.66668624",
"0.66631466",
"0.6601874",
"0.65811366",
"0.65811366",
"0.65570873",
"0.65568954",
"0.6555981",
"0.65506774",
"0.65450805",
"0.6508817",
"0.6489668",
"0.6489114",
"0.6475761",
"0.6462632",
"0.64532435",
"0.644... | 0.7264278 | 0 |
Encode the temporal expression into +codes+. | def encode(codes)
encode_list(codes, @years)
codes << encoding_token
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def encode(codes)\n encode_list(codes, @days)\n codes << encoding_token\n end",
"def encode(codes)\n encode_list(codes, @weeks)\n codes << encoding_token\n end",
"def encode\n @code = \"\"\n add_check_digit_and_ensure_even_digit_size\n 0.step(@encodable.size - 1, 2) do |i|\n ... | [
"0.7304426",
"0.6767383",
"0.64246994",
"0.6260675",
"0.61554",
"0.6052014",
"0.57806444",
"0.57806444",
"0.57306635",
"0.5701775",
"0.5606594",
"0.56039166",
"0.5589813",
"0.55358315",
"0.5489029",
"0.54518265",
"0.54444075",
"0.54103553",
"0.5396086",
"0.53835905",
"0.53568... | 0.6798351 | 1 |
Serialize retina_dimensions if mounted to class has a retina_dimensions column | def mount_uploader(*args)
original_mount_uploader(*args)
serialize :retina_dimensions if table_exists? && columns_hash.has_key?('retina_dimensions')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def serialize\n\n\t\t{\n\t\t\twidth: @width, height: @height, mines: @mines, \n\t\t\tcell_size: @cell_size,\n\t\t}\n\n\tend",
"def store_dimensions\n return nil unless file && model\n\n # Note: file on Heroku is CarrierWave::Storage::Fog::File but in dev it's\n # CarrierWave::SanitizedFile (whether GCLO... | [
"0.5838203",
"0.57619655",
"0.569255",
"0.5639831",
"0.56112516",
"0.5562489",
"0.53710765",
"0.53633153",
"0.5299633",
"0.52928567",
"0.5274846",
"0.52627623",
"0.5235053",
"0.5235015",
"0.52322435",
"0.5208622",
"0.5206143",
"0.5200012",
"0.51837045",
"0.5165387",
"0.513234... | 0.6282395 | 0 |
Returns an array of Times representing the opening and closing times of this Place between +startAt+ and +endAt+ | def schedule(startAt,endAt,opts={})
## Caching ##
@schedules ||= {}
if @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]
return @schedules[(startAt.xmlschema+endAt.xmlschema+opts.to_s).hash]
end
## End Caching ##
# TODO Handle events starting within the range but ending outsi... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_times_array(padding = true)\n @times = (padding) ? [@start_dt - 1.hour] : [@start_dt]\n \n # and including every 1/2 hour until one hour after the selected end time\n while true do\n tmp = @times.last + 30.minutes\n (padding) ? (tmp == (@end_dt + 1.hour)) ? break : '' : (tmp == @end_dt... | [
"0.6497007",
"0.59098506",
"0.5897343",
"0.5853915",
"0.57841593",
"0.5771392",
"0.57023984",
"0.5647339",
"0.5640666",
"0.5524755",
"0.54804415",
"0.54413384",
"0.54336673",
"0.5417881",
"0.54117066",
"0.53994346",
"0.5387614",
"0.5376027",
"0.5351545",
"0.53449816",
"0.5335... | 0.6103833 | 1 |
Obtain single CDF value Returns the probability that a stochastic variable x is less than X, i.e. P(x<X) | def get_cdf(x)
if x >= @lower && x < @upper
(x - @lower).fdiv(@upper - @lower)
elsif x >= @upper
1.0
else
0.0
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def probability_lower_than(value)\n probability_for_sides(:<, value)\n end",
"def get_cdf(x)\n return 0.5 + 0.5 * Math.erf((Math.log(x.to_f) - @meanlog) / (NumericalConstants::SQRT2 * @sdlog))\n end",
"def get_cdf(x)\n raise \"method 'cdf' not implemented for student t\"\n end",
"def... | [
"0.66019666",
"0.65201014",
"0.64938265",
"0.64415234",
"0.62931585",
"0.6164105",
"0.61587465",
"0.61431086",
"0.61372626",
"0.6108529",
"0.60630566",
"0.60486436",
"0.60329247",
"0.6014305",
"0.6005895",
"0.59431034",
"0.5901901",
"0.58371156",
"0.5828301",
"0.5798785",
"0.... | 0.6564936 | 1 |
Returns an array of suffixes for each chunk, in alphabetical order. For example: [aa, ab, ac, ad, ae] or [aaa, aab, aac aad] | def chunk_suffixes
chunks.map { |chunk| File.extname(chunk).split("-").last }.sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunk_suffixes\n chunks.map do |chunk|\n File.extname(chunk).split(\"-\").last\n end.sort\n end",
"def suffix_array text\n sufs = {}\n 0.upto(text.length - 1){|i| sufs[text[i..text.length]] = i}\n lexo_sufs = sufs.keys.sort\n array = []\n lexo_sufs.each{|s| array << sufs[s]}\n array... | [
"0.75436664",
"0.73064035",
"0.72185963",
"0.64578176",
"0.62116957",
"0.5884414",
"0.5848429",
"0.5818345",
"0.5716512",
"0.561798",
"0.55411017",
"0.5511726",
"0.5460196",
"0.53845996",
"0.5375466",
"0.5336151",
"0.53166455",
"0.52881604",
"0.52673864",
"0.525677",
"0.52396... | 0.7478786 | 1 |
Returns an array of full paths to the backup chunks. Chunks are sorted in alphabetical order. | def chunks
Dir[File.join(Config.tmp_path, package.basename + "-*")].sort
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chunks\n Dir[\"#{model.file}-*\"].sort\n end",
"def get_bag_paths\n bag_paths = Array.new\n \n Dir.glob(@path).each do |entry|\n if !(File.directory? entry) || entry == \".\" || entry == \"..\"\n next\n end\n \n bag_paths.push entry\n end\n \n ... | [
"0.6198102",
"0.59166926",
"0.5823255",
"0.57746917",
"0.5662597",
"0.5555852",
"0.55254996",
"0.54982215",
"0.54180866",
"0.5409183",
"0.5395605",
"0.53900915",
"0.5343963",
"0.5332324",
"0.5323415",
"0.5309111",
"0.5298276",
"0.5288528",
"0.52704346",
"0.5263583",
"0.526358... | 0.6470217 | 0 |
Returns only the most recent budget created by the user | def current_budget
Budget.where(user_id: current_user.id).sort_by(&:created_at).last
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_last_bid\n self.bids.max_by {|bid| bid.created_at}\n end",
"def latest_dosage\n dosages.order(date_given: :desc).first\n end",
"def find_latest_ticket(end_user_id)\n end_user = client.user.find(id: end_user_id)\n end_user.requested_tickets(sort_by: :updated_at, sort_order: :desc).first\n ... | [
"0.66106296",
"0.64322376",
"0.6276718",
"0.61590546",
"0.6125074",
"0.61066216",
"0.60924083",
"0.60848254",
"0.60177803",
"0.59961706",
"0.59803516",
"0.59708774",
"0.5914271",
"0.58935827",
"0.58644557",
"0.5861451",
"0.58541226",
"0.58413506",
"0.58051544",
"0.5776839",
"... | 0.8312912 | 0 |
This function connects a pattern with a block. A pattern is either a String or a Regex instance. Optionally, a second argument can be provided which is either a String, Symbol or Array of resource record types which the rule matches against. match(" match("gmail.com", IN::MX) match(/g?mail.(com|org|net)/, [IN::MX, IN::... | def match(*pattern, &block)
@rules << Rule.new(pattern, block)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match(*args)\n if args.first.is_a?(Qo::Matchers::GuardBlockMatcher)\n Qo::Matchers::PatternMatch.new(*args)\n else\n match_target, *qo_matchers = args\n Qo::Matchers::PatternMatch.new(*qo_matchers).call(match_target)\n end\n end",
"def match(pattern); end",
"def match... | [
"0.66065353",
"0.65639335",
"0.64466745",
"0.64453673",
"0.6169437",
"0.6105952",
"0.6029837",
"0.5993804",
"0.594868",
"0.5938817",
"0.5911829",
"0.58942026",
"0.58737826",
"0.58718103",
"0.58718103",
"0.58428234",
"0.58189875",
"0.5817546",
"0.57853884",
"0.57853884",
"0.57... | 0.7259967 | 0 |
Fire the named event, which must have been registered using on. | def fire(event_name)
callback = @events[event_name]
if callback
callback.call(self)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fire_event(name)\n @_node.fireEvent(name)\n end",
"def trigger(name, *args)\n Events.use(name, *args)\n end",
"def fire(event_name, opts = {})\n adapter.fire name_with_suffix(event_name), opts do\n yield opts if block_given?\n end\n end",
"def fire_event(event_name, re... | [
"0.77659446",
"0.7224864",
"0.70432025",
"0.6991312",
"0.6989028",
"0.6989028",
"0.681445",
"0.6756925",
"0.6745033",
"0.6452781",
"0.6402948",
"0.6383673",
"0.63708586",
"0.63152546",
"0.6301037",
"0.6282573",
"0.6277452",
"0.6245285",
"0.62258697",
"0.62253225",
"0.6223314"... | 0.7883768 | 0 |
Return the name of the results table to display | def results_view
'capital_project_search_results_table'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def results_view\n 'general_ledger_account_search_results_table'\n end",
"def output_results_table(results={})\n\tputs \"-----------------------------------------\"\n\tputs \"| Type \t | Mean \t | Median \t|\"\n\tputs \"-----------------------------------------\"\n\tresults.each do |label, hash|\n\t\... | [
"0.71292627",
"0.67005277",
"0.6690627",
"0.65437436",
"0.6527185",
"0.6462985",
"0.64054364",
"0.6399318",
"0.63923943",
"0.6383158",
"0.634059",
"0.633635",
"0.6310288",
"0.6281024",
"0.6265888",
"0.62590307",
"0.6250866",
"0.62205875",
"0.6178755",
"0.6176683",
"0.6171725"... | 0.70261025 | 1 |
Funding Source type is wrapped up in the structure of funding requests (will have state_funding_source_id or federal_funding_source_id column populated) | def funding_source_conditions
unless funding_source.blank?
case FundingSourceType.find(funding_source).name
when "Federal"
CapitalProject.joins(:activity_line_items => {:funding_requests => :federal_funding_line_item})
when "State"
CapitalProject.joins(:activity_line_items => {:fun... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def funding_source_params\n params.require(:funding_source).permit(:name)\n end",
"def source_object\n case source_type\n # (this may eventually be replaced with source_id)\n when \"project\" then project\n when \"source\" then nil # (haven't created \"Source\" model yet)\n when \"user\" t... | [
"0.6147664",
"0.60141367",
"0.58312654",
"0.58198094",
"0.58056825",
"0.58046013",
"0.57624054",
"0.57247907",
"0.56673336",
"0.5561894",
"0.5527859",
"0.5456567",
"0.5394896",
"0.5356775",
"0.5345599",
"0.5271514",
"0.52548134",
"0.52495974",
"0.5234211",
"0.52099556",
"0.52... | 0.6887322 | 0 |
Test PJ Model in [Email Notification Function] Test: users_in_mailing_list() Input: + New PJ is created. + TCANA admin logged in. Expected: users_in_mailing_list function return TCANA admin. | def test_ut_t5_sef_pj_001
current_user = User.find(TCANA_ADMIN_ID)
new_pj = Pj.create(:name => "test_pj",
:pu_id => PU_ID)
EVENT_IDS.each do |event_id|
users = new_pj.users_in_mailing_list(event_id,current_user)
assert_not_nil users
users.each do |e|
user = User.find(e[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ut_t5_sef_pj_002\n current_user = User.find(PU_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n EVENT_IDS.each do |event_id|\n users = new_pj.users_in_mailing_list(event_id,current_user)\n assert users.blank?\n end\n end",
"def test_ut_t5_sef_pj_006\n... | [
"0.8049243",
"0.7718252",
"0.76834863",
"0.7637645",
"0.7622925",
"0.760629",
"0.75957334",
"0.71326137",
"0.6914831",
"0.639231",
"0.61951506",
"0.6103672",
"0.60366565",
"0.60154915",
"0.5914471",
"0.59079516",
"0.5864561",
"0.5855069",
"0.58513784",
"0.5788367",
"0.5777922... | 0.80791014 | 0 |
Input: + New PJ is created. + PU admin logged in. Expected: users_in_mailing_list function return no users. | def test_ut_t5_sef_pj_002
current_user = User.find(PU_ADMIN_ID)
new_pj = Pj.create(:name => "test_pj",
:pu_id => PU_ID)
EVENT_IDS.each do |event_id|
users = new_pj.users_in_mailing_list(event_id,current_user)
assert users.blank?
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def blank_join_list\n if params[:signup] && params[:signup][:email]\n pw = Digest::SHA1.hexdigest(\"--#{Time.now.to_s}#{self.object_id}#{Array.new(256){rand(256)}.join}\")\n user = User.new\n user.password = user.password_confirmation = pw\n user.email = params[:signup][:email]\n user.n... | [
"0.70394754",
"0.6973215",
"0.69183517",
"0.6897707",
"0.6810902",
"0.66514504",
"0.6583319",
"0.6544974",
"0.64853156",
"0.625375",
"0.6007596",
"0.5991986",
"0.59286666",
"0.592638",
"0.592553",
"0.59183353",
"0.5916323",
"0.58888215",
"0.5879726",
"0.58553374",
"0.57899135... | 0.737322 | 0 |
Test: users_not_in_mailing_list() Input: + New PJ is created. + TCANA admin logged in. Expected: users_not_in_mailing_list function return all these above users except TCANA admin | def test_ut_t5_sef_pj_007
current_user = User.find(TCANA_ADMIN_ID)
new_pj = Pj.create(:name => "test_pj",
:pu_id => PU_ID)
#
EVENT_IDS.each do |event_id|
un_users = new_pj.users_not_in_mailing_list(event_id,current_user)
un_users.each do |user_id|
user = User.find(user_id[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ut_t5_sef_pj_008\n current_user = User.find(PU_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n un_users = new_pj.users_not_in_mailing_list(event_id,current_user)\n un_users.each do |user_id|\n user = User.find(u... | [
"0.79056746",
"0.7436026",
"0.7430999",
"0.7112992",
"0.7077619",
"0.6875776",
"0.68277776",
"0.67767626",
"0.63529",
"0.6279218",
"0.6185659",
"0.6140296",
"0.60956484",
"0.5998027",
"0.598824",
"0.5947046",
"0.59418046",
"0.5922785",
"0.5920353",
"0.58850926",
"0.58801997",... | 0.7928234 | 0 |
Input: + New PJ is created. + TCANA admin, PU/PJ admin, PJ member is assigned to be this PJ member. + PU admin logged in. Expected: users_not_in_mailing_list function return all these above users except TCANA admin | def test_ut_t5_sef_pj_008
current_user = User.find(PU_ADMIN_ID)
new_pj = Pj.create(:name => "test_pj",
:pu_id => PU_ID)
#
EVENT_IDS.each do |event_id|
un_users = new_pj.users_not_in_mailing_list(event_id,current_user)
un_users.each do |user_id|
user = User.find(user_id[1])
... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ut_t5_sef_pj_007\n current_user = User.find(TCANA_ADMIN_ID)\n new_pj = Pj.create(:name => \"test_pj\",\n :pu_id => PU_ID)\n #\n EVENT_IDS.each do |event_id|\n un_users = new_pj.users_not_in_mailing_list(event_id,current_user)\n un_users.each do |user_id|\n user = User.fin... | [
"0.72188455",
"0.68080235",
"0.67812437",
"0.676382",
"0.6657425",
"0.64235926",
"0.64207387",
"0.62110204",
"0.616823",
"0.6130393",
"0.6093417",
"0.6066623",
"0.5972039",
"0.5907327",
"0.583898",
"0.5746646",
"0.5740697",
"0.57304215",
"0.5728015",
"0.57214165",
"0.5715943"... | 0.7219435 | 0 |
Input: + Pj has ph_id = 3 Expect: Pj had not analyzed task | def test_ut_t4_mtv_pu_002
pj = Pj.find(3)
assert_equal FALSE, pj.has_analyzed_task?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_ut_t4_mtv_pj_001\n pj = Pj.find(1)\n assert_equal TRUE, pj.has_analyzed_task?\n end",
"def test_ut_t4_mtv_pu_002\n pu = Pu.find(2)\n assert_equal FALSE, pu.has_analyzed_task?\n end",
"def test_ut_t4_mtv_pu_001\n pu = Pu.find(1)\n assert_equal TRUE, pu.has_analyzed_task?\n end",
... | [
"0.6581046",
"0.5898692",
"0.5863738",
"0.52280205",
"0.52207625",
"0.5197072",
"0.51197505",
"0.51004624",
"0.50949836",
"0.4985218",
"0.4975346",
"0.49433348",
"0.49362007",
"0.49293035",
"0.49125966",
"0.49078116",
"0.49030244",
"0.48974273",
"0.48883086",
"0.48761272",
"0... | 0.65218556 | 1 |
after an idea progress has been saved, notify the owner and subscribers | def after_commit(idea_progress)
# only process if a create just occurred
# - see after_create method above
if idea_progress.send_notification
# determine if idea is realized
if idea_progress.is_completed && idea_progress.url
# idea realized
# notify owner if wants notification
if idea_progress.... | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def save!\n ScriptoriaCore::Ruote.engine.storage_participant.do_update(_workitem)\n end",
"def perform_work\n object_client.notify_goobi\n end",
"def inform_goal_of_new_contribution\n self.goal.check_for_completion!(self.goal_participant)\n end",
"def save(*)\n super.tap { |res... | [
"0.64183325",
"0.6415203",
"0.62567264",
"0.625113",
"0.6189967",
"0.61509526",
"0.6105813",
"0.60953826",
"0.6088025",
"0.60529435",
"0.60441643",
"0.604202",
"0.6022783",
"0.6022693",
"0.6020467",
"0.60061324",
"0.5995345",
"0.5956427",
"0.5941829",
"0.5936379",
"0.59234154... | 0.7254583 | 0 |
GET /starts GET /starts.json | def index
@starts = Start.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @launchstarts = Launchstart.all\n end",
"def all_startups(options={})\n get(\"1/startups\", options)\n end",
"def start\n @homes = Home.all\n\n respond_to do |format|\n format.html # start.html.erb\n format.json { render json: @homes }\n end\n end",
"def start\... | [
"0.65527344",
"0.6432792",
"0.6374035",
"0.6374035",
"0.6231602",
"0.6207804",
"0.6190304",
"0.6190304",
"0.613447",
"0.5927713",
"0.59002614",
"0.58721894",
"0.5857689",
"0.5842823",
"0.5836324",
"0.5803938",
"0.57915896",
"0.5787564",
"0.57834405",
"0.5776439",
"0.5773984",... | 0.7251397 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.