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
Get a RUM application.
def get_rum_application(id, opts = {}) data, _status_code, _headers = get_rum_application_with_http_info(id, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_rum_applications(opts = {})\n data, _status_code, _headers = get_rum_applications_with_http_info(opts)\n data\n end", "def app\n App.load(self.app_id)\n end", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def r...
[ "0.68203694", "0.6739275", "0.6705859", "0.66802746", "0.6674283", "0.66742724", "0.66585577", "0.65514684", "0.6469167", "0.6442275", "0.6401066", "0.6394888", "0.6299214", "0.6255379", "0.62467337", "0.62464064", "0.6245272", "0.62288606", "0.6224524", "0.61448985", "0.6132...
0.7070075
0
Get a RUM application. Get the RUM application with given ID in your organization.
def get_rum_application_with_http_info(id, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_application ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling RUMAPI.get_rum_application" end # resource path local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RUMApplicationResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :get_rum_application, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#get_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def app_by_id(id)\n get(\"/apps/#{id}\")\n end", "def get(id)\n response = Network.get(['Applications', id])\n Application.new(response)\n end", "def get_rum_application(id, opts = {})\n data, _status_code, _headers = get_rum_application_with_http_info(id, opts)\n data\...
[ "0.7585172", "0.75727016", "0.7501526", "0.7126829", "0.6787501", "0.6715384", "0.6643006", "0.6607145", "0.66043967", "0.650721", "0.64870113", "0.64225805", "0.64199555", "0.63546413", "0.6250305", "0.61794657", "0.6168167", "0.6141745", "0.61112094", "0.6073163", "0.603238...
0.6951836
4
List all the RUM applications.
def get_rum_applications(opts = {}) data, _status_code, _headers = get_rum_applications_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applications_list\n get \"applications\"\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def list()\n path = \"/query/apps\"\n conn = multipart_connection(port: 8060)\n response = conn.get path\n\n if response.success?\n...
[ "0.7688058", "0.71771026", "0.71689224", "0.70924443", "0.70924443", "0.7086369", "0.7084254", "0.7034559", "0.7034559", "0.7034559", "0.7034559", "0.69031674", "0.6845617", "0.68409914", "0.68332", "0.67965364", "0.6757214", "0.6749461", "0.66785157", "0.6670607", "0.6558551...
0.7066129
7
List all the RUM applications. List all the RUM applications in your organization.
def get_rum_applications_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.get_rum_applications ...' end # resource path local_var_path = '/api/v2/rum/applications' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RUMApplicationsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :get_rum_applications, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#get_rum_applications\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def applications_list\n get \"applications\"\n end", "def applications\n Application.from session.get 'operations/application', API_V1\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Application.all\n end", "def index\n @applications = Ap...
[ "0.7430933", "0.70224917", "0.6844486", "0.6844486", "0.6844486", "0.6844486", "0.6834701", "0.68186885", "0.6785698", "0.67786324", "0.6703775", "0.6625048", "0.660905", "0.65824676", "0.65824676", "0.65735525", "0.65202856", "0.6518695", "0.6516427", "0.647344", "0.6444008"...
0.592046
63
Get a list of RUM events.
def list_rum_events(opts = {}) data, _status_code, _headers = list_rum_events_with_http_info(opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/events\"))[0]\n end", "def event_list\n @_events\n end", "def event_list\n events_list\n end", "def events\...
[ "0.72163916", "0.71673846", "0.71455514", "0.71312195", "0.7089489", "0.70870143", "0.70684934", "0.70225304", "0.6872262", "0.6821366", "0.67921853", "0.6746008", "0.671455", "0.67065674", "0.66975677", "0.66975677", "0.6616857", "0.6608215", "0.6600963", "0.6596074", "0.659...
0.7761489
0
Get a list of RUM events. List endpoint returns events that match a RUM search query. [Results are paginated][1]. Use this endpoint to see your latest RUM events. [1]:
def list_rum_events_with_http_info(opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.list_rum_events ...' end allowable_values = ['timestamp', '-timestamp'] if @api_client.config.client_side_validation && opts[:'sort'] && !allowable_values.include?(opts[:'sort']) fail ArgumentError, "invalid value for \"sort\", must be one of #{allowable_values}" end if @api_client.config.client_side_validation && !opts[:'page_limit'].nil? && opts[:'page_limit'] > 1000 fail ArgumentError, 'invalid value for "opts[:"page_limit"]" when calling RUMAPI.list_rum_events, must be smaller than or equal to 1000.' end # resource path local_var_path = '/api/v2/rum/events' # query parameters query_params = opts[:query_params] || {} query_params[:'filter[query]'] = opts[:'filter_query'] if !opts[:'filter_query'].nil? query_params[:'filter[from]'] = opts[:'filter_from'] if !opts[:'filter_from'].nil? query_params[:'filter[to]'] = opts[:'filter_to'] if !opts[:'filter_to'].nil? query_params[:'sort'] = opts[:'sort'] if !opts[:'sort'].nil? query_params[:'page[cursor]'] = opts[:'page_cursor'] if !opts[:'page_cursor'].nil? query_params[:'page[limit]'] = opts[:'page_limit'] if !opts[:'page_limit'].nil? # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] # return_type return_type = opts[:debug_return_type] || 'RUMEventsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :list_rum_events, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#list_rum_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_rum_events(opts = {})\n data, _status_code, _headers = list_rum_events_with_http_info(opts)\n data\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}/#{id}/...
[ "0.75780886", "0.72380906", "0.713011", "0.7118851", "0.69809484", "0.68107086", "0.676955", "0.6728415", "0.6693383", "0.6680425", "0.6587745", "0.6545867", "0.6526493", "0.6522521", "0.64968944", "0.6479987", "0.64667207", "0.6457101", "0.6453949", "0.6438746", "0.643305", ...
0.71137667
4
Search RUM events. List endpoint returns RUM events that match a RUM search query. [Results are paginated][1]. Use this endpoint to build complex RUM events filtering and search. [1]:
def search_rum_events_with_http_info(body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.search_rum_events ...' end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.search_rum_events" end # resource path local_var_path = '/api/v2/rum/events/search' # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'RUMEventsResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ] new_options = opts.merge( :operation => :search_rum_events, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Post, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#search_rum_events\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all_events\n @unreads = current_user.unreads\n search_params = params.except(:utf8, :commit, :controller, :action, :page)\n if search_params.present?\n @events = Event.search(search_params, @unreads).order(\"created_at DESC\")\n @events = @events.paginate(:page => params[:page], :per_page ...
[ "0.72911173", "0.71306217", "0.69764805", "0.6956214", "0.68302834", "0.67160755", "0.6714171", "0.66890335", "0.6683445", "0.6655216", "0.65698457", "0.6561368", "0.6555787", "0.65485126", "0.6491471", "0.64004403", "0.63939756", "0.6380674", "0.6367059", "0.63666064", "0.63...
0.6488923
15
Update a RUM application.
def update_rum_application(id, body, opts = {}) data, _status_code, _headers = update_rum_application_with_http_info(id, body, opts) data end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_app data={}\n put '/app', data\n end", "def update!(**args)\n @app = args[:app] if args.key?(:app)\n end", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes)\n\tend", "def update(name, attributes)\n\t\tput(\"/apps/#{name}\", :app => attributes...
[ "0.75971067", "0.74355614", "0.72224873", "0.72224873", "0.7185832", "0.70620316", "0.7040081", "0.7024419", "0.69961953", "0.6942338", "0.6870574", "0.68487716", "0.6847216", "0.6823785", "0.68153256", "0.68153256", "0.68069154", "0.6799347", "0.6799347", "0.6799347", "0.678...
0.72866803
2
Update a RUM application. Update the RUM application with given ID in your organization.
def update_rum_application_with_http_info(id, body, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug 'Calling API: RUMAPI.update_rum_application ...' end # verify the required parameter 'id' is set if @api_client.config.client_side_validation && id.nil? fail ArgumentError, "Missing the required parameter 'id' when calling RUMAPI.update_rum_application" end # verify the required parameter 'body' is set if @api_client.config.client_side_validation && body.nil? fail ArgumentError, "Missing the required parameter 'body' when calling RUMAPI.update_rum_application" end # resource path local_var_path = '/api/v2/rum/applications/{id}'.sub('{id}', CGI.escape(id.to_s).gsub('%2F', '/')) # query parameters query_params = opts[:query_params] || {} # header parameters header_params = opts[:header_params] || {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/json']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['application/json']) # form parameters form_params = opts[:form_params] || {} # http body (model) post_body = opts[:debug_body] || @api_client.object_to_http_body(body) # return_type return_type = opts[:debug_return_type] || 'RUMApplicationResponse' # auth_names auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth] new_options = opts.merge( :operation => :update_rum_application, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => return_type, :api_version => "V2" ) data, status_code, headers = @api_client.call_api(Net::HTTP::Patch, local_var_path, new_options) if @api_client.config.debugging @api_client.config.logger.debug "API called: RUMAPI#update_rum_application\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_rum_application(id, body, opts = {})\n data, _status_code, _headers = update_rum_application_with_http_info(id, body, opts)\n data\n end", "def update(id, optional_params = {})\n response = Network.post(['Applications', id], optional_params)\n Application.new(response)\n ...
[ "0.77720004", "0.72263825", "0.71447027", "0.7139714", "0.71034366", "0.7075179", "0.70720214", "0.7037274", "0.70340693", "0.70285535", "0.7020902", "0.69945914", "0.6985224", "0.69750273", "0.6965341", "0.694668", "0.6928166", "0.6928166", "0.69228214", "0.6905937", "0.6905...
0.6827842
28
load money from external file
def load_money() money_val = File.open("money_val.txt") money = money_val.read.to_i if money == 0 money = 100 end money_val.close return money end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_currencies\n currencies = parse_currency_file(\"currency.json\")\n currencies.merge! parse_currency_file(\"currency_bc.json\")\n end", "def load!\n money = redis.get('money')\n money && @use_redis ? money_from_json(money) : default_hash\n end", "def load_contract(path)\n open(path, ...
[ "0.63752735", "0.6208907", "0.619752", "0.6146132", "0.5941594", "0.5880553", "0.58179224", "0.58179224", "0.58148724", "0.58148724", "0.56278294", "0.55781066", "0.55687886", "0.556844", "0.5562873", "0.55596036", "0.5544476", "0.5497189", "0.5426702", "0.54199797", "0.53959...
0.76896745
0
Creates Options Hit, Stand, Exit
def play_options(prompt) choices = [ {name: "Hit", value: 1}, {name: "Stand", value: 2}, {name: "Exit", value: 3} ] chosen_option = prompt.select("What would you like to do?", choices, help_color: :yellow, help: "(Use Keybvoard keys)", show_help: :start, filter: true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def options_create opts, colors\n\t\t\t\t#todo create, switch\n\t\t\t\topts.separator \" *\".colorize(colors[:cyan]) + \" create, switch\".colorize(colors[:yellow]) + \n\t\t\t\t\" creates a new list or switches to an existing one\".colorize(colors[:magenta])\n\t\t\t\topts.separator \" usage: \".colorize(colo...
[ "0.62488633", "0.61966", "0.6157505", "0.6157505", "0.6122708", "0.6096641", "0.60453546", "0.59938914", "0.5950944", "0.58911467", "0.5882152", "0.58337116", "0.58092225", "0.58092225", "0.57909256", "0.5786242", "0.57611465", "0.5745946", "0.5703358", "0.56967336", "0.56870...
0.6249847
0
Collection of all cards (Create all Cards)
def create_deck all_cards = [] # Hearts ♥ all_cards << ace_of_hearts = Ace.new('A', 'hearts', "♥") all_cards << king_of_hearts = Card.new('K', 'hearts', 10, "♥") all_cards << queen_of_hearts = Card.new('Q', 'hearts', 10, "♥") all_cards << jack_of_hearts = Card.new('J', 'hearts', 10, "♥") all_cards << ten_of_hearts = Card.new('10', 'hearts', 10, "♥") all_cards << nine_of_hearts = Card.new('9', 'hearts', 9, "♥") all_cards << eight_of_hearts = Card.new('8', 'hearts', 8, "♥") all_cards << seven_of_hearts = Card.new('7', 'hearts', 7, "♥") all_cards << six_of_hearts = Card.new('6', 'hearts', 6, "♥") all_cards << five_of_hearts = Card.new('5', 'hearts', 5, "♥") all_cards << four_of_hearts = Card.new('4', 'hearts', 4, "♥") all_cards << three_of_hearts = Card.new('3', 'hearts', 3, "♥") all_cards << two_of_hearts = Card.new('2', 'hearts', 2, "♥") # Spades ♠ all_cards << ace_of_spades = Ace.new('A', 'spades', "♠") all_cards << king_of_spades = Card.new('K', 'spades', 10, "♠") all_cards << queen_of_spades = Card.new('Q', 'spades', 10, "♠") all_cards << jack_of_spades = Card.new('J', 'spades', 10, "♠") all_cards << ten_of_spades = Card.new('10', 'spades', 10, "♠") all_cards << nine_of_spades = Card.new('9', 'spades', 9, "♠") all_cards << eight_of_spades = Card.new('8', 'spades', 8, "♠") all_cards << seven_of_spades = Card.new('7', 'spades', 7, "♠") all_cards << six_of_spades = Card.new('6', 'spades', 6, "♠") all_cards << five_of_spades = Card.new('5', 'spades', 5, "♠") all_cards << four_of_spades = Card.new('4', 'spades', 4, "♠") all_cards << three_of_spades = Card.new('3', 'spades', 3, "♠") all_cards << two_of_spades = Card.new('2', 'spades', 2, "♠") # Diamonds ♦ all_cards << ace_of_diamonds = Ace.new('A', 'diamonds', "♦") all_cards << king_of_diamonds = Card.new('K', 'diamonds', 10, "♦") all_cards << queen_of_diamonds = Card.new('Q', 'diamonds', 10, "♦") all_cards << jack_of_diamonds = Card.new('J', 'diamonds', 10, "♦") all_cards << ten_of_diamonds = Card.new('10', 'diamonds', 10, "♦") all_cards << nine_of_diamonds = Card.new('9', 'diamonds', 9, "♦") all_cards << eight_of_diamonds = Card.new('8', 'diamonds', 8, "♦") all_cards << seven_of_diamonds = Card.new('7', 'diamonds', 7, "♦") all_cards << six_of_diamonds = Card.new('6', 'diamonds', 6, "♦") all_cards << five_of_diamonds = Card.new('5', 'diamonds', 5, "♦") all_cards << four_of_diamonds = Card.new('4', 'diamonds', 4, "♦") all_cards << three_of_diamonds = Card.new('3', 'diamonds', 3, "♦") all_cards << two_of_diamonds = Card.new('2', 'diamonds', 2, "♦") # Clubs ♣ all_cards << ace_of_clubs = Ace.new('A', 'clubs', "♣") all_cards << king_of_clubs = Card.new('K', 'clubs', 10, "♣") all_cards << queen_of_clubs = Card.new('Q', 'clubs', 10, "♣") all_cards << jack_of_clubs = Card.new('J', 'clubs', 10, "♣") all_cards << ten_of_clubs = Card.new('10', 'clubs', 10, "♣") all_cards << nine_of_clubs = Card.new('9', 'clubs', 9, "♣") all_cards << eight_of_clubs = Card.new('8', 'clubs', 8, "♣") all_cards << seven_of_clubs = Card.new('7', 'clubs', 7, "♣") all_cards << six_of_clubs = Card.new('6', 'clubs', 6, "♣") all_cards << five_of_clubs = Card.new('5', 'clubs', 5, "♣") all_cards << four_of_clubs = Card.new('4', 'clubs', 4, "♣") all_cards << three_of_clubs = Card.new('3', 'clubs', 3, "♣") all_cards << two_of_clubs = Card.new('2', 'clubs', 2, "♣") all_cards end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_cards\r\n @cards.each{|e| e.create}\r\n @symbols_card.each{|e| e.create}\r\n @cards_rotated.each{|e| e.create}\r\n end", "def my_cards\n index = 0\n @my_cards = []\n @suits.each do |suit|\n (1..13).each do |value|\n card = Card.new(value, suit)\n @my_cards.p...
[ "0.7471742", "0.7357251", "0.73570734", "0.71580964", "0.7126043", "0.7113201", "0.709008", "0.7068963", "0.70546275", "0.70480394", "0.70342565", "0.6977888", "0.6977888", "0.69651055", "0.692051", "0.6914167", "0.6912226", "0.6899868", "0.6881599", "0.6848604", "0.684584", ...
0.65493244
58
Given a directory, returns all directories that are immediate children of that directory excluding special directories `.` and `..`.
def enumerate_directories(directory) return directory. children. select(&:directory?). map(&:expand_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_subdirs(directory)\n Dir.entries(directory).select { |entry|\n entry != '.' and entry != '..' and is_dir?(\"#{directory}/#{entry}\")\n }\n end", "def dir_children(dirname=mpwd)\n simple_entries(dirname).find_all {|e|\n File.directory?(File.join(dirname, e))\n }\n end", "...
[ "0.7638104", "0.70057476", "0.67189044", "0.6481939", "0.64345044", "0.61306983", "0.612973", "0.60767", "0.60660934", "0.6062486", "0.6051012", "0.60124105", "0.5933177", "0.58806175", "0.5877884", "0.58656883", "0.5864012", "0.58394295", "0.58172023", "0.5800595", "0.579632...
0.648601
3
Given a directory, returns all files that are immediate children of that directory excluding directories.
def enumerate_files(directory) return directory. children. reject(&:directory?). map(&:expand_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_files(directory)\n Dir.entries(directory).select { |entry| not is_dir?(\"#{directory}/#{entry}\") }\n end", "def visible_files_under(directory)\n result = []\n if File.exists?(directory)\n allFiles = Dir.entries(directory)\n dirs = allFiles.select{ |f| File.directory?(File.join(di...
[ "0.74780506", "0.7093621", "0.70213926", "0.6992802", "0.6954193", "0.68545866", "0.6846414", "0.6688498", "0.6684306", "0.6555964", "0.6532517", "0.6527787", "0.6489764", "0.64504623", "0.6418011", "0.63843364", "0.63359874", "0.6319954", "0.6315337", "0.6298193", "0.6272499...
0.7309401
1
Make a stab at determining if the file specified is a shell program by seeing if it has a shebang line.
def is_shell_program?(path) magic_word = File.open(path, 'r', { :encoding => 'ASCII-8BIT' }) do |fh| fh.read(2) end return magic_word == '#!' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_shell_script?(path)\n File.open(path) do |f|\n f.read(9) == \"#!/bin/sh\"\n end\n end", "def shebang?(match)\n shebang =~ /\\b#{match}(\\s|$)/ ? true : false\n end", "def shebang_line=(_arg0); end", "def is_executable?(file)\n mime = `file -b --mime-type #{file}`\n mime.s...
[ "0.7438066", "0.66542697", "0.6593862", "0.6586622", "0.65706366", "0.6393383", "0.62673575", "0.6255626", "0.6248323", "0.622831", "0.6008073", "0.6004686", "0.5996074", "0.5994553", "0.5962212", "0.595634", "0.5934821", "0.59273785", "0.5914567", "0.5894363", "0.58910656", ...
0.7823547
0
Options include: +path+ : the URI path to listen to (defaults to '/stream') +keepalive_timeout+ : the timeout in seconds between keepalive comments (defaults to 20) +namespace+ : a namespace used as prefix for redis pubsub channels +allowed_channels+ : an array with allowed channel names a proc that takes a Rack::Request and returns an array of allowed channels for that particular request +on_register+ : a Proc that takes a Sse::Connection as argument and is called right after a connection is initiated. +on_unregister+ : a Proc that takes a Sse::Connection as argument and is called right after a connection is initiated. The same Sse::Connection object will be passed to the on_register and on_unregister callbacks. You can for example use the +connection.data+ attribute to store an identifier.
def initialize(app = nil, options = {}) @app = app @options = { path: '/stream', namespace: '', keepalive_timeout: 20 }.merge(options) @subscription_map = {} EventMachine::next_tick { setup_redis } EventMachine::next_tick { setup_keepalive } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def listen \n response.headers[\"Content-Type\"] = \"text/event-stream\"\n redis = Redis.new\n\n key = \"/node/#{params[:event_id]}:change\"\n logger.info \"listen #{key}\"\n redis.subscribe(key) do |on|\n on.message do |event, data|\n response.stream.write \"event: update\\n\"\n res...
[ "0.5768141", "0.55437756", "0.5397223", "0.5298344", "0.5191328", "0.51623774", "0.5145308", "0.5144331", "0.5135618", "0.5111566", "0.5104955", "0.5082597", "0.5061528", "0.50525457", "0.50512004", "0.50437504", "0.50396687", "0.50206244", "0.5011835", "0.499689", "0.4996117...
0.5746854
1
GET /samples GET /samples.json
def test end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @sample = Sample.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample }\n end\n end", "def samples(filter_params = {})\n get_request(shard_endpoint_uri('samples', filter_params))\n end", "def index\n @samples = S...
[ "0.69534856", "0.6939203", "0.6814256", "0.67516744", "0.66234225", "0.6532149", "0.6532149", "0.6523348", "0.6489714", "0.64232147", "0.6370491", "0.6357608", "0.6325009", "0.6311997", "0.63068664", "0.6275714", "0.6274013", "0.62677944", "0.61959803", "0.616178", "0.6137376...
0.0
-1
GET /samples/1 GET /samples/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @sample = Sample.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sample }\n end\n end", "def sample_json_response\n if @_sample_response.nil?\n example_json = fields.dig('responses', '200', 'examples', 'application/json...
[ "0.71274495", "0.66596454", "0.6617429", "0.6617429", "0.6612046", "0.6591987", "0.65919816", "0.6583159", "0.65720254", "0.64992464", "0.64299905", "0.6429778", "0.6416638", "0.6381077", "0.63655794", "0.63493353", "0.633182", "0.6292102", "0.6271172", "0.6255353", "0.625011...
0.0
-1
POST /samples POST /samples.json
def create @sample = Sample.new(sample_params) respond_to do |format| if @sample.save format.html { redirect_to @sample, notice: 'Sample was successfully created.' } format.json { render :show, status: :created, location: @sample } else format.html { render :new } format.json { render json: @sample.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @sample = Sample.new(params[:sample])\n\n respond_to do |format|\n if @sample.save\n format.html { redirect_to samples_path, notice: 'Sample was successfully created.' }\n format.json { render json: @sample, status: :created, location: @sample }\n else\n format.htm...
[ "0.7141083", "0.7099799", "0.66906804", "0.66406417", "0.65793705", "0.6522983", "0.6498193", "0.6420759", "0.6391551", "0.63422585", "0.63271666", "0.63124233", "0.62573344", "0.6200999", "0.61618364", "0.6143026", "0.6135293", "0.6070077", "0.601044", "0.59975386", "0.59681...
0.6949383
4
PATCH/PUT /samples/1 PATCH/PUT /samples/1.json
def update respond_to do |format| if @sample.update(sample_params) format.html { redirect_to @sample, notice: 'Sample was successfully updated.' } format.json { render :show, status: :ok, location: @sample } else format.html { render :edit } format.json { render json: @sample.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @sample = Sample.find(params[:id])\n\n respond_to do |format|\n if @sample.update_attributes(params[:sample])\n format.html { redirect_to samples_path, notice: 'Sample was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render act...
[ "0.65712523", "0.64691603", "0.6419393", "0.63918513", "0.63792026", "0.62873465", "0.60940784", "0.609024", "0.60694605", "0.60399264", "0.60277075", "0.60231364", "0.59766597", "0.5961478", "0.5929132", "0.5916164", "0.5900946", "0.5900946", "0.58998424", "0.5895634", "0.58...
0.63079923
8
DELETE /samples/1 DELETE /samples/1.json
def destroy @sample.destroy respond_to do |format| format.html { redirect_to samples_url, notice: 'Sample was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n format.html { redirect_to samples_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @sample = Sample.find(params[:id])\n @sample.destroy\n\n respond_to do |format|\n...
[ "0.76480424", "0.76480424", "0.7645551", "0.7407162", "0.7358793", "0.7338754", "0.7150406", "0.7098547", "0.698806", "0.6968413", "0.69566303", "0.69515824", "0.69446754", "0.6901059", "0.68780226", "0.68663245", "0.68663245", "0.68663245", "0.68663245", "0.68550235", "0.683...
0.74189293
7
Use callbacks to share common setup or constraints between actions.
def set_sample @sample = Sample.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def sample_params params[:sample] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6980629", "0.67819995", "0.67467666", "0.67419875", "0.67347664", "0.65928614", "0.6504013", "0.6498014", "0.64819515", "0.64797956", "0.64562726", "0.64400834", "0.6380117", "0.6377456", "0.63656694", "0.6320543", "0.63002014", "0.62997127", "0.629425", "0.6293866", "0.62...
0.0
-1
returns the top 10 scores on Openspace
def topusers @topusers = User.find(:all, :order => "points DESC", :limit => "10") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top_10 (matches)\n matches.sort_by! { |match| match['score'] }.reverse[:10]\nend", "def top(num = nil)\n temp = @user.scores.group(:sentence).sum(:val).sort_by{|_,v| -v}\n filter_by_num(temp, num)\n end", "def get_scores\r\n items_db = DYNAMODB.scan(table_name: TABLE_NAME).items\r\n items_h...
[ "0.77678275", "0.6852175", "0.67914927", "0.6754282", "0.67193633", "0.66178745", "0.661107", "0.6607321", "0.6601112", "0.66009295", "0.6591012", "0.65576994", "0.6519045", "0.6510493", "0.6505528", "0.6504507", "0.6501067", "0.6495973", "0.6495439", "0.64795977", "0.6454784...
0.59746414
81
shows user information avatar + username
def u(user, show_avatar = true, size = 16) if !user.nickname.nil? display_name = user.nickname else display_name = user.login end if show_avatar return avatar(user, size) + " <span title='#{display_name} (#{user.points})'>#{display_name}</span>" else return "<span title='#{display_name} (#{user.points})'>#{display_name}</span>" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n if @user_profile.image.attachment \n @profile_image = @user_profile.image\n else\n @profile_image = \"https://api.adorable.io/avatars/200/#{current_user.username}\" \n end\n end", "def show\n @user_author = User.find_by_id(@materialpicture.user_id)\n @user_author_name = @user...
[ "0.7530686", "0.7267867", "0.7256623", "0.7256623", "0.70567954", "0.7055965", "0.7049665", "0.70050794", "0.6985356", "0.6985356", "0.6960068", "0.695912", "0.695912", "0.6941426", "0.6941266", "0.6923562", "0.6847144", "0.6838325", "0.6833522", "0.6824165", "0.6821433", "...
0.72422
4
}}} For prepared statements that return model instance records
def select_prepared(plan_name, *args) # {{{ args_string = '' if args.to_s != '' && args.length > 0 then args_string = "(#{args.flatten.map { |a| "'#{a}'" }.join(',')})" end query_string = "EXECUTE #{plan_name.to_s} #{args_string}; " return select_cached(query_string) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prepare record = nil, command\n record ? Statement.new(record, command) : db.prepare(command)\n end", "def prepare_result; end", "def prepared_sql\n case prepared_type\n when :select, :all, :each\n # Most common scenario, so listed first.\n select_sql\n when :...
[ "0.6576591", "0.6558719", "0.65546215", "0.63562244", "0.62257713", "0.62257713", "0.62257713", "0.6198121", "0.61505884", "0.6121692", "0.611222", "0.6107657", "0.6068164", "0.6034927", "0.6018474", "0.60113287", "0.60056794", "0.6004066", "0.5999624", "0.59587145", "0.59217...
0.0
-1
}}} For prepared statements that return arbitrary records
def execute_prepared(plan_name, *args) # {{{ args_string = '' if args.to_s != '' && args.length > 0 then args_string = "(#{args.flatten.map { |a| "'#{a}'" }.join(',')})" end query_string = "EXECUTE #{plan_name.to_s} #{args_string}; " return perform_select(query_string).get_rows() end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exec_raw(sql, options = {})\n cursor = $connection.exec(sql)\n if(options[:return_hash])\n recordset, = pack_cursor(cursor, :return => \"hash\")\n return recordset\n else\n return_data = []\n while current_row = cursor.fetch()\n return_data.push(current_row)\...
[ "0.7207686", "0.6693692", "0.65496325", "0.650941", "0.6464795", "0.64276296", "0.6404037", "0.6259019", "0.62388533", "0.6222753", "0.6214135", "0.6198562", "0.61803573", "0.61758167", "0.6169054", "0.6152983", "0.61445665", "0.611187", "0.61068547", "0.6091655", "0.6085752"...
0.585943
36
What is the smallest positive number that is evenly divisible(divisible with no remainder) by all of the numbers from 1 to N? SOLUTION:
def is_prime?(num) return true if num == 1 || num == 2 return false if num % 2 == 0 int = 3 while int <= Math::sqrt(num) return false if num % int == 0 int += 2 end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def smallest_divisible_by_all_v2(range)\n return (range).inject(1) do |result, n| \n result.lcm n\n end\nend", "def smallest_multiple(n)\r\n dividers = (1..n)\r\n dividers.reduce(:lcm)\r\nend", "def min_divisible_by_all(num)\r\n (1..num).inject(:lcm)\r\nend", "def smallest(n)\n\tdivisible = false\n\t...
[ "0.7848905", "0.7807805", "0.77478737", "0.77267814", "0.76549506", "0.7508944", "0.7451165", "0.7449361", "0.7382869", "0.73757535", "0.7349275", "0.7281679", "0.7275512", "0.72302496", "0.7219051", "0.7198163", "0.71946985", "0.71796215", "0.71444196", "0.7126453", "0.71199...
0.0
-1
Delete current session release
def cleanup_release if ssh.directory_exists?(release_path) ssh.run("rm -rf #{release_path}") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def release!\n ensure_service!\n service.delete_session path\n end", "def delete\n if @session\n @session.destroy\n @session = nil\n end\n end", "def delete\n return unless @session\n @session.destroy\n @session = nil\n end", "def destroy\n ...
[ "0.7587336", "0.74852246", "0.7197912", "0.7186222", "0.69286567", "0.6900274", "0.6829874", "0.67848706", "0.6765451", "0.67618865", "0.6725155", "0.67089045", "0.6679904", "0.6645306", "0.66032964", "0.6591644", "0.6568679", "0.6568481", "0.65493107", "0.6540163", "0.653658...
0.61311513
53
I worked on this challenge with Jack Huang. Your Solution Below
def factorial(number) if number == 0 return 1 elsif number == 1 return 1 end i=number-1 f=number*i while i > 1 i=i-1 f=f*i end return f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def challenge; end", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 ...
[ "0.6670118", "0.64935124", "0.6405797", "0.6389439", "0.62589556", "0.62513846", "0.62220705", "0.61623204", "0.61576265", "0.6156878", "0.6141082", "0.6128271", "0.6102838", "0.606117", "0.6038531", "0.60349095", "0.6021287", "0.6013494", "0.6006348", "0.5998362", "0.5983704...
0.0
-1
Methode qui permet de mettre en gras un label
def setBold(btn, nom) label = Gtk::Label.new label.set_markup("<span weight = 'ultrabold'>#{nom}</span>") btn.add(label) btn.set_height_request(60) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def label\n end", "def label\n nome\n end", "def label; end", "def label; end", "def set_label(l); end", "def label\n return @label\n end", "def label\r\n\t\t''\r\n\tend", "def label\n label = \"#{number}: #{name}\"\n end", "def add_label label\n @labels[label] = true\n\n label\nend"...
[ "0.8457275", "0.82376856", "0.8136432", "0.8136432", "0.7971316", "0.7734121", "0.7727831", "0.7712106", "0.76194215", "0.7533873", "0.75251377", "0.75082076", "0.74817795", "0.74765384", "0.7469411", "0.74680316", "0.7418688", "0.7377389", "0.73027533", "0.7279293", "0.72675...
0.0
-1
Methode qui permet de modifier l'affichage des bouton lorsque l'utilisateur clique sur le bouton 'survie'. Le bouton se divise en 3 boutons ('facile', 'moyen' et 'difficile')
def creationHBoxSurvie( box, position , remove , positionOtherDifficulty , btnOtherMode ) if box.children[positionOtherDifficulty] != btnOtherMode box.remove( box.children[positionOtherDifficulty] ) box.add(btnOtherMode) box.reorder_child(btnOtherMode, positionOtherDifficulty) end box.remove(remove) #DELETE hBox = Gtk::Box.new(:horizontal) hBox.set_height_request(60); hBox.set_homogeneous(true) hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) ) hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) ) hBox.add ( Gtk::Button.new() ) # gestion des evenements des boutons de choix de niveau hBox.children[0].signal_connect("clicked"){ Fenetre.remove(box); nbGrille = SauvegardeGrille.getInstance.getNombreGrille indiceRand = rand(1..(nbGrille/3)) FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand))) } hBox.children[1].signal_connect("clicked"){ Fenetre.remove(box); nbGrille = SauvegardeGrille.getInstance.getNombreGrille indiceRand = rand((1+nbGrille/3)..(2*nbGrille/3)) FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand))) } hBox.children[2].signal_connect("clicked"){ Fenetre.remove(box); nbGrille = SauvegardeGrille.getInstance.getNombreGrille indiceRand = rand((1+2*nbGrille/3)..nbGrille) FenetrePartie.afficheToiSelec(FenetreMenu, PartieSurvie.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand))) } setBold( hBox.children[0] , @@lg.gt("FACILE") ) setBold( hBox.children[1] , @@lg.gt("MOYEN") ) setBold( hBox.children[2] , @@lg.gt("DIFFICILE") ) box.add( setmargin(hBox,0,15,70,70) ) #ADD box.reorder_child( hBox , position ) #REORDER Fenetre.show_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend", "def attacks(victim)\n #AFFICHE LE JOUEUR ATTAQUANT SA VICTIME\n puts \"le joueur #{self.names} attaque le joueur #{victim.names}\"\n\n #DAMAGE_COMPUTED PREND LA VALEUR DU NOMBRE OBTENU ALEATOIREMENT\n damage_computed = compute_dam...
[ "0.6093953", "0.58751285", "0.5852571", "0.5839256", "0.58385485", "0.58189803", "0.57666135", "0.5739894", "0.57251817", "0.5666428", "0.562609", "0.5607013", "0.55598885", "0.5549703", "0.55069846", "0.55016655", "0.5500432", "0.54959226", "0.54959226", "0.54770094", "0.545...
0.0
-1
Methode qui permet de modifier l'affichage des bouton lorsque l'utilisateur clique sur le bouton 'contrelamontre'. Le bouton se divise en 3 boutons ('facile', 'moyen' et 'difficile')
def creationHBoxCLM( box, position , remove , positionOtherDifficulty , btnOtherMode ) if box.children[positionOtherDifficulty] != btnOtherMode box.remove( box.children[positionOtherDifficulty] ) box.add(btnOtherMode) box.reorder_child(btnOtherMode, positionOtherDifficulty) end box.remove(remove) #DELETE hBox = Gtk::Box.new(:horizontal) hBox.set_height_request(60); hBox.set_homogeneous(true) hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) ) hBox.add ( setmargin( Gtk::Button.new(),0,0,0,5 ) ) hBox.add ( Gtk::Button.new() ) # gestion des evenements des boutons de choix de niveau hBox.children[0].signal_connect("clicked"){ Fenetre.remove(box); nbGrille = SauvegardeGrille.getInstance.getNombreGrille gridsId = (1..(nbGrille/3)).to_a.shuffle indiceRand = -1 gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0) indiceRand = id break end } if(indiceRand == -1 ) gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1) indiceRand = id break end } end if(indiceRand == -1 ) gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2) indiceRand = id break end } end if(indiceRand == -1 ) indiceRand = gridsId[0] end FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand))) } hBox.children[1].signal_connect("clicked"){ Fenetre.remove(box); nbGrille = SauvegardeGrille.getInstance.getNombreGrille gridsId = ((1 + nbGrille/3)..(2*nbGrille/3)).to_a.shuffle indiceRand = -1 gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0) indiceRand = id break end } if(indiceRand == -1 ) gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1) indiceRand = id break end } end if(indiceRand == -1 ) gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2) indiceRand = id break end } end if(indiceRand == -1 ) indiceRand = gridsId[0] end FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand))) } hBox.children[2].signal_connect("clicked"){ Fenetre.remove(box); nbGrille = SauvegardeGrille.getInstance.getNombreGrille gridsId = ((1 + 2*nbGrille/3)..nbGrille).to_a.shuffle indiceRand = -1 gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 0) indiceRand = id break end } if(indiceRand == -1 ) gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 1) indiceRand = id break end } end if(indiceRand == -1 ) gridsId.each{ |id| if(Sauvegardes.getInstance.getSauvegardeScore.scoresContreLaMontre[id][1] == 2) indiceRand = id break end } end if(indiceRand == -1 ) indiceRand = gridsId[0] end FenetrePartie.afficheToiSelec(FenetreMenu, PartieContreLaMontre.creer(SauvegardeGrille.getInstance.getGrilleAt(indiceRand))) } setBold( hBox.children[0] , @@lg.gt("FACILE") ) setBold( hBox.children[1] , @@lg.gt("MOYEN") ) setBold( hBox.children[2] , @@lg.gt("DIFFICILE") ) box.add( setmargin(hBox,0,15,70,70) ) #ADD box.reorder_child( hBox , position ) #REORDER Fenetre.show_all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def moverPrimasADespacho(cantidad_lotes)\n\t\n\nend", "def changerEnSuivant #-1=>1=>0>-1\n\t\t@couleur=@couleur%3-1\n\tend", "def panier_valid\n balance = 0\n if params[:commit] == 'Option famille'\n current_user.eleves.sort_by { |el| el.prix }.each.with_index do |ele, i|\n if i == 1 && ele.com...
[ "0.61234796", "0.5997743", "0.59718865", "0.5799232", "0.5722709", "0.5607618", "0.5603682", "0.55915296", "0.5581747", "0.5580277", "0.5556741", "0.5518329", "0.5511251", "0.5481011", "0.54755145", "0.54505134", "0.5448348", "0.5442821", "0.5425443", "0.5419622", "0.5416064"...
0.0
-1
Function constructor for immutable Set
def Set(*elements) Set.new(elements).freeze end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_set(klass = Set, *args, &block)\n return self if instance_of?(Set) && klass == Set && block.nil? && args.empty?\n klass.new(self, *args, &block)\n end", "def to_set(klass = IntegerSet, *args, &block)\n return self if instance_of?(IntegerSet) && klass == IntegerSet && block.nil? && args.empty?\n ...
[ "0.72407925", "0.68801", "0.66608435", "0.662431", "0.64515585", "0.64301264", "0.6287075", "0.62222373", "0.61873573", "0.6140284", "0.6140284", "0.6114759", "0.61047876", "0.60450715", "0.59863216", "0.5957244", "0.59066105", "0.5890212", "0.5861376", "0.58516794", "0.58465...
0.6943262
1
Functional constructor for weighted and unweighted links.
def Link(from, to, weight = nil) if weight WeightedLink.new(from, to, weight) else Link.new(from, to) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def link(src, dest, w=1, add=:add)\n if (!@directed) \n begin\n src, dest = dest, src if (src > dest)\n rescue ArgumentError\n src, dest = dest, src if (src.object_id > dest.object_id)\n end\n end\n key = [src,dest]\n unless l = @links[key]\n l = Link.new(self, src...
[ "0.6252265", "0.62365425", "0.6232321", "0.61812884", "0.6170899", "0.6011076", "0.58283603", "0.5809302", "0.5762102", "0.5742521", "0.57237875", "0.570081", "0.5675787", "0.5666668", "0.5584298", "0.55717134", "0.55508465", "0.5520146", "0.5518455", "0.55116475", "0.550711"...
0.7324075
0
TODO this should call an action not use send
def enqueued(t, game) @enqueued_at = t raise "timed event: unknown start action #{@start_action} rest of #{@end_action}conf#{@start_data} #{@end_data}" unless game.respond_to? @start_action game.send(@start_action, @start_data) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def process\n send_request @action\n end", "def process_action(...)\n send_action(...)\n end", "def send_request; end", "def send_action(*_arg0); end", "def act\n end", "def request; end", "def request; end", "def request; end", "def request; end", "def request; end", "def ...
[ "0.68344945", "0.6798762", "0.672713", "0.65715086", "0.6540881", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.6462667", "0.63862383", "0.6375067", "0.6375067", "0.6375067", "0.6375067", ...
0.0
-1
Write code to remove duplicates from an unsorted linked list. Follow ups: How would you solve this problem if a temporary buffer is not allowed? Iterate through the linked list Have a histogram hash that keeps tracks of occurrencies of values in the list If ever reach a value that already has an occurrence in the hash, don't increment the occurrence Have a variable that keeps track of the previous node and point it to the current node's next node if we find a duplicate Edge cases: Empty linked list
def remove_dups(head) current_node = head previous_node = nil histogram = Hash.new(0) until current_node.nil? if histogram[current_node].zero? histogram[current_node.value] += 1 previous_node = current_node current_node = current_node.next else previous_node.next = current_node.next current_node = previous_node.next end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_duplicates(linked_list)\n duplicate_hash = Hash.new(0)\n test_node = linked_list.head.next\n until test_node.next.value == nil\n next_node = test_node.next\n if duplicate_hash[test_node.value] > 0\n linked_list.remove(test_node)\n end\n duplicate_hash[test_node.value] += 1\n test_...
[ "0.79479873", "0.79371727", "0.77724236", "0.7760853", "0.7725404", "0.7674425", "0.75274533", "0.7507289", "0.7482287", "0.7428985", "0.741406", "0.7380211", "0.73590076", "0.73262995", "0.72735965", "0.71397805", "0.7090933", "0.70181376", "0.70041484", "0.6996934", "0.6943...
0.82454383
0
if the concert is in the bands hometown return ture otherwise false
def hometown_show d if (venue.city == band) true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hometown_show\n if self.venue.city == self.band.hometown\n return true\n end\n end", "def hometown_show?\n # self.venue.city\n # self.band.hometown\n\n self.venue.city == self.band.hometown\n end", "def works_at_hanson_st?\n @city == HANSON\n end", "def has_town?\n !!province...
[ "0.7525953", "0.7418681", "0.71429586", "0.687276", "0.6706632", "0.65676695", "0.6527762", "0.6406399", "0.64053637", "0.6310119", "0.6299607", "0.62913156", "0.62760895", "0.62741125", "0.62690705", "0.6213714", "0.6206525", "0.6204149", "0.62005585", "0.61759096", "0.61686...
0.7685509
0
This challenge took me [2] hours. Pseudocode Input= Array of numbers Output = print out fizzbuzz for numbers that are divisible by 3 and 5, fizz for number that are divisible only by 3, and buzz for numbers that are dibisible only by 5, and print just the numbers for the rest Steps= Iterate through the array of numbers check its divisibility, and put fizzbuzz that numbers that are divisible both by 3 and 5 put fizz for numbers that are divisible only by 3 put buzz for numbers that are divislb only by 5 put just the numbers for the rest print out the results in array Initial Solution def super_fizzbuzz(array) result=[] array.each do |i| if i % 3 == 0 && i % 5 == 0 result << 'FizzBuzz' elsif i % 3 == 0 result << 'Fizz' elsif i % 5 == 0 result << 'Buzz' else result << i end end p result end Refactored Solution
def super_fizzbuzz(array) i=0 while i < array.length if array[i]%5==0 && array[i]%3==0 array[i]= 'FizzBuzz' elsif array[i]%3==0 array[i]= 'Fizz' elsif array[i]%5==0 array[i]= 'Buzz' end i+=1 end p array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def super_fizzbuzz(array)\n fizzbuzz_array = []\n counter = 0\n while counter < array.length\n if array[counter] % 3 == 0 && array[counter] % 5 != 0\n fizzbuzz_array << \"Fizz\"\n elsif array[counter] % 5 == 0 && array[counter] % 3 != 0\n fizzbuzz_array << \"Buzz\"\n elsif array[counter] % 3 ...
[ "0.8584148", "0.85081327", "0.848062", "0.84251446", "0.8422344", "0.84183127", "0.83648473", "0.8272745", "0.82644373", "0.8244698", "0.82329017", "0.81712574", "0.8167414", "0.8162882", "0.8161074", "0.8152878", "0.8147905", "0.81393474", "0.813301", "0.8107017", "0.8098908...
0.84154344
6
include PostgresHelper attr_accessor :id
def from_postgres(postgres_user_info) # user = UserInfo.new # puts "FROM POSTGRES INFO #{postgres_user_info.inspect}" if postgres_user_info self.id = postgres_user_info['id'] || '' self.name = postgres_user_info['name'] || '' self.updated_at = postgres_user_info['updated_at']? postgres_user_info['updated_at'].to_datetime : DateTime.now self.title = postgres_user_info['title'] || '' if (postgres_user_info['about']) postgres_user_info['about'][0] = '[' postgres_user_info['about'][postgres_user_info['about'].length-1] = ']' unescaped_about = PostgresHelper.unescape_from_postgres(postgres_user_info['about']) else end # puts "UNESAPED ABOUT #{unescaped_about}" # self.about =(unescaped_about)? JSON.parse(unescaped_about) : Array.new self.about =(unescaped_about)? PostgresHelper.from_array_string_load(unescaped_about) : Array.new self.location = (postgres_user_info['location'] && postgres_user_info['location'] != 'null')? PostgresUserInfos.from_json_load( postgres_user_info['location']) : Hash.new self.location_id = postgres_user_info['location_id'] || '' self.latitude = (postgres_user_info['latitude'] && !postgres_user_info['latitude'].empty?)? postgres_user_info['latitude'].to_f : nil self.longitude = (postgres_user_info['longitude'] && !postgres_user_info['longitude'].empty?)? postgres_user_info['longitude'].to_f : nil self.public_service = (postgres_user_info['public_service'])? postgres_user_info['public_service'] : false self.keywords_rated = from_json_load(postgres_user_info['keywords_rated']) # self.current_keywords = self.keywords_rated self.current_keywords = (self.keywords_rated && !self.keywords_rated.empty?)?self.keywords_rated.keys : Array.new end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id; end", "def id\n __id\n end", "def id; 1; end", "def real_id\n @id\n end", "def real_id\n ...
[ "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.7339177", "0.73149484", "0.7279733", "0.723136", "0.723136", "0.72103226", "0.72103226", "0.71962595", "0.71213704", "0.7107414", ...
0.0
-1
For each line make the key(s) and emit them then for that line
def process(line) parts = line.chomp.split(/\t/) keys = line_key(parts) keys.each do |k| yield [k, *parts] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go!\n results = {}\n dups = []\n\n @enumerable.each do |line|\n line.strip!\n sequences(line).each do |sequence|\n if results[sequence]\n dups << sequence\n else\n results[sequence] = line\n end\n end\n end\n \n # Remove dups from the resu...
[ "0.63806945", "0.6258037", "0.5987613", "0.5751157", "0.56689036", "0.5575979", "0.5573288", "0.55653423", "0.5522806", "0.5427221", "0.54171056", "0.5382973", "0.53793085", "0.5358747", "0.5358154", "0.53499544", "0.52597004", "0.5239695", "0.5228768", "0.52137387", "0.52075...
0.66406846
0
Detects whether this application is suitable for autoreconfiguration
def detect @version ? id(@version) : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def config\n mode == \"autoinst_config\"\n end", "def detect\n @auto_reconfiguration_version, @auto_reconfiguration_uri = SpringAutoReconfiguration.find_auto_reconfiguration(@app_dir, @configuration)\n @auto_reconfiguration_version ? id(@auto_reconfiguration_version) : nil\n end", "def aut...
[ "0.65026486", "0.64635855", "0.6415782", "0.63724494", "0.62873393", "0.62873393", "0.627237", "0.6206193", "0.61715835", "0.61633694", "0.6135164", "0.6128465", "0.6035531", "0.6029668", "0.6028354", "0.6022398", "0.6014299", "0.6008568", "0.6000775", "0.5985345", "0.5975544...
0.0
-1
Downloads the Autoreconfiguration JAR
def compile JavaBuildpack::Util.download(@version, @uri, 'Auto Reconfiguration', jar_name(@version), @lib_directory) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform_download_configuration!\n find_nginx!\n if not @nginx_conf\n error \"Could not find the NginX configuration file in #{y(@nginx_conf)}\"\n exit\n end\n \n local_nginx_dir = File.join(local.gitpusshuten_dir, 'nginx')\n FileUtils.mkdir_p(local_ng...
[ "0.59470683", "0.5711322", "0.5667881", "0.559568", "0.55104804", "0.5493774", "0.5492138", "0.54642326", "0.54256034", "0.5386822", "0.5372146", "0.5370584", "0.5353639", "0.5330559", "0.5316289", "0.529656", "0.5285697", "0.5260086", "0.5244875", "0.52281433", "0.5212693", ...
0.61372584
0
that does not equal 0.0 is true
def to_b !zero? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def approximate?\n !exact?\n end", "def near_zero_or_less?(value)\n (value < 0.0 or near_zero?(value))\n end", "def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < toleranc...
[ "0.6914562", "0.68451107", "0.6831074", "0.6765833", "0.67067766", "0.6676411", "0.65820336", "0.6564516", "0.6544035", "0.6541917", "0.6541917", "0.6529434", "0.6527969", "0.65264046", "0.6502138", "0.64989376", "0.64906037", "0.64870113", "0.6482905", "0.6482905", "0.647948...
0.0
-1
Rounds float to the precision specified 100.5235.round_to => 101.0 100.5235.round_to(1) => 101.5 100.5235.round_to(3) => 101.524
def round_to(precision=0) mulitplier = 10.0 ** (precision) (((((self)*mulitplier).round).to_f)/mulitplier) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def round_to(decimal_places)\n to_f.round(decimal_places)\n end", "def round(number, precision)\n ((number * 10**precision).round.to_f) / (10**precision)\n end", "def round(float, decimal_places)\n sprintf(\"%.#{decimal_places}f\", float)\n end", "def round_float(float, places); end", "def floa...
[ "0.8028547", "0.7857059", "0.77214545", "0.7714461", "0.76052624", "0.75774676", "0.75214744", "0.75100905", "0.74549985", "0.73176146", "0.7287837", "0.7190709", "0.7159201", "0.71151817", "0.70879894", "0.7054623", "0.6994332", "0.6974736", "0.6947288", "0.68917876", "0.688...
0.79195976
1
returns boolean value for common boolean string values
def to_b return true if self =~ BOOLEAN_REGEX false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def value_is_boolean?(string)\n return %w[true false yes no y n].include?(string.downcase)\n end", "def result\n val = value.sub(/^boolean-/, '')\n val.casecmp(\"true\").zero?\n end", "def to_bool\n dc = to_s.downcase\n\n if TRUE_WORDS.include?(dc)\n true\n elsif FALSE_WORD...
[ "0.7796263", "0.77290726", "0.7416112", "0.74141365", "0.73810846", "0.7299423", "0.7279104", "0.726054", "0.7188894", "0.7154388", "0.7118743", "0.705926", "0.7050487", "0.703741", "0.7032188", "0.7032188", "0.7017373", "0.7006849", "0.699303", "0.69724864", "0.6963494", "...
0.6471406
58
Takes known US formatted date/time strings (MM/DD/YYYY TIME) and converts them to international format (YYYY/MM/DD TIME). Also cleans up C JSON Date (really a time integer) value. safe_date_string("12/31/2010") => '20101231' safe_date_string("12/31/2010T23:30:25") => '20101231T23:30:25' safe_date_string("12/31/2010 23:30:25") => '20101231 23:30:25' safe_date_string("\/Date(1310669017000)\/") =>
def safe_datetime_string safe_date = nil if self =~ US_DATE_REGEX safe_date = us_date_to_iso_str elsif self =~ JSON_DATE_REGEX safe_date = json_date_to_time.to_s else safe_date = self end safe_date end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def normalize_date_strings(date_strings, separator = '/')\n return date_strings if RUBY_VERSION < '1.9'\n date_strings = [*date_strings] # ensure Array\n date_strings.map! do |ds|\n fragments = ds.split(separator)\n [fragments[1], fragments[0], fragments[2]].join(separator)\n end\n end", ...
[ "0.64009744", "0.6249786", "0.6082967", "0.60786235", "0.60703707", "0.60011", "0.59392226", "0.59177995", "0.589846", "0.585969", "0.5844215", "0.5844215", "0.58311677", "0.58273405", "0.58135545", "0.58114177", "0.57983214", "0.57799935", "0.5759994", "0.5758653", "0.575855...
0.6890183
0
Use safe_datetime_string help with those pesky US date formats in Ruby 1.9 or to change an integer string to date
def to_date return self.to_i.to_date if self =~ DIGIT_ONLY_REGEX if self =~ US_DATE_REGEX Date.strptime(self.tr(DATE_TR,'-'), US_DATE_FORMAT) elsif self =~ JSON_DATE_REGEX json_date_to_time.to_date else Date.strptime(self.tr(DATE_TR,'-'), ISO_DATE_FORMAT) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end", "def safe_datetime_string\n safe_date = nil\n if self =~ US_DATE_REGEX\n safe_date = us_date_to_iso_str\n elsif self =~ JSON_DATE_REGEX\n safe_date = json_date_to_time.to_s\n else...
[ "0.7155179", "0.7124238", "0.7088141", "0.70011497", "0.67767096", "0.6746792", "0.67281824", "0.6715919", "0.669914", "0.6672858", "0.66674703", "0.6661269", "0.66478705", "0.6622896", "0.65794486", "0.65308654", "0.652221", "0.6521958", "0.6506142", "0.6484642", "0.64496714...
0.0
-1
Use safe_datetime_string help with those pesky US date formats in Ruby 1.9 or to change an integer string to date
def to_time return self.to_i.to_time if self =~ DIGIT_ONLY_REGEX if self =~ US_DATE_REGEX Time.parse(us_date_to_iso_str) elsif self =~ JSON_DATE_REGEX json_date_to_time else Time.parse(self) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def string_to_datetime(string)\n super(handle_date_parse_input(string))\n end", "def safe_datetime_string\n safe_date = nil\n if self =~ US_DATE_REGEX\n safe_date = us_date_to_iso_str\n elsif self =~ JSON_DATE_REGEX\n safe_date = json_date_to_time.to_s\n else...
[ "0.7155501", "0.71236235", "0.708873", "0.70003843", "0.6775027", "0.6745972", "0.67268485", "0.6716436", "0.66986847", "0.6672011", "0.66675776", "0.6659969", "0.66472286", "0.6620941", "0.65776044", "0.6530306", "0.6522448", "0.6521635", "0.6505954", "0.6484742", "0.6449500...
0.0
-1
Remove none numeric characters then run default ruby float cast
def to_f gsub(SCRUB_NUMBER_REGEX, EMPTY_STRING).core_to_f end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_process_float( val )\n\t\t\treturn Float( val.to_s )\n\t\tend", "def convert_float(str)\n return nil if !str\n str.gsub! /[^0-9.]/, \"\"\n neg = str.match /\\((.*?)\\)/\n float = str.to_f\n neg ? -float : float\n end", "def convert_float( text_value )\r\n (!text_value.empty?) ? text_v...
[ "0.79024374", "0.7483114", "0.72769636", "0.7184323", "0.6987389", "0.69836974", "0.6949767", "0.6880023", "0.6833504", "0.6828915", "0.6790639", "0.6778442", "0.67424923", "0.67006284", "0.6693914", "0.6593933", "0.6585941", "0.65810823", "0.65718967", "0.65576327", "0.65442...
0.5953416
65
For now, we assume that write does not include id
def write(table, row) file = $tables[table] # By default, set the ID to the last index + 1 # This can potentially re-use a deleted ID # But it cannot (yet) create two rows with the same ID id = file.size() == 0 ? 1 : file.last_line.split(",").first.to_i + 1 # Add the id to the beginning of the row row.unshift(id) file.puts(serialize(row)) id end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pending_write?; end", "def write_value_using_id_strategy(writer, _key)\n writer.push_value(@object.attributes['_id'], 'id') unless @object.new_record?\n end", "def write\n @id = store.put(self)\n end", "def write\n write_data\n end", "def write; end", "def write; end", "def write?; e...
[ "0.6438489", "0.631332", "0.6303347", "0.62978226", "0.6260789", "0.6260789", "0.6219477", "0.6219477", "0.6219477", "0.60446864", "0.6018515", "0.59657264", "0.5910093", "0.5906797", "0.58926094", "0.58926094", "0.58926094", "0.58605856", "0.584262", "0.5837871", "0.58347183...
0.548788
42
For simplicity, we will completely rewrite the table
def delete(table, id) file = $tables[table] raw_row = binary_search(file, id) row_id = raw_row[0...10].to_i # Read the data after the current row cur_size = file.size() file_offset = row_id * ROW_LENGTH file.seek(file_offset, File::SEEK_SET) file_end = file.read(file.size() - file_offset) # Overwrite file starting at current row file.seek((row_id - 1) * ROW_LENGTH, File::SEEK_SET) file.write(file_end) file.truncate(cur_size - ROW_LENGTH) # Shrink size of file by one row true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rebuild(table); end", "def update_table_sql(sql)\n sql << ' '\n source_list_append(sql, @opts[:from][0..0])\n end", "def table; end", "def table; end", "def table; end", "def table; end", "def iso_code_table\n update unless @iso_code_table\n @iso_code_table\n end", "def ...
[ "0.7948124", "0.62820804", "0.6261469", "0.6261469", "0.6261469", "0.6261469", "0.6207432", "0.6148647", "0.6132191", "0.6120511", "0.6048569", "0.602405", "0.5991208", "0.59648037", "0.5964296", "0.58568937", "0.5846725", "0.5821217", "0.5817181", "0.5805875", "0.5794623", ...
0.0
-1
Turn row to CSV
def serialize(row) row .map { |c| db_format(c) } .join(",") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv(rows)\n rows.map { |r| r.join(';') }.join(\"\\n\")\n end", "def to_csv\n str = ''\n str << ( columns.join(\",\") + \"\\n\" )\n rows.each { |row|\n next if is_hr(row) || !row_visible(row)\n str << ( row.map{|x|\n x = x.to_s\n x.gsub(/[\\r\\n]/, ' ').gsub(/\\s+/, ' ').g...
[ "0.7754217", "0.7610371", "0.76005054", "0.7397962", "0.7352303", "0.7231261", "0.72139144", "0.70896906", "0.7054959", "0.7045105", "0.70198977", "0.7006398", "0.6961379", "0.6885295", "0.6858983", "0.68478465", "0.6782315", "0.67539245", "0.67539245", "0.6677587", "0.667030...
0.646253
34
INTERFACE We will process metacommands separately Metacommands start with a "." For now we will support only ".exit" to escape the REPL.
def process_meta_command(command) # -> String if command == :exit puts "EXIT..." close() exit end "" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def commands; end", "def set_commands; end", "def subcommands(cmd); end", "def subcommands(cmd); end", "def subcommand() __subcommand__ end", "def subcommands() __subcommands__ end", "def end_commands\n abstract!\n end", "def commandInterface\n\t\tisfinished = false\n\t\tcmd = \"\" \n...
[ "0.634371", "0.6299895", "0.6189378", "0.6189378", "0.6150772", "0.6130891", "0.6085452", "0.6071684", "0.59328383", "0.59305656", "0.59305656", "0.59305656", "0.59305656", "0.59305656", "0.59305656", "0.59100366", "0.5894281", "0.5887555", "0.58782506", "0.58763295", "0.5841...
0.72132796
0
rubocop:enable Metrics/MethodLength Return encoded header
def encode [@signature1].pack('L*') << [@signature2].pack('L*') << [@flags].pack('L*') << [@version].pack('L*') << @master_seed << @encryption_iv << [@groups_count].pack('L*') << [@entries_count].pack('L*') << @content_hash << @master_seed2 << [@rounds].pack('L*') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encode_header(s); s; end", "def raw_headers; end", "def header_data\n\t\treturn self.normalized_headers.to_s\n\tend", "def header_str\n \"\"\n end", "def patched_encoded\n buffer = header.encoded\n buffer << \"\\r\\n\"\n buffer << body.to_s\n buffer\n end", "d...
[ "0.809916", "0.73499763", "0.7259496", "0.68839025", "0.68610173", "0.6852649", "0.68168855", "0.67906314", "0.6781441", "0.6744992", "0.6714935", "0.67041916", "0.66949034", "0.66533417", "0.6628501", "0.66171366", "0.66171366", "0.66171366", "0.66171366", "0.66171366", "0.6...
0.0
-1
GET /questionario_egressos GET /questionario_egressos.json
def index checar_super @pnome = params[:pnome] @pdata_ini = params[:pdata_ini] @pdata_fim = params[:pdata_fim] @pdata_ate = params[:pdata_ate] @data_ate = (params[:pdata_ate].to_date+1.days).to_s if params[:pdata_ate]# +1 pegar a data cheia, update_at time @pcurso = params[:pcurso] @prealizado = params[:prealizado] if not(@pcurso ==nil) filtro_curso = "nome_curso like '%"+@pcurso+"%'" else filtro_curso = "1=1" end if not(@pnome ==nil) filtro_nome = "nome_completo like '%"+@pnome+"%'" else filtro_nome = "1=1" end osEgressos = Egresso.where(filtro_nome) if @pdata_ini.present? && @pdata_fim.present? asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso).where("data_fim >= (?) AND data_fim <= (?)", @pdata_ini, @pdata_fim) else if @pdata_ini.present? && not(@pdata_fim.present?) asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso).where("data_fim >= (?) ", @pdata_ini) end if not( @pdata_ini.present?) && @pdata_fim.present? asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso).where("data_fim <= (?) ", @pdata_fim) end if not( @pdata_ini.present?) && not(@pdata_fim.present?) &&@pcurso.present? asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)).where(filtro_curso) else asFormAcads = FormAcad.where(egresso_id: osEgressos.map(&:id)) end end if @prealizado == "S" @realizado = "true" else @realizado = "false" end puts @prealizado @forms = QuestionarioEgresso.where(form_acad_id: asFormAcads.map(&:id)).where(filtro_curso).where("realizado = '"+@realizado+"'").where("updated_at <= (?)" , @pdata_ate) @questionario_egressos = @forms.paginate(page: params[:page], per_page: 5).order("egresso_id") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_questionario_egresso\n @questionario_egresso = QuestionarioEgresso.find(params[:id])\n end", "def create\n @questionario_egresso = QuestionarioEgresso.new(questionario_egresso_params)\n\n respond_to do |format|\n if @questionario_egresso.save\n format.html { redirect_to question...
[ "0.6630252", "0.6577431", "0.6296", "0.60005254", "0.5595407", "0.5568901", "0.5508309", "0.5452108", "0.5443397", "0.5425567", "0.54027015", "0.53896606", "0.53510714", "0.53424025", "0.5298733", "0.52822226", "0.52671903", "0.5226774", "0.5210258", "0.5202801", "0.5184251",...
0.0
-1
GET /questionario_egressos/1 GET /questionario_egressos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_questionario_egresso\n @questionario_egresso = QuestionarioEgresso.find(params[:id])\n end", "def create\n @questionario_egresso = QuestionarioEgresso.new(questionario_egresso_params)\n\n respond_to do |format|\n if @questionario_egresso.save\n format.html { redirect_to question...
[ "0.66807", "0.65182376", "0.6279607", "0.5888648", "0.588723", "0.5882541", "0.58330846", "0.57566166", "0.5667242", "0.56377727", "0.5628532", "0.5608778", "0.56039613", "0.55942124", "0.5585629", "0.55595964", "0.5548359", "0.55441695", "0.5508043", "0.54977393", "0.5494365...
0.0
-1
POST /questionario_egressos POST /questionario_egressos.json
def create @questionario_egresso = QuestionarioEgresso.new(questionario_egresso_params) respond_to do |format| if @questionario_egresso.save format.html { redirect_to questionario_egressos_path, notice: 'Questionario incluído com sucesso.' } format.json { render :show, status: :created, location: questionario_egressos_path } else format.html { render :new } format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def questionario_egresso_params\n params.require(:questionario_egresso).permit(:auxiliar, :nome_curso,:curso_id, :realizado, :form_acad_id, :egresso_id, :ig_idade, :ig_genero, :ig_cor, :ig_est_conjug, :ia_qual_curso, :ia_nome_curso, :ia_ano_iniciou, :ia_ano_concluiu, :ia_satisf_palestras, :ia_satisf_oficina, ...
[ "0.6672659", "0.6631674", "0.6585595", "0.62861395", "0.6275319", "0.5895884", "0.58818436", "0.58555984", "0.5719281", "0.5683607", "0.56761897", "0.56534475", "0.56318355", "0.5619606", "0.5601388", "0.5597034", "0.55484337", "0.5533738", "0.5531236", "0.5488991", "0.542488...
0.77029645
0
PATCH/PUT /questionario_egressos/1 PATCH/PUT /questionario_egressos/1.json
def update respond_to do |format| if @questionario_egresso.update(questionario_egresso_params) format.html { redirect_to home_path, notice: 'Questionario preenchido com sucesso.' } format.json { render :show, status: :ok, location: questionario_egressos_path } else format.html { render :edit } format.json { render json: @questionario_egresso.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @question.update(question_params)\n format.html { redirect_to @question, notice: 'La pregunta fue modificada correctamente.' }\n format.json { render :show, status: :ok, location: @question }\n else\n format.html { render :edit }\n f...
[ "0.64545584", "0.64470184", "0.6330834", "0.6323789", "0.6323135", "0.62889564", "0.62721944", "0.62679297", "0.6263592", "0.6261784", "0.6251707", "0.6236323", "0.62331885", "0.62237036", "0.62147707", "0.6133462", "0.6123554", "0.6123554", "0.6123554", "0.6114019", "0.60708...
0.7440442
0
DELETE /questionario_egressos/1 DELETE /questionario_egressos/1.json
def destroy @questionario_egresso.destroy respond_to do |format| format.html { redirect_to questionario_egressos_path(@questionario_egresso, egresso_id: @questionario_egresso.egresso_id), notice: 'Questionario excluído com sucesso.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\r\n checar_egresso_super\r\n @egresso.destroy\r\n respond_to do |format|\r\n format.html { redirect_to egressos_url, notice: 'Egresso excluído com sucesso.' }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @question.destroy\n respond_to do |format|\...
[ "0.7280255", "0.7244226", "0.7179036", "0.71341497", "0.71156216", "0.7115618", "0.7104042", "0.7083343", "0.7072378", "0.7054231", "0.7048593", "0.7025022", "0.7012467", "0.7005945", "0.69730175", "0.6954191", "0.69532424", "0.694578", "0.693468", "0.69107544", "0.69080573",...
0.78672314
0
Use callbacks to share common setup or constraints between actions.
def set_questionario_egresso @questionario_egresso = QuestionarioEgresso.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def questionario_egresso_params params.require(:questionario_egresso).permit(:auxiliar, :nome_curso,:curso_id, :realizado, :form_acad_id, :egresso_id, :ig_idade, :ig_genero, :ig_cor, :ig_est_conjug, :ia_qual_curso, :ia_nome_curso, :ia_ano_iniciou, :ia_ano_concluiu, :ia_satisf_palestras, :ia_satisf_oficina, :ia_satisf_minicurso, :ia_satisf_seminario, :ia_satisf_vis_tec, :ia_satisf_estagio, :ia_satisf_prat_prof, :ia_satisf_bolsas, :ia_est_dur_curso, :ia_empresa_pq_sim, :ia_empresa_pq_nao, :ia_avalia_curso, :ia_nessec_atlzr, :ia_fazer_atlzr, :saip_esta_inst, :saip_back_inst, :saip_curso_atual, :saip_pq_back, :saip_pqnao_back, :saip_trab_atual, :saip_trab_area, :saip_tempo, :saip_vinculo, :saip_local, :saip_renda, :saip_ja_trab, :saip_prim_oport, :saip_pq_nao_esta, :saip_texto1, :saip_pq_nunca, :saip_texto2) 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
Resolves conflict add file to staged area
def resolve @base.add(@path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def try_resolve_conflict\n # retry the merge\n working_changeset = self[nil]\n merge_changeset = working_changeset.parents.last\n \n # backup the current file to a .resolve file (but retain the extension\n # so editors that rely on extensions won't bug out)\n ...
[ "0.6969783", "0.6516617", "0.6491172", "0.6335912", "0.57899153", "0.5722829", "0.56688976", "0.56387454", "0.55698955", "0.5550421", "0.55307037", "0.55158746", "0.5512391", "0.5466221", "0.53982687", "0.5393984", "0.5375969", "0.53402245", "0.53193307", "0.53150785", "0.530...
0.5218371
25
returns winning marker or nil
def winning_marker WINNING_LINES.each do |line| squares = @squares.values_at(*line) if three_identical_markers?(squares) return squares.first.marker end end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winning_marker\n WINNING_LINES.each do |line|\n squares = @squares.values_at(*line)\n if three_identical_markers?(squares)\n return squares.first.marker # return the corresponding detected marker\n end\n end\n nil\n end", "def winning_marker\n WINNING_LINES.each do |line|\n...
[ "0.85002774", "0.8436989", "0.84034675", "0.84034675", "0.84034675", "0.84034675", "0.84034675", "0.84034675", "0.84034675", "0.84034675", "0.840281", "0.8393305", "0.83877844", "0.8382617", "0.83823586", "0.83460945", "0.83377886", "0.81496006", "0.81261563", "0.8119364", "0...
0.83985656
11
You may assume no duplicates in the array. Naive Approach O(N) Iterate through every element, if current element >= target return the index
def search_insert(arr, target) arr.each_with_index do |element, index| return index if element >= target end arr.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_index(array, target)\n index = 0\n found_index = nil\n\n array.each do |element|\n if element == target\n found_index = index\n end\n index += 1\n end\n\n found_index\nend", "def search_target(nums, target)\n return -1 if nums.empty? || !target\n start_ind = 0\n last_ind = nu...
[ "0.7710215", "0.74841803", "0.73470235", "0.7325671", "0.73082954", "0.72499514", "0.7139708", "0.70808256", "0.7079577", "0.7078256", "0.70670986", "0.7055596", "0.70440763", "0.70414275", "0.7037703", "0.7031434", "0.7027173", "0.69715285", "0.6952183", "0.69246745", "0.690...
0.73555815
2
Returns true or false if the player is logged in.
def logged_in? !session[:player_id].nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def logged_in?\n !current_player.nil?\n end", "def logged_in?\n !current_player.nil?\n end", "def logged_in?\n @current_player.is_a?(Player)\n end", "def logged_in?\n if session[:username]\n if session[:logged_in?]\n return true\n end\n else\n return false\...
[ "0.86407477", "0.86407477", "0.84310234", "0.81205475", "0.8090825", "0.8061363", "0.8061363", "0.80012524", "0.79322904", "0.79322904", "0.79322904", "0.79322904", "0.79173934", "0.7892113", "0.7875051", "0.7867881", "0.7853163", "0.78527623", "0.78527623", "0.7838977", "0.7...
0.8433673
2
Formats the ActivationRecord for the logger.
def record ar, mode ad = ar.advised msg = nil case mode when :before, :after msg = ad.log_prefix(logger, ar).to_s msg = msg.dup if msg.frozen? ar[:args] ||= format(ar.args, :args) if ad[:log_args] != false ar[:meth] ||= "#{ad.meth_to_s} #{ar.rcvr.class}" msg << "#{format(ar[:"time_#{mode}"], :time)} #{ar[:meth]}" msg << " #{format(ar.rcvr, :rcvr)}" if ad[:log_rcvr] msg << " ( #{ar[:args]} )" if ar[:args] end case mode when :before msg << " {" when :after msg << " }" if ar.error msg << " #{format(ar[:error], :error )}" if ad[:log_error] != false else msg << " #{format(ar[:result], :result)}" if ad[:log_result] != false end end msg end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_formatter; end", "def log_formatter; end", "def to_log_format\n @log_format ||= begin\n attributes = []\n attributes << \"#{LOG_ATTR_ENV}=#{env}\" unless env.nil?\n attributes << \"#{LOG_ATTR_SERVICE}=#{service}\"\n attributes << \"#{LOG_ATTR_VERSION...
[ "0.5497052", "0.5497052", "0.54417574", "0.5405089", "0.50963205", "0.50928205", "0.498088", "0.498088", "0.49433672", "0.49433672", "0.49433672", "0.49260613", "0.49142674", "0.4898576", "0.4897965", "0.4830425", "0.4753048", "0.47373948", "0.47322837", "0.47320268", "0.4709...
0.4784783
16
=begin idea: given argument n produce a string consisting of n lines each line has length n, and an ascending number of stars rightjustified in line, from 1 to n. implementation details: can produce the overall string with inject method call inject on range (1..n), pass empty string as initial value, block param num on each iteration, add another line to memostring with num stars rightjustified in string of length n, add newline at the end. how to get a rightjustified string? string.rjust(n) where string is a sequence of stars. =end
def triangle(n) triangle = (1..n).inject('') do |memo, current_num| stars = '*' * current_num line = stars.rjust(n) + "\n" memo + line end puts "\n" + triangle + "\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def staircase(n)\n for i in 1..n do\n puts (\"#\" * i).rjust(n)\n end\n\nend", "def tower_builder(n)\n (1..n)\n .map { |i| ' ' * (n - i) + '*' * (i + i - 1) + ' ' * (n - i) }\nend", "def letra_i(n)\n result = \"\"\n n.times do |i|\n if i == 0 || i == n-1\n n.times {resu...
[ "0.69316155", "0.6731054", "0.671986", "0.6602063", "0.6600533", "0.6553574", "0.64965814", "0.64634234", "0.64489734", "0.64206165", "0.6400786", "0.6348424", "0.6344818", "0.6341171", "0.63302374", "0.6283368", "0.62775785", "0.62698853", "0.6267738", "0.62653893", "0.62653...
0.70692235
0
TODO: Colorized output for all feedback types, or running counters, or TODO: something...
def success!(info = nil) @logger.error { info } if info @successes += 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output(message, type)\n puts \"\\e[31m[ ✘ ]\\e[0m #{message}\" if type == 'error'\n puts \"\\e[32m[ ✔︎ ]\\e[0m #{message}\" if type == 'success'\n puts \"\\e[33m[ ✻ ]\\e[0m #{message}\" if type == 'info'\nend", "def feedback\n end", "def tally\n return \"\"\n\n text = \"%s concerns: %s pa...
[ "0.65192735", "0.62432534", "0.62414855", "0.62272316", "0.6187011", "0.60789466", "0.60214823", "0.6016784", "0.59771425", "0.5971962", "0.59434277", "0.59279495", "0.58759886", "0.5863351", "0.5837028", "0.5831333", "0.5825332", "0.58015454", "0.5786821", "0.5781382", "0.57...
0.0
-1
Opens an active debugger for the process with the given PID.
def open_active_debugger(pid) ITwibDebugger.new(@connection, @device_id, send(Command::OPEN_ACTIVE_DEBUGGER, [pid].pack("Q<")).wait_ok.object_ids[0]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_debugger\n # First try the more modern 'byebug'\n begin\n require \"byebug\"\n byebug\n rescue LoadError\n # If that fails, try the older debugger\n begin\n require 'debugger'\n debugger\n rescue LoadError\n self.log.info \"No d...
[ "0.66999483", "0.59827304", "0.5888002", "0.57304233", "0.557473", "0.55458605", "0.5523532", "0.5379685", "0.53770626", "0.5325998", "0.52798176", "0.5254402", "0.5216819", "0.5215103", "0.51993775", "0.5180837", "0.5140287", "0.5097943", "0.5067256", "0.50338763", "0.497886...
0.8355894
0
Delivers the alert via SMS to the owning user if the following 2 conditions are met: 1. The given `current_temperature` is greater than or equal to the `temperature_threshold` for the alert. 2. The alert hasn't already been delivered today.
def conditionally_deliver(current_temperature) return if Time.current < Time.current.change(hour: 6) return if current_temperature < temperature_threshold return if delivered_today? deliver end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def alarm\n @history_thermostats = HistoryThermostat.all\n @thermostat = Thermostat.find(params[:id])\n @history_thermostats = @thermostat.history_thermostats\n @last_history = @history_thermostats.last\n if @last_history != nil\n @alarm = @last_history.thermostat.location.alarm\n if @al...
[ "0.56281817", "0.558501", "0.5579354", "0.53859705", "0.5229786", "0.5219185", "0.5214493", "0.5127954", "0.5109558", "0.510576", "0.50797004", "0.5065795", "0.5053062", "0.5023537", "0.5011943", "0.5006179", "0.49930206", "0.49607253", "0.4942989", "0.49251318", "0.4899196",...
0.71666527
0
This is called a instance method This means you can only call it on an instance so for example delhi_streets.print_out_name (array attached to class)
def print_out_name @name self # self is the object (restuarant) itself. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_of_all_apartments_method(array)\n\t array.each do |instance|\n\t \t#binding.pry\n\t \tif instance.renters[0].class == Person && instance.renters != \"Unoccupied\"\n\t \t\tif instance.renters.length == 1\n\t \t\t\tinstance.renters.each do |tenant|\n\t\t \t\tputs \"#{tenant.name} lives in apartment #{ins...
[ "0.62716895", "0.5925188", "0.5860941", "0.5766998", "0.5711034", "0.56430924", "0.55890703", "0.55845124", "0.55394137", "0.5519076", "0.5514294", "0.54761565", "0.5464114", "0.5454345", "0.5408197", "0.53999025", "0.5392211", "0.5368017", "0.536073", "0.53587806", "0.534532...
0.5562284
8
dynamically creates attributes set to space objects for all 42 spaces
def initialize x = 0 y = 0 space_array = [] 42.times do space = instance_variable_set("@space#{x}#{y}", Space.new) space_array.push(space) self.class.send(:attr_accessor, "space#{x}#{y}") y += 1 if y == 6 y = 0 x += 1 end end @space_array = space_array @display = "------------------------------------\n| #{space05.occupied} | #{space15.occupied} | #{space25.occupied} |"\ " #{space35.occupied} | #{space45.occupied} | #{space55.occupied} | #{space65.occupied} |\n"\ "------------------------------------\n| #{space04.occupied} | #{space14.occupied} | #{space24.occupied} |"\ " #{space34.occupied} | #{space44.occupied} | #{space54.occupied} | #{space64.occupied} |\n" \ "------------------------------------\n| #{space03.occupied} | #{space13.occupied} | #{space23.occupied} |"\ " #{space33.occupied} | #{space43.occupied} | #{space53.occupied} | #{space63.occupied} |\n"\ "------------------------------------\n| #{space02.occupied} | #{space12.occupied} | #{space22.occupied} |"\ " #{space32.occupied} | #{space42.occupied} | #{space52.occupied} | #{space62.occupied} |\n"\ "------------------------------------\n| #{space01.occupied} | #{space11.occupied} | #{space21.occupied} |"\ " #{space31.occupied} | #{space41.occupied} | #{space51.occupied} | #{space61.occupied} |\n"\ "------------------------------------\n| #{space00.occupied} | #{space10.occupied} | #{space20.occupied} |"\ " #{space30.occupied} | #{space40.occupied} | #{space50.occupied} | #{space60.occupied} |\n"\ "------------------------------------\n 1 2 3 4 5 6 7" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make\n @spaces.each { |position| position.occupied = true }\n # pp \"made ship: #{@spaces}\"\n end", "def attributes=(_arg0); end", "def populate\n spots = @spaces.length**2\n asteroids = (spots * 0.3).round\n gravity_wells = (spots * 0.1).round\n empty_space = (spots * 0.6 ).round\n\n ast...
[ "0.611803", "0.6085056", "0.5997785", "0.5940728", "0.59002346", "0.58168894", "0.5804175", "0.57987696", "0.5790312", "0.5676507", "0.5630534", "0.5558698", "0.5489158", "0.54428154", "0.5432241", "0.542564", "0.5409423", "0.5404589", "0.53909713", "0.53798634", "0.5369933",...
0.6214794
0
45 minutes Executes this stage and updates the commit log. If the commit has been fully translated, the commit log will be updated with a +FINALIZED+ status, and the +finalize+ method will be called on the translation management system. If the commit has not been fully translated, the commit log's status won't be updated and +finalize+ will not be called. In both cases, commit log locale entries will be updated to track translation progress.
def execute! logger.info("Finalizing commit #{commit_log.commit_id}") status = repo_config.tms.status(commit_log.commit_id) repo_config.locales.each do |locale| locale_code = locale.code rosette_config.datastore.add_or_update_commit_log_locale( commit_log.commit_id, locale_code, status.locale_count(locale_code) ) end if status.fully_translated? repo_config.tms.finalize(commit_log.commit_id) commit_log.finalize save_commit_log end logger.info("Finished finalizing commit #{commit_log.commit_id}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execute!\n logger.info(\"Pushing commit #{commit_log.commit_id}\")\n\n if phrases.size > 0\n commit_log.phrase_count = phrases.size\n repo_config.tms.store_phrases(phrases, commit_log.commit_id)\n commit_log.push\n else\n commit_log.finaliz...
[ "0.60674495", "0.5897237", "0.57185316", "0.5485851", "0.54247266", "0.524159", "0.52088076", "0.5203131", "0.51798517", "0.5177751", "0.5172749", "0.5158065", "0.51480746", "0.50927216", "0.50833577", "0.50811106", "0.50811106", "0.5072285", "0.50721663", "0.5065324", "0.505...
0.7854903
0
Converts this stage to a job that can be enqueued. This method should be called after +execute!+, meaning the commit log has been updated to the next status in the pipeline. If that next status also happens to be PUSHED, this method adds a delay to avoid finalizing too often. If the chosen queue implementation does not support delays, setting this value should be a safe noop (i.e. have no adverse sideeffects).
def to_job super.tap do |job| if commit_log.status == PhraseStatus::PUSHED job.set_delay(random_delay) job.set_queue('finalize') end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def queue\n pending_duplicate_job || Delayed::Job.enqueue(self)\n end", "def enqueue!\n return nil unless persisted?\n \"#{job_type.camelize}Job\".constantize.perform_later(self)\n end", "def queue_job(priority = nil, delay = default_delay)\n args = { }\n args[:wait] = delay if delay\n args...
[ "0.6162002", "0.5973482", "0.5795701", "0.5727709", "0.5727709", "0.5720016", "0.56973886", "0.56925946", "0.5675933", "0.5663017", "0.5655041", "0.5655041", "0.5647108", "0.56205755", "0.55645233", "0.5553462", "0.5468759", "0.54303014", "0.5375386", "0.53600365", "0.5342791...
0.67357874
0
desc 'search ', 'searches vimpack.org for scripts'
def search(pattern) Vimpack::Commands::Search.run(self, pattern) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def search; end", "def search\n\n end", "def search \n\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n end", "def search\n...
[ "0.75002444", "0.72042704", "0.71942186", "0.71886533", "0.71013886", "0.71013886", "0.71013886", "0.71013886", "0.71013886", "0.71013886", "0.71013886", "0.71013886", "0.71013886", "0.71013886", "0.70515406", "0.7035824", "0.7030495", "0.6965785", "0.6927803", "0.6920154", "...
0.6732958
23
GET /rank_algorithms GET /rank_algorithms.xml
def index @rank_algorithms = RankAlgorithm.find(:all) respond_to do |format| format.html # index.html.erb format.xml { render :xml => @rank_algorithms } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ranking_algorithms = RankingAlgorithm.all.page(params[:page]).per(10)\n end", "def ranking(opts={})\r\n Rakuten::Request.get(\"https://app.rakuten.co.jp/services/api/IchibaItem/Ranking/20120927\", Rakuten::Api.merge(opts))\r\n end", "def show\n @rank_algorithm = RankAlgorith...
[ "0.68819183", "0.6572817", "0.63816816", "0.62393034", "0.5785932", "0.57728744", "0.5680099", "0.5634229", "0.5599976", "0.5534475", "0.55243635", "0.5498352", "0.5486594", "0.5484028", "0.54786384", "0.5461728", "0.5411162", "0.54070324", "0.53442574", "0.5340064", "0.53359...
0.72858334
0
GET /rank_algorithms/1 GET /rank_algorithms/1.xml
def show @rank_algorithm = RankAlgorithm.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @rank_algorithm } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @rank_algorithms = RankAlgorithm.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rank_algorithms }\n end\n end", "def index\n @ranking_algorithms = RankingAlgorithm.all.page(params[:page]).per(10)\n end", "def ranking(op...
[ "0.7299873", "0.6599532", "0.649089", "0.6257379", "0.59772134", "0.5957035", "0.5539556", "0.55345994", "0.55237025", "0.5482007", "0.54712814", "0.54339933", "0.54301435", "0.5414407", "0.53884244", "0.53690124", "0.5300097", "0.5289254", "0.5289097", "0.52772546", "0.52572...
0.66421396
1
GET /rank_algorithms/new GET /rank_algorithms/new.xml
def new @rank_algorithm = RankAlgorithm.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @rank_algorithm } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @rank_algorithms = RankAlgorithm.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rank_algorithms }\n end\n end", "def create\n @rank_algorithm = RankAlgorithm.new(params[:rank_algorithm])\n \n respond_to do |format|\n ...
[ "0.6644772", "0.6592853", "0.6507366", "0.63442194", "0.63269013", "0.61653304", "0.60608935", "0.60303056", "0.6016412", "0.5949583", "0.5922413", "0.59055024", "0.5897164", "0.58289045", "0.5809351", "0.57677543", "0.5735561", "0.56119305", "0.5584854", "0.5548083", "0.5521...
0.7286456
0
POST /rank_algorithms POST /rank_algorithms.xml
def create @rank_algorithm = RankAlgorithm.new(params[:rank_algorithm]) respond_to do |format| if @rank_algorithm.save flash[:notice] = 'RankAlgorithm was successfully created.' format.html { redirect_to(@rank_algorithm) } format.xml { render :xml => @rank_algorithm, :status => :created, :location => @rank_algorithm } else format.html { render :action => "new" } format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ranking_algorithm_params\n params.require(:ranking_algorithm).permit(:algorithm_name, :template)\n end", "def index\n @rank_algorithms = RankAlgorithm.find(:all)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @rank_algorithms }\n end\n e...
[ "0.5889296", "0.5859113", "0.5687356", "0.5636704", "0.55211806", "0.5518879", "0.54464114", "0.53616726", "0.5305081", "0.5285669", "0.5285669", "0.52595484", "0.5176032", "0.51689893", "0.5083349", "0.5048326", "0.5034209", "0.5029309", "0.50168264", "0.5010272", "0.500663"...
0.62922126
0
PUT /rank_algorithms/1 PUT /rank_algorithms/1.xml
def update @rank_algorithm = RankAlgorithm.find(params[:id]) respond_to do |format| if @rank_algorithm.update_attributes(params[:rank_algorithm]) flash[:notice] = 'RankAlgorithm was successfully updated.' format.html { redirect_to(@rank_algorithm) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @rank_algorithm.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @ranking_algorithm.update(ranking_algorithm_params)\n format.html { redirect_to @ranking_algorithm, notice: 'Алгоритм успешно обновлен' }\n format.json { render :show, status: :ok, location: @ranking_algorithm }\n else\n format.html { rende...
[ "0.57474405", "0.55491173", "0.5504826", "0.5455035", "0.53351843", "0.53225654", "0.5312142", "0.52642125", "0.5232523", "0.5231709", "0.522487", "0.52039576", "0.5172493", "0.5114166", "0.50983065", "0.50731826", "0.50572616", "0.50522363", "0.50516343", "0.50516343", "0.50...
0.6424177
0
DELETE /rank_algorithms/1 DELETE /rank_algorithms/1.xml
def destroy @rank_algorithm = RankAlgorithm.find(params[:id]) @rank_algorithm.destroy respond_to do |format| format.html { redirect_to(rank_algorithms_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n\t\tdb.execute{ \"delete edge #{ref_name} #{rrid}\" }\n\tend", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @algorithm = Algorithm.find(params[:id])\n @algorithm.destro...
[ "0.6254335", "0.62243766", "0.6159543", "0.61574465", "0.60247606", "0.60084766", "0.5941785", "0.5923146", "0.5916227", "0.5914477", "0.5872474", "0.58657515", "0.58558226", "0.582", "0.58148813", "0.57818586", "0.57775813", "0.5769614", "0.5764127", "0.5763597", "0.5762012"...
0.69488746
0
Decrease / increase to [0, 2Pi]
def by_mod l = self if (l > Math::PI) while (l > Math::PI) l = l - 2*Math::PI end else while (l < -Math::PI) l = l + 2*Math::PI end end l end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increaseByTwo(a) #=> zwroci nam dwukrotnosc wartosci przypisanej do zmiennej a\n\n\ta = a * 2\n\nend", "def calcpi()\n\n pi = 0.0\n rep = $PI_ITER\n \n while rep >= 0\n \n pi += 1.0 / pow(16.0, rep) * (4.0 / (8.0 * rep + 1.0) - 2.0 / (8.0 * rep + 4.0) - 1.0 / (8.0 * rep + 5.0) - 1 / (8.0 * rep + 6.0...
[ "0.61294746", "0.6029583", "0.5868148", "0.58160615", "0.5800691", "0.5776711", "0.5618982", "0.559714", "0.5544676", "0.55395025", "0.5499583", "0.54939467", "0.5478512", "0.5446193", "0.54396635", "0.543573", "0.5425751", "0.5408753", "0.5383687", "0.5367939", "0.5357182", ...
0.58755034
2
used in ActiveRecord validations
def save; end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation; end", "def validation; end", "def is_valid; end", "def validator; end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def validated; end", "def validated?; end", "def valid; end", "def literal_validation; end", "def literal_validation; ...
[ "0.76639444", "0.76639444", "0.76526827", "0.7540748", "0.7377266", "0.7377266", "0.7377266", "0.7377266", "0.73440677", "0.7305694", "0.73024267", "0.7234575", "0.7234575", "0.7190975", "0.7190975", "0.7190975", "0.7190975", "0.7190975", "0.7168359", "0.7121287", "0.7121287"...
0.0
-1
Stops the master after recieving the kill signal is overriden from ProcessManager::Daemon::Child
def stop if @prepare_run_done @runner.graceful_shutdown end ProcessManager::Log.info('agent exiting now') super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stopKill\n self.stop_d\n return\n end", "def kill\n active_slaves.each_value { |s| s.kill(join: false) }\n while has_active_slaves?\n finished_child = Process.waitpid2(-1)\n process_finished_slave(*finished_child)\n end\n resc...
[ "0.7369806", "0.73476005", "0.7270692", "0.7102033", "0.7041387", "0.6980689", "0.6954005", "0.69472724", "0.6921947", "0.6895982", "0.68725246", "0.6864195", "0.6854116", "0.6827091", "0.6826721", "0.68165565", "0.6812384", "0.6803706", "0.67988837", "0.6767304", "0.674254",...
0.6238943
70
Catches the trap signals and does a default or custom action is overriden from ProcessManager::Daemon::Child
def trap_signals [:INT, :QUIT, :TERM].each do |sig| trap(sig) do ProcessManager::Log.info "#{description}: Received #{sig} - setting internal shutting down flag and possibly finishing last run" stop_thread = Thread.new {stop} stop_thread.join end end # make sure we do not handle children like the master process trap(:CHLD, 'DEFAULT') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trap_signals\n # kill\n trap('INT') do\n puts('INT received')\n notify_subscribers('INT received')\n stop\n end\n\n # kill\n trap('TERM') do\n puts('TERM received')\n notify_subscribers('TERM received')\n ...
[ "0.7044149", "0.70146704", "0.6954334", "0.6954334", "0.6849687", "0.68458784", "0.6702279", "0.67012864", "0.6656735", "0.665435", "0.6638909", "0.65601486", "0.65405613", "0.653179", "0.64835334", "0.64835334", "0.63996255", "0.6360999", "0.63107574", "0.63008964", "0.62972...
0.76223844
0
Partner Help Email Notifications
def partner_help_notice(partner_help_id) ActsAsTenant.current_tenant = nil @partner_help = PartnerHelp.find(partner_help_id) mail(subject: 'YesTrak Partner Help Form', to: @partner_help.email, bcc: "#{APP_CONFIG['admin_emails']}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def question_notification(asker, subject, details)\n @asker = asker\n @subject = subject\n @details = details\n\n mail to: \"Alex Yang <alexyang.personal@gmail.com>\",\n from: \"BaseRails <notifications@baserails.com>\",\n subject: \"#{asker} posted a new question on BaseRails\"\n e...
[ "0.72000027", "0.7042168", "0.7041643", "0.70263386", "0.7017448", "0.6923108", "0.69135433", "0.69115674", "0.69050777", "0.68997693", "0.6859798", "0.6828306", "0.6801441", "0.6798682", "0.6778224", "0.67755026", "0.676906", "0.67675793", "0.6767118", "0.6766415", "0.672636...
0.77578235
0
Minutes are running low Notification
def minutes_running_low(tenant) ActsAsTenant.current_tenant = nil @tenant = tenant @plan = tenant.plan_bid.to_s @days = (tenant.next_due - Date.today).to_i mail(subject: 'Minutes Running Low', to: @tenant.owner.email, bcc: APP_CONFIG['admin_emails']) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tock\n @minute += 1\n end", "def today_minutes_active\n self[:min_active]\n end", "def minimum_interval\n 500\n end", "def minutes?\n @name == :minutely\n end", "def watch_interval; end", "def restart_notification_snooze_duration_in_minutes\n return ...
[ "0.64594555", "0.63423747", "0.6158274", "0.61369705", "0.61266404", "0.612431", "0.6118135", "0.6117697", "0.6117697", "0.61174893", "0.6075876", "0.604616", "0.6028172", "0.5984806", "0.59708345", "0.5961126", "0.59574467", "0.5947727", "0.5934222", "0.59315395", "0.5928194...
0.6230205
2
call transaction log mailer
def call_transaction_mailer(tenant,gate) ActsAsTenant.current_tenant = nil @tenant = tenant @gate = gate mail(subject: 'Call Transaction', to: 'mayank.jani@softwebsolutions.com') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_transaction_alert\n ApplicationMailer.transaction_alert(self).deliver_now\n end", "def transaction_complete\n NotificationsMailer.transaction_complete\n end", "def create_sale_report\n mail = LogMailer.sale_report(self).deliver\n end", "def transaction_complete\n @greeting = \"Hi\"\n\...
[ "0.7136187", "0.66376984", "0.6453176", "0.63764864", "0.632228", "0.63097477", "0.63049954", "0.62806374", "0.61297613", "0.6079548", "0.6079353", "0.60256314", "0.59959483", "0.59696734", "0.5952205", "0.5918265", "0.59001267", "0.58947307", "0.5894381", "0.5886689", "0.588...
0.7177245
0
recursion 1 exp(b, 0) = 1 exp(b, n) = b exp(b, n 1)
def exponent(b, n) return 1 if n == 0 if n > 0 b * exponent(b, n - 1) else 1.0/b * exponent(b, n + 1) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exp1(b, n)\n return 1 if n == 0\n b * exp1(b, n - 1)\nend", "def exp_1(b, n)\n return 1 if n == 0\n b * exp_1(b, n - 1)\nend", "def exp1(b, n)\n return 1 if n == 0\n p b * exp1(b, n - 1)\nend", "def exp(b,n)\n return 1 if n == 0\n b * exp(b,n-1)\nend", "def exp1(b, n)\n n == 0 ? 1 : ...
[ "0.86539435", "0.86359346", "0.85930175", "0.8509584", "0.8494824", "0.84863293", "0.8315414", "0.82662886", "0.8263258", "0.8256007", "0.82111144", "0.8204571", "0.8113258", "0.8008711", "0.79113495", "0.79113495", "0.7906457", "0.78841704", "0.7869792", "0.7828034", "0.7767...
0.789177
17
p fibonacci(1) p fibonacci(2) p fibonacci(3) p fibonacci(4) p fibonacci(5) p fibonacci(6) p fibonacci(7) p fibonacci(8)
def subsets(arr) return [[]] if arr.empty? last_el = arr.last results = [] subsets(arr[0..-2]).each do |el| sub_arr = el << last_el results << sub_arr end subsets(arr[0..-2]) + results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci( n )\r\n fib_nums = []\r\n return n if n <= 1\r\n fib_nums << fibonacci( n - 1 )\r\n fib_nums << fibonacci( n - 2 )\r\n p \"#{fib_nums}\"\r\nend", "def fibonacci\n\tresults, first, second, current = 0, 1, 2, 2\n\twhile current <= 4000000\n\t\tif current % 2 == 0\n\t\t\tresults += c...
[ "0.820835", "0.81469125", "0.80928487", "0.8072117", "0.8063987", "0.80615276", "0.8056482", "0.80351835", "0.8023147", "0.8000126", "0.79788816", "0.79749435", "0.7973073", "0.7972119", "0.7970941", "0.79605913", "0.7949807", "0.7943491", "0.79315317", "0.7931355", "0.792472...
0.0
-1
=> [[], [1]] p subsets([1, 2]) => [[], [1], [2], [1, 2]] p subsets([1, 2, 3])
def permutations(arr) arr = arr.dup return [arr] if arr.length == 1 last_el = arr.pop base = permutations(arr) # [[1]] results = [] base.each do |perm| (perm.length + 1).times do |i| result = perm[0...i] + [last_el] + perm[i..-1] results << result end end results end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subsets(nums)\n result = []\n subsets_helper(nums, [], result, 0)\n result\nend", "def subsets(nums)\n return [[]] if nums.empty?\n return [[],[nums.first]] if nums.size == 1\n [[], (0...nums.size).map {|x|\n [[nums[x]], subsets(nums[x + 1..-1]).map { |y| [nums[x]] + y }]\n }.flatten]\n...
[ "0.8487025", "0.823515", "0.81840074", "0.81755", "0.8160179", "0.8099356", "0.8099356", "0.8099356", "0.80842894", "0.80592185", "0.8050087", "0.8044357", "0.7981963", "0.7949653", "0.7942235", "0.7865244", "0.78652006", "0.78574306", "0.78485876", "0.7846706", "0.7845733", ...
0.0
-1
this might actually be a helper
def current_round self.rounds.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helpers; end", "def helpers; end", "def helpers; end", "def private; end", "def helper(*args, &block); end", "def helper\n @helper\n end", "def helper\n @helper\n end", "def wrapper; end", "def instance_helper\n\tend", "def specie; end", "def specie; end", "def spe...
[ "0.75946504", "0.75946504", "0.75946504", "0.6645548", "0.6580859", "0.6484357", "0.6484357", "0.6386061", "0.6287495", "0.6279808", "0.6279808", "0.6279808", "0.6279808", "0.61679775", "0.61545885", "0.6140402", "0.6140402", "0.6136763", "0.6022865", "0.59852356", "0.5985235...
0.0
-1
Registers a callback handle that will be periodically run.
def periodically(timing, event_callback) EventMachine.add_periodic_timer(timing) do dispatch(event_callback.to_sym) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def register_update_handle_callback(&blk)\n @logger.debug(\"Register update handle callback with #{blk}\")\n @update_handle_callback = blk\n end", "def register_callback(&proc)\n if ready?\n proc.call(sync)\n else\n @callbacks << proc\n end\n end", "def register_callback(...
[ "0.69045144", "0.6677008", "0.65314215", "0.6359059", "0.6311531", "0.60619485", "0.6040254", "0.6040254", "0.6040254", "0.6040254", "0.6019728", "0.59898883", "0.59188956", "0.5911588", "0.5892645", "0.5882398", "0.5872747", "0.58179694", "0.5804135", "0.56763995", "0.566117...
0.55908346
23
==== NEW PLOTTING API ====
def begin_figure @legend_keys = [] @legend_labels = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def plot; end", "def draw_basic_plot(params) \n jitter = params[:jitter]\n grouplist = params[:grouplist]\n snp_list = params[:snp_list]\n x_start = params[:x_start]\n y_start = params[:y_start]\n stat_max = params[:stat_max]\n stat_min = params[:stat_min]\n data_key = params[:data_key]\...
[ "0.72804433", "0.66865206", "0.63143885", "0.62144697", "0.6196042", "0.5990444", "0.5977674", "0.5977674", "0.5977674", "0.5977674", "0.592123", "0.59142095", "0.5884148", "0.58301854", "0.5827838", "0.5760075", "0.57449", "0.5727259", "0.5723504", "0.5707553", "0.5701308", ...
0.0
-1
GET /order_detalis GET /order_detalis.json
def index @order_detalis = OrderDetali.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not found for that client.\"\n end\n end", "def show\n ...
[ "0.67153955", "0.67150676", "0.67150676", "0.66246796", "0.655945", "0.65387374", "0.65387374", "0.65375286", "0.65274066", "0.6521837", "0.64866495", "0.6439851", "0.64285237", "0.6416113", "0.63549775", "0.6340292", "0.6329492", "0.6325521", "0.63116854", "0.629744", "0.626...
0.73373497
0
GET /order_detalis/1 GET /order_detalis/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @order_detalis = OrderDetali.all\n end", "def show\n if @order\n respond_to do |format|\n format.html { @order }\n format.json { render json: @order.to_json(include: [:status, :package, :discount]) }\n end\n else\n redirect_to orders_path, notice: \"Order ID not...
[ "0.71183354", "0.70629406", "0.6908313", "0.6824049", "0.6765412", "0.6765412", "0.67271954", "0.6723", "0.6709088", "0.6702399", "0.6702399", "0.664294", "0.6637023", "0.6616795", "0.6595496", "0.65941", "0.6573095", "0.65280414", "0.65198445", "0.6519484", "0.6489724", "0...
0.0
-1
POST /order_detalis POST /order_detalis.json
def create @order_detali = OrderDetali.new(order_detali_params) respond_to do |format| if @order_detali.save format.html { redirect_to @order_detali, notice: 'Order detali was successfully created.' } format.json { render :show, status: :created, location: @order_detali } else format.html { render :new } format.json { render json: @order_detali.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @order = Order.new(order_params_create)\n\n respond_to do |format|\n if @order.save && @order.update(order_params_create_2)\n #Обновляем поля\n Ordered.all.each do |myord|\n if myord.order_id==@order.id\n Ordered.update(myord.id, :quantity => 1, :discount => 0)\n ...
[ "0.6508184", "0.6442758", "0.64053607", "0.63741314", "0.63610244", "0.6346044", "0.6313415", "0.6306812", "0.6279113", "0.6247363", "0.62337583", "0.62293917", "0.62262595", "0.6224976", "0.6207935", "0.6155869", "0.6148136", "0.6131479", "0.6130066", "0.6125559", "0.6124595...
0.71264327
0
PATCH/PUT /order_detalis/1 PATCH/PUT /order_detalis/1.json
def update respond_to do |format| if @order_detali.update(order_detali_params) format.html { redirect_to @order_detali, notice: 'Order detali was successfully updated.' } format.json { render :show, status: :ok, location: @order_detali } else format.html { render :edit } format.json { render json: @order_detali.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'La commande a été créée avec succès.' }\n format.json { render :show, status: :ok, location: @order }\n else\n format.html { render :edit }\n format.json { rend...
[ "0.68504137", "0.68477577", "0.6833518", "0.68226534", "0.6822191", "0.6819898", "0.6815785", "0.6807843", "0.68026036", "0.6768745", "0.6768745", "0.6754119", "0.6734648", "0.66957736", "0.6686595", "0.6684546", "0.6683625", "0.66705245", "0.66705245", "0.66705245", "0.66705...
0.69475025
0
DELETE /order_detalis/1 DELETE /order_detalis/1.json
def destroy @order_detali.destroy respond_to do |format| format.html { redirect_to order_detalis_url, notice: 'Order detali was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @order_datail = OrderDatail.find(params[:id])\n @order_datail.destroy\n\n respond_to do |format|\n format.html { redirect_to order_datails_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_order = V1::Order.find(params[:id])\n @v1_order.destroy\n...
[ "0.7318589", "0.7300436", "0.72904706", "0.72790307", "0.72659403", "0.7234647", "0.72334635", "0.7226227", "0.71964484", "0.7172841", "0.7155792", "0.7150181", "0.7118461", "0.71173495", "0.7095023", "0.7089124", "0.70787394", "0.7072836", "0.7051535", "0.70460993", "0.70402...
0.7530425
0