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 |
|---|---|---|---|---|---|---|
pop up end tags from the stack | def multi_end2(ttls)
rpls = ''
ttl = @tg_end.size-1
ttl = ttls-1 if ttls
ttl.downto(0) do |i|
sz = @tg_end[i][/^ +/].to_s.size
if ttls || @spc.size <= sz
send = @tg_end.pop
if send.strip[0,5]=="!run!"
scrpt = send.gsub("\n","\n#{@spc}").split("\n")
@doc_src = scrpt[1,99]+@doc_src
else
spc = send[/(^[ \t]*)/,1].to_s
rpls << (send.gsub("\n","\n#{spc}") + "\n")
end
end
end
p "End2 : #{rpls}" if @dbg[:parse] && rpls!= ''
rpls
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def end(name)\n stack(name).pop\n end",
"def discard()\n element_stack = []\n\n while(true)\n e = @pull_parser.peek\n name = e[0]\n if e.start_element?\n element_stack.push(name)\n elsif e.end_element?\n return nil if element_stack.size == 0\n raise \"mismat... | [
"0.7043606",
"0.6781192",
"0.67729473",
"0.67261976",
"0.6725965",
"0.6725965",
"0.6701047",
"0.6657208",
"0.66569704",
"0.6612764",
"0.65983444",
"0.6592795",
"0.6590307",
"0.656103",
"0.6558478",
"0.6510645",
"0.65091044",
"0.65002126",
"0.64891374",
"0.6478215",
"0.6478215... | 0.0 | -1 |
command execution "key", internally parsed to "%_key~", so both command are the same except that command "key" need to translate to "%_key~" and it goes to Hot files key definition to lookup to. some of these definition built in (for erb: %_if , %_elsif , %_else , %_end , ... etc) if => %_if li => %_li | def shortcut_exec(regex)
if(regex =~ @row;@rgx = $~)
srcs = @rgx.to_s
rplc = "#{@rgx[1]}%!_#{@rgx[2]}~ #{@rgx[3]}\n"
@row.gsub!(srcs,rplc)
p "reExe_ #{@row}" if @dbg[:parse]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def handle_key(key); end",
"def get_key_from_command(argv)\n case argv[0].to_s.downcase\n when \"info\",\"multi\",\"exec\",\"slaveof\",\"config\",\"shutdown\",\"select\"\n nil\n else\n # Unknown commands, and all the commands having the key\n # as first argument ar... | [
"0.6417169",
"0.636669",
"0.6347327",
"0.6273761",
"0.6261199",
"0.61597383",
"0.6155341",
"0.61010396",
"0.6087634",
"0.6042987",
"0.6014585",
"0.5964492",
"0.5936739",
"0.5928263",
"0.5920729",
"0.59025073",
"0.5897449",
"0.5889133",
"0.5886107",
"0.5884398",
"0.58809423",
... | 0.0 | -1 |
command execution "=", internally parsed to "%=~", so both command are the same except that command "=" need to translate to "%=~" and it goes to Hot files key definition to lookup to. you can redefine it. | def shortcut_equal(regex)
if(regex =~ @row;@rgx = $~)
srcs = @rgx.to_s
rplc = "#{@rgx[1]}%!=~#{@rgx[3]}\n"
@row.gsub!(srcs,rplc)
p "reEqu_ #{rplc}" if @dbg[:parse]
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_command\n [grep_cmd, '&&', replace_cmd, '||', append_cmd].join(' ')\n end",
"def command_shortcuts(cmd)\n shortcuts[cmd] \n end",
"def default_cmd ; %w{urxvt} ; end",
"def default_command(command)\n @@default_command = command.to_sym\n end",
"def unset_command\n [gre... | [
"0.6253883",
"0.61958927",
"0.5838727",
"0.5795322",
"0.5788183",
"0.56640995",
"0.56343424",
"0.5576013",
"0.55415857",
"0.55257344",
"0.548541",
"0.5479717",
"0.5478878",
"0.5444794",
"0.5444057",
"0.5443944",
"0.54303545",
"0.54270583",
"0.5423066",
"0.54098696",
"0.540239... | 0.0 | -1 |
this command is the selector from command %..key.. params1;paramsN \n ex: %divparams\n or %div. if key div fine in hot, it will translate to HOT tags, but if not it become w2tags | def get_hot_simple(regex)
if regex =~ @row ;@rgx = $~
chk1= @rgx[2][-1,1] + @rgx[3][0,2].to_s
chk2= @rgx[2][/"\}!/]
chk3= @rgx[2][/"\}~/]
# already become w2tags, ignore!!!
if (/[=\}][!~][ ]?/ !~ chk1 && chk2 == nil && chk3 == nil)
keys = @rgx[2].strip
opts = @rgx[3]
#p chk1
# FIX for:
# %form#dodol{action="<%= #{aaa} %>"} <%= #{bbb} %>
# <form id="dodol" action="<%= #{aaa} %>"><%= #{bbb}%></form>
# when wrong splitting, fix the splitting...
# assume last attribute don't have spaceses!!! ==>{opt="blah"}<==
fixd = keys.split('"} ')
if fixd.length>1
keys = fixd[0]+'"}'
opts = fixd[1]+opts
end
srcs = @rgx.captures.join
opts = $1 << opts if keys.gsub!(/(\/)$/,'')
hots = keys.gsub(/\{.*\}$/,'').gsub(/[:#.][\w\-#.=]*$/,'')
rplc = @tg_hot[hots]!=nil ?
"%!#{keys}~ #{opts}" :
"%!#{keys}! #{opts}"
@row.gsub!(srcs,rplc)
p "reHot> #{@row} << -H-O-T-" if @dbg[:parse]
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def getcommand(msg)\n msg.message =~ /#{$COMMAND}(\\w+)/\n commandused = $1\n case commandused\n when 'roll', 'nobotch', 'special'\n if msg.message =~ /#{commandused}\\s*help\\s*$/\n # show command help\n \"#{HELP_TEXT(commandused)}\"\n elsif msg.message =~ /#{commandused}\\s+(.*)\\s*$/\n ... | [
"0.5667535",
"0.54549706",
"0.54143006",
"0.53610253",
"0.5328877",
"0.5319789",
"0.5308048",
"0.52223307",
"0.51546466",
"0.51546466",
"0.51531166",
"0.51356596",
"0.5061754",
"0.50431377",
"0.50216234",
"0.50082606",
"0.49951968",
"0.49951968",
"0.49928018",
"0.49784207",
"... | 0.4825191 | 48 |
these not really visible for end user, since user usualy see the command as a HAML like command and translate to this HOT files. the translation usually came from method in: shortcut_exec get_hot_simple format for this command is %...key...~..params1;paramsN..\n | def parse_hot
eva = ''
col = @row.split('%')
return false if col.size==1
(col.size-1).downto(0) do |c|
eva = "%#{col[c]}" << eva
@rg_hot.each do |ht|
if(ht =~ eva;@rgx = $~)
@key = @rgx[2]
prms = @rgx[3].to_s.strip
if /^\!/ =~ @key
@new = (multi_end2(nil)+@spc+@rgx.to_s.gsub('%!','%')).split("\n")
swap_last_empt_src_with_end_tg(@new) #@new array of src
@row = ''
else
nameidclass_var()
# Auto closing, see in "erb.hot": _elsif _else:
# when last doc out is <% end %> and hot command is %_elsif or %_else
# then remove the last doc out <% end %>
if @doc_out[-1] and @doc_out[-1].strip=='<% end %>'
@doc_out.pop if %w[else elsif].include? prms.split(' ')[0]
end
params_inline prms #concenation line if params end with \
@mem_var["$tag"] = @key
if @tg_hot[@key]
hots = @tg_hot[@key]
hots[1]='' if !hots[1] #remark if not error!
@new = hots[0].call(self).clone
if @new.strip=="" #&& @tg_end[-1]
@tg_end << "#{@spc}#{hots[1][0]}"
empt = @row.gsub!(@rgx.to_s,"").strip
@row = empt if empt == "" #remove if empty (only \t,\n)
else
@tg_end << "#{@spc}#{hots[1][0]}" if hots[1]
@new.gsub!(/( *~\^.*[^\n]+)/,"^~^~^")
setvar = $1 # don't parse SetMem ~^
@new.gsub!(/\n/,"\n#{@spc}")
get_dollar(prms,hots[1])
@new.gsub!(/\^~\^~\^/,setvar) if setvar #restore SetMem
re_indent(@rgx.to_s)
end
p "Func>> #{@new}" if @dbg[:parse]
else
@row.gsub!(@rgx.to_s,"<!-- no hot for:#{@key} -->")
end
end
break
end
end
break if @rgx
end
@rgx!=nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def command_shortcuts(cmd)\n shortcuts[cmd] \n end",
"def help command\n puts \"\nThe command you entered, #{command}, is not supported.\nValid commands: \"\n @command_map.each_key{|key| puts \"\\t#{key}\\n\"}\n end",
"def translate_shortcut(cmd)\n command_lookup_table[cmd] || cmd\n end... | [
"0.64645034",
"0.6264762",
"0.62238204",
"0.6182368",
"0.6162928",
"0.61588615",
"0.6117151",
"0.61039364",
"0.60955083",
"0.60710704",
"0.6048732",
"0.6038716",
"0.60207754",
"0.60196453",
"0.60182136",
"0.5994478",
"0.5918325",
"0.5884061",
"0.5845444",
"0.58102804",
"0.579... | 0.554707 | 59 |
internal use call from get_div get_input | def get_shortcut(regex,tag)
if(regex =~ @row;@rgx = $~)
src = @rgx.captures.join
keys= @rgx[1,2].join.strip
opts= @rgx[3].to_s
opts= $1 << opts if keys.gsub!(/(\/)$/,'')
#tgt = "%!#{tag}#{keys}!#{opts}"
tgt = "%#{tag}#{keys} #{opts}"
@row.gsub!(src,tgt)
p "to#{tag.capitalize[0,3]}: #{tgt}" if @dbg[:parse]
end
@rgx!=nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_input;\t@input \t\tend",
"def text_input; end",
"def input; @input; end",
"def input; @input; end",
"def get_input\n #Get input from the user\nend",
"def input; end",
"def input; end",
"def input; end",
"def user_input\n\tgets\nend",
"def read_input\n end",
"def stdinput\n ... | [
"0.7393197",
"0.6358912",
"0.63160205",
"0.63160205",
"0.62269545",
"0.6177137",
"0.6177137",
"0.6177137",
"0.6107064",
"0.60244817",
"0.59154445",
"0.5914387",
"0.5900488",
"0.5898558",
"0.5777839",
"0.57528484",
"0.57451373",
"0.5730283",
"0.5708698",
"0.5702846",
"0.568182... | 0.0 | -1 |
shortcut for "%...div...!params", and user no need to write "%div" if user supply the command with ID or CLASS. %divkey my key features same as: key my key features %div.okey my key features same as: .okey my key features | def get_div( regex)
get_shortcut(regex,'div')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def keyName _args\n \"keyName _args;\" \n end",
"def send_key(*args); end",
"def key(*args)\n args.join(\":\")\n end",
"def _key(*args); args.hash; end",
"def key(*args)\n args.compact.join(\"/\")\n end",
"def key_entry(key_string, key_type, comment, login)\n shell ... | [
"0.5680514",
"0.5626305",
"0.5513779",
"0.54446816",
"0.5316866",
"0.52087814",
"0.5186061",
"0.5161263",
"0.51453555",
"0.5144898",
"0.51384026",
"0.51329625",
"0.5083632",
"0.5065588",
"0.50591236",
"0.50512105",
"0.5031194",
"0.5021018",
"0.49646822",
"0.49618572",
"0.4961... | 0.4641483 | 63 |
shortcut for "%...input...!params", and user no need to write "%input" if user supply the command with NAME %input:wharsojo my key features same as: :wharsojo my key features | def get_input(regex)
get_shortcut(regex,'input')
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_key_input(name); end",
"def parse_input(input)\n match = input.match(/^(PLACE|MOVE|LEFT|RIGHT|REPORT|EXIT)(.*)/i)\n\n command, args = match.captures\n args.strip!\n\n [command.downcase.to_sym, args]\n end",
"def search_input(passthrough)\t\t\n\tcase passthrough\n\t\twhen \"mv\"\n\t\t\tputs... | [
"0.6348562",
"0.6104748",
"0.59635055",
"0.594672",
"0.5656056",
"0.559582",
"0.5557314",
"0.55255",
"0.54854",
"0.54854",
"0.54807734",
"0.547923",
"0.54736936",
"0.54634917",
"0.54604673",
"0.545422",
"0.5416974",
"0.54012585",
"0.5388686",
"0.53838646",
"0.53680724",
"0.... | 0.0 | -1 |
popup the closing tags when indentation are less than the previous. | def auto_close
if @tg_end.size>1
sz = @tg_end[-1][/^ +/].to_s.size
if @spc.size <= sz
ed = multi_end(nil).rstrip
p "AutE:#{ed}#{@row}" if @dbg[:parse]
@doc_out += [ed,(@doc_out[-1].to_s[-1,1]=="\n" ? '' : "\n"),@row]
@row = ''
true
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def close_lower_level_tags\n # If indentation level is less than or equal to previous level\n if @current_level <= @previous_level\n # Close all indentations greater than or equal to indentation level of this line\n while @open_tags.length > 0 and @open_tags[@open_tags.length - 1][0] >= @current_le... | [
"0.75991094",
"0.6898975",
"0.6898975",
"0.660579",
"0.64693487",
"0.644756",
"0.63913596",
"0.63913596",
"0.63913596",
"0.63913596",
"0.63913596",
"0.6355195",
"0.6258626",
"0.60979366",
"0.6093202",
"0.6073196",
"0.60115653",
"0.5996674",
"0.5985264",
"0.5981544",
"0.596409... | 0.5555886 | 52 |
all regex for line will be parse in this methods return value of not nill | def parse_all
#check for skipping the block using add on module...
parse_spc
if @skiper.select{|f|send(f)}.length>0
p "skip > #{@row}" if @dbg[:parse]
else
@plt_opt= ''
#rtn= true if @selector.select{|f|send(f)}.length>0
rtn = true if shortcut_exec( /(^[\t ]*)\-([\w\-&\/:#.%]*\{.*\}=*) *([^\n]*)\n/)
rtn = true if shortcut_exec( /(^[\t ]*)\-([\w\-&\/:#.%=]*) *([^\n]*)\n/)
rtn = true if shortcut_equal( /(^[\t ]*)=([\w\-&\/:#.%=]*) *([^\n]*)\n/)
rtn = true if get_hot_simple(/^[\t ]*(%)([\$\w\-&\/:#.\[\]]+\{.*?\}[= ]*)([^\n]*)\n/)
rtn = true if get_hot_simple(/^[\t ]*(%)([\$\w\-&\/:#.\[\]]+\{.*?\}[= ]*)()\n/)
rtn = true if get_hot_simple(/^[\t ]*(%)([\$\w\-&\/:#.\[\]%=]+ )([^\n]*)\n/)
rtn = true if get_hot_simple(/^[\t ]*(%)([\$\w\-&\/:#.\[\]%=]+)()\n/)
rtn = true if get_div(/^[\t ]*([#.])([\w\-&\/.]*\{.*\}[= ]*)([^\n]*)\n/)
rtn = true if get_div(/^[\t ]*([#.])([\w\-&\/.]*\{.*\}[= ]*)()\n/)
rtn = true if get_div(/^[\t ]*([#.])([\w\-&\/.=]* )([^\n]*)\n/)
rtn = true if get_div(/^[\t ]*([#.])([\w\-&\/.=]*)()\n/)
rtn = true if get_input( /^[\t ]*(:)([\w\-&\/#.]*\{.*\}[= ]*)([^\n]*)\n/)
rtn = true if get_input( /^[\t ]*(:)([\w\-&\/#.]*\{.*\}[= ]*)()\n/)
rtn = true if get_input( /^[\t ]*(:)([\w\-&\/#.=]* )([^\n]*)\n/)
rtn = true if get_input( /^[\t ]*(:)([\w\-&\/#.=]*)()\n/)
rtn = true if parse_hot
rtn = true if merge_hot
rtn = true if merge_w2x
rtn = true if parse_set_var
rtn = true if parse_set_mem
rtn = true if parse_get_mem
rtn = true if inline_tag
rtn = true if parse_end
if parse_tags
rtn = nil
elsif !rtn
auto_close
end
end
rtn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def matching_lines(regex); end",
"def parse_blank_line; end",
"def line_regex\n @line_regex ||= /\\<(\\d+)\\>(1) (\\d\\d\\d\\d-\\d\\d-\\d\\dT\\d\\d:\\d\\d:\\d\\d(?:\\.\\d+)?\\+00:00) ([a-z0-9\\-\\_\\.]+) ([a-z0-9\\.-]+) ([a-z0-9\\-\\_\\.]+) (\\-) (.*)$/\n end",
"def parse_line\n s0 = @scanner.... | [
"0.7183983",
"0.69000185",
"0.6796012",
"0.65230894",
"0.63872534",
"0.63473326",
"0.6276482",
"0.6276482",
"0.6200759",
"0.614293",
"0.612569",
"0.60627615",
"0.6041761",
"0.6038924",
"0.6019153",
"0.60028493",
"0.5991119",
"0.59794873",
"0.5947387",
"0.5938391",
"0.59174937... | 0.0 | -1 |
remember command "^", not really use but if you want less typing you can define this command inside HOT file for the next command to be execute like: HOT file: >>_tr ~^%td Source file: tr ^ inside td I think its Ok. | def parse_set_mem
if @row.gsub!(/([ \t]*~\^)([^\n]+\n)/,'')
set_mem = $2
if !global_set_mem(set_mem)
p "setMem ^ => #{set_mem}" if @dbg[:parse]
@mem_tag["^"]= set_mem
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precmd(line)\n line\n end",
"def shortcut_exec(regex)\n if(regex =~ @row;@rgx = $~)\n srcs = @rgx.to_s\n rplc = \"#{@rgx[1]}%!_#{@rgx[2]}~ #{@rgx[3]}\\n\"\n @row.gsub!(srcs,rplc)\n p \"reExe_ #{@row}\" if @dbg[:parse]\n end\n end",
"def regex_arrow_prefix\n ... | [
"0.5736035",
"0.5697506",
"0.5601157",
"0.55487645",
"0.5429064",
"0.54005283",
"0.53565264",
"0.53397393",
"0.5325439",
"0.5314944",
"0.53113556",
"0.5306893",
"0.5302454",
"0.53010285",
"0.5257826",
"0.5256096",
"0.52507424",
"0.5223563",
"0.5195954",
"0.51887304",
"0.51794... | 0.0 | -1 |
remember command "^", not really use but if you want less typing you can define this command inside HOT file for the next command to be execute like: HOT file: >>_tr ~^%td Source file: tr ^ inside td I think its Ok. | def parse_get_mem
if(/^ *([\^*])([^ ]*) *([^\n]*)(\n)/ =~ @row;@rgx = $~)
# BUG!!! %td{align="right"}= row[:price] * wowow => %td{align="right"}= row[:price] * wowow
# from /([\^*])([^ ]*) *([^\n]*)(\n)/
# to /^ *([\^*])([^ ]*) *([^\n]*)(\n)/
keys,tmp,prms,opt,ends= @rgx.captures
if opt=='!'
opt=''
@mem_hot=nil
end
keys.sub!('*','^')
params_inline prms #concenation line if params end with \
@new = @mem_tag[keys].split(' ')
@new[0] << tmp
@new = @new.join(" ") << "\n"
get_dollar(prms)
rpl = @new #+opt.to_s+ends.to_s
p "stMem> #{rpl}" if @dbg[:parse]
@row.gsub!(@rgx.to_s,rpl)
rows = @row.split("\n")
if rows.size>1
@doc_src = rows+@doc_src
@row = @doc_src.shift+"\n"
end
end
@rgx!=nil
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def precmd(line)\n line\n end",
"def shortcut_exec(regex)\n if(regex =~ @row;@rgx = $~)\n srcs = @rgx.to_s\n rplc = \"#{@rgx[1]}%!_#{@rgx[2]}~ #{@rgx[3]}\\n\"\n @row.gsub!(srcs,rplc)\n p \"reExe_ #{@row}\" if @dbg[:parse]\n end\n end",
"def regex_arrow_prefix\n ... | [
"0.57359",
"0.5697671",
"0.5600948",
"0.55477154",
"0.54278994",
"0.5400044",
"0.5355738",
"0.5339506",
"0.5323383",
"0.5314129",
"0.5309973",
"0.53068566",
"0.5302116",
"0.530123",
"0.5255439",
"0.525495",
"0.5250304",
"0.52224493",
"0.5195577",
"0.51883966",
"0.51783276",
... | 0.0 | -1 |
it call from parse_end | def get_end(regex)
if(regex =~ @row;@rgx = $~)
if @rgx[1]=='~'
@new = ''
@new = multi_end(1) if @tg_end.size>0
else
case @rgx[1]
when '!';@new = multi_end(nil)
when ',';@new = multi_end(@tg_end.size)
else ;@new = multi_end(@rgx[1].size)
end
end
@doc_src = @row.gsub(@rgx.to_s,@new).split("\n")+@doc_src
@row = ''
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def after_parse; end",
"def after_parse; end",
"def parse; end",
"def parse; end",
"def parse; end",
"def parsed; end",
"def parsed; end",
"def after_parse\n end",
"def parse\n end",
"def parse(data); end",
"def parse()\n #This is a stub, used for indexing\n end",
... | [
"0.8010497",
"0.8010497",
"0.7827609",
"0.7827609",
"0.7827609",
"0.77983373",
"0.77983373",
"0.77531725",
"0.74677455",
"0.71446455",
"0.7144347",
"0.68810946",
"0.6877751",
"0.6746343",
"0.6735254",
"0.66916907",
"0.66916907",
"0.66916907",
"0.66916907",
"0.6664221",
"0.664... | 0.0 | -1 |
user can popup the end tags using these folowing command: ,/ all end tags will be popup ~/ one or multi end tags will be popup (depend on how many ~ you write) !/ popup until the same indentation of "!/" | def parse_end
(get_end(/^(,)\/(\n)/) ? true : \
(get_end(/^[ \t]*(~+)\/(\n)/) ? true : \
get_end(/^[ \t]*(!)\/(\n)/)))
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auto_close\n if @tg_end.size>1\n sz = @tg_end[-1][/^ +/].to_s.size\n if @spc.size <= sz\n ed = multi_end(nil).rstrip\n p \"AutE:#{ed}#{@row}\" if @dbg[:parse]\n @doc_out += [ed,(@doc_out[-1].to_s[-1,1]==\"\\n\" ? '' : \"\\n\"),@row]\n @row = ''\n ... | [
"0.5464875",
"0.5362832",
"0.53290576",
"0.52938974",
"0.5283015",
"0.52198887",
"0.52170956",
"0.5143438",
"0.5130877",
"0.5130065",
"0.51091224",
"0.51082987",
"0.5097804",
"0.50756645",
"0.5060529",
"0.5050556",
"0.5018116",
"0.50171965",
"0.49522427",
"0.49403566",
"0.491... | 0.0 | -1 |
concenation line if params end with \ | def params_inline prms
while prms[-1,1]=='\\' do
prms.gsub!(/\\$/,'') << @doc_src.shift.strip
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def lex_en_plain_backslash_delimited=(_arg0); end",
"def lex_en_interp_backslash_delimited=(_arg0); end",
"def lex_en_interp_backslash_delimited=(_arg0); end",
"def lex_en_interp_backslash_delimited=... | [
"0.6020807",
"0.6020807",
"0.6020807",
"0.58925277",
"0.58925277",
"0.58925277",
"0.5837823",
"0.5807922",
"0.57906187",
"0.57906187",
"0.57906187",
"0.5722061",
"0.5691065",
"0.5691065",
"0.5691065",
"0.5672227",
"0.5669432",
"0.5635618",
"0.56177866",
"0.56162065",
"0.56019... | 0.5533836 | 22 |
Initializes The number of guesses (or tries) a player is allowed before the game ends. You should default number of guesses to 3 if the parameter is null. Sets a guess counter to zero. Creates a new instance of the Player class. Creates a new instance of the SecretNumber class and assigns it to the secret_number. Don't forget to pass along the necessary parameters. initializes the current guess to nil | def initialize(guesses_allowed = 3, set_of_numbers)
@guesses_allowed = guesses_allowed
@current_guess_count = 0
@current_guess = nil
@secret_numb = SecretNumber.new(set_of_numbers)
@player = Player.new()
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(guesses_allowed=3, set_of_numbers=10)\n @guesses_allowed = guesses_allowed #sets the number of guesses\n @current_guess_count = 0 #starts guess count at 0\n @player = Player.new #creates a new player\n @max_guess = set_of_numbers #i did this... | [
"0.7810365",
"0.7326715",
"0.670418",
"0.66642845",
"0.65044904",
"0.64234036",
"0.63069415",
"0.6227705",
"0.61629057",
"0.6152367",
"0.6083445",
"0.6082885",
"0.6049797",
"0.593813",
"0.5868858",
"0.5847587",
"0.5799266",
"0.57494795",
"0.57382447",
"0.57271576",
"0.5711211... | 0.7823153 | 0 |
Print who made this wonderful program :) | def print_created_by
return "This game was created by Kevin Tripp."
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def who\n puts \"I am #{@name} from #{@planet}\"\n end",
"def print_created_by\n puts 'Created by James (#1) Bronzan'\n end",
"def progname; \"Dis-organizer\"; end",
"def progname; \"Dis-organizer\"; end",
"def progname; \"Dis-organizer\"; end",
"def progname; \"Disorganizer\"; end",
"def a... | [
"0.6766457",
"0.6353424",
"0.6346323",
"0.6346323",
"0.6346323",
"0.630192",
"0.6238998",
"0.6188899",
"0.6180715",
"0.6096651",
"0.602987",
"0.60276663",
"0.6023193",
"0.5980736",
"0.5937484",
"0.592697",
"0.5923975",
"0.59005016",
"0.58906835",
"0.58815587",
"0.58640593",
... | 0.65179765 | 1 |
Calls `print_created_by` so that your players knows you created the game. | def start_game
puts print_created_by
puts "What is your name?"
@player.name = $stdin.gets.chomp
puts "secret_numb: #{@secret_numb.secret_number}"
puts "Welcome to my game, #{@player.name}."
puts "You have #{guesses_allowed} tries to guess a number between 1 and #{@secret_numb.set_of_numbers.length}."
puts "What is your #{current_guess_count + 1}st guess?"
@current_guess = $stdin.gets.strip.to_i
increment_guess_count
while @current_guess_count <= @guesses_allowed && guess_correct?(@current_guess) do
increment_guess_count
puts "What is your #{current_guess_count}#{get_num_suffex(@current_guess_count)} guess?"
@current_guess = $stdin.gets.strip.to_i
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_created_by\n return \"This game was created by Kevin Tripp.\"\n end",
"def print_created_by\n puts 'Created by James (#1) Bronzan'\n end",
"def displayPlayer()\n puts \"*** Player Info ***\"\n puts \"Name: #{@name}\"\n puts\n end",
"def title\n \"Game #{self.id}: ... | [
"0.8244638",
"0.7642423",
"0.6343901",
"0.63270134",
"0.62253886",
"0.61090106",
"0.6091958",
"0.6091251",
"0.6055",
"0.60084623",
"0.59779227",
"0.5955575",
"0.59553945",
"0.595268",
"0.5949572",
"0.5921355",
"0.5896758",
"0.5852211",
"0.584965",
"0.58110505",
"0.580398",
... | 0.0 | -1 |
This method checks if the player guessed the correct secret number. It should print out if they guessed correctly or guessed too high or too low. | def guess_correct?(guess)
if guesses_left <= 0 && !(guess == @secret_numb.secret_number)
messaging(:lose, @current_guess_count)
false
elsif guess == @secret_numb.secret_number
messaging(:win, @current_guess_count)
false
elsif guess > @secret_numb.secret_number
messaging(:too_high, @current_guess_count)
true
elsif guess < @secret_numb.secret_number
messaging(:too_low, @current_guess_count)
true
else
messaging(:error, @current_guess_count)
false
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def if_correct(ok_guess, number_guesses, secret_number) \n\tnumber_guesses = number_guesses - 1\t# STEP 6 - Subtracts one of the player's guesses\n\t\tif ok_guess == secret_number\n\t\t\tputs \"Congratulations! You got it right! You win!!!\"\n\t\telsif ok_guess < secret_number \n\t\t\tputs \"Good try, but guess a ... | [
"0.7791213",
"0.7556881",
"0.7500454",
"0.74572",
"0.74270254",
"0.7386249",
"0.7381",
"0.73637974",
"0.7359744",
"0.73413694",
"0.7331417",
"0.73291135",
"0.7320256",
"0.73090404",
"0.7265746",
"0.7252803",
"0.72362894",
"0.72258466",
"0.7198763",
"0.7192184",
"0.7148635",
... | 0.75332177 | 2 |
This method should increment every time the player guesses incorrectly. | def increment_guess_count
@current_guess_count += 1
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def use_guess\n @guesses -= 1\n end",
"def update_guess_count\n @guess_count > 0 ? @guess_count -= 1 : @guess_count\n end",
"def guess_count\n\t\t @number_of_guesses -= 1\n\tend",
"def increment_guess_count\n @current_guess_count += 1\n end",
"def check_if_lost\n\t\tif @guess_count == @number... | [
"0.7843759",
"0.7824999",
"0.76712334",
"0.7604054",
"0.7459229",
"0.7444053",
"0.7437983",
"0.7403498",
"0.7331801",
"0.7330157",
"0.7109123",
"0.70712507",
"0.7023707",
"0.6995806",
"0.69833535",
"0.6937983",
"0.69334453",
"0.6906039",
"0.6875565",
"0.68627596",
"0.6858359"... | 0.76288503 | 4 |
Calculates the guesses the player has left. | def guesses_left
@guesses_allowed - @current_guess_count
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def guesses_left\n\t\t@guesses -= 1\n\t\tguesses \n\tend",
"def guesses_left()\n \treturn ((@guesses_allowed - @current_guess_count)) \n end",
"def guesses_left\n @guesses_left = @guesses_allowed - @current_guess_count\n end",
"def guesses_left(current_guess_count)\n\t3 - current_guess_count\nend",
"... | [
"0.8351317",
"0.8327878",
"0.8281476",
"0.7815218",
"0.7609687",
"0.7301302",
"0.71884",
"0.71437603",
"0.71174955",
"0.70620245",
"0.68323994",
"0.67959815",
"0.6741824",
"0.6722987",
"0.66938",
"0.65269953",
"0.65137273",
"0.65112376",
"0.6464362",
"0.6462001",
"0.6451418",... | 0.848712 | 0 |
sidekiq_options retry: false TODO refactor to make this IO efficent. Bring in Threading | def perform(post_id, profile_id)
post = Post.find_by(id: post_id)
return if post.blank? || post.drafted?
begin
profile = Profile.find(profile_id)
client = Postman::TwitterDeck.new
serialized_content = PostSeralizer.new(post, 'twitter').serialized_content
if post.ready?
tweet_ids = []
options = {}
if post.media.exists?
media_ids = post.media.map do |media|
Thread.new do
client.upload(File.new(media.upload_doc.file.file), profile)
end
end.map(&:value)
options = { media_ids: media_ids.join(",")}
end
logger.info "Media ids - #{media_ids}"
post.update(media_ids: options[:media_ids])
serialized_content.each do |content|
time = Time.now
tweeted = client.post_tweet(content, profile, options)
status, sent_at = tweeted[:status] == false ? [tweeted[:error], nil]
: ["Tweeted", time]
state = tweeted[:status] == false ? post.state : "tweeted"
if profile.default_retweet_enable
state = "retweet_ready"
scheduled_at = profile.default_time_from_now
else
scheduled_at = post.scheduled_at
end
post.update(status: status, sent_at: sent_at, state: state, scheduled_at: scheduled_at)
tweet_ids << tweeted[:tweet_id]
#reset the media_ids
options = {}
end
# save the tweet ids to retweet it later
post.update(tweet_ids: tweet_ids.join(","))
elsif post.tweeted?
post.tweet_ids.split(",").each do |tweet_id|
client.retweet(tweet_id, profile)
end
post.update(status: "Retweeted", retweeted_at: Time.now, state: "retweeted")
end
rescue Exception => e
post.update(status: e.message)
logger.error "Error in processing post #{post.id} - #{e.message}\n#{e.backtrace}"
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def retry_options\n {tries: 15, sleep: 1}\n end",
"def read_with_one_retry(options = nil)\n yield\n rescue *retryable_exceptions, Error::PoolError => e\n raise e unless e.write_retryable?\n\n retry_message = options && options[:retry_message]\n log_retry(e, messag... | [
"0.62000006",
"0.59332424",
"0.58893424",
"0.5812825",
"0.5774281",
"0.5762834",
"0.57137793",
"0.5643478",
"0.5619021",
"0.5605701",
"0.5605701",
"0.5603572",
"0.5571494",
"0.5558859",
"0.55390817",
"0.5487994",
"0.54839975",
"0.5454873",
"0.5443303",
"0.542875",
"0.5422983"... | 0.0 | -1 |
Compile a complete class | def compileclass(output,classname)
#File.open(output, "a") { |f| f.write "<class>\n <" }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile\n end",
"def comp_class\n # set field count to zero\n @field_count = 0\n @i += 1\n # instantiate new Codewrite instance\n $cw = CodeWriter.new\n $st = ST.new\n # set cw.@class_name to class name\n $cw.set_class_name(@tokens[@i].val)\n @class = @tokens[@i].val\n @i += ... | [
"0.72428226",
"0.6971777",
"0.675228",
"0.6577193",
"0.6566162",
"0.65579426",
"0.6501133",
"0.6479787",
"0.6479482",
"0.64667743",
"0.6403323",
"0.6371314",
"0.63430464",
"0.63280034",
"0.631162",
"0.6279672",
"0.6273461",
"0.6210824",
"0.60312045",
"0.6019873",
"0.60138625"... | 0.72401536 | 1 |
Compile a static declaration or a field declaration | def compileclassvardec(token)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def process_declaration declaration\n tokens = declaration.split(' ')\n\n return nil if tokens.include?('static')\n declaration = tokens.delete_if { |t| t == 'inline'}.join(' ')\n\n tokens = declaration.split('(')\n arg_list = tokens.last.split(')').first\n\n # Remove variable names\n... | [
"0.6297934",
"0.62891537",
"0.585867",
"0.5854446",
"0.5786827",
"0.56592786",
"0.5646704",
"0.5575036",
"0.5504244",
"0.54735285",
"0.5450122",
"0.53573984",
"0.53425974",
"0.5318569",
"0.5318272",
"0.5317748",
"0.5279864",
"0.5279864",
"0.5271867",
"0.52633023",
"0.52333856... | 0.47592378 | 71 |
Compile a complete method, function, or constructor | def compilesubroutine
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile\n end",
"def compile\n raise NotImplementedError\n end",
"def compile!\n raise NotImplementedError\n end",
"def compile(*args)\n\t filtered_args, vm = prepare_call(args)\n\t CompiledCall.new(self, filtered_args, vm)\n\tend",
"def compile(mod); end",
"def compile_exec(... | [
"0.7672112",
"0.73463374",
"0.72945887",
"0.7074016",
"0.7025811",
"0.69555736",
"0.69549143",
"0.67511237",
"0.670062",
"0.66976887",
"0.66359174",
"0.6559602",
"0.6495265",
"0.64719546",
"0.6449004",
"0.64361644",
"0.64270616",
"0.6424721",
"0.6367914",
"0.63465047",
"0.631... | 0.7076988 | 3 |
Compile a possibly empty parameter list, not including the () | def compileparameterlist
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_parameterlist\n write_tag '<parameterList>'\n until check?(')')\n compile_type\n consume(TokenType::IDENTIFIER) # varName\n break unless check?(',')\n consume(',')\n end\n write_tag '</parameterList>'\n end",
"def params(*); {}; end",
"def param_li... | [
"0.7215876",
"0.6404536",
"0.63454723",
"0.61168844",
"0.6099847",
"0.59323215",
"0.59066844",
"0.59007233",
"0.5881544",
"0.5805141",
"0.57985085",
"0.57944834",
"0.57864994",
"0.5764907",
"0.5764907",
"0.5764023",
"0.5707104",
"0.5679517",
"0.5666972",
"0.56536573",
"0.5653... | 0.7429851 | 0 |
Compile a var declaration | def compilevardec
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_var_declaration\n write_tag '<varDec>'\n consume(TokenType::VAR)\n compile_type\n consume(TokenType::IDENTIFIER)\n while check?(',')\n consume(',')\n consume(TokenType::IDENTIFIER)\n break if check?(';')\n end\n consume(';')\n write_tag '</va... | [
"0.759935",
"0.70447546",
"0.66961133",
"0.64844257",
"0.6445993",
"0.6445993",
"0.6381995",
"0.6347653",
"0.63402414",
"0.63186926",
"0.6274749",
"0.6257731",
"0.62323236",
"0.622013",
"0.6187409",
"0.6187409",
"0.61668706",
"0.61604935",
"0.61521435",
"0.60755044",
"0.60735... | 0.73516583 | 1 |
Compile a do statement | def compiledo
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_do_statement\n write_tag '<doStatement>'\n consume(TokenType::DO)\n compile_subroutine_call\n consume(';')\n write_tag '</doStatement>'\n end",
"def compile_do\n create_statement\n @stack << top.add_element('doStatement')\n last_token = nil\n i = 0\n while(l... | [
"0.8196415",
"0.8070553",
"0.6504174",
"0.6504174",
"0.6286719",
"0.628658",
"0.628658",
"0.62378496",
"0.6227929",
"0.61859256",
"0.587416",
"0.581534",
"0.56697166",
"0.56477183",
"0.56076014",
"0.5591183",
"0.55281687",
"0.5450599",
"0.53958946",
"0.53958946",
"0.5366473",... | 0.66218746 | 2 |
Compile a let statement | def compilelet
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_let\n create_statement\n @stack << top.add_element('letStatement')\n last_token = nil\n i = 0\n while(last_token != ';')\n if(last_token == '=')\n i = compile_expression(i,';')\n end\n if(last_token == '[')\n i = compile_expression(i,']')\n end\n ty... | [
"0.78980786",
"0.762047",
"0.76076066",
"0.7243523",
"0.7083487",
"0.66396356",
"0.6573758",
"0.64724594",
"0.6333511",
"0.62523884",
"0.61510116",
"0.60345775",
"0.6021799",
"0.6021799",
"0.5968905",
"0.58149457",
"0.57081205",
"0.5660714",
"0.5660714",
"0.5623329",
"0.55864... | 0.6307722 | 9 |
Compile a while statement | def compilewhile
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def while_stmt \n\t\n\t$cst.add_branch(\"WhileStatement\")\n\t\n\tmatch_token(\"T_WHILE\", $tokens[$index])\n\tboolexpr\n\tblock\n\t\n\t$cst.ascend\n\t\nend",
"def while!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 80 )\n\n type = WHILE\n channel =... | [
"0.7972847",
"0.74024016",
"0.7380643",
"0.73601234",
"0.7351094",
"0.7351094",
"0.73455834",
"0.732595",
"0.7318799",
"0.72873276",
"0.72138935",
"0.7195432",
"0.70746386",
"0.70251065",
"0.7019906",
"0.6972073",
"0.6939769",
"0.68903637",
"0.6834035",
"0.66948795",
"0.66796... | 0.8360006 | 0 |
Compile a return statement | def compilereturn
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_return_statement\n write_tag '<returnStatement>'\n consume(TokenType::RETURN)\n compile_expression unless check?(';') # empty expression case\n consume(';')\n write_tag '</returnStatement>'\n end",
"def return_statement\n unless token_is? :return\n return nil\n... | [
"0.8263178",
"0.7317673",
"0.7237288",
"0.71184504",
"0.70908356",
"0.69796383",
"0.6972876",
"0.6836697",
"0.67932594",
"0.6733255",
"0.6725629",
"0.6688142",
"0.6665214",
"0.6646184",
"0.6612102",
"0.6607547",
"0.64397794",
"0.6393278",
"0.6387002",
"0.6369095",
"0.63025683... | 0.0 | -1 |
Compile an if statement, possibly with trailing else clause | def compileif
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_to_c\n \"if (\" + @condition.compile_to_c + \") {\\n\" +\n indent_c(@then_part.compile_to_c) +\n \"\\n} else {\\n\" +\n indent_c(@else_part.compile_to_c) +\n \"\\n}\"\n end",
"def compile_to_ruby\n \"if \" + indent_c(@condition.compile_to_ruby) + \"\\n\" +\n ... | [
"0.78035533",
"0.7474251",
"0.7287863",
"0.723189",
"0.6884074",
"0.67606187",
"0.67483866",
"0.6733429",
"0.6733071",
"0.67048764",
"0.67048764",
"0.66801554",
"0.66780025",
"0.6653033",
"0.66484386",
"0.66216755",
"0.6599771",
"0.65939456",
"0.6578004",
"0.6568843",
"0.6550... | 0.67930645 | 5 |
Compile a term. Must determine if current token is an idenifier. Must distinguish between a variable, an arrary, and subrouting call. A single lookahead token, which may be of [ ( or . suffices to distinguish between the three possibilities. Any other token is not part of this term and shouldn't be advanced over. | def compileterm
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_term\n write_tag '<term>'\n if match(TokenType::STING_CONST)\n write_tag '</term>'\n return\n end\n if match(TokenType::INT_CONST)\n write_tag '</term>'\n return\n end\n if check_any?('true', 'false', 'null', 'this')\n consume(TokenType::... | [
"0.65608495",
"0.647647",
"0.5996874",
"0.5829472",
"0.5779213",
"0.55558324",
"0.5535097",
"0.5510847",
"0.5495841",
"0.5484619",
"0.5403951",
"0.53758913",
"0.5340251",
"0.53329164",
"0.5327545",
"0.53253824",
"0.53201336",
"0.53004104",
"0.52982754",
"0.5268617",
"0.520502... | 0.59879696 | 3 |
Compile a possibly empty commaseparated list of expressions | def compileexpressionlist
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def compile_expression_list\n write_tag '<expressionList>'\n compile_expression unless check?(')') # Emptylist\n compile_expression while match(',')\n write_tag '</expressionList>'\n end",
"def compile_expression_list\n push_non_terminal(\"expressionList\")\n\n unless match?(JackLexe... | [
"0.77270347",
"0.75359005",
"0.69952923",
"0.6397383",
"0.617458",
"0.6108897",
"0.6045727",
"0.5803116",
"0.57643074",
"0.57364655",
"0.57320154",
"0.57310116",
"0.57310116",
"0.5723735",
"0.5715952",
"0.570516",
"0.5704227",
"0.5603803",
"0.5552841",
"0.55230284",
"0.549380... | 0.6882331 | 3 |
DEPRECATED: Please use source_files=, which now takes either an array of files or a glob pattern string. | def source_files_pattern=(pattern)
warn 'source_files_pattern= is deprecated in QUnited rake task config, use source_files= with a pattern'
@source_files = pattern
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def add_files(*files)\n @source_paths &= files\n end",
"def load_files(*sources); end",
"def add_source_files_references\n UI.message '- Adding source files' do\n add_file_accessors_paths_to_pods_group(:source_files, nil, true)\n end\n end",
"def source_fil... | [
"0.68712384",
"0.66870564",
"0.6534927",
"0.65318793",
"0.65259105",
"0.6485275",
"0.64828986",
"0.6433997",
"0.6289778",
"0.62145317",
"0.620381",
"0.6202257",
"0.60725653",
"0.6056632",
"0.6027547",
"0.6014331",
"0.6004998",
"0.5971506",
"0.59617543",
"0.5944963",
"0.592439... | 0.7974318 | 0 |
DEPRECATED: Please use test_files=, which now takes either an array of files or a glob pattern string. | def test_files_pattern=(pattern)
warn 'test_files_pattern= is deprecated in QUnited rake task config, use test_files= with a pattern'
@test_files = pattern
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def test_files=(files) # :nodoc:\n @test_files = Array files\n end",
"def test_files=(list)\n @test_files = list\n end",
"def test_files\n files = tests\n files = files.map{ |f| Dir[f] }.flatten\n files = files.map{ |f| File.directory?(f) ? Dir[File.join(f, '**/*.rb')] : f }\n ... | [
"0.7703941",
"0.7066874",
"0.6687349",
"0.6658255",
"0.66179",
"0.65755635",
"0.6526309",
"0.6278196",
"0.62563974",
"0.61875826",
"0.6184304",
"0.61507446",
"0.6148887",
"0.60762113",
"0.6066438",
"0.60202277",
"0.59947044",
"0.5986415",
"0.598558",
"0.5970321",
"0.5961494",... | 0.78929293 | 0 |
Force convert to array of files if glob pattern | def files_array(files)
return [] unless files
files.is_a?(Array) ? files : pattern_to_filelist(files.to_s)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def appendGlobs(arr, patterns); patterns.each { |p| arr << Dir.glob(p) }; arr.flatten end",
"def files() = files_path.glob('**/*')",
"def process_globs(globs); end",
"def process_globs globs\n result = globs.flat_map do |glob|\n Dir[File.join directory, glob]\n .map{ |f| f.gsub(/\\... | [
"0.69884145",
"0.6885692",
"0.6879581",
"0.68353146",
"0.6794981",
"0.67859834",
"0.6701638",
"0.6697332",
"0.6664398",
"0.660444",
"0.6598504",
"0.6547257",
"0.6446467",
"0.6389122",
"0.63276243",
"0.6324825",
"0.6248098",
"0.6236056",
"0.6235098",
"0.6230561",
"0.6212332",
... | 0.7265152 | 0 |
check if all the field is tied by either player1's symbol or player2's symbol Return false if not full, true if it is | def full?(player1, player2)
full = @field.all? {|f| f == player1.symbol || f == player2.symbol }
return full
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def full?\n for x in 0..2\n for y in 0..2\n return false if @field[x][y].player == 0\n end\n end\n return true\n end",
"def full?\n if match_type.include?(\"Doubles\") and players.length < 4\n return false\n elsif match_type.include?(\"Singles\") and players.length < 2\n ... | [
"0.79420894",
"0.72687197",
"0.6794969",
"0.67379785",
"0.67153716",
"0.66681063",
"0.660096",
"0.65438306",
"0.6535892",
"0.65195197",
"0.6496832",
"0.64817977",
"0.64751536",
"0.6448529",
"0.6439529",
"0.6433881",
"0.643339",
"0.64196754",
"0.63944376",
"0.639208",
"0.63892... | 0.88537776 | 0 |
Main method which goes through the Simulator strategy. | def check_for_tautology
counter = 0
random_decision = Decider.new(@propositional_statement, @random_truth_values).evaluate_expression
if random_decision == false
what_simulator_tells = "False"
elsif random_decision == true
@possible_truth_tables.each do |possible_truth_table|
counter += 1
decision = Decider.new(@propositional_statement, possible_truth_table).evaluate_expression
if decision == false
what_simulator_tells = "False"
break
elsif decision == true && counter == @max_truth_tables
what_simulator_tells = "True"
break
end
end
end
what_simulator_tells
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def run_main\n end",
"def main\n# puts \"#{name} called with #{args.size} arguments: #{args.inspect}\"\n# puts \"@dsl_file = #{@dsl_file}\"\n# puts \"in main\"\n\n# opts = parseOptions(args)\n if args.size > 0\n if !(simEngineHelper) then \n puts \"Error: simEngine did not run su... | [
"0.702037",
"0.69666255",
"0.6943787",
"0.6896795",
"0.6813818",
"0.66756517",
"0.66589934",
"0.6613685",
"0.65979266",
"0.65688366",
"0.6522081",
"0.65097874",
"0.6508768",
"0.6415878",
"0.639938",
"0.6395757",
"0.63823277",
"0.6368376",
"0.6368185",
"0.6366268",
"0.63569194... | 0.0 | -1 |
Adapted from User.to_hash ( | def user_to_hash(user)
{ "id" => user["_id"].to_s, "uid" => user["uid"], "name" => user["name"], "email" => user["email"] }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def to_hash() end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_hash; end",
"def to_h\n super.select {|k, v| k != 'hashed_password'}\n end",
"def to_h\n super.select {|k, v| k != 'hashed_password'}\n end",
"def to_hash\n ... | [
"0.7473705",
"0.7161478",
"0.7161478",
"0.7161478",
"0.7161478",
"0.7161478",
"0.7161478",
"0.697993",
"0.6952414",
"0.69417393",
"0.6817498",
"0.6790388",
"0.6738158",
"0.6738158",
"0.67227876",
"0.67189187",
"0.669066",
"0.6637802",
"0.6600023",
"0.65621716",
"0.65621036",
... | 0.79371 | 1 |
Make sure all actions are initialized before generating the routes | def touch_controller(klass)
klass.controller_class
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def _routes; end",
"def finalize_artifacts\n \n return if skip_method(__method__)\n \n puts \"finalize Rails routes in config/routes.rb\"\n \n add_routes(@@rails_routes)\n \n # create the navigation menu\n finalize_menu\n \n end",
"def routes; end",
"def routes; end",
"def ro... | [
"0.7032267",
"0.69338",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.6832654",
"0.67967045",
"0.67338276",
"0.6706111",
"0.6659544",
"0.66409206",
"0.6623799",
"0.6596858",
"0.6544351",
... | 0.0 | -1 |
DELETE /experiments/1 DELETE /experiments/1.xml | def destroy
@task = Task.find(params[:id])
@task.destroy
redirect_to admin_session_path
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n respond_to do |format|\n format.html { redirect_to(experiments_url) }\n format.xml { head :ok }\n end\n end",
"def destroy\n @experiment = Experiment.find(params[:id])\n @experiment.destroy\n\n res... | [
"0.722913",
"0.722913",
"0.6741451",
"0.665412",
"0.66419667",
"0.66419667",
"0.66419667",
"0.6602156",
"0.64780307",
"0.64103174",
"0.62858367",
"0.62838364",
"0.6283242",
"0.62736064",
"0.6268991",
"0.6262074",
"0.6262074",
"0.6256288",
"0.62561464",
"0.6250428",
"0.6247093... | 0.0 | -1 |
Eg: if n = 5, such numbers are 39518, 15951, etc. OMG the competition is so fucked. It's like the problem leaked recently from the Google interview and its all over the internets even i'm trying to solve it lol | def numbers(n)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def solution(n)\n x = (n**0.5).floor\n (1..x).reduce(0) { |s, i| n % i == 0 ? s += (i * i == n ? 1 : 2) : s }\nend",
"def solve( n = 1_000_000_000 )\n log10 = Math.log10( n )\n\n sum = (0...log10).map do |i|\n if 0 == (i % 4)\n 0\n elsif 0 != (i % 2)\n 20 * 30**((i - 1)/2)\n ... | [
"0.79180104",
"0.7588999",
"0.7570537",
"0.7468091",
"0.74654555",
"0.73845303",
"0.7374083",
"0.73090845",
"0.7304953",
"0.72842467",
"0.7276236",
"0.72549623",
"0.722373",
"0.71866226",
"0.7185332",
"0.71534616",
"0.7146233",
"0.7096326",
"0.709336",
"0.708886",
"0.7082412"... | 0.0 | -1 |
an algorithm for ensuring that the expected entries are listed in a declaration no more, and no less | def verify!(block)
self.instance_eval(&block)
expected = Set.new(expected_entries)
provided = Set.new(provided_entries)
missing_entries = expected - provided
extra_entries = provided - expected
missing_entries_found(missing_entries) if missing_entries.any?
extra_entries_found(extra_entries) if extra_entries.any?
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def completeness_check\n available = (@rules + @leaves).map(&:name).to_set\n sought = @rules.flat_map(&:seeking).uniq.to_set\n problems = sought.reject { |s| available.include? s }\n raise Error, \"the following rules or leaves remain undefined: #{problems.join(', ')}\" if problems.any?\n end",
"def... | [
"0.5925351",
"0.5693967",
"0.5523829",
"0.55043924",
"0.52919096",
"0.52840775",
"0.5271343",
"0.5265172",
"0.52492577",
"0.52139723",
"0.5195047",
"0.5189276",
"0.51721454",
"0.51653874",
"0.5160843",
"0.51550436",
"0.51532114",
"0.5152699",
"0.5116638",
"0.5108515",
"0.5077... | 0.57501346 | 1 |
// ! Key word arguements... ! Example.. There work like hashes, but in the below instance we gave them a default value, though not neccessary. | def happy_birthday(name: "Beyonce", current_age: 31)
puts "Happy Birthday, #{name}"
current_age += 1
puts "You are now #{current_age} years old"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def in_kwarg=(_arg0); end",
"def default _args\n \"default _args;\" \n end",
"def key=(_arg0); end",
"def key=(_arg0); end",
"def key=(_arg0); end",
"def arguments=(_arg0); end",
"def _key(*args); args.hash; end",
"def **(arg0)\n end",
"def **(arg0)\n end",
"def initialize hashed_args\n... | [
"0.69596666",
"0.6927971",
"0.68702865",
"0.68702865",
"0.68702865",
"0.68526584",
"0.68238354",
"0.6819989",
"0.6819989",
"0.66854596",
"0.6680542",
"0.6638825",
"0.6638825",
"0.6638825",
"0.6591617",
"0.6591405",
"0.64847547",
"0.6477337",
"0.6477337",
"0.6472375",
"0.64708... | 0.0 | -1 |
! Here it is without the default... | def happy_birthday(name:, current_age:)
puts "Happy Birthday, #{name}"
current_age += 1
puts "You are now #{current_age} years old"
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def default; end",
"def default; end",
"def custom; end",
"def custom; end",
"def private; end",
"def -@; end",
"def default_proc() end",
"def default=(_arg0); end",
"def default=(_); end",
"def safe_by_default; end",
"def defaults!; end",
"def defaults!; end",
"def specie; end",
"def spe... | [
"0.7329959",
"0.7329959",
"0.7029965",
"0.7029965",
"0.6971877",
"0.68719846",
"0.68690753",
"0.6843672",
"0.6814865",
"0.6760695",
"0.6752315",
"0.6752315",
"0.6737523",
"0.6737523",
"0.6737523",
"0.6737523",
"0.6722046",
"0.6717083",
"0.6689784",
"0.66883147",
"0.66515607",... | 0.0 | -1 |
Use callbacks to share common setup or constraints between actions. | def set_appointment_document(id)
@appointment_document = AppointmentDocument.find(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 |
Get Get data params: province_id() | def get_by_province
districts = District.where(province_id: params[:province_id])
return render json: { status: 1 } if districts.blank?
render json: {
status: 0,
result: districts.map{ |district| { id: district.id, name: district.name } }
}
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def get_province_by_id\n province = (!params['id'].nil?) ? Province.find_by(id: params['id']) : nil\n if (!province.nil?)\n render json: {status: 'SUCCESS', message:'Province found', data:province},status: :ok\n else\n render json: {status: 'ERROR', message:'Province not ... | [
"0.7263875",
"0.66578376",
"0.65120816",
"0.6447143",
"0.6307634",
"0.623688",
"0.6181576",
"0.6102252",
"0.60444546",
"0.6007795",
"0.59307176",
"0.5891754",
"0.58905977",
"0.57937384",
"0.5750616",
"0.5700025",
"0.56425655",
"0.56301504",
"0.56094223",
"0.55612344",
"0.5545... | 0.66584235 | 1 |
/ Get Manage View/Partial view params: search: province_id | def manage
# Author
authorize! :manage, District
# Get params
page = (params[:page] || 1).to_i
per = (params[:per] || 30).to_i
search_params = params[:search] || { province_id: 1 }
# Build conditions
conditions = {}
if search_params[:province_id].present?
conditions[:province_id] = search_params[:province_id]
end
# Get districts
districts = District.where(conditions)
# Render result
respond_to do |f|
f.html {
render 'manage',
locals: {
province_id: search_params[:province_id],
districts: districts
}
}
f.json {
render json: {
status: 0,
result: render_to_string(
partial: 'manage',
formats: :html,
locals: {
districts: districts
}
)
}
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @province = Province.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n end\n end",
"def update_provinces\n country_ids = params[:advanced][:countrie].split(\",\")\n @provinces = Province.find(:all, :conditions => [\"country_id IN (?)\", country_ids], :or... | [
"0.670562",
"0.6624525",
"0.646706",
"0.63192993",
"0.6274264",
"0.6125446",
"0.6102649",
"0.60798043",
"0.60505575",
"0.60257125",
"0.60031575",
"0.5979583",
"0.5900378",
"0.5884005",
"0.58831364",
"0.58646625",
"0.58548105",
"0.584603",
"0.58309793",
"0.58179396",
"0.577691... | 0.6285222 | 4 |
/ Manage Change order Handle params: id, order | def update_order
# Author
authorize! :manage, District
# Get district
district = District.find params[:id]
result = district.set_order params[:order]
render json: result
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_order\n @order = Order.friendly.find(params[:id])\n end",
"def set_order\n @order = Order.friendly.find(params[:id])\n end",
"def set_order\n @order = Order.find(params[:id])\n end",
"def set_order\n @my_order = Order.find(params[:id])\n end",
"def set_order\n # f... | [
"0.77435523",
"0.77435523",
"0.7631716",
"0.7626975",
"0.7616745",
"0.76151913",
"0.76151913",
"0.75749487",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063",
"0.7574063"... | 0.0 | -1 |
def working? true end | def broken?
@broken
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def working?\n true\n end",
"def working?\n true\n end",
"def working?\n false\n end",
"def working?\n \t@working\n end",
"def working?\n @working\n end",
"def stand\r\n return true\r\n end",
"def running? ; @running end",
"def usable?; end",
"d... | [
"0.9126052",
"0.9126052",
"0.88758427",
"0.8746525",
"0.84622115",
"0.77995265",
"0.774722",
"0.76887864",
"0.75787866",
"0.75544333",
"0.75118744",
"0.74271774",
"0.73157823",
"0.72882724",
"0.7276613",
"0.726403",
"0.7205383",
"0.71851766",
"0.71058404",
"0.71058404",
"0.70... | 0.0 | -1 |
Verifying method of calculation (sqrt) requries visibility into SUT implementation details | def test_likelihood_of_catch_calculated_with_sqrt_rain
rain = 0.5
sqrt_rain = 0.707106781186548
# setup Test Double: Test Stub via direct injection
FishingForecaster.weather_forecaster = stub(:likelihood_of_rain => rain)
# setup Test Double: Mock Object, set expectation with specific arguements and return value
Math.expects(:sqrt).with(rain).returns(sqrt_rain)
likelihood_of_catch = FishingForecaster.likelihood_of_catch
# Notice that verification (assertions) are not necessary.
# If the mock object's expectations are not met, it will cause the test to fail.
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def square_root_of(number)\n Math.sqrt number\nend",
"def square_root_of(number)\n Math.sqrt(number)\nend",
"def perfect_square?\n self == Math.sqrt(self).to_i ** 2\n end",
"def square_root_of(number)\n Math.sqrt(number)\nend",
"def square_root_of(number)\n Math.sqrt(number)\nend",
"def square?... | [
"0.67342687",
"0.66206926",
"0.66058624",
"0.6589978",
"0.6589978",
"0.6560766",
"0.650576",
"0.646991",
"0.6436531",
"0.64319605",
"0.6418422",
"0.63786674",
"0.6351001",
"0.6335827",
"0.6299498",
"0.6284397",
"0.6257855",
"0.6225213",
"0.6222475",
"0.62154746",
"0.6211028",... | 0.0 | -1 |
Sets led to level HIGH | def on
change_state(pin, :high)
@is_on = true
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def led(on_off, duration_s=0)\n set_state(on_off, duration_s, {on: {on: 0}, off: {off: 0}})\n end",
"def turn_on_leds\n @entry_led.on\n @exit_led.on \n end",
"def off\n GP... | [
"0.6948059",
"0.6948059",
"0.6758728",
"0.64543766",
"0.64232576",
"0.6336993",
"0.62592965",
"0.6119359",
"0.6104251",
"0.6069359",
"0.605993",
"0.59976894",
"0.5990808",
"0.5952242",
"0.5952242",
"0.5939744",
"0.5934653",
"0.59181845",
"0.59065336",
"0.583176",
"0.5801749",... | 0.5102547 | 67 |
Sets led to level LOW | def off
change_state(pin, :low)
@is_on = false
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def off\n @level = 0\n puts \"Light is off\"\n end",
"def status_light_enabled=(enabled)\n send_device_message('SetLEDState', enabled ? 'On' : 'Off')\n end",
"def on\n @level = 100\n puts \"Light is on\"\n end",
"def on\n @le... | [
"0.6820719",
"0.6820719",
"0.66877156",
"0.6637196",
"0.6637196",
"0.6634482",
"0.651009",
"0.648953",
"0.6342376",
"0.62037396",
"0.61664784",
"0.61092573",
"0.60719305",
"0.6030394",
"0.5984708",
"0.59812856",
"0.5945816",
"0.592123",
"0.5847739",
"0.5836235",
"0.58147025",... | 0.4982462 | 89 |
GET /games GET /games.json | def index
@games = Game.all
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n render json: @games\n end",
"def index\n @games = current_user.games\n \n respond_to do |format|... | [
"0.801388",
"0.7969819",
"0.7854131",
"0.7795904",
"0.77952725",
"0.77952725",
"0.77952725",
"0.7618289",
"0.75276613",
"0.74230546",
"0.74158394",
"0.7390365",
"0.73540944",
"0.7318076",
"0.72921306",
"0.7247407",
"0.7209582",
"0.7190768",
"0.7177297",
"0.7177297",
"0.717729... | 0.69501257 | 64 |
GET /games/1 GET /games/1.json | def show
unless @game.dual_id.nil?
@game2 = Game.find(@game.dual_id)
#want the lower number first so that it's consistant as we are basing the websocket chat off of the url
redirect_to @game.id > @game2.id ? game_dual_path(@game2,@game) : game_dual_path(@game,@game2)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show\n @game = Game.find(params[:id])\n render json: @game, status: 200\n end",
"def index\n @games = Game.available\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @games }\n end\n end",
"def index\n @games = Game.all\n render json: @... | [
"0.7778205",
"0.7749684",
"0.773515",
"0.75975066",
"0.7597277",
"0.7597277",
"0.7597277",
"0.75432575",
"0.74726534",
"0.74726534",
"0.74726534",
"0.74726534",
"0.74726534",
"0.74726534",
"0.74726534",
"0.7428973",
"0.74050504",
"0.7396191",
"0.7338032",
"0.7334514",
"0.7298... | 0.0 | -1 |
POST /games POST /games.json | def create
@game = Game.new(game_params)
respond_to do |format|
if @game.save
format.html { redirect_to @game, notice: 'Game was successfully created.' }
format.json { render action: 'show', status: :created, location: @game }
else
format.html { render action: 'new' }
format.json { render json: @game.errors, status: :unprocessable_entity }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create\n @game = current_or_guest_user.games.create\n render json: @game, status: 201\n end",
"def create\n game = @current_user.games.create!(game_params)\n render json: { game: game }\n end",
"def create\n @new_game = Game.create(game_params)\n render json: @new_game\n\n end",
"def... | [
"0.7666801",
"0.75520563",
"0.7413892",
"0.70869124",
"0.7075019",
"0.70485115",
"0.70426613",
"0.7039214",
"0.702803",
"0.702508",
"0.702508",
"0.702508",
"0.702508",
"0.702508",
"0.6992957",
"0.69471335",
"0.6937076",
"0.69172454",
"0.6903971",
"0.6903971",
"0.6903971",
"... | 0.68417835 | 30 |
PATCH/PUT /games/1 PATCH/PUT /games/1.json | def update
if params[:commit] == 'End Game'
@game.ended_at = Time.current()
end
respond_to do |format|
if @game.update(game_params)
format.js
format.html { redirect_to user_path }
else
format.json { render json: @game.errors, status: :unprocessable_entity }
format.html { render action: 'edit' }
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update\n #if game exists, pass here to update state\n @game = Game.find_by(id: params[:id])\n @game.update(game_params)\n render json: @game, status: 201\n end",
"def update\n @game = Game.find(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n ... | [
"0.7157309",
"0.7029037",
"0.70235133",
"0.7022238",
"0.70219064",
"0.70219064",
"0.70219064",
"0.70219064",
"0.70219064",
"0.70219064",
"0.70219064",
"0.699033",
"0.6979274",
"0.69443756",
"0.6894251",
"0.68479854",
"0.68479854",
"0.68479854",
"0.6822679",
"0.6814825",
"0.68... | 0.0 | -1 |
DELETE /games/1 DELETE /games/1.json | def destroy
@game.destroy
respond_to do |format|
format.html { redirect_to user_path }
format.json { head :no_content }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def destroy\n @game.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end",
"def destroy\n @game = Game.get(params[:id])\n @game.destroy\n\n respond_to do |format|\n format.html { redirect_to games_url }\n format.json { head :ok }\n end\n end",
"d... | [
"0.7732339",
"0.7712217",
"0.7657307",
"0.76516914",
"0.76516914",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.76474565",
"0.75758624",
"0.75758624",
"0.75758624",
... | 0.7297653 | 38 |
Use callbacks to share common setup or constraints between actions. | def set_game
@game = Game.find(params[:game_id] ||= 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.61637366",
"0.60446453",
"0.59452957",
"0.591511",
"0.58885515",
"0.5834122",
"0.57761765",
"0.5702554",
"0.5702554",
"0.5652102",
"0.5619581",
"0.5423898",
"0.5409782",
"0.5409782",
"0.5409782",
"0.5394745",
"0.53780794",
"0.5356209",
"0.5338898",
"0.53381324",
"0.5328622... | 0.0 | -1 |
Never trust parameters from the scary internet, only allow the white list through. | def game_params
params.require(:game).permit(:user_id, :score, :length, :cells)
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 |
Returns a unique, deterministically reproducible index into an array We are hashing based on strings, let's use the ascii value of each string as a starting point. | def index(key, size)
asc = 0
key.each_byte do |c|
asc += c
end
return asc % size
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def find_unique(array)\n unique_id = 0\n\n array.each do |num|\n unique_id ^= num\n end\n\n unique_id\nend",
"def generateKey(string)\r\n key = {}\r\n stringIterator = 0\r\n\r\n (string.length).times do\r\n charactersIterator = string[stringIterator] - 1\r\n divisorsIterator = 0\r\n divisors =... | [
"0.6383203",
"0.62403595",
"0.6144129",
"0.60989696",
"0.6059703",
"0.6045736",
"0.6044741",
"0.602797",
"0.59923834",
"0.59066594",
"0.5871428",
"0.58396715",
"0.58258843",
"0.5814923",
"0.5766527",
"0.57525396",
"0.57516277",
"0.5742264",
"0.5731274",
"0.5711685",
"0.570730... | 0.0 | -1 |
Simple method to return the number of items in the hash | def size
@items.length
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def size\n return @hash.length\n end",
"def length\n hash.keys.length\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def size\n @hash.size\n end",
"def size\n @hash_array.length\n end",
"def size\n @hash_array.length\n end",
"def size\n ... | [
"0.82830465",
"0.82106954",
"0.8109915",
"0.8109915",
"0.8109915",
"0.79695594",
"0.79695594",
"0.78124315",
"0.77486163",
"0.76849425",
"0.7678069",
"0.7656559",
"0.7636084",
"0.76298493",
"0.761464",
"0.761464",
"0.7574793",
"0.7569945",
"0.7478816",
"0.7444118",
"0.7398974... | 0.0 | -1 |
code req __ pub ok A_ A_ ok __ A_ ERROR __ AA ERROR << AA AA ok A_ AA ERROR _A AA ERROR _A pub OK routed nil no C and V false not PEP true <= check | def check_missing_authentication
$abst_states.each do |n, s|
if s.type == 'controller' && !s.req_policies[0].nil? && s.routed
if s.req_policies[0].is_authenticated # A_
if s.code_policy.is_authenticated
# Good
else
# No PEP
s.req_error = true
type = 'Missing authentication'
msg = "[Req:O, Code:X] No authentication for #{s.domain}" # TODO: get URL also
end
else # pub, __
if s.code_policy.is_authenticated
# No Req
s.req_error = true
type = 'Missing authentication'
msg = "[Req:X, Code:O] No authentication for #{s.domain}" # TODO: get URL also
else
# Good, both req and code are public
end
end
end
if s.req_error
w = Hash.new
w['warning_type'] = type
w['message'] = msg
w['file'] = s.filename
w['line'] = nil
w['code'] = nil
w['location'] = nil
w['user_input'] = nil
w['confidence'] = 'High' # Weak Medium High
$warning.add(w)
print_pep_error(s, 'authentication') if $enable_stdout
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check ; true ; end",
"def checks; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid?; end",
"def valid; end",
"def issn; end",
"def verify_iss=(_arg0); end",
"def verify_iss=(_arg0); end",
"def error?; end",
"def error?; end",
"def error?; en... | [
"0.66207445",
"0.65339905",
"0.65050733",
"0.65050733",
"0.65050733",
"0.65050733",
"0.65050733",
"0.649999",
"0.644845",
"0.6361654",
"0.6361654",
"0.6339945",
"0.6339945",
"0.6339945",
"0.63385457",
"0.63385457",
"0.6329336",
"0.6329336",
"0.6314272",
"0.63095397",
"0.62972... | 0.0 | -1 |
Check authorization at controller | def check_missing_authorization
$abst_states.each do |n, s|
if s.type == 'controller' && !s.req_policies[0].nil? && s.routed
if s.req_policies[0].is_authorized
if s.code_policy.is_authorized
# Good
else
# No PEP code
s.req_error = true
type = 'Missing authorization'
msg = "[Req:O, Code:X] No authorization for #{s.domain}" # TODO: get URL also
end
else
if s.code_policy.is_authorized
# No Req
if s.code_policy.is_authenticated
s.req_error = true
type = 'Missing authorization'
msg = "[Req:X, Code:O] No authorization for #{s.domain}" # TODO: get URL also
else
# _A
end
else
# God public
end
end
end
if s.req_error
w = Hash.new
w['warning_type'] = type
w['message'] = msg
w['file'] = s.filename
w['line'] = nil
w['code'] = nil
w['location'] = nil
w['user_input'] = nil
w['confidence'] = 'High' # Weak Medium High
$warning.add(w)
print_pep_error(s, 'authorization') if $enable_stdout
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def authorization_checking\n authorize!(:authorization_checking,current_user) unless current_user.role?(:livia_admin) || current_user.role?(:lawfirm_admin)\n end",
"def check_authorization \n user = current_user\n unless session[\"permission_\" + action_name + \"_\" + controller_name] && u... | [
"0.79519355",
"0.7837663",
"0.7815695",
"0.7765679",
"0.77583826",
"0.77151835",
"0.7685024",
"0.76841545",
"0.7676643",
"0.7676643",
"0.7663199",
"0.76594776",
"0.764292",
"0.7607233",
"0.7568085",
"0.75636196",
"0.75636196",
"0.75601363",
"0.75548124",
"0.75434226",
"0.7543... | 0.0 | -1 |
Check authentication authorization at view | def print_nav_error(trans, ssl, dsl, type)
print "\e[36m" # Cyan
puts " Navigation error? #{trans.src_id}[lv:#{ssl}] => #{trans.dst_id}[lv:#{dsl}], #{type}"
print "\e[0m" # reset
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def auth\n if request.get?\n show_auth\n elsif request.post?\n check_auth\n end\n end",
"def authenticate\n \t\tlogged_in? || access_denied\n \tend",
"def authenticate\n logged_in? || access_denied\n end",
"def authenticate\n\t\t\tlogged_in? ? true : access_denied\n\t\tend",
"def ... | [
"0.7680953",
"0.75567",
"0.7540352",
"0.7483452",
"0.73984265",
"0.7387263",
"0.735058",
"0.73218274",
"0.7318897",
"0.7313711",
"0.7295621",
"0.7293747",
"0.7293747",
"0.7290657",
"0.72877234",
"0.7287344",
"0.7285364",
"0.7269698",
"0.7267779",
"0.7267779",
"0.7261048",
"... | 0.0 | -1 |
Change artwork status according to admins choice on show view | def update
@rent = Rent.find(params[:id])
if params[:rent][:delete]
@rent.kunstvoorwerp.update_attribute('status', 0)
@rent.delete
redirect_to :action => 'index'
else
if params[:rent][:done]
@rent.kunstvoorwerp.update_attribute('status', 2)
end
if params[:rent][:revert]
@rent.kunstvoorwerp.update_attribute('status', 0)
end
@rent.status = params[:rent][:status]
@rent.save
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def admin_edit_prep\n\n @artist = Artist.find_by_url_slug(params[:url_slug])\n authorize! :admin, @artist\n\n @artist_test=\"blah\"\n\n image_upload_prep(@artist)\n\n @form = render_to_string('artists/_form',:layout => false)\n\n #varable to remove defualt artist loading. Loads the edit layout i... | [
"0.6287903",
"0.6212096",
"0.6089958",
"0.60054344",
"0.60045135",
"0.59965646",
"0.59965646",
"0.5948968",
"0.5948968",
"0.59405255",
"0.59211963",
"0.59211963",
"0.5918077",
"0.5870062",
"0.57951",
"0.57951",
"0.57951",
"0.57951",
"0.57649285",
"0.57291967",
"0.5724381",
... | 0.0 | -1 |
Render form with email content replaced by actual values from users and artworks | def mailing
@mail = Prefabmail.find(params[:mail][:message])
@rent = Rent.find_by_id(params[:id])
if params[:mail][:to] == "v"
@email = @rent.kunstvoorwerp.user.email
else
@email = @rent.user.email
end
@mail.content = replace_prefab_mail_vars(@mail, @rent)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def input_email(f)\n\t\trender :partial => \"shared/forms/panel/email\", :locals => { :f => f }\n\tend",
"def emailform\n end",
"def emailform\n end",
"def emit_form(formdata: {})\n if formdata[JIRA] || formdata[CONFLUENCE]\n title = 'Update your JIRA and Confluence IDs (previously submitted)'\n sub... | [
"0.6521241",
"0.6519643",
"0.6519643",
"0.6260191",
"0.60812616",
"0.6021175",
"0.5761389",
"0.57184774",
"0.57112813",
"0.56852",
"0.5639942",
"0.56148994",
"0.56127495",
"0.5600421",
"0.5594155",
"0.55891067",
"0.5587404",
"0.5580118",
"0.55589527",
"0.5549099",
"0.55196524... | 0.0 | -1 |
dump all matching notes to stdout | def cat
unless encrypted_notes.empty?
print_notes(:encrypted => true)
decrypted_notes = @cipher.decrypt_files(encrypted_notes)
end
matching_notes.each do |note_path|
contents = \
if FuzzyNotes::Cipher.encrypted?(note_path)
decrypted_notes.shift
elsif FuzzyNotes::EvernoteSync.evernote?(note_path)
FuzzyNotes::EvernoteSync.sanitize_evernote(note_path)
elsif FuzzyNotes::ImageViewer.image?(note_path)
FuzzyNotes::ImageViewer.display(@viewer, note_path)
else
FuzzyNotes::TextViewer.read(note_path)
end
if contents
log.info "=== #{note_path} ===\n\n"
puts "#{contents}\n"
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def print_all_notes(archive=nil)\n\t\tarchive = name_to_archive(archive)\n\t\tarchive.get_all_notes.each(&:print)\n\t\ttrue\n\tend",
"def all_notes\n self.has_notes? ? self.annotations.map {|n| n.body }.join(' ') : '' \n end",
"def show_notes\n info \"showing notes\"\n res = run(\"git not... | [
"0.6697545",
"0.6262526",
"0.6241473",
"0.6081765",
"0.59887415",
"0.5959257",
"0.5898653",
"0.5847072",
"0.58305657",
"0.5809998",
"0.5775857",
"0.5737395",
"0.57373744",
"0.5703484",
"0.56454",
"0.5627561",
"0.56022894",
"0.55964905",
"0.55784047",
"0.5568689",
"0.5568689",... | 0.67098075 | 0 |
edit all matching notes in EDITOR | def edit
notes_to_edit = \
unless encrypted_notes.empty?
print_notes(:encrypted => true)
decrypted_tempfiles = @cipher.decrypt_to_tempfiles(encrypted_notes)
successfully_decrypted_files = decrypted_tempfiles.compact
plaintext_notes + successfully_decrypted_files
else plaintext_notes
end
# edit decrypted files
unless notes_to_edit.empty?
system("#{@editor} #{bashify_note_paths(notes_to_edit)}")
end
# reencrypt decrypted notes
unless encrypted_notes.empty? || successfully_decrypted_files.empty?
log.info "#{CREATE_COLOR} re-encrypting edited notes:"
tempfiles_notes = decrypted_tempfiles.zip(encrypted_notes)
log.indent do
tempfiles_notes.each do |(tmpfile, note_path)|
log.info "#{PATH_COLOR} #{note_path}" if note_path
end
end
log.indent { @cipher.encrypt_from_tempfiles(tempfiles_notes) }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def update!(notes)\n fetch_notes\n show_notes\n push_notes(notes)\n end",
"def notes=(notes)\n self.service.editObject({ \"notes\" => notes.to_s })\n self.refresh_details()\n end",
"def edit\n @time_zone = @note.receiver.time_zone\n note_receiver = @note.receiver\n @time_zone = ... | [
"0.62134147",
"0.6155888",
"0.6089196",
"0.6048241",
"0.60363775",
"0.6012389",
"0.60067296",
"0.5998196",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
"0.5991484",
... | 0.68778074 | 0 |
view WC info for all/matching notes | def info
paths = bashify_note_paths(matching_notes(:all_if_empty => true))
puts `wc $(find #{paths} -type f)`
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def show_all_notes(db)\n notes = server.get_index\n notes.each do |note|\n note = server.get_note(note[\"key\"])\n show_note(note)\n end\nend",
"def show\n horse = set_horse\n @notes = horse.notes.paginate(:page => params[:page], :per_page => 20).order('created_at DESC')\n end",
"def list\n\t\t... | [
"0.65620136",
"0.6416957",
"0.6273608",
"0.627183",
"0.6256496",
"0.6256496",
"0.6256496",
"0.6256496",
"0.6256496",
"0.62427807",
"0.62262636",
"0.62248224",
"0.6222515",
"0.6221666",
"0.6217293",
"0.6193548",
"0.6183801",
"0.6157212",
"0.6145156",
"0.61356145",
"0.61318976"... | 0.6032611 | 27 |
initialize to params or use defaults | def parse_init_params
VALID_PARAMS.each do |param|
default_const = param.to_s.upcase
val = @params[param] || FuzzyNotes::Defaults.const_get(default_const)
instance_variable_set("@#{param}", val)
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def initialize(params = {})\n super(DEFAULTS.merge(params))\n end",
"def set_default_params params\n set_default_params_status(params)\n set_default_params_type(params)\n set_default_params_content(params)\n return params\n end",
"def initialize(params = {})\n parameters(par... | [
"0.78314996",
"0.7733972",
"0.7443345",
"0.74147046",
"0.73937124",
"0.7315772",
"0.72881925",
"0.7280353",
"0.7255651",
"0.7194249",
"0.7194249",
"0.71941775",
"0.718973",
"0.71892405",
"0.716295",
"0.713107",
"0.71162194",
"0.7111503",
"0.70720977",
"0.7049656",
"0.7032333"... | 0.7551284 | 2 |
TODO: grab creds from user | def evernote_params_found?
unless @evernote_params
log.error("required evernote configuration not found!")
false
else true
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credentials; end",
"def credential; end",
"def credential; end",
"def credentials=(_arg0); end",
"def credentials=(_arg0); end",
"def credentials=(_arg0); end",
"def credentials=(_arg0); end",
... | [
"0.7475617",
"0.7475617",
"0.7475617",
"0.7475617",
"0.7475617",
"0.7043391",
"0.7043391",
"0.6767096",
"0.6767096",
"0.6767096",
"0.6767096",
"0.6767096",
"0.66884625",
"0.6644935",
"0.65531725",
"0.6519636",
"0.6512233",
"0.64609605",
"0.64609605",
"0.6431769",
"0.6431769",... | 0.0 | -1 |
Creates a flair template in a subreddit. | def create_flair_template(subreddit, type, options = {})
subreddit_name = extract_string(subreddit, :display_name)
flair_type = (type.to_s == 'link') ? 'LINK_FLAIR' : 'USER_FLAIR'
parameters = { :r => subreddit_name, :flair_type => flair_type, :text => options[:text], :css_class => options[:css_class], :api_type => :json }
parameters[:text_editable] = 'on' if options[:user_editable]
post('api/flairtemplate', parameters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def apply_flair_template(options)\n subreddit_name = extract_string(options[:subreddit], :display_name)\n link_full_name = extract_full_name options[:link]\n username = extract_string options[:user], :username\n\n parameters = { :flair_template_id => options[:template_id], :r => subredd... | [
"0.6816444",
"0.59390205",
"0.58209133",
"0.58114433",
"0.58095676",
"0.5755416",
"0.56863254",
"0.56861407",
"0.5672713",
"0.56678635",
"0.56597555",
"0.5633296",
"0.5611466",
"0.5602601",
"0.56024164",
"0.56024164",
"0.56024164",
"0.56024164",
"0.56024164",
"0.56024164",
"0... | 0.78434134 | 0 |
Deletes a flair template. | def delete_flair_template(subreddit, template_identifier)
subreddit_name = extract_string(subreddit, :display_name)
parameters = { :flair_template_id => template_identifier, :r => subreddit_name }
post('api/deleteflairtemplate', parameters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def delete_template(opts)\n post(\"/template/delete/#{opts[:template_id]}\")\n end",
"def destroy\n mytemplate = Mytemplate.get(params[:id])\n close_document(mytemplate)\n \n begin\n if mytemplate != nil\n if File.exist?(mytemplate.path) \n FileUtils.rm_rf mytemplate.... | [
"0.76568514",
"0.75534385",
"0.7532757",
"0.73931986",
"0.73627925",
"0.7347544",
"0.73255646",
"0.7309789",
"0.73005044",
"0.72306585",
"0.7217071",
"0.7200788",
"0.7147052",
"0.71444124",
"0.71424943",
"0.7120022",
"0.7110576",
"0.70936793",
"0.70901394",
"0.7082465",
"0.70... | 0.7451892 | 3 |
Toggles flair for a subreddit. | def toggle_flair(subreddit, flair_enabled)
post('api/setflairenabled', { :r => subreddit, :flair_enabled => flair_enabled })
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_flair(options)\n subreddit_name = extract_string(options[:subreddit], :display_name)\n link_full_name = extract_full_name options[:link]\n username = extract_string options[:user], :username\n\n parameters = { :r => subreddit_name, :text => options[:text], :css_class => options[... | [
"0.5714251",
"0.55454594",
"0.5511596",
"0.5427171",
"0.53988385",
"0.5385824",
"0.5292395",
"0.5234163",
"0.5234163",
"0.5177913",
"0.5006644",
"0.4998033",
"0.49875367",
"0.49653372",
"0.49580252",
"0.49484795",
"0.4945879",
"0.49364883",
"0.49061143",
"0.4872201",
"0.48233... | 0.8241441 | 0 |
Sets flair on a link or user. | def set_flair(options)
subreddit_name = extract_string(options[:subreddit], :display_name)
link_full_name = extract_full_name options[:link]
username = extract_string options[:user], :username
parameters = { :r => subreddit_name, :text => options[:text], :css_class => options[:css_class], :name => username, :link => link_full_name }
post('api/flair', parameters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_flair(thing, type = nil, text = nil, css_class = nil)\n params = {text: text, css_class: css_class}\n if thing.is_a?(Objects::User) || type == :user\n params[:name] = client.property(thing, :name)\n elsif thing.is_a?(Objects::Submission) || type == :link\n params[:lin... | [
"0.59242696",
"0.58865786",
"0.577611",
"0.55950415",
"0.5412381",
"0.5345181",
"0.534509",
"0.53132385",
"0.52696925",
"0.511402",
"0.50983924",
"0.5084892",
"0.503706",
"0.50355476",
"0.50348324",
"0.50154674",
"0.5009498",
"0.50080645",
"0.50073856",
"0.5003218",
"0.499333... | 0.6478214 | 0 |
Sets a subreddit's flair using a string formatted as CSV. | def set_flair_with_csv(subreddit, csv_string)
subreddit_name = extract_string(subreddit, :display_name)
parameters = { :r => subreddit_name, :flair_csv => csv_string }
post('api/flaircsv', parameters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_flair(options)\n subreddit_name = extract_string(options[:subreddit], :display_name)\n link_full_name = extract_full_name options[:link]\n username = extract_string options[:user], :username\n\n parameters = { :r => subreddit_name, :text => options[:text], :css_class => options[... | [
"0.5870527",
"0.52636456",
"0.5148826",
"0.48246872",
"0.47675493",
"0.4749555",
"0.4677668",
"0.46761853",
"0.4669588",
"0.46532598",
"0.46387324",
"0.46064284",
"0.45988673",
"0.45987067",
"0.45962578",
"0.45873463",
"0.45843655",
"0.4523182",
"0.4523182",
"0.45083672",
"0.... | 0.8186247 | 0 |
Clears a user's flair. | def delete_user_flair(subreddit, user)
subreddit_name = extract_string(subreddit, :display_name)
username = extract_string(user, :username)
parameters = { :name => username, :r => subreddit_name }
post('api/deleteflair', parameters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear_current_user; end",
"def clear_current_user\n User.current_user = nil\n end",
"def clear_user\n warden.set_user(nil) if warden.user.present?\n end",
"def delete_profile\n system 'clear'\n CoffeeMan.stay_logo\n @userid.delete\n puts \"Your account has been termina... | [
"0.70233166",
"0.6596516",
"0.6367742",
"0.62103885",
"0.61742765",
"0.61727786",
"0.614795",
"0.6095274",
"0.6082274",
"0.60713935",
"0.6068341",
"0.60677904",
"0.60533583",
"0.60532826",
"0.60529256",
"0.60525244",
"0.6040664",
"0.6038349",
"0.60317093",
"0.6024031",
"0.601... | 0.62093294 | 4 |
Clears all flair templates of a certain type. | def clear_flair_templates(options)
subreddit_name = extract_string(options[:subreddit], :display_name)
flair_type = 'USER_FLAIR'
flair_type = 'LINK_FLAIR' if options[:type].to_s == 'link'
parameters = { :r => subreddit_name, :flair_type => flair_type, :text => options[:text], :css_class => options[:css_class] }
post('api/clearflairtemplates', parameters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def clear\n @types = nil\n end",
"def clear!\n @types.clear\n end",
"def clear\n @types = nil\n @explicit = nil\n extensions.each do |extension|\n extension.clear\n end\n end",
"def rem_types_pgs\n \tpages = Page.where(type_... | [
"0.70048267",
"0.6924789",
"0.64395666",
"0.64236397",
"0.6296301",
"0.6209893",
"0.6186869",
"0.6140878",
"0.59241074",
"0.5920672",
"0.5887313",
"0.5858437",
"0.5848043",
"0.58266306",
"0.57929134",
"0.5780714",
"0.5745955",
"0.5739536",
"0.5732599",
"0.5680469",
"0.5679927... | 0.7066647 | 0 |
Applys a flair template to a link or user. | def apply_flair_template(options)
subreddit_name = extract_string(options[:subreddit], :display_name)
link_full_name = extract_full_name options[:link]
username = extract_string options[:user], :username
parameters = { :flair_template_id => options[:template_id], :r => subreddit_name, :name => username, :link => link_full_name }
post('api/selectflair', parameters)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def create_flair_template(subreddit, type, options = {})\n subreddit_name = extract_string(subreddit, :display_name)\n flair_type = (type.to_s == 'link') ? 'LINK_FLAIR' : 'USER_FLAIR'\n\n parameters = { :r => subreddit_name, :flair_type => flair_type, :text => options[:text], :css_class => opt... | [
"0.5882593",
"0.5300053",
"0.52860117",
"0.5235962",
"0.52205724",
"0.5208901",
"0.5188757",
"0.51673216",
"0.5148387",
"0.5138124",
"0.5107573",
"0.50687623",
"0.506518",
"0.5064962",
"0.5064962",
"0.5064962",
"0.5063488",
"0.5049171",
"0.50414264",
"0.5033725",
"0.50294775"... | 0.7254389 | 0 |
Sets flair options for a subreddit. | def set_flair_options(subreddit, options = {})
options = options.clone
subreddit_name = extract_string(subreddit, :display_name)
options.merge!({ :r => subreddit_name, :uh => @modhash })
post('api/flairconfig', options)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def set_flair(options)\n subreddit_name = extract_string(options[:subreddit], :display_name)\n link_full_name = extract_full_name options[:link]\n username = extract_string options[:user], :username\n\n parameters = { :r => subreddit_name, :text => options[:text], :css_class => options[... | [
"0.71628296",
"0.6233644",
"0.5774997",
"0.56181854",
"0.5457854",
"0.5029439",
"0.5029439",
"0.4990922",
"0.4987225",
"0.4894305",
"0.48246357",
"0.47792137",
"0.47398525",
"0.47395036",
"0.46339932",
"0.45951396",
"0.4585685",
"0.45764017",
"0.45764017",
"0.45587447",
"0.45... | 0.8345101 | 0 |
Returns the repository objects configured for the application. | def repositories
opts[:repositories]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def repositories\n # TODO : merge with current data\n load_repos\n end",
"def repositories\n Repositories.instance\n end",
"def repos\n @repos ||= OY.repos\n end",
"def repositories\n [ repository ].to_set + @properties.keys.map { |repository_name| DataMapper.repository(reposito... | [
"0.7392715",
"0.7347744",
"0.72041965",
"0.7203909",
"0.7062867",
"0.69925416",
"0.6976434",
"0.694501",
"0.6943849",
"0.68995005",
"0.6895885",
"0.67856085",
"0.66276914",
"0.6574559",
"0.65189046",
"0.65084463",
"0.6479356",
"0.64404047",
"0.6426262",
"0.6395961",
"0.631071... | 0.6737 | 12 |
Stores the file contained in a multipart POST +request+ in the repositories that will handle the mediatype of the file. | def store(request)
stored = repositories.each_with_object({}) do |repo, paths|
next unless repo.supports? request.file_type
paths[repo.name] = repo.store request.file
end
request.unsupported_media_type if stored.empty?
stored
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def multipart_upload\n end",
"def multipart; end",
"def upload\n secure_silence_logs do\n return bad_request unless params[:file] && params[:title] && current_account\n is_file = params[:file].respond_to?(:path)\n if !is_file && !(URI.parse(params[:file]) rescue nil)\n return bad_requ... | [
"0.6549069",
"0.6417748",
"0.62674844",
"0.6251529",
"0.61617243",
"0.613432",
"0.612522",
"0.61173904",
"0.60953736",
"0.6056403",
"0.604818",
"0.60336983",
"0.6006491",
"0.6006491",
"0.5929114",
"0.59210914",
"0.5916884",
"0.5912493",
"0.5908578",
"0.59015036",
"0.58758837"... | 0.70465046 | 0 |
Returns the filename for the file contained in the request. ===== Options: :property name of the parameter property that contains the file. | def filename(property: 'file')
params.dig property, :filename
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def filename\n unless @filename\n load_file_params\n end\n @filename\n end",
"def filename\n @filename || @options[:filename]\n end",
"def filename\n @properties[:filename]\n end",
"def filename\n get \"filename\"\n end",
"def filename\n @filename... | [
"0.75010973",
"0.7408721",
"0.73886216",
"0.7337761",
"0.733454",
"0.733454",
"0.7263633",
"0.7162572",
"0.7081067",
"0.70307016",
"0.70307016",
"0.69533914",
"0.69008106",
"0.68808",
"0.68797195",
"0.6879006",
"0.68352795",
"0.6796015",
"0.6796015",
"0.6757862",
"0.6703986",... | 0.82505363 | 0 |
Returns the media type for the file contained in the request. ===== Options: :property name of the parameter property that contains the file. | def file_type(property: 'file')
params.dig property, :type
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def stringy_media_type\n request.content_mime_type.to_s\n end",
"def content_type\n file.try(:content_type)\n end",
"def media_type\r\ncontent_mime_type.to_s\r\nend",
"def media_type(meta, file)\n tags = meta.inject(&:merge)\n tags.fetch 'MIMEType', Rack::Mime.mime_type(File.extname... | [
"0.73089916",
"0.7232878",
"0.7230197",
"0.71769804",
"0.71624255",
"0.70827603",
"0.70810145",
"0.7055742",
"0.70282835",
"0.6994459",
"0.6994205",
"0.69101834",
"0.69101834",
"0.6904581",
"0.68765324",
"0.6865378",
"0.6856837",
"0.6855495",
"0.6854482",
"0.68524027",
"0.684... | 0.73409086 | 0 |
Halts the request with details about the media type. To be called when the file_type is not supported. | def unsupported_media_type
msg = "Image format #{file_type} is not supported."\
" Supported formats are: #{roda_class.supported_media_types}."
halt [333, { 'Content-Type' => 'text/html' }, [msg]]
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def status_unsupported_media_type\n respond_to do |format|\n format.any { head :unsupported_media_type }\n end\n end",
"def response_media_type(options={})\n options = {:halt_if_unacceptable => false}.merge(options)\n accept = env['HTTP_ACCEPT']\n if accept =~ /\\S/\n begin\n ... | [
"0.6951718",
"0.6666416",
"0.66281724",
"0.662024",
"0.662024",
"0.6591503",
"0.64629847",
"0.6339447",
"0.6308161",
"0.6271723",
"0.62414294",
"0.62382567",
"0.62382567",
"0.62382567",
"0.62382567",
"0.6222194",
"0.62088704",
"0.6197783",
"0.6182947",
"0.6178754",
"0.6178179... | 0.71662086 | 0 |
Validate the received method and arguments for the call. | def validate_request
binding.pry if $debug
rejected_error = validate_method || validate_arguments
if rejected_error
reject
#if public mode
#kill
#else
respond_with_rejected_error(rejected_error)
#end
return false
end
accept
true
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check!\n self.normalize!\n __check_method\n __check_params\n end",
"def validate!(call_name)\n params = self.methods\n params.select { | method | call_name.include?(call_name) }\n end",
"def verify_args(method, args)\n matches = Chassi... | [
"0.7341075",
"0.72064984",
"0.69872266",
"0.6740991",
"0.67174166",
"0.6664119",
"0.6614999",
"0.65328634",
"0.63998544",
"0.63875645",
"0.6386713",
"0.63597673",
"0.63515997",
"0.632684",
"0.6284983",
"0.6276928",
"0.62759405",
"0.6245169",
"0.61959",
"0.6189466",
"0.6163865... | 0.60382 | 23 |
Accept the call request. To be called if the call is to be started. The argument's references will be settled. | def accept
@arguments_references.each { |argument_reference| @connection.objects.accept_reference(argument_reference) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_accept(accpt)\n @accept_model = accpt\n accept!\n end",
"def accept_incoming\n request = ProtoRINA.flow_read(name: Name)\n end",
"def call\n @called = true\n handleResponse @stubs\n end",
"def accept\n Connection.accept(person_id, contact_id)\n end",
"def accept\n Co... | [
"0.60958564",
"0.58628184",
"0.58357376",
"0.5787319",
"0.5756746",
"0.57097983",
"0.5618936",
"0.55976146",
"0.55567455",
"0.555378",
"0.55499464",
"0.54665256",
"0.54478693",
"0.5446066",
"0.54443693",
"0.54271185",
"0.5409506",
"0.54004395",
"0.5388949",
"0.53768075",
"0.5... | 0.6073174 | 1 |
Determine the acceptable number of arguments the method will accept. | def acceptable_argument_count
parameters = @object.method(@method).parameters
min_args = parameters.select{ |arg| arg[0] == :req }.count
if parameters.any? { |arg| arg[0] == :rest }
max_args = Float::INFINITY
else
max_args = parameters.count
end
(min_args..max_args)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def check_arguments_count(input_params)\n return if input_params.count >= declared_params.count\n raise ArgumentError, \"#{declared_params.count} parameters expected.\"\n end",
"def how_many_args(*args)\n args.length\nend",
"def how_many_args *args\n args.length\n # accepts any number of arguments wi... | [
"0.7424012",
"0.73169637",
"0.726779",
"0.7197137",
"0.71703976",
"0.71410257",
"0.7127916",
"0.7040024",
"0.7036553",
"0.6967004",
"0.6937658",
"0.6928255",
"0.6906251",
"0.68837464",
"0.6779577",
"0.6752329",
"0.6723505",
"0.6692151",
"0.6568561",
"0.6503173",
"0.65024316",... | 0.83989096 | 0 |
Build the object can arguments that will be used for this call. | def build_objects
@object = @connection.objects.convert_reference_to_object(@object_reference)
@arguments = @arguments_references.map { |arguments_reference| @connection.objects.convert_reference_to_object(arguments_reference) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_args\n @scope.argument_descriptors = build_arg_descriptor\n add CheckArityInstr.new(2, 0, false, false, -1)\n _in = @scope.get_new_local_variable(\"_in\", 0)\n add ReceivePreReqdArgInstr.new(_in, 0)\n _out = @scope.get_new_local_variable(\"_out\", 0)\n add ReceivePreReqdArgI... | [
"0.68723047",
"0.6833558",
"0.65399355",
"0.6502566",
"0.64693487",
"0.6426462",
"0.6388518",
"0.6387083",
"0.6222001",
"0.6217064",
"0.6217064",
"0.6217064",
"0.6206528",
"0.6189203",
"0.6180162",
"0.61526424",
"0.61525184",
"0.6104492",
"0.6103821",
"0.61022395",
"0.6087549... | 0.652809 | 3 |
Reject the call request. To be called if the call could not be started. The argument's references will be forgotten unless they are in use elsewhere. | def reject
@arguments_references.each { |argument_reference| @connection.objects.reject_reference(argument_reference) }
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def call_reject(accpt)\n @accept_model = accpt\n reject!\n end",
"def reject!\n raise RejectMessage\n end",
"def refuse_method(request)\n maybe_log(\"Refusing method call (transaction=#{message.transaction})\")\n error = ::Ractor::ClosedError.new\n request.sender.send(Message.ne... | [
"0.631477",
"0.62937677",
"0.62734836",
"0.6094098",
"0.596257",
"0.5955629",
"0.59134734",
"0.58571595",
"0.58059615",
"0.57172036",
"0.56483334",
"0.55957824",
"0.5576135",
"0.5555351",
"0.55514055",
"0.55424297",
"0.55169743",
"0.5512948",
"0.5504918",
"0.5445783",
"0.5419... | 0.69934815 | 0 |
Build and send response message for an error. | def respond_with_error(error)
response = Messages::CallResponse.build(id: @id, exception: error)
@connection.messenger.send(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def build_error_response(error)\n error_messages = messages_from_error(error)\n\n JsonRender.convert(:status => :error, :messages => error_messages)\n end",
"def error!(status, message)\n response.status = status\n response[\"Content-Type\"] = \"application/json\"\n ... | [
"0.7091141",
"0.70776784",
"0.69767815",
"0.68897855",
"0.68141925",
"0.68120766",
"0.6784898",
"0.67485535",
"0.6726096",
"0.6708616",
"0.6699454",
"0.66556376",
"0.6640858",
"0.6615443",
"0.659044",
"0.65856516",
"0.6577798",
"0.6532693",
"0.65284765",
"0.65278596",
"0.6508... | 0.6739324 | 8 |
Build and send response message for a rejected call. | def respond_with_rejected_error(error)
response = Messages::CallResponse.build(id: @id, rejected_exception: error)
@connection.messenger.send(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def reject!(response_data={})\n @client.post(\"#{path}/reject\", response_data)\n end",
"def reject!\n raise RejectMessage\n end",
"def respond_with_error(error)\n response = Messages::CallResponse.build(id: @id, exception: error)\n @connection.messenger.send(response)\n end",
"def... | [
"0.6484151",
"0.60555637",
"0.60079795",
"0.6005952",
"0.5881943",
"0.58573765",
"0.58517814",
"0.57878685",
"0.5737999",
"0.56993085",
"0.5686025",
"0.5633313",
"0.56326216",
"0.55960613",
"0.55735767",
"0.55588126",
"0.5556301",
"0.55523384",
"0.55439526",
"0.5483756",
"0.5... | 0.7542247 | 0 |
Build and send response message for a value. | def respond_with_value(value)
return_value_properties = @connection.objects.convert_object_to_properties(value)
response = Messages::CallResponse.build(id: @id, return_value: return_value_properties)
@connection.messenger.send(response)
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def generate(value, **options)\n create_message(value, **options)\n end",
"def rpc_response(value)\n render inline: \"xml.instruct! :xml, :version=>'1.0' \\n xml.methodResponse { xml.params { xml.param { #{value} }}}\", type: :builder, content_type: \"text/xml\"\n end",
"def output(value)\n {\... | [
"0.6292473",
"0.61458594",
"0.6144818",
"0.59858996",
"0.5777698",
"0.56394076",
"0.5576192",
"0.5569706",
"0.550307",
"0.5477748",
"0.5466036",
"0.54569423",
"0.54562396",
"0.54294765",
"0.54152626",
"0.5398839",
"0.5391088",
"0.538453",
"0.53839177",
"0.5355931",
"0.5349654... | 0.72253376 | 0 |
GET /courses GET /courses.json | def index
respond_to do |format|
format.html # index.html.haml
format.json {
page = 1
page = params[:iDisplayStart].to_i/10+1 if params[:iDisplayStart]
e = Course
e = e.joins(:instructor, :college)
total_record_size = 0
display_length = 10
if params[:iDisplayLength].to_i > 10
display_length = params[:iDisplayLength].to_i
end
if params[:iSortCol_0].to_i != 0
sort_column = DatatableFields[params[:iSortCol_0].to_i]
sort_direction = params[:sSortDir_0]
if ["instructor", "college"].include?(sort_column)
sc = ""
case sort_column
when /instructor/
sc = "instructors.name"
when /college/
sc = "colleges.college_tag"
end
e = e.order("#{sc} #{sort_direction}")
else
e = e.order("#{sort_column} #{sort_direction}")
end
end
if params[:sSearch] != "" && !params[:sSearch].nil?
search = DatatableFields.collect{|d| "#{d} LIKE '%#{params[:sSearch]}%'" unless ["college","instructor", "add", "friends"].include?(d) }.compact.join(' OR ')
search2 = " OR instructors.name LIKE '%SUB%' OR colleges.college_tag LIKE '%SUB%' ".gsub('SUB', params[:sSearch])
search += search2
e = e.where(search)
total_record_size = e.count
e = e.page(page).per(display_length)
#logger.info "EQ: " + e.to_sql
else
total_record_size = e.count
e = e.page(page).per(display_length)
end
json = DatatablesRails::Structify.new(e)
json.formatter do |u|
course = Course.find(u['id'])
if current_user.courses.where(:id => u['id']).first.blank?
u['add'] = self.class.helpers.link_to "Add", user_courses_path(:course_id => u['id']), :method => :post, :remote => :true, :onclick => "$(this).html('Added')"
else
u['add'] = "Added"
end
u['course_number'] = self.class.helpers.link_to u['course_number'], course_path(:id => u['id'])
u['instructor'] = self.class.helpers.link_to course.try(:instructor).try(:name), instructor_path(:id => course.try(:instructor_id))
u['college'] = course.college.college_tag.upcase
u['begin_time'] = u['begin_time'].strftime("%I:%M %p")
u['end_time'] = u['end_time'].strftime("%I:%M %p")
u['friends'] = current_user.find_friends_in_course(u['id']).size
end
json_struct = json.struct
json_struct["iTotalRecords"] = total_record_size
json_struct["iTotalDisplayRecords"] = total_record_size
json_struct["sEcho"] = params[:sEcho]
render :json => json_struct
}
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def index\n\t\t@courses = Course.all\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @courses }\n\t\tend\n\tend",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).or... | [
"0.7943173",
"0.78570646",
"0.7742099",
"0.7729055",
"0.7729055",
"0.76939315",
"0.76708746",
"0.76526207",
"0.752899",
"0.74440956",
"0.74415404",
"0.73988724",
"0.7373047",
"0.7365082",
"0.73555565",
"0.7347125",
"0.7311683",
"0.7271882",
"0.7270879",
"0.72251445",
"0.72230... | 0.0 | -1 |
GET /courses/1 GET /courses/1.json | def show
@course = Course.find(params[:id])
@wall_message = WallMessage.new
@type = @course
respond_to do |format|
format.html # show.html.erb
format.json { render json: @course }
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def course\n\t\t@course = Course.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.json\n\t\tend\n\tend",
"def index\n @courses = Course.all\n render json: @courses, status: :ok\n end",
"def courses\n @courses = Course.where(faculty_id: params[:faculty_id]).order(:name)\n respond_to do... | [
"0.7639248",
"0.7600732",
"0.7561499",
"0.7498261",
"0.7492566",
"0.7492566",
"0.7460362",
"0.7459336",
"0.7438278",
"0.7280991",
"0.7248682",
"0.7241407",
"0.723878",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.72222453",
"0.721023",
"0.71961445"... | 0.0 | -1 |
Stream the blob from storage directly to the response. The disposition can be controlled by setting +disposition+. The content type and filename is set directly from the +blob+. | def send_blob_stream(blob, disposition: nil) #:doc:
send_stream(
filename: blob.filename.sanitized,
disposition: blob.forced_disposition_for_serving || disposition || DEFAULT_BLOB_STREAMING_DISPOSITION,
type: blob.content_type_for_serving) do |stream|
blob.download do |chunk|
stream.write chunk
end
end
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def download_single(content_blob)\n @content_blob = content_blob\n\n respond_to do |format|\n format.html { handle_download(params[:disposition] || 'attachment') }\n end\n end",
"def download_blob_to(file) #:doc:\n file.binmode\n blob.download { |chunk| file.write(chunk) }\... | [
"0.65148145",
"0.64677745",
"0.6205658",
"0.6205658",
"0.6126547",
"0.5770641",
"0.5723598",
"0.56950754",
"0.5636549",
"0.56108",
"0.55993396",
"0.5552398",
"0.5535288",
"0.5515239",
"0.5488792",
"0.5464795",
"0.5445536",
"0.5437135",
"0.539026",
"0.5387455",
"0.5348541",
... | 0.8033089 | 0 |
Returns true if the integer is not a positive number. | def nonpositive?
return self <= 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def positive? number\n return number > 0 ? true : false\n end",
"def nonnegative?\n return self >= 0\n end",
"def valid_integer?(number)\n (number.to_i.abs.to_s == number) && (number.to_i != 0)\nend",
"def valid_number?(num)\n num.to_i() != 0\nend",
"def valid_number?(num)\n num.to_i... | [
"0.8014647",
"0.78272897",
"0.77576536",
"0.7698711",
"0.7698711",
"0.7695251",
"0.7695251",
"0.7630341",
"0.7577927",
"0.75503194",
"0.74870217",
"0.74750257",
"0.74692243",
"0.7446078",
"0.7424931",
"0.73741317",
"0.7361235",
"0.7322905",
"0.7275038",
"0.72711927",
"0.72234... | 0.76358205 | 7 |
Returns true if the integer is a negative number. | def negative?
return self < 0
end | {
"objective": {
"self": [],
"paired": [],
"triplet": [
[
"query",
"document",
"negatives"
]
]
}
} | [
"def negative?\n value < 0\n end",
"def is_negative(number)\n if number < 0 \n return true\n end\n return false\nend",
"def is_negative(number)\n if number < 0 \n return true\n else return false\n end\nend",
"def is_negative(num)\n if num < 0\n return true\n ... | [
"0.7955224",
"0.78899336",
"0.7857076",
"0.77552176",
"0.7750208",
"0.77453125",
"0.77315074",
"0.77171177",
"0.7691686",
"0.7673194",
"0.75819856",
"0.7543617",
"0.75366545",
"0.75290024",
"0.7519752",
"0.7508382",
"0.74932516",
"0.7441781",
"0.7408552",
"0.73440474",
"0.734... | 0.7510809 | 15 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.