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 |
|---|---|---|---|---|---|---|
Find user by this param | def user_param
params[:user_id]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_user\n results = @ldap.search( :base => options[:ldap][:base], :filter => user_filter)\n return results.first\n end",
"def find_by_id\n User.find_by_id(@username_or_id)\n end",
"def find_by_username\n User.find_by_username(@username_or_id)\n end",
"def find_by_id!\n User.find... | [
"0.7566216",
"0.7548165",
"0.7537888",
"0.7390686",
"0.73877084",
"0.7386062",
"0.7381989",
"0.7373473",
"0.735071",
"0.729144",
"0.7288163",
"0.72822285",
"0.727134",
"0.7249238",
"0.72233695",
"0.721054",
"0.7148794",
"0.7093854",
"0.7074633",
"0.7072847",
"0.7066931",
"0... | 0.0 | -1 |
Safe params from the intertube | def credit_params
@credit_params ||= params.require(:credit).permit(
:amount, :amount_in_cents
).to_h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unsolved_params\n \n end",
"def valid_params_request?; end",
"def check_params; true; end",
"def raw_params(auth); end",
"def valid_params?; end",
"def safe_params\n params.require(:safe).permit(:game_id, :sTime, :player_id)\n end",
"def valid_for_params_auth?; end",
"def magic_par... | [
"0.6536284",
"0.64123434",
"0.63633484",
"0.62410045",
"0.619374",
"0.59280974",
"0.59117967",
"0.5907687",
"0.58912575",
"0.5865526",
"0.58302075",
"0.5826202",
"0.57827216",
"0.57827216",
"0.57827216",
"0.57827216",
"0.57827216",
"0.57827216",
"0.57827216",
"0.57827216",
"0... | 0.0 | -1 |
Gets or creates a peer b2bua leg (session). The session passed in as the argument becomes the anchor leg which is the main leg. | def get_or_create_peer_session(session, rip=SipperConfigurator[:DefaultRIP],
rp=SipperConfigurator[:DefaultRP] )
peer = get_peer_session(session)
peer = create_peer_session(session, rip, rp) unless peer
session.offer_answer = nil
peer.offer_answer = nil
peer
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_b2bua_request(session, orig_request=session.irequest, rip=SipperConfigurator[:DefaultRIP], \n rp=SipperConfigurator[:DefaultRP])\n peer_session = get_or_create_peer_session(session, rip, rp)\n if peer_session.initial_state?\n r = peer_session.create_initial_request(orig_request... | [
"0.61279386",
"0.57889134",
"0.55213815",
"0.5115642",
"0.47722444",
"0.4648274",
"0.45638853",
"0.45313078",
"0.45313078",
"0.44708326",
"0.44551533",
"0.44380295",
"0.4381787",
"0.4368886",
"0.4368886",
"0.43681976",
"0.4351521",
"0.4345587",
"0.43385658",
"0.43385008",
"0.... | 0.4879569 | 4 |
While linking the two sessions to create a b2bua the first argument is treated as the main or anchor leg. | def link_sessions(session1, session2)
unlink_session(session1, session1[:_sipper_b2b_peer]) if session1[:_sipper_b2b_peer]
session1[:_sipper_b2b_peer] = session2
session2[:_sipper_b2b_peer] = session1
session2.use_b2b_session_lock_from(session1)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_b2bua_request(session, orig_request=session.irequest, rip=SipperConfigurator[:DefaultRIP], \n rp=SipperConfigurator[:DefaultRP])\n peer_session = get_or_create_peer_session(session, rip, rp)\n if peer_session.initial_state?\n r = peer_session.create_initial_request(orig_request... | [
"0.5979892",
"0.5362096",
"0.52364355",
"0.52331614",
"0.5143465",
"0.5118357",
"0.5104357",
"0.51038396",
"0.51038396",
"0.51038396",
"0.50651026",
"0.50546616",
"0.5037846",
"0.5017374",
"0.4995351",
"0.49946535",
"0.4990233",
"0.49746883",
"0.49594954",
"0.49547485",
"0.49... | 0.49860483 | 17 |
Unlinking removes the b2bua association. | def unlink_sessions(session1, session2)
if session1.b2b_anchor_leg?
anchor_leg = session1
peer_leg = session2
else
anchor_leg = session2
peer_leg = session1
end
anchor_leg[:_sipper_b2b_peer] = nil
peer_leg[:_sipper_b2b_peer] = nil
peer_leg.revert_to_local_session_lock
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unlinked\n reject(&:linked?)\n end",
"def remove_association(server_url, handle)\n raise NotImplementedError\n end",
"def remove_link(from,to,tag)\n link = JiakLink.new(to.jiak.object.bucket, to.jiak.object.key, tag)\n has_link = from.jiak.object.links.include?(link)\n ... | [
"0.6718593",
"0.61393166",
"0.61369836",
"0.60909",
"0.6057438",
"0.59861845",
"0.59734565",
"0.58835036",
"0.58801883",
"0.5863643",
"0.5827249",
"0.5807304",
"0.5781493",
"0.5764678",
"0.57597196",
"0.5717308",
"0.5710706",
"0.5710473",
"0.56948423",
"0.5694037",
"0.5680671... | 0.5824398 | 11 |
Creates the b2bua request based on the original request. Also creates the peer session if it does not already exist. | def create_b2bua_request(session, orig_request=session.irequest, rip=SipperConfigurator[:DefaultRIP],
rp=SipperConfigurator[:DefaultRP])
peer_session = get_or_create_peer_session(session, rip, rp)
if peer_session.initial_state?
r = peer_session.create_initial_request(orig_request.method, orig_request.uri)
r.copy_from(orig_request, :from, :to, :route, :content, :content_type, :path, :service_route, :privacy, :referred_by, :p_asserted_identity)
r.from.tag = "3"
else
if(orig_request.method == "CANCEL")
r = peer_session.create_cancel
elsif(orig_request.method == "ACK")
r = peer_session.create_ack
else
r = peer_session.create_subsequent_request(orig_request.method)
end
r.copy_from(orig_request, :content, :content_type)
end
return r
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relay_request(session)\n peer_session = get_peer_session(session)\n if peer_session\n r = create_b2bua_request(session)\n peer_session.send(r)\n else\n @ilog.warn(\"No peer session found, cannot relay the request\") if @ilog.warn?\n raise \"Unable to relay the request... | [
"0.66611457",
"0.61085904",
"0.5668791",
"0.560353",
"0.55809873",
"0.5507978",
"0.54521906",
"0.54018867",
"0.53954715",
"0.5377524",
"0.53081924",
"0.5255757",
"0.5215799",
"0.52126396",
"0.5208265",
"0.5202263",
"0.51600367",
"0.5143009",
"0.5107065",
"0.50887597",
"0.5086... | 0.8536696 | 0 |
Creates a b2bua response based on an original response. If there is no peer session then this fails. | def create_b2bua_response(session, orig_response=session.iresponse)
peer_session = get_peer_session(session)
if peer_session
r = peer_session.create_response(orig_response.code)
r.copy_from(orig_response, :content, :content_type, :path, :service_route, :privacy, :warning)
return r
else
@ilog.warn("No peer session found, cannot create the response") if @ilog.warn?
raise "Unable to create response"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relay_response(session)\n peer_session = get_peer_session(session)\n if peer_session\n r = create_b2bua_response(session)\n peer_session.send(r)\n else\n @ilog.warn(\"No peer session found, cannot relay the response\") if @ilog.warn?\n raise \"Unable to relay the resp... | [
"0.7325529",
"0.6563041",
"0.6326793",
"0.63149214",
"0.613644",
"0.60440725",
"0.59429187",
"0.5863213",
"0.58187276",
"0.5782858",
"0.57120216",
"0.5687099",
"0.554539",
"0.54726774",
"0.54672784",
"0.5444872",
"0.5434071",
"0.5427138",
"0.5408385",
"0.54053646",
"0.5403971... | 0.8888372 | 0 |
Invalidates this b2bua sessions. | def invalidate_sessions(session, flag=true)
peer_session = get_peer_session(session)
peer_session.invalidate(flag) if peer_session
session.invalidate(flag)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def invalidate_session\n @sequence = 0\n @session_id = nil\n end",
"def invalidate!\n self.active = false\n self.save!\n if controller\n cookies.delete(:user_session)\n end\n end",
"def invalidate_all_sessions!\n update(session_token: SecureRandom.hex)\n end",
"... | [
"0.75684875",
"0.67775315",
"0.6383661",
"0.6320874",
"0.6296015",
"0.62711936",
"0.6270757",
"0.62661535",
"0.62534636",
"0.6218106",
"0.62101257",
"0.61450154",
"0.61291224",
"0.61291224",
"0.60694444",
"0.60443676",
"0.5979894",
"0.5964966",
"0.59564453",
"0.59313524",
"0.... | 0.6160468 | 11 |
Transparently passes / relays the request given a peer session exists. | def relay_request(session)
peer_session = get_peer_session(session)
if peer_session
r = create_b2bua_request(session)
peer_session.send(r)
else
@ilog.warn("No peer session found, cannot relay the request") if @ilog.warn?
raise "Unable to relay the request"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_request(session)\n peer_session = get_peer_session(session)\n if peer_session && session[:_sipper_b2b_transparent]\n peer_session.request_with(session.irequest.method)\n else\n super\n end\n end",
"def request_with_passthru_argument_tracking req, body = nil, &block\n ... | [
"0.6818268",
"0.6083799",
"0.59033513",
"0.5791634",
"0.5523379",
"0.5377912",
"0.5274315",
"0.5246738",
"0.5246738",
"0.5237417",
"0.52302206",
"0.52302206",
"0.5171425",
"0.51421875",
"0.5120592",
"0.5070269",
"0.5066187",
"0.5063245",
"0.505978",
"0.5034782",
"0.5026331",
... | 0.7471165 | 0 |
Transparently passes / relays the response given a peer session exists. | def relay_response(session)
peer_session = get_peer_session(session)
if peer_session
r = create_b2bua_response(session)
peer_session.send(r)
else
@ilog.warn("No peer session found, cannot relay the response") if @ilog.warn?
raise "Unable to relay the response"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def on_response(session)\n peer_session = get_peer_session(session)\n if peer_session && session[:_sipper_b2b_transparent]\n peer_session.respond_with(session.iresponse.code)\n else\n super\n end\n end",
"def relay_request(session)\n peer_session = get_peer_session(sessi... | [
"0.70387226",
"0.6481867",
"0.59788483",
"0.575729",
"0.57058483",
"0.57058483",
"0.566877",
"0.5655246",
"0.5651044",
"0.56481856",
"0.5541686",
"0.5524582",
"0.5385978",
"0.5350139",
"0.5330039",
"0.531674",
"0.53091764",
"0.5301101",
"0.52905655",
"0.5257484",
"0.52433354"... | 0.7679448 | 0 |
Marks this b2bua as transparent which allows the relaying of requests and responses between legs without any controller involvement. | def go_transparent(session, state=true)
session[:_sipper_b2b_transparent] = state
peer_session = get_peer_session(session)
peer_session[:_sipper_b2b_transparent] = state if peer_session
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def transparent!\n @transparency = 1.0\n self\n end",
"def opaque!\n @transparency = TRANSPARENCY\n self\n end",
"def transparent=(value)\n\t\t\t@transparent = value\n\t\tend",
"def settransparency(*)\n super\n end",
"def transparent\n visual = @screen.get_rgba_visual()\n ... | [
"0.66455907",
"0.659353",
"0.58278006",
"0.57407016",
"0.5493787",
"0.5493787",
"0.54331756",
"0.5325351",
"0.5295011",
"0.52677786",
"0.5214685",
"0.5117758",
"0.51040417",
"0.5088064",
"0.50864756",
"0.50864756",
"0.50164855",
"0.4925703",
"0.4903986",
"0.48616993",
"0.4844... | 0.58882576 | 2 |
if there exists a peer session then we transparently send the request as a b2bua if transparent flag is on. | def on_request(session)
peer_session = get_peer_session(session)
if peer_session && session[:_sipper_b2b_transparent]
peer_session.request_with(session.irequest.method)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relay_request(session)\n peer_session = get_peer_session(session)\n if peer_session\n r = create_b2bua_request(session)\n peer_session.send(r)\n else\n @ilog.warn(\"No peer session found, cannot relay the request\") if @ilog.warn?\n raise \"Unable to relay the request... | [
"0.7091014",
"0.6212786",
"0.6090893",
"0.58368886",
"0.5663029",
"0.5399066",
"0.5352831",
"0.52985203",
"0.52897197",
"0.51932645",
"0.5162186",
"0.5162186",
"0.50925595",
"0.5075601",
"0.5074941",
"0.5010787",
"0.5002318",
"0.49889553",
"0.49873072",
"0.49191588",
"0.49164... | 0.70557433 | 1 |
if there exists a peer session then we transparently pass the response as a b2bua if transparent flag is true | def on_response(session)
peer_session = get_peer_session(session)
if peer_session && session[:_sipper_b2b_transparent]
peer_session.respond_with(session.iresponse.code)
else
super
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def relay_response(session)\n peer_session = get_peer_session(session)\n if peer_session\n r = create_b2bua_response(session)\n peer_session.send(r)\n else\n @ilog.warn(\"No peer session found, cannot relay the response\") if @ilog.warn?\n raise \"Unable to relay the resp... | [
"0.7128945",
"0.6547249",
"0.65422624",
"0.651117",
"0.62259954",
"0.6035025",
"0.57305187",
"0.5637645",
"0.5550217",
"0.5550217",
"0.5483338",
"0.5427559",
"0.53432626",
"0.5288237",
"0.5269494",
"0.5248528",
"0.52389807",
"0.5236692",
"0.5233693",
"0.52086395",
"0.51817864... | 0.70724934 | 1 |
Provides Privacy service to users, user can call this API after creating the request or response to apply the privacy. | def apply_privacy(msg)
if !msg[:privacy] || msg[:privacy].to_s == "none"
return msg
else
if msg.privacys.include?("user")
if msg.class == Request
if msg.method == "REFER"
msg.referred_by ='sip:anonymous@anonymous.invalid'
end
msg.from.uri = "sip:anonymous@anonymous.invalid"
msg.from.display_name ='"Anonymous"'
elsif msg[:warning]
warn_code,warn_agent,warn_text = msg.warning.to_s.split(' ',3)
msg.warning = warn_code + " " + warn_text
end
end
msg.privacy = nil
return msg
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def privacy\n end",
"def privacy\n end",
"def privacy()\n return MicrosoftGraph::Privacy::PrivacyRequestBuilder.new(@path_parameters, @request_adapter)\n end",
"def new\n @privacies = Privacy.all\n super\n end",
"def privacy(arg = nil)\n set_or_return(\n :privacy,... | [
"0.71097904",
"0.71097904",
"0.70544904",
"0.66863483",
"0.64068305",
"0.63604313",
"0.6334668",
"0.6325537",
"0.6324939",
"0.6300991",
"0.6198979",
"0.6113116",
"0.6030783",
"0.6004375",
"0.5979589",
"0.59041107",
"0.5896112",
"0.5893879",
"0.5863371",
"0.5863162",
"0.581322... | 0.55080205 | 26 |
similar to String.index but treats '.' as wildcard that matches anything note: each '.' is its own capture group, and return is a string of length N where N is the number of '.' in the pattern. Each char is the captured value for the ith wildcard. RETURNS: a pair of values, index of match (or nil) and replacement chars as a string | def wc_index(str, pat, start_idx)
size = str.size - pat.size
while start_idx <= size
ridx = start_idx
repls = ''
pat.each_char do |ch|
str_char = str[ridx]
if str_char != ch
if ch != '.'
ridx = nil
break
else
repls += str_char
end
end
ridx += 1
end
return start_idx, repls unless ridx.nil?
start_idx += 1
end
[nil, '']
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def custIndex(string, substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend",
"def custom_index(string,substring)\n retu... | [
"0.5667053",
"0.566024",
"0.56420565",
"0.5629933",
"0.5362191",
"0.5313697",
"0.52932805",
"0.5254548",
"0.52518487",
"0.51752996",
"0.51752996",
"0.5175262",
"0.51229346",
"0.5116469",
"0.5067015",
"0.5064135",
"0.504022",
"0.5032986",
"0.5032986",
"0.50236714",
"0.49934906... | 0.72079504 | 0 |
Compare two strings. Pat _may_ contain . as a wildcard char, which matches any corresponding character in str at the same offset. | def wc_equals(str, pat)
return false if pat.size != str.size
idx = 0
pat.each_char do |ch|
return false if (str[idx] != ch) && (ch != '.')
idx += 1
end
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def is_match(s, p)\n # . matches a single character\n # * matches any number of the preceding character including 0\n # match to the entire string\n\n # s can be empty, only lowercase\n # p can be empty, only lowercase, plus . and *\n\n return false if p[0] == '*'\n return false if p.length == 0\n\n left_i... | [
"0.61306256",
"0.61224353",
"0.5965447",
"0.5918117",
"0.58858496",
"0.5865793",
"0.5844238",
"0.57709306",
"0.57670015",
"0.57658494",
"0.57655996",
"0.5756238",
"0.5747417",
"0.574257",
"0.5730987",
"0.5722759",
"0.5654311",
"0.56403995",
"0.55900675",
"0.5580033",
"0.54929... | 0.71031517 | 0 |
given a str, the pat may refer to captures represented in repl_chars for any single digit D in (1...9), if str[i] == repl_chars[D] then it's a match presumably, repl_chars was returned from wc_index. | def wc_with_placeholder_equals(str, pat, repl_chars)
return false if pat.size != str.size
fixed_pat = wc_replace(pat, repl_chars)
wc_equals(str, fixed_pat)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def wc_index(str, pat, start_idx)\n size = str.size - pat.size\n while start_idx <= size\n ridx = start_idx\n repls = ''\n pat.each_char do |ch|\n str_char = str[ridx]\n if str_char != ch\n if ch != '.'\n ridx = nil\n break\n else\n repls += str_char\n ... | [
"0.5934188",
"0.5612179",
"0.54502034",
"0.5424939",
"0.5335791",
"0.52297896",
"0.52244943",
"0.51776934",
"0.5174325",
"0.5124654",
"0.50746024",
"0.5035363",
"0.49692887",
"0.4946795",
"0.49387118",
"0.49312758",
"0.49194103",
"0.49194103",
"0.49130994",
"0.48888218",
"0.4... | 0.6293221 | 0 |
normally the cur_row is computed from the raw row, but it's "ok" if the cur_row doesn't transform when we pretend it's the raw row. (raw rows contains placeholder chars that may have special rules applied to update them, while cur_row is resolved, and loses that metadata.) | def cur_row=(cur_row)
raise('overrides detected; must use cur_raw_row= instead') if compute_cur_row(cur_row) != cur_row
@cur_raw_row = cur_row
@cur_row = cur_row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_row(row)\n row\n end",
"def transform_row(row)\n row\n end",
"def compute_row(row)\n row\n end",
"def process_change(row)\n ETL::Engine.logger.debug \"Processing row: #{row.inspect}\"\n return unless row\n \n # Change processing can only occ... | [
"0.66497064",
"0.65518767",
"0.62755615",
"0.59439296",
"0.59166044",
"0.5832468",
"0.57935786",
"0.57005143",
"0.5671665",
"0.5630445",
"0.5611281",
"0.55979514",
"0.55741674",
"0.55652744",
"0.5560258",
"0.5542723",
"0.55338085",
"0.55132896",
"0.550092",
"0.5487611",
"0.54... | 0.74269223 | 0 |
move_hash: same fields returned from each elt of possible_plays all the gs_play_ fields from top of file | def make_move(move)
if @max_depth == @prev_rows.size
puts("max_depth of #{@max_depth} reached") if @verbose
return nil
end
offset = move[GS_PLAY_IDX]
from = move[GS_PLAY_PAT]
to = move[GS_PLAY_REPL]
if @cur_row.index(from, offset) != offset
dump_plays
raise "invalid replacement: cur_row=#{@cur_row}, from=#{from}, offset=#{offset}"
end
raise "too wide: maxwidth= #{@max_width}" if @cur_row.size - from.size + to.size > max_width
cached_move = move.dup
cached_raw_row = @cur_raw_row.dup
@prev_rows.push(cached_raw_row)
@played_moves.push(cached_move)
@cur_raw_row[offset...offset + from.size] = to
@cur_row = compute_cur_row(@cur_raw_row)
cached_row = @cur_row.dup
cached_move[GS_PLAY_RESULT] = cached_row
@cur_row
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def addBlankPlayer(retrosheet_id, hash)\n perfs = Hash.new\n perfs[\"career_games\"] = 0.0\n \n perfs[\"at_bats_last_1_game\"] = [0]\n perfs[\"at_bats_last_2_games\"] = [0, 0]\n perfs[\"at_bats_last_5_games\"] = [0, 0, 0, 0, 0]\n perfs[\"at_bats_last_10_games\"] = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0]\n perfs[\"a... | [
"0.5458372",
"0.5435226",
"0.53848726",
"0.51992035",
"0.5114729",
"0.4997751",
"0.49221522",
"0.49104995",
"0.48772737",
"0.4867915",
"0.4867915",
"0.4858612",
"0.485384",
"0.4849168",
"0.48487887",
"0.48473725",
"0.48429343",
"0.47959858",
"0.47950593",
"0.47855273",
"0.478... | 0.4795022 | 19 |
return an array of possible moves. a move is represented as: [offset, fromstr, tostr] special characters in rule strings affect options: pattern: ? matches any single char replacement: 1 2 3, ..., 9 : placeholder for whatever char matched corresponding N in pattern | def possible_plays
results = []
# pat: string, repls: array of replacements
rulenum = -1
rules.each do |pat, repls|
rulenum += 1
base_len = @cur_row.size - pat.size
repls.each do |replacement|
replacement = '' if replacement.nil?
next unless base_len + replacement.size <= @max_width
idx = 0
loop do
idx, repl_chars = wc_index(@cur_row, pat, idx)
break if idx.nil?
cur_pat, cur_repl = fixup_wildcards(pat, replacement, repl_chars)
# Grepable key: GS_PLAY_ARRAY
results << [idx, cur_pat, cur_repl, replacement, repl_chars]
idx += 1
end
end
end
results
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_possible_moves\n moves = \n\t @@offsets.collect do |move| \n\t row = @position[:row] + move[0]\n\t col = @position[:col] + move[1]\n\t\t[row, col] if row.between?(0, 7) && col.between?(0, 7)\n\t end\n\tmoves.compact\n end",
"def parse_move(move)\n #Is this enough of a repetition for me to ... | [
"0.6797918",
"0.67268044",
"0.6682454",
"0.66211486",
"0.66210955",
"0.6607359",
"0.6526303",
"0.6412042",
"0.64039075",
"0.63871497",
"0.6378224",
"0.6340463",
"0.63302004",
"0.6327256",
"0.63233876",
"0.6311289",
"0.62841475",
"0.62752545",
"0.6227007",
"0.6217513",
"0.6173... | 0.0 | -1 |
for the current turn in the current state, each special cell char must map to ... SOMETHING so build a map to preresolve those transformations (They may be different each turn.) | def make_charmap
charmap = {}
@type_overrides.each do |char, char_override|
type = char_override['type']
case type
# cycle through the string of chars in cycle_chars
when 'RotatingColors'
cycle_chars = char_override['cycle_chars']
raise "Invalid/missing 'cycle_chars' attribute of 'RotatingColors' type_override" if cycle_chars.nil?
idx = cur_move_number % cycle_chars.size
charmap[char] = cycle_chars[idx]
else
raise "Unhandled override type '#{type}'"
end
end
charmap
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def traverse map, sol, x, y, l\n\n\t# First lets see if this cell has a letter\n\tif sol[x][y].ord >= 'a'.ord\n\t\t#if it does, then we can just return that letter, and we're done with this traverse path\n\t\treturn sol[x][y]\n\tend\n\n\t# Otherwise lets set the letter\n\tsol[x][y] = l\n\n\t# Then we're getting th... | [
"0.59542966",
"0.5748085",
"0.5742791",
"0.5732868",
"0.567049",
"0.56597877",
"0.5643435",
"0.5584514",
"0.55725104",
"0.5571196",
"0.55380726",
"0.54990524",
"0.5448882",
"0.5383394",
"0.53825533",
"0.5364843",
"0.5341886",
"0.53183603",
"0.5301365",
"0.5275037",
"0.5255664... | 0.518722 | 25 |
find a rule that can produce the given move, matching the from (pat) and containing the replace pattern. same format as moves returned from possible_plays in this class. note:the move provided is fully resolved, so matching it to a rule requires accounting for wildcards in the rule code. (That is, it's not directly obvious that a move came from a wildcard, but it needs to be figured out.) | def get_raw_rule_and_repl_for_move(move)
resolved_from_str = move[GS_PLAY_PAT]
resolved_to_str = move[GS_PLAY_REPL]
@rules.each do |raw_from_str, raw_repl_strs|
idx, captures = wc_index(resolved_from_str, raw_from_str, 0)
next unless !idx.nil? && (raw_from_str.size == resolved_from_str.size)
# rule pattern matches, but does a repl also match? given wildcards,
# it's possible this rule matches the from_str pat, but has no
# replacement that matches. (Must be from a different rule, if it can
# match multiple rules.)
raw_repl_strs.each do |raw_repl|
return raw_from_str, raw_repl if wc_with_placeholder_equals(resolved_to_str, raw_repl, captures)
end
end
[nil, nil]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_move(move)\n if @max_depth == @prev_rows.size\n puts(\"max_depth of #{@max_depth} reached\") if @verbose\n return nil\n end\n\n offset = move[GS_PLAY_IDX]\n from = move[GS_PLAY_PAT]\n to = move[GS_PLAY_REPL]\n\n if @cur_row.index(from, offset) != offset\n dump_plays\n ... | [
"0.60705364",
"0.5525321",
"0.54555565",
"0.54506683",
"0.53911567",
"0.52983063",
"0.52969044",
"0.52929145",
"0.5290336",
"0.52664095",
"0.52571815",
"0.51759475",
"0.51488346",
"0.5108208",
"0.5033434",
"0.5016896",
"0.49992973",
"0.49971706",
"0.496786",
"0.49671194",
"0.... | 0.7442282 | 0 |
Start the app, process all pending messages, and then shutdown | def run
supervisors.map(&:run).each(&:join)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run\n run_app\n adapter.run\n rescue Interrupt\n shut_down\n end",
"def start_apps\n check_apps\n remove_sockets\n _start_apps(ARGV[1])\nend",
"def start\n validate!\n start_messages\n create_workers\n Process.wait\n end",
"def start\n valid... | [
"0.6556222",
"0.6372028",
"0.63268995",
"0.63268995",
"0.6166472",
"0.6147942",
"0.6128416",
"0.61252666",
"0.6121546",
"0.6119248",
"0.6104585",
"0.6091895",
"0.60846853",
"0.60750836",
"0.6045958",
"0.6006996",
"0.59956765",
"0.5995411",
"0.5990529",
"0.59901965",
"0.597354... | 0.0 | -1 |
Ensures source code is interpreted as UTF8. This is necessary as sometimes Ruby guesses the encoding of a file incorrectly, for example if the LC_ALL environment variable is set to "C". | def process_encoding(source)
source.force_encoding(Encoding::UTF_8)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def external_utf8_check?(safe_path)\n iconv = system('command -v iconv > /dev/null 2>&1')\n return false unless iconv\n\n path = SafeFile.safepath_to_string(safe_path)\n system(\"iconv -f UTF-8 #{Shellwords.escape(path)} > /dev/null 2>&1\")\n end",
"def enc_utf8\n\n ... | [
"0.66392225",
"0.6415981",
"0.63473034",
"0.6322102",
"0.6317325",
"0.63168323",
"0.62966585",
"0.6272737",
"0.6255892",
"0.618884",
"0.61598754",
"0.6154429",
"0.61473644",
"0.61307573",
"0.6106308",
"0.6042595",
"0.6018425",
"0.6018425",
"0.6018425",
"0.60130227",
"0.598641... | 0.72002923 | 0 |
147 142 133 122 59 304 5 4 2 57 330 10 1 1 54 351 11 23 25 26 362 747 806> ... | def main
# Make each run
RUNS.each do |name, data|
# skip run?
if data[:skip]
puts "Skipped '#{name}'"
next
end
# Process data
target = data[:input]
board = Board.new
side_length = 1
x = y = 0
current_value = 1
board[x, y] = current_value
while current_value <= target
# side of new ring is 2 more than previous
side_length += 2
# move cursor to first corner of new ring
x += 1
y -= 1
# add elements for each side of the whole ring
[[0, 1], [-1, 0], [0, -1], [1, 0]].each do |mod|
(side_length - 1).times do
x += mod[0]
y += mod[1]
current_value = board.neighbors(x, y).sum
board[x, y] = current_value
break if current_value > target
end
break if current_value > target
end
end
# Print result
res = board.cell_count
success_msg = res == data[:target] ? 'succeeded' : 'failed'
puts "AOC17-#{PUZZLE}/#{name} #{success_msg}: #{res}, #{current_value} (Target: #{data[:target]})"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def p13\n\tnumbers = [\n\t\t37107287533902102798797998220837590246510135740250,\n\t\t46376937677490009712648124896970078050417018260538,\n\t\t74324986199524741059474233309513058123726617309629,\n\t\t91942213363574161572522430563301811072406154908250,\n\t\t23067588207539346171171980310421047513778063246676,\n\t\t89... | [
"0.6408673",
"0.62020344",
"0.61703163",
"0.6076491",
"0.5934825",
"0.58847916",
"0.58527064",
"0.58496886",
"0.58411926",
"0.5796249",
"0.5775391",
"0.5772288",
"0.575788",
"0.5735183",
"0.5694396",
"0.5646702",
"0.5646381",
"0.56347436",
"0.5618643",
"0.56041086",
"0.557392... | 0.0 | -1 |
Here we assume a 1:1 relation between route and polyline. | def remove_unused_polylines
#Polyline.delete(self.polyline_id)
Polyline.destroy_all(["id = ?", self.polyline_id])
Syncronisation.destroy_all(["route_id = ?", self.id])
#Polyline.find(:all, :conditions => ["video_id = ?", self.id]).each { |object| object.destroy }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def polyline\n @polyline ||= Automatic::Client::Polyline.new(self.path)\n end",
"def add_route(station, line)\n Neo4j::Transaction.run do\n rel = Neo4j::Relationship.create(:route, self, station)\n rel[:distance] = 1.0\n rel[:line] = line\n end\n\n self\n end",
"def directi... | [
"0.690366",
"0.6791112",
"0.6637752",
"0.65814054",
"0.64111614",
"0.6339908",
"0.6258481",
"0.6221909",
"0.61921704",
"0.6056569",
"0.6015468",
"0.5995741",
"0.59488523",
"0.5938009",
"0.5924678",
"0.58934593",
"0.58910435",
"0.58603716",
"0.5829676",
"0.5769146",
"0.574671"... | 0.0 | -1 |
GET /trends GET /trends.json | def index
@trends = Trend.order("as_of DESC").limit(10)
respond_to do |format|
format.html # index.html.erb
format.json { render json: @trends }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_trends\n get(\"/trends/available.json\")\n end",
"def trends_available\n get(\"/trends/available.json\")\n end",
"def closest_trends\n get(\"/trends/closest.json\")\n end",
"def trends_for_location(woeid)\n get(\"/trends/woeid.json\")\n end",
"def show\n @tr... | [
"0.8464926",
"0.80448186",
"0.79442924",
"0.7553669",
"0.69031245",
"0.68645257",
"0.67752224",
"0.67729056",
"0.67564535",
"0.66964155",
"0.6682735",
"0.66251224",
"0.65809554",
"0.6572708",
"0.65609646",
"0.6521203",
"0.6447618",
"0.64428717",
"0.63273686",
"0.62822837",
"0... | 0.7648236 | 3 |
GET /trends/1 GET /trends/1.json | def show
@trend = Trend.find(params[:id])
respond_to do |format|
format.html # show.html.erb
format.json { render json: @trend }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def available_trends\n get(\"/trends/available.json\")\n end",
"def closest_trends\n get(\"/trends/closest.json\")\n end",
"def trends_available\n get(\"/trends/available.json\")\n end",
"def index\n \n @trends = Trend.order(\"as_of DESC\").limit(10)\n\n respond_to do |format... | [
"0.82187",
"0.8006087",
"0.7849452",
"0.76294106",
"0.74807787",
"0.71565974",
"0.68644065",
"0.68198997",
"0.6756292",
"0.6730448",
"0.6675012",
"0.66381484",
"0.66345704",
"0.6595953",
"0.6568511",
"0.6528743",
"0.6463858",
"0.6390878",
"0.63837993",
"0.63088197",
"0.624040... | 0.7106173 | 6 |
GET /trends/new GET /trends/new.json | def new
@trend = Trend.new
respond_to do |format|
format.html # new.html.erb
format.json { render json: @trend }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n @trend = Trend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @trend }\n end\n end",
"def create\n @trend = Trend.new(params[:trend])\n\n respond_to do |format|\n if @trend.save\n format.html { redirect_to @trend, :notic... | [
"0.7585289",
"0.70956403",
"0.70278394",
"0.69632196",
"0.6856518",
"0.678173",
"0.6761616",
"0.6750306",
"0.64665943",
"0.64665943",
"0.6376541",
"0.6364157",
"0.6301984",
"0.6268966",
"0.6265268",
"0.61568743",
"0.61441565",
"0.6134211",
"0.6118044",
"0.6093511",
"0.6070304... | 0.7656456 | 0 |
POST /trends POST /trends.json | def create
@trend = Trend.new(params[:trend])
respond_to do |format|
if @trend.save
format.html { redirect_to @trend, notice: 'Trend was successfully created.' }
format.json { render json: @trend, status: :created, location: @trend }
else
format.html { render action: "new" }
format.json { render json: @trend.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @trend = Trend.new(params[:trend])\n\n respond_to do |format|\n if @trend.save\n format.html { redirect_to @trend, :notice => 'Trend was successfully created.' }\n format.json { render :json => @trend, :status => :created, :location => @trend }\n else\n format.html... | [
"0.68849444",
"0.6850317",
"0.67138535",
"0.6565518",
"0.6469129",
"0.6347282",
"0.6239606",
"0.6226279",
"0.6108849",
"0.59187895",
"0.58882594",
"0.5826299",
"0.5818047",
"0.57494634",
"0.5740838",
"0.5739891",
"0.573035",
"0.5722107",
"0.57111514",
"0.5654762",
"0.56008744... | 0.67812383 | 2 |
PUT /trends/1 PUT /trends/1.json | def update
@trend = Trend.find(params[:id])
respond_to do |format|
if @trend.update_attributes(params[:trend])
format.html { redirect_to @trend, notice: 'Trend was successfully updated.' }
format.json { head :no_content }
else
format.html { render action: "edit" }
format.json { render json: @trend.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n @trend = Trend.find(params[:id])\n\n respond_to do |format|\n if @trend.update_attributes(params[:trend])\n format.html { redirect_to @trend, :notice => 'Trend was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\"... | [
"0.7115279",
"0.6358489",
"0.60356",
"0.5999022",
"0.5948721",
"0.59001344",
"0.58943313",
"0.5877498",
"0.58382314",
"0.5826662",
"0.57208705",
"0.56966853",
"0.5541391",
"0.5538751",
"0.54880863",
"0.5463817",
"0.5431997",
"0.53855526",
"0.5335112",
"0.5331938",
"0.52742153... | 0.70530486 | 1 |
DELETE /trends/1 DELETE /trends/1.json | def destroy
@trend = Trend.find(params[:id])
@trend.destroy
respond_to do |format|
format.html { redirect_to trends_url }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @trend = Trend.find(params[:id])\n @trend.destroy\n\n respond_to do |format|\n format.html { redirect_to trends_url }\n format.json { head :ok }\n end\n end",
"def destroy\n @trending.destroy\n respond_to do |format|\n format.html { redirect_to trendings_url, notic... | [
"0.77617973",
"0.69828826",
"0.6756288",
"0.6687434",
"0.65862304",
"0.65860265",
"0.6577997",
"0.6520948",
"0.64767796",
"0.64706546",
"0.6401686",
"0.63920933",
"0.6375629",
"0.6373956",
"0.6370029",
"0.63236636",
"0.629012",
"0.6287877",
"0.62566787",
"0.6251377",
"0.62414... | 0.776625 | 0 |
Redirige vers le menu principal | def vers_menu
@win.set_title("FILL A PIX")
@win.set_default_size($widthEcran, $heightEcran)
@win.remove(@layoutManager)
Ecran_menu.creer(@win)
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def menu\n \nend",
"def menu\n \n \n\nend",
"def menu\nend",
"def main_menu\n h = {\n a: :ag,\n z: :z_interface,\n # f: :file_actions,\n b: :bookmark_menu,\n c: :create_menu,\n f: :filter_menu,\n o: :order_menu,\n s: :selection_menu,\n t: :toggle_menu,\n v: :view_menu,... | [
"0.74213856",
"0.7405282",
"0.7380776",
"0.7186169",
"0.71083903",
"0.70275813",
"0.6997468",
"0.6950392",
"0.6883389",
"0.6868467",
"0.68619674",
"0.6847486",
"0.6842519",
"0.68339187",
"0.67917407",
"0.67815965",
"0.67780405",
"0.6774205",
"0.6764095",
"0.67618936",
"0.6687... | 0.6072646 | 98 |
Ajout d'un nouvel utilisateur +nom+ nom de l'utilisateur | def newUser(nom)
File.open($userPath + "users.txt", "a")
File.chmod(0777,$userPath + "users.txt")
File.write($userPath + "users.txt", nom+"\n", mode: "a")
##Ajout des dossiers 'Libre' et 'Aventure'
##qui contiendront les sauvegardes de ces modes respectifs
$userPath += nom+"/"
Dir.mkdir($userPath)
Dir.mkdir($userPath+"Libre/")
Dir.mkdir($userPath+"Aventure/")
Dir.mkdir($userPath+"Tuto/")
##Ajout des premiers fichiers nécessaires pour un nouvel utilisateur
File.open($userPath+"Libre/config.txt", "w")
File.open($userPath+"Aventure/config.txt", "w")
File.open($userPath+"Tuto/config.txt", "w")
File.open($userPath+"succes.txt", "w")
File.chmod(0777,$userPath + "succes.txt")
i = 0
while i <= 11 do
File.write($userPath+"succes.txt", "false 0 0\n", mode: "a")
i+=1
end
return self
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def new\n \t@user = User.new\n \t@titre = \"Inscription\"\n end",
"def add_user_name(username)\n\t\tuser_name_input.set(username)\n\tend",
"def add_user(name)\n\t@users << {:name => name}\n end",
"def create_user(user_name)\n if :locale == 'de'\n self.action = \"Teilnehmer '#{user_name}' wurde ... | [
"0.6797243",
"0.6785538",
"0.65700734",
"0.64984673",
"0.6449019",
"0.6352052",
"0.6304317",
"0.62712795",
"0.6263485",
"0.61970145",
"0.61815387",
"0.61551154",
"0.61075693",
"0.60163146",
"0.60151833",
"0.60078794",
"0.600658",
"0.6003742",
"0.6002502",
"0.5997776",
"0.5980... | 0.61958754 | 10 |
Custom logic to select from checkin or post | def startup
return Startup.where(:id => self.startup_id) if self.startup_id.present?
return self.checkin.startup if self.checkin_id.present
nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def for_post?\n self.checkin_id.blank?\n end",
"def selectTypes\n\n @posting = Posting.new\n @post_attachment = @posting.post_attachments.build\n if params[:from] == 'market'\n user = UserTable.find(session[:user_id])\n if user[:enterprise] == 1\n @posting[:enterprise] = '1'\n ... | [
"0.6151436",
"0.5699747",
"0.53550315",
"0.52792627",
"0.51948",
"0.5174935",
"0.5160108",
"0.5159",
"0.5159",
"0.51477927",
"0.5125994",
"0.5122817",
"0.5122095",
"0.5110056",
"0.51023185",
"0.5102102",
"0.5074846",
"0.5069202",
"0.50229824",
"0.502",
"0.49881786",
"0.4988... | 0.0 | -1 |
Need custom logic or else it also selects itself | def reposts
Comment.where(:original_id => self.id).where(['id != ?', self.id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def select; end",
"def select; end",
"def selected?; end",
"def selected?; end",
"def chain_select_child\n self.chain_select_child\n end",
"def select_intended\n select intended\n end",
"def select_intended\n select intended\n end",
"def selected; end",
"def select_n... | [
"0.6685063",
"0.6685063",
"0.6449269",
"0.6449269",
"0.63296413",
"0.62513566",
"0.62513566",
"0.6211039",
"0.62096596",
"0.61550057",
"0.59843075",
"0.5971897",
"0.5908495",
"0.58646977",
"0.58646977",
"0.58565724",
"0.57867277",
"0.57812846",
"0.5711139",
"0.56860316",
"0.5... | 0.0 | -1 |
Posts this comment (like retweeting) from a new user. It will save the originator and then the post is also | def repost_by(user)
c = Comment.new
c.content = self.content
# if this was a repost itself, use this post's original
c.original = self.original ? self.original : self
c.user = user
c.original.save if c.save # update cache on responders
c
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @user = User.find_by_slug(params[:user_id])\n @post = @user.posts.find(params[:post_id])\n @comment = @post.comments.create(params[:comment])\n\n @comment.commenter = current_user.profile.name#test and move to model?\n\n if @comment.save(params[:comment])\n current_user.comments <<... | [
"0.71819985",
"0.69012743",
"0.67428946",
"0.6736323",
"0.67266273",
"0.6714505",
"0.6707908",
"0.67073745",
"0.66745925",
"0.6624373",
"0.6593054",
"0.6587928",
"0.65530956",
"0.6479562",
"0.6426763",
"0.6423064",
"0.64212245",
"0.64149284",
"0.63922036",
"0.6372689",
"0.636... | 0.6910327 | 1 |
All people who commented or liked this post | def responders
return [] if self.responder_ids.blank?
User.find(self.responder_ids.flatten - [self.user_id]) # don't include author
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def liked_by\n\t\tcomment = Comment.includes(:liked_by).find_by(id: params[:id])\n\t\t@users = comment.has_been_liked_by\t\t\t\t\t\t\t\t\t\n\tend",
"def likes\n people = []\n query = Activity.joins { verb }.where { activity_object_id.eq(my { id }) }\n\n activities_likes = query.where { verb.name... | [
"0.71222436",
"0.705742",
"0.6782471",
"0.6772138",
"0.67585415",
"0.67221045",
"0.6613476",
"0.66087866",
"0.6559809",
"0.6541015",
"0.6476889",
"0.6444848",
"0.6432457",
"0.64298123",
"0.6398631",
"0.6381756",
"0.6367447",
"0.63154507",
"0.62894005",
"0.6279288",
"0.6267422... | 0.0 | -1 |
This comment is for a checkin | def for_checkin?
self.checkin_id.present?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comments_hash_flag; end",
"def comments_hash_flag; end",
"def comments_hash_flag; end",
"def comment?; end",
"def comment?; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end",
"def comment; end... | [
"0.66618425",
"0.66618425",
"0.66618425",
"0.65666145",
"0.65666145",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394",
"0.65472394"... | 0.0 | -1 |
This is a comment on a post | def for_post?
self.checkin_id.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def comment\n @comment\n end",
"def comment comment\n end",
"def can_create_comment?(post); true; end",
"def commentable_title\n \"Undefined Post Title\"\n end",
"def commentable_title\n \"Undefined Post Title\"\n end",
"def comment; end",
"def comment; end",
"def comment; end",
... | [
"0.7486186",
"0.73499244",
"0.7332807",
"0.73177093",
"0.729293",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
"0.72283155",
... | 0.0 | -1 |
This is the original (root) post | def original_post?
self.ancestry.blank? && self.checkin_id.blank?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def raw_post; end",
"def initialized_post_name; end",
"def post_reader; end",
"def posts; end",
"def process_post\n\t\traise \"Ehh, What's up Doc?\"\n\tend",
"def post #:doc:\n end",
"def post; end",
"def private; end",
"def formation; end",
"def post\n _root_document\n end",
"def entry; e... | [
"0.64357674",
"0.6179126",
"0.61740416",
"0.60944915",
"0.60557556",
"0.6020969",
"0.60178393",
"0.60039514",
"0.5970726",
"0.59691197",
"0.5861664",
"0.5861664",
"0.5861664",
"0.5861664",
"0.5826125",
"0.5826125",
"0.5826125",
"0.5826125",
"0.5826125",
"0.5826125",
"0.582612... | 0.0 | -1 |
Queries who responded to this post and updates cached count and ids | def update_responders
return true unless self.original_post?
children = self.descendants
awesomes = self.awesomes
# Save as array with comment user ids, then repost user ids, then awesome user ids
self.responder_ids = [children.map{|c| c.user_id }, self.reposts.map{|c| c.user_id }, awesomes.map{|a| a.user_id }]
self.responder_ids = [] if self.responder_ids.present? && self.responder_ids[0].blank? && self.responder_ids[1].blank? && self.responder_ids[2].blank?
self.reply_count = children.size
self.awesome_count = awesomes.size
self.save
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update_replies_count\n Answer.update_counters(answer_id, replies_count: 1)\n end",
"def update_topic_reply_count\n self.topic_reply_count = Topic\n .joins(\"INNER JOIN posts ON topics.id = posts.topic_id AND topics.user_id <> posts.user_id\")\n .where(\"posts.deleted_at IS NULL AND posts.use... | [
"0.6464697",
"0.6411103",
"0.63254195",
"0.6261489",
"0.6113065",
"0.61104614",
"0.6088264",
"0.6077459",
"0.6013911",
"0.59989136",
"0.59702665",
"0.5922907",
"0.5916365",
"0.5855895",
"0.5834871",
"0.5831599",
"0.576573",
"0.574539",
"0.5691215",
"0.56835455",
"0.56752276",... | 0.60358965 | 8 |
If this is a root post then we can delete it | def safe_destroy
if self.is_root? && self.original_post?
Comment.transaction do
self.descendants.each{|c| c.destroy }
end
self.destroy
else
self.update_attribute('deleted', true)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete post\n\t\t$DIRTY << :news\n\t\tpost = @children[post] if post.kind_of? Integer\n\t\traise ArgumentError, \"Post not found\" unless @children.include? post\n\n\t\tif @children[-1] == post and post.children.size == 0\n\t\t\t@children.delete post\n\t\telse\n\t\t\tpost.title = \"<Deleted>\"\n\t\t\tpost.body... | [
"0.7820557",
"0.7606751",
"0.7256617",
"0.72342676",
"0.72329205",
"0.72329205",
"0.72329205",
"0.72329205",
"0.7193745",
"0.71417767",
"0.7129103",
"0.7128115",
"0.71220994",
"0.70974135",
"0.70891213",
"0.70788693",
"0.7008157",
"0.7008157",
"0.69995064",
"0.69952714",
"0.6... | 0.7394617 | 2 |
GET /consignments GET /consignments.json | def index
@consignments = Consignment.newest_first.page params[:page]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @consignments = Consignment.all\n end",
"def index\n @consignees = Consignee.all\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @conc... | [
"0.7628862",
"0.65952605",
"0.6585483",
"0.6310784",
"0.6310784",
"0.6310784",
"0.6310784",
"0.6125483",
"0.6125483",
"0.60214716",
"0.5982178",
"0.5869977",
"0.57882196",
"0.57768375",
"0.56652606",
"0.5661365",
"0.5646141",
"0.56451416",
"0.5643992",
"0.5611221",
"0.558044"... | 0.61171573 | 9 |
GET /consignments/1 GET /consignments/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @consignments = Consignment.all\n end",
"def index\n @consents = Consent.all\n render json: @consents\n end",
"def show\n @concerts = Concert.find(params[:id])\n end",
"def index\n @concerts = Concert.all\n end",
"def index\n @concerts = Concert.all\n end",
"def index\... | [
"0.7189249",
"0.674576",
"0.66339344",
"0.6533182",
"0.6533182",
"0.6533182",
"0.6533182",
"0.6381324",
"0.6374813",
"0.632502",
"0.6294494",
"0.6148018",
"0.61280835",
"0.6108537",
"0.6108537",
"0.601019",
"0.6003986",
"0.6000647",
"0.5941914",
"0.5927862",
"0.5916751",
"0... | 0.0 | -1 |
POST /consignments POST /consignments.json | def create
@consignment = Consignment.new(consignment_params)
respond_to do |format|
if @consignment.save
format.html {redirect_to @consignment, notice: 'Consignment was successfully created.'}
format.json {render :show, status: :created, location: @consignment}
else
format.html {render :new}
format.json {render json: @consignment.errors, status: :unprocessable_entity}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @consignment = Consignment.new(consignment_params)\n\n respond_to do |format|\n if @consignment.save\n format.html { redirect_to @consignment, notice: 'Consignment was successfully created.' }\n format.json { render action: 'show', status: :created, location: @consignment }\n ... | [
"0.66646063",
"0.62312603",
"0.58440626",
"0.58440626",
"0.5806886",
"0.5773796",
"0.57573754",
"0.57133526",
"0.56976604",
"0.569431",
"0.56412",
"0.5525826",
"0.5443691",
"0.5441027",
"0.54406667",
"0.54368365",
"0.53620905",
"0.53444535",
"0.53379357",
"0.5325861",
"0.5321... | 0.66034454 | 1 |
PATCH/PUT /consignments/1 PATCH/PUT /consignments/1.json | def update
respond_to do |format|
if @consignment.update(consignment_params)
format.html {redirect_to @consignment, notice: 'Consignment was successfully updated.'}
format.json {render :show, status: :ok, location: @consignment}
else
format.html {render :edit}
format.json {render json: @consignment.errors, status: :unprocessable_entity}
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @consignment.update(consignment_params)\n format.html { redirect_to @consignment, notice: 'Consignment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { ren... | [
"0.6564134",
"0.6294707",
"0.6294707",
"0.61792785",
"0.61617196",
"0.60776126",
"0.6048915",
"0.6040333",
"0.6033305",
"0.59755737",
"0.59654635",
"0.59556365",
"0.59541935",
"0.59223056",
"0.5919229",
"0.59164006",
"0.5899871",
"0.5894683",
"0.58939004",
"0.5884851",
"0.588... | 0.6403328 | 1 |
DELETE /consignments/1 DELETE /consignments/1.json | def destroy
@consignment.destroy
respond_to do |format|
format.html {redirect_to consignments_url, notice: 'Consignment was successfully destroyed.'}
format.json {head :no_content}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @consignment.destroy\n respond_to do |format|\n format.html { redirect_to consignments_url }\n format.json { head :no_content }\n end\n end",
"def destroy\n @concert.destroy\n respond_to do |format|\n format.html { redirect_to concerts_url, notice: 'Concert was succes... | [
"0.75020623",
"0.7152222",
"0.7152222",
"0.7152222",
"0.7151957",
"0.7094227",
"0.7090333",
"0.6935903",
"0.69345343",
"0.69208115",
"0.69004935",
"0.68993354",
"0.68849367",
"0.6876099",
"0.681157",
"0.679851",
"0.6797518",
"0.6793039",
"0.67808163",
"0.67789453",
"0.6764549... | 0.7197221 | 1 |
Use callbacks to share common setup or constraints between actions. | def set_consignment
@consignment = Consignment.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 consignment_params
params.require(:consignment).permit(:merchant_id, :plan_id, :tracking_code, :receiver_name, :receiver_phone, :receiver_addr, :amount, :weight, :charge, :additional_cost, :compensation, :payment_status, :merchant_order_no, :package_description, :delivered_on, :current_hub_id, :target_hub_id, :rider, :assigned_by, :data_entry_by, :completed_by, :assigned_on, :assigned_on, :completed_on, :data_entry_on, :status)
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.6981606",
"0.6784227",
"0.6746523",
"0.67439264",
"0.67361516",
"0.6593381",
"0.6506166",
"0.64994407",
"0.6483518",
"0.64797056",
"0.64578557",
"0.6441216",
"0.63811713",
"0.63773805",
"0.6366333",
"0.63217646",
"0.6301816",
"0.63009787",
"0.6294436",
"0.62940663",
"0.629... | 0.0 | -1 |
queue implementation using linked list preorder: First draw path from root to each node and mark direction on path and visit nodes as per path direction consider 1st visited nodes in path and ignore same nodes, if visited again | def preOrder(root) # O(n)
return nil if root == nil
print " #{root.value}"
preOrder(root.left)
preOrder(root.right)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def path_finder \n until queue.empty? \n current_node = queue.shift()\n generate_neighbours(current_node)\n current_node.neighbour_nodes.each do |neighbour|\n track_visited(current_node, neighbour)\n correct_node?(neighbour) ? (return neighbour.visited) : (queue << nei... | [
"0.6995178",
"0.67278767",
"0.6660628",
"0.6598862",
"0.6443971",
"0.6415696",
"0.636845",
"0.6337074",
"0.6313219",
"0.63078165",
"0.6303374",
"0.62761503",
"0.62735325",
"0.62493676",
"0.6229773",
"0.6229773",
"0.6229444",
"0.61777216",
"0.6171646",
"0.612192",
"0.6104046",... | 0.0 | -1 |
preorder traversal with iterative manner | def preOrderTraversal(root)
return nil if root == nil
stack = [root]
while !stack.empty?
node = stack.pop
print " #{node.value}"
if node.right != nil
stack.push(node.right)
end
if node.left != nil
stack.push(node.left)
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def preorder\n preorder_traversal(@root, [])\n end",
"def pre_order_traversal(tree=root, ordering=[])\n end",
"def preorder_traversal(root)\n visited = []\n traverse(root, visited)\n visited\nend",
"def pre_order_traversal(current_node = @root)\n @accumulator = []\n pre_order_traversal_aux(curr... | [
"0.81335896",
"0.8011351",
"0.7906197",
"0.7869199",
"0.7617952",
"0.7593604",
"0.75834346",
"0.75386363",
"0.75173354",
"0.74701124",
"0.7464182",
"0.74599093",
"0.7435571",
"0.74265397",
"0.7331957",
"0.73223346",
"0.73156434",
"0.72967565",
"0.729504",
"0.7284927",
"0.7280... | 0.7036623 | 41 |
postorder: First draw path from root to each node and mark direction on path and visit nodes as per path direction Ignore nodes which are going to visit again and consider nodes which are visited to last | def postOrder(root)
return nil if root == nil
postOrder(root.left)
postOrder(root.right)
print " #{root.value}"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def postorder\n postorder_traversal(@root, [])\n end",
"def dfs_tree_postorder(start, edges)\n require 'set'\n queue = [[start,nil]]\n visited = Set[start]\n bq = []\n while queue.size > 0\n f = queue.pop\n bq << f\n ts = edges[f[0]].keys.reject{ |t| visited.member?(t) }\n ts.each{ |t| visit... | [
"0.76230705",
"0.73961765",
"0.71605766",
"0.71135867",
"0.6981831",
"0.69794065",
"0.68771756",
"0.68535686",
"0.67994714",
"0.6764498",
"0.67493755",
"0.6675716",
"0.66671365",
"0.6645947",
"0.66309947",
"0.65657717",
"0.6538964",
"0.6496445",
"0.6490851",
"0.6423056",
"0.6... | 0.57704616 | 54 |
postorder traversal with iterative manner inorder: Draw straight line from each node w/o having intersection and go from beginning node to end node | def inOrder(root)
return nil if root == nil
inOrder(root.left)
print " #{root.value}"
inOrder(root.right)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def level_order_traversal_line_by_line_sol1(root_node)\n queue = Queue.new\n queue.enq root_node\n while(!queue.empty?)\n node_count = queue.size\n while(node_count > 0)\n node = queue.deq\n print node.value\n print \"\\s\"\n\n queue.enq node.left un... | [
"0.61725897",
"0.60208404",
"0.5756017",
"0.57419986",
"0.57400537",
"0.56552386",
"0.56214684",
"0.5543634",
"0.5528585",
"0.54985774",
"0.5450322",
"0.54355645",
"0.5430648",
"0.5415127",
"0.54123783",
"0.54102665",
"0.5395289",
"0.5350339",
"0.5346322",
"0.5345635",
"0.534... | 0.0 | -1 |
two ways of implementation of find height height: no.s of edges from root node to longest leaf node | def height_edges(root)
return -1 if root == nil
left = height_edges(root.left)
right = height_edges(root.right)
if left > right
h = 1 + left
else
h = 1 + right
end
return h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n count_right = 0\n count_left = 0\n node = @root\n return count_left if node.nil?\n\n count_left = height_helper(node, 'left', count_left)\n count_right = height_helper(node, 'right', count_right)\n if count_right > count_left\n count_right\n else\n count_left\n end... | [
"0.80779594",
"0.80105925",
"0.79629827",
"0.79626435",
"0.7958419",
"0.7927384",
"0.79263395",
"0.78611827",
"0.78394324",
"0.7818799",
"0.7803482",
"0.7791029",
"0.7774215",
"0.7760255",
"0.77515644",
"0.7747452",
"0.7747452",
"0.7744866",
"0.77202785",
"0.7628266",
"0.7615... | 0.7997765 | 2 |
height: no.s of nodes from root node to longest leaf node | def height_nodes(root)
return 0 if root == nil
left = height_nodes(root.left)
right = height_nodes(root.right)
if left > right
h = 1 + left
else
h = 1 + right
end
return h
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n max_height = 0\n each do |child|\n if child.kind_of? Tree\n max_height = [max_height, 1].max\n else\n max_height = [max_height, child.height].max\n end\n end\n max_height.succ\n end",
"def height\n count = 0\n if @root != nil\n count = height_help... | [
"0.7975885",
"0.78423697",
"0.7822242",
"0.77793413",
"0.7749319",
"0.7749319",
"0.7744198",
"0.77216023",
"0.7686783",
"0.76714486",
"0.7671287",
"0.7629264",
"0.76285785",
"0.76285785",
"0.761675",
"0.7611407",
"0.7600325",
"0.7571313",
"0.7566023",
"0.7561519",
"0.7546327"... | 0.74088645 | 23 |
height: no.s of edges from root to longest leaf node | def find_height_edges(root)
return -1 if root == nil
left_height = 1 + find_height_edges(root.left)
right_height = 1 + find_height_edges(root.right)
return (left_height > right_height)? left_height : right_height
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n height_recursive(@root)\n end",
"def height\n max_height = 0\n each do |child|\n if child.kind_of? Tree\n max_height = [max_height, 1].max\n else\n max_height = [max_height, child.height].max\n end\n end\n max_height.succ\n end",
"def height(root = sel... | [
"0.789046",
"0.7877523",
"0.7862438",
"0.78505945",
"0.7848457",
"0.7817281",
"0.7817281",
"0.7794976",
"0.7790575",
"0.7775118",
"0.7750455",
"0.7745253",
"0.77399886",
"0.76954097",
"0.76886",
"0.76845884",
"0.76845884",
"0.7658937",
"0.7658151",
"0.7651388",
"0.764877",
... | 0.7647723 | 21 |
height: no.s of nodes from root to longest leaf node | def find_height_nodes(root) # O(n)
return 0 if root == nil
left_height = 1 + find_height_nodes(root.left)
right_height = 1 + find_height_nodes(root.right)
return (left_height > right_height)? left_height : right_height
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def height\n max_height = 0\n each do |child|\n if child.kind_of? Tree\n max_height = [max_height, 1].max\n else\n max_height = [max_height, child.height].max\n end\n end\n max_height.succ\n end",
"def height\n count = 0\n if @root != nil\n count = height_help... | [
"0.8001393",
"0.7908955",
"0.78901273",
"0.78365886",
"0.7799348",
"0.7799348",
"0.7781119",
"0.7763492",
"0.7745417",
"0.7728309",
"0.7712648",
"0.76933813",
"0.7688827",
"0.76887727",
"0.7684243",
"0.7684243",
"0.76550126",
"0.7649881",
"0.76255137",
"0.76206386",
"0.761774... | 0.7298036 | 29 |
GET /items GET /items.json | def index
set_counter
@items = Item.all.order("cached_votes_up DESC")
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def items\n\t\tresponse = self.get('items').body\n\t\titems = JSON.parse(response)\n\t\tparse_items(items)\n\t\treturn items\n\tend",
"def getItems()\n return mergeWithAPI(@item_json)['data']\n end",
"def index\n @items =... | [
"0.79562956",
"0.7546286",
"0.74375594",
"0.7434485",
"0.73975587",
"0.7358414",
"0.7358414",
"0.7358414",
"0.7358414",
"0.7357372",
"0.7313286",
"0.73129123",
"0.7311041",
"0.7306297",
"0.7281173",
"0.7273615",
"0.72629416",
"0.72484964",
"0.72301924",
"0.71767205",
"0.71181... | 0.0 | -1 |
GET /items/1 GET /items/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @items = Item.find(params[:id])\n render json: @items\n end",
"def get_item( item )\n @session.base_url = \"http://cl.ly\"\n resp = @session.get( \"/\" + item )\n \n raise ItemNotFound if resp.status == 404\n Crack::JSON.parse(resp.body)\n end",
"def show\n item = I... | [
"0.7736765",
"0.75480884",
"0.74947023",
"0.7368989",
"0.7327862",
"0.7293909",
"0.7287341",
"0.7132699",
"0.71251625",
"0.711878",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
"0.7088335",
... | 0.0 | -1 |
POST /items POST /items.json | def create
@item = current_user.items.new(item_params)
respond_to do |format|
if @item.save
format.html { redirect_to root_path, notice: 'Item was successfully created.' }
format.json { render :show, status: :created, location: @item }
else
format.html { render :new }
format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n item = list.items.create!(item_params)\n render json: item, status: 201\n end",
"def create\n\t\titem = Item.create(item_params)\n\t\trender json: item\n\tend",
"def create\n @item = @client.items.new(item_params)\n\n respond_to do |format|\n if @item.save\n format.html { ... | [
"0.7971939",
"0.7285761",
"0.7231758",
"0.721958",
"0.71792215",
"0.71131957",
"0.7062943",
"0.7053179",
"0.6988855",
"0.69712186",
"0.6903009",
"0.68806237",
"0.6871792",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6840092",
"0.6839645",
... | 0.6672411 | 52 |
PATCH/PUT /items/1 PATCH/edit/edit/PUT /items/1.json | def update
respond_to do |format|
if @item.update(item_params)
format.html { redirect_to root_path, notice: 'Item was successfully updated.' }
format.json { render :show, status: :ok, location: @item }
else
format.html { render :edit }
format.json { render json: @item.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end",
"def update\n \n respond_to do |format|\n if @item.update_attributes(params[:item])\n format.html { redirect_to @item, :notice => 'Item was successfully updated.' }\n format.json { head :ok }\n else\... | [
"0.7067099",
"0.6945445",
"0.6890041",
"0.68582803",
"0.68492866",
"0.68425494",
"0.682619",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.68146735",
"0.6805969",
"0.6796444",
"0.... | 0.6572654 | 48 |
DELETE /items/1 DELETE /items/1.json | def destroy
@item.destroy
respond_to do |format|
format.html { redirect_to items_url, notice: 'Item was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete\n render json: Item.delete(params[\"id\"])\n end",
"def delete(items)\n item_ids = items.collect { |item| item.id }\n args = {ids: item_ids.to_json}\n return @client.api_helper.command(args, \"item_delete\")\n end",
"def destroy\n @item = Item.find(params[:id... | [
"0.7906849",
"0.76885504",
"0.7604411",
"0.7585917",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.758546",
"0.7547388",
"0.7539847",
"0.7528851",
... | 0.7196719 | 91 |
Use callbacks to share common setup or constraints between actions. | def set_item
@item = Item.find(params[:id])
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_required_actions\n # TODO: check what fields change to asign required fields\n end",
"def action_hook; end",
"def run_actions; end",
"def define_action_hook; end",
"def actions; end",
"def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_... | [
"0.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 item_params
params.require(:item).permit(:item, :body)
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 |
Question 4 The first block would cause the loop to only iterate over every other item in the original array. Arrayshift is only called twice, so 3 and 4 remain in the array, which is returned by Arrayeach. Output: 1 3 => [3, 4] The 2nd block would iterate over the first two items in the array, and then reach the end. Since Arraypop is only called twice, the first two items in the array will remain to be returned by Arrayeach. Output: 1 2 => [1, 2] Question 5 Fix: set the condition to dividend <= 0 instead of == 0 Bonus 1: Test for divisibility. Modulo of a number and any of its factors is always zero. Bonus 2: It's an implicit return statement. bbatsov's guide says that implicit returns are preferable when an explicit return is not needed for flow control. Question 6 Array+ is a shortcut for Arrayconcat, whereas Array<< is a shortcut for Arrayappend. The former takes an array as its input, meaning that for the sake of the buffer you have to wrap the incoming value in an array so that the concat can unwrap it seems wasteful. Official Answer: Using Array<< changes the original buffer, whereas Array+ does not. Question 7 Limit is defined outside the fib method, and is not passed in as an argument. Add a limit argument to fib and pass that value in. You can define the limit variable as the default value for the limit argument so that you don't need to explicitly include it thereby making the method easier to reuse. Question 8 | def titleize(string)
string.split.map { |w| w.capitalize }.join ' '
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def fib_method(number)\n\ncounter = 0\nfib_array = [0,1]\n\n\n#create a loop that breaks down the array into its parts\nuntil counter == number\n\n# if counter is at zero do nothing.\n\nif counter == 0\n#else not at zero subtract from fib_array index current counter -1\n# add too fib_array index counter\n# store t... | [
"0.70935535",
"0.70104235",
"0.6969237",
"0.693083",
"0.6889201",
"0.68876606",
"0.6882936",
"0.6828525",
"0.68259877",
"0.6825175",
"0.6815143",
"0.6784835",
"0.6783128",
"0.67661184",
"0.67656565",
"0.67431873",
"0.6729135",
"0.6716562",
"0.66979873",
"0.66799915",
"0.66567... | 0.0 | -1 |
rubocop: disable CodeReuse/ActiveRecord `_build_ids` is deprecated and will be removed in 14.0 See: | def perform(pipeline_id, _build_ids = nil)
Ci::Pipeline.find_by(id: pipeline_id).try do |pipeline|
Ci::ProcessPipelineService
.new(pipeline)
.execute
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def ids\n @ids ||= []\n end",
"def existing_ids\n return Thread.current[:existing_ids] if Thread.current[:existing_ids]\n\n ids_in = [].tap do |ids|\n transformer.map_column(update_on, records).each_slice(999) do |slice|\n ids << destination_model.arel_table[update_o... | [
"0.61702174",
"0.6145322",
"0.60860634",
"0.5882196",
"0.5882196",
"0.5881698",
"0.5842799",
"0.5816228",
"0.5812693",
"0.5791238",
"0.5788473",
"0.5782986",
"0.5781539",
"0.57235754",
"0.57035094",
"0.5697796",
"0.56768507",
"0.5646146",
"0.5609809",
"0.5595048",
"0.55837035... | 0.0 | -1 |
setter and getter for backed_projects, an empty array at initialize setter and getter for name of backer | def initialize(name) #new instance of a backer takes in a name
@name= name
@backed_projects= []
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def backed_projects \n self.project_backers.map do |projectbacker| \n projectbacker.project\n end\n end",
"def backed_projects\n self.projects.map {|back_project| back_project.project}\n end",
"def backed_projects\n\n # iterate thru existing list of projects and backers to pull jus... | [
"0.78348637",
"0.781063",
"0.7721115",
"0.771174",
"0.74882454",
"0.707806",
"0.7028774",
"0.6948506",
"0.6767714",
"0.67431897",
"0.671964",
"0.6684615",
"0.66723895",
"0.66095674",
"0.648549",
"0.648549",
"0.6468288",
"0.6428605",
"0.64126307",
"0.64102566",
"0.6398174",
... | 0.7024642 | 7 |
evenly distribute the groupings | def combine(groupings, people, results=[], bad_path=[])
return results if groupings.empty?
print "R:"
p results
puts
print "b:"
p bad_path.sort
#print "g:"
#p groupings
puts
line = nil
groupings.each do |item|
if only_off_by_1(results, item, people)
line = groupings.delete item
break
end
end
if line
if bad_path.include? [results[-1], line]
item = results.pop
groupings.push line
groupings.push item
bad_path.push [results[-1], item]
else
results.push line
end
else
item = results.pop
bad_path.push([results[-1], item])
groupings.push item
end
combine groupings, people, results, bad_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def make_groups(all_students)\n\n #calculate how many groups of 5, with one group of leftovers\n num_full_groups = all_students.size / 5\n leftovers = all_students.size % 5\n group_avg = all_students.size.to_f / num_full_groups\n\n #each entry in group_sizes represents one group - put 5 in each full one\n gr... | [
"0.66428614",
"0.644022",
"0.6435781",
"0.6310154",
"0.62894064",
"0.62723553",
"0.6145525",
"0.6088997",
"0.60339504",
"0.60094506",
"0.6007185",
"0.59791756",
"0.5953913",
"0.5934659",
"0.59254575",
"0.5919048",
"0.5890795",
"0.58810717",
"0.5831873",
"0.58258504",
"0.58179... | 0.0 | -1 |
GET /notificationtypes GET /notificationtypes.json | def index
@notificationtypes = Notificationtype.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @notification_types = NotificationType.all\n end",
"def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end",
"def index\n @notification_types = NotificationType.search(params[:search], params[:pa... | [
"0.73500055",
"0.6975381",
"0.6499018",
"0.6428333",
"0.6350602",
"0.6298206",
"0.6296281",
"0.62097937",
"0.6194143",
"0.61803913",
"0.6088028",
"0.6078737",
"0.6059651",
"0.60438997",
"0.60409784",
"0.6032974",
"0.6032974",
"0.6016389",
"0.6010299",
"0.59943",
"0.5974585",
... | 0.72714525 | 1 |
GET /notificationtypes/1 GET /notificationtypes/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @notification_types = NotificationType.all\n end",
"def index\n @notificationtypes = Notificationtype.all\n end",
"def subscriptions\n update_subscriptions(params[:types]) if params[:types]\n @types = build_notification_types\n render :json => @types\n end",
"def show\n @noti... | [
"0.71715546",
"0.7101948",
"0.67506325",
"0.6474472",
"0.6345697",
"0.6218475",
"0.61459947",
"0.6131307",
"0.60254806",
"0.5966506",
"0.59652776",
"0.59436685",
"0.59184384",
"0.5912663",
"0.5901204",
"0.5894205",
"0.58929604",
"0.5890306",
"0.5876692",
"0.5865713",
"0.58643... | 0.0 | -1 |
POST /notificationtypes POST /notificationtypes.json | def create
@notificationtype = Notificationtype.new(notificationtype_params)
respond_to do |format|
if @notificationtype.save
format.html { redirect_to moderator_notificationtypes_path, notice: 'Notificationtype was successfully created.' }
format.json { render :show, status: :created, location: @notificationtype }
else
format.html { render :new }
format.json { render json: @notificationtype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @notification_type = NotificationType.new(notification_type_params)\n\n respond_to do |format|\n if @notification_type.save\n format.html { redirect_to @notification_type, notice: 'Notification type was successfully created.' }\n format.json { render :show, status: :created, l... | [
"0.71165067",
"0.6934795",
"0.6789998",
"0.640815",
"0.6386328",
"0.62375826",
"0.61735004",
"0.61577487",
"0.605502",
"0.60138196",
"0.59891146",
"0.59577453",
"0.5834752",
"0.5834752",
"0.580923",
"0.578771",
"0.578771",
"0.5750855",
"0.57498807",
"0.57393926",
"0.5710362",... | 0.70423204 | 1 |
PATCH/PUT /notificationtypes/1 PATCH/PUT /notificationtypes/1.json | def update
respond_to do |format|
if @notificationtype.update(notificationtype_params)
format.html { redirect_to moderator_notificationtypes_path, notice: 'Notificationtype was successfully updated.' }
format.json { render :show, status: :ok, location: @notificationtype }
else
format.html { render :edit }
format.json { render json: @notificationtype.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n respond_to do |format|\n if @notification_type.update(notification_type_params)\n format.html { redirect_to @notification_type, notice: 'Notification type was successfully updated.' }\n format.json { render :show, status: :ok, location: @notification_type }\n else\n f... | [
"0.7042436",
"0.64380264",
"0.64077884",
"0.60732156",
"0.6044601",
"0.60021424",
"0.59956086",
"0.5990247",
"0.59861004",
"0.59801084",
"0.59801084",
"0.59801084",
"0.59367687",
"0.59249896",
"0.59080654",
"0.5899749",
"0.58924013",
"0.5877912",
"0.5862786",
"0.5853973",
"0.... | 0.6934581 | 1 |
DELETE /notificationtypes/1 DELETE /notificationtypes/1.json | def destroy
@notificationtype.destroy
respond_to do |format|
format.html { redirect_to moderator_notificationtypes_url, notice: 'Notificationtype was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @notification_type.destroy\n respond_to do |format|\n format.html { redirect_to notification_types_url, notice: 'Notification type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"def destroy\n @notification_type = NotificationType.find(params[... | [
"0.7714958",
"0.76677775",
"0.6974458",
"0.6932581",
"0.6932581",
"0.6932581",
"0.6932581",
"0.6833993",
"0.68050015",
"0.67953837",
"0.6784834",
"0.6783142",
"0.67825717",
"0.67780334",
"0.67763627",
"0.6772702",
"0.6755963",
"0.6754058",
"0.67463636",
"0.67411095",
"0.67316... | 0.7534466 | 2 |
Use callbacks to share common setup or constraints between actions. | def set_notificationtype
@notificationtype = Notificationtype.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 notificationtype_params
params.require(:notificationtype).permit(:name, :description)
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.6980244",
"0.6782812",
"0.6745103",
"0.6741142",
"0.6733961",
"0.65925",
"0.6503602",
"0.64967257",
"0.64822173",
"0.64796996",
"0.6456357",
"0.6439594",
"0.63803256",
"0.6376499",
"0.63644457",
"0.6319286",
"0.6299465",
"0.6298051",
"0.62935406",
"0.62923044",
"0.6291212"... | 0.0 | -1 |
GET /door_tags GET /door_tags.json | def index
@door_tags = DoorTag.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tags\n get('tags')\n end",
"def tags\n return head :unauthorized unless current_user\n @tags = current_user.owned_tags.where(\"name like ?\", \"%#{params[:tag]}%\").\n page(params[:page]).per(20)\n if @tags.empty?\n @tags = [current_user.owned_tags.new(name: I18n.t('record.tag_list.no_... | [
"0.7288327",
"0.72448486",
"0.71449494",
"0.7072861",
"0.7037412",
"0.6935678",
"0.6872113",
"0.6857534",
"0.68326855",
"0.6716885",
"0.66547376",
"0.659157",
"0.65785444",
"0.6562971",
"0.6550152",
"0.6543731",
"0.6543731",
"0.6514373",
"0.6485034",
"0.64808744",
"0.64675474... | 0.73494124 | 0 |
GET /door_tags/1 GET /door_tags/1.json | def show
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @door_tags = DoorTag.all\n end",
"def tags\n @tags_with_count = Asset.tag_counts_on(:tags)\n \n @tags = @tags_with_count.map{|tag_hash| tag_hash = tag_hash.name }\n \n respond_to do |format|\n format.html\n format.json { render :json => @tags }\n end\n end",
"def t... | [
"0.7172247",
"0.6830727",
"0.6790261",
"0.6734177",
"0.672243",
"0.66450065",
"0.66283125",
"0.6587648",
"0.6584008",
"0.6551032",
"0.6483446",
"0.64769053",
"0.64450544",
"0.6428818",
"0.6426982",
"0.6390363",
"0.6387405",
"0.631077",
"0.629057",
"0.62772965",
"0.62708026",
... | 0.0 | -1 |
POST /door_tags POST /door_tags.json | def create
@door_tag = DoorTag.new(door_tag_params)
respond_to do |format|
if @door_tag.save
format.html { redirect_to @door_tag, notice: 'Door tag was successfully created.' }
format.json { render :show, status: :created, location: @door_tag }
else
format.html { render :new }
format.json { render json: @door_tag.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def tag!(params = {})\n self.post params, edge: :tags\n end",
"def door_tag_params\n params.require(:door_tag).permit(:tag)\n end",
"def create\n tag = @user.tags.new(:location => params[:location])\n\n if tag.save\n render :status => 200,\n :json => tag_as_hash(tag).... | [
"0.735648",
"0.70592254",
"0.66701573",
"0.65909094",
"0.6569804",
"0.6554544",
"0.6543577",
"0.6509267",
"0.6470823",
"0.64582783",
"0.64275694",
"0.63975036",
"0.63761556",
"0.63345647",
"0.6317917",
"0.6300607",
"0.627312",
"0.62647694",
"0.6262026",
"0.6258143",
"0.624402... | 0.7418671 | 0 |
PATCH/PUT /door_tags/1 PATCH/PUT /door_tags/1.json | def update
respond_to do |format|
if @door_tag.update(door_tag_params)
format.html { redirect_to @door_tag, notice: 'Door tag was successfully updated.' }
format.json { render :show, status: :ok, location: @door_tag }
else
format.html { render :edit }
format.json { render json: @door_tag.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def modify_tag tag\n data = {\n \"tag\" => params\n }\n temp = data[\"servers\"]\n data[\"servers\"] = { \"server\" => temp }\n\n json = JSON.generate data\n\n response = put \"tag/#{tag}\", json\n return response unless response.code == 200\n\n body = JSON.parse response.body\n bod... | [
"0.7057935",
"0.6999276",
"0.6817976",
"0.67866874",
"0.6750965",
"0.66072685",
"0.65550536",
"0.6526612",
"0.6486743",
"0.6480863",
"0.6458767",
"0.6411597",
"0.64097327",
"0.6404073",
"0.63831234",
"0.6336705",
"0.63343394",
"0.632389",
"0.6323162",
"0.63167",
"0.6303154",
... | 0.7045113 | 1 |
DELETE /door_tags/1 DELETE /door_tags/1.json | def destroy
@door_tag.destroy
respond_to do |format|
format.html { redirect_to door_tags_url, notice: 'Door tag was successfully destroyed.' }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @tags_of_novel = TagsOfNovel.find(params[:id])\n @tags_of_novel.destroy\n\n respond_to do |format|\n format.html { redirect_to tags_of_novels_url }\n format.json { head :no_content }\n end\n end",
"def delete_tag tag\n delete \"tag/#{tag}\"\n end",
"def delete(tag)\n ... | [
"0.72829795",
"0.72393364",
"0.72001964",
"0.7144119",
"0.7113708",
"0.7098564",
"0.7084683",
"0.70776635",
"0.70524883",
"0.70400137",
"0.7030984",
"0.70005167",
"0.70005167",
"0.70005167",
"0.6992042",
"0.6989122",
"0.698343",
"0.69474715",
"0.6942441",
"0.69422364",
"0.693... | 0.76496124 | 0 |
Use callbacks to share common setup or constraints between actions. | def set_door_tag
@door_tag = DoorTag.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.61642385",
"0.60448",
"0.5945487",
"0.5915654",
"0.58890367",
"0.58330417",
"0.5776098",
"0.5703048",
"0.5703048",
"0.5654613",
"0.5620029",
"0.5423114",
"0.540998",
"0.540998",
"0.540998",
"0.5393666",
"0.53783023",
"0.53568405",
"0.53391176",
"0.5339061",
"0.53310865",
... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def door_tag_params
params.require(:door_tag).permit(:tag)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end",
"def allow_params_authentication!; end",
"def allowed_params\n ALLOWED_PARAMS\n end",
"def default_param_whitelist\n [\"mode\"]\n... | [
"0.69792545",
"0.6781151",
"0.67419964",
"0.674013",
"0.6734356",
"0.6591046",
"0.6502396",
"0.6496313",
"0.6480641",
"0.6477825",
"0.64565",
"0.6438387",
"0.63791263",
"0.63740575",
"0.6364131",
"0.63192815",
"0.62991166",
"0.62978333",
"0.6292148",
"0.6290449",
"0.6290076",... | 0.0 | -1 |
Method to clear screen | def clear_screen
sleep(3)
system "clear"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_screen\n CLEAR_SCREEN\n end",
"def clear_screen\r\n system('clear') || system('cls')\r\n end",
"def clear_screen\n system \"clear\" or system \"cls\"\n end",
"def clear_screen\n system \"clear\" or system \"cls\"\n end",
"def clear_screen\n\t\tputs \"Clearing screen\"\n\t\tsys... | [
"0.9042058",
"0.88165426",
"0.8718861",
"0.8718861",
"0.86616534",
"0.8616045",
"0.8611374",
"0.8600059",
"0.85629106",
"0.8500091",
"0.8500091",
"0.84282017",
"0.8425539",
"0.83217597",
"0.82111543",
"0.81790555",
"0.8166506",
"0.81625956",
"0.814347",
"0.8120129",
"0.811304... | 0.81611043 | 18 |
Method for intro to the game | def intro
clear_screen
print "Today is "
puts Time.now
sleep(2)
puts"\nYou are travelling by motorcycle on a dirt road in Thailand, when all of a sudden you swerve and hit a ditch. Knocking yourself unconcious...\n\n"
sleep (5)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def intro\n\t\t@frame = @frame + 1\n\t\tif @frame == 1 or @frame == 40 \n\t\t\t@screen.fill([0, 0, 0])\n\t\telsif @frame == 10 or @frame == 60\n\t\t\t@map.updateBackground\n\t\t\t@map.sprites.each { |sprite|\n\t\t\t\tsprite.draw(@screen)\n\t\t\t}\n\t\telsif @frame == 220\n\t\t\t@frame = 0\n\t\t\tstats\n\t\t\tsetM... | [
"0.79059094",
"0.74464864",
"0.7177579",
"0.7160354",
"0.70822287",
"0.7048985",
"0.7022552",
"0.700869",
"0.67640555",
"0.6726694",
"0.67057514",
"0.668713",
"0.6653742",
"0.6631242",
"0.6631242",
"0.6631242",
"0.6631242",
"0.6631242",
"0.6631129",
"0.6631129",
"0.6629573",
... | 0.6578287 | 24 |
Method for about menu option | def about
puts "Created by: Frank Rycak Jr." + " " + "\u00A9" + " " + "2016" + " " + "Wyncode Cohort 8"
sleep(3)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def about\r\n end",
"def about\n\tend",
"def about\n\tend",
"def about\n end",
"def about\n\n \tend",
"def about\n\n end",
"def about\n end",
"def about\n end",
"def about\n end",
"def about\n end",
"def about\n end",
"def about\n end",
"def about\n end",
"def about\n end"... | [
"0.784483",
"0.7675253",
"0.7675253",
"0.76531464",
"0.76271677",
"0.7604362",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
"0.7531181",
... | 0.0 | -1 |
Method to exit the game | def close
puts "Goodbye comeback soon!"
exit
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def game_exit\n Message.game_quit\n false\n end",
"def end_game\n\t\tputs \"Goodbye!\"\n\t\texit\n\tend",
"def end_game\n\n end",
"def quit\n Rubygame.quit()\n exit\n end",
"def end_game\n end",
"def exit(state_manager, game)\n exiting = true\n end",
"def exit_game\n prin... | [
"0.8552952",
"0.8431173",
"0.83706313",
"0.83605057",
"0.8185223",
"0.8162507",
"0.79778695",
"0.79541934",
"0.79315764",
"0.7877723",
"0.7859241",
"0.77339876",
"0.7657996",
"0.7615838",
"0.7591152",
"0.7509634",
"0.7485579",
"0.74371934",
"0.74061185",
"0.74045086",
"0.7368... | 0.0 | -1 |
Method to choose weapon | def select_weapon
# Store weapons in new array
weapons = [
"\u{1F52B}" + " " + "gun",
"\u{1F526}" + " " + "flashlight",
"\u{1F525}" + " " + "torch",
"\u{1F528}" + " " + "hammer",
"\u{1F52A}" + " " + "knife"]
# Ask user to choose a starting weapon
puts "Choose your weapon by typing its associated number: \n\n"
# Loop through weapons array and print options to console
# prints the weapons and its value
(0...weapons.length).each do |i|
puts "#{i+1} - #{weapons[i]}"
end
# user input placeholder
print "> "
# getting the users choice
choice = $stdin.gets.chomp.to_i - 1
@selected_weapon = weapons[choice]
#switch case for output of weapon choice
case choice
when 0
puts "You selected: #{@selected_weapon}"
clear_screen
start_game
when 1
puts "You selected: #{@selected_weapon}"
clear_screen
start_game
when 2
puts "You selected: #{@selected_weapon}"
clear_screen
start_game
when 3
puts "You selected: #{@selected_weapon}"
clear_screen
start_game
when 4
puts "You selected: #{@selected_weapon}"
clear_screen
start_game
else
puts "\nChoose again\n\n"
select_weapon
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def chose_weapon\n if @class == 'Water'\n chosen_weapon = Weapon.new \n return chosen_weapon.water_weapons\n end\n end",
"def weapon; end",
"def weapon; end",
"def weapon; end",
"def equipe_weapon(weapon)\n #equipe weapon\n #5 weapons to choice from\n #need to cover user's input t... | [
"0.7904671",
"0.77307606",
"0.77307606",
"0.77307606",
"0.766106",
"0.7326765",
"0.729373",
"0.72665846",
"0.7207878",
"0.7204816",
"0.7174237",
"0.7151032",
"0.7151032",
"0.7151032",
"0.7080718",
"0.70743257",
"0.70737207",
"0.6941181",
"0.6938297",
"0.69157714",
"0.68877816... | 0.69623077 | 17 |
Method to change weapon | def change_weapon
# Store weapons in new array
weapons = [
"\u{1F52B}" + " " + "gun",
"\u{1F526}" + " " + "flashlight",
"\u{1F525}" + " " + "torch",
"\u{1F528}" + " " + "hammer",
"\u{1F52A}" + " " + "knife"]
# Ask user to choose a starting weapon
puts "Choose your weapon by typing its associated number: \n\n"
# Loop through weapons array and print options to console
# prints the weapons and its value
(0...weapons.length).each do |i|
puts "#{i+1} - #{weapons[i]}"
end
# user input placeholder
print "> "
# getting the users choice
choice = $stdin.gets.chomp.to_i - 1
@selected_weapon = weapons[choice]
#switch case for output of weapon choice
case choice
when 0
puts "You selected: #{@selected_weapon}"
walking_down_the_path
when 1
puts "You selected: #{@selected_weapon}"
walking_down_the_path
when 2
puts "You selected: #{@selected_weapon}"
walking_down_the_path
when 3
puts "You selected: #{@selected_weapon}"
walking_down_the_path
when 4
puts "You selected: #{@selected_weapon}"
walking_down_the_path
else
puts "\nChoose again\n\n"
select_weapon
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_weapon(weapon)\n @weapon = weapon\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def set_weapon\n @weapon = Weapon.find(params[:id])\n end",
"def weapon; end",
"def weapon; end",
"def... | [
"0.80934095",
"0.77422184",
"0.77422184",
"0.77422184",
"0.76388395",
"0.76388395",
"0.76388395",
"0.76039654",
"0.73263764",
"0.7217511",
"0.71251196",
"0.71190757",
"0.70276713",
"0.69845635",
"0.6975384",
"0.69510746",
"0.68978214",
"0.6860854",
"0.6856575",
"0.6837922",
"... | 0.6675882 | 25 |
Method to start game | def start_game
# Assign initial value for items_collected array
$items_collected = []
# Ask player if they are ready to play
puts "\nReady to play? Y/N"
print "> "
# confirmation of players intention to play
confirm = $stdin.gets.chomp.upcase
if confirm == 'Y'
clear_screen
enter_room
else
puts "Game over"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def start\n DataManager.create_game_objects\n $game_party.setup_starting_members\n $game_map.setup(Config::Starting_Map_ID)\n $game_player.moveto(Config::X_Pos, Config::Y_Pos)\n $game_player.followers.visible = false\n $game_player.refresh\n $game_player.make_encounter_count\n\n @character_... | [
"0.8228377",
"0.8196538",
"0.79898727",
"0.7972225",
"0.7969193",
"0.7949641",
"0.7888288",
"0.7883422",
"0.78776747",
"0.7877595",
"0.7758869",
"0.772901",
"0.77028567",
"0.7668156",
"0.7653181",
"0.7631221",
"0.7630464",
"0.76302075",
"0.76159257",
"0.75409013",
"0.75407475... | 0.0 | -1 |
Method to enter room | def enter_room
time = Time.now
time_future = time + 100*60*60
# Inform user of current status
puts "\nYou awake in a small room."
print "...the date is "
puts time_future
puts "\nFours days after your accident!\n\n"
puts "There is a large door in the distance that is locked."
puts "In front of you is a small table.\n\n"
puts "You walk towards the table.\n\n"
desk_options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def room\n end",
"def enter_the_room(name, options={})\n json_request \"enter\", {:name => name}, options\n end",
"def room_enter(player, value)\r\n self.synchronize do\r\n iroom = value\r\n if iroom < 0\r\n room = Room.new(player, @batch_game)\r\n @rooms << room\r\n ir... | [
"0.7343197",
"0.7112974",
"0.70847833",
"0.7038508",
"0.6925626",
"0.6827705",
"0.67141986",
"0.6515238",
"0.64859617",
"0.6455609",
"0.64501816",
"0.64501816",
"0.64240146",
"0.64116806",
"0.64116806",
"0.64116806",
"0.64116806",
"0.64116806",
"0.64116806",
"0.64116806",
"0.... | 0.61378527 | 56 |
Method for first item found at desk | def desk_options
#items that can be found in the desk
desk_items = [
"\u{1F511}" + " " + "key",
"\u{270F}" + " " + "pencil",
"\u{1F4B5}" + " " + "money",
"\u{1F354}" + " " + "hamburger",]
# Ask user to pick an item
puts "Choose and item to take with you: "
# Loop through desk items array and print options to console
# prints the desk items and its value
(0...desk_items.length).each do |i|
puts "#{i+1} - #{desk_items[i]}"
end
# user input placeholder
print "> "
# getting the users choice
choice = $stdin.gets.chomp.to_i - 1
@selected_from_desk = desk_items[choice]
# if-statement to determine which item they chose and then adding it to the items_collected array
if choice == 0
puts "\nThe #{@selected_from_desk} has been added to your bag"
$items_collected << "key"
clear_screen
puts "\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'"
sleep(5)
options_when_walking_away_from_desk
elsif choice == 1
puts "\nThe #{@selected_from_desk} has been added to your bag"
$items_collected << "pencil"
clear_screen
puts "\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'"
sleep(5)
options_when_walking_away_from_desk
elsif choice == 2
puts "\nThe #{@selected_from_desk} has been added to your bag"
$items_collected << "money"
clear_screen
puts "\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'"
sleep(5)
options_when_walking_away_from_desk
elsif choice == 3
puts "\nThe #{@selected_from_desk} has been added to your bag"
$items_collected << "hamburger"
clear_screen
puts "\nYou found a letter on the desk. It says 'Find your way to the castle and bring me my things!'"
sleep(5)
options_when_walking_away_from_desk
else
puts "\n***Please choose an item that is available!***\n\n"
desk_options
# printing out users selection
puts "\nYou selected: #{@selected_from_desk}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def first_item\n items.first\n end",
"def first\n @items.first\n end",
"def first_item (electives)\n electives[0] \nend",
"def first\n items.compact.first\n end",
"def first\n\n @items.values.first\n end",
"def first_titem\n @first_titem ||= titems.first\n end",
"def fi... | [
"0.7460917",
"0.7369077",
"0.71203876",
"0.69494927",
"0.68636626",
"0.66962075",
"0.66858256",
"0.6631946",
"0.66303486",
"0.658066",
"0.6574405",
"0.6462921",
"0.63563746",
"0.6322906",
"0.6291972",
"0.6284179",
"0.6275619",
"0.6247575",
"0.6212045",
"0.6212045",
"0.6199723... | 0.0 | -1 |
method for options when after picking item from desk | def options_when_walking_away_from_desk
# letting user know whats happening with the door
puts "\nYou walk to the door and... "
sleep(2)
if $items_collected.include?("key") then
puts "You use the key to open the door"
sleep(2)
opened_the_door_walked_outside
else !$items_collected.include?("key")
puts "Sorry you dont have the key, go back to the desk!\n\n"
sleep(2)
remove_last_item_from_items_collected_at_desk
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def choice_a_shop\n sell_item\n end",
"def pbChooseItemScreen(proc=nil)\n oldlastpocket = @bag.lastpocket\n oldchoices = @bag.getAllChoices\n @scene.pbStartScene(@bag,true,proc)\n item = @scene.pbChooseItem\n @scene.pbEndScene\n @bag.lastpocket = oldlastpocket\n @bag.setAllChoices(ol... | [
"0.6764992",
"0.6666634",
"0.6616228",
"0.65771616",
"0.65384513",
"0.649539",
"0.6431496",
"0.64119834",
"0.6403975",
"0.63912326",
"0.6377945",
"0.63632965",
"0.6341812",
"0.6328854",
"0.63126993",
"0.63107127",
"0.63107127",
"0.62461334",
"0.6199813",
"0.6197594",
"0.61682... | 0.0 | -1 |
method to remove last item from array when being returned to previous task which is desk_options | def remove_last_item_from_items_collected_at_desk
$items_collected.delete($items_collected.last)
# returns user to previous task of choosing item from desk
desk_options
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def remove_retrieve_last\n # @array.pop\n @array.slice!(0)\n end",
"def remove_from_end(arr)\n arr.pop\nend",
"def end_arr_delete(arr)\n # delete the element from the end of the array and return the deleted element\n return arr.pop\nend",
"def end_arr_delete(arr)\n # delete the element from ... | [
"0.6963716",
"0.64641136",
"0.63236254",
"0.6311188",
"0.6307276",
"0.62615",
"0.6249341",
"0.6240122",
"0.6172503",
"0.616893",
"0.61656433",
"0.6144886",
"0.6144886",
"0.61134374",
"0.6075888",
"0.60530627",
"0.60505855",
"0.6049656",
"0.604131",
"0.602731",
"0.5995594",
... | 0.76924026 | 0 |
Method for your options when you have opened the door | def opened_the_door_walked_outside
# array for choices once you have made it outside
where_to_go = ["path", "forest"]
puts "\nWhere would you like to go:"
puts "Path or Forest?"
# user input placeholder
print "> "
# getting user input for either forest or path
confirm = $stdin.gets.chomp.upcase
if confirm == "P" or confirm == "PATH"
walking_down_the_path
clear_screen
sleep(3)
elsif confirm == "F" or confirm == "FOREST"
walking_down_into_the_forest
clear_screen
sleep(3)
else
puts "Choose again..."
opened_the_door_walked_outside
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def open_option\n call_scene(Options) do |scene|\n if scene.modified_options.include?(:language)\n @running = false\n Graphics.transition\n end\n end\n end",
"def opens\n if open_status == true || unlocked_status == false\n raise ArgumentError.new(\"You cannot... | [
"0.63623565",
"0.6344335",
"0.61970896",
"0.6074297",
"0.58820724",
"0.5850785",
"0.58345914",
"0.57776874",
"0.5769926",
"0.57672477",
"0.56921506",
"0.5595263",
"0.55812484",
"0.55741096",
"0.5572479",
"0.55303884",
"0.55242586",
"0.551804",
"0.5501702",
"0.54990184",
"0.54... | 0.0 | -1 |
Method for walking to the path | def walking_down_the_path
sleep(2)
clear_screen
puts "As you walk down the path it becomes harder to see, its getting dark."
if @selected_weapon.include?("flashlight") or @selected_weapon.include?("torch") then
puts "Luckily you have a #{@selected_weapon} to help light the path."
walking_out_of_the_path
else
puts "\nOh No! you dont have the right tools to continue in the dark!"
puts "\nWould you like to go back and pick another tool?"
puts "Yes or No?"
print "> "
end
# confirmation to change weapon
confirm = $stdin.gets.chomp.upcase
if confirm == 'Y' or confirm == 'YES'
puts "You walk back to the cabin..."
clear_screen
change_weapon
else
game_over
restart_game
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk(path); end",
"def walk_path(path)\n tree.walk_path(path)\n end",
"def walk; end",
"def go(direction)\n return @paths[direction]\n end",
"def calculate_path(actor)\n reset_baconator(actor)\n node_search do |current_node|\n process_single_node(current_node)\n end\n e... | [
"0.81260216",
"0.7355205",
"0.6753608",
"0.6586477",
"0.6470474",
"0.644996",
"0.6436837",
"0.64339465",
"0.63970673",
"0.6351203",
"0.63044775",
"0.6227891",
"0.6207927",
"0.61936337",
"0.6183794",
"0.616411",
"0.6157989",
"0.6131033",
"0.6111692",
"0.6111171",
"0.6068107",
... | 0.0 | -1 |
Method for walking thru of the path | def walking_out_of_the_path
path_items = ["ruby", "laptop"]
sleep(3)
puts "\nWith the use of your #{@selected_weapon} you see something in the distance"
sleep(3)
puts "\nIts a ruby and a laptop! Would you like to take one with you?"
puts "Yes or No?"
print "> "
confirm = $stdin.gets.chomp.upcase
if confirm == 'Y' or confirm == 'YES'
sleep(2)
puts "Which would you like to add to your bag?"
puts "Ruby or the Laptop?"
puts "Select number: "
#Loop through path items array and print options to console
# prints the path items and its value
(0...path_items.length).each do |i|
puts "#{i+1} - #{path_items[i]}"
end
# user input placeholder
print "> "
# getting the users choice
choice = $stdin.gets.chomp.to_i - 1
@selected_path_item = path_items[choice]
if choice == 0 then
puts "You have added the #{@selected_path_item} to the bag"
$items_collected << @selected_path_item
puts "Now you make your way to the end of the path"
sleep(4)
enter_castle
elsif choice == 1
puts "You have added the #{@selected_path_item} to the bag"
$items_collected << @selected_path_item
puts "Now you make your way to the end of the path"
sleep(4)
enter_castle
else
puts "Choose 1 or 2"
walking_out_of_the_path
end
else
puts "You took nothing and continued out of the path."
enter_castle
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def walk(path); end",
"def walk_path(path)\n tree.walk_path(path)\n end",
"def traverse(path)\n if (File.directory?(path))\n dir = Dir.open(path)\n while name = dir.read\n next if name == \".\"\n next if name == \"..\"\n traverse(path + \"/\" + name)\n end\n dir.... | [
"0.7810511",
"0.69901484",
"0.6650011",
"0.64397216",
"0.6364111",
"0.63446015",
"0.63115203",
"0.62463695",
"0.622829",
"0.62179875",
"0.6167805",
"0.61545146",
"0.61262107",
"0.6124182",
"0.61193347",
"0.60685945",
"0.6060677",
"0.60369813",
"0.59959424",
"0.5985391",
"0.59... | 0.0 | -1 |
Method for walking thru the forest | def walking_down_into_the_forest
clear_screen
puts "As you walk into the forest you hear a noise up ahead.\n\n"
sleep(2)
puts "There is a Giant Troll rushing towards you...\n\n"
sleep(2)
if @selected_weapon.include?("gun") or @selected_weapon.include?("knife") then
puts "Luckily you have a #{@selected_weapon} and you defeated the Giant Troll!\n\n"
walking_out_of_the_forest
else
puts "Oh No! you dont have the right tools to fight The Giant Troll!\n\n"
puts "He rushes you and crushes your skull\n\n"
game_over
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def traverse; end",
"def iterate(itr)\n itr.call(@leaf)\n end",
"def tree\n @treetop = @proj.default_ontology_class\n @proj.ontology_classes.first if !@treetop\n redirect_to :action => :new, :controller => :ontology_classes and return if !@treetop\n @colored_object_relationships = @proj.object_... | [
"0.589193",
"0.556502",
"0.55140847",
"0.54878765",
"0.5467944",
"0.5377388",
"0.53679067",
"0.5365898",
"0.5359119",
"0.5356659",
"0.5351507",
"0.5334958",
"0.53005326",
"0.5259904",
"0.52141726",
"0.5199245",
"0.5192096",
"0.5188949",
"0.5177104",
"0.514848",
"0.5145552",
... | 0.0 | -1 |
Method for walking out of the forest | def walking_out_of_the_forest
clear_screen
trolls_head = "Trolls Head"
puts "Now that you used your #{@selected_weapon} to defeat the Giant Troll,"
puts "Would you like to take his head as a suvorneir?\n\n"
puts "Yes or No?"
print "> "
confirm = $stdin.gets.chomp.upcase
if confirm == "Y" or confirm == "YES"
puts "You added the #{trolls_head} to your bag.\n\n"
$items_collected << "trolls_head"
enter_castle
else
puts "You took nothing and continued out of the path."
enter_castle
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def unfinish(paths)\n if paths.empty?\n raise Plan::Advice.new('please drill down to a level to unfinish')\n end\n # go to the right depth and unfinish\n item = path_tree.descend(paths)\n item.unfinish!\n save_path_tree\n # print what happened here\n ... | [
"0.6104339",
"0.60173285",
"0.587988",
"0.587988",
"0.5770696",
"0.57496595",
"0.5686387",
"0.56366366",
"0.56055605",
"0.56016433",
"0.5571667",
"0.5558469",
"0.5541619",
"0.5531022",
"0.54629964",
"0.5454625",
"0.5452459",
"0.5434093",
"0.54296017",
"0.53947127",
"0.5358233... | 0.0 | -1 |
Method for entering the castle | def enter_castle
clear_screen
sleep(5)
castle_choices = ["door", "staircase"]
puts "You made it to the castle!"
puts "\nAs you walk in you notice there is a door ahead and a staircase."
puts "\nWould you like to open the door, or walk up the staircase"
puts "Type 'door' or 'stairs':"
print"> "
confirm = $stdin.gets.chomp.upcase
clear_screen
if confirm == 'DOOR' or confirm == 'D'
puts "The door is locked and you dont have another key."
wrong_choice_castle
elsif confirm == 'STAIRS' or confirm == 'S'
puts "You have made it to the castle! The Knight asks if you brought his things."
user_items
else
puts "Choose again..."
wrong_choice_castle
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def enter\n puts \"CUSTOMER HAS ENTERED, LOCK GATE AGAIN\"\n @gate.change_state(ClosedGateState.new(@gate))\n end",
"def enter_state\n end",
"def casino_floor\n puts\n puts \"Welcome back!\"\n @person_wallet.show_wallet\n choose_game\n end",
"def enter\n Apartment::Ten... | [
"0.63809156",
"0.6100152",
"0.60367626",
"0.5882694",
"0.5871264",
"0.56995076",
"0.56804585",
"0.5638343",
"0.5638343",
"0.5638343",
"0.56157696",
"0.5612657",
"0.55982465",
"0.55515474",
"0.5525519",
"0.55139256",
"0.5447344",
"0.53828025",
"0.53485864",
"0.53343856",
"0.53... | 0.5804551 | 5 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.