query stringlengths 7 9.55k | document stringlengths 10 363k | metadata dict | negatives listlengths 0 101 | negative_scores listlengths 0 101 | document_score stringlengths 3 10 | document_rank stringclasses 102
values |
|---|---|---|---|---|---|---|
Convert line breaks to paragraphs. | def add_line_breaks(str)
simple_format(str, {}, sanitize: false)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paragraphize(input)\n \"#{input.lstrip.rstrip.gsub(/\\n\\n/, '</p><p>').gsub(/\\n/, '')}\"\n end",
"def to_paragraphs(body)\n without_line_breaks = ignore_unnecessary_line_breaks body\n paragraphs = split_body_to_paragraphs without_line_breaks\n paragraphs = remove_blank_spaces paragraphs\n ... | [
"0.74172646",
"0.74104005",
"0.70495063",
"0.69335634",
"0.685042",
"0.6638869",
"0.66311604",
"0.65363556",
"0.6533562",
"0.6517662",
"0.64685994",
"0.64419806",
"0.63590586",
"0.63533914",
"0.63533914",
"0.6350873",
"0.62821573",
"0.6171709",
"0.61607224",
"0.61418337",
"0.... | 0.0 | -1 |
Create links out of bare URLs, and add externallink icons to them. Leave untouched any link tags entered in description field. This is an artifact of a) the way things worked before link tags were allowed in the Sufia description field b) obsolete communications guidelines. We may later decide to overhaul the content such that the content contains no bare links. | def turn_bare_urls_into_links(str)
Rinku.auto_link(str) do |text|
"<i class=\"fa fa-external-link\" aria-hidden=\"true\"></i> #{text}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def html_filter_annotate_bare_links\n @html.search('a[@href]').each do |node|\n href = node.attributes['href'].content\n text = node.inner_text\n\n next unless href == text || href[0] == '#' ||\n CGI.unescapeHTML(href) == \"mailto:#{CGI.unescapeHTML(text)}\"\n\n ... | [
"0.6379881",
"0.63793135",
"0.6373063",
"0.6321923",
"0.62787575",
"0.6273679",
"0.6250364",
"0.6162387",
"0.61537766",
"0.60876155",
"0.60818875",
"0.60145783",
"0.59852105",
"0.59778076",
"0.59717673",
"0.5966451",
"0.59498274",
"0.5948937",
"0.5938999",
"0.59212315",
"0.59... | 0.71543694 | 0 |
Parse the coordinates into an array of arrays. | def parse_coordinates(coordinates, format: :array, third_dim: ABSENT)
return coordinates if format == :array
key = THIRD_DIM_MAP[third_dim]
coordinates.map do |c|
if third_dim == ABSENT
[c[:lat], c[:lng]]
else
[c[:lat], c[:lng], c[key]]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def coordinates\n arr = []\n (0...@size).each do |row|\n (0...@size).each do |column|\n arr << Coordinate.new(x: row,y: column)\n end\n end\n arr\n end",
"def coordinate_array\n\t\t[latitude,longitude]\n\tend",
"def coordinates\n raw_coords = multivalue_field('c... | [
"0.7395922",
"0.68630964",
"0.6844302",
"0.68428946",
"0.68329823",
"0.6747194",
"0.6526422",
"0.6526422",
"0.65152466",
"0.6484685",
"0.6418001",
"0.641542",
"0.6393551",
"0.6350474",
"0.6327507",
"0.62880176",
"0.62700236",
"0.6266974",
"0.61984026",
"0.6192657",
"0.6192657... | 0.6838237 | 4 |
Uses veriable integer encoding to encode an unsigned integer. | def encode_unsigned_varint(value, appender)
while value > 0x1F
pos = (value & 0x1F) | 0x20
appender.call(ENCODING_TABLE[pos])
value >>= 5
end
appender.call(ENCODING_TABLE[value])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def decode_uinteger_value(value)\n build_integer(value, 0, value.length)\n end",
"def encode_uint8(int); [int].pack(PACK_FORMAT_UINT8); end",
"def encode_uint32(value)\n [value].pack(\"L>\")\n end",
"def encode_uint64(value)\n [value].pack(\"Q>\")\n end",
"def encode_varint(... | [
"0.68076015",
"0.6772702",
"0.6479252",
"0.64195776",
"0.63262033",
"0.63009226",
"0.6254384",
"0.6170657",
"0.61574215",
"0.60281885",
"0.59519935",
"0.5947744",
"0.5906996",
"0.58914816",
"0.57937145",
"0.5754946",
"0.57216376",
"0.57173246",
"0.5672619",
"0.5647399",
"0.56... | 0.72121304 | 0 |
Transform a integer `value` into a variable length sequence of characters. | def encode_scaled_value(value, appender)
negative = value.negative?
value = value << 1
value = ~value if negative
encode_unsigned_varint(value, appender)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_string(value, n)\n value.length < 3 ? value * n : value[0..2] * n\nend",
"def pad(val, number_of_places)\n str = val.to_s\n while(str.length < number_of_places) do\n str = '0' + str\n end\n str\n end",
"def solution(value)\n answer = \"\"\n number_string = value.to_s\n ( 5 - nu... | [
"0.6405041",
"0.6003121",
"0.598537",
"0.5945142",
"0.5936587",
"0.5906959",
"0.5831862",
"0.5799427",
"0.5796513",
"0.57830113",
"0.57439905",
"0.57395834",
"0.5733646",
"0.57222944",
"0.56709284",
"0.56616986",
"0.563689",
"0.56100404",
"0.5604961",
"0.5604332",
"0.55969095... | 0.0 | -1 |
before_action :authenticate_with_token! respond_to :json | def index
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authenticate_with_token!\n render json: { errors: 'Acesso não autorizado!' }, status: 401 unless user_logged_in?\n end",
"def authenticate_with_token!\n render json: { errors: \"Not authenticated\" }, status: :unauthorized unless user_signed_in?\n end",
"def authenticate_with_token!\n renders js... | [
"0.83475745",
"0.83345324",
"0.82125074",
"0.7754041",
"0.7743527",
"0.7743527",
"0.76421064",
"0.7501688",
"0.7444051",
"0.74348855",
"0.73978233",
"0.7394526",
"0.73807245",
"0.73256046",
"0.7295442",
"0.7272344",
"0.7262006",
"0.72535914",
"0.72415864",
"0.7234468",
"0.722... | 0.0 | -1 |
UNIT TESTS FOR METHOD print_result(result) Equivalence classes: n/a This test case checks that printing an integer actually prints to the console | def test_print
var = 30
assert_kind_of Integer, var
assert_output(var)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def display_result(result)\r\n puts result\r\n end",
"def printResult(result)\r\n puts\r\n puts \" Least number of times you can copy paste a \"\r\n puts \" print statement: #{result}\"\r\n puts \"======================== END ========================\\n\\n\"\r\nend",
"def test_print_results\n @d... | [
"0.6877891",
"0.6839862",
"0.6684243",
"0.6672758",
"0.657899",
"0.641779",
"0.63579226",
"0.62681544",
"0.62681544",
"0.61923563",
"0.6177306",
"0.61699086",
"0.61197686",
"0.6107868",
"0.6099753",
"0.6079041",
"0.6040359",
"0.6013766",
"0.5973085",
"0.59480685",
"0.5940145"... | 0.72190344 | 0 |
UNIT TESTS FOR METHOD self.numeric?(look_ahead) Equivalence classes: look_ahead is not a number > returns nil look_ahead is a number > returns the index of the last number found | def test_numeric_positive
test_value = RPN.numeric?(6)
assert_equal(test_value,0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_num\n la = $lookahead\n\n return expected(\"Integer\") unless is_digit(la)\n\n lookahead\n\n la\nend",
"def number?\n lookahead?([:T_INT, :T_FLOAT])\n end",
"def get_num\n value = 0\n\n return expected(\"Integer\") unless is_digit($lookahead)\n\n while is_digit($lookahead)\n value = 1... | [
"0.70159787",
"0.69276947",
"0.6881152",
"0.6543469",
"0.6486724",
"0.6251445",
"0.6226373",
"0.6225203",
"0.62236947",
"0.6221067",
"0.6208557",
"0.6175206",
"0.6128722",
"0.6126248",
"0.6126248",
"0.6093593",
"0.60811913",
"0.6056387",
"0.598245",
"0.59731627",
"0.5969839",... | 0.5847667 | 29 |
UNIT TESTS FOR METHOD self.letter?(look_ahead) Equivalence classes: look_ahead is not a alphabet letter > returns nil look_ahead is an alphabet letter > returns the index of the last letter found | def test_letter
test_value = RPN.letter?('a')
assert_equal(test_value,0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def letter?(lookAhead)\n lookAhead =~ /[A-Za-z]/\n end",
"def letter?(lookAhead)\n\t\tlookAhead =~ /[A-Za-z]/\n\tend",
"def letter?(lookAhead)\n if lookAhead =~ /[[:alpha:]]/\n return true\n else\n return false\n end\nend",
"def letter?(lookAhead)\r\n\t\tlookAhead =~ /^[a-z]|[A-Z]$/\r\n\tend",
... | [
"0.7838478",
"0.779758",
"0.76821023",
"0.7650876",
"0.7077939",
"0.7011756",
"0.6908443",
"0.687596",
"0.6851348",
"0.67837226",
"0.67371964",
"0.6683321",
"0.6676616",
"0.65785754",
"0.6573812",
"0.65598685",
"0.6509207",
"0.65042",
"0.6496638",
"0.649267",
"0.6480379",
"... | 0.63265276 | 38 |
UNIT TESTS FOR METHOD self.symbol?(look_ahead) Equivalence classes: look_ahead is not an operator symbol > returns nil look_ahead is an operator symbol > returns the index of the last symbol found | def test_negative_symbol
test_value = RPN.symbol?('-')
assert_equal(test_value,0)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_operator_symbol(symbol)\n \n symbol_array = ['+', '-', '*', '/']\n \n symbol_array.each do |sym|\n if symbol.to_s.split('').include?(sym) == true\n return true\n break\n else\n return false\n end\n end\nend",
"def known_symbol?(s)\n @@known_symb... | [
"0.6514743",
"0.6375788",
"0.62920225",
"0.62127054",
"0.6208199",
"0.6109989",
"0.60212946",
"0.6001679",
"0.600008",
"0.5963296",
"0.59365344",
"0.5879739",
"0.5830198",
"0.57816887",
"0.57816887",
"0.57816887",
"0.57816887",
"0.57816887",
"0.57816887",
"0.5777272",
"0.5777... | 0.5718503 | 24 |
UNIT TESTS FOR METHOD check_let(keyword) Equivalence classes: keyword = 'LET' (caseinsensitive) > returns true keyword != 'LET' (caseinsensitive) > return false Create a string with mixed upper and lowercase letters, verify that the downcase method makes all the letters lowercase | def test_downcase_string
test = 'MiXeD'
down = test.downcase
assert_equal down, 'mixed'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_capital_letters\n v = Verify.new\n return_code = v.verify_second_pipeset('2As3', '2As3')\n assert_equal 1, return_code\n end",
"def test_small_words_within_phrase\n %w( a an and as at but by en for if in of on or the to v v. via vs vs. ).each do |word|\n \n # Test in a string\n ... | [
"0.6299661",
"0.60561407",
"0.5973382",
"0.5933541",
"0.5905903",
"0.5900394",
"0.58565724",
"0.581914",
"0.5816895",
"0.5813604",
"0.5802129",
"0.57760894",
"0.573724",
"0.57348186",
"0.57244337",
"0.56954813",
"0.5673532",
"0.565339",
"0.56441915",
"0.5637084",
"0.5628368",... | 0.5915386 | 4 |
Create a new RPN, verify that LET can be caseinsensitive, and verify that check_let returns true on valid input | def test_check_let
RPN rpn = RPN.new(1)
let = 'let'
assert_equal let, 'let'
assert rpn.check_let(let)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_let\n RPN rpn = RPN.new(2)\n let = 'foo'\n refute_equal let, 'let'\n refute rpn.check_let(let)\n end",
"def test_not_print\n RPN rpn = RPN.new(2)\n print = 'leT'\n refute_equal let.downcase, 'print'\n refute rpn.check_print(print)\n end",
"def politician_name_checker_crea... | [
"0.6769745",
"0.61224586",
"0.5715112",
"0.5705755",
"0.5433115",
"0.53864974",
"0.5369079",
"0.52962184",
"0.52690864",
"0.52497226",
"0.5130873",
"0.510512",
"0.5100687",
"0.5093426",
"0.50641626",
"0.5019788",
"0.50126594",
"0.5011989",
"0.4969935",
"0.49659005",
"0.496024... | 0.71380395 | 0 |
Create a new RPN and verify that check_let will return false with incorrect input | def test_not_let
RPN rpn = RPN.new(2)
let = 'foo'
refute_equal let, 'let'
refute rpn.check_let(let)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_let\n RPN rpn = RPN.new(1)\n let = 'let'\n assert_equal let, 'let'\n assert rpn.check_let(let)\n end",
"def test_not_print\n RPN rpn = RPN.new(2)\n print = 'leT'\n refute_equal let.downcase, 'print'\n refute rpn.check_print(print)\n end",
"def solver\n if checkrule(0... | [
"0.73636216",
"0.6289784",
"0.5453979",
"0.54471844",
"0.52890295",
"0.5215531",
"0.52038467",
"0.52038467",
"0.5194829",
"0.51770175",
"0.5149521",
"0.51079595",
"0.50511134",
"0.5042513",
"0.50424266",
"0.49992064",
"0.49951527",
"0.4994622",
"0.49751937",
"0.49568883",
"0.... | 0.7415937 | 0 |
UNIT TESTS FOR METHOD check_print(keyword) Equivalence classes: keyword = 'PRINT' (caseinsensitive) > returns true keyword != 'PRINT' (caseinsensitive) > return false Create a new RPN and verify that check_print returns true on valid input | def test_check_print
RPN rpn = RPN.new(2)
print = 'print'
assert_equal print, 'print'
assert rpn.check_print(print)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_print\n RPN rpn = RPN.new(2)\n print = 'leT'\n refute_equal let.downcase, 'print'\n refute rpn.check_print(print)\n end",
"def test_user_input_driver_print_valid\n\n end",
"def print!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1... | [
"0.7559676",
"0.581756",
"0.5800547",
"0.5660068",
"0.55917645",
"0.55795884",
"0.5555967",
"0.5549805",
"0.54334116",
"0.53807384",
"0.5377816",
"0.53582835",
"0.5337732",
"0.53304505",
"0.5313584",
"0.5313584",
"0.5260948",
"0.5255454",
"0.52353376",
"0.5211019",
"0.5206696... | 0.7779315 | 0 |
Create a new RPN and verify that check_print will return false with incorrect input | def test_not_print
RPN rpn = RPN.new(2)
print = 'leT'
refute_equal let.downcase, 'print'
refute rpn.check_print(print)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_check_print\n RPN rpn = RPN.new(2)\n print = 'print'\n assert_equal print, 'print'\n assert rpn.check_print(print)\n end",
"def test_check_let\n RPN rpn = RPN.new(1)\n let = 'let'\n assert_equal let, 'let'\n assert rpn.check_let(let)\n end",
"def test_not_let\n RPN rpn = R... | [
"0.7257095",
"0.59641004",
"0.59185284",
"0.56126887",
"0.5474711",
"0.54608345",
"0.54137576",
"0.52059317",
"0.5186488",
"0.51747465",
"0.5164451",
"0.51512617",
"0.5119125",
"0.5109912",
"0.5085725",
"0.5078865",
"0.50724226",
"0.5060679",
"0.5055261",
"0.5054874",
"0.5023... | 0.74291044 | 0 |
UNIT TESTS FOR METHOD quit(quit_keyword) quit_keyword = 'QUIT' (caseinsensitive) > exit quit_keyword != 'QUIT' (caseinsensitive) > do nothing Create a new RPN and verify that quit exits on valid input | def test_quit
RPN rpn = RPN.new(1)
quit = 'QUIT'
assert_equal quit, 'quit'
assert_respond_to rpn.quit(quit), exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_not_quit\n RPN rpn = RPN.new(1)\n quit = 'laboon'\n refute_equal quit, 'quit'\n assert_silent() { sim.quit(quit) }\n end",
"def quit; end",
"def quit; end",
"def quit; @quit = 1 end",
"def test_keyword_quit\n token_parser = TokenParser.new\n str = 'QUIT'\n assert token_parser... | [
"0.7852589",
"0.6895092",
"0.6895092",
"0.67719376",
"0.67363477",
"0.6717077",
"0.65723443",
"0.65562105",
"0.64746565",
"0.6408756",
"0.6394149",
"0.63795346",
"0.6366376",
"0.6342716",
"0.6339054",
"0.62797326",
"0.6270771",
"0.6255505",
"0.62485397",
"0.6210533",
"0.62012... | 0.78717494 | 0 |
Create a new RPN and verify that quit will not exit with incorrect input | def test_not_quit
RPN rpn = RPN.new(1)
quit = 'laboon'
refute_equal quit, 'quit'
assert_silent() { sim.quit(quit) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pcr_prompt\n puts \"\\n***************For the following questions, Please provide which test you have receieved.***********************************\"\n puts \"\\n\\nDid you receive a PCR swab test? Please type 'yes' or 'no'. (For informaiton about PCR or other testing types, please visit https://www.cdc.... | [
"0.58503693",
"0.5830705",
"0.57715786",
"0.5770372",
"0.5761758",
"0.5640406",
"0.56041414",
"0.55979407",
"0.55948085",
"0.5480829",
"0.5479379",
"0.5454601",
"0.5442427",
"0.54270166",
"0.534264",
"0.5332797",
"0.5318246",
"0.5292074",
"0.52900594",
"0.5282837",
"0.5275513... | 0.6695594 | 0 |
UNIT TESTS FOR METHOD write_let(letter, number) Equivalence classes: letter is not a valid letter > return false letter is a valid letter > hash letter to number in an array Create a letter and verify that the system treats it as a letter | def test_is_a_letter
assert_equal true, RPN.letter?('c').zero?
refute_equal true, RPN.letter?('$').zero?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_5_verify_letter_is_added_to_bucket_array_if_good\r\n $bucket = []\r\n letter = \"a\"\r\n results = good_letter(letter)\r\n assert_equal([\"a\"], $bucket)\r\n end",
"def test_12_add_wrong_letter_to_wrong_count_array\r\n $wrong_count = [\"z\", \"x\", \"w\", \"q\", \"d\", \"f\", \"k\", \"m\... | [
"0.6448512",
"0.62839425",
"0.6247155",
"0.6232716",
"0.6227641",
"0.6222573",
"0.6121278",
"0.6096344",
"0.6056553",
"0.6023394",
"0.5912998",
"0.5879544",
"0.5836607",
"0.5835641",
"0.5822236",
"0.5780672",
"0.57716566",
"0.57624567",
"0.5722734",
"0.57151425",
"0.57120895"... | 0.5563732 | 40 |
UNIT TESTS FOR METHOD self.symbol_calculate(symbol, operand1, operand2) Equivalence classes: symbol = '+' > operand2 + operand1 symbol = '' > operand2 operand1 symbol = '' > operand2 operand1 symbol = '/' > operand2 / operand1 | def test_symbol_calculate_plus
operand1 = 10
operand2 = -3
sum = operand1 + operand2
assert_equal true, RPN.symbol?('+').zero?
assert_equal 7, sum
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n elsif operation == \"multiply\" || operation == \"*\"\n return \"#{n1} * #{n2} = #{n1*n2... | [
"0.6533487",
"0.64761734",
"0.6358428",
"0.63110876",
"0.6310091",
"0.6308935",
"0.6261803",
"0.62595606",
"0.61335516",
"0.6095548",
"0.60756886",
"0.6067394",
"0.60599047",
"0.60216314",
"0.60070986",
"0.60049134",
"0.5994116",
"0.59626025",
"0.5961037",
"0.59601504",
"0.59... | 0.7304159 | 0 |
TEST 17 UNIT TESTS FOR METHOD calculate_postfix_expression(expression) SUCCESS CASES: The expression is valid and the arithmetic is correct FAILURE CASES: If the expression is invalid in any way, or the arithmetic is incorrect | def test_calculate_postfix_numbers
RPN rpn = RPN.new(2)
expression = '1 2 +'
assert_equal rpn.calculate_postfix_expression(expression), 3
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_e1311_postfix_evaluator\n verify_method :e1311_postfix_evaluator,\n :with =>\n [\n {param: '1 2 +', expect: 3},\n {param: '1 2 3 +', expect: 6},\n {param: '3 4 - 5 +'... | [
"0.848634",
"0.8463767",
"0.8022603",
"0.7986915",
"0.78369623",
"0.7772433",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.7771957",
"0.74361926",
"0.73175305",
"0.7314818",
"0.7303462",
... | 0.8408463 | 2 |
UNIT TESTS FOR METHOD rpn_driver(user_input, keyword, rpn) SUCCESS CASES: The user_input, keyword, and rpn are valid FAILURE CASES: None of the arguments are valid or the driver doesn't handle the arithmetic | def test_user_input_driver_print_valid
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rpn_calculator(str)\nend",
"def rpnout \n @input1 = params[:search_string]\n#Begin catches all errors like zero division Type Error and nil cant be coerced into a float\n\nbegin\n #Call the gem RpnCalculator and evaluate @input from form\n \n @result = RpnCalculator.evaluate(@input1)\n #Rounds to ... | [
"0.6359594",
"0.58404064",
"0.57046646",
"0.5626866",
"0.5500398",
"0.5464064",
"0.53131324",
"0.53009427",
"0.528842",
"0.51842165",
"0.51159585",
"0.5105312",
"0.51032853",
"0.5054712",
"0.503643",
"0.50209415",
"0.5009859",
"0.49534848",
"0.4948869",
"0.49394715",
"0.49360... | 0.5300409 | 8 |
GET /user_reports/1 GET /user_reports/1.xml | def show
@user_report = UserReport.find(params[:id])
respond_to do |format|
format.html # edit.html.erb
format.xml { render :xml => @user_report }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @user_reports = UserReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user_reports }\n end\n end",
"def index\n @user_reports = UserReport.find_all_by_spam(false, :include => :user, :order => 'user_reports.created_a... | [
"0.76290756",
"0.71519715",
"0.70653063",
"0.6842781",
"0.6788871",
"0.6680859",
"0.66511124",
"0.659505",
"0.65549976",
"0.6493356",
"0.64805776",
"0.64690405",
"0.64690405",
"0.6468307",
"0.6457758",
"0.64543414",
"0.64414346",
"0.64017165",
"0.63991576",
"0.63953644",
"0.6... | 0.6975994 | 3 |
GET /user_reports/new GET /user_reports/new.xml | def new
@user_report = UserReport.new
respond_to do |format|
format.html # new.html.erb
format.xml { render :xml => @user_report }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @user_reports = UserReport.new(params[:user_report])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user_reports }\n end\n end",
"def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @repor... | [
"0.7708791",
"0.744753",
"0.72834355",
"0.71507174",
"0.70684445",
"0.70684445",
"0.7038818",
"0.69809115",
"0.69310635",
"0.6881937",
"0.6824412",
"0.6767731",
"0.67447966",
"0.67403674",
"0.6738187",
"0.67316735",
"0.6722761",
"0.67204136",
"0.67087907",
"0.6699119",
"0.668... | 0.7801488 | 0 |
POST /user_reports POST /user_reports.xml | def create
@user_report = UserReport.new(params[:user_report])
respond_to do |format|
if @user_report.save
flash[:notice] = 'UserReport was successfully created.'
format.html { redirect_to(@user_report) }
format.xml { render :xml => @user_report, :status => :created, :location => @user_report }
else
format.html { render :action => "new" }
format.xml { render :xml => @user_report.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def post_report dep_name, user, vars, log\n require 'net/http'\n require 'uri'\n\n returning(Net::HTTP.post_form(\n URI.parse('http://gist.github.com/api/v1/xml/new'),\n {\n \"files[from]\" => user,\n \"files[vars.yml]\" => vars,\n \"files[#{dep_name}.log]\" ... | [
"0.6677747",
"0.66758627",
"0.66620237",
"0.6629133",
"0.65627354",
"0.64391965",
"0.6431855",
"0.6428493",
"0.637676",
"0.63612",
"0.6356502",
"0.6330893",
"0.62330633",
"0.6220424",
"0.6110917",
"0.608539",
"0.6080479",
"0.607878",
"0.6066214",
"0.6056832",
"0.599875",
"0... | 0.68960774 | 0 |
PUT /user_reports/1 PUT /user_reports/1.xml | def update
@user_report = UserReport.find(params[:id])
respond_to do |format|
if @user_report.update_attributes(params[:user_report])
flash[:notice] = 'UserReport was successfully updated.'
format.html { redirect_to(@user_report) }
format.xml { head :ok }
else
format.html { render :action => "edit" }
format.xml { render :xml => @user_report.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @user_reports = UserReport.find(params[:id])\n\n respond_to do |format|\n if @user_reports.update_attributes(params[:user_report])\n flash[:notice] = 'UserReport was successfully updated.'\n format.html { redirect_to(@user_reports) }\n format.xml { head :ok }\n el... | [
"0.7069234",
"0.64965284",
"0.6311282",
"0.6184804",
"0.6166341",
"0.61397934",
"0.6128155",
"0.6116337",
"0.6102123",
"0.606546",
"0.6052924",
"0.60071504",
"0.59383136",
"0.59203887",
"0.59202456",
"0.5918748",
"0.59143806",
"0.5895895",
"0.5869708",
"0.5867932",
"0.5863927... | 0.6915547 | 1 |
DELETE /user_reports/1 DELETE /user_reports/1.xml | def destroy
@user_report = UserReport.find(params[:id])
@user_report.destroy
respond_to do |format|
format.html { redirect_to(user_reports_url) }
format.xml { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @user_reports = UserReport.find(params[:id])\n @user_reports.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_reports_url) }\n format.xml { head :ok }\n end\n end",
"def report_delete(id)\r\n\t\tpost= { \"token\" => @token, \"report\" => id } \r\n\t\tdocxm... | [
"0.7618442",
"0.7365839",
"0.69974405",
"0.689065",
"0.6863244",
"0.6863244",
"0.68260115",
"0.6786227",
"0.6770737",
"0.6768292",
"0.6768292",
"0.6751529",
"0.66948354",
"0.6646248",
"0.66073346",
"0.66003513",
"0.65716815",
"0.65624577",
"0.6558615",
"0.6551955",
"0.6527098... | 0.7532968 | 1 |
change later GET /landings GET /landings.xml | def index
@landings = Landing.all
respond_to do |format|
format.html # index.html.erb
format.xml { render :xml => @landings }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @landings = Landing.all\n end",
"def index\n @landings = Landing.all\n end",
"def show\n @land = Land.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @land }\n end\n end",
"def index\n @lands = Land.paginate ... | [
"0.68362594",
"0.68362594",
"0.6760059",
"0.65389216",
"0.6441934",
"0.63788944",
"0.6310935",
"0.6206788",
"0.620125",
"0.6058821",
"0.60012096",
"0.5958538",
"0.5945528",
"0.5930574",
"0.5913066",
"0.5876246",
"0.5875157",
"0.5874378",
"0.5874378",
"0.5850666",
"0.5842566",... | 0.75168544 | 0 |
this does an endless loop as a "server" | def zeromq_pull_server name,
endpoint = "ipc://#{IPCDIR}/#{name}.ipc",
ctx: :pull,
&block
grand_server ZMQ::PULL, name, endpoint, ctx: ctx, bind: true, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n connect = false\n until connect do\n begin\n call { |server| @server = server ; start }\n rescue\n Waves::Logger.error e.to_s\n sleep 1\n end\n connect = true\n end\n end",
"def loop_forever; end",
"def ser... | [
"0.75611573",
"0.74268275",
"0.72715425",
"0.7248813",
"0.7220039",
"0.7138934",
"0.70907503",
"0.70907503",
"0.69925064",
"0.69884264",
"0.69872177",
"0.6979823",
"0.6979823",
"0.69616747",
"0.6956946",
"0.6955604",
"0.6894437",
"0.68508816",
"0.68455815",
"0.6836314",
"0.68... | 0.0 | -1 |
we make the request and return the response | def zeromq_request name,
endpoint = "ipc://#{IPCDIR}/#{name}.ipc",
**opts,
&block
h = grand_pusher ZMQ::REQ, name, endpoint, **opts, &block
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_request\n response = @http.request(@request)\n end",
"def do_request()\n uri = URI.parse(API_BASE_URL + build_request_path())\n response = Net::HTTP.get_response(uri)\n response.body\n end",
"def request\n self.response = prepare_response(http_communication.content)\n ... | [
"0.7734122",
"0.75163823",
"0.7324121",
"0.7274051",
"0.7250698",
"0.7195205",
"0.7160233",
"0.7127533",
"0.70853263",
"0.70496833",
"0.6986446",
"0.6950778",
"0.6877195",
"0.6861398",
"0.68591046",
"0.6854963",
"0.6839532",
"0.6838875",
"0.6824472",
"0.6824472",
"0.68184304"... | 0.0 | -1 |
I worked on this challenge i worked with: Tori Huang]. Your Solution Below | def factorial(number)
if number == 0
return 1
else
final_factorial = 1
for x in 1..number
final_factorial = final_factorial * x
end
return final_factorial
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 => 2\r\n #p[1]=5 q[1]=5 t 4 => 4\r\n \r\n \r... | [
"0.6728879",
"0.6726973",
"0.6650952",
"0.66082144",
"0.6309417",
"0.610757",
"0.60342526",
"0.60202146",
"0.6017861",
"0.6009625",
"0.60033125",
"0.5995693",
"0.5892673",
"0.5880516",
"0.5862258",
"0.58531636",
"0.58498394",
"0.58363634",
"0.5827988",
"0.5822908",
"0.5808244... | 0.0 | -1 |
The install type for the agentstandard (GitHub) or container | def install_type(arg = nil)
res = set_or_return(:install_type,
arg.nil? ? arg : arg.to_sym,
kind_of: Symbol,
equal_to: [:standard, :container],
default: :standard)
provider(arg.to_s.capitalize) if arg
res
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def installer_package?\n installer_type.blank?\n end",
"def package_types\n case Ohai['platform_family']\n when 'debian'\n %w(deb)\n when 'fedora', 'rhel'\n %w(rpm)\n when 'aix'\n %w(bff)\n when 'solaris2'\n %w(solaris)\n when 'windows'\n %w(ms... | [
"0.6297019",
"0.60873413",
"0.5993212",
"0.59126717",
"0.5876905",
"0.57980514",
"0.57632524",
"0.5714754",
"0.57122517",
"0.57043904",
"0.5696873",
"0.56413406",
"0.5612702",
"0.5531608",
"0.5531412",
"0.55141133",
"0.55092764",
"0.55028325",
"0.5489116",
"0.54880726",
"0.54... | 0.6211642 | 2 |
The source to pull in the Shipyard application from | def source(arg = nil)
set_or_return(:source, arg, kind_of: [String, NilClass], default: nil)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def source\n ap get_source\n end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"def source; end",
"... | [
"0.5957757",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.5752753",
"0.57506067",
"0.56595397",
"0.56595397",
... | 0.0 | -1 |
The Docker image to download for a containerbased install | def docker_image(arg = nil)
set_or_return(
:docker_image,
arg,
kind_of: [String, NilClass],
default: install_type == :container ? default_docker_image : nil,
callbacks: { 'A `docker_image` requires a container install' =>
->(a) { a.nil? ? true : install_type == :container },
'A `docker_image` cannot be used with a `source`' =>
->(a) { a.nil? ? true : source.nil? } }
)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_docker_image(image_version)\n @process_runner.execute!(\"cd #{@working_directory} && docker build -t #{repository_name}:latest -t #{repository_name}:#{image_version} .\")\n end",
"def build_docker_image\n return if File.exist?(Kubes.config.state.path)\n Build.new(@options).run\n end",
... | [
"0.6862341",
"0.6827714",
"0.6702109",
"0.6569127",
"0.6554598",
"0.652254",
"0.64714724",
"0.6436985",
"0.62833816",
"0.62619144",
"0.62050277",
"0.61964816",
"0.6195572",
"0.6121831",
"0.6090223",
"0.60637844",
"0.60454446",
"0.6008229",
"0.59639394",
"0.5936693",
"0.586784... | 0.62251735 | 10 |
The version of the agent to install | def version(arg = nil)
set_or_return(:version, arg, kind_of: String, default: 'latest')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def engine_version\n\t\tAgent.engine_version_for_agent string\n\tend",
"def engine_version\n Agent.engine_version_for_user_agent string\n end",
"def version\n fetch('vehicle.version')\n end",
"def ddl_version(agent)\n ddl = agent_ddl(agent)\n ddl.meta[:version]\n end"... | [
"0.78660995",
"0.772601",
"0.7454633",
"0.72439766",
"0.71551543",
"0.7146672",
"0.71290106",
"0.70989513",
"0.7059147",
"0.7051195",
"0.704656",
"0.70461947",
"0.7041415",
"0.7028874",
"0.70268416",
"0.70065445",
"0.69991803",
"0.69708705",
"0.69708705",
"0.69708705",
"0.697... | 0.0 | -1 |
creates votes hash by the finalists amount | def cast_votes finalists
# create vote by input finalist
votes = Hash[finalists.map {|finalist| [finalist, 0]}]
# randomly add member votes to finalists
@members.each do |member|
pick = votes.keys.sample
votes[pick] += 1
puts "#{member.to_s} gave vote for #{pick}".yellow
end
votes
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cast_votes(finalists)\n total_votes = {finalists[0] => 0, finalists[1] => 0}\n @members.each do |member|\n vote = finalists.sample\n puts \"#{member.to_s.capitalize.pink} voted for #{vote.to_s.capitalize.light_blue}.\"\n total_votes[vote] += 1 \n end\n ... | [
"0.6536551",
"0.60825163",
"0.6039722",
"0.5836124",
"0.5836124",
"0.5836124",
"0.5836124",
"0.5836124",
"0.5836124",
"0.5836124",
"0.5766492",
"0.5601627",
"0.5586101",
"0.55728424",
"0.55165964",
"0.5506623",
"0.542262",
"0.5408465",
"0.53474796",
"0.5342973",
"0.53366494",... | 0.7288002 | 0 |
Note about session 'omniauth_error_return'... Since we have a sign in and log in page, with omniauth actions doing the exact same thing, we need to track where to return them to. | def google_oauth2
# You need to implement the method below in your model (e.g. app/models/user.rb)
@user = User.find_for_google_oauth2(request.env["omniauth.auth"])
if @user.persisted?
#flash[:notice] = I18n.t "devise.omniauth_callbacks.success", :kind => "Google"
sign_in_and_redirect @user, :event => :authentication
else
session["devise.google_data"] = request.env["omniauth.auth"]
if !session['omniauth_error_return'].nil? && session['omniauth_error_return'] == 'log_in'
redirect_to log_in_url
else
redirect_to sign_up_url
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def redirect_callbacks\n setup_env_params\n\n session['dta.omniauth.auth'] = request.env['omniauth.auth']\n .except('extra')\n session['dta.omniauth.params'] = omniauth_params\n tweak_session_attrs\n has_params = session['dta.omniauth.params']\n\n... | [
"0.71846867",
"0.6987326",
"0.67561054",
"0.6678708",
"0.6586645",
"0.6579777",
"0.6556778",
"0.65380853",
"0.65161216",
"0.6514883",
"0.6392303",
"0.63829756",
"0.63829756",
"0.63637894",
"0.63494873",
"0.6347026",
"0.63266265",
"0.6307058",
"0.6290293",
"0.6269418",
"0.6262... | 0.0 | -1 |
t.integer "user_id" t.string "status" t.datetime "order_time" t.datetime "pickup_time" t.datetime "fulfillment_time" t.datetime "created_at", null: false t.datetime "updated_at", null: false | def create
@order = Order.create(order_params.merge(user_id: current_user.id))
process_order_items
if @order.save
OrderNotifier.kitchen(@order).deliver_now
OrderNotifier.customer(@order).deliver_now
else
invalid_request
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def action_date\n case object.status\n when 'paid'\n object.created_at\n when 'canceled'\n object.closed_at\n when 'shipped'\n object.shipped_at\n when 'accepted'\n object.accepted_at\n end\n end",
"def lead_time\n if completed_at\n completed_at - cr... | [
"0.5900553",
"0.5852865",
"0.5809541",
"0.56716025",
"0.5645348",
"0.5623345",
"0.557551",
"0.5566412",
"0.55576134",
"0.55511975",
"0.5537849",
"0.55123293",
"0.5482841",
"0.54601544",
"0.54247946",
"0.5383342",
"0.5380505",
"0.53601617",
"0.53535646",
"0.53455865",
"0.53190... | 0.0 | -1 |
called when a new websocket connection is made | def start_connect
# increment id to use as counter for each connections color
if controller_store[:id] == 7
controller_store[:id] = 0
end
controller_store[:id] += 1
connection_store[:id] = controller_store[:id]
# send the connection's color
send_message :curColor, controller_store[:colors][connection_store[:id]]
# sends array data used to display drawing
send_message :Draw, [
controller_store.collect_all(:x),
controller_store.collect_all(:y),
controller_store.collect_all(:drag),
controller_store[:color]
]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def websocket; end",
"def websocket; end",
"def receive(websocket_message); end",
"def initialize(url, cookies, logs: false, &handler)\n @super_logger = Logger.new(logs ? 'ws_super_logger.log' : '/dev/null')\n\n @uri = URI.parse(url)\n @url = \"ws#{@uri.scheme.split(\"\")[4]}://#{@uri.ho... | [
"0.7648182",
"0.7648182",
"0.7367147",
"0.7058308",
"0.7026102",
"0.6970328",
"0.68558884",
"0.66535825",
"0.66340977",
"0.6600166",
"0.65855545",
"0.652976",
"0.6528848",
"0.65201813",
"0.6474723",
"0.63914907",
"0.6335068",
"0.629707",
"0.6296762",
"0.62851995",
"0.6254859"... | 0.0 | -1 |
override assignment so we can massage scores into what they need to be ie. strings become ints | def home_score=(score)
normalised_score = hash_values_to_ints(score)
# if the above fails, stick in whatever we got, so that errors are correct
self[:home_score] = score if normalised_score.nil?
self[:home_score] = normalised_score unless normalised_score.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_score; end",
"def assign_score=(_arg0); end",
"def scores=(value)\n if value.is_a? String\n value = value.split(/[, ]+/).reject(&:blank?)\n end\n super\n end",
"def score=(_); end",
"def score_convert(n) \n score = 0\n if n.length <= 2 #if the score is in \"A\", ... | [
"0.7364378",
"0.7165108",
"0.6916187",
"0.6890668",
"0.6500172",
"0.63902295",
"0.62932926",
"0.6236709",
"0.6182246",
"0.6136195",
"0.61333066",
"0.61296827",
"0.6114091",
"0.6070785",
"0.6038603",
"0.6035376",
"0.60315394",
"0.5983525",
"0.59682465",
"0.5936285",
"0.591385"... | 0.55820805 | 61 |
override assignment so we can massage scores into what they need to be ie. strings become ints | def away_score=(score)
normalised_score = hash_values_to_ints(score)
# if the above fails, stick in whatever we got, so that errors are correct
self[:away_score] = score if normalised_score.nil?
self[:away_score] = normalised_score unless normalised_score.nil?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def assign_score; end",
"def assign_score=(_arg0); end",
"def scores=(value)\n if value.is_a? String\n value = value.split(/[, ]+/).reject(&:blank?)\n end\n super\n end",
"def score=(_); end",
"def score_convert(n) \n score = 0\n if n.length <= 2 #if the score is in \"A\", ... | [
"0.736254",
"0.71630615",
"0.69162744",
"0.6889082",
"0.64998436",
"0.63871694",
"0.62924784",
"0.62339664",
"0.61808074",
"0.6134016",
"0.6131949",
"0.61278903",
"0.6112312",
"0.60705537",
"0.6037023",
"0.60342175",
"0.6032215",
"0.59821796",
"0.5966704",
"0.5934349",
"0.591... | 0.0 | -1 |
to refactor; also in dc_slot.rb | def flavor_descriptor
"#{self.fgsku.flavor.shorthand} #{self.fgsku.sizegroup}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def slot_id\n super\n end",
"def to_slot( _ )\n raise \"Not implemented for #{self}\"\n end",
"def to_slot(compiler)\n raise \"not implemented in #{self}:#{self.class}\"\n end",
"def private; end",
"def slot\n Item.find(item_id).slot\n end",
"def slot_definition(compiler)\n ... | [
"0.6065127",
"0.5966858",
"0.5774973",
"0.56914705",
"0.56007576",
"0.5563623",
"0.5370036",
"0.53068054",
"0.5289903",
"0.52383643",
"0.52383643",
"0.52383643",
"0.52383643",
"0.5233053",
"0.52327067",
"0.51881963",
"0.5174168",
"0.5157619",
"0.5153534",
"0.5150816",
"0.5150... | 0.0 | -1 |
The LoggingHelpers mixin attaches a StringIO to Scrolls to capture log messages. | def test_scrolls_logs_to_stream
Scrolls.log(key: 'value')
assert_equal("app=test_app key=value", Scrolls.stream.string.strip)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def capture_log(&block)\n tmp = $log\n $log = StringIO.new\n yield\n return $log.string\nensure\n $log = tmp\nend",
"def capture_log(&block)\n tmp = $log\n $log = StringIO.new\n yield\n return $log.string\n ensure\n $log = tmp\n end",
"def set_scrolls_context\n ::Scrolls.context(re... | [
"0.5841854",
"0.5791342",
"0.5654509",
"0.5541528",
"0.53616273",
"0.5247023",
"0.5179728",
"0.5050335",
"0.5012301",
"0.5002743",
"0.49964464",
"0.49964464",
"0.49964464",
"0.49964464",
"0.49964464",
"0.49681228",
"0.49110648",
"0.49042702",
"0.48972094",
"0.48934668",
"0.48... | 0.60735494 | 0 |
format a object call function | def objfn(txt)
raise 'not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call(object); end",
"def to_text\n \"#{name}: #{call}\"\n end",
"def format=(procedure); end",
"def format!; end",
"def awesome(object)\n if Thread.current[AD].include?(object.object_id)\n nested(object)\n else\n begin\n Thread.current[AD] << object.object_id\n ret... | [
"0.66549367",
"0.6482313",
"0.645",
"0.644368",
"0.6430194",
"0.64295644",
"0.63759744",
"0.63759744",
"0.63759744",
"0.63759744",
"0.63250434",
"0.62304276",
"0.62143236",
"0.62143236",
"0.62143236",
"0.62143236",
"0.62143236",
"0.62143236",
"0.62143236",
"0.62143236",
"0.61... | 0.59187716 | 34 |
format a special variable | def special(txt, sub)
raise 'not implemented'
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def format_variable(v)\n\t if v.kind_of?(Gerber::ApertureMacro::Variable)\n\t\tindex = modifiers.index(v)\n\t\tindex ? \"$#{index}\" : nil\n\t else\n\t\tv.to_s\n\t end\n\tend",
"def formatted_string\n format.dup.tap do |str|\n variables.each {|v| str.gsub!(\"%#{v}\", \"%{#{v}}\") }\n end\n e... | [
"0.7315323",
"0.6968612",
"0.6887746",
"0.667663",
"0.66634226",
"0.65376115",
"0.650504",
"0.650504",
"0.650504",
"0.650504",
"0.650504",
"0.650504",
"0.650504",
"0.650504",
"0.6401997",
"0.6401834",
"0.6400977",
"0.6398702",
"0.6398702",
"0.6398702",
"0.6398702",
"0.63927... | 0.0 | -1 |
Loop through format expressions for type and call proc on matches. Allow pre or post match strings to exist if strict is false. Otherwise wrap regexp in start and end anchors. Returns time array if matches a format, nil otherwise. | def parse(string, type, options={})
return string unless string.is_a?(String)
options.reverse_merge!(:strict => true)
sets = if options[:format]
options[:strict] = true
[ send("#{type}_expressions").assoc(options[:format]) ]
else
expression_set(type, string)
end
matches = nil
processor = sets.each do |format, regexp, proc|
full = /\A#{regexp}\Z/ if options[:strict]
full ||= case type
when :date then /\A#{regexp}/
when :time then /#{regexp}\Z/
when :datetime then /\A#{regexp}\Z/
end
break(proc) if matches = full.match(string.strip)
end
last = options[:include_offset] ? 8 : 7
if matches
values = processor.call(*matches[1..last])
values[0..2] = dummy_date_for_time_type if type == :time
return values
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def match_data\n Pdfh.verbose_print \"~~~~~~~~~~~~~~~~~~ Match Data RegEx\"\n Pdfh.verbose_print \" Using regex: #{@type.re_date}\"\n Pdfh.verbose_print \" named: #{@type.re_date.named_captures}\"\n matched = @type.re_date.match(@text)\n raise ReDateError unless matched\n\n ... | [
"0.5912079",
"0.56026894",
"0.528868",
"0.5257827",
"0.5227897",
"0.5224307",
"0.5207526",
"0.5130955",
"0.5117435",
"0.5092901",
"0.50901127",
"0.5019648",
"0.5015509",
"0.50046426",
"0.49285787",
"0.4896848",
"0.48954487",
"0.48954487",
"0.48851895",
"0.4880235",
"0.4859695... | 0.6059991 | 0 |
Removes formats where the 1 or 2 digit month comes first, to eliminate formats which are ambiguous with the European style of day then month. The mmm token is ignored as its not ambigous. | def remove_us_formats
us_format_regexp = /\Am{1,2}[^m]/
date_formats.reject! { |format| us_format_regexp =~ format }
datetime_formats.reject! { |format| us_format_regexp =~ format }
compile_format_expressions
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strftime_to_ms_format numberformat\n return nil if numberformat.nil?\n numberformat.gsub(\"%Y\", \"yyyy\").gsub(\"%A\", \"dddd\").gsub(\"%B\", \"mmmm\").gsub(\"%a\", \"ddd\").gsub(\"%b\", \"mmm\").gsub(\"%y\", \"yy\").gsub(\"%d\", \"dd\").gsub(\"%m\", \"mm\").gsub(\"%y\", \"y\").gsub(\"%y\", \"%%... | [
"0.6300776",
"0.62407714",
"0.613639",
"0.5986576",
"0.59477687",
"0.5896556",
"0.5830204",
"0.5830204",
"0.57873124",
"0.5735318",
"0.5710749",
"0.5709451",
"0.5621271",
"0.55452263",
"0.55433804",
"0.55331814",
"0.55323887",
"0.5506735",
"0.5498014",
"0.5492232",
"0.5485121... | 0.691114 | 0 |
Compile formats into validation regexps and format procs | def format_expression_generator(string_format)
regexp = string_format.dup
order = {}
regexp.gsub!(/([\.\\])/, '\\\\\1') # escapes dots and backslashes
format_tokens.each do |token|
token_name = token.keys.first
token_regexp, regexp_str, arg_key = *token.values.first
# hack for lack of look-behinds. If has a capture group then is
# considered an anchor to put straight back in the regexp string.
regexp.gsub!(token_regexp) {|m| "#{$1}" + regexp_str }
order[arg_key] = $~.begin(0) if $~ && !arg_key.nil?
end
return Regexp.new(regexp), format_proc(order)
rescue
raise "The following format regular expression failed to compile: #{regexp}\n from format #{string_format}."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _process_format(format); end",
"def _process_format(format); end",
"def process_validates validator\n hash_arg = validator.last\n return unless hash? hash_arg\n\n value = hash_access(hash_arg, FORMAT)\n\n if hash? value\n value = hash_access(value, WITH)\n end\n\n if value\n che... | [
"0.6726359",
"0.6726359",
"0.6531119",
"0.6314415",
"0.6213784",
"0.6213784",
"0.6192435",
"0.6149147",
"0.5916795",
"0.5890949",
"0.5877042",
"0.5814713",
"0.5769245",
"0.5768294",
"0.57675844",
"0.5751056",
"0.57309026",
"0.5671397",
"0.56594723",
"0.56329465",
"0.5617168",... | 0.59317255 | 8 |
Generates a proc which when executed maps the regexp capture groups to a proc argument based on order captured. A time array is built using the proc argument in the position indicated by the first element of the proc arg array. | def format_proc(order)
arg_map = format_proc_args
args = order.invert.sort.map {|p| arg_map[p[1]][1] }
arr = [nil] * 7
order.keys.each {|k| i = arg_map[k][0]; arr[i] = arg_map[k][2] unless i.nil? }
proc_string = <<-EOL
lambda {|#{args.join(',')}|
md ||= nil
[#{arr.map {|i| i.nil? ? 'nil' : i }.join(',')}].map {|i| i.is_a?(Float) ? i : i.to_i }
}
EOL
eval proc_string
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def pin_patternorder(args)\n argarr = args.split(',')\n index = 0\n new_timeset(0)\n argarr.each do |pin|\n @patternorder << pin\n @pinmap[pin].pattern_index = index\t# pattern index stored in pin object now\n @patternpinindex[pin] = index\t\t# to be removed\n... | [
"0.58555824",
"0.5270143",
"0.52536434",
"0.519276",
"0.5187468",
"0.5111797",
"0.5103268",
"0.50601447",
"0.50481015",
"0.5037818",
"0.50332654",
"0.49858895",
"0.4974521",
"0.49683934",
"0.4953222",
"0.4952944",
"0.49411318",
"0.4916048",
"0.4913358",
"0.4892776",
"0.488951... | 0.58678657 | 0 |
Pick expression set and combine date and datetimes for datetime attributes to allow date string as datetime | def expression_set(type, string)
case type
when :date
date_expressions
when :time
time_expressions
when :datetime
# gives a speed-up for date string as datetime attributes
if string.length < 11
date_expressions + datetime_expressions
else
datetime_expressions + date_expressions
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_rails_dt_attributes!(meth,dt)\n if dt && meth.match(/_(?:on|d)$/)\n write_attribute meth, dt.to_date\n elsif dt && meth.match(/_(?:at|dt)$/)\n write_attribute meth, dt.to_datetime\n else\n write_attribute meth, dt\n end\n end",
"def has_dates(*attrs)\n options = attrs.e... | [
"0.65432435",
"0.64019877",
"0.6114642",
"0.59181535",
"0.59135604",
"0.59133357",
"0.58991075",
"0.58716637",
"0.58432126",
"0.58317417",
"0.5721703",
"0.56850874",
"0.56139517",
"0.56058246",
"0.5533792",
"0.55246186",
"0.55178344",
"0.5512671",
"0.5481327",
"0.5473462",
"0... | 0.73259234 | 0 |
return time of next downbeat (in ticks) | def next_beat(now, divis = TICKS_4N)
nb = (now.to_f / divis).ceil * divis
# try skipping the below safety code, so that basic
# gestures can start on a dime!
return nb
# if time is really tight (i.e., generate_gesture event came in _right on_ a beat)
# then just skip to next beat rather than letting it fail.
# return (nb - now < 10) ? (nb + divis) : (nb)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def next_time(now=Time.now)\n\n time = as_time(now)\n time = time - time.usec * 1e-6 + 1\n # small adjustment before starting\n\n loop do\n\n unless date_match?(time)\n time += (24 - time.hour) * 3600 - time.min * 60 - time.sec; next\n end\n unless sub_match?(tim... | [
"0.6848011",
"0.6799956",
"0.6749825",
"0.67426366",
"0.66222066",
"0.65780175",
"0.65050775",
"0.64262414",
"0.63919926",
"0.63546187",
"0.63436025",
"0.6331185",
"0.6285131",
"0.62276053",
"0.6190851",
"0.6185957",
"0.61591756",
"0.61414117",
"0.61389714",
"0.6128353",
"0.6... | 0.60100913 | 29 |
find the nearest beatearlier if we can do it, otherwise leave a gap | def nearest_beat(now, first_event, divis = TICKS_4N)
earlier_beat = next_beat(now - TICKS_4N)
return (earlier_beat + first_event < now) ? next_beat(now) : earlier_beat
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def nearestGreater(a)\n \n result = []\n stack = []\n \n a.each_with_index do |el, i|\n \n while !stack.empty? and a[stack[-1]] < el\n num = stack.pop\n if result[num] == -1 || (i - num < num - result[num])\n result[num] = i\n end\n e... | [
"0.6712782",
"0.67045534",
"0.6235825",
"0.61671203",
"0.6164121",
"0.6087973",
"0.599211",
"0.59716916",
"0.58784664",
"0.5871002",
"0.58645487",
"0.5863962",
"0.5860011",
"0.5857351",
"0.5781585",
"0.57664627",
"0.57634443",
"0.5738476",
"0.5731913",
"0.5729543",
"0.5726792... | 0.57055753 | 22 |
returns an enumeration of assets for bulk sharing change based upon the parameters passed | def resolve_sharing_params(params)
param_not_isa = params[:share_not_isa]
param_isa = params[:share_isa]
if param_not_isa.blank? && param_isa.blank?
[@asset].compact
else
assets = []
unless param_not_isa.blank?
param_not_isa.keys.each do |asset_class|
param_not_isa[asset_class].keys.each do |id|
assets << eval("#{asset_class}.find_by_id(#{id})")
end
end
end
unless param_isa.blank?
param_isa.keys.each do |asset_class|
param_isa[asset_class].keys.each do |id|
assets << eval("#{asset_class}.find_by_id(#{id})")
end
end
end
assets.compact.uniq
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def resolve_sharing_params(params)\n param_not_isa = params[:share_not_isa] || {}\n param_isa = params[:share_isa] || {}\n\n if param_not_isa.blank? && param_isa.blank?\n [@asset].compact\n else\n assets = []\n Seek::Util.authorized_types.each do |klass|\n ... | [
"0.6192207",
"0.6146128",
"0.59126025",
"0.58620447",
"0.5728704",
"0.56899446",
"0.5607291",
"0.5534154",
"0.54425097",
"0.5439486",
"0.5358536",
"0.5309136",
"0.5269622",
"0.52598834",
"0.5244851",
"0.5244851",
"0.52325743",
"0.5221821",
"0.5215045",
"0.5213354",
"0.5211898... | 0.6268788 | 0 |
These might change so wrap them so we can increase them as we go along | def big_blind
START_BIG_BLIND
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def rekey_limit; end",
"def private; end",
"def width=(_); end",
"def width=(_); end",
"def spacing; 0; end",
"def probers; end",
"def line_to_wrap; end",
"def anchored; end",
"def offences_by; end",
"def tenth_frame; end",
"def magic_numbers(count)\nend",
"def width=(_arg0); end",
"def __n... | [
"0.5810264",
"0.57784504",
"0.5615274",
"0.5615274",
"0.5590985",
"0.5575815",
"0.5511321",
"0.55026233",
"0.5461222",
"0.5455772",
"0.5455029",
"0.54276145",
"0.5422797",
"0.5418756",
"0.5403644",
"0.5401852",
"0.5387325",
"0.5387325",
"0.5386892",
"0.53724355",
"0.53724355"... | 0.0 | -1 |
TODO this is dumb but will work for heads up | def dealer
if @hand
(@hand.dealer == @player1) ? @player2 : @player1
else
# coin toss
(rand(2) == 0) @player1 : @player2
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def probers; end",
"def schubert; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def formation; end",
"def offences_by; end",
"def identify; end",
"def anchored; end",
"def stderrs; end",
"def terpene; end",
"def verdi; end",
"def ... | [
"0.68636024",
"0.6356121",
"0.61101747",
"0.6082204",
"0.6082204",
"0.6082204",
"0.6082204",
"0.59327966",
"0.5876998",
"0.57763827",
"0.5749246",
"0.57320726",
"0.5691659",
"0.5620048",
"0.5587839",
"0.5557162",
"0.5538078",
"0.5494773",
"0.5494773",
"0.5494773",
"0.54537266... | 0.0 | -1 |
Only an admin can create or delete a user. | def authorized?
return false unless current_user
%w{ show index }.include?(action_name) || current_user.is_admin?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create?\n user.present? && user.admin?\n end",
"def admin_user\n unless current_user && current_user.admin?\n redirect_to login_url, notice: \"admin can only do this action.\" \n end\n end",
"def admin_user\n\t\tredirect_to(root_url) unless current_user.admin? #NB il metodo \"admin?\... | [
"0.7465552",
"0.74119866",
"0.73838675",
"0.7379976",
"0.7379458",
"0.7286961",
"0.7267469",
"0.7265577",
"0.7239858",
"0.72235984",
"0.721876",
"0.7218147",
"0.72083",
"0.72081816",
"0.7199235",
"0.7194559",
"0.71828383",
"0.7178149",
"0.71744823",
"0.715653",
"0.71485025",
... | 0.0 | -1 |
TODO : is it worth it ? what about a redirection to /users/1 ? | def load_user
i = params[:id].to_i
@user = i == 0 ? User.find_by_login(params[:id]) : User.find(i)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n redirect_to User.find(params[:user_id])\n end",
"def index\n redirect_to user_path(@user)\n end",
"def show\n redirect_to users_index_url\n end",
"def index\n \tredirect_to :controller => \"user\", :action => \"index\"\n end",
"def index\n redirect_to user_path(current_user... | [
"0.7140941",
"0.7098254",
"0.69812393",
"0.6896132",
"0.6872796",
"0.6869319",
"0.6839412",
"0.67877775",
"0.67851806",
"0.67697114",
"0.67435545",
"0.67254704",
"0.66852707",
"0.66669995",
"0.6652437",
"0.66387457",
"0.6635025",
"0.6635025",
"0.66193515",
"0.6607638",
"0.656... | 0.0 | -1 |
Sometimes SIGTERM causes Dir.mktmpdir to not properly delete the temp folder Remove 1 day old folders | def delete_old_temp_folders
path = File.join(Dir.tmpdir, STAGING_AREA_PREFIX + "*")
day = 24 * 60 * 60
dirs = Dir.glob(path)
dirs.select! { |dir| Time.now.utc - File.ctime(dir).utc > day } # only stale ones
removed = dirs.each { |dir| FileUtils.rm_rf(dir) }
log "Removed #{removed} old temp folder(s)" if removed.count > 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanTmp\n ts_str = \"/tmp/d\" + Date.today.strftime(\"%Y%m%d\") + \"-*\"\n Gitchefsync.logger.info \"clean up of #{ts_str}\"\n FS.cmdNoError \"sudo rm -fr #{ts_str}\"\n end",
"def cleanup_tmpdirs\n FileUtils.rm_r @tmpdir if @tmpdir\n end",
"def clean_tmp_dir\n system \... | [
"0.77541035",
"0.7678057",
"0.75475913",
"0.7461698",
"0.71483976",
"0.7128303",
"0.70719093",
"0.6981706",
"0.69722927",
"0.6915251",
"0.6911135",
"0.69089985",
"0.68823165",
"0.6813736",
"0.6788389",
"0.678522",
"0.6759246",
"0.66948026",
"0.66726786",
"0.6671406",
"0.66624... | 0.7158072 | 4 |
Create a new RequestHandler with the given owner pipe. +owner_pipe+ must be the readable part of a pipe IO object. Additionally, the following options may be given: connect_password | def initialize(owner_pipe, options = {})
require_option(options, "app_group_name")
install_options_as_ivars(self, options,
"app",
"app_group_name",
"connect_password"
)
@keepalive = options.fetch("keepalive", true).to_s == "true"
@force_http_session = ENV["_PASSENGER_FORCE_HTTP_SESSION"] == "true"
if @force_http_session
@connect_password = nil
end
@thread_handler = options["thread_handler"] || ThreadHandler
@concurrency = 1
#############
#############
@server_sockets = {}
if should_use_unix_sockets?
@main_socket_address, @main_socket = create_unix_socket_on_filesystem(options)
else
@main_socket_address, @main_socket = create_tcp_socket(options)
end
@server_sockets[:main] = {
:address => @main_socket_address,
:socket => @main_socket,
:protocol => @force_http_session ? :http : :session,
:concurrency => @concurrency,
:accept_http_requests => true
}
@http_socket_address, @http_socket = create_tcp_socket(options)
@server_sockets[:http] = {
:address => @http_socket_address,
:socket => @http_socket,
:protocol => :http,
:concurrency => 1
}
@owner_pipe = owner_pipe
@options = options
@previous_signal_handlers = {}
@main_loop_generation = 0
@main_loop_thread_lock = Mutex.new
@main_loop_thread_cond = ConditionVariable.new
@threads = []
@threads_mutex = Mutex.new
@main_loop_running = false
#############
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(owner_pipe, app, options = {})\n\t\tsuper(owner_pipe, options)\n\t\t@app = app\n\tend",
"def initialize(io_or_pipe)\n @io = io_or_pipe\n end",
"def owner\n @owner ||= User.new(connection, :login => @attributes[:owner])\n end",
"def initialize(info={})\n super\n\n register_opt... | [
"0.59077275",
"0.48978895",
"0.4764403",
"0.47581062",
"0.46706915",
"0.4587253",
"0.45288494",
"0.4493126",
"0.4469392",
"0.4411532",
"0.4361587",
"0.43159357",
"0.4311468",
"0.43022132",
"0.42956585",
"0.42919442",
"0.4284062",
"0.42539236",
"0.42524856",
"0.42461058",
"0.4... | 0.6674226 | 0 |
Clean up temporary stuff created by the request handler. If the main loop was started by main_loop, then this method may only be called after the main loop has exited. If the main loop was started by start_main_loop_thread, then this method may be called at any time, and it will stop the main loop thread. | def cleanup
if @main_loop_thread
@main_loop_thread_lock.synchronize do
@graceful_termination_pipe[1].close rescue nil
end
@main_loop_thread.join
end
@server_sockets.each_value do |info|
socket = info[:socket]
type = get_socket_address_type(info[:address])
begin
socket.close if !socket.closed?
rescue Exception => e
# Ignore "stream closed" error, which occurs in some unit tests.
# We catch Exception here instead of IOError because of a Ruby 1.8.7 bug.
if e.to_s !~ /stream closed/ && e.message.to_s !~ /stream closed/
raise e
end
end
if type == :unix
filename = info[:address].sub(/^unix:/, '')
File.unlink(filename) rescue nil
end
end
@owner_pipe.close rescue nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def cleanup_handler\n end",
"def cleanup_handler\n stop_handler\n\n # Kill any remaining handle_connection threads that might\n # be hanging around\n conn_threads.each { |thr|\n thr.kill rescue nil\n }\n end",
"def cleanup_handler\n\t\t# Kill any remaining handle_connection threads that m... | [
"0.6944314",
"0.6831552",
"0.6780021",
"0.6753135",
"0.67010677",
"0.6629734",
"0.66121113",
"0.64397573",
"0.64371306",
"0.6222622",
"0.61910415",
"0.61910415",
"0.6185307",
"0.61043495",
"0.61043495",
"0.61043495",
"0.61043495",
"0.6098075",
"0.60569423",
"0.6032463",
"0.60... | 0.59862506 | 25 |
Check whether the main loop's currently running. | def main_loop_running?
@main_loop_thread_lock.synchronize do
return @main_loop_running
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def running_here?\n !idle? && @self_started\n end",
"def ran_main_loop?\n @ran_main_loop_p ? true : false\n end",
"def running?\n !@manager_thread.nil? &&\n ['sleep', 'run'].include?(@manager_thread.status)\n end",
"def running?\n @thread and @thread.alive?\n end",
"def r... | [
"0.795439",
"0.7885283",
"0.7658615",
"0.7607056",
"0.7566679",
"0.75111854",
"0.745441",
"0.74448967",
"0.74382037",
"0.7397202",
"0.73965627",
"0.73753846",
"0.7350663",
"0.73355335",
"0.7329715",
"0.7307762",
"0.72880733",
"0.72875077",
"0.7272201",
"0.72569114",
"0.725609... | 0.85782427 | 0 |
Enter the request handler's main loop. | def main_loop
debug("Entering request handler main loop")
reset_signal_handlers
begin
@graceful_termination_pipe = IO.pipe
@graceful_termination_pipe[0].close_on_exec!
@graceful_termination_pipe[1].close_on_exec!
@main_loop_thread_lock.synchronize do
@main_loop_generation += 1
@main_loop_running = true
@main_loop_thread_cond.broadcast
@select_timeout = nil
@selectable_sockets = []
@server_sockets.each_value do |value|
socket = value[2]
@selectable_sockets << socket if socket
end
@selectable_sockets << @owner_pipe
@selectable_sockets << @graceful_termination_pipe[0]
end
install_useful_signal_handlers
start_threads
wait_until_termination_requested
wait_until_all_threads_are_idle
terminate_threads
debug("Request handler main loop exited normally")
rescue EOFError
# Exit main loop.
trace(2, "Request handler main loop interrupted by EOFError exception")
rescue Interrupt
# Exit main loop.
trace(2, "Request handler main loop interrupted by Interrupt exception")
rescue SignalException => signal
trace(2, "Request handler main loop interrupted by SignalException")
if signal.message != HARD_TERMINATION_SIGNAL
raise
end
rescue Exception => e
trace(2, "Request handler main loop interrupted by #{e.class} exception")
raise
ensure
debug("Exiting request handler main loop")
revert_signal_handlers
@main_loop_thread_lock.synchronize do
@graceful_termination_pipe[1].close rescue nil
@graceful_termination_pipe[0].close rescue nil
@selectable_sockets = []
@main_loop_generation += 1
@main_loop_running = false
@main_loop_thread_cond.broadcast
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start_handler\n end",
"def start_handler\n\tend",
"def start\n main_loop\n end",
"def serving_loop\n Thread.new { socket_loop }\n @manager.management_loop\n end",
"def run\n loop do\n break unless app_loop\n end\n end",
"def start\n\n # load config files\n ... | [
"0.6993165",
"0.6893265",
"0.6872871",
"0.6555238",
"0.6500629",
"0.6456017",
"0.64544106",
"0.64303786",
"0.6339771",
"0.6317774",
"0.62825054",
"0.62599534",
"0.6258303",
"0.6258115",
"0.62108654",
"0.6188447",
"0.61741406",
"0.61142725",
"0.6087884",
"0.60839343",
"0.60715... | 0.6571769 | 3 |
Start the main loop in a new thread. This thread will be stopped by cleanup. | def start_main_loop_thread
current_generation = @main_loop_generation
@main_loop_thread = create_thread_and_abort_on_exception do
main_loop
end
@main_loop_thread_lock.synchronize do
while @main_loop_generation == current_generation
@main_loop_thread_cond.wait(@main_loop_thread_lock)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n Thread.start do\n begin\n while true\n main_loop\n end\n ensure\n @protocol.close if @protocol\n end\n end\n end",
"def start\n main_loop\n end",
"def start_thread #does this need to be its own thread?\n @@thread = Thr... | [
"0.7672381",
"0.73001415",
"0.7143566",
"0.7142959",
"0.70647013",
"0.70622015",
"0.704225",
"0.70303416",
"0.7023884",
"0.7023884",
"0.6946484",
"0.6899398",
"0.6882698",
"0.6826648",
"0.6807501",
"0.6787898",
"0.67861986",
"0.6755439",
"0.6666254",
"0.6612476",
"0.66079646"... | 0.8069231 | 0 |
Reset signal handlers to their default handler, and install some special handlers for a few signals. The previous signal handlers will be put back by calling revert_signal_handlers. | def reset_signal_handlers
Signal.list_trappable.each_key do |signal|
begin
prev_handler = trap(signal, DEFAULT)
if prev_handler != DEFAULT
@previous_signal_handlers[signal] = prev_handler
end
rescue ArgumentError
# Signal cannot be trapped; ignore it.
end
end
trap('HUP', IGNORE)
PhusionPassenger.call_event(:after_installing_signal_handlers)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reset_handlers_for(signals)\n logger.debug \"Resetting signal handlers for #{signals.inspect}\"\n signals.each {|signal| Signal.trap signal, \"DEFAULT\" }\n end",
"def restore_default_signal_handlers\n HANDLED_SIGNALS.each do |sig|\n trap(sig, :DEFAULT) if ::Signal.list.include? si... | [
"0.8359454",
"0.83320534",
"0.72461444",
"0.70611143",
"0.70396465",
"0.7019418",
"0.70079964",
"0.6853801",
"0.68020177",
"0.67924976",
"0.67914206",
"0.67017955",
"0.6686618",
"0.66022336",
"0.65887064",
"0.6511355",
"0.6466753",
"0.6466753",
"0.64336514",
"0.6405163",
"0.6... | 0.86165303 | 0 |
Metodo para agregar observadores al observado | def agregar(observador)
puts "Observado: Tengo un nuevo observador #{observador.nombre}."
@observadores << observador
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notificar\n puts 'Observador: Notificando observadores...'\n @observadores.each { |observador| observador.actualizar(self) }\n end",
"def set_observ\n @observ = Observ.find(params[:id])\n end",
"def add_observer(name, obs)\n @observ_list[name] = obs\n end",
"def inform_obeservers\n\t\t... | [
"0.7224962",
"0.67150944",
"0.6385472",
"0.5739261",
"0.5735387",
"0.5704813",
"0.565078",
"0.56040627",
"0.5519915",
"0.55166143",
"0.5390966",
"0.53849226",
"0.5362211",
"0.5360187",
"0.53378445",
"0.5322429",
"0.5322429",
"0.5306696",
"0.5306288",
"0.530054",
"0.52934766",... | 0.77130467 | 0 |
Metodos para manejar a los observadores Trigger an update in each subscriber. | def notificar
puts 'Observador: Notificando observadores...'
@observadores.each { |observador| observador.actualizar(self) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def inform_obeservers\n\t\t@observers.each { |observer| observer.update(self) }\n\tend",
"def send_update\n changed\n notify_observers(self)\n end",
"def update\n super\n @observing_procs.values.each { |block| block.call(item) }\n end",
"def notify\n @observers.each { |observer| observer.updat... | [
"0.6912604",
"0.65776",
"0.63960844",
"0.627228",
"0.61343116",
"0.5970952",
"0.591306",
"0.5851661",
"0.58395815",
"0.58255386",
"0.58190185",
"0.5783119",
"0.57563734",
"0.5755537",
"0.5745437",
"0.57399434",
"0.56927854",
"0.561147",
"0.56087023",
"0.56087023",
"0.5588526"... | 0.64390856 | 2 |
La logica de la clase es la encargada de emitir las notificaciones cuando algo ocurre, en este caso cada vez que el estado cambie, se notificara a los observadores. | def logica
puts "\nObservado: Estoy haciendo algo importante"
# Con un random, podemos hacer reaccionar al ObservadorA o ObservadorB.
# @estado = rand(0..10)
# Con esto reaccionan ambos
@estado = 0
puts "\nObservado: mi estado cambio a #{@estado}"
notificar
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notificar\n puts 'Observador: Notificando observadores...'\n @observadores.each { |observador| observador.actualizar(self) }\n end",
"def notificaciones\n end",
"def guarda_observaciones_naturalista_servicio\n if !existe_cache?('observaciones_naturalista')\n if p = proveedor\n if Rai... | [
"0.68251395",
"0.5736942",
"0.5662428",
"0.5410969",
"0.53362924",
"0.5311297",
"0.5310748",
"0.52300876",
"0.5224935",
"0.51501757",
"0.5128937",
"0.51157653",
"0.5036752",
"0.50032204",
"0.49895364",
"0.4977292",
"0.49443913",
"0.4938029",
"0.49365464",
"0.49305984",
"0.492... | 0.6198227 | 1 |
FIXME need better name | def collect_every(size)
collect = []
index = 0
while true
slice = self.slice(index, size)
break if slice.nil? || slice.empty?
collect.concat(yield slice)
index += size
end
collect
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def private; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def specie; end",
"def probers; end",
"def schubert; end",
"def custom; end",
"def custom; end",
"def formation; end",
"def implementation; end",
"def implementation; end",
"def refutal()\n end",
"def internal... | [
"0.8139852",
"0.6973693",
"0.6973693",
"0.6973693",
"0.6973693",
"0.69264954",
"0.675003",
"0.65377986",
"0.65377986",
"0.6468975",
"0.6335834",
"0.6335834",
"0.6326",
"0.6321305",
"0.6305974",
"0.62587625",
"0.6207339",
"0.6196975",
"0.61855346",
"0.6162808",
"0.6162808",
... | 0.0 | -1 |
before_action :update_selected_run, only: [:index, :run, :new] GET /stocks GET /stocks.json | def index
@runs = @stocks_util.user_runs
@selected_run = @stocks_util.selected_run
set_stocks
@stocks_util.enrich_stock_from_yahoo(@stocks) if @stocks.size != 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_stock\n @stock = Stock.find(params[:id])\n end",
"def set_stock\n @stock = Stock.find(params[:id])\n end",
"def set_stock\n @stock = Stock.find(params[:id])\n end",
"def set_stock\n @stock = Stock.find(params[:id])\n end",
"def set_stock\n @stock = Stock.find(params... | [
"0.68465865",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
"0.6762122",
... | 0.7514413 | 0 |
GET /stocks/1 GET /stocks/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @stock = Stock.find(params[:id])\n\n render json: @stock\n end",
"def show\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @stock }\n end\n end",
"def show\n @stock = Stock.find(params[:id])\n\n ... | [
"0.813285",
"0.7827617",
"0.7827617",
"0.7827617",
"0.7827617",
"0.76127833",
"0.7513371",
"0.7456414",
"0.7420787",
"0.7385634",
"0.7380303",
"0.733541",
"0.7296758",
"0.7272539",
"0.71380734",
"0.71366733",
"0.7114768",
"0.7114768",
"0.7114768",
"0.7114768",
"0.7103809",
... | 0.0 | -1 |
POST /stocks POST /stocks.json | def create
symbol = params[:symbol].upcase
is_existing_stock = current_user.stocks.where(symbol: symbol, run_id: params[:run_id]).flatten.size > 0
num_of_stocks = current_user.stocks.where( run_id: params[:run_id]).flatten.size
respond_to do |format|
if !is_existing_stock && num_of_stocks != 5 && @stocks_util.validate_stock(symbol)
@stock = current_user.stocks.build({symbol:symbol, run_id: params[:run_id]})
@stock.save!
format.json { render json: "stock_added" }
else
error_msg = "adding_stock_failed"
if num_of_stocks == 5
error_msg = "already_5_stocks"
elsif is_existing_stock
error_msg = "existing_stock"
end
format.json { render json: error_msg }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @stock = Stock.new(params[:stock])\n\n respond_to do |format|\n if @stock.save\n format.html { redirect_to stocks_url, notice: 'Stock was successfully created.' }\n format.json { render json: @stock, status: :created, location: @stock }\n else\n format.html { rende... | [
"0.7304764",
"0.7258611",
"0.7258611",
"0.7258611",
"0.7258611",
"0.7221076",
"0.7193015",
"0.7193015",
"0.7193015",
"0.7193015",
"0.7193015",
"0.7193015",
"0.71179634",
"0.7115472",
"0.7012972",
"0.69397414",
"0.6908692",
"0.679796",
"0.67754006",
"0.67698586",
"0.67565894",... | 0.70998645 | 14 |
PATCH/PUT /stocks/1 PATCH/PUT /stocks/1.json | def update
respond_to do |format|
if @stock.update(stock_params)
format.html { redirect_to @stock, notice: 'Stock was successfully updated.' }
format.json { render :show, status: :ok, location: @stock }
else
format.html { render :edit }
format.json { render json: @stock.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @stock = Stock.find(params[:id])\n\n respond_to do |format|\n if @stock.update_attributes(params[:stock])\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json... | [
"0.7433786",
"0.7297452",
"0.7297452",
"0.7297452",
"0.7295128",
"0.72519654",
"0.72486717",
"0.72486717",
"0.72477585",
"0.7060393",
"0.69195443",
"0.69048566",
"0.6889293",
"0.68346685",
"0.68212485",
"0.6819722",
"0.68123454",
"0.68065983",
"0.6795806",
"0.678522",
"0.6779... | 0.72219247 | 19 |
DELETE /stocks/1 DELETE /stocks/1.json | def destroy
@stock.destroy
respond_to do |format|
format.html { redirect_to stocks_url, notice: 'Stock was successfully deleted.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n format.html { redirect_to stocks_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @stock = Stock.find(params[:id])\n @stock.destroy\n\n respond_to do |format|\n f... | [
"0.78629744",
"0.78629744",
"0.78629744",
"0.78629744",
"0.78629744",
"0.78629744",
"0.7833893",
"0.7833893",
"0.7696498",
"0.76632124",
"0.7626853",
"0.7606632",
"0.7606632",
"0.7604487",
"0.7587675",
"0.7576472",
"0.7576472",
"0.75709665",
"0.75709665",
"0.75709665",
"0.757... | 0.76833856 | 9 |
Use callbacks to share common setup or constraints between actions. | def set_stock
@stock = Stock.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.6163163",
"0.6045976",
"0.5946146",
"0.591683",
"0.5890051",
"0.58349305",
"0.5776858",
"0.5703237",
"0.5703237",
"0.5652805",
"0.5621621",
"0.54210985",
"0.5411113",
"0.5411113",
"0.5411113",
"0.5391541",
"0.53794575",
"0.5357573",
"0.53402257",
"0.53394014",
"0.53321576"... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def stock_params
params[:stock]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
, versioning: :paper_trail, fallbacks_for_empty_translations: true | def another_locale
I18n.available_locales.map(&:to_sym).select {|locale| locale != I18n.locale.to_sym }.first
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def paper_trail_enabled_for_controller\n false\n end",
"def paper_trail_enabled_for_controller\n true\n end",
"def missing_translations\n @translations.select { |x, v| v.nil? or v.blank? }\n end",
"def create_translations\n end",
"def translations; end",
"def version_language_ready_to_pu... | [
"0.57302034",
"0.5631916",
"0.56231016",
"0.557944",
"0.5561341",
"0.5504099",
"0.54906285",
"0.546308",
"0.5308633",
"0.5307568",
"0.5291523",
"0.52738714",
"0.52710456",
"0.52669215",
"0.52075857",
"0.5200844",
"0.51711386",
"0.5146792",
"0.5105695",
"0.5104758",
"0.5101329... | 0.0 | -1 |
Used to start the Landrush DNS server as a child process using ChildProcess gem | def start
with_pid_lock do |file|
# Check if the daemon is already started...
if running?(file)
@ui.info "[landrush] DNS server already running with pid #{read_pid(file)}" unless @ui.nil?
return
end
# On a machine with just Vagrant installed there might be no other Ruby except the
# one bundled with Vagrant. Let's make sure the embedded bin directory containing
# the Ruby executable is added to the PATH.
Landrush::Util::Path.ensure_ruby_on_path
ruby_bin = Landrush::Util::Path.embedded_vagrant_ruby.nil? ? 'ruby' : Landrush::Util::Path.embedded_vagrant_ruby
start_server_script = Pathname(__dir__).join('start_server.rb').to_s
@ui.detail("[landrush] starting DNS server: '#{ruby_bin} #{start_server_script} #{port} #{working_dir} #{gems_dir}'") unless @ui.nil?
if Vagrant::Util::Platform.windows?
# Need to handle Windows differently. Kernel.spawn fails to work, if
# the shell creating the process is closed.
# See https://github.com/vagrant-landrush/landrush/issues/199
#
# Note to the Future: Windows does not have a
# file handle inheritance issue like Linux and Mac (see:
# https://github.com/vagrant-landrush/landrush/issues/249)
#
# On windows, if no filehandle is passed then no files get
# inherited by default, but if any filehandle is passed to
# a spawned process then all files that are
# set as inheritable will get inherited. In another project this
# created a problem (see: https://github.com/dustymabe/vagrant-sshfs/issues/41).
#
# Today we don't pass any filehandles, so it isn't a problem.
# Future self, make sure this doesn't become a problem.
info = Process.create(command_line: "#{ruby_bin} #{start_server_script} #{port} #{working_dir} #{gems_dir}",
creation_flags: Process::DETACHED_PROCESS,
process_inherit: false,
thread_inherit: true,
cwd: working_dir.to_path)
pid = info.process_id
else
# Fix https://github.com/vagrant-landrush/landrush/issues/249)
# by turning of filehandle inheritance with :close_others => true
# and by explicitly closing STDIN, STDOUT, and STDERR
pid = spawn(ruby_bin, start_server_script, port.to_s, working_dir.to_s, gems_dir.to_s,
in: :close,
out: :close,
err: :close,
close_others: true,
chdir: working_dir.to_path,
pgroup: true)
Process.detach pid
end
write_pid(pid, file)
# As of Vagrant 1.8.6 this additional sleep is needed, otherwise the child process dies!?
sleep 1
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n @process = ChildProcess.build(*parameters)\n process.start\n end",
"def start\n logger.debug \"Starting felix with these values: \"\n logger.debug \"felix_home: #{@felix_home}\"\n logger.debug \"felix_command: #{felix_command.join(' ')}\"\n \n # Check to see if we can... | [
"0.61086476",
"0.59872746",
"0.5917836",
"0.5834499",
"0.58018744",
"0.5773009",
"0.5751814",
"0.5723095",
"0.5716752",
"0.5710433",
"0.5653626",
"0.563657",
"0.5613394",
"0.559288",
"0.5586861",
"0.55851763",
"0.5575866",
"0.556999",
"0.5568038",
"0.5564401",
"0.5530759",
... | 0.7001921 | 0 |
tells you the depth of this page in relation to the root page root is 0, below that is 1, etc.. | def level
if parent.nil?
0
else
parent.level + 1;
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def depth\n @cur_level - @base_level + 1\n end",
"def depth()\n #This is a stub, used for indexing\n end",
"def depth\n children_depth + my_depth\n end",
"def my_depth\n 1\n end",
"def depth\n breadcrumbs.size\n end",
"def depth\n depth_suppo... | [
"0.7827018",
"0.76226956",
"0.756311",
"0.75072217",
"0.74369323",
"0.73693115",
"0.7368403",
"0.735292",
"0.73091877",
"0.7289452",
"0.7279256",
"0.71578246",
"0.7154971",
"0.707501",
"0.6972326",
"0.6938815",
"0.693",
"0.6882889",
"0.68290687",
"0.6798591",
"0.678228",
"0... | 0.6100983 | 60 |
gives you a list of parent pages [0] is the root | def parents
if parent.nil?
[self]
else
parent.parents + [self]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def parents\n page, parents = self, Array.new\n while page.parent\n page = page.parent\n parents << page\n end\n parents\n end",
"def find_pages_for_parents_list\n @pages_for_parents_list = []\n Page.find_all_by_parent_id(nil, :order => \"position ASC\").each do |page|\... | [
"0.78991985",
"0.75888187",
"0.7231508",
"0.7201841",
"0.6970371",
"0.6905901",
"0.6825705",
"0.6661358",
"0.66594",
"0.6658029",
"0.66570663",
"0.66170233",
"0.6567642",
"0.6559108",
"0.6555283",
"0.65382457",
"0.65162826",
"0.65131325",
"0.6489615",
"0.6487997",
"0.6471744"... | 0.6251999 | 42 |
stop rails CSRF protection for this action | def auth
if user_signed_in?
if current_user && params[:room_id]
authentication_query=Room.includes(:rooms_users).where('rooms_users.user_id'=>current_user.id,
'rooms.id'=>params[:room_id].to_i).exists? &&
(params[:channel_name] == "private-#{params[:room_id]}" ||
params[:channel_name] == "private-#{current_user.id}"||
params[:channel_name] == "presence-status")
else
authentication_query=params[:channel_name] == "presence-status" || params[:channel_name] == "private-#{current_user.id}"
end
end
if authentication_query
auth = Pusher[params[:channel_name]].authenticate(params[:socket_id],:user_id => current_user.id)
render :json => auth
else
render :text => "Not authorized", :status => '403'
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def disable_request_forgery_protection; end",
"def disable_request_forgery_protection=(_arg0); end",
"def clean_up_csrf?; end",
"def clean_up_csrf?; end",
"def skip_forgery_protection(options = T.unsafe(nil)); end",
"def csrf; end",
"def clean_up_csrf?\n false\n end",
"def clean_up_csrf?\... | [
"0.77760774",
"0.76563007",
"0.7332915",
"0.7332915",
"0.70371854",
"0.70363104",
"0.70097077",
"0.7002428",
"0.6828669",
"0.6828669",
"0.6679377",
"0.66760176",
"0.66671306",
"0.6602603",
"0.65869737",
"0.6586769",
"0.6585341",
"0.6585341",
"0.6585341",
"0.6585341",
"0.65853... | 0.0 | -1 |
a uniform intensity value Generates some MGFspecific headers. | def headers(spec)
{
:charge => charge,
:parent_ion_mass => spec.parent_ion_mass(charge),
:title => "#{spec.sequence.gsub(/\s+/, "")} (#{series.join(', ')})"
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def gaussian94_format\n components = [\"#{characterization}\\t#{primitives_length}\\t1.00\"]\n @rows.each {|row| components << row.gaussian94_format}\n \n components.join(\"\\n\")\n end",
"def h(num)\n font_sizes.percentile(((HEADING_DEPTH - 1) - num) * HEADING_STEP)\n end",
"def functiona... | [
"0.5216186",
"0.51887566",
"0.5153235",
"0.51257616",
"0.5122163",
"0.5034705",
"0.49871364",
"0.49554732",
"0.49423897",
"0.48929158",
"0.4874799",
"0.48682597",
"0.48442322",
"0.48302132",
"0.48254022",
"0.48249447",
"0.48056886",
"0.4796335",
"0.47798976",
"0.47716376",
"0... | 0.43685606 | 87 |
Returns a Mascot::Spectrum for the peptide. | def spectrum(peptide)
Mascot::Spectrum.new(peptide, nterm, cterm)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def linear_spectrum(peptide)\n # LinearSpectrum(Peptide, AminoAcid, AminoAcidMass)\n # PrefixMass(0) ← 0\n # for i ← 1 to |Peptide|\n # for j ← 1 to 20\n # if AminoAcid(j) = i-th amino acid in Peptide\n # PrefixMass(i) ← PrefixM... | [
"0.6264299",
"0.62523884",
"0.5457567",
"0.5275319",
"0.5119077",
"0.50559205",
"0.5018467",
"0.49916613",
"0.4960324",
"0.48587793",
"0.47968814",
"0.47807172",
"0.4757609",
"0.47531095",
"0.46859965",
"0.46813586",
"0.45780048",
"0.45532215",
"0.45124203",
"0.44714054",
"0.... | 0.8756104 | 0 |
GET /themes GET /themes.json | def index
conditions = {:_id => {:$ne => current_group.current_theme_id}}
@themes = current_group.themes.where(conditions).page(params["page"])
if params[:tab] == "all"
conditions[:$or] = [{:community => true}, {:group_id => current_group.id}]
@themes = Theme.where(conditions).page(params["page"])
end
respond_to do |format|
format.html # index.html.haml
format.json { render :json => @themes }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @themes = Theme.all\n json_response(@themes)\n end",
"def get_theme\n respond theme, 200, {'Content-Type' => 'text/plain'}\n end",
"def fetch_themes(options={})\n url = build_url options\n themes = Nokogiri::XML(open(url)).search('//item').map do |item|\n Kuler::Theme.new item... | [
"0.812787",
"0.7300965",
"0.7179562",
"0.7160153",
"0.71211064",
"0.71078604",
"0.71078604",
"0.7104765",
"0.7033204",
"0.6918204",
"0.6780791",
"0.67168003",
"0.6696859",
"0.6696859",
"0.66808033",
"0.66706914",
"0.66666913",
"0.6564479",
"0.65527874",
"0.6552682",
"0.643174... | 0.6635338 | 17 |
GET /themes/1 GET /themes/1.json | def show
@theme = Theme.find(params[:id])
respond_to do |format|
format.html # show.html.haml
format.json { render :json => @theme }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @themes = Theme.all\n json_response(@themes)\n end",
"def show\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @theme }\n end\n end",
"def show\n @theme = Theme.find(params[:id])\n\n respond_to d... | [
"0.7979219",
"0.7445954",
"0.74304044",
"0.74304044",
"0.7297703",
"0.7169249",
"0.7090008",
"0.69986886",
"0.6992559",
"0.6992559",
"0.69768643",
"0.69681054",
"0.6873628",
"0.6831471",
"0.67846835",
"0.6675448",
"0.6629238",
"0.6619264",
"0.66064876",
"0.6578578",
"0.654686... | 0.7256133 | 5 |
GET /themes/new GET /themes/new.json | def new
@theme = Theme.new
respond_to do |format|
format.html # new.html.haml
format.json { render :json => @theme }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n end\n end",
"def new\n @theme = Theme.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @theme }\n end\n end"... | [
"0.80375797",
"0.80375797",
"0.80188566",
"0.80030334",
"0.79679215",
"0.73892516",
"0.726279",
"0.72351885",
"0.7168556",
"0.7028067",
"0.69959766",
"0.69700444",
"0.693015",
"0.6918306",
"0.68274295",
"0.6752841",
"0.67319167",
"0.6701851",
"0.66456354",
"0.66411185",
"0.66... | 0.7908012 | 5 |
POST /themes POST /themes.json | def create
if !current_group.shapado_version.has_custom_js?
params[:theme].delete(:javascript)
end
if !current_group.shapado_version.has_custom_themes?
params[:theme].delete(:javascript)
params[:theme].delete(:layout_html)
params[:theme].delete(:questions_index_html)
params[:theme].delete(:questions_show_html)
end
@theme = Theme.new(params[:theme])
@theme.group = current_group
@theme.ready = false
@theme.set_has_js(params[:theme][:javascript])
respond_to do |format|
if @theme.save
Jobs::Themes.async.generate_stylesheet(@theme.id).commit!(4)
format.html { redirect_to(@theme, :notice => 'Theme was successfully created.') }
format.json { render :json => @theme, :status => :created, :location => @theme }
else
format.html { render :action => "new" }
format.json { render :json => @theme.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @theme = Theme.new(params[:theme])\n\n respond_to do |format|\n if @theme.save\n format.html { redirect_to @theme, notice: 'Theme was successfully created.' }\n format.json { render json: @theme, status: :created, location: @theme }\n else\n format.html { render ac... | [
"0.7163235",
"0.70911884",
"0.70522827",
"0.7021412",
"0.6956752",
"0.69379383",
"0.6792986",
"0.6789661",
"0.6784276",
"0.6766233",
"0.67447436",
"0.6675168",
"0.66481054",
"0.66260976",
"0.66260976",
"0.6551993",
"0.652207",
"0.6487304",
"0.64622587",
"0.6433848",
"0.642596... | 0.7017689 | 4 |
PUT /themes/1 PUT /themes/1.json | def update
if !current_group.shapado_version.has_custom_js?
params[:theme].delete(:javascript)
end
if !current_group.shapado_version.has_custom_themes?
params[:theme].delete(:javascript)
params[:theme].delete(:layout_html)
params[:theme].delete(:questions_index_html)
params[:theme].delete(:questions_show_html)
end
@theme = Theme.find(params[:id])
@theme.ready = false
@theme.set_has_js(params[:theme][:javascript])
respond_to do |format|
if @theme.update_attributes(params[:theme])
Jobs::Themes.async.generate_stylesheet(@theme.id).commit!(4)
format.html { redirect_to(edit_theme_path(@theme), :notice => 'Theme was successfully updated.') }
format.json { head :ok }
else
format.html { render :action => "edit" }
format.json { render :json => @theme.errors, :status => :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n theme = Theme.find(params[:idTheme])\n if theme.update(params_theme)\n render json: theme, status: 200\n else\n render json: theme.errors, status: 422\n end\n\n end",
"def update\n @theme = Theme.find(params[:id])\n\n respond_to do |format|\n if @the... | [
"0.7363643",
"0.7092662",
"0.7092662",
"0.7092662",
"0.68349504",
"0.6783722",
"0.677551",
"0.6774066",
"0.6753175",
"0.66917133",
"0.6656574",
"0.6551912",
"0.6488639",
"0.6473615",
"0.64094436",
"0.63587356",
"0.63192934",
"0.6247706",
"0.6235097",
"0.62133145",
"0.62133145... | 0.7072041 | 4 |
DELETE /themes/1 DELETE /themes/1.json | def destroy
@theme = current_group.themes.find(params[:id])
@theme.destroy
respond_to do |format|
format.html { redirect_to(themes_url) }
format.json { head :ok }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @theme = Theme.find(params[:id])\n @theme.destroy\n\n respond_to do |format|\n format.html { redirect_to themes_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @theme = Theme.find(params[:id])\n @theme.destroy\n\n respond_to do |format|\n f... | [
"0.750061",
"0.750061",
"0.74517554",
"0.74442506",
"0.743572",
"0.7435504",
"0.73897934",
"0.7357961",
"0.72797906",
"0.72612053",
"0.72493285",
"0.72444206",
"0.7219779",
"0.7219619",
"0.71793514",
"0.7072068",
"0.70339924",
"0.69099146",
"0.6764493",
"0.6678919",
"0.664944... | 0.782452 | 0 |
Your function should return true if any value appears at least twice in the array, and it should return false if every element is distinct. | def contains_duplicate(arr)
chars_freq = Hash.new(0)
arr.each { |char| chars_freq[char] += 1 }
if chars_freq.values.max >= 2
true
else
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def no_dupes?(arr)\n count = Hash.new(0)\n arr.each { |el| count[el] += 1 }\n count.keys.select { |el| count[el] == 1 }\nend",
"def no_dupes?(arr)\n solved = Hash.new(0)\n arr.each { |ele| solved[ele] += 1 }\n solved.keys.select { |ele| solved[ele] == 1 }\nend",
"def same_values?(arr)\n ... | [
"0.79752916",
"0.7885972",
"0.78733945",
"0.7858538",
"0.78504837",
"0.78052604",
"0.7765385",
"0.7753908",
"0.76772094",
"0.76688874",
"0.76543295",
"0.76165086",
"0.75929695",
"0.7567517",
"0.75237983",
"0.7517843",
"0.7508935",
"0.7450153",
"0.7446666",
"0.74441695",
"0.74... | 0.7480928 | 17 |
It works a lot like Bundler. We provide some core modules by default. This ensures at least the ability to construct a basic environment. | def github(name, version, options = nil)
options ||= {}
options[:repo] ||= "boxen/puppet-#{name}"
mod name, version, :github_tarball => options[:repo]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def setup_environment; end",
"def setup_context\n self['console'] = Console.new\n load RUNTIME_PATH\n\n opal = self['opal']\n opal['loader'] = Loader.new opal, self\n opal['fs'] = FileSystem.new opal, self\n opal['platform']['engine'] = 'opal-gem'\n\n # eval \"opal.require('cor... | [
"0.6606999",
"0.6296658",
"0.626677",
"0.6247867",
"0.6180595",
"0.60726714",
"0.603119",
"0.6021986",
"0.6008879",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.60077566",
"0.600... | 0.0 | -1 |
function to verify idno and vcode | def verify?(idno, vcode)
if idno==''|| vcode==''
flash[:error]="All fields are required."
return false
end
#check if student exists
begin
student = Profile.find(idno)
if student.idNo==2041575 #premade Profile for nonexistent students (check web service)
flash[:error]="The student cannot be found. Please check the ID number and try again."
return false
end
#need hash formula for vcode verification here!
if vcode != hash(idno)[4..9]
flash[:error]="Invalid Verification Code #{hash(idno)[4..9]}"
return false
end
rescue
flash[:error]="The student cannot be found. Please check the ID number and try again."
return false
end
return true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def verify?(idno, vcode)\n if idno==''|| vcode==''\n flash[:error]=\"Fields can not be blank\"\n return false\n end\n\n #check if student exists\n student = Profile.find(idno)\n if student.id==3 #premade Profile for nonexistent students (check web service)\n flash[:error]=\"Student no... | [
"0.78743833",
"0.7052385",
"0.6245103",
"0.6070763",
"0.60672987",
"0.60104954",
"0.6009442",
"0.59182954",
"0.5908116",
"0.5907871",
"0.58260196",
"0.5814094",
"0.57913005",
"0.5779309",
"0.5779309",
"0.57529694",
"0.5752445",
"0.5719899",
"0.571686",
"0.56988776",
"0.568938... | 0.77808607 | 1 |
track all task runs | def build_and_run_task(task_class, params = nil)
task_run = TaskRun.new(task_class, params)
@task_run_stack.last.runs << task_run
@task_run_stack.push(task_run)
task = super(task_class, params)
@task_run_stack.pop
task
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_tasks()\n self.task_queue.each do |task|\n\n self.task_list << task\n trigger_event(:start,:task)\n\n result = self.send(task[:name],*(task[:args]))\n if result[:status] == :failed\n break\n end\n\n\n self.task_list.last[:result]=result\n trigger_event(:end,:tas... | [
"0.70123684",
"0.6969844",
"0.6844624",
"0.66985285",
"0.6368326",
"0.62910795",
"0.6283063",
"0.62740153",
"0.6259411",
"0.6259411",
"0.62514",
"0.6244853",
"0.61891097",
"0.61891097",
"0.6142522",
"0.6137418",
"0.6113329",
"0.6098293",
"0.6078285",
"0.60663277",
"0.60563713... | 0.0 | -1 |
We can optimize the performance with armlength recursion: which checks base condition before calling recursion But arm length reursion is frownedupon(have a angry look or displeased) | def permute(input, output, used_flags, n)
if n == output.length
puts output
return
end
for i in 0...n
next if used_flags[i]
output += input[i]
used_flags[i] = true
permute(input, output, used_flags, n)
used_flags[i] = false
output.chop!
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def length_calculator; end",
"def length() end",
"def length() end",
"def length() end",
"def length() end",
"def length_calculator=(_arg0); end",
"def current_length; end",
"def calc_length\n Base.calculate_and_set_length self\n end",
"def length_penalty\n (@options[:target].size ... | [
"0.63593096",
"0.6075173",
"0.6075173",
"0.6075173",
"0.6075173",
"0.605973",
"0.5855927",
"0.5840502",
"0.5766597",
"0.5755206",
"0.57450646",
"0.57398933",
"0.5730737",
"0.5730737",
"0.5730737",
"0.5730737",
"0.5730737",
"0.5730737",
"0.5730737",
"0.570397",
"0.570015",
"... | 0.0 | -1 |
GET /products/1 GET /products/1.json | def index
@products=products.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def index\n @api_v1_products = Product.all\n jso... | [
"0.77224106",
"0.76329553",
"0.76313764",
"0.7607208",
"0.75760156",
"0.7552171",
"0.7506385",
"0.7484625",
"0.745622",
"0.74501616",
"0.74376804",
"0.7421124",
"0.7362056",
"0.7318765",
"0.73185545",
"0.73185545",
"0.73185545",
"0.7316062",
"0.7311976",
"0.73088664",
"0.7294... | 0.0 | -1 |
GET /products/1 GET /products/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def product(name)\n get(\"/apiproducts/#{name}\")\n end",
"def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end",
"def show\n @product = Product.find(params[:id])\n\n render json: @product\n end",
"def index\n @api_v1_products = Product.all\n jso... | [
"0.77224106",
"0.76329553",
"0.76313764",
"0.7607208",
"0.75760156",
"0.7552171",
"0.7506385",
"0.7484625",
"0.745622",
"0.74501616",
"0.74376804",
"0.7421124",
"0.7362056",
"0.7318765",
"0.73185545",
"0.73185545",
"0.73185545",
"0.7316062",
"0.7311976",
"0.73088664",
"0.7294... | 0.0 | -1 |
detail on the squares being made being implemented | def draw
@square = Square.new(x: @x, y: @y, size: @size, color: @color)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_squares(board)\n\nend",
"def num_squares\n self.size ** 2\n end",
"def squares\n self.map(&:square)\n end",
"def squares\r\n [@a1, @a2, @a3, @b1, @b2, @b3, @c1, @c2, @c3]\r\n \r\nend",
"def show\n @squares = @grid.squares\n end",
"def sum_of_squares\n end",
"def squares\n [@a... | [
"0.6937477",
"0.6920399",
"0.6890415",
"0.6845554",
"0.6804791",
"0.6745276",
"0.6713942",
"0.669367",
"0.6681793",
"0.6672291",
"0.66506684",
"0.66059345",
"0.65656465",
"0.656006",
"0.6437285",
"0.6412592",
"0.6403345",
"0.6403345",
"0.6403345",
"0.6403345",
"0.6403345",
... | 0.63174224 | 28 |
movement with velocity as speed | def move
@x = (@x + @x_velocity) % Window.width
@y = (@y + @y_velocity) % Window.height
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def move\n move_by get_incremental_position_for_velocity if (any_velocity?)\n decrease_velocity\n @has_increased_velocity_for = {\n x: false,\n y: false\n }\n @velocity_deltatime.update\n end",
"def move_position\n @x += @velocity_x\n @y += @veloci... | [
"0.7466005",
"0.7426989",
"0.7301334",
"0.728127",
"0.72228426",
"0.7207625",
"0.7195585",
"0.7191056",
"0.7172749",
"0.7095973",
"0.70778674",
"0.7010639",
"0.6996482",
"0.69887745",
"0.69558954",
"0.6930306",
"0.6917658",
"0.6913602",
"0.6854147",
"0.68017673",
"0.67694855"... | 0.7015579 | 11 |
collision detected method asks other boxes if they include/contain the current box inside also checks if they have collided | def collision_detected?
($boxes - Array(self)).any? do |other_box|
# .include method with other_square
other_box.include?(@square)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def notify_collision(another_box)\n @box.overlaps_with?(another_box)\n end",
"def calc_box_collision\n return unless state.world_lookup.keys.length > 0 # return unless hash has atleast 1 key\n collision_floor!\n collision_left!\n collision_right!\n collision_ceiling!\n end",
"def calc_box_c... | [
"0.774542",
"0.71560943",
"0.7139919",
"0.70956635",
"0.6884646",
"0.68837965",
"0.6852403",
"0.6791641",
"0.67604727",
"0.67399144",
"0.67092735",
"0.6702298",
"0.6685057",
"0.6680137",
"0.66648155",
"0.66261214",
"0.65908056",
"0.6567702",
"0.6563129",
"0.65565974",
"0.6545... | 0.7332003 | 1 |
comparing squares bruh, squares so much easier than circles. 3D EVEN harder gotta user different formulas for circles not .include, its .contains | def include?(other_square)
# top left
@square.contains?(other_square.x1, other_square.y1) ||
# top right
@square.contains?(other_square.x1, other_square.y2) ||
# bottom right
@square.contains?(other_square.x1, other_square.y3) ||
# bottom left
@square.contains?(other_square.x1, other_square.y4)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def collision_detected?\n ($boxes - Array(self)).any? do |other_box|\n # .include method with other_square\n other_box.include?(@square)\n end\nend",
"def squaragonal?(grid)\n match?(grid) || match?(grid.reverse)\nend",
"def exists_sq?(hx, hy)\n x, y = *hex_to_sq(hx, hy)\n x_is_insid... | [
"0.6871018",
"0.6653129",
"0.66435647",
"0.6544128",
"0.6441899",
"0.6370687",
"0.6274457",
"0.6269943",
"0.62333775",
"0.6217134",
"0.61390495",
"0.61205006",
"0.6114212",
"0.6112075",
"0.6087959",
"0.60570014",
"0.60532516",
"0.6042563",
"0.6034806",
"0.60280776",
"0.602415... | 0.6925421 | 0 |
execute it based on these given parameters. | def execute actor, target=[nil]
def himher thing
multiple = thing.count > 1
if multiple
return "them"
end
case thing[0]
when Player then "him"
when ItemFacade then "it"
else ""
end
end
room_msg, self_msg, vict_msg = @ofound.dup, @found.dup, @tfound.dup
if target.include?(actor) # if they're the same person then it's an auto
target = [actor]
room_msg = @oauto.dup
self_msg = @auto.dup
vict_msg = nil
elsif target[0] == nil
room_msg = @onoarg.dup
self_msg = @noarg.dup
vict_msg = nil
end
room_msg.gsub!("$n", "<%=other.peek(actor)%>")
room_msg.gsub!("$N", "<%=other.peek(if arg[0].include?(other) then arg[0]-[other]+['You'] else arg[0] end)%>")
room_msg.gsub!("$m", himher([actor]))
room_msg.gsub!("$M", himher(target))
self_msg.gsub!("$M", himher(target))
self_msg.gsub!("$m", himher([actor]))
if target
self_msg.gsub!("$N", actor.peek(target))
end
actor.view("#G"+self_msg+"#n" + ENDL)
room_msg.untaint
if target[0]
if target.count > 1
actor.in_room.display([:visual, "other.can_see?(actor) || other.can_see?(arg[0])"], actor, [actor], "#G"+room_msg+"#n", target)
else
actor.in_room.display([:visual, "other.can_see?(actor) || other.can_see?(arg[0])"], actor, [actor, *target], "#G"+room_msg+"#n", target)
target.each do |one_targ|
vm = vict_msg.dup
vm.gsub!("$n", one_targ.peek(actor))
one_targ.view("#G"+vm+ "#n" + ENDL)
end
end
else
puts room_msg
actor.in_room.display([:visual, "other.can_see?(actor)"], actor, [actor], "#G"+room_msg+"#n", "")
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def execute; end",
"def execute; end",
"def execute(params)\n raise NotImplementedError, \"#{self.class}##{__method__} must be implemented\"\n end",
"def execute *params\r\n sql = parse_args( *params )\r\n @driver.execute( sql )\r\n end",
"de... | [
"0.69028425",
"0.69028425",
"0.68474096",
"0.6703948",
"0.6699795",
"0.6699795",
"0.6691073",
"0.6691073",
"0.66660553",
"0.6615538",
"0.6535067",
"0.65117896",
"0.65064347",
"0.64860797",
"0.64134204",
"0.63301736",
"0.6323116",
"0.6309235",
"0.6309235",
"0.6296183",
"0.6264... | 0.0 | -1 |
Returns a feature name given a actortracking url. Used so we are able to expire a cache using a feature name given an event url. Not intended to be generic, and makes no guarantees about support for alternative url schemes. | def get_name(url)
(url.match('features\/(.*)\z') || [])[1]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_feature_filename(feature)\n features_subdir = \"#{Rails.root}/#{get_tag_dir}\"\n Dir.mkdir features_subdir unless Dir.exists?(features_subdir)\n \"#{features_subdir}#{feature.id}_#{feature.subject.parameterize}.feature\"\n end",
"def name_from_url(url)\n return '' unless url.present?\n ... | [
"0.5453686",
"0.5344445",
"0.5054266",
"0.50257653",
"0.50257653",
"0.5022119",
"0.500689",
"0.49888536",
"0.49723792",
"0.49483296",
"0.4912279",
"0.4912279",
"0.49110174",
"0.49110174",
"0.4904617",
"0.4876649",
"0.48765677",
"0.48492515",
"0.479554",
"0.47914392",
"0.47879... | 0.69454926 | 0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.