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
goto last line of file
def goto_end $multiplier ||= 0 if $multiplier > 0 goto_line $multiplier - 1 return end @current_index = @list.count() - 1 @prow = @current_index - @scrollatrows $multiplier = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line; end", "def last_line_only(range); end", "def last_line_only(range); end", "def last_line_only(range); end", "def last_line(src)\n if n = src.rindex...
[ "0.75997883", "0.75997883", "0.75997883", "0.75997883", "0.75997883", "0.75997883", "0.75997883", "0.6711023", "0.6711023", "0.6711023", "0.66987884", "0.65330243", "0.64326423", "0.63485146", "0.63215375", "0.6311817", "0.6307867", "0.62413573", "0.6239466", "0.6238657", "0....
0.6351437
13
move down a line mimicking vim's j key
def down num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier) #@oldindex = @current_index if num > 10 @current_index += num # no , i don't like this here. it scrolls up too much making prow = current_index unless is_visible? @current_index #alert "#{@current_index} not visible prow #{@prow} #{@scrollatrows} " @prow += num end #ensure_visible $multiplier = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_down(n); print \"\\e[#{n}B\" end", "def move_down(lines=1)\n self.y += CONSOLE_LINE_HEIGHT * lines\n end", "def move_down\n\t\tmove([0,1])\n\tend", "def up_down_line(count)\n insert = at_insert\n\n # if the last movement was not done by up_down_*, set new origin.\n @udl_pos_orig =...
[ "0.71944875", "0.71664673", "0.71011597", "0.68808055", "0.67687726", "0.6764369", "0.67387015", "0.6738013", "0.66623443", "0.65985", "0.657905", "0.64836335", "0.6443147", "0.64283866", "0.6389913", "0.63110673", "0.63015914", "0.6298962", "0.62486804", "0.6207132", "0.6199...
0.0
-1
move up a line mimicking vim's k key
def up num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier) #@oldindex = @current_index if num > 10 @current_index -= num #unless is_visible? @current_index #if @prow > @current_index ##$status_message.value = "1 #{@prow} > #{@current_index} " #@prow -= 1 #else #end #end $multiplier = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_up(lines=1)\n self.y -= CONSOLE_LINE_HEIGHT * lines\n end", "def move_up\n current_y = position[0] - 1\n position[0] = (current_y < 0 ) ? (width-1) : current_y\n end", "def up_down_line(count)\n insert = at_insert\n\n # if the last movement was not done by up_down_*, set new origi...
[ "0.74885505", "0.7154799", "0.7051208", "0.70040673", "0.67441165", "0.6707951", "0.6684964", "0.66678727", "0.66047305", "0.6570271", "0.65185636", "0.65105015", "0.6492471", "0.6446223", "0.63912636", "0.63724595", "0.635368", "0.6343697", "0.63405526", "0.63329625", "0.632...
0.0
-1
scrolls window down mimicking vim Ce
def scroll_window_down num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier) @prow += num if @prow > @current_index @current_index += 1 end #check_prow $multiplier = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll_down(n); puts \"\\e[#{n}T\" end", "def scroll_down(*args, &block)\n max_oy = contents_height - maqj_visible_height\n dest = ((@dest_scroll_oy / line_height) + 1)*line_height\n @dest_scroll_oy = [dest, max_oy].min\n end", "def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend", "def cursor...
[ "0.7386232", "0.7252345", "0.7120143", "0.7120143", "0.70166683", "0.6983436", "0.69340295", "0.6816489", "0.67793775", "0.6760179", "0.6691775", "0.668288", "0.6624111", "0.65974516", "0.6564243", "0.65440047", "0.6476978", "0.6438732", "0.6437633", "0.643521", "0.6351057", ...
0.6395857
21
scrolls window up mimicking vim Cy
def scroll_window_up num=(($multiplier.nil? or $multiplier == 0) ? 1 : $multiplier) @prow -= num unless is_visible? @current_index # one more check may be needed here TODO @current_index -= num end $multiplier = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll_up(n); puts \"\\e[#{n}S\" end", "def scroll_up(*args, &block)\n dest = ((@dest_scroll_oy / line_height) - 1)*line_height\n @dest_scroll_oy = [dest, 0].max \n end", "def scroll_up\n ESC + 'M'\n end", "def scroll_up\n if @top > 0\n @screen.scrl(-1)\n @top -= 1\n ...
[ "0.7424409", "0.7379806", "0.7349244", "0.7103998", "0.7075424", "0.68921226", "0.6837922", "0.67576164", "0.67188257", "0.66476387", "0.6627078", "0.6619033", "0.6600041", "0.6574433", "0.6574433", "0.6431914", "0.6410413", "0.63828844", "0.63173354", "0.6248976", "0.6181665...
0.6580799
14
scrolls lines a window full at a time, on pressing SPACE or Cd or pagedown
def scroll_forward #@oldindex = @current_index @current_index += @scrollatrows @prow = @current_index - @scrollatrows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend", "def cursor_scroll_dn\n moveto(pos() + MSCROLL)\nend", "def cursor_scroll_dn\n @cursor_movement = :down\n @old_cursor = @cursor\n move_to(pos + MSCROLL)\nend", "def scroll_down(n); puts \"\\e[#{n}T\" end", "def scroll_down(lines = 1)\n @lines.ea...
[ "0.7090296", "0.7090296", "0.690545", "0.6904675", "0.689632", "0.6633979", "0.6502822", "0.6469237", "0.63545364", "0.6351124", "0.6309351", "0.62834525", "0.62604266", "0.6247006", "0.61690384", "0.6149455", "0.6149455", "0.6147551", "0.60917646", "0.6086938", "0.6081799", ...
0.567723
56
scrolls lines backward a window full at a time, on pressing pageup Cu may not work since it is trapped by form earlier. Need to fix
def scroll_backward #@oldindex = @current_index @current_index -= @scrollatrows @prow = @current_index - @scrollatrows end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scroll_down(lines = 1)\n @lines.each { |spr| spr.move_down(lines) }\n end", "def scroll_backward\n @oldindex = @current_index\n @current_index -= @scrollatrows\n @prow = @current_index - @scrollatrows\n end", "def scroll_up(*args, &block)\n dest = ((@dest_scroll_oy / line_height) -...
[ "0.72301215", "0.71764106", "0.7050362", "0.69633883", "0.6908916", "0.6908086", "0.690179", "0.6882274", "0.68089384", "0.6757942", "0.6723388", "0.67179847", "0.6658803", "0.66498595", "0.664703", "0.6622656", "0.6595669", "0.65755415", "0.6536535", "0.65335923", "0.6527817...
0.738171
0
jumps cursor to next word, like vim's w key
def forward_word #forward_regex(/[[:punct:][:space:]]\w/) forward_regex(:word) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_word\n return unless md = get.match(FORWARD_WORD, cursor)\n self.cursor = md.offset(0).last\n end", "def search_next_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @info.search_with_length(Regexp.new(Regexp::quote(word), Regexp::IGNORECAS...
[ "0.7673494", "0.70441574", "0.703867", "0.6855899", "0.6750185", "0.6724746", "0.6534171", "0.64086807", "0.61973697", "0.6161635", "0.61401933", "0.6091734", "0.60705185", "0.594954", "0.58635193", "0.58579093", "0.5857218", "0.5834509", "0.5822063", "0.57602304", "0.5759305...
0.0
-1
jump to the next occurence of given regex in the current line. It only jumps to next line after exhausting current.
def forward_regex regex if regex.is_a? Symbol regex = @text_patterns[regex] raise "Pattern specified #{regex} does not exist in text_patterns " unless regex end $multiplier = 1 if !$multiplier || $multiplier == 0 line = @current_index _arr = _getarray buff = _arr[line].to_s return unless buff pos = @curpos || 0 # list does not have curpos $multiplier.times { found = buff.index(regex, pos) if !found # if not found, we've lost a counter if line+1 < _arr.length line += 1 else return end pos = 0 else pos = found + 1 end $log.debug " forward_word: pos #{pos} line #{line} buff: #{buff}" } $multiplier = 0 @current_index = line @curpos = pos ensure_visible @repaint_required = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_regex regex\n if regex.is_a? Symbol\n regex = @text_patterns[regex]\n raise \"Pattern specified #{regex} does not exist in text_patterns \" unless regex\n end\n @last_regex = regex\n find_more\n end", "def _find_next regex=@last_regex, start = @search_found_ix \n ...
[ "0.6841017", "0.6755143", "0.62304157", "0.62183255", "0.61865795", "0.6145331", "0.6144834", "0.61244446", "0.6084669", "0.6019128", "0.6008567", "0.5866663", "0.5855027", "0.58350176", "0.57782656", "0.57015604", "0.56657267", "0.56259495", "0.56060004", "0.5569695", "0.554...
0.61976624
4
jump to previous word, like vim's "b"
def backward_word #backward_regex(/[[:punct:][:space:]]\w/) backward_regex(:word) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prev_word\n line = get.reverse\n pos = get.size - cursor\n\n return unless md = line.match(BACKWARD_WORD, pos)\n self.cursor = (line.size - md.offset(0).last)\n end", "def search_prev_word(word)\n @info.focus\n highlight_word word\n cursor = @info.index('insert')\n pos = @i...
[ "0.7218953", "0.71519053", "0.66127187", "0.65857327", "0.65051687", "0.65002143", "0.646146", "0.63583714", "0.62715954", "0.6232249", "0.6090339", "0.60740215", "0.6038118", "0.59909636", "0.583592", "0.5815168", "0.5770268", "0.5770268", "0.5738587", "0.57274026", "0.56969...
0.0
-1
jump to previous occurence of given regexp within a line, and then to previous line This is more line 'w' or 'b' in vim, not like '/'
def backward_regex regex if regex.is_a? Symbol regex = @text_patterns[regex] raise "Pattern specified #{regex} does not exist in text_patterns " unless regex end $multiplier = 1 if !$multiplier || $multiplier == 0 _arr = _getarray pos = @curpos || 0 # list does not have curpos line = @current_index #buff = _arr[line].to_s #return unless buff # if curpos is at zero , we should be checking previous line ! $multiplier.times { # if at start of line, go to previous line if pos == 0 if @current_index > 0 line -= 1 pos = _arr[line].to_s.size else # we are on first line of file at start break end end buff = _arr[line].to_s return unless buff pos2 = pos - 2 pos2 = 0 if pos2 < 0 found = buff.rindex(regex, pos2) $log.debug " backward: pos #{pos} , found #{found}, pos2 = #{pos2} " if !found || found == 0 # if not found, we've lost a counter if pos > 0 pos = 0 elsif line > 0 #line -= 1 #pos = _arr[line].to_s.size else break end else pos = found + 1 end $log.debug " backward_word: pos #{pos} line #{line} buff: #{buff}" } $multiplier = 0 @current_index = line @curpos = pos ensure_visible @repaint_required = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jump(line)\n return line[/(JGT)|(JEQ)|(JGE)|(JLT)|(JNE)|(JLE)|(JMP)/]\n end", "def insert_line_after_match(regex, newline)\n search_match(regex, newline, 'i', 1)\n end", "def forward_regex regex\n if regex.is_a? Symbol\n regex = @text_patterns[regex]\n raise \"Pattern spe...
[ "0.61537296", "0.6057724", "0.60293704", "0.6012797", "0.59500563", "0.5933336", "0.59200156", "0.5870731", "0.5852831", "0.5850108", "0.5758879", "0.5745673", "0.5730376", "0.56961465", "0.5682975", "0.5665793", "0.5626249", "0.5613198", "0.5605322", "0.55937594", "0.5591945...
0.5743854
12
move cursor forward by one char (currently will not pan)
def cursor_forward $multiplier = 1 if $multiplier == 0 if @curpos < @cols @curpos += $multiplier if @curpos > @cols @curpos = @cols end @repaint_required = true end $multiplier = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_char\n self.cursor += 1\n end", "def prev_char\n self.cursor -= 1\n end", "def cursor_forward\n if @curpos < @buffer.length \n if addcol(1)==-1 # go forward if you can, else scroll\n @pcol += 1 if @pcol < @width \n end\n @curpos += 1\n end\n # $log.debug ...
[ "0.7498934", "0.7269978", "0.7082536", "0.70062274", "0.6984206", "0.68688446", "0.67982036", "0.6778933", "0.6763792", "0.6739839", "0.67254406", "0.67148036", "0.66449374", "0.66412854", "0.6640879", "0.6640879", "0.66249037", "0.6620265", "0.66194254", "0.66194254", "0.654...
0.71773577
2
move cursor backward by one char (currently will not pan)
def cursor_backward $multiplier = 1 if $multiplier == 0 if @curpos > 0 @curpos -= $multiplier @curpos = 0 if @curpos < 0 @repaint_required = true end $multiplier = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cursor_backward\n if @curpos > 0\n @curpos -= 1\n #if @pcol > 0 #and @form.col == @col + @col_offset\n #@pcol -= 1\n #end\n addcol -1\n elsif @pcol > 0 \n # pan left only when cursor pos is 0\n @pcol -= 1 \n end\n # $log.debug \" crusor back cp:#{@curpos} pcol:...
[ "0.79509836", "0.74841917", "0.7102214", "0.70612377", "0.70296013", "0.68372345", "0.67884934", "0.67884934", "0.66378367", "0.6622847", "0.6594029", "0.65732783", "0.6538286", "0.6515188", "0.6478461", "0.6451838", "0.64513755", "0.6442741", "0.6430066", "0.6294655", "0.621...
0.7604372
1
moves cursor to end of line also panning window if necessary NOTE: if one line on another page (not displayed) is way longer than any displayed line, then this will pan way ahead, so may not be very intelligent in such situations.
def cursor_eol # pcol is based on max length not current line's length @pcol = @content_cols - @cols - 1 _arr = _getarray @curpos = _arr[@current_index].size @repaint_required = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_cursor_position() set_cursor_position(@event[\"line\"], @event[\"column\"]) end", "def pitch_view( y = 1, do_pitch_cursor = DONT_PITCH_CURSOR, do_display = DO_DISPLAY )\n old_top_line = @top_line\n new_top_line = @top_line + y\n\n if new_top_line < 0\n @top_line = 0\n elsif...
[ "0.6602665", "0.6566417", "0.65540075", "0.6487797", "0.6487797", "0.64680314", "0.6329631", "0.62467074", "0.6235528", "0.6157572", "0.6134036", "0.60940987", "0.60845435", "0.6077002", "0.60402524", "0.6036547", "0.60011363", "0.593484", "0.593484", "0.59280527", "0.590448"...
0.58972484
22
moves cursor to start of line, panning if required
def cursor_bol # copy of C-a - start of line @repaint_required = true if @pcol > 0 @pcol = 0 @curpos = 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_of_line\n self.cursor = 0\n end", "def move_to_start\n @cursor = 0\n end", "def move_to_start\n @cursor = 0\n end", "def cursor_move_to_beginning\n @cursor_position = 0\n self.reset_cursor_blinking\n end", "def cursor_to_input_line\n setpos(input_line...
[ "0.78425467", "0.7343484", "0.7343484", "0.7285749", "0.71662885", "0.710454", "0.682262", "0.67036116", "0.66446054", "0.6619282", "0.65861607", "0.6569485", "0.6540071", "0.651005", "0.6493825", "0.6488633", "0.6462212", "0.6413101", "0.6411354", "0.63114977", "0.62700045",...
0.67640626
7
return true if the given row is visible
def is_visible? index j = index - @prow #@toprow j >= 0 && j <= scrollatrows() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row_visible(row)\n return true if self.scterm.nil?\n row_to_s(row).match(self.scterm)\n end", "def visible? component\n r, c = component.rowcol\n return false if c+@cols_panned < @orig_left\n return false if c+@cols_panned > @orig_left + @display_w\n # XXX TODO for rows UNTESTED fo...
[ "0.8478809", "0.7672713", "0.76326066", "0.724727", "0.70836234", "0.7029323", "0.7029323", "0.7020071", "0.6959652", "0.694816", "0.69280523", "0.6925951", "0.68309003", "0.6829188", "0.6713625", "0.6708087", "0.66931397", "0.66049606", "0.6554269", "0.654493", "0.65364754",...
0.7663828
2
this is a barebones handler to be used only if an overriding key handler wishes to fall back to default processing after it has handled some keys. The complete version is in Defaultkeyhandler. BUT the key will be executed again.
def _handle_key ch begin ret = process_key ch, self $multiplier = 0 bounds_check rescue => err $log.error " TEXTPAD ERROR _handle_key #{err} " $log.debug(err.backtrace.join("\n")) alert "#{err}" #textdialog ["Error in TextPad: #{err} ", *err.backtrace], :title => "Exception" ensure padrefresh Ncurses::Panel.update_panels end return 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def handle_key(key); end", "def handle_key ch\n super\n end", "def handle_key key\n key\n end", "def default_handler\n @default_handler\n end", "def ORIG_process_key keycode, object, window\n return :UNHANDLED if @_key_map.nil?\n blk = @_key_map[keycode]\n $...
[ "0.65332574", "0.6287819", "0.62558764", "0.60658634", "0.60360444", "0.6029564", "0.59207726", "0.5794826", "0.57213503", "0.5715959", "0.5697095", "0.56821334", "0.5599095", "0.558388", "0.5548807", "0.5491435", "0.5477062", "0.546665", "0.5447936", "0.542248", "0.54029506"...
0.53932977
21
creates and returns a textactionevent object with current_value , line number and cursor position
def text_action_event aev = TextActionEvent.new self, :PRESS, current_value().to_s, @current_index, @curpos end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def text_selection_start__position(text_input_handle)\n end", "def text_cursor_position(text_input_handle)\n end", "def new_event(n, text)\n @events_list_iter.set_value(0, n.to_s)\n @events_list_iter.set_value(1, text)\n @events_list.append\n @events_list_iter.next!\n\n if false # XXX actually...
[ "0.5495258", "0.53459", "0.5177446", "0.514204", "0.5140041", "0.51305586", "0.5129958", "0.5125481", "0.51245993", "0.5037417", "0.50167716", "0.49774277", "0.49708086", "0.4926232", "0.492334", "0.49123117", "0.48857108", "0.48708323", "0.48643515", "0.48525622", "0.4824874...
0.7309527
0
execute binding when a row is entered, used more in lists to display some text in a header or footer as one traverses
def on_enter_row arow return nil if @list.nil? || @list.size == 0 @repaint_footer_required = true ## can this be done once and stored, and one instance used since a lot of traversal will be done require 'canis/core/include/ractionevent' aev = TextActionEvent.new self, :ENTER_ROW, current_value().to_s, @current_index, @curpos fire_handler :ENTER_ROW, aev end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_enter\n if @list.nil? || @list.size == 0\n Ncurses.beep\n return :UNHANDLED\n end\n super # forgot this 2011-10-9 that's why events not firign\n on_enter_row @current_index\n set_form_row # added 2009-01-11 23:41 \n true\n end", "def on_enter\n if @list...
[ "0.6505296", "0.64952505", "0.6221871", "0.610796", "0.5969941", "0.58616275", "0.58422655", "0.5819171", "0.57604784", "0.5476558", "0.5452064", "0.541308", "0.53614706", "0.53538185", "0.53420275", "0.53416324", "0.5308076", "0.5281529", "0.5263281", "0.52291805", "0.515920...
0.7091436
0
called when this widget is entered, by form
def on_enter super set_form_row end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def on_enter\n set_form_row # 2011-10-17 \n end", "def on_enter\n ## Form has already set this, and set modified to false\n @state = :HIGHLIGHTED # duplicating since often these are inside containers\n #@focussed = true\n if @handler && @handler.has_key?(:ENTER)\n fire_handler :ENTER,...
[ "0.71269745", "0.697253", "0.646106", "0.63830316", "0.63830316", "0.63097996", "0.6196688", "0.61315715", "0.6047822", "0.60251623", "0.60219955", "0.5871702", "0.57979953", "0.57962656", "0.5761342", "0.5747836", "0.5737826", "0.56508887", "0.56189716", "0.56189716", "0.561...
0.7235996
0
save last cursor position so when reentering, cursor can be repositioned
def lastcurpos r,c @lastrow = r @lastcol = c end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_cursor_position() set_cursor_position(@event[\"line\"], @event[\"column\"]) end", "def save_cursor(cursor)\n cursors[cursor] = cursor\n end", "def _restore_cursor\n\t\tfalse\n\tend", "def save_pos\n [pos, @previous_pos, @previous_line_number]\n end", "def _save_cursor\n\t\tf...
[ "0.762486", "0.75109667", "0.71843624", "0.7126944", "0.7015976", "0.6978166", "0.67664576", "0.6722707", "0.6684266", "0.6649398", "0.66344714", "0.6619475", "0.6588864", "0.6536363", "0.6487687", "0.6473817", "0.6426671", "0.64074403", "0.64003646", "0.639659", "0.6287287",...
0.6891439
6
check that prow and pcol are within bounds
def check_prow @prow = 0 if @prow < 0 @pcol = 0 if @pcol < 0 cc = @list.count @rows = rows() #$log.debug " check_prow prow #{@prow} , list count #{cc}, rows #{@rows} " # 2014-05-28 - 22:41 changed < to <= otherwise prow became -1 when equal if cc <= @rows @prow = 0 else maxrow = cc - @rows - 1 if @prow > maxrow @prow = maxrow end end #$log.debug " check_prow after prow #{@prow} , list count #{cc} " # we still need to check the max that prow can go otherwise # the pad shows earlier stuff. # return end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def in_bounds?(side_a, side_b, side_c, perim, max_leg, max_hypot, max_perim)\n perim <= max_perim && side_a <= max_leg && side_b <= max_leg && side_c <= max_hypot\nend", "def in_bounds?(x, y)\n x >= 0 && x < @grid_width && y >= 0 && y < @grid_height\n end", "def inbounds?(point)\n return false if point...
[ "0.7037905", "0.694998", "0.68094224", "0.6806937", "0.6709597", "0.6673274", "0.66654", "0.6650466", "0.6557469", "0.6535677", "0.64648795", "0.6416508", "0.6380388", "0.6350596", "0.63109076", "0.630712", "0.6298867", "0.62909365", "0.6242223", "0.6192132", "0.6172907", "...
0.5644192
99
key mappings TODO take from listbindings so that emacs and vim can be selected. also user can change in one place.
def map_keys @mapped_keys = true require 'canis/core/include/listbindings' bindings =begin bind_key([?g,?g], 'goto_start'){ goto_start } # mapping double keys like vim bind_key(279, 'goto_start'){ goto_start } bind_keys([?G,277], 'goto end'){ goto_end } bind_keys([?k,KEY_UP], "Up"){ up } bind_keys([?j,KEY_DOWN], "Down"){ down } bind_key(?\C-e, "Scroll Window Down"){ scroll_window_down } bind_key(?\C-y, "Scroll Window Up"){ scroll_window_up } bind_keys([32,338, ?\C-d], "Scroll Forward"){ scroll_forward } # adding CTRL_SPACE as back scroll 2014-04-14 bind_keys([0,?\C-b,339], "Scroll Backward"){ scroll_backward } # the next one invalidates the single-quote binding for bookmarks #bind_key([?',?']){ goto_last_position } # vim , goto last row position (not column) bind_key(?/, :ask_search) bind_key(?n, :find_more) bind_key([?\C-x, ?>], :scroll_right) bind_key([?\C-x, ?<], :scroll_left) bind_key(?\M-l, :scroll_right) bind_key(?\M-h, :scroll_left) bind_key(?L, :bottom_of_window) bind_key(?M, :middle_of_window) bind_key(?H, :top_of_window) bind_key(?w, :forward_word) bind_key(?b, :backward_word) bind_key(?l, :cursor_forward) bind_key(?h, :cursor_backward) bind_key(?$, :cursor_eol) bind_key(KEY_ENTER, :fire_action_event) =end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vieditable_init_listbox\n $log.debug \" inside vieditable_init_listbox \"\n @editable = true\n bind_key( ?C, :edit_line)\n bind_key( ?o) { insert_line(@current_index+1) } \n bind_key( ?O) { insert_line(@current_index) } \n bind_key( [?d, ?d] , :delete_line ) \n bind_key( ?\\C...
[ "0.67676145", "0.66373724", "0.6563305", "0.6422784", "0.6367914", "0.6283101", "0.62378216", "0.61789227", "0.61688995", "0.61585367", "0.61176497", "0.6064144", "0.6000942", "0.58397305", "0.58233774", "0.57623774", "0.5729316", "0.5719083", "0.5680145", "0.56647116", "0.56...
0.6712874
1
Find next matching row for string accepted in ask_search
def find_more return unless @last_regex ix = next_match @last_regex return unless ix #@oldindex = @current_index @current_index = ix[0] @curpos = ix[1] ensure_visible end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_next (matrix, word, index, start_row, start_col)\n\tif(index < word.length - 1)\n\t\tneighbors = find_neighbors(matrix, start_row, start_col)\n\t\t\n\t\tneighbors.each do |neighborObj|\t\t\t\n\t\t\tif neighborObj[:char] == word[index + 1]\n\t\t\t\t# print word, \" - \", word[index], \" \", neighborObj[:ch...
[ "0.66623473", "0.64739454", "0.6311996", "0.6246705", "0.6218237", "0.6092529", "0.60770255", "0.60002995", "0.5982743", "0.59796935", "0.596081", "0.5960215", "0.5957798", "0.5957798", "0.5924469", "0.58647686", "0.58647686", "0.5862222", "0.57722586", "0.5768632", "0.576582...
0.0
-1
Find the next row that contains given string
def ORIGnext_match str return unless str first = nil ## content can be string or Chunkline, so we had to write <tt>index</tt> for this. ## =~ does not give an error, but it does not work. @native_text.each_with_index do |line, ix| offset = 0 # next line just a hack and not correct if only one match in file FIXME offset = @curpos + 1 if ix == @current_index _col = line.index str, offset if _col first ||= [ ix, _col ] if ix > @current_index || ( ix == @current_index && _col > @curpos) return [ix, _col] end end end # if first is nil, then none found in current line also, so don't increment offset in current line # next time. FIXME TODO return first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(str)\n index = items.index {|i| i.index > current_row && i.name.start_with?(str)} || items.index {|i| i.name.start_with? str}\n move_cursor index if index\n end", "def find_next (matrix, word, index, start_row, start_col)\n\tif(index < word.length - 1)\n\t\tneighbors = find_neighbors(matrix...
[ "0.6725129", "0.6718731", "0.6509934", "0.6448449", "0.64366114", "0.6410759", "0.6375557", "0.6355379", "0.63376606", "0.6231505", "0.62160796", "0.6212064", "0.61023873", "0.6096099", "0.59024644", "0.58670944", "0.58477944", "0.58477944", "0.58467543", "0.5843705", "0.5834...
0.6259802
9
since 20140526 12:13 new logic to take into account multiple matches in one line First time, starts searching current line from cursor position onwards to end of file If no match, then checks from start of file to current line.
def next_match str, startline=nil, endline=nil # 1. look in current row after the curpos # 2. if no match look in rest of array # 3. if no match and you started from current_index, then search # from start of file to current_index. call _next_match with 0. _arr = _getarray if !startline startline = @current_index pos = @curpos + 1 # FIXME you could be at end of line #_line = _arr[startline] _line = to_searchable(startline) _col = _line.index(str, pos) if _line if _col return [startline, _col] end startline += 1 # FIXME check this end of file end # FIXME iterate only through the ones we need, not all _arr.each_with_index do |line, ix| next if ix < startline break if endline && ix > endline # next line just a hack and not correct if only one match in file FIXME line = to_searchable(ix) _col = line.index str if _col return [ix, _col] end end if startline > 0 return next_match str, 0, @current_index end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seek_pos lines, series\n i, j = 0, 0\n best_match = [nil, nil]\n while line = lines[i]\n i += 1\n if line !~ /^\\s*$/\n indent, _, _, pattern = series[j]\n return [i, j] if !indent # max match\n if line =~ pattern\n j += 1\n best_match = [i, j] if !best_match[1] or best_ma...
[ "0.64104724", "0.6364961", "0.6310056", "0.6199114", "0.60861266", "0.6046064", "0.599462", "0.596461", "0.5945588", "0.5848483", "0.5812246", "0.57936454", "0.57875437", "0.5782312", "0.57465637", "0.57146937", "0.5680232", "0.56452405", "0.5641671", "0.5638741", "0.5633111"...
0.7086668
0
search for the next occurence of given regexp. Returns line and col if found, else nil.
def next_regex regex if regex.is_a? Symbol regex = @text_patterns[regex] raise "Pattern specified #{regex} does not exist in text_patterns " unless regex end @last_regex = regex find_more end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _find_next regex=@last_regex, start = @search_found_ix \n raise \"No previous search\" if regex.nil?\n #$log.debug \" _find_next #{@search_found_ix} : #{@current_index}\"\n fend = @list.size-1\n if start != fend\n start += 1 unless start == fend\n @last_regex = regex\n @searc...
[ "0.70904464", "0.7022101", "0.69924724", "0.6901064", "0.6879615", "0.6737899", "0.66592616", "0.657626", "0.6543069", "0.6459748", "0.6280896", "0.60419905", "0.599671", "0.59566724", "0.59566724", "0.58882254", "0.5847537", "0.5843798", "0.5802095", "0.5802095", "0.5774254"...
0.5874899
16
convert the row to something we can run +index+ on. it should be exactly as the display will be, so find offsets are correct. Required for descendants such as Table.
def to_searchable index _getarray[index].to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def row(index)\n end", "def row index\n rows[index / 9]\n end", "def get_row_from_index(index)\n (index - 1) / 8 + 1\n end", "def get_row_from_index (idx)\n (idx/@cols).floor\n end", "def get_row_from_index(index)\n return (index - 1)/8 + 1\n end", "def row(position)\n position[...
[ "0.70437187", "0.69709855", "0.6793034", "0.6681363", "0.66401863", "0.65310144", "0.64495766", "0.6391371", "0.6366801", "0.6259756", "0.6245225", "0.6229187", "0.6206628", "0.61972725", "0.61911917", "0.61768", "0.6171322", "0.6158087", "0.61569214", "0.61140275", "0.607746...
0.0
-1
Ensure current row is visible, if not make it first row NOTE need to check if its at end and then reduce scroll at rows, check_prow does that
def ensure_visible row = @current_index unless is_visible? row @prow = row end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_visible row = @current_index\n unless is_visible? row\n @prow = @current_index\n end\n end", "def is_visible? index\n j = index - @prow #@toprow\n j >= 0 && j <= scrollatrows()\n end", "def bounds_check\n h = scrollatrow()\n rc = row_count\n #$log.debug \"...
[ "0.8158815", "0.7577258", "0.6668709", "0.64220434", "0.6415791", "0.6390818", "0.6369792", "0.6369792", "0.6369792", "0.63257396", "0.62380433", "0.6201237", "0.6180051", "0.6153826", "0.61525536", "0.5976124", "0.5964114", "0.5960185", "0.58408004", "0.5802726", "0.5792469"...
0.8092253
1
returns the row offset of the focussed row, based on what is visible this takes into account scrolling, and is useful if some caller needs to know where the current index is actually being displayed (example if it wishes to display a popup at that row) An argument is not being taken since the index should be visible.
def visual_index row = @current_index row - @prow end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_row\n @row_offset\n end", "def scrollatrow #:nodoc:\n if @suppress_borders\n return @height - 1\n else\n return @height - 3\n end\n end", "def scrollatrow #:nodoc:\n if @suppress_borders\n return @height - 1\n else\n return @height - 3...
[ "0.6556148", "0.6490237", "0.6490237", "0.6310142", "0.5922774", "0.58988655", "0.58957267", "0.5832196", "0.5822272", "0.58220035", "0.5795196", "0.57879514", "0.57800275", "0.5758834", "0.5748855", "0.5639501", "0.5635319", "0.56344795", "0.55645335", "0.5521518", "0.551950...
0.615627
4
have the renderer get the latest colors from the widget. Override this if for some reason the renderer wishes to hardcode its own. But then the widgets colors would be changed ?
def pre_render @attr = @source.attr cp = get_color($datacolor, @source.color(), @source.bgcolor()) @color_pair = @source.color_pair || cp @cp = FFI::NCurses.COLOR_PAIR(cp) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setcolorrep(*)\n super\n end", "def on_49(_) { fg: fg_color(9) } end", "def colors; end", "def colors\n return\n end", "def colorize!; @colors = true; end", "def spray_paint(new_color)\n self.color = new_color\n end", "def getDrawColor()\n return @drawColor\n end", "def defa...
[ "0.6454214", "0.61380965", "0.6072207", "0.6070166", "0.5994385", "0.58352643", "0.58231485", "0.58058196", "0.5802805", "0.58022606", "0.57943064", "0.57943064", "0.57943064", "0.5771725", "0.5677481", "0.56749535", "0.5654362", "0.56388855", "0.5638624", "0.56352144", "0.56...
0.5580064
23
derived classes may choose to override this. However, they should set size and color and attrib at the start since these can change after the object has been created depending on the application.
def render_all pad, arr pre_render @content_cols = @source.pad_cols @clearstring = " " * @content_cols @list = arr att = @attr || NORMAL FFI::NCurses.wattron(pad, @cp | att) arr.each_with_index { |line, ix| render pad, ix, line } FFI::NCurses.wattroff(pad, @cp | att) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(parent, x, y, r, opt = {})\r\n super(parent)\r\n @x = x\r\n @y = y\r\n @r = r\r\n @color = opt[:color]\r\n @frame_color = opt[:frame_color]\r\n @thickness = opt[:thickness] || 1\r\n end", "def xmlAttr()\r\n a = super()\r\n a << ['width', @width]\r\n a...
[ "0.6434326", "0.6427471", "0.6365772", "0.63187975", "0.61535764", "0.60746765", "0.6072068", "0.5968404", "0.59634244", "0.5957485", "0.59475", "0.594602", "0.59331167", "0.59043765", "0.5849479", "0.58159924", "0.5803353", "0.5767633", "0.575994", "0.5744262", "0.57402337",...
0.0
-1
concrete / derived classes should override this for their specific uses. Called if only a row is changed.
def render pad, lineno, text FFI::NCurses.mvwaddstr(pad, lineno, 0, @clearstring) if @clearstring FFI::NCurses.mvwaddstr(pad, lineno, 0, text) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_change(row)\n ETL::Engine.logger.debug \"Processing row: #{row.inspect}\"\n return unless row\n \n # Change processing can only occur if the natural key exists in the row \n ETL::Engine.logger.debug \"Checking for natural key existence\"\n unless has_natural_ke...
[ "0.65293044", "0.6477707", "0.6306532", "0.6204595", "0.60779023", "0.60052913", "0.5975752", "0.59739023", "0.59562445", "0.5917464", "0.58721745", "0.5830079", "0.5800735", "0.5781436", "0.5695599", "0.56936693", "0.56916916", "0.5674709", "0.5648913", "0.561435", "0.560297...
0.0
-1
returns true if at least one enterprise exists
def any_enterprise_exists? return @enterprises unless @enterprises.nil? enterprises = ctl_command(["list", "enterprises"]) @enterprises = (enterprises.chomp.length > 0) rescue Setup::Exceptions::EnterpriseCtlCommandFailed # Most likely to occur if the server is not yet configured or is shut down # Future iterations will add more granularity so that we can report # meaningful next steps (complete setup first, start services, etc) false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def company_must_have_one_hr\n if self.designation ==\"hr\"\n \tif Employee.where(:company_id=>self.company_id,:designation=>\"hr\").count ==1\n \t\tthrow :abort\n \telse\n \t\treturn true\n \tend\n end\n end", "def validate_enterprise\r\n expense = Expense.find(params[:id],:include=>'us...
[ "0.678486", "0.65516275", "0.65516275", "0.65048766", "0.6434395", "0.6354367", "0.6319197", "0.61783123", "0.61137027", "0.61027485", "0.6058057", "0.6053564", "0.5908611", "0.5906322", "0.58827305", "0.58640945", "0.5856612", "0.5845886", "0.5837365", "0.5827082", "0.582014...
0.7847704
0
XXX if state block missing, just run
def default_object # XXX end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state; end", "def state_machine()\n parse_sucess = false\n if event_block && optional_reset_block()\n # if event_block() && optional_reset_block() &...
[ "0.71632195", "0.71632195", "0.71632195", "0.71632195", "0.71632195", "0.71632195", "0.71632195", "0.71632195", "0.6972788", "0.69351554", "0.6738722", "0.66774243", "0.6655916", "0.651582", "0.65108806", "0.6503823", "0.6503823", "0.6503823", "0.64587635", "0.6407808", "0.63...
0.0
-1
method to print the menu options
def print_menu puts "1. Input the students" puts "2. Show the students" puts "3. Save the list to students.csv" puts "4. Load the list from students.csv" puts "5. Delete the list from students.csv" puts "9. Exit" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_menu_options\n\t\tputs \"----------------------------------------------\"\n\t\tputs \"1) Rename List | 2) Add task \"\n\t\tputs \"3) Complete task | 4) Uncomplete task\"\n\t\tputs \"5) Prioritize task | 6) Normalize task \"\n \t\tputs \"7) Add due date | 8) Remove du...
[ "0.81168884", "0.81142104", "0.79258263", "0.78728485", "0.7700979", "0.7700193", "0.7672838", "0.7641765", "0.74285537", "0.74161094", "0.74108547", "0.7396988", "0.7371523", "0.73648494", "0.7362514", "0.73619217", "0.7298522", "0.7275072", "0.72619617", "0.72453254", "0.71...
0.0
-1
method to loop back to the menu each time
def interactive_menu loop do print_menu process(STDIN.gets.chomp) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dat_menu() \n game_states.size == 1 && exit #fires if this is the only gamestate\n Chingu::Text.create 'Now leaving :(', size: 48, x: 200, y: 200, color: Gosu::Color::RED\n after(500) { $window.pop_game_state(setup: false) }\n end", "def return_to_recipe_list\n system \"clear\"\n main_menu(1)\nen...
[ "0.70633936", "0.6891324", "0.68510485", "0.6785818", "0.672497", "0.6717171", "0.6677987", "0.6677987", "0.6677755", "0.66382766", "0.66117173", "0.6578546", "0.65777576", "0.6547742", "0.65468264", "0.65468264", "0.65098155", "0.64877564", "0.6479387", "0.6462723", "0.64090...
0.0
-1
method to execute menu options
def process(selection) case selection when "1" input_students when "2" show_students when "3" save_students puts "List of students was saved to students.csv, #{@students.count} total students on list" when "4" load_students puts "Loaded students from students.csv, #{@students.count} total students on list" when "5" delete_students puts "Deleted all students from students.csv, #{@students.count} total students on list" when "9" exit # this will cause the program to terminate else puts "I don't know what you mean, try again" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def menu_options()\n print_message 'Select operation to perform'\n print_message '1. Add'\n print_message '2. Substract'\n print_message '3. Multiply'\n print_message '4. Divide'\n print_message \"Or press 'q' to exit calculator app\"\n end", "def display_and_run\n\n # prints ...
[ "0.720763", "0.7200622", "0.7089131", "0.70448405", "0.703296", "0.7000234", "0.6996241", "0.6952365", "0.69506", "0.6895124", "0.6866628", "0.68532085", "0.6827966", "0.68166167", "0.6815789", "0.68102103", "0.67704546", "0.6754814", "0.6744514", "0.6741523", "0.67180955", ...
0.0
-1
method to load the student file (you have to specify which file to load)
def load_students puts "Which file do you want to load?" file = STDIN.gets.chomp CSV.foreach(file) do |row| @name, cohort = row.shift write_students end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(file)\n @data = { :students => [] }\n @file = file\n load_data\n end", "def try_load_students\n filename = ARGV.first\n if filename.nil?\n return\n elsif File.exists? (filename)\n load_students(filename)\n else\n puts \"Sorry #{filename} doesn't exist\"\n ...
[ "0.7521808", "0.73146117", "0.7047017", "0.7047017", "0.7043822", "0.7009496", "0.7009496", "0.6996233", "0.69920474", "0.69744194", "0.69113076", "0.6834754", "0.6774671", "0.6767988", "0.6734855", "0.6733625", "0.67285764", "0.67197025", "0.67084396", "0.6697666", "0.668201...
0.6020941
71
method to save the student file (you have to specify which file to save)
def save_students puts "Which file do you want to save to?" file = STDIN.gets.chomp # open the file for writing CSV.open(file, "wb") do |csv| # iterate over the array of students @students.each do |student| student_data = [student[:name], student[:cohort]] csv_line = student_data csv.puts csv_line end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_student(filename)\n File.open(filename, \"w\") do |file|\n @students.each do |student|\n parse_to_save_file(student, file)\n puts \"File saved!\"\n interactive_menu\n end\n end\nend", "def save_students\n clear_terminal\n puts \"SAVE FILE\"\n puts \"-\" * \"SAVE FILE\".length\n...
[ "0.8127705", "0.74968046", "0.7221019", "0.70502526", "0.7016621", "0.7002402", "0.69640064", "0.6934205", "0.6897977", "0.68088955", "0.6742425", "0.67202365", "0.66922337", "0.66674024", "0.66674024", "0.66246134", "0.66114783", "0.65878713", "0.65837824", "0.6579344", "0.6...
0.64974236
27
method for inputting new students
def input_students puts "Please enter the names of the students you wish to add" puts "To finish, just hit return twice" # get the first name @name = STDIN.gets.chomp # while the name is not empty, repeat this code while !@name.empty? do # add the student hash to the array write_students puts "Added student, now #{@students.count} students total" # get another name from the user @name = STDIN.gets.chomp end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def input_students\n puts \"please put the names of the students, their cohort, their hobby and country of birth, seperated by a comma and space\".center(100)\n puts \"To finish just hit the return twice\".center(100)\n student_info = STDIN.gets.chomp\n # push student info into student adding loop\n student_loop(s...
[ "0.78787386", "0.74241775", "0.7270584", "0.7197623", "0.71606696", "0.7044644", "0.7036144", "0.7022092", "0.7012275", "0.69904006", "0.69576", "0.69559634", "0.694253", "0.6941483", "0.6931563", "0.69059694", "0.6905464", "0.6901569", "0.6881602", "0.68794346", "0.68784446"...
0.6737397
26
method for putting the new student name and cohort in the students array
def write_students @students << {name: @name, cohort: :november} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_students(name, cohort)\n @students << {name: name, cohort: cohort}\nend", "def update_students(name, cohort)\n @students << {name: name, cohort: cohort.to_sym}\nend", "def assign_students(name, cohort)\n @students << {name: name, cohort: cohort.to_sym, country_of_birth: :unknown, height: :unknown, ...
[ "0.78630984", "0.7847778", "0.7697358", "0.7626259", "0.748527", "0.74334574", "0.73181236", "0.7257659", "0.7196703", "0.7133071", "0.7065129", "0.7008927", "0.69305396", "0.688431", "0.6865392", "0.6855604", "0.6661027", "0.660383", "0.6593571", "0.6578855", "0.65239257", ...
0.80205816
0
method to print out the current list of students plus header and footer
def show_students print_header print_student_list print_footer end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_students\n print_header\n print_students_list\n print_footer\nend", "def show_students\n print_header\n print_students_list\n print_footer\nend", "def show_students\n print_header\n print_students_list\n print_footer\nend", "def show_students\n print_header\n print_students_list\n ...
[ "0.88584524", "0.8827324", "0.8827324", "0.8827324", "0.8742409", "0.8650158", "0.8044547", "0.71775895", "0.7136272", "0.71202785", "0.71143323", "0.7078664", "0.70699334", "0.7040747", "0.6988593", "0.6984566", "0.6960254", "0.69524735", "0.6946954", "0.6927445", "0.6915079...
0.8799992
5
method for printing header
def print_header puts "The students of Villains Academy".center(100) puts "-------------".center(100) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_header\n\t\t\"The students of Makers Academy\\n=======================================\"\nend", "def print_header\n \"#{\"Sl.\"} #{\"Description\".ljust(20)} #{\"Created time\".ljust(10)} #{\"Due by\".ljust(10)} #{\"Status\"}\"\n end", "def print_start_header()\n puts \">>>>>>>>>>>>>>>>...
[ "0.84471196", "0.8284639", "0.82684565", "0.82020056", "0.8179598", "0.8118474", "0.80601496", "0.80601496", "0.80403364", "0.8034761", "0.803246", "0.803246", "0.803246", "0.80271995", "0.8024462", "0.79983336", "0.79983264", "0.79634744", "0.7956853", "0.7934159", "0.789161...
0.73004836
55
method for printing student list
def print_student_list @students.each do |student| puts "#{student[:name]} (#{student[:cohort]} cohort)".center(100) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def student_displayer\n print_header\n print_students_list\n print_footer\nend", "def print_student_list\n #print the list if there is at least one student in there\n if @students.count > 0\n @students.each do |student|\n puts \"Name = #{student[:name]} (#{student[:cohort]} cohort), hobby = #{studen...
[ "0.79167753", "0.79093385", "0.7909228", "0.7839416", "0.78186023", "0.7752981", "0.7752981", "0.7752981", "0.7746608", "0.7746608", "0.7660623", "0.7621062", "0.7568935", "0.75576466", "0.75549525", "0.7500016", "0.74867755", "0.7463384", "0.74001783", "0.7382292", "0.736848...
0.7635994
11
method for printer footer
def print_footer puts "Overall, we have #{@students.count} great students".center(100) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_footer\n # TODO: Design footers.\n mvaddstr(@lines - 1, 10, 'sample footer')\n end", "def footer\n end", "def draw_footer; end", "def add_footer=(_arg0); end", "def print_foot\n return unless @print_footer\n ha = @_header_adjustment\n # ha takes into account whether...
[ "0.8367959", "0.8207133", "0.8033962", "0.80006456", "0.79950666", "0.78511035", "0.7815457", "0.77271026", "0.754458", "0.75295246", "0.74778366", "0.74778366", "0.74778366", "0.7329577", "0.727688", "0.71768", "0.7153947", "0.7067009", "0.7057621", "0.7031542", "0.7027194",...
0.6492501
57
method for deleting all students from students.CSV
def delete_students CSV.open("students.csv", "w") do |csv| @students.clear end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_students(db, student_name)\n\tdb.execute(\"DELETE FROM students WHERE name=?\", [student_name])\nend", "def del_csv(csv)\n stu_section = \"\"\n print_csv(csv)\n loop do\n puts \"Please enter the section that the student to be modified is currently in.\"\n stu_section = gets.strip\n if csv....
[ "0.6973524", "0.69483006", "0.69245654", "0.6836302", "0.65093935", "0.64900494", "0.6472234", "0.6211834", "0.61455643", "0.61037105", "0.61009073", "0.6098349", "0.60770875", "0.6052918", "0.6045542", "0.60404783", "0.60193294", "0.6009151", "0.59980524", "0.59948504", "0.5...
0.8542345
0
method to check if a file was supplied as an argument from the command line
def try_load_students filename = ARGV.first # first argument from the command line return if filename.nil? # get out of the method if it isn't given if File.exists?(filename) # if it exists load_students(filename) puts "Loaded #{@students.count} from #{filename}" else # if it doesn't exist puts "Sorry, #{filename} doesn't exist." exit end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_file_input?(command_line_arguments)\n\t\tcommand_line_arguments.any?\n\tend", "def check_args(args)\r\n args.count == 1\r\n File.exist?(ARGV[0].to_s)\r\nrescue StandardError\r\n false\r\nend", "def valid_arguments?\n begin\n if(@options.file)\n raise LoadError,\"The fil...
[ "0.8165", "0.7799413", "0.7415034", "0.7331821", "0.7331821", "0.7282832", "0.7282832", "0.7282832", "0.7229694", "0.70663106", "0.7052338", "0.69566417", "0.6935593", "0.6809401", "0.68093276", "0.67483336", "0.674458", "0.67019117", "0.66949034", "0.66901106", "0.66878736",...
0.0
-1
Construtor responsavel pela inicializacao dos arrays que armazenam os processos de tempo real e os processos de usuario
def initialize(real_time_memory=Concurrent::Array.new(64), user_memory=Concurrent::Array.new(960)) @real_time_memory = real_time_memory @user_memory = user_memory @logger = OSLog.instance end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize\n self.daily = Array.new\n self.incluidos=Array.new\n self.ingresados=Array.new\n\n end", "def crea(a)\n procs=[]\n a.each do\n |riga|\n (at,mt,et,sflo,sfhi,mf,ne,metro,nr)=riga\n delta=60.0/metro\n #brevettato\n 1.upto(nr...
[ "0.6217861", "0.58560675", "0.57919776", "0.5748471", "0.5620235", "0.55635697", "0.55424964", "0.5471092", "0.54554594", "0.5424291", "0.54124355", "0.5403154", "0.54015213", "0.53775215", "0.53309953", "0.5291548", "0.5257699", "0.524705", "0.5226523", "0.5225643", "0.51735...
0.61723816
1
Metodo responsavel pela soma dos tamanhos do array de processos de tempo real com o array de processos do usuario
def size @real_time_memory.size + @user_memory.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relatorio\n @users = User.all\n @total_por_usuario = []\n\n @users.each do |user| \n @pontos = Ponto.where(\"user_id = ?\", user.id)\n .by_month(Time.now.strftime(\"%B\"), field: :created_at)\n .order(\"created_at asc\")\n\n @segundos = 0\n\n @pon...
[ "0.63990885", "0.60185087", "0.57239354", "0.57211035", "0.54662186", "0.5426756", "0.54256463", "0.5383779", "0.5373795", "0.53641826", "0.5359766", "0.5341537", "0.53315634", "0.52863175", "0.5276768", "0.5268378", "0.5208788", "0.51999456", "0.5195166", "0.51944983", "0.51...
0.0
-1
Metodo responsavel por contar a quantidade de blocos preenchidos na memoria RAM
def written_blocks (@real_time_memory + @user_memory).reject(&:nil?).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memos; end", "def memos; end", "def memsize\n end", "def entry_size; BLOCK_SIZE; end", "def entry_size; BLOCK_SIZE; end", "def block_size; end", "def memsize; RAtlas::memsize(@storage);end", "def blksize() end", "def def_block_size\n 16384\n end", "def free_blocks\n free_space / BLO...
[ "0.72454745", "0.72454745", "0.7063821", "0.6700159", "0.6700159", "0.65982443", "0.6458289", "0.6398974", "0.6380208", "0.6359941", "0.6336004", "0.62204796", "0.6182949", "0.6129194", "0.6098661", "0.6086425", "0.608574", "0.60784936", "0.6078081", "0.60703444", "0.6062258"...
0.63744754
9
Metodo responsavel pela escritao de um processo na posicao de memoria passada como parametro
def write(memory, address, process) memory[address, process.memory_blocks] = Concurrent::Array.new(process.memory_blocks, process.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process\n end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def child_process(result)\n end", "def process(*)\n end", "def process(*)\n end", "def process!\n ...
[ "0.663361", "0.645939", "0.645939", "0.645939", "0.645939", "0.645939", "0.645939", "0.645939", "0.645939", "0.63515663", "0.61630476", "0.61630476", "0.6132365", "0.60642713", "0.6052186", "0.6035933", "0.59971064", "0.59962755", "0.59793305", "0.59619313", "0.5915857", "0...
0.0
-1
Metodo responsavel por retornar o indice do primeiro bloco capaz de alocar o processo
def initial_address(memory, process) initial_address = nil memory.each_with_index {|elem, index| next unless elem.nil? memory_slot = memory[index, process.memory_blocks] break if memory_slot.size < process.memory_blocks return index if memory_slot.all?(&:nil?) } initial_address end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def Com6 # Recuperation Info\n \n end", "def consulta\n puts self\n print \"Su respuesta: \" \n respuesta = gets.to_i\n return @respuestas[respuesta - 1].consulta\n end", "def index\n calcula_pagamento()\n puts \"ooooooooooooooooooooooo\"\n @inquilinos = Inquilino.order...
[ "0.53060204", "0.5270843", "0.52642596", "0.52507794", "0.52363807", "0.5231359", "0.5215297", "0.51841587", "0.5171831", "0.5165415", "0.5165415", "0.5165415", "0.5165415", "0.5165415", "0.5165415", "0.5165415", "0.5165415", "0.51474535", "0.514079", "0.5121693", "0.50948876...
0.0
-1
GET /conducta GET /conducta.json
def index @conducta = Conductum.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n format.json { render json: @contas.to_json, status: :ok...
[ "0.6875875", "0.66950685", "0.6644171", "0.6572382", "0.64194185", "0.6386707", "0.63780826", "0.63328415", "0.6323622", "0.62536824", "0.6251157", "0.6208846", "0.61857986", "0.6184175", "0.6183137", "0.61827844", "0.6176562", "0.612131", "0.6093761", "0.6078544", "0.6078135...
0.6547143
4
GET /conducta/1 GET /conducta/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @condclima = Condclima.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @condclima }\n end\n end", "def index\n @conducta = Conductum.all\n end", "def index\n @contas = Conta.all\n respond_to do |format|\n fo...
[ "0.68481183", "0.6470229", "0.64697045", "0.645027", "0.64459527", "0.6354574", "0.6311188", "0.62920994", "0.6265063", "0.61985785", "0.61920434", "0.616356", "0.61620086", "0.61617833", "0.6157691", "0.61049247", "0.6100927", "0.6100433", "0.6098033", "0.60979956", "0.60767...
0.0
-1
POST /conducta POST /conducta.json
def create @conductum = Conductum.new(conductum_params) @conductum.interno_id=params[:interno_id] @id=@conductum.interno_id if @conductum.save flash[:success] = 'Conducta fue creado exitosamente' redirect_to @conductum else render action: "new" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @condclima = Condclima.new(params[:condclima])\n\n respond_to do |format|\n if @condclima.save\n format.html { redirect_to @condclima, notice: 'Condclima was successfully created.' }\n format.json { render json: @condclima, status: :created, location: @condclima }\n else\...
[ "0.68307096", "0.65311253", "0.64429873", "0.63310575", "0.63118196", "0.6252936", "0.6249433", "0.6242621", "0.6224214", "0.6222692", "0.6200499", "0.6200308", "0.6194663", "0.6194543", "0.6182688", "0.61790574", "0.61601907", "0.6155308", "0.6136747", "0.6133459", "0.610690...
0.0
-1
PATCH/PUT /conducta/1 PATCH/PUT /conducta/1.json
def update if @conductum.update(conductum_params) flash[:success] = 'Conducta fue actualizado exitosamente' redirect_to @conductum else render action: "edit" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def api_patch(path, data = {})\n api_request(:patch, path, :data => data)\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'P...
[ "0.65259546", "0.6468038", "0.63249516", "0.62989795", "0.6168342", "0.6123454", "0.6119207", "0.6116387", "0.60941786", "0.60596275", "0.6039891", "0.60286826", "0.6021094", "0.6010192", "0.59554046", "0.5946287", "0.5927026", "0.5889824", "0.5864418", "0.5848223", "0.584275...
0.0
-1
DELETE /conducta/1 DELETE /conducta/1.json
def destroy @conductum.destroy respond_to do |format| format.html { redirect_to conducta_url, notice: 'Conductum was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @condclima = Condclima.find(params[:id])\n @condclima.destroy\n\n respond_to do |format|\n format.html { redirect_to condclimas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @contum = Contum.find(params[:id])\n @contum.destroy\n\n respond_to d...
[ "0.69513834", "0.6937668", "0.69371235", "0.68407905", "0.68109506", "0.6769065", "0.67430705", "0.6738562", "0.6733038", "0.6710306", "0.6692949", "0.6658278", "0.6650671", "0.66487664", "0.6648748", "0.66473556", "0.6636073", "0.6634271", "0.6628087", "0.66266376", "0.66210...
0.7109562
0
Use callbacks to share common setup or constraints between actions.
def set_conductum @conductum = Conductum.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163927", "0.6046165", "0.59465253", "0.59167755", "0.58904207", "0.58346355", "0.577713", "0.5703502", "0.5703502", "0.56531286", "0.56215113", "0.54224145", "0.5410795", "0.5410795", "0.5410795", "0.53924775", "0.5379919", "0.53580743", "0.53401667", "0.53397506", "0.533...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def conductum_params params.require(:conductum).permit(:estado, :fecha, :descripcion, :tipoConducta) 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.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
Consult README for inputs and outputs REMEMBER: This returns a new Array that represents the cart. Don't merely change `cart` (i.e. mutate) it. It's easier to return a new thing.
def consolidate_cart(cart) new_cart = [] index = 0 while index < cart.count do new_cart_item = find_item_by_name_in_collection(cart[index][:item], new_cart) if new_cart_item new_cart_item[:count] += 1 else new_cart_item = { :item => cart[index][:item], :price => cart[index][:price], :clearance => cart[index][:clearance], :count => 1 } new_cart << new_cart_item end index += 1 end return new_cart end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def consolidate_cart(cart)\n # Consult README for inputs and outputs\n #\n # REMEMBER: This returns a new Array that represents the cart. Don't merely\n # change `cart` (i.e. mutate) it. It's easier to return a new thing.\n new_cart = []\n counter = 0\n\n while counter < cart.length\n new_item = find_i...
[ "0.71814644", "0.7120606", "0.685776", "0.6843832", "0.67733616", "0.6526793", "0.6526793", "0.6526793", "0.6526793", "0.65173215", "0.64977545", "0.64473295", "0.64468557", "0.6440726", "0.6410025", "0.63601", "0.6356056", "0.63435656", "0.6297642", "0.6291744", "0.6289514",...
0.67650765
5
just reset state, no rewinding required
def finalize_current_entry if current_entry entry = current_entry super write_local_footer(entry) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset() end", "def reset_state\n @state = nil\n end", "def reset ; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "def reset; end", "de...
[ "0.8158254", "0.8106535", "0.80398476", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", "0.79770935", ...
0.0
-1
never need to do this because we set correct sizes up front
def update_local_headers nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def interpret_size(size); end", "def fit_width; end", "def size\n super\n end", "def size\n super\n end", "def validate_entry_sizes; end", "def size\n width * height\n end", "def update_size(x,y)\n @width = x if x > @width\n @height = y if y > @height\n end", "def check_for_...
[ "0.6728039", "0.6628523", "0.6606491", "0.6606491", "0.6432852", "0.6425753", "0.633641", "0.6330907", "0.630625", "0.6283679", "0.6270597", "0.6260265", "0.6221208", "0.61683446", "0.61683446", "0.61683446", "0.61679167", "0.6122533", "0.6122533", "0.61126727", "0.61022896",...
0.0
-1
helper to deal with difference between rubyzip 1.0 and 1.1
def current_entry @currentEntry || @current_entry end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_zip64_support; end", "def write_zip64_support=(_arg0); end", "def zip\n @zip\n end", "def zipfile; end", "def p7zip\n if OS.windows?\n '7z'\n else\n '7za'\n end\nend", "def zip_contents; end", "def zip\n end", "def p7zip\n if OS.windows?\n \"7z\"\n else\n \"7za\"\n...
[ "0.70807207", "0.6973575", "0.6525443", "0.6504104", "0.65015894", "0.6477093", "0.64304966", "0.6390365", "0.6328257", "0.6283289", "0.62784684", "0.6173174", "0.61046124", "0.6045184", "0.59938085", "0.59803164", "0.5962997", "0.59616655", "0.5934437", "0.5922277", "0.59199...
0.0
-1
whose sum is a given target and the return an array with two elements' indexes
def twosum(array, target) return [] if array.length<=1 cache = {} array.each.with_index do |e,i| if cache.include? (target-e) return [i,cache[target-e]] else cache[e] = i end end return [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_sum(nums, target)\n indices_array = []\n i = 0\n while i < nums.length\n j = i + 1\n while j < nums.length\n if nums[i] + nums[j] == target\n indices_array << i\n indices_array << j\n end\n j += 1\n end\n i += 1\n end\n return indice...
[ "0.79231346", "0.7910445", "0.7891439", "0.78889745", "0.78163004", "0.7800195", "0.77895904", "0.77849674", "0.77841544", "0.773899", "0.77373004", "0.7730696", "0.7699577", "0.7671639", "0.76681465", "0.76655734", "0.76634973", "0.76583374", "0.76110375", "0.75917864", "0.7...
0.7145831
46
Given an array of integers return check if there exists any two elements whose sum is a given target and the return an array with two elements
def twosumtwo(a, target) return [] if a.length <= 1 l = 0; r = a.length-1 a.sort! while l < r do if a[l] + a[r] == target return [a[l],a[r]] elsif (a[l] + a[r]) < target l = l+1 else r = r+1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_sum(array, target)\n\n !!array.uniq.combination(2).detect { |a, b| a + b == target }\nend", "def bad_two_sum?(arr, target)\n sums = []\n arr.each_index do |i|\n (i+1...arr.length).each do |j|\n sums << arr[i] + arr[j]\n end\n end\n sums.include?(target)\nend", "def okay_two_sum?(arr, tar...
[ "0.82747173", "0.8015385", "0.79170084", "0.7843083", "0.77690774", "0.77667487", "0.77297217", "0.7710644", "0.76617265", "0.7655423", "0.76376104", "0.7636382", "0.76265436", "0.76111627", "0.76091516", "0.7587602", "0.7580741", "0.7576766", "0.7559702", "0.7548497", "0.754...
0.0
-1
''' do the feedforward prediction of a piece of data'''
def predict(input) l_size = input.shape[0] az = Numo::DFloat.zeros(l_size,@nhidden) ar = Numo::DFloat.zeros(l_size,@nhidden) ahhat = Numo::DFloat.zeros(l_size,@nhidden) ah = Numo::DFloat.zeros(l_size,@nhidden) a1 = tanh((input.dot @w1) + @b1) pp "a1 is ============" pp a1 pp a1[1,0...a1.shape[1]] # (array slice view) http://ruby-numo.github.io/narray/narray/Numo/DFloat.html#[]-instance_method x = (Numo::DFloat.zeros(@nhidden)).concatenate(a1[1,0...a1.shape[1]]) az[1,0...az.shape[1]] = sigm((x.dot @wz) + @bz) ar[1,0...ar.shape[1]] = sigm((x.dot @wr) + @br) ahhat[1,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh) ah[1,0...ah.shape[1]] = az[1,0...az.shape[1]]*ahhat[1,0...ahhat.shape[1]] # for i in range(1,l_size): (1...l_size).each do |i| x = ah[i-1,0...ah.shape[1]].concatenate(a1[i,0...a1.shape[1]]) az[i,0...az.shape[1]] = sigm((x.dot @wz) + @bz) ar[i,0...ar.shape[1]] = sigm((x.dot @wr) + @br) x = (ar[i,0...ar.shape[1]]*ah[i-1,0...ah.shape[1]]).concatenate(a1[i,0...a1.shape[1]]) ahhat[i,0...ahhat.shape[1]] = tanh((x.dot @wh) + @bh) ah[i,0...ah.shape[1]] = (1-az[i,0...az.shape[1]])*ah[i-1,0...az.shape[1]] + az[i,0...az.shape[1]]*ahhat[i,0...ahhat.shape[1]] end a2 = tanh((ah.dot @w2) + @b2) return a1,az,ar,ahhat,ah,a2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(x, batch_size: 100)\r\n Utils.check_input_data_type(\"x\", x, Xumo::SFloat)\r\n start_predict(x, batch_size: batch_size)\r\n update while predicting?\r\n predicted_data\r\n end", "def forward\n new_x, new_y = forward_prediction\n reset(x: new_x, y: new_y, f: @f)\n...
[ "0.68265074", "0.6555507", "0.6473412", "0.6462847", "0.6322826", "0.62622887", "0.6238955", "0.6191132", "0.616354", "0.6133924", "0.6104707", "0.6070679", "0.6064781", "0.6046157", "0.60189146", "0.5957466", "0.59361255", "0.5934161", "0.59271795", "0.59084404", "0.59084404...
0.57652414
26
GET /distribuidoras/1 GET /distribuidoras/1.xml
def show @distribuidora = Distribuidora.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @distribuidora } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @distribuidora = Distribuidora.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @distribuidora }\n end\n end", "def index\n @distributions = @foyer.distributions\n\n respond_to do |format|\n format.html # index.html.erb\n for...
[ "0.6187773", "0.616497", "0.6089344", "0.60586214", "0.58994526", "0.5753805", "0.5740534", "0.5701603", "0.5679858", "0.5677561", "0.56107754", "0.559459", "0.55925345", "0.55841756", "0.55609685", "0.55431014", "0.554075", "0.5535941", "0.5535941", "0.5506956", "0.5486245",...
0.69744486
0
GET /distribuidoras/new GET /distribuidoras/new.xml
def new @distribuidora = Distribuidora.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @distribuidora } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @distribuidora = Distribuidora.new(params[:distribuidora])\n\n respond_to do |format|\n if @distribuidora.save\n format.html { redirect_to(@distribuidora, :notice => 'Distribuidora was successfully created.') }\n format.xml { render :xml => @distribuidora, :status => :created...
[ "0.68960637", "0.68505126", "0.6741998", "0.67090005", "0.66841775", "0.6603702", "0.6583628", "0.6579958", "0.65781", "0.6556591", "0.651749", "0.651259", "0.64950323", "0.64941514", "0.6466458", "0.64659107", "0.64659107", "0.64659107", "0.6454337", "0.6444949", "0.6439585"...
0.7767563
0
POST /distribuidoras POST /distribuidoras.xml
def create @distribuidora = Distribuidora.new(params[:distribuidora]) respond_to do |format| if @distribuidora.save format.html { redirect_to(@distribuidora, :notice => 'Distribuidora was successfully created.') } format.xml { render :xml => @distribuidora, :status => :created, :location => @distribuidora } else format.html { render :action => "new" } format.xml { render :xml => @distribuidora.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @distribuidor = Distribuidor.new(distribuidor_params)\n\n respond_to do |format|\n if @distribuidor.save\n format.html { redirect_to @distribuidor, notice: 'El distribuidor a sido creado.' }\n format.json { render :show, status: :created, location: @distribuidor }\n else\...
[ "0.66260546", "0.62649053", "0.6042767", "0.60369694", "0.59779376", "0.59317267", "0.5824947", "0.5748544", "0.5594747", "0.5593735", "0.5489059", "0.5474605", "0.5461806", "0.5361725", "0.5320989", "0.53198135", "0.5305665", "0.5281854", "0.5255108", "0.5254367", "0.5247842...
0.6919824
0
PUT /distribuidoras/1 PUT /distribuidoras/1.xml
def update @distribuidora = Distribuidora.find(params[:id]) respond_to do |format| if @distribuidora.update_attributes(params[:distribuidora]) format.html { redirect_to(@distribuidora, :notice => 'Distribuidora was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @distribuidora.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n respond_to do |format|\n if @distribuidor.update(distribuidor_params)\n format.html { redirect_to @distribuidor, notice: 'El distribuidor a sido modifi...
[ "0.6308281", "0.61849505", "0.59567606", "0.5758376", "0.5728061", "0.571419", "0.5655888", "0.55749714", "0.555185", "0.55478334", "0.55428946", "0.55316025", "0.5504669", "0.5470641", "0.54175675", "0.5413772", "0.54008734", "0.5371229", "0.535071", "0.5350015", "0.5328711"...
0.6412814
0
DELETE /distribuidoras/1 DELETE /distribuidoras/1.xml
def destroy @distribuidora = Distribuidora.find(params[:id]) @distribuidora.destroy respond_to do |format| format.html { redirect_to(distribuidoras_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @distribuidor.destroy\n respond_to do |fo...
[ "0.65516883", "0.65429753", "0.64918596", "0.6454731", "0.63199556", "0.6296042", "0.6264669", "0.62246567", "0.6211916", "0.62030464", "0.6181874", "0.61744374", "0.6138825", "0.61334425", "0.61217", "0.6104946", "0.6051056", "0.6009156", "0.59846157", "0.59624875", "0.59590...
0.71558267
0
Helper method for returning the JBoss CLI.
def jboss_cli 'bin/jboss-cli.sh -c' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cli_options\n { returns: [0],\n user: node[:jboss][:user],\n cwd: node[:jboss][:home]\n }\n end", "def command_line\n Launchy::CommandLine.new\n end", "def cli_prefix; end", "def jboss_product\n @cli_executor.jboss_product\n end", "def run(cmd)\n shell_out! ...
[ "0.68202376", "0.6532817", "0.647592", "0.644203", "0.6432166", "0.6422714", "0.6263959", "0.61593693", "0.61024725", "0.60753655", "0.60591143", "0.60077673", "0.5995255", "0.58979625", "0.588078", "0.58281857", "0.5822237", "0.5820167", "0.5789973", "0.5784234", "0.5782417"...
0.80934775
0
A list of options passed to shell_out.
def cli_options { returns: [0], user: node[:jboss][:user], cwd: node[:jboss][:home] } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def io_options\n options.select { |k, _| [:append_output, :stdout].include? k }\n end", "def option_list\n result = @options.dup\n result << \"-o\" << @rdoc_dir\n result << \"--main\" << main if main\n result << \"--markup\" << markup if markup\n result << \"--title\" << title...
[ "0.6764756", "0.6732246", "0.6626262", "0.6480855", "0.6395107", "0.63340586", "0.62069154", "0.6204494", "0.6197707", "0.614645", "0.6140401", "0.6119246", "0.6019203", "0.6018179", "0.5996087", "0.59949434", "0.5982738", "0.5973635", "0.59560466", "0.5942193", "0.5940524", ...
0.54318905
96
Run the command, writing the command's standard out and standard error to stdout and stderr, and saving its exit status object to status.
def run(cmd) shell_out! "#{jboss_cli} '#{cmd}'", cli_options end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_command(command)\n command = \"true\" if command.to_s.strip.empty?\n with_shell_instance do\n stdin.puts wrapped_command(command)\n stdin.close\n out, err = stdout.read, stderr.read\n out, status, _ = raw_stdout_to_parts(out)\n return status, out, ...
[ "0.6896079", "0.6887307", "0.67680556", "0.67030084", "0.67030084", "0.67030084", "0.67030084", "0.66324073", "0.65925866", "0.65838945", "0.6582919", "0.65289026", "0.6526067", "0.6526067", "0.6496445", "0.6494327", "0.64830387", "0.6432739", "0.64027315", "0.64001846", "0.6...
0.0
-1
Provide a common Monitor to all providers for locking.
def lock @@lock ||= Monitor.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lock\n @lock ||= Monitor.new\n end", "def lock\n @@locks.synchronize do\n @@locks[@path] ||= Monitor.new\n @@locks[@path]\n end\n end", "def monitor\n raise NotImplementedError\n end", "def mon_synchronize(&b)\n mon_data = defined?(@mon_data) ? @mon_data : us...
[ "0.68122834", "0.6069008", "0.6036651", "0.59153134", "0.5898546", "0.5847953", "0.57272524", "0.56622976", "0.5627301", "0.5622176", "0.5604719", "0.5596719", "0.55822414", "0.55729324", "0.55664164", "0.5540866", "0.553396", "0.54927176", "0.54760975", "0.54590976", "0.5433...
0.6758413
1
get '/ages/:age_id/gifts', to: 'giftsindex_by_age'
def index_by_age @age = Age.find(params[:age_id]) @gifts = @age.gifts render json: @gifts, include: :ages, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_by_age_sorted_by_price\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index_by_user\n @gifts = @current_user.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n if params[:t...
[ "0.742997", "0.6494152", "0.63359535", "0.6296733", "0.62277526", "0.61084586", "0.6088144", "0.60879076", "0.6075354", "0.60113025", "0.6005913", "0.6005913", "0.5932806", "0.59013414", "0.5824361", "0.5821645", "0.5770103", "0.5754126", "0.57417154", "0.5720364", "0.5708883...
0.79120505
0
get '/ages/:age_id/gifts_by_price', to: 'giftsindex_by_age_sorted_by_price'
def index_by_age_sorted_by_price @age = Age.find(params[:age_id]) @gifts = @age.gifts render json: @gifts, include: :ages, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_by_age\n @age = Age.find(params[:age_id])\n @gifts = @age.gifts\n render json: @gifts, include: :ages, status: :ok\n end", "def index\n order = sortable_column_order, \"gage_number desc\"\n @gages = Gage.paginate page: params[:page], order: order, per_page: 50\n respond_to do |format...
[ "0.7339749", "0.6596248", "0.6306616", "0.6172551", "0.61470884", "0.6141002", "0.6130922", "0.58669597", "0.5858431", "0.58461475", "0.5839283", "0.5839283", "0.5822318", "0.57394564", "0.57383674", "0.5734671", "0.5734671", "0.57340485", "0.5714981", "0.57039404", "0.570378...
0.8120757
0
get '/gifts', to: 'gifts/index_by_user'
def index_by_user @gifts = @current_user.gifts render json: @gifts, include: :ages, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n user = current_user\n\n @giftees = Giftee.where(:user_id => user.id)\n \n \n end", "def index\n if params[:tag]\n @gifs = Gif.tagged_with(params[:tag]).order(:total_score => :desc).all\n elsif params[:user]\n @gifs = User.find_by_username(params[:user]).gifs.order(:total_...
[ "0.7601195", "0.73558277", "0.69485897", "0.672554", "0.66569537", "0.661492", "0.661492", "0.6537713", "0.6490912", "0.64715147", "0.64404684", "0.6429894", "0.64020294", "0.63799185", "0.6366434", "0.63212633", "0.62926227", "0.627097", "0.6266717", "0.6252903", "0.6232316"...
0.7432006
1
get '/gifts/:id', to: 'giftsindex_single_gift'
def index_single_gift render json: @gift, include: :ages, status: :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @gift = Gift.find(params[:id])\n end", "def index\n @gifts = Gift.all\n end", "def index\n @gifts = Gift.all\n end", "def show\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @gift }\n end\n end"...
[ "0.7103631", "0.6902037", "0.6902037", "0.68801886", "0.6641421", "0.6576607", "0.652258", "0.651783", "0.6422546", "0.64174634", "0.63649714", "0.63618135", "0.63618135", "0.63524336", "0.62388873", "0.6209265", "0.6209265", "0.6209265", "0.6209265", "0.6209265", "0.6209265"...
0.6088455
26
post '/ages/:age_id/gifts', to: 'giftsadd_new'
def add_new @age = Age.find(params[:age_id]) @gift = Gift.new(gift_params) @current_user.gifts << @gift # @current_user.gifts << @gift this shovels and saves at the same time if @age.gifts << @gift render json: {gift: @gift}, status: :created else render json: { error: @gift.errors }, status: :unprocessible_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @garrage = Garrage.new(garrage_params)\n @garrage.user_id = current_user.id\n\n respond_to do |format|\n if @garrage.save\n format.html { redirect_to garrage_stuffs_path(@garrage), notice: 'Garrage was successfully created.' }\n format.json { render :show, status: :created,...
[ "0.64268774", "0.6420502", "0.63318413", "0.63303745", "0.6312796", "0.60814995", "0.60542816", "0.6052922", "0.60320956", "0.5936152", "0.59317744", "0.5911589", "0.5887342", "0.58384544", "0.5760741", "0.5725303", "0.57199764", "0.5719575", "0.5704651", "0.56987154", "0.568...
0.6613666
0
put '/gifts/:giftid', to: 'giftsupdate'
def update if @gift.user == @current_user if @gift.update(gift_params) render json: @gift, include: :ages else render json: @gift.errors, status: :unprocessable_entity end else render json: { errors: "not authorized" }, status: :unauthorized end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @gift = Gift.find(params[:id])\n\n respond_to do |format|\n if @gift.update_attributes(params[:gift])\n format.html { redirect_to @gift, notice: 'Gift was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n ...
[ "0.736414", "0.722621", "0.722621", "0.7164252", "0.69656503", "0.6938207", "0.68850124", "0.68850124", "0.67900985", "0.67900985", "0.67900985", "0.67900985", "0.67900985", "0.67900985", "0.67900985", "0.67900985", "0.67900985", "0.6744933", "0.662713", "0.6465567", "0.64122...
0.6509497
19
destroy '/gifts/:id', to: 'giftsdestroy'
def destroy if @gift.user == @current_user @gift.destroy render json: {gift: @gift}, status: :ok else render json: { errors: "not authorized" }, status: :unauthorized end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @gif.destroy\n respond_to do |format|\n format.html { redirect_to gifs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @indexed_gif = IndexedGif.find(params[:id])\n @indexed_gif.destroy\n\n respond_to do |format|\n format.html { redirect_to in...
[ "0.790917", "0.78280663", "0.777479", "0.76962453", "0.7532224", "0.74703705", "0.74129206", "0.7367616", "0.73383164", "0.7332925", "0.73281217", "0.72753584", "0.72575444", "0.7230234", "0.7199076", "0.7198712", "0.7191573", "0.7185004", "0.71839523", "0.7183294", "0.717511...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_gift @gift = Gift.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163754", "0.6045816", "0.5944853", "0.59169096", "0.58892167", "0.58342934", "0.5776148", "0.57057375", "0.57057375", "0.56534296", "0.56209534", "0.54244673", "0.54101455", "0.54101455", "0.54101455", "0.53951085", "0.5378493", "0.53563684", "0.53399915", "0.5338049", "0...
0.0
-1
Only allow a trusted parameter "white list" through.
def gift_params params.require(:gift).permit(:name, :image_url, :amazon_url, :for_girls, :for_boys, :price_range) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121862", "0.70524937", "0.6947974", "0.69016707", "0.6735245", "0.67157984", "0.66887176", "0.66779864", "0.6660236", "0.6554225", "0.6527208", "0.6456831", "0.6451704", "0.64509416", "0.64478475", "0.6432556", "0.6411603", "0.6411603", "0.6389978", "0.63789994", "0.63789...
0.0
-1
is_integer? takes in a number returns true for Fixnums and Bignums (whole number or 'integer' types) returns true for Floats (decimals) equal to integers returns false for noninteger decimals returns false for Float::NAN returns false for nonnumbers is_prime? takes in a number and checks if it's prime returns false for noninteger decimals returns false for numbers less than or equal to 1 returns false for numbers divisible by anything but 1 and themselves returns true for prime numbers Hint: google prime numbers!
def is_prime(number) if number == Float return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prime?(integer)\n return false if integer < 2 || (integer.even? && integer != 2)\n\n n = Math.sqrt(integer).floor\n (2..n).none? { |x| (integer % x).zero? }\nend", "def prime?(integer)\n\ttrial_divisions = (2..1000000).to_a #turns string into array\n\ttest = trial_divisions.detect {|i| (integer % i) == 0...
[ "0.7775016", "0.77722275", "0.76901084", "0.75549227", "0.7550575", "0.74969375", "0.7486571", "0.7428204", "0.73803496", "0.7378897", "0.73701465", "0.73701465", "0.7345692", "0.7305838", "0.7288817", "0.72083104", "0.7181447", "0.7181447", "0.7168202", "0.7165744", "0.71512...
0.7701626
2
GET /users GET /users.json
def index @users = User.all if name = params[:name] @users = User.joins(:university).where(universities: {name: name}) end render json: @users end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n para...
[ "0.82097304", "0.7873201", "0.7859711", "0.7810757", "0.78054243", "0.7677531", "0.76581895", "0.7632243", "0.7582378", "0.7529056", "0.7487394", "0.7448642", "0.743942", "0.74375093", "0.74266934", "0.73983777", "0.73983777", "0.73983777", "0.73983777", "0.73761976", "0.7373...
0.0
-1
GET /users/1 GET /users/1.json
def show render json: @user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.81049806", "0.77023244", "0.77010894", "0.7625595", "0.75821865", "0.74811673", "0.74603444", "0.7446582", "0.7305236", "0.72992796", "0.72888285", "0.72772574", "0.72345036", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", "0.72321355", ...
0.0
-1
POST /users POST /users.json
def create @university = University.find_or_initialize_by(name: university_params) al = 0 if current_user && current_user.admin? al = params[:authorization_level] end @user = User.new(user_params.merge(university: @university, authorization_level: al)) if @user.save render json: {:message => "success"}.to_json, status: :created @user.send_activation_email else render json: @user.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.7717216", "0.75203925", "0.73826534", "0.72408456", "0.7198273", "0.71413374", "0.7104663", "0.70592535", "0.7041866", "0.70243144", "0.70035493", "0.7002658", "0.7002658", "0.7002658", "0.6993813", "0.6990762", "0.69811314", "0.697928", "0.697928", "0.6979072", "0.6976808...
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update @university = University.find_or_initialize_by(name: university_params) if params[:payments] == "delete" and current_user.authorization_level == 'admin' @user.update(payments: []) end if @user.update(user_params.merge(university: @university.id)) render json: @user else render json: @user.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.7225487", "0.71291554", "0.7003983", "0.6903858", "0.682214", "0.6816166", "0.6708457", "0.66937435", "0.6680848", "0.6674177", "0.6672642", "0.66645867", "0.66645867", "0.6660262", "0.6660262", "0.6654932", "0.66482556", "0.66436964", "0.6642245", "0.6635296", "0.6618284"...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.7875345", "0.77512276", "0.7713299", "0.76091963", "0.7471578", "0.74069583", "0.74069583", "0.73691666", "0.7345325", "0.7339192", "0.73272485", "0.7309725", "0.73092926", "0.73057216", "0.7296841", "0.72904414", "0.7290419", "0.72891515", "0.72831494", "0.7249661", "0.72...
0.0
-1
Returns a copy of this counter, with the local Meangirls node's value incremented by delta.
def +(delta) clone.increment(Meangirls.node, delta) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delta\n prev = self.val\n self.class.new(self) do |v, s|\n v - prev.tap { prev = v }\n end\n end", "def __to_inc__\n self\n end", "def increment!\n @value += @increment\n \n self\n end", "def increment\n curr_value = counter\n self.coun...
[ "0.61804694", "0.5957244", "0.5895278", "0.5887541", "0.5811977", "0.5629292", "0.5623353", "0.55038923", "0.54640174", "0.5418411", "0.54057795", "0.5396978", "0.53745764", "0.53585386", "0.53565985", "0.5340919", "0.5305906", "0.52926385", "0.5230885", "0.5208914", "0.52089...
0.69893765
0
Use callbacks to share common setup or constraints between actions.
def set_order @order = current_user.orders.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163443", "0.604317", "0.5943409", "0.59143174", "0.5887026", "0.58335453", "0.57738566", "0.5701527", "0.5701527", "0.56534666", "0.5618685", "0.54237175", "0.5407991", "0.5407991", "0.5407991", "0.5394463", "0.5376582", "0.5355932", "0.53376216", "0.5337122", "0.5329516"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def order_params params.require(:order).permit( :transaction_id, :paypal_id, :paypal_email, :date_received, :shipping_name, :shipping_address1, :shipping_address2, :shipping_address3, :shipping_address4, :shipping_address5, :payment_total, :payment_subtotal, :shipping_total, :user_id, order_items_attributes: [:id, :description, :item_number, :unit_price, :quantity, :order_id, :user_id] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980244", "0.6782812", "0.6745103", "0.6741142", "0.6733961", "0.65925", "0.6503602", "0.64967257", "0.64822173", "0.64796996", "0.6456357", "0.6439594", "0.63803256", "0.6376499", "0.63644457", "0.6319286", "0.6299465", "0.6298051", "0.62935406", "0.62923044", "0.6291212"...
0.0
-1
I found this function on the internets somewhere modified it to be more efficient in the context of this program. It calls oneach for each random element it selects, but returns early after count calls
def fisher_yates_shuffle(a, count, &oneach) (a.size-1).downto(1) { |i| j = rand(i+1) a[i], a[j] = a[j], a[i] if i != j yield(a[i]) count-=1 return if count==0 } yield(a[0]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_random_element_with_one_loop\n\tget_random_element\nend", "def select(pop,fit,fitsum,totalfit)\n r = rand()\n j = 0\n while fitsum[j+1]/totalfit <= r\n j += 1\n end\n return j\nend", "def random\n all[rand(count)]\n end", "def random\n if (c = count) != 0\n find(:first...
[ "0.6701416", "0.6348616", "0.6320195", "0.627743", "0.62251186", "0.61866635", "0.61401343", "0.61254674", "0.6075061", "0.6038423", "0.6017392", "0.6013049", "0.6010472", "0.60103065", "0.5960981", "0.59596664", "0.5951863", "0.59306306", "0.59306306", "0.5926755", "0.592548...
0.594113
17
Initializes a new protected range object
def initialize(options = {}) parse_options options yield self if block_given? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(base, range, pointer = nil)\n @base = base\n @range = range\n @pointer = pointer\n end", "def initialize(min, max=min)\n @begin, @end = coerce(min), coerce(max)\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.iP...
[ "0.7596457", "0.74997175", "0.7494417", "0.74060225", "0.73639804", "0.73631245", "0.73631245", "0.73631245", "0.73631245", "0.7356895", "0.7269028", "0.72483873", "0.7151154", "0.71458095", "0.70814735", "0.7021703", "0.6986933", "0.69675314", "0.68604094", "0.68263644", "0....
0.0
-1
serializes the proteted range
def to_xml_string(str = +'') serialized_tag 'protectedRange', str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @_range\n end", "def json\n @@id += 1\n if @options\n charset = @options[:reg_options].charset\n else\n charset = \"d\"\n end\n \"{\" +\n \"\\\"type\\\": \\\"LEX_RANGE\\\", \" +\n \"\\\"id\\\": \\\"G#{@@id}\\\", \" +\n \"\\\"begin\\\"...
[ "0.67659086", "0.6244632", "0.60928965", "0.6083333", "0.60343885", "0.6022383", "0.5848796", "0.5844386", "0.58203673", "0.58203673", "0.5812808", "0.5766375", "0.57019836", "0.57019836", "0.57019836", "0.57019836", "0.5654798", "0.5630043", "0.56280345", "0.5623989", "0.559...
0.62566733
1
Returns 401 response. To handle malformed / invalid requests.
def invalid_authentication render json: { error: 'Invalid Request' }, status: :unauthorized end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_unauthorized\n logger.debug \" *** UNAUTHORIZED REQUEST: '#{request.env['HTTP_AUTHORIZATION']}' ***\"\n self.headers['WWW-Authenticate'] = 'Token realm=\"Application\"'\n render json: {error: \"Bad credentials\"}, status: 401\n end", "def unauthorized\n [ 401, {'Content-Type' ...
[ "0.76328546", "0.758432", "0.75080186", "0.749968", "0.74849254", "0.74807656", "0.74807656", "0.74807656", "0.74807656", "0.74807656", "0.7479978", "0.7453964", "0.7421042", "0.74079967", "0.7392542", "0.7365732", "0.7352652", "0.7327427", "0.7274686", "0.7274686", "0.727468...
0.74525934
15
Deconstructs the Authorization header and decodes the JWT token.
def payload auth_header = request.headers['Authorization'] token = auth_header.split(' ').last JsonWebToken.decode(token) rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decode_token\n #token in header\n if auth_header\n #JWT as a string \n token = auth_header.split(' ')[1]\n #header: { 'Authorization': 'Bearer <token>' }\n #begin/rescue allows us to rescue out of an exception in Ruby \n begin\n ...
[ "0.76351947", "0.7585592", "0.75312334", "0.7512804", "0.737356", "0.72972506", "0.7248826", "0.7101624", "0.69801533", "0.6833541", "0.67919844", "0.6788746", "0.6782993", "0.67570865", "0.6692855", "0.6655688", "0.6631123", "0.66262865", "0.6600745", "0.6598726", "0.6586241...
0.6642419
20
getter def radius not using return as it seems that is not desirable in rubyworld.
def area Math::PI * (self.radius ^ 2) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def radius\n end", "def c_radius \n Math.sqrt((@x*@x)+(@y*@y))\n end", "def radius #:nodoc:\n 0\n end", "def radius #:nodoc:\n 0\n end", "def radius\n RANDOM_RADIUS / 111300\n end", "def base_radius\n 200\n end", "def radius\n \twidth / 2\n end", "def s_ra...
[ "0.84077036", "0.79165953", "0.7835088", "0.7835088", "0.76787716", "0.75941914", "0.75642806", "0.73777485", "0.7233905", "0.72159696", "0.7206138", "0.7186769", "0.71102095", "0.7081524", "0.70755684", "0.70755684", "0.7005391", "0.6982297", "0.6966869", "0.6935148", "0.688...
0.6502251
39