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
what can it do
def name (name) @name = name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def suivre; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def operations; end", "def operations; end", "def formation; end", "def berlioz; end", "def who_we_are\r\n end", "def terpene; end",...
[ "0.71564245", "0.7099721", "0.691293", "0.66757196", "0.66709125", "0.66709125", "0.66709125", "0.66709125", "0.65342927", "0.65342927", "0.6503778", "0.6439634", "0.6430328", "0.6420799", "0.6389896", "0.6316146", "0.6316146", "0.63094395", "0.629723", "0.62489974", "0.62225...
0.0
-1
Render multiple boxes. Takes as argument a single array of Hash For the Hash options, please see render_box. The boxes are wrapped in a div with class "textboxes". You can pass individual styling using :textboxes_style => textboxes_style. You can specify a template Hash ( :template => template ) which will be merged with each indivdual's box's options Hash. This way, you can create a list of boxes that look the same but some have their own characteristics. Also adds a div with style "clear: both" after the output so other objects won't start floating. If you don't want that, add :noclear => true as an option.
def render_boxes(array = [], options = {}) boxes = "" template = {} if options[:template].class.to_s.eql?("Hash") template = options[:template] end array.each do |individual_options| box_options = template box_options = template.merge(individual_options) unless individual_options.nil? r = render_box(box_options) unless individual_options[:link].blank? r = "<a href='#{individual_options[:link]}' target='#{individual_options[:link_target]}' class='no_underline render_boxes'>#{r}</a>" end boxes += r unless r.blank? end boxes_div = content_tag :div, boxes, :class => "textboxes", :style => options[:textboxes_style] clear_both_ = "" unless options[:noclear] === true clear_both_ = clear_both end boxes_div + clear_both_ end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def render_box(options = {})\n # list of classes for the outer div.\n outer_div_classes = [ \"textbox_container\" ]\n # inner div, same story\n inner_div_classes = [ \"textbox\" ]\n # heading\n heading_classes = [ \"heading\" ]\n\n content = yield if block_given?\n content ||= options[:cont...
[ "0.6464205", "0.5841228", "0.56698936", "0.5520285", "0.55042785", "0.5450058", "0.54241514", "0.52830034", "0.5258477", "0.5247274", "0.5208967", "0.5190762", "0.51529074", "0.514873", "0.5145886", "0.5129254", "0.50793684", "0.5023993", "0.50237775", "0.5003811", "0.4992348...
0.81510353
0
Render a box. options: content (string) heading (string) float_left (true/false) text_align_center (true/false) highlight (true/false) background_image (url) bigfont (true/false) heading_color (color name, e.g. 'red') background_color (color name, e.g. 'blue') inner_div_style (css style, e.g. "width: 382px; height: 281px;") outer_div_style (same) heading_style (same) height (css style unit, e.g. "100px" or "6em") solid_background (true/false) You can wrap an tag around the box and it will have a:hover CSS enabled, e.g. link_to " do = render_box do "bar"
def render_box(options = {}) # list of classes for the outer div. outer_div_classes = [ "textbox_container" ] # inner div, same story inner_div_classes = [ "textbox" ] # heading heading_classes = [ "heading" ] content = yield if block_given? content ||= options[:content] return nil if content.blank? && options[:heading].blank? unless options[:empty] # Options: # float_left outer_div_classes.push("float_left") if options[:float_left] === true # text_align_center inner_div_classes.push("text_align_center") if options[:text_align_center] === true # highlight inner_div_classes.push("highlight") if options[:highlight] === true # background_image background_image = options[:background_image] # header color heading_color = options[:heading_color] inner_div_classes.push("textbox_#{heading_color}") unless heading_color.blank? # background color background_color = options[:background_color] ############################################################################ # inner div ############################################################################ inner_div_classes.push("#{background_color}_background") unless background_color.blank? inner_div_options = { :class => c(inner_div_classes) } inner_div_styles = [] unless background_image.blank? # opacity:0.4;filter:alpha(opacity=40); inner_div_styles.push "background: url(#{background_image}) no-repeat center;" end unless options[:height].blank? inner_div_styles.push "height: #{options[:height]}" end unless options[:width].blank? inner_div_styles.push "width: #{options[:width]}" end unless inner_div_styles.blank? inner_div_options[:style] = c(inner_div_styles) end inner_div_options[:style] ||= options[:inner_div_style] # can be overridden ############################################################################ # outer div ############################################################################ outer_div_options = { :class => c(outer_div_classes) } outer_div_options[:style] = options[:outer_div_style] ############################################################################ # text div ############################################################################ text_div_options = {} text_div_classes = [] text_div_classes.push "bigfont" if options[:bigfont] === true text_div_classes.push "solid_background" if options[:solid_background] === true text_div_options[:class] = c(text_div_classes) ############################################################################ # go render ############################################################################ # let's go, outer div content_tag :div, outer_div_options do content_tag :div, inner_div_options do # heading heading = "" heading = content_tag :p, options[:heading], :class => c(heading_classes), :style => options[:heading_style] unless options[:heading].blank? # text div content_tag_ = content_tag :div, text_div_options do content_tag :p, content, :class => "inner_p" end # do it! heading + content_tag_ end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prettybox(html_options, &proc)\n raise ArgumentError, \"Missing block\" unless block_given?\n concat(tag(\"div\", html_options, true), proc.binding)\n concat(\"<div class=\\\"prettybox_top\\\">\n <div>&nbsp;</div>\n </div><div class=\\\"prettybox_inside\\\">\", proc.binding)\n yield\n co...
[ "0.66518354", "0.64276874", "0.63438886", "0.62945646", "0.6275616", "0.62258786", "0.5826013", "0.57734585", "0.575188", "0.5711554", "0.5708607", "0.5708331", "0.56436723", "0.56094885", "0.5501951", "0.5469089", "0.54682136", "0.5411976", "0.54065824", "0.5400691", "0.5351...
0.74547935
0
If you want to put two boxes side by side, they both have to be float: left Add this tag after the last one to prevent other blocks from floating.
def clear_both content_tag :div, nil, :class => "clear_both" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def field_block(cols = 2, &block)\n css_class = \"float_left\"\n css_class << \"_#{cols}\" unless cols == 2\n concat('<div class=\"'+ css_class +'\">', block.binding)\n yield\n concat('</div>', block.binding)\n concat('<div style=\"clear:both;\"></div>', block.bin...
[ "0.58390015", "0.52419776", "0.5044535", "0.4948103", "0.48815846", "0.48268345", "0.47270834", "0.46595266", "0.4517622", "0.4507763", "0.4491649", "0.44737348", "0.44705626", "0.44566122", "0.44476724", "0.44317672", "0.4430788", "0.44307515", "0.4428931", "0.44123876", "0....
0.47190097
7
c: convert array to string just like to_s but with a space between them.
def c(array = []) str = "" for a in array str += a + " " end str.strip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def back_to_s(array)\n array.join(\"\")\nend", "def string(arr)\n arr.join(\" \")\nend", "def array_to_string(arr)\n arr.map { |e| \"'#{sanitize(e)}'\" }.join(\",\")\n end", "def to_s\n to_a.join(' ')\n end", "def to_s\n to_a.join(' ')\n end", "def encode_array(arr)\n arr.join ...
[ "0.82369655", "0.7931556", "0.79197073", "0.7643666", "0.76374394", "0.75368977", "0.74581146", "0.74581146", "0.74540716", "0.74323225", "0.7426978", "0.73795867", "0.7360123", "0.7338302", "0.7338302", "0.7338302", "0.7333398", "0.7329531", "0.72759765", "0.7265223", "0.726...
0.72650313
20
allow users to update their accounts without passwords
def update_without_current_password(params, *options) params.delete(:current_password) if params[:password].blank? && params[:password_confirmation].blank? params.delete(:password) params.delete(:password_confirmation) end result = update_attributes(params, *options) clean_up_passwords result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_without_password(params, *options); end", "def update_with_password(params, *options); end", "def update_resource(resource, params)\n if params[\"password\"]&.present? or params[\"email\"]&.present?\n return super\n else\n resource.update_without_password(params.except(\"current_pass...
[ "0.77653825", "0.73083836", "0.7171343", "0.7103088", "0.70882946", "0.7053925", "0.7053925", "0.7053925", "0.7053925", "0.7053925", "0.7053925", "0.7053925", "0.7053925", "0.7053925", "0.7053925", "0.70126736", "0.70057464", "0.700406", "0.70012176", "0.69952846", "0.6980737...
0.64955616
78
def mtdarry 10.times do |num| puts num end end mtdarry and the program: def mtdarry 10.times do |num| puts num end end puts mtdarry
def mtdarry 10.times do |num| puts num end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mtdarry\n 10.times do |num|\n puts num\n end\nend", "def using_times\n $num.times do\n puts \"Wingardium Leviosa\"\n end\nend", "def integer_print_10\n 10.times do |x|\n puts x \n end \nend", "def pTimes2(statement,num)\n num.times do\n puts statement\n end\nend", "def using_times \n 7...
[ "0.8742151", "0.7306706", "0.7197621", "0.7103111", "0.7101599", "0.7080987", "0.6975314", "0.6974177", "0.69270074", "0.69239324", "0.69062734", "0.6882265", "0.6867385", "0.6845959", "0.6826359", "0.6723819", "0.67074376", "0.67071843", "0.66990864", "0.66575956", "0.664275...
0.8713106
3
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
def new_input_set() return AddURLInputSet.new() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(input_set = nil)\n # If the inputs are not configured, create a blank set.\n if input_set == nil\n input_set = InputSet.new()\n end\n param_map = {\"source_id\" => TembooSession.get_identifier()}\n body = input_set.format_inputs()\n results = @session.post_request(get_path(), bod...
[ "0.66497", "0.6483957", "0.6319194", "0.63119155", "0.62781215", "0.6270611", "0.62674415", "0.6260382", "0.62576175", "0.62385845", "0.62293905", "0.6219069", "0.6185865", "0.61762726", "0.61523426", "0.61429346", "0.61131257", "0.6100583", "0.60944587", "0.6078606", "0.6077...
0.0
-1
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
def execute(input_set = nil) resp = super(input_set) results = AddURLResultSet.new(resp) return results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n ...
[ "0.7595022", "0.75631005", "0.756171", "0.7473159", "0.72565645", "0.72401345", "0.72373563", "0.71919423", "0.7141123", "0.71391577", "0.7119281", "0.7119281", "0.7119281", "0.7119281", "0.7119281", "0.71159613", "0.7106211", "0.7098456", "0.7098221", "0.70703983", "0.706935...
0.0
-1
Set the value of the Selection input for this Choreo.
def set_Selection(value) set_input("Selection", value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_selection\n @selection = Selection.find(params[:id])\n end", "def selected=(selected)\n @selected = selected\n update_cursor\n end", "def set_selection(*args)\n # Check for a cell reference in A1 notation and substitute row and column\n if args[0] =~ /^\\D/\n args = substitute...
[ "0.6730609", "0.60064816", "0.59250665", "0.55305684", "0.54792243", "0.5294307", "0.5193717", "0.5160014", "0.50771934", "0.49670652", "0.49642852", "0.49552462", "0.4897551", "0.48896053", "0.48892686", "0.48653993", "0.47962394", "0.47817543", "0.47708645", "0.4731124", "0...
0.72626334
0
Set the value of the Title input for this Choreo.
def set_Title(value) set_input("Title", value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_title(title)\n @title = title\n end", "def title=(title)\n if title.nil?\n fail ArgumentError, 'invalid value for \"title\", title cannot be nil.'\n end\n @title = title\n end", "def title=(title)\n if title.nil?\n fail ArgumentError, 'invalid value for \"title\...
[ "0.7805282", "0.77696145", "0.77696145", "0.7668345", "0.7668345", "0.7668345", "0.7668345", "0.76442933", "0.7638002", "0.7638002", "0.7638002", "0.7638002", "0.7638002", "0.7638002", "0.7638002", "0.7618395", "0.7618395", "0.7618395", "0.7618395", "0.7618395", "0.7618395", ...
0.7820923
0
Set the value of the URL input for this Choreo.
def set_URL(value) set_input("URL", value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url=(value)\n @url = value\n Curl.set_option(:url, value_for(value, :string), handle)\n end", "def set_URL(value)\n set_input(\"URL\", value)\n end", "def set_URL(value)\n set_input(\"URL\", value)\n end", "def set_URL(value)\n set_input(\"URL\"...
[ "0.8073227", "0.76355296", "0.76355296", "0.76355296", "0.76355296", "0.76355296", "0.76355296", "0.76355296", "0.71796364", "0.71796364", "0.71796364", "0.71796364", "0.71796364", "0.70758444", "0.6956582", "0.68834627", "0.68829864", "0.68481743", "0.6793545", "0.6757589", ...
0.78341466
1
Set the value of the Username input for this Choreo.
def set_Username(value) set_input("Username", value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username=(username)\n validate_options(username: username)\n @username = username\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n se...
[ "0.7176145", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035",...
0.720891
8
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
def new_input_set() return AuthenticateInputSet.new() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(input_set = nil)\n # If the inputs are not configured, create a blank set.\n if input_set == nil\n input_set = InputSet.new()\n end\n param_map = {\"source_id\" => TembooSession.get_identifier()}\n body = input_set.format_inputs()\n results = @session.post_request(get_path(), bod...
[ "0.6651932", "0.6483557", "0.632022", "0.6310716", "0.6279258", "0.6270703", "0.6267418", "0.6260844", "0.6256668", "0.6238553", "0.622937", "0.62193567", "0.61860573", "0.6176299", "0.6150794", "0.6143215", "0.61124265", "0.6099851", "0.6094492", "0.60777086", "0.6077177", ...
0.0
-1
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
def execute(input_set = nil) resp = super(input_set) results = AuthenticateResultSet.new(resp) return results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "def execute(input_set = nil)\n ...
[ "0.7593966", "0.7562012", "0.75606173", "0.74745876", "0.7255611", "0.7239773", "0.72373766", "0.7190971", "0.7141743", "0.7138197", "0.7119328", "0.7119328", "0.7119328", "0.7119328", "0.7119328", "0.7114557", "0.71045625", "0.7097668", "0.7096947", "0.7071564", "0.7068732",...
0.0
-1
Set the value of the Username input for this Choreo.
def set_Username(value) set_input("Username", value) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username=(username)\n validate_options(username: username)\n @username = username\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n set_input(\"Username\", value)\n end", "def set_Username(value)\n se...
[ "0.7176145", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035", "0.69219035",...
0.720891
9
Show locations or events based on choice
def admin_choice @choice = params[:choice] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def location_switch_label\n if outside_location.blank?\n \"other\"\n else\n \"pick one from the list\"\n end\n end", "def show_menu\n\n menu_pick = @prompt.select('Please select a menu option: ') do |menu|\n menu.choice 'Show Events by Country', 'find by country'\n menu.choice 'S...
[ "0.6550271", "0.6291964", "0.6285029", "0.62697446", "0.62322617", "0.61553884", "0.6131257", "0.6030089", "0.5974883", "0.59326524", "0.591444", "0.5911638", "0.5851388", "0.58241403", "0.5823944", "0.57971764", "0.57905614", "0.5777028", "0.5760865", "0.5749241", "0.5742668...
0.0
-1
Show location based on selection
def select_locations if params[:status] == "pending" @locations = Location.where(status: "pending").order('updated_at ASC').paginate(page: params[:page], per_page: 10) elsif params[:status] == "accepted" @locations = Location.where(status: "accepted").order('updated_at ASC').paginate(page: params[:page], per_page: 10) elsif params[:status] == "declined" @locations = Location.where(status: "declined").order('updated_at ASC').paginate(page: params[:page], per_page: 10) elsif params[:status] == "all" @locations = Location.all.order('updated_at ASC').paginate(page: params[:page], per_page: 10) else @locations = Location.where(status: "pending").order('updated_at ASC').paginate(page: params[:page], per_page: 10) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show_location\n\n end", "def location_switch_label\n if outside_location.blank?\n \"other\"\n else\n \"pick one from the list\"\n end\n end", "def set_location\n LocationHelper.browse_location(params['select_location'], current_user)\n end", "def show_selected_locations(query, ar...
[ "0.72246563", "0.70836264", "0.69254565", "0.64676356", "0.64052504", "0.6343469", "0.6172598", "0.60997164", "0.60342556", "0.60231566", "0.60148776", "0.6014681", "0.5956577", "0.5956577", "0.5956577", "0.5956577", "0.5943234", "0.58837545", "0.5880966", "0.58531857", "0.58...
0.0
-1
Show logout instead of link to adminpage on adminpanel
def show_logout @show_logout = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logout\n if @user != nil and @user.admin?(@routes)\n show :logout, views: File.join(Classiccms::ROOT, 'views/cms')\n end\n end", "def logout\n session.delete(:admin_password)\n redirect_to admin_login_path\n end", "def logout\n @logout_message = \"You have successfully logged ...
[ "0.7869341", "0.7371892", "0.73304105", "0.71523815", "0.7088891", "0.7064473", "0.70633715", "0.7058166", "0.6968901", "0.69150984", "0.6904809", "0.68289655", "0.6823173", "0.68124586", "0.681163", "0.681163", "0.681163", "0.6787559", "0.6779616", "0.6779616", "0.6776586", ...
0.7381453
1
Pause the current track
def pause; self.app.pause end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pause\n @paused += 1\n end", "def pause\n @paused = true\n end", "def pause\n @paused = true\n end", "def pause\n unless(@paused)\n @paused = true\n reset\n end\n current_self\n end", "def pause!\n @state = :paused\n end", "def pause!\n @...
[ "0.7822946", "0.77286905", "0.77286905", "0.7508161", "0.7437753", "0.7257708", "0.7246991", "0.7092195", "0.70725775", "0.70659554", "0.70659554", "0.70659554", "0.70573574", "0.70322376", "0.7000362", "0.7000362", "0.69799197", "0.69732195", "0.6967805", "0.6967805", "0.693...
0.600692
69
Stop the current track
def stop; self.app.stop end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop\n if @playing\n @should_stop = true\n end\n end", "def on_stop (track)\n end", "def stop\n if running?\n @log.info \"Stopping tracker...\"\n @trackers.each_value {|tracker| tracker.stop}\n @running = false\n else\n @log...
[ "0.786155", "0.7728812", "0.7270189", "0.72044474", "0.72044474", "0.71125084", "0.7085592", "0.705722", "0.7054395", "0.70497006", "0.6992938", "0.6992938", "0.6992938", "0.6992938", "0.6992938", "0.6992938", "0.6992938", "0.6992938", "0.69823134", "0.6972386", "0.6972386", ...
0.0
-1
Sets the current position in the track
def position=(position) self.app.player_position.set(position.to_f) rescue nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_position=(new_current_position)\n Klass.setCurrentPosition(@handle, @index, new_current_position.to_i)\n\t new_current_position\n end", "def seek(position)\n current.position = position if position\n\n self\n end", "def update_position\n end", "def update_position\n end"...
[ "0.7136796", "0.70751524", "0.7071571", "0.7071571", "0.7071571", "0.6931389", "0.6926014", "0.683678", "0.6696016", "0.66864717", "0.6680258", "0.6644065", "0.6627005", "0.6627005", "0.6586475", "0.65845835", "0.65783316", "0.6549046", "0.65422994", "0.6503704", "0.6495198",...
0.64787465
22
Receiving messages from client and sending to other clients
def client_handler(client, all_clients) client.puts 'Welcome to server, stranger!' loop do msg = client.gets if msg.nil? puts 'Client disconnected' break end all_clients.each { |dest| send_msg(msg, dest) if dest != client } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process_messages\n\t\t\tloop do\n\t\t\t\tchan, message = @redis_listener.blpop(\"#{PREFIX}.network:#{@network}.messages\", 0)\n\t\t\t\t@log.debug(\"A client sent the message : #{message}\")\n\t\t\t\tmsgid, command, args = parse(message)\n\t\t\t\tunless command\n\t\t\t\t\t@log.warn(\"A client sent an invalid me...
[ "0.73470896", "0.7064501", "0.69389194", "0.69049066", "0.68902683", "0.68148494", "0.680604", "0.67075753", "0.66322184", "0.6594547", "0.65687734", "0.65055674", "0.649664", "0.64837456", "0.6478959", "0.646703", "0.64556307", "0.64452773", "0.6444162", "0.64072937", "0.636...
0.714587
1
get only the storage, moving and truck companies
def filter_records_and_build_listings(records) @category = ''; @wanted = []; @rejected = []; @wanted_rows = []; count = 0; total = records.size @storage_regex = /(storage)|(stge)|(strge)|(container)|(warehouse)/i @truck_regex = /(truck)/i @moving_regex = /(moving)|(mover)|(van line)/i records.each_with_index do |row, i| @listing = nil # column mappings begin title = row[0].titleize address = (row[2] || '').titleize city = (row[3] || '').titleize state = row[4] zip = row[5].split(/-|\s/)[0] phone = row[6] contact_title = row[9] contact_first_name = row[7] contact_last_name = row[8] web_address = row[1] sic_description = row[10] unless Listing.find(:first, :include => :map, :conditions => ['LOWER(listings.title) = ? AND LOWER(maps.address) = ? AND LOWER(maps.city) = ? AND LOWER(maps.state) = ? AND LOWER(maps.zip) = ? AND maps.phone = ?', title.downcase, address.downcase, city.downcase, state.downcase, zip.downcase, phone]) if sic_description =~ @storage_regex || title =~ @storage_regex @category = 'Storage' @listing = Listing.new :title => title, :enabled => true, :default_logo => rand(6), :category => @category build_listing_features! title, sic_description elsif sic_description =~ @truck_regex || title =~ @truck_regex @category = 'Trucking' @listing = Listing.new :title => title, :enabled => true, :category => @category elsif sic_description =~ @moving_regex || title =~ @moving_regex @category = 'Moving' @listing = Listing.new :title => title, :enabled => true, :category => @category end if @listing @listing.build_map :address => address, :city => city, :state => state, :zip => zip, :phone => phone @listing.build_contact :title => contact_title, :first_name => contact_first_name, :last_name => contact_last_name, :phone => phone, :sic_description => sic_description @wanted << @listing @wanted_rows << row puts "Added (#{percent_of(count, total)} done) (#{@category}) #{@listing.title} [#{sic_description}] - #{@listing.city}, #{@listing.state}" else @rejected << row puts "Rejected (#{percent_of(count, total)} done): #{title}, Description: #{sic_description}" end else @rejected << row puts "Already have (#{percent_of(count, total)} done): #{title}, Description: #{sic_description}" end count += 1 rescue => e puts "Row #{i} had bad data. Row: #{row.inspect}\nError: #{e.message}\nDetails: #{e.inspect}" end end @filtered = { :wanted => @wanted, :rejected => @rejected, :wanted_rows => @wanted_rows } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def companies\n private_companies + major_companies\n end", "def getcompany\n Company.company_than(need_calc_company)\n end", "def companies\n return [] unless basecamp\n @companies ||= basecamp.companies\n end", "def thorins_company; end", "def other_companies\r\n companies\r\n...
[ "0.68780994", "0.63347614", "0.6331536", "0.6326407", "0.6272238", "0.62294704", "0.62115926", "0.61885047", "0.61815214", "0.6166791", "0.6157467", "0.6154713", "0.6143255", "0.6142684", "0.6132214", "0.610327", "0.6092068", "0.60668546", "0.6064127", "0.60580295", "0.603626...
0.0
-1
Helper for model classes. Allows for convenient instantiation of current athlete. This is completely agnostic to class type, it can be a DB model, a PORO, etc. Usage: class Account Strava::Athlete Can also perform lookup through another method: class User < ApplicationRecord has_one :account include Strava.model as: :athlete, via: 'account.token', id: 'account.strava_id' end
def model(as: :strava_athlete, via: :access_token, id: nil) Module.new.tap do |mod| str = <<~EOF def self.included(base) base.send(:define_method, :#{as}) { ::Strava::Athlete.new(#{id ? "{'id' => #{id}}" : '{}' }, token: #{via}, current: true) } end EOF mod.class_eval str end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def associate_one(person, account_class)\n return unless person\n\n account = account_class.find_by_secdn(person.dn)\n\n new(person, account)\n end", "def ar_resource\n return unless type && id\n return unless self.class.union_models.include?(type.to_sym)\n\n ...
[ "0.52092934", "0.511394", "0.5069212", "0.50299656", "0.5023484", "0.4993129", "0.49767023", "0.49451876", "0.49443752", "0.49165156", "0.4914349", "0.49054357", "0.48659104", "0.4865236", "0.48552924", "0.4853309", "0.48528898", "0.48528898", "0.48528898", "0.48528898", "0.4...
0.723099
0
Reverse the word order of a given string =begin doctest: reverse word order of a string >> s = "This is test line one." >> reverse_word_order(s) => "one. line test is This" doctest: Lines are handled this way >> s = "This is test line one.\nThis is test line two." >> reverse_word_order(s) => "two. line test is This one. line test is This" =end
def reverse_word_order string string.split.reverse.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reverse_word_order(str)\n str.split.reverse.join(' ')\nend", "def word_reverse(str)\n p str.split(' ').reverse.join(' ')\nend", "def wordReverse(string)\n\tp string.split(\" \").reverse().join(\" \")\nend", "def reverse_words(string)\n words = string.split()\n words.each_with_index { |word, index| ...
[ "0.7666444", "0.7598045", "0.7538827", "0.741925", "0.74179643", "0.74103767", "0.740417", "0.7379643", "0.7379643", "0.7373929", "0.73467344", "0.73209673", "0.7309497", "0.7302201", "0.7295405", "0.7286302", "0.72851825", "0.7282557", "0.7274572", "0.72719157", "0.72685456"...
0.77907425
0
This method is autogenerated. Do not change directly.
def to_sdd_xml(meta, xml) xml.send(meta[:xml_name]) do self.class.xml_fields.each do |field| if self[field[:db_field_name]] if self[field[:db_field_name]].is_a? Array logger.debug 'Translating to XML and the object is an Array' self[field[:db_field_name]].each_with_index do |instance, index| xml.send(:"#{field[:xml_field_name]}", instance, 'index' => index) end else xml.send(:"#{field[:xml_field_name]}", self[field[:db_field_name]]) end end end # go through children if they have something to add, call their methods kids = self.class.children_models unless kids.nil? || kids.empty? kids.each do |k| models = send(k[:model_name].pluralize) models.each do |m| m.to_sdd_xml(k, xml) end end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def custom; end", "def custom; end", "def schubert; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def refutal()\n end", "def implementation; end", "def implementation; end", "def probers; end", "def attribute; end", "def attribut...
[ "0.7373633", "0.65087914", "0.65087914", "0.645239", "0.6378533", "0.6378533", "0.6378533", "0.6378533", "0.6254785", "0.62208474", "0.62208474", "0.6191855", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.61281425", "0.6120204", "0.611...
0.0
-1
This method been overloaded to not do anything because if you import an existing SDD XML then it should not load the materials, rather, it will will read from the database to get the material layers
def create_children_from_sdd_json(meta, h) # Materials should not be import return true # legacy code -- # Go through the children self_model = meta[:model_name].camelcase(:upper).constantize kids = self_model.children_models unless kids.nil? || kids.empty? kids.each do |k| # check if the kids have a json object at this level if h[k[:xml_name]] logger.debug "XML child is #{k[:xml_name]}" logger.debug "Model name is #{k[:model_name]}" if h[k[:xml_name]].is_a? Array logger.debug "#{k[:xml_name]} is an array, will add all the objects" h[k[:xml_name]].each do |h_instance| klass = k[:model_name].camelcase(:upper).constantize if klass.respond_to? :from_sdd_json model = klass.from_sdd_json(k, h_instance) # Assign the foreign key on the object model["#{meta[:model_name]}_id"] = id model.save! else logger.warn "Class #{klass} does not have instance method 'from_sdd_json'" end end elsif h[k[:xml_name]].is_a? Hash logger.debug "#{k[:xml_name]} is a single object, will add only one" klass = k[:model_name].camelcase(:upper).constantize if klass.respond_to? :from_sdd_json model = klass.from_sdd_json(k, h[k[:xml_name]]) # Assign the foreign key on the object model["#{meta[:model_name]}_id"] = id model.save! else logger.warn "Class #{klass} does not have instance method 'from_sdd_json'" end end end end end # end legacy code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_material(material_name)\n # First check model and return material if it already exists\n self.getMaterials.each do |material|\n if material.name.get.to_s == material_name\n OpenStudio::logFree(OpenStudio::Debug, 'openstudio.standards.Model', \"Already added material: #{material_name}\")\n...
[ "0.5989781", "0.5866443", "0.58146", "0.58146", "0.5582218", "0.5562461", "0.54327744", "0.5393348", "0.5391727", "0.5388659", "0.53873897", "0.5367174", "0.53637314", "0.5362144", "0.53528416", "0.5346108", "0.52761114", "0.5260748", "0.5244348", "0.5230568", "0.52272516", ...
0.0
-1
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement. CREATE TABLE projects ( id INTEGER PRIMARY KEY, title TEXT, category TEXT, funding_goal INTEGER, start_date TEXT, end_date TEXT ); CREATE TABLE users ( id INTEGER PRIMARY KEY, name TEXT, age INTEGER ); CREATE TABLE pledges ( id INTEGER PRIMARY KEY, amount INTEGER, user_id INTEGER, project_id INTEGER );
def selects_the_titles_of_all_projects_and_their_pledge_amounts_alphabetized_by_name "SELECT projects.title, SUM(pledges.amount) FROM projects INNER JOIN pledges ON projects.id = pledges.project_id GROUP BY projects.title ORDER BY projects.title;" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def select_category_from_projects\n\"SELECT category FROM projects;\"\nend", "def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\n\"SELECT projects.category, pledges.amount\nFROM pledges\nINNER JOIN projects\nON projects.id = pledges.project_id\nWHERE projects.category = 'musi...
[ "0.85798305", "0.7391567", "0.69657433", "0.6950588", "0.6634899", "0.662993", "0.6523316", "0.6484258", "0.64634806", "0.6426333", "0.63640916", "0.63552696", "0.63456184", "0.63089365", "0.6301092", "0.62780017", "0.6228032", "0.6221488", "0.6173391", "0.61261296", "0.61195...
0.5787372
98
Replace this with your real tests.
def test_truth assert true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def testing\n # ...\n end", "def __dummy_test__\n end", "def tests; end", "def tests; end", "def spec; end", "def spec; end", "def self_test; end", "def self_test; end", "def test \n end", "def test_0_dummy\n\t\tend", "def test\n\n end", "def test\n end", "def test\n end"...
[ "0.7444841", "0.6954491", "0.6913394", "0.6913394", "0.6863823", "0.6863823", "0.66389537", "0.66389537", "0.66238844", "0.6545616", "0.6523148", "0.64830077", "0.64830077", "0.64830077", "0.6406177", "0.6389718", "0.6389718", "0.6389718", "0.6389718", "0.6389718", "0.6389718...
0.0
-1
define equality between two entities by iterating over instance variables and comparing each field for equality
def ==(entity) rval = true self.instance_variables.each { |variable| rval &= self.instance_variable_get(variable) == entity.instance_variable_get(variable) } rval end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def object_equal(obj1, obj2)\n vars1 = obj1.instance_variables\n vars2 = obj2.instance_variables\n return false unless vars1.length == vars2.length\n # if they don't have exactly the same instance_variables names then return false\n return false unless vars1.map(&:to_s).sort.to_s == vars2.map(&:to_s).sort.to_...
[ "0.6365919", "0.6288923", "0.6226688", "0.62169", "0.6111295", "0.6087191", "0.598765", "0.5970042", "0.59560186", "0.59450203", "0.5894917", "0.5863724", "0.58579576", "0.5838317", "0.58370423", "0.58349097", "0.5823593", "0.58083266", "0.5806187", "0.5801017", "0.58009577",...
0.660682
1
undesignate_package params is passed from 'form_nested_params_for_undesignate'
def undesignate(undesignate_package = nil) packages = undesignate_package ? undesignate_package : @params OrdersPackage.undesignate_partially_designated_item(packages) @package.reload.undesignate_from_stockit_order end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unsolved_params\n \n end", "def drop_extra_params!(form, params)\n form_data = form['properties']['data']['properties']\n allowed_params = form_data['attributes']['properties'].keys rescue nil\n params['data'].fetch('attributes', {}).slice!(*allowed_params) if allowed_params.present?\n ...
[ "0.5887348", "0.5579017", "0.550668", "0.5481046", "0.5415299", "0.5408723", "0.5318543", "0.5298929", "0.5264611", "0.523779", "0.5198984", "0.51949567", "0.51777846", "0.50805336", "0.5054774", "0.50440156", "0.5003783", "0.49490967", "0.49228296", "0.4879456", "0.48700336"...
0.7438915
0
receive data from the server
def receive_data(data) @server_parser.parse(data) do |packet| debug "server --> #{packet.inspect}" state.update packet if packet.kind == :disconnect log "server disconnect: #{packet.message}" EM.stop end handle packet if current_action current_action.update(packet) send_pending_action_packets end end rescue => e STDERR.puts e.inspect EM.stop raise end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def receive(data); end", "def receive_data data\n rdata = data.split(\"\\n\")\n rdata.each do |line|\n puts \"#{self} received <<< #{line}\"\n # the echo part\n send_data \">>>you sent: #{line}\\n\"\n # Close the connection when the client tells us to.\n close_connection if line =~...
[ "0.7653938", "0.7651687", "0.765021", "0.765021", "0.7572085", "0.7540905", "0.7391688", "0.73495215", "0.7322522", "0.7313851", "0.7265806", "0.7241606", "0.71805114", "0.7168161", "0.7130244", "0.706215", "0.70518416", "0.70425093", "0.70286465", "0.69944966", "0.6984717", ...
0.72990406
10
Generate a remember token
def remember self.remember_token = User.newtoken update_attribute(:remember_digest, User.digest(remember_token)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_remember_token(token = SecureRandom.urlsafe_base64)\n self.remember_token = Digest::SHA1.hexdigest(token)\n end", "def create_remember_token\n # Using the urlsafe-base64 method from the SecureRandom module\n # in the Ruby standard library, creates a Base64 string safe \n # ...
[ "0.84411263", "0.8207586", "0.81466025", "0.81121475", "0.81121475", "0.8093326", "0.80880356", "0.80439264", "0.7999621", "0.79689527", "0.7939218", "0.7852527", "0.7823208", "0.78136426", "0.7801064", "0.7775022", "0.7775022", "0.7775022", "0.7718073", "0.7711839", "0.76859...
0.0
-1
Check if is authenticated with token
def authenticated?(token) return false if (!remember_digest) BCrypt::Password.new(remember_digest).is_password?(token) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_token\n @is_authenticated = false\n if request.headers[\"TOKEN\"]\n if request.headers[\"TOKEN\"] == \"AppDipre\"\n @is_authenticated = true\n end\n end\n end", "def authenticate_token\n @is_authenticated = false\n ...
[ "0.8381212", "0.8381212", "0.8240689", "0.8123797", "0.81085986", "0.81085986", "0.80770963", "0.8072737", "0.80651766", "0.80651766", "0.8045858", "0.80457026", "0.804546", "0.8011329", "0.7998877", "0.7976542", "0.79486686", "0.79226536", "0.78589106", "0.7772606", "0.77607...
0.0
-1
Forget the remember token
def forget self.remember_token = nil update_attribute(:remember_digest, nil) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def forget\n self.remember_token = nil\n update_attribute(:remember_token_digest, nil)\n end", "def forget\n update_attribute(:remember_token, nil)\n end", "def forget\n update_attribute(:remember_digest, nil)\n # We don't need the below line because if we update remember_digest to nil, then\n...
[ "0.85903674", "0.85840243", "0.84172887", "0.8414009", "0.8067702", "0.8067702", "0.8003807", "0.796986", "0.796986", "0.7964057", "0.79531074", "0.79438734", "0.7914545", "0.7914545", "0.7914545", "0.7878318", "0.7878318", "0.7878318", "0.7878318", "0.7878318", "0.7878318", ...
0.8463376
3
Show Page shows individual coordinate and tweet page and attached user
def show @case = Case.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @tweets = @usuario.tweets\n end", "def show\n @user = User.where(uuid: params[:uuid]).first || User.where(username: params[:uuid]).first\n render_404 and return unless @user\n\n @og = {\n \"og:title\" => @user,\n \"og:type\" => \"train-track:user\",\n \"og:url\" => re...
[ "0.6452849", "0.64488304", "0.64108247", "0.6133235", "0.6045814", "0.59724283", "0.59616923", "0.59616303", "0.5923543", "0.5918561", "0.58995724", "0.5890823", "0.5889099", "0.58784366", "0.5873971", "0.5859521", "0.5843587", "0.58353287", "0.5820898", "0.5819172", "0.58141...
0.0
-1
Specify the target pool name.
def get_floating_ip_list_post(get_floating_ip_list_param, opts = {}) data, _status_code, _headers = get_floating_ip_list_post_with_http_info(get_floating_ip_list_param, opts) return data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_pool_name\n super\n end", "def pool_name()\n #This is a stub, used for indexing\n end", "def set_default_pool_name(opts)\n opts = check_params(opts,[:default_pools])\n super(opts)\n end", "def ssdb_attr_pool(pool_name)\n @ssdb_attr_pool_name = pool_na...
[ "0.7474914", "0.710743", "0.695675", "0.67571664", "0.67051613", "0.6602692", "0.6428393", "0.63330424", "0.6281564", "0.6222057", "0.6222057", "0.6222057", "0.6218384", "0.61269975", "0.6126857", "0.608822", "0.6060427", "0.6015072", "0.60082954", "0.59410733", "0.5931343", ...
0.0
-1
Specify the target pool name.
def get_floating_ip_list_post_with_http_info(get_floating_ip_list_param, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: NetworkApi.get_floating_ip_list_post ..." end # verify the required parameter 'get_floating_ip_list_param' is set if @api_client.config.client_side_validation && get_floating_ip_list_param.nil? fail ArgumentError, "Missing the required parameter 'get_floating_ip_list_param' when calling NetworkApi.get_floating_ip_list_post" end # resource path local_var_path = "/getFloatingIPList" # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = {} # http body (model) post_body = @api_client.object_to_http_body(get_floating_ip_list_param) auth_names = ['basicAuth'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'Array<FloatingIP_V2_2>') if @api_client.config.debugging @api_client.config.logger.debug "API called: NetworkApi#get_floating_ip_list_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_pool_name\n super\n end", "def pool_name()\n #This is a stub, used for indexing\n end", "def set_default_pool_name(opts)\n opts = check_params(opts,[:default_pools])\n super(opts)\n end", "def ssdb_attr_pool(pool_name)\n @ssdb_attr_pool_name = pool_na...
[ "0.7475218", "0.71075815", "0.69569796", "0.67587066", "0.6705719", "0.6604256", "0.6427816", "0.6331779", "0.62833005", "0.62248945", "0.62248945", "0.62248945", "0.62179357", "0.6127898", "0.6127753", "0.6088075", "0.60620564", "0.6016896", "0.60104614", "0.59410554", "0.59...
0.0
-1
Constants Callbacks Scopes Other Methods the project creator
def creator User.find_by_id(creator_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def project; end", "def projects ; end", "def project\n end", "def new_project_unit\n end", "def global; end", "def set_project\n\n end", "def set_project\n\n end", "def create_project(name, type)\nend", "def project=(_arg0); end", "def callbacks; end", "def callbacks; end", "def init_pro...
[ "0.6695897", "0.65395135", "0.6255923", "0.6249774", "0.61731553", "0.6100218", "0.6100218", "0.6023362", "0.59180224", "0.59133893", "0.59133893", "0.5702257", "0.56968296", "0.5674485", "0.564195", "0.562498", "0.55689216", "0.5515018", "0.54626155", "0.5455124", "0.5445025...
0.0
-1
Tell this track's channel to use the given instrument, and also set the track's instrument display name.
def instrument=(instrument) @events << MIDI::ProgramChange.new(@channel, instrument) super(GM_PATCH_NAMES[instrument]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def instrument=(instrument)\n @events << \nMIDI::ProgramChange.new(@channel, instrument)\n super(MIDI::GM_PATCH_NAMES[instrument])\n end", "def instrument=(instrument)\n @events << MIDI::ProgramChange.new(@channel, instrument)\n super(MIDI::GM_PATCH_NAMES[instrument])\n end", "def instrume...
[ "0.6368076", "0.62432176", "0.6185505", "0.6185505", "0.6185505", "0.61758345", "0.60637724", "0.60637724", "0.60637724", "0.60637724", "0.60637724", "0.58738804", "0.58738804", "0.5730139", "0.5724428", "0.5724428", "0.554737", "0.53196824", "0.5193287", "0.51252496", "0.506...
0.63136387
1
Add one or more notes to sound simultaneously. Increments the pertrack timer so that subsequent notes will sound after this one finishes.
def notes(offsets, velocity=127, duration='quarter') offsets = [offsets] unless offsets.respond_to? :each offsets.each do |offset| event(NoteOnEvent.new(@channel, offset, velocity)) end @time += @sequence.note_to_delta(duration) offsets.each do |offset| event(NoteOffEvent.new(@channel, offset, velocity)) end recalc_delta_from_times end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add(notes, options = {})\n notes = [notes].flatten\n notes = sanitize_input_notes(notes, MIDIMessage::NoteOn, options)\n @sequence.add(notes)\n end", "def play tick, sounds\n\n # Obviously can't play a tune without a tune\n if @tune.empty? || !@playing\n return\n ...
[ "0.65166426", "0.6507929", "0.6136562", "0.61280113", "0.61226624", "0.61226624", "0.61226624", "0.61226624", "0.6105571", "0.6105571", "0.6105571", "0.6098773", "0.6076589", "0.603306", "0.6029598", "0.58895326", "0.58701015", "0.5861478", "0.5716908", "0.5716908", "0.570507...
0.53765523
40
Chords Major triad in root position
def major(low_note, velocity=127, duration='quarter') notes([0,4,7].collect { |x| x + low_note }, velocity, duration) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locrian_6(root=nil)\n Scale.harmonic_minor(root).rotate(1)\n end", "def minor_diagonal\n (0...@game.rows).collect { |i| @game.board.board[i][-i - 1] }\n end", "def chords\n \n end", "def pentagonal_index\n (1 + Math.sqrt(24 * self.abs + 1)) / 6\n end", "def pentagonal_index\n ...
[ "0.6145774", "0.58531636", "0.5806371", "0.5691763", "0.5691763", "0.5634798", "0.5599382", "0.5560795", "0.5483722", "0.54503834", "0.54503834", "0.5425558", "0.53946936", "0.5360479", "0.5339953", "0.53314114", "0.5301746", "0.529586", "0.5287546", "0.5267568", "0.5214638",...
0.0
-1
GET /posts/1 GET /posts/1.json
def show @post = Post.find(params[:id]) @comment = Comment.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @posts = Post.find(params[:id])\n render json: @posts\n end", "def show\n render json: Post.find(params[\"id\"])\n end", "def show\r\n post = Post.find(params[:id])\r\n render json: post\r\n end", "def show\n @post = Post.find(params[:id])\n\n render json: @post\n end", ...
[ "0.77110183", "0.73537844", "0.73433185", "0.73379177", "0.73228735", "0.7293139", "0.7275997", "0.7256934", "0.7161576", "0.7158913", "0.71552676", "0.71552676", "0.7119547", "0.7094749", "0.7094749", "0.7094749", "0.70943594", "0.7071599", "0.70607626", "0.70452625", "0.703...
0.0
-1
GET /posts/new GET /posts/new.json
def new @post = Post.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\n @post = Post.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\n end\...
[ "0.8041974", "0.80156785", "0.79855186", "0.7931169", "0.79215", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "0.79208946", "...
0.0
-1
POST /posts POST /posts.json
def create @post = Post.new(params[:post]) @post.user = current_user @post.score = 0 @post.upvoters = "[-1]" @post.downvoters = "[-2]" respond_to do |format| if @post.save format.html { redirect_to @post, notice: 'Post was successfully created.' } else format.html { render action: "new" } end end if params[:promote] curr_user = User.find(current_user.id) tel_numbers = curr_user.destring_favs(curr_user) tel_numbers.each do |id| user = User.find(id) TextMessage.new("#{curr_user.name} says #{params[:post][:content]}", user.phone_no.to_s).send end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n render json: Post.create(params[\"post\"])\n end", "def create\n respond_with Post.create(params[:posts])\n end", "def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end", "def create\n @post = Post.new(post_params)\n @po...
[ "0.74453115", "0.73224664", "0.73065", "0.7123661", "0.7014955", "0.7012768", "0.69840264", "0.6938563", "0.69309723", "0.6905106", "0.68197066", "0.68119097", "0.67928475", "0.6792773", "0.67785394", "0.67785394", "0.6762736", "0.6759516", "0.67510056", "0.67350024", "0.6698...
0.0
-1
PUT /posts/1 PUT /posts/1.json
def update @post = Post.find(params[:id]) authorize! :update, @post respond_to do |format| if @post.update_attributes(params[:post]) format.html { redirect_to @post, notice: 'Post was successfully updated.' } else format.html { render action: "edit" } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: Post.update(params[\"id\"], params[\"post\"])\n end", "def update\n respond_with Post.update(params[:id], params[:posts])\n end", "def update\n respond_with post.update(params[:id], params[:post])\n end", "def update\n title = params[:title]\n body ...
[ "0.7308219", "0.7123652", "0.68159384", "0.66432106", "0.66181636", "0.6607148", "0.6583982", "0.6564183", "0.6552021", "0.6532697", "0.6511846", "0.64877653", "0.6446283", "0.64321554", "0.64155626", "0.638547", "0.63833165", "0.63661736", "0.63641906", "0.6363359", "0.63632...
0.0
-1
DELETE /posts/1 DELETE /posts/1.json
def destroy @post = Post.find(params[:id]) authorize! :destroy, @post @post.destroy respond_to do |format| format.html { redirect_to posts_url } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n render json: Post.delete(params[\"id\"])\n end", "def destroy\n @post.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n post = Post.find(params[:id])\n if post.destroy\n render json: {status: \"success\", data: {id: param...
[ "0.8046884", "0.76902676", "0.7583626", "0.75803024", "0.7568048", "0.75047046", "0.75031126", "0.74750155", "0.74671036", "0.74650854", "0.746482", "0.74589694", "0.74589694", "0.74589694", "0.74589694", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "0.74579465", "...
0.0
-1
if user is logged in, return current_user, else return guest_user
def current_or_guest_user(params) if current_user if cookies[:uuid] unless current_user.guest? cookies.delete :uuid end end current_user else guest_user(params) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_or_guest_user\n if current_user\n transfer_session_to_logged_in_user if session[:guest_user_id].present?\n current_user\n else\n guest_user\n end\n end", "def current_or_guest_user\n if user_signed_in? then current_user else guest_user end\n end", "def current_or_gu...
[ "0.8972976", "0.89307785", "0.8852604", "0.86945367", "0.8651757", "0.853395", "0.853395", "0.8513949", "0.8457797", "0.8418504", "0.84031", "0.8402678", "0.839943", "0.839943", "0.8398982", "0.8397229", "0.83788675", "0.83763117", "0.83692396", "0.8366224", "0.83564925", "...
0.82762253
28
find guest_user object associated with the current session, creating one as needed
def guest_user(params) if u = User.where(:lazy_id => true).where(:lazy_id => cookies[:uuid]).first u else create_guest_user(params) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guest_user\n User.find(session[:guest_user_id] ||= create_guest_user.id)\n\n rescue ActiveRecord::RecordNotFound # if session[:guest_user_id] invalid\n session[:guest_user_id] = nil\n guest_user\n end", "def guest_user\n User.find(session[:guest_user_id].nil? ? session[:guest_user_id] = creat...
[ "0.84719986", "0.84546036", "0.8436438", "0.83515316", "0.8258372", "0.822358", "0.822358", "0.82172614", "0.8186005", "0.8162806", "0.8079069", "0.80566293", "0.8028192", "0.80156237", "0.7948459", "0.7938866", "0.78632987", "0.7787028", "0.77818793", "0.7755516", "0.7704540...
0.75695187
35
Configure Vedeu using a simple configuration DSL.
def configure(&block) fail InvalidSyntax, '`configure` requires a block.' unless block_given? Vedeu::Configuration.configure(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(args = [], opts = {}, &block)\n @options.merge!(opts)\n\n @options.merge!(Config::API.configure(&block)) if block_given?\n @options.merge!(Config::CLI.configure(args)) if args.any?\n\n Vedeu::Renderers.renderer(*@options[:renderers])\n\n Vedeu::Configuration\n end", "def...
[ "0.650775", "0.6432643", "0.6432643", "0.64055663", "0.61986077", "0.6190462", "0.6190431", "0.6138053", "0.6106681", "0.6049971", "0.60169464", "0.5942714", "0.5928619", "0.59283185", "0.59283185", "0.59080756", "0.58889747", "0.58865875", "0.588558", "0.58774656", "0.585829...
0.7594411
0
Used after defining an interface or interfaces to set the initially focussed interface.
def focus(name) Vedeu.trigger(:_focus_by_name_, name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_focus\n\t\t@line.focus\n\tend", "def focus\r\n end", "def set_input_focus! (focus, time = 0, revert_to: INPUT_FOCUS_POINTER_ROOT)\n super(revert_to, focus, time)\n end", "def focus!\n self.update_attribute :focus, 1\n end", "def focus!\n @gtk_socket.can_focus = true\n @...
[ "0.6657486", "0.6434159", "0.6372374", "0.63690823", "0.6366425", "0.6239629", "0.620794", "0.6184416", "0.5994305", "0.58919275", "0.5883557", "0.58778596", "0.5841011", "0.5741461", "0.57374036", "0.57085913", "0.57085913", "0.5696812", "0.5664851", "0.5649674", "0.5639836"...
0.53342366
41
Find out how many lines the current terminal is able to display.
def height Terminal.height end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _rl_current_display_line()\r\n # Find out whether or not there might be invisible characters in the\r\n # editing buffer.\r\n if (@rl_display_prompt == @rl_prompt)\r\n nleft = @_rl_last_c_pos - @_rl_screenwidth - @rl_visible_prompt_length\r\n else\r\n nleft = @_rl_last_c_pos - @_rl_scre...
[ "0.71714467", "0.6992928", "0.6932099", "0.6932099", "0.6847231", "0.6753881", "0.66749424", "0.6661989", "0.6558362", "0.65137", "0.6512988", "0.6503775", "0.65018797", "0.64677733", "0.6441898", "0.641452", "0.6382001", "0.63357705", "0.6311618", "0.6301831", "0.6246852", ...
0.0
-1
Register an interface by name which will display output from a event or command. This provides the means for you to define your application's views without their content.
def interface(name = '', &block) API::Interface.define({ name: name }, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register(interface)\n InvalidInterfaceError.check(interface)\n \n interfaces[interface.to_s.demodulize.underscore.to_sym] = interface\n end", "def register_ui thing\n @uis << thing\n end", "def name\n\t\t\"Interface Fingerprinter\"\n\tend", "def register_outputter(na...
[ "0.5812963", "0.57885903", "0.57239634", "0.5534636", "0.54944015", "0.54944015", "0.54944015", "0.5466492", "0.5456569", "0.5287779", "0.52860355", "0.5271038", "0.526901", "0.5255215", "0.5211872", "0.51988626", "0.51811814", "0.51612604", "0.5107999", "0.5107547", "0.50589...
0.59082633
0
Directly write a view buffer to the terminal. Using this method means that the refresh event does not need to be triggered after creating the view or views, though can be later triggered if needed.
def render(&block) API::Composition.render(&block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_screen!; end", "def write_to_screen!; end", "def render\n Vedeu::Output.render(buffer)\n end", "def redraw\n @terminal.erase_screen\n render\n end", "def write(value)\n update_buffer(value)\n\n render\n\n self\n end", "def render(view)\n ...
[ "0.5687408", "0.5687408", "0.5626912", "0.5620277", "0.5584487", "0.5510782", "0.5393719", "0.532096", "0.5275034", "0.5275034", "0.5241258", "0.52340823", "0.5227426", "0.5196341", "0.51800394", "0.51716137", "0.51673335", "0.5157724", "0.51544875", "0.51432383", "0.5142093"...
0.0
-1
When the terminal emit the 'SIGWINCH' signal, Vedeu can intercept this and attempt to redraw the current interface with varying degrees of success. Can also be used to simulate a terminal resize.
def resize trigger(:_clear_) trigger(:_refresh_) true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def track_resize\n @track_resize = true\n d = Terminal.dimensions\n\n @resize_thread = Thread.new {\n while @track_resize\n Terminal.reset!\n t = Terminal.dimensions\n\n if t != d && !shutdown?\n Terminal.resize!\n @on_resize.call if !!@on_resize\n end\n\...
[ "0.63828766", "0.61948633", "0.58233225", "0.58028", "0.576226", "0.5656884", "0.56419384", "0.5637691", "0.5577362", "0.54738194", "0.5473249", "0.5447006", "0.54385275", "0.53427464", "0.53353596", "0.5297545", "0.5282795", "0.5266352", "0.52637595", "0.52584106", "0.522934...
0.4684728
87
Trigger a registered or system event by name with arguments. If the event stored returns a value, that is returned. If multiple events are registered for a name, then the result of each event will be returned as part of a collection.
def trigger(name, *args) Events.use(name, *args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def registered_events\n return repository.find(name) if repository.registered?(name)\n\n Vedeu::Events::Aliases.find(name).map do |event_name|\n Vedeu::Events::Trigger.trigger(event_name, *args)\n end\n\n []\n end", "def registered_events\n return repository.find(...
[ "0.63373756", "0.63373756", "0.63167703", "0.6304516", "0.6193974", "0.61852914", "0.6161528", "0.6115156", "0.6016299", "0.59253484", "0.5922085", "0.5793874", "0.5752463", "0.5727183", "0.5715739", "0.56951404", "0.56702304", "0.56689626", "0.56689507", "0.5660282", "0.5638...
0.662765
0
Unregisters the event by name, effectively deleting the associated events bound with it also.
def unevent(name) Events.remove(name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def off(event_name)\n events.delete(event_name.to_sym)\n end", "def unregister name\n @tags.delete(name)\n end", "def unregister name\n @tags.delete(name)\n end", "def off(event_type = ANY_EVENT, name = ANY_STATE, &callback)\n sync_exclusive do\n hooks.unregister e...
[ "0.7441557", "0.6746965", "0.6746965", "0.67336833", "0.67336833", "0.6647178", "0.66150576", "0.6588004", "0.6495706", "0.6373919", "0.63577336", "0.6313051", "0.6273848", "0.6216565", "0.62098235", "0.619146", "0.6179944", "0.61641043", "0.6109086", "0.6096646", "0.60931474...
0.8343725
0
Use attributes of another interface whilst defining one.
def use(name) Vedeu::Interface.new(Vedeu::Interfaces.find(name)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(interface1, interface2)\n @interface1 = interface1\n @interface2 = interface2\n end", "def extended_interfaces; end", "def interfaces\n @interfaces ||= Interface.coercer(attributes[:interfaces])\n end", "def included_interfaces; end", "def interface\n @attributes[:interfa...
[ "0.58755946", "0.5759022", "0.5745776", "0.57397133", "0.5710328", "0.569804", "0.569804", "0.5682356", "0.56622773", "0.5642446", "0.5642446", "0.56290156", "0.5519598", "0.54572505", "0.54177654", "0.5392917", "0.5373731", "0.53679764", "0.53630376", "0.5357716", "0.5350051...
0.0
-1
Define a view (content) for an interface.
def view(name, &block) API::Composition.build { view(name, &block) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def views(name = nil)\n raise NotImplementedError, \"views is an abstract method\"\n end", "def define_view\n \t#puts \"#{controller_name}.define_view:begin view=#{@myparams[:view_id]}\"\n \t# views: liste des vues possibles est utilisee dans la view ruby show\n\t\t@views = View.all\n\t\t# view_id:...
[ "0.6348486", "0.59553117", "0.5892823", "0.583951", "0.58289176", "0.5757608", "0.57494634", "0.57396156", "0.57155", "0.56891584", "0.56891584", "0.56592447", "0.56539816", "0.56523585", "0.56483483", "0.56440157", "0.56439006", "0.562876", "0.5611243", "0.5588051", "0.55721...
0.5437506
32
Find out how many columns the current terminal is able to display.
def width Terminal.width end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_columns\n require 'io/console'\n n = ENV[\"COLUMNS\"]\n if n.nil? or n == \"\"\n rows, n = IO.console.winsize\t\n else\n n = n.to_i\n end\n return n\nend", "def columns; IO.console.winsize[1] rescue 80; end", "def columns\n IO.console.winsize.last\n end", "def output_cols\n return ...
[ "0.83149594", "0.8067606", "0.80612296", "0.78652745", "0.7573015", "0.7279616", "0.71125925", "0.70880663", "0.7072508", "0.70322585", "0.69907343", "0.6919715", "0.69088763", "0.6901746", "0.68977755", "0.6879635", "0.6822853", "0.6782459", "0.6774531", "0.6770733", "0.6742...
0.0
-1
string The string to turn into a array Examples split("1;2;3;4;5;", ";") => ["1", "2", "3", "4", "5"] Returns a array of the string
def split(string, n) string.split(n) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def split_string_to_array(str)\n @string_as_array = str.split('')\n return @string_as_array\nend", "def string_to_array(string)\n string.split(\" \")\nend", "def string_to_array(string)\n string.split(\" \")\nend", "def string_splitter( string )\n\n array = []\n array = string.split(\"\")\n p array\n ...
[ "0.7977758", "0.74163264", "0.74163264", "0.72099316", "0.71479136", "0.70243883", "0.7021012", "0.6991178", "0.6866784", "0.68232596", "0.67716885", "0.67585045", "0.67146945", "0.6680817", "0.6678724", "0.6668329", "0.6584351", "0.65814435", "0.65251845", "0.6416366", "0.64...
0.0
-1
this is method for work with wysiwyg redactor
def fill_in_ckeditor(locator, opts) content = opts.fetch(:with).to_json page.execute_script <<-SCRIPT CKEDITOR.instances['#{locator}'].setData(#{content}); $('textarea##{locator}').text(#{content}); SCRIPT end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wysiwyg_editor_shown?(recognition)\n company = recognition.authoritative_company || @company\n recognition.input_format_html? || company.recognition_wysiwyg_editor_enabled?\n end", "def before_save\n\t\tself.html = RedCloth.new(self.text).to_html\n\tend", "def preview\n #for debug\n params[:d]...
[ "0.66802615", "0.6531045", "0.63223284", "0.6221183", "0.6148571", "0.6116077", "0.6088229", "0.6079464", "0.6045467", "0.5987837", "0.5912503", "0.5894419", "0.5885974", "0.58809245", "0.58726573", "0.5869829", "0.5849178", "0.5845995", "0.58367646", "0.58339155", "0.5779724...
0.0
-1
TODO: process equests from server Diagnostics Refresh workspace/diagnostic/refresh Register Capability client/registerCapability Unregister Capability client/unregisterCapability
def lsp_read_message(io) @ext.data['lsp'].each_pair do |_k, v| next unless io == v.io headers, message = v.recv_message if headers == {} @logger.error "server(#{v.server[:command]}) is not running" v.status = :not_found # del_io_read_event(v.io) next end if message == nil @logger.error '[lsp] error' next end @logger.debug message.to_s if !message['id'].nil? # request or response id = message['id'].to_i if !v.request_buffer[id].nil? lsp_response(v, id, message) else # request? @logger.info '[LSP] recieve request???' @logger.info message.to_s end else # notification lsp_notification(v, message) end break end # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_capabilities methods\n @register_semaphore.synchronize do\n send_request 'client/registerCapability', {\n registrations: methods.select{|m| can_register?(m) and !registered?(m)}.map { |m|\n @registered_capabilities.add m\n {\n id: m,\...
[ "0.5956428", "0.56648713", "0.53404224", "0.5231727", "0.5126469", "0.5100215", "0.5100215", "0.5100215", "0.504841", "0.5036983", "0.49699584", "0.4955168", "0.49309996", "0.48953703", "0.48447317", "0.48319802", "0.47732192", "0.476498", "0.47220227", "0.47154567", "0.47148...
0.0
-1
Removes all unnessesary data from the traces
def remove_useless_traces_data(params) convert_list_of_json_traces_to_objects(params[0]) create_new_traces @traces_json_string = '[' + @traces_json_string[0...-1] + ']' puts @traces_json_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear\n trace.elegibility.transform_values { |_| 0 }\n trace.extended.each_value do |ext|\n ext.transform_values { |_| 0 }\n end\n\n error.responsibility = error.projected = error.gated = 0\n end", "def discardAllTreasures\n \n end", "def clear_transformed_data!\n ...
[ "0.67180717", "0.6350163", "0.61820173", "0.59679735", "0.5958402", "0.5931395", "0.58900374", "0.58790004", "0.5877097", "0.5816887", "0.5800543", "0.57929695", "0.57839453", "0.57833207", "0.5782553", "0.57753074", "0.575557", "0.57200986", "0.5714017", "0.57020986", "0.566...
0.722608
0
Converts a trace string to JSON Object
def convert_json_trace_to_object(trace) JSON.parse(trace[1...-1].insert(0, '{'), object_class: OpenStruct) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_json_string\n @traces_json_string\n end", "def to_json(*_args)\n @trace.to_json\n end", "def load(string)\n ActiveSupport::JSON.decode string\n end", "def load(string)\n ActiveSupport::JSON.decode string\n end", "def meta_to_json(str)\n key_pairs = str....
[ "0.6320628", "0.6235496", "0.578373", "0.578373", "0.5767151", "0.56942123", "0.5670016", "0.56492263", "0.5531835", "0.55062896", "0.5493804", "0.546757", "0.5374033", "0.5363098", "0.53590876", "0.5348716", "0.52849364", "0.52409697", "0.5237889", "0.52342045", "0.52288604"...
0.6937454
0
Converts all traces strings into JSON objects
def convert_list_of_json_traces_to_objects(list_of_traces) list_of_traces.each do |trace| @traces << convert_json_trace_to_object(trace) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def return_json_string\n @traces_json_string\n end", "def json()\n @trace_arr.map{|trace| \n tile = trace.json \n @tiles[trace.id] = trace\n trace.id\n }\n end", "def create_new_traces\n @traces.each do |trace|\n trace_stack = trace.stack_to_render[0]\n unless(trace_stack...
[ "0.7023154", "0.63920337", "0.631136", "0.6275152", "0.62739885", "0.6178219", "0.5559284", "0.53204095", "0.51694477", "0.5123657", "0.5102622", "0.50852495", "0.5061908", "0.50488085", "0.50301486", "0.50261694", "0.5007797", "0.49982178", "0.49965495", "0.49964806", "0.498...
0.59042925
6
Generate the traces that will be used in the visualization process. This is done by 1 extract the variables names form the trace 2 extract the encoded locals from the trace 3 extract the heap values form the trace 4 extract the code from the trace
def create_new_traces @traces.each do |trace| trace_stack = trace.stack_to_render[0] unless(trace_stack.func_name.include? '<init>') trace_stack_ordered_variable_names = trace_stack.ordered_varnames trace_stack_encoded_locals = trace_stack.encoded_locals trace_heap = trace.heap trace_code = @code[trace.line] filtered_trace = filter_trace([ trace_stack_ordered_variable_names, trace_stack_encoded_locals, trace_heap, trace_code, trace.line ]) @new_traces << filtered_trace trace_string = Yajl::Encoder.encode(filtered_trace) @traces_json_array << trace_string @traces_json_string += trace_string + ',' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_trace(params)\n trace = {}\n trace['stack'] = {}\n trace['stack']['ordered_variable_names'] = params[0]\n trace['stack']['encoded_locals'] = {}\n params[1].each_pair do |key, value|\n trace['stack']['encoded_locals'][key] = value\n end\n trace['heap'] = {}\n params[2].each_p...
[ "0.644559", "0.6297783", "0.58538085", "0.56983066", "0.5570515", "0.5535104", "0.5380226", "0.5338043", "0.5216844", "0.52124184", "0.5202664", "0.5117278", "0.5096113", "0.5090454", "0.50670594", "0.5060551", "0.50140655", "0.50054634", "0.49925035", "0.4990763", "0.4983535...
0.694777
0
Creates the new filtered trace object.
def filter_trace(params) trace = {} trace['stack'] = {} trace['stack']['ordered_variable_names'] = params[0] trace['stack']['encoded_locals'] = {} params[1].each_pair do |key, value| trace['stack']['encoded_locals'][key] = value end trace['heap'] = {} params[2].each_pair do |key, value| trace['heap'][key] = value if value.is_a?(Array) && value.length > 2 end trace['code'] = params[3] trace['lineNumber'] = params[4] trace end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_traces\n @traces.each do |trace|\n trace_stack = trace.stack_to_render[0]\n unless(trace_stack.func_name.include? '<init>')\n trace_stack_ordered_variable_names = trace_stack.ordered_varnames\n trace_stack_encoded_locals = trace_stack.encoded_locals\n trace_heap = trace.h...
[ "0.6354261", "0.5675816", "0.56490976", "0.56144345", "0.5571073", "0.55227375", "0.55160254", "0.54694855", "0.5440443", "0.5430974", "0.54215443", "0.539581", "0.539581", "0.539581", "0.539581", "0.539581", "0.5391642", "0.53829247", "0.5377108", "0.5353095", "0.53215367", ...
0.49404043
61
getter method to return the new trace as JSON string
def return_json_string @traces_json_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_json(*_args)\n @trace.to_json\n end", "def to_s\n @trace.to_s\n end", "def to_hash\n @trace\n end", "def json()\n @trace_arr.map{|trace| \n tile = trace.json \n @tiles[trace.id] = trace\n trace.id\n }\n end", "def trace\n attributes.fetch(:trace...
[ "0.77254003", "0.7145027", "0.6813827", "0.6757803", "0.66630393", "0.6413217", "0.63729984", "0.6330249", "0.6316424", "0.63129944", "0.6271973", "0.62525904", "0.6241202", "0.6188315", "0.61733526", "0.6162095", "0.6154478", "0.6142723", "0.61175704", "0.6100477", "0.609032...
0.82976204
0
Generates the full execution trace for the complete source code by executing the command related to Java_Jail
def generate_backend_trace(junit_test_file, files_path, peruser_files_path, student_file_name) raw_code = junit_test_file raw_code.gsub! "\n", "\\n" + "\n" raw_code.gsub! "\t", "\\t" lines = raw_code.split("\n") jUnit_test = '' lines.each { |line| jUnit_test += line} jUnit_test.gsub!('\"', "\\" + '\"') student_file = File.open(File.join(File.dirname(File.expand_path(__FILE__)), peruser_files_path, student_file_name), 'w+') full_string = '{' + "\n" + '"' + 'usercode' + '"' + ':' + '"' + jUnit_test + '"' + ',' + "\n" + '"' + 'options' + '"' + ':' + '{' + '}' \ ',' + "\n" + '"' + 'args' + '"' + ':' + '[' + ']' + ',' \ "\n" + '"' + 'stdin' + '"' + ':' + '"' + '"' + "\n" + '}' student_file.puts(full_string) student_file.close output = `java -cp .:cp:cp/javax.json-1.0.4.jar:java/tools.jar traceprinter.InMemory < cp/traceprinter/output.txt` # the shell command output end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dump_caller_stack\n return unless $ITEST2_TRACE_EXECUTION\n begin\n caller.each_with_index do |position, idx|\n next unless position =~ /\\A(.*?):(\\d+)/\n file = $1\n # TODO: send multiple trace to be parse with pages.rb\n # next if file =~ /example\\/examp...
[ "0.5608189", "0.5282671", "0.52793324", "0.5163975", "0.5157312", "0.5133898", "0.51140076", "0.5084825", "0.508095", "0.50801665", "0.50302386", "0.5028595", "0.50142825", "0.49818859", "0.4976015", "0.49694765", "0.49694765", "0.4936821", "0.493411", "0.49049076", "0.490453...
0.57624656
0
Generates the trace string that will be used in the visualization by generating the full execution trace then filter out all unnessesary traces param (see generate_backend_trace)
def seperate_and_filter_trace(junit_test_file, files_path, peruser_files_path, student_file_name) code_and_trace = generate_backend_trace(junit_test_file, files_path, peruser_files_path, student_file_name) splitter = '"' + 'trace' + '"' + ':' user_code, whole_trace = code_and_trace.split(splitter) whole_trace = whole_trace[1..whole_trace.length] entire_json_file = code_analyzer(user_code, whole_trace) entire_json_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_new_traces\n @traces.each do |trace|\n trace_stack = trace.stack_to_render[0]\n unless(trace_stack.func_name.include? '<init>')\n trace_stack_ordered_variable_names = trace_stack.ordered_varnames\n trace_stack_encoded_locals = trace_stack.encoded_locals\n trace_heap = trace.h...
[ "0.6041274", "0.6006499", "0.5920284", "0.5894594", "0.5885749", "0.58806366", "0.58528924", "0.5831939", "0.5730669", "0.5609301", "0.5577233", "0.5537164", "0.5499167", "0.5472909", "0.5422381", "0.53958225", "0.5350669", "0.53487486", "0.52871054", "0.5236721", "0.52265984...
0.56369483
9
Sets the line number
def set_line(line_number) @line_number = line_number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lineno=(num)\n num = Maglev::Type.coerce_to(num, Fixnum, :to_int)\n @_st_lineno = num\n $. = num\n num\n end", "def line_number\n @line_number_overwrite || default_line_number\n end", "def line_numbering(value)\n @document_builder.line_numbering = value\n end", ...
[ "0.80674815", "0.7915055", "0.7709483", "0.7512962", "0.7491955", "0.7491835", "0.73757076", "0.7301996", "0.7254114", "0.7139814", "0.7121126", "0.7121126", "0.7120693", "0.7105037", "0.7105037", "0.7105037", "0.7085615", "0.7085615", "0.7085615", "0.7085615", "0.7085615", ...
0.8918514
0
gets the line number if the trace at the specified index
def get_line_number(index) if @list_of_events.length.zero? puts 'list is empty' else temp_event = @list_of_events[index] temp_event.line_number end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_number\n return unless backtrace and backtrace[0]\n\n backtrace[0].split(\":\")[1].to_i\n end", "def line_number\n\t\t\t@line_index + 1\n\t\tend", "def line_number(pos=pos)\n line_index(pos) + 1\n end", "def line_number(pos=pos())\n line_index(pos) + 1\n end", "def lin...
[ "0.77366424", "0.7610707", "0.7297889", "0.72958374", "0.7276237", "0.72306144", "0.7224381", "0.72243", "0.7223026", "0.7218484", "0.7212791", "0.7212791", "0.7212791", "0.7212791", "0.7212791", "0.7212791", "0.7212791", "0.7108751", "0.7079458", "0.7079458", "0.7079458", ...
0.7773393
0
Sets the event to the Event object
def set_event(index, event) @filtered_events[index] = event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_event(id)\n @event = Event.find(id)\n end", "def set_event\n @event = ::Event.find(params[:id] || params[:event_id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n @event = Event.find(params[:id])\n end", "def set_event\n ...
[ "0.77552676", "0.7699793", "0.76343054", "0.76343054", "0.76343054", "0.7620364", "0.761567", "0.761567", "0.761567", "0.761567", "0.76021934", "0.7571875", "0.7567521", "0.7562625", "0.7562625", "0.75062394", "0.75056255", "0.7473688", "0.74482644", "0.74482644", "0.74482644...
0.0
-1
Gets the event Object
def get_event(index) @filtered_events[index] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event\n @event\n end", "def event\n @event ||= ::Event.find(self.id)\n end", "def event\n @event ||= build_event\n end", "def event\n @event ||= build_event\n end", "def get_event_object(args)\n if args.is_a? Event\n this_event = args\n else\n this_event = Event....
[ "0.7907608", "0.7687524", "0.7468734", "0.7468734", "0.7155435", "0.71338934", "0.69934124", "0.6986356", "0.6859506", "0.6740046", "0.67266226", "0.6694376", "0.66729695", "0.6609214", "0.6570292", "0.6531881", "0.6531684", "0.6528595", "0.6490209", "0.64786047", "0.64646196...
0.6031544
56
Adds the event to the list of events
def add_event(event) @list_of_events << event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_events(new_events); end", "def <<(add)\n @_events << add \n end", "def push(event)\n @events.push(event)\n end", "def record_event(event)\n @events_mutex.synchronize do\n @events << event\n end\n end", "def add_event(event_id)\n\t\treturn ERR_UNSUCCESSFUL...
[ "0.77535295", "0.7713343", "0.7484306", "0.7373104", "0.73165375", "0.71663284", "0.7020312", "0.7010055", "0.69903207", "0.69689035", "0.6899304", "0.6890351", "0.68839157", "0.68167365", "0.67840266", "0.67667526", "0.67644536", "0.67023915", "0.6662739", "0.66297203", "0.6...
0.90519327
0
Get the list of Events object
def trace_list my_list = [] (0...@list_of_events.length).each do |x| temp = @list_of_events[x] my_list << temp.trace end my_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event_list\n @_events\n end", "def events\n @events ||= []\n @events\n end", "def event_list\n events_list\n end", "def events\n return @events\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def...
[ "0.8797734", "0.8574594", "0.83244395", "0.82105964", "0.818586", "0.80787486", "0.8015265", "0.7917265", "0.7876332", "0.78195477", "0.78087556", "0.78087556", "0.7794356", "0.7719211", "0.7708861", "0.76996416", "0.76966906", "0.7693073", "0.7684366", "0.7684366", "0.764678...
0.0
-1
Prints the events one by one
def print_events if @filtered_events.length.zero? puts 'List of events is empty' else (0..@filtered_events.length).each do |x| temp_event = @filtered_events[x] puts temp_event.trace end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_events(events)\n events.each do |name, description|\n puts \"Event: #{name}\"\n puts \"Description: #{description} \\n\\n\"\n end\n end", "def print_event\n clear\n @talks.sort_by {|task| task.start_time }.each do |t|\n puts \"#{t.start_time.strftime(\"%I:%M%p\...
[ "0.8099862", "0.74389297", "0.7233531", "0.72172785", "0.7173616", "0.71060103", "0.69325256", "0.69086456", "0.6794468", "0.6791981", "0.66129893", "0.6533328", "0.6512295", "0.64493334", "0.64128244", "0.6406028", "0.63991565", "0.63930964", "0.6180031", "0.61016333", "0.60...
0.7645054
1
Correct the line number in each trace. In the begining, the line number value is numbered based on the begining os the complete code. This method re calculates the line number based on the start of the student code.
def modify_lines (code) line_number = 0 event_number = 0 initial_line_number = @list_of_events[0].line_number @list_of_events.each do |modify| temp_string = modify.trace temp_line = modify.line_number line_number = temp_line % initial_line_number if code[line_number] == 'newline' || code[line_number] == '\\t' line_number += 1 else original_line = temp_line.to_s new_line = line_number.to_s temp_string.gsub! original_line, new_line modified_event = Event.new modified_event.set_event(temp_string) modified_event.set_line(line_number) @list_of_events[event_number] = modified_event event_number += 1 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_line_numbers!\n each_with_index do |lo, new_line_number|\n lo.line_number = new_line_number\n end\n end", "def start_line_number=(_); end", "def line_number\n\t\t\t@line_index + 1\n\t\tend", "def start_line_number; end", "def start_line_number; end", "def original_line_number(new_l...
[ "0.66758853", "0.6604923", "0.6539844", "0.65312266", "0.65312266", "0.65311056", "0.6339304", "0.6339304", "0.6339304", "0.6339304", "0.6339304", "0.6339304", "0.6339304", "0.63314104", "0.6306968", "0.6254753", "0.62531304", "0.6188669", "0.6150878", "0.6140371", "0.6138524...
0.65986234
2
filter the traces by extracting the part of the trace correspond to the student solution
def handle_everything(user_code, in_trace) exe_Point_Finder(in_trace) @event_manager.modify_lines(user_code) raw_events = @event_manager.trace_list filtered_out_events = FilteredTraces.new([raw_events, user_code]) filtered_out_events.return_json_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def seperate_and_filter_trace(junit_test_file,\n files_path,\n peruser_files_path,\n student_file_name)\n code_and_trace = generate_backend_trace(junit_test_file,\n files_path,\n ...
[ "0.58075714", "0.54273003", "0.540387", "0.5100983", "0.5027973", "0.50176746", "0.50176746", "0.5012923", "0.49923772", "0.49602386", "0.4937663", "0.49290845", "0.4912477", "0.48956367", "0.48954368", "0.4892914", "0.48877412", "0.48835197", "0.48743933", "0.48680818", "0.4...
0.43881845
99
Extracts the code line number form the given trace string
def extract_line_num(string) line = string.tr '"', ' ' line.tr! '{', ' ' line.tr! ':', ' ' line.tr! ',', ' ' line.tr! '[', ' ' line.tr! '(', ' ' line.tr! ']', ' ' line.tr! '}', ' ' line.tr! ')', ' ' new_line = [] line.split.each do |s| new_line << s.to_i if s.numeric? end new_line[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_trace_id(line)\n return line.split(\"\\t\")[1].to_i\nend", "def extract_line_number(backtrace)\n return unless backtrace\n backtrace = backtrace.to_a\n return unless backtrace.length > 1\n m = backtrace.first.match(/^.+:(\\d+):/)\n return unless m and m.length > 1\n m[1]\n ...
[ "0.7728589", "0.7561722", "0.7522045", "0.7247545", "0.6928189", "0.6853162", "0.68316257", "0.6789391", "0.6720793", "0.6711742", "0.66255116", "0.66115427", "0.65748245", "0.6496958", "0.6488452", "0.6481479", "0.64529824", "0.64021224", "0.6384644", "0.6332786", "0.6304918...
0.7007544
4
Validate that the trace is for the student code. Requiers reimplementing
def verify_exe_point(on, off, in_point) add_exe_point = false exe_trace = Event.new if on == true && off == false exe_trace.set_event(in_point) exe_trace.set_line(extract_line_num(in_point)) @event_manager.add_event(exe_trace) add_exe_point = true elsif on == false && off == false add_exe_point = false else add_exe_point = false end add_exe_point end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def internal_validate_scn\n unless self.scottish_candidate_number.empty?\n unless Student.validate_scn self.scottish_candidate_number\n self.errors.add(:scottish_candidate_number, 'is not valid')\n end\n end\n end", "def valid_student_uin\n if student && uin.blank?\n e...
[ "0.6330288", "0.5862168", "0.57931864", "0.576125", "0.563359", "0.55734164", "0.5561997", "0.55297774", "0.55057395", "0.55027395", "0.54630727", "0.5457319", "0.54275537", "0.5404678", "0.5317936", "0.5298461", "0.5298271", "0.52704316", "0.52692795", "0.525978", "0.5249187...
0.0
-1
Extract the execution trace for the student solution only. THis is done by finding the execution trace for the code that is surrounded by startTraceNow and endTraceNow function calls.
def exe_Point_Finder(trace) symbol_stack = [] other_list = [] top_symbol = '' exe = '' exe_point = ' ' on = false off = false trace.split('').each do |i| current_symbol = i exe_point += current_symbol if i == '{' or i == '[' or i == '(' symbol_stack << i elsif i == '}' or i == ')' or i == ']' if empty?(symbol_stack) == false top_symbol = symbol_stack.pop if i == '}' and top_symbol != '{' next end end elsif i == ',' other_list << exe_point if symbol_stack.length.zero? other_list.each do |thing| exe += thing end if exe.include? 'startTraceNow' on = true exe = '' exe_point = '' other_list = [] elsif exe.include? 'endTraceNow' off = true return else flag = verify_exe_point(on, off, exe) on = false if flag == false exe = '' exe_point = '' other_list = [] end else exe_point = '' end else next end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trace(begX, begY, endX, endY)\n if solve(begX, begY, endX, endY)\n node = @tnode\n trace = Array.new\n while node != nil do\n trace.unshift(node.to_S)\n node = node.prev\n end\n\n trace.each do |elem|\n print elem, \" \"\n end\n print \"\\n\"\n else...
[ "0.61676794", "0.61020243", "0.5964391", "0.5948465", "0.59072137", "0.58359414", "0.57576954", "0.5685536", "0.5553746", "0.55075586", "0.5504756", "0.54980147", "0.54239726", "0.54068494", "0.5302817", "0.53017026", "0.52682984", "0.52546424", "0.52263254", "0.5190801", "0....
0.63415736
0
Extract student code from the complete source code
def code_splitter(code) student_code = [] code = code.split('startTraceNow();') new_code = code[1].split('endTraceNow();') executed_code = new_code[0] executed_code_list = executed_code.split('\\n') flag = false counter = 0 until flag if executed_code_list[counter] == '' || executed_code_list[counter] == ' ' flag = false counter += 1 elsif executed_code_list[counter] != '' flag = true end end x = counter while x < executed_code_list.length temp = executed_code_list[x] temp = temp.strip student_code << executed_code_list[x] unless temp.empty? x += 1 end student_code end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_code!\n data = @data\n data.gsub!(/^``` ?([^\\r\\n]+)?\\r?\\n(.+?)\\r?\\n```\\r?$/m) do\n id = Digest::SHA1.hexdigest($2)\n cached = check_cache(:code, id)\n @codemap[id] = cached ?\n { :output => cached } :\n { :lang => $1, :code => $2...
[ "0.60492027", "0.5954043", "0.589249", "0.58797973", "0.5722023", "0.56838745", "0.5664355", "0.55895305", "0.5587683", "0.5578158", "0.55733454", "0.5569232", "0.5540921", "0.5503417", "0.54738206", "0.5472135", "0.5436016", "0.54348767", "0.54334074", "0.54332197", "0.53896...
0.5713253
5
Extracts the student code and its trace
def code_analyzer(code, first_trace) code_to_viz = code_splitter(code) trace_analyzer = TraceAnalyzer.new trace_analyzer.handle_everything(code_to_viz, first_trace) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def code_splitter(code)\n student_code = []\n code = code.split('startTraceNow();')\n new_code = code[1].split('endTraceNow();')\n executed_code = new_code[0]\n executed_code_list = executed_code.split('\\\\n')\n flag = false\n counter = 0\n until flag\n if executed_code_list[counter] == '' || executed_...
[ "0.57225436", "0.5640148", "0.5640148", "0.5638506", "0.56211865", "0.55864507", "0.5530788", "0.5526458", "0.5507496", "0.5461128", "0.537084", "0.5336449", "0.52993196", "0.52795386", "0.5239639", "0.52373165", "0.51874083", "0.5185851", "0.51789796", "0.5158859", "0.515176...
0.5105308
23
The main method that will be called from OpenPOP server to generate the trace that will be used for the visualization
def main_method(file_path, student_full_code) my_test = seperate_and_filter_trace(student_full_code, file_path, 'cp/traceprinter/', 'output.txt') Dir.chdir('/home') #puts my_test my_test end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tracing()\n #This is a stub, used for indexing\n end", "def trace!\n request! :trace\n end", "def reporting\n # STUB\n end", "def call\n return nil unless scope_layer\n return nil unless context.config.value('timeline_traces')\n\n # Since this request is bei...
[ "0.6028443", "0.57972765", "0.5612796", "0.5453651", "0.54270864", "0.54270864", "0.54270864", "0.54270864", "0.54270864", "0.5425737", "0.542376", "0.5405917", "0.54030615", "0.5375943", "0.5373659", "0.5369219", "0.53162014", "0.52955663", "0.5231164", "0.5212229", "0.52022...
0.0
-1
This function is uesd in testing only.
def create_student_full_code puts Dir.pwd @student_code = '' File.open('code.txt', 'rb') do |code_file| code = code_file.read() code = code.split("\n") code.each { |line| @student_code += line + "\n" unless line.empty? } end File.open('part1.txt', 'rb') do |part1file| @part1 = part1file.read end File.open('part2.txt', 'rb') do |part2file| @part2 = part2file.read end full_student_code = @part1 + @student_code + "\n" + @part2 main_method('', full_student_code) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def schubert; end", "def probers; end", "def suivre; end", "def refutal()\n end", "def spec; end", "def spec; end", "def internal; end", "def ibu; end", "def used?; end", "def internship_p...
[ "0.7426645", "0.65343124", "0.65343124", "0.65343124", "0.65343124", "0.64072627", "0.62731266", "0.6048883", "0.60274196", "0.60094106", "0.60094106", "0.5976838", "0.59708804", "0.5841638", "0.5839765", "0.5835154", "0.58323705", "0.58323705", "0.5809095", "0.5805751", "0.5...
0.0
-1
GET /job_applications GET /job_applications.json
def index $lmc_left_menu = "lmw_all_jobs" $lmc_subleft_menu = "lmw_job_applications" @user = current_user @job_applications_ids = current_user.job_applications.pluck(:job_id) @job_applications = Job.where(id: @job_applications_ids).text_search(params[:query], params[:town], params[:status]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @job_applications = JobApplication.all\n end", "def index\n @jobapplications = Jobapplication.all\n end", "def applications_list\n get \"applications\"\n end", "def app\n jobs = App.find_by(uid: unsafe_params[:id]).\n app_series.jobs.editable_by(@context).\n eag...
[ "0.7649894", "0.764502", "0.7387177", "0.73761916", "0.7342064", "0.7204362", "0.7185809", "0.7047377", "0.7020832", "0.70059836", "0.6856699", "0.68265283", "0.68219966", "0.6801303", "0.6795594", "0.6754994", "0.67336607", "0.67336607", "0.672512", "0.67169476", "0.67136806...
0.60550916
89
GET /job_applications/1 GET /job_applications/1.json
def show @skip_footer_for_home = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @job_applications = JobApplication.all\n end", "def index\n @jobapplications = Jobapplication.all\n end", "def show\n #@job_application = JobApplication.find(params[:id])\n\n #@user = User.find(params[:id])\n @job_application = current_user.job_applications #.page(params[:page]).pe...
[ "0.73992616", "0.7387969", "0.7181728", "0.716288", "0.70688754", "0.705798", "0.6846004", "0.6846004", "0.6843619", "0.6792671", "0.67818606", "0.67695767", "0.67623425", "0.6675928", "0.6674146", "0.66518587", "0.66145766", "0.6613072", "0.6604981", "0.6604981", "0.6604981"...
0.0
-1
POST /job_applications POST /job_applications.json
def create if current_user.job_applications.where(job_id: params[:job_application][:job_id]).count > 0 respond_to do |format| format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_error') } end else @job_application = current_user.job_applications.new(job_application_params) #Create EQ Answers if params.has_key?("answer") Answer.create(eq_answer_params(params["answer"])) else params["answers"].each do |answer| Answer.create(eq_answer_params(answer)) end end #Create EQ Answers end respond_to do |format| if @job_application.save @job = @job_application.job @job_owner = @job_application.job.users.first @applicant = current_user UserMailer.new_job_applicant_email(@job, @job_owner, @applicant ).deliver_now format.html { redirect_to worker_all_jobs_path, notice: t('job_applications_controller.job_applications_create_success') } format.json { render :show, status: :created, location: @job_application } else format.html { render :new } format.json { render json: @job_application.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @job_application = JobApplication.new(job_application_params)\n\n respond_to do |format|\n if @job_application.save\n format.html { redirect_to @job_application, notice: 'Job application was successfully created.' }\n format.json { render :show, status: :created, location: @jo...
[ "0.744032", "0.7427608", "0.7419197", "0.730825", "0.7208124", "0.7051559", "0.69155604", "0.6884683", "0.6787227", "0.67019594", "0.66984814", "0.65622455", "0.6494502", "0.6434999", "0.64301753", "0.6423644", "0.63641804", "0.6353813", "0.63487315", "0.6311471", "0.6290718"...
0.70089036
6
PATCH/PUT /job_applications/1 PATCH/PUT /job_applications/1.json
def update respond_to do |format| if @job_application.update(job_application_params) format.html { redirect_to @job_application, notice: t('job_applications_controller.job_applications_update_success') } format.json { render :show, status: :ok, location: @job_application } else format.html { render :edit } format.json { render json: @job_application.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n\n respond_to do |format|\n if @job_application.update(job_application_params)\n format.html { redirect_to job_applications_url}\n format.json { render :show, status: :ok, location: @job_application }\n else\n format.html { render :edit }\n format.json { render ...
[ "0.7554603", "0.75157005", "0.747418", "0.7409727", "0.73861325", "0.73861325", "0.73682624", "0.7362379", "0.72317976", "0.7058822", "0.7058822", "0.6948372", "0.6858128", "0.6845131", "0.6788649", "0.675084", "0.67361444", "0.6678714", "0.6671946", "0.6636824", "0.6636824",...
0.74696577
3
DELETE /job_applications/1 DELETE /job_applications/1.json
def destroy @job_application.destroy respond_to do |format| format.html { redirect_to job_applications_url, notice: t('job_applications_controller.job_applications_delete_success') } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n #@jobapp = Jobapp.find(params[:id])\n @jobapp.destroy\n\n respond_to do |format|\n format.html { redirect_to jobapps_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @job_application.destroy\n respond_to do |format|\n format.html { redirect_to ...
[ "0.7790644", "0.7636803", "0.7635471", "0.7635471", "0.76344645", "0.7595782", "0.7372801", "0.7372801", "0.7371552", "0.7371552", "0.7321274", "0.7297315", "0.7282463", "0.7220791", "0.71963775", "0.71139127", "0.7089889", "0.7088245", "0.70454216", "0.70454216", "0.70454216...
0.7491728
6
Use callbacks to share common setup or constraints between actions.
def set_job_application @job_application = JobApplication.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.6165094", "0.60450804", "0.5944413", "0.5915806", "0.58885634", "0.5835225", "0.5775847", "0.5700531", "0.5700531", "0.56543404", "0.56209993", "0.54238355", "0.5410386", "0.5410386", "0.5410386", "0.5394892", "0.5377769", "0.53559244", "0.5339896", "0.53388095", "0.533008...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def job_application_params params.require(:job_application).permit(:apply_job_info, :price_per_hour, :job_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.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
GET /podvals GET /podvals.xml
def index @podvals = Podval.find(:all) @podval = Podval.find_by_main(1) if @podval == nil @podvals = Podval.find_all_by_vis(1) @podval = @podvals.choice end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @podvals } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def values(params = {})\n @client.get(\"#{path}/values\", params)\n end", "def new\n @podval = Podval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @podval }\n end\n end", "def get_prop(values)\n cmd = \"{\\\"id\\\":1,\\\"method\\\":\\...
[ "0.60993767", "0.57483554", "0.56734437", "0.5239529", "0.5156862", "0.5083917", "0.50354815", "0.5031465", "0.49419847", "0.492067", "0.49194166", "0.49026126", "0.4887002", "0.48712024", "0.48311663", "0.481108", "0.48047805", "0.4791674", "0.47803277", "0.47778094", "0.476...
0.66280293
0
GET /podvals/new GET /podvals/new.xml
def new @podval = Podval.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @podval } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @prop_value = PropValue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @prop_value }\n end\n end", "d...
[ "0.62041026", "0.5975784", "0.59499407", "0.58696115", "0.5821277", "0.58180106", "0.5790565", "0.5777775", "0.5769915", "0.5724539", "0.56767046", "0.5672125", "0.56688523", "0.5617821", "0.5609206", "0.5586452", "0.55854684", "0.558404", "0.55838054", "0.5582039", "0.556662...
0.7312344
0
POST /podvals POST /podvals.xml
def create @podval = Podval.new(params[:podval]) name1 = params[:podval][:tov1img].original_filename if params[:podval][:tov1img] name2 = params[:podval][:tov2img].original_filename if params[:podval][:tov2img] name3 = params[:podval][:tov3img].original_filename if params[:podval][:tov3img] name4 = params[:podval][:tov4img].original_filename if params[:podval][:tov4img] name5 = params[:podval][:tov5img].original_filename if params[:podval][:tov5img] name6 = params[:podval][:divup].original_filename if params[:podval][:divup] name7 = params[:podval][:divdown].original_filename if params[:podval][:divdown] directory = 'public/images/podval' path1 = File.join(directory, name1) if params[:podval][:tov1img] path2 = File.join(directory, name2) if params[:podval][:tov2img] path3 = File.join(directory, name3) if params[:podval][:tov3img] path4 = File.join(directory, name4) if params[:podval][:tov4img] path5 = File.join(directory, name5) if params[:podval][:tov5img] path6 = File.join(directory, name6) if params[:podval][:divup] path7 = File.join(directory, name7) if params[:podval][:divdown] File.open(path1, "wb") { |f| f.write(params[:podval][:tov1img].read) } if params[:podval][:tov1img] File.open(path2, "wb") { |f| f.write(params[:podval][:tov2img].read) } if params[:podval][:tov2img] File.open(path3, "wb") { |f| f.write(params[:podval][:tov3img].read) } if params[:podval][:tov3img] File.open(path4, "wb") { |f| f.write(params[:podval][:tov4img].read) } if params[:podval][:tov4img] File.open(path5, "wb") { |f| f.write(params[:podval][:tov5img].read) } if params[:podval][:tov5img] File.open(path6, "wb") { |f| f.write(params[:podval][:divup].read) } if params[:podval][:divup] File.open(path7, "wb") { |f| f.write(params[:podval][:divdown].read) } if params[:podval][:divdown] respond_to do |format| if @podval.save @podval.tov1img = name1[0..-5] if params[:podval][:tov1img] @podval.tov2img = name2[0..-5] if params[:podval][:tov2img] @podval.tov3img = name3[0..-5] if params[:podval][:tov3img] @podval.tov4img = name4[0..-5] if params[:podval][:tov4img] @podval.tov5img = name5[0..-5] if params[:podval][:tov5img] @podval.divup = name6[0..-5] if params[:podval][:divup] @podval.divdown = name7[0..-5] if params[:podval][:divdown] check_podval_cat1s @podval.save flash[:notice] = 'Сохранено.' format.html { redirect_to podvals_path } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @podval = Podval.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @podval }\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def destro...
[ "0.57049316", "0.54709834", "0.5308807", "0.5175909", "0.5172681", "0.51400983", "0.5076454", "0.5031883", "0.50246847", "0.50151294", "0.49099264", "0.48643515", "0.4830862", "0.4819268", "0.4819268", "0.4819268", "0.4818986", "0.4812253", "0.48077974", "0.47933495", "0.4789...
0.0
-1
PUT /podvals/1 PUT /podvals/1.xml
def update @podval = Podval.find(params[:id]) name1 = params[:podval][:tov1img].original_filename if params[:podval][:tov1img] name2 = params[:podval][:tov2img].original_filename if params[:podval][:tov2img] name3 = params[:podval][:tov3img].original_filename if params[:podval][:tov3img] name4 = params[:podval][:tov4img].original_filename if params[:podval][:tov4img] name5 = params[:podval][:tov5img].original_filename if params[:podval][:tov5img] name6 = params[:podval][:divup].original_filename if params[:podval][:divup] name7 = params[:podval][:divdown].original_filename if params[:podval][:divdown] directory = 'public/images/podval' path1 = File.join(directory, name1) if params[:podval][:tov1img] path2 = File.join(directory, name2) if params[:podval][:tov2img] path3 = File.join(directory, name3) if params[:podval][:tov3img] path4 = File.join(directory, name4) if params[:podval][:tov4img] path5 = File.join(directory, name5) if params[:podval][:tov5img] path6 = File.join(directory, name6) if params[:podval][:divup] path7 = File.join(directory, name7) if params[:podval][:divdown] File.open(path1, "wb") { |f| f.write(params[:podval][:tov1img].read) } if params[:podval][:tov1img] File.open(path2, "wb") { |f| f.write(params[:podval][:tov2img].read) } if params[:podval][:tov2img] File.open(path3, "wb") { |f| f.write(params[:podval][:tov3img].read) } if params[:podval][:tov3img] File.open(path4, "wb") { |f| f.write(params[:podval][:tov4img].read) } if params[:podval][:tov4img] File.open(path5, "wb") { |f| f.write(params[:podval][:tov5img].read) } if params[:podval][:tov5img] File.open(path6, "wb") { |f| f.write(params[:podval][:divup].read) } if params[:podval][:divup] File.open(path7, "wb") { |f| f.write(params[:podval][:divdown].read) } if params[:podval][:divdown] respond_to do |format| if @podval.update_attributes(params[:podval]) @podval.tov1img = name1[0..-5] if params[:podval][:tov1img] @podval.tov2img = name2[0..-5] if params[:podval][:tov2img] @podval.tov3img = name3[0..-5] if params[:podval][:tov3img] @podval.tov4img = name4[0..-5] if params[:podval][:tov4img] @podval.tov5img = name5[0..-5] if params[:podval][:tov5img] @podval.divup = name6[0..-5] if params[:podval][:divup] @podval.divdown = name7[0..-5] if params[:podval][:divdown] @podval.save flash[:notice] = 'Сохранено.' format.html { redirect_to podvals_path } 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(uri, payload)\n url = \"#{@config[:base_url]}#{@config[:rest_path]}/#{extract_pid(uri)}\"\n request = Request.new(\n \"Put\", url, payload.to_s, ...
[ "0.6149169", "0.56566006", "0.56329364", "0.5524957", "0.55061173", "0.548143", "0.5459431", "0.5332811", "0.531839", "0.53114873", "0.5288465", "0.52776104", "0.52713555", "0.52661276", "0.5242661", "0.5241596", "0.523505", "0.52337563", "0.52294177", "0.52294177", "0.522941...
0.49423975
64
DELETE /podvals/1 DELETE /podvals/1.xml
def destroy @podval = Podval.find(params[:id]) @podval.destroy respond_to do |format| format.html { redirect_to(podvals_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 delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req...
[ "0.64152956", "0.6399643", "0.6387767", "0.6370322", "0.6267758", "0.6196657", "0.6159628", "0.613705", "0.61281145", "0.61144996", "0.60902584", "0.6066382", "0.6052238", "0.6052238", "0.60420334", "0.6035436", "0.6028942", "0.60017455", "0.59953773", "0.5993745", "0.5993745...
0.7289542
0