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
Checks that a cube is open, raising a NotAttached exception if one is not.
def check_attached check_connected raise NotAttached unless @app && @cube end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attached?\n interface.status == 'in-use'\n end", "def attached?\n\t\tCommon.device_status(@handle);\n end", "def attached?\n not self.info.nil?\n end", "def attached?\n not send(self.class.container_name).nil?\n end", "def check()\n # check if teh volume still exists\n ...
[ "0.544216", "0.53384924", "0.53176224", "0.52649313", "0.5184758", "0.51149905", "0.50992036", "0.5036669", "0.501715", "0.49898186", "0.49860623", "0.49706852", "0.49439564", "0.49264377", "0.48942304", "0.48936844", "0.48797712", "0.48647383", "0.48555163", "0.4828772", "0....
0.78451747
0
Sends the current request XML to the SmartView provider, and parses the response with hpricot. If an exception was returned, an SmartViewException is raised with the details of the error.
def invoke resp = nil ms = Benchmark.realtime do resp = @http.post @url, @req.to_s end @logger.info 'SmartView request %s completed in %.1fs' % [@req.method, ms] doc = Hpricot::XML(resp.body.content) if !doc.at("//res_#{@req.method}") @logger.error "Error invoking SmartView method #{@req.method}" @logger.debug "Request was:\n#{@req}" @logger.debug "Response was:\n#{resp.body.content}" if ex = doc.at('//exception') ex = SmartViewException.new(ex) @logger.error "An exception occurred in #{@req.method}" @logger.error ex raise ex else @logger.error "Unexpected response from SmartView provider:\n#{doc.to_plain_text}" raise RuntimeError, "Unexpected response from SmartView provider: #{doc.to_plain_text}" end end doc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_xml(xml)\n connection.ProcessRequest(session, xml)\n rescue => e\n puts \"ERROR processing request:\\n#{xml}\"\n raise # Reraises the original error, only this way we got the xml output\n end", "def send_request( xml )\n write( xml )\n read\n end", "def send...
[ "0.6339378", "0.6231344", "0.61522204", "0.60964334", "0.600724", "0.597375", "0.58602387", "0.579789", "0.5697041", "0.5680977", "0.5674398", "0.5653115", "0.5624577", "0.55661297", "0.55544704", "0.5521125", "0.5497294", "0.5478834", "0.54606766", "0.54162884", "0.54162884"...
0.67916286
0
Insert filter arguments to a request
def insert_filter_args(xml, filter_args) if filter_args filter_args.each_with_index do |filter_arg, i| xml.arg({'id' => "#{i}"}, filter_arg) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def filter_parameters=(_arg0); end", "def filter_parameters=(_arg0); end", "def add_filters(filters); end", "def filter_parameters; end", "def filter_parameters; end", "def Filter=(arg0)", "def filters=(_arg0); end", "def filters=(_arg0); end", "def query_parameters\n params = {}\n params...
[ "0.7019112", "0.7019112", "0.69137275", "0.6784069", "0.6784069", "0.6692211", "0.6600999", "0.6600999", "0.64978456", "0.6479139", "0.64715946", "0.6457765", "0.64549553", "0.6385913", "0.6374145", "0.6365863", "0.63474315", "0.6326313", "0.6320585", "0.62886226", "0.6262696...
0.7094534
0
Write a method that takes two arguments, a string and a positive integer, and prints the string as many times as the integer indicates. input: a string a positive integer output: at least one string
def repeat(string, integer) integer.times do puts string end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def repeat(string, int)\n return 'invalid string argument' unless string.class == String\n return 'invalid integer argument' unless int.to_s.to_i == int\n int.times { |num| puts string }\nend", "def repeat(string, num)\n if num < 0\n puts 'The number is not a positive integer'\n else\n puts 'The numbe...
[ "0.77459663", "0.76784885", "0.76408774", "0.7569376", "0.7561316", "0.75529027", "0.72775435", "0.71979725", "0.7147224", "0.7125909", "0.70867366", "0.7080978", "0.70470273", "0.70152044", "0.7014705", "0.70093966", "0.6961474", "0.6961474", "0.6961474", "0.6957185", "0.695...
0.67674845
42
store the countries information and create region list
def store_countries Countries::Data.get_data @regions = Countries::Country.create_region_list end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def countries_list\n [\n ['Afghanistan', 'Afghanistan'],\n ['Albania', 'Albania'],\n ['Algeria', 'Algeria'],\n ['American Samoa', 'American Samoa'],\n ['Andorra', 'Andorra'],\n ['Angola', 'Angola'],\n ['Antigua and Barbuda', 'Antigua and Barbuda'],\n ['Arg...
[ "0.6857831", "0.68053675", "0.6796844", "0.6672254", "0.65704274", "0.6566891", "0.6477582", "0.6476874", "0.64247", "0.6422858", "0.6376245", "0.633171", "0.62361586", "0.62327844", "0.6219856", "0.6216796", "0.62142414", "0.6202572", "0.6197147", "0.6186581", "0.61776906", ...
0.8644318
0
get the selected country information from the list of countries
def selected_country(input_region) new_input = nil while new_input != "exit" puts "\nEnter the country number (1-#{@countries.size}) to get more information or type 'return' to go the previous menu or".bold.cyan puts "\ntype 'list' to see the list of countries again or 'exit':".bold.cyan new_input = digit_or_word case new_input when (1..@countries.size) country_details(input_region, new_input.to_i) when "list" country_list_by_region(input_region) when "return" menu new_input = "exit" when "exit" break else puts "\nPlease enter a valid input, (1-#{@countries.size}) or type 'list' to see the list of countries again or 'exit':".bold.red end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country\n client.places.get_countries.select{|hash| hash[\"cid\"] == @params[:country].to_i}.first[:title]\n end", "def country_select(country)\n select(country, :from => countryname[:id])\n end", "def get_selected_country\n countries = @chrome_driver.find_element(:id, COUNTRY_DROP_DOWN_...
[ "0.7727084", "0.7558824", "0.7439343", "0.74220604", "0.7421992", "0.7320288", "0.72973764", "0.7171137", "0.7160514", "0.71356726", "0.71346307", "0.71215004", "0.7118109", "0.7029274", "0.69996035", "0.6995505", "0.69755256", "0.69649816", "0.69537985", "0.6927001", "0.6899...
0.0
-1
get the country list of given region
def country_list_by_region(region) # select list of countries based on the region @countries = Countries::Country.find_by_region(region) # print the list of countries as table format Table.display_as_table(@countries) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def country_list\n return [] if type == \"state\"\n return countries if type == \"country\"\n members.collect { |zone| zone.country_list }.flatten\n end", "def get_countries\n countries=[]\n @locations.each do |loc|\n countries << loc.country.capitalize if loc.country\n end\n countries...
[ "0.7619613", "0.7324609", "0.72546595", "0.7250403", "0.7059625", "0.7008309", "0.6882325", "0.687028", "0.6860345", "0.6838286", "0.6737262", "0.6724257", "0.66977495", "0.66964805", "0.66939497", "0.6610382", "0.6607012", "0.65989596", "0.6598801", "0.65600556", "0.6545739"...
0.78170156
0
country details based on region and country
def country_details(region, input) country = @countries[input - 1] Table.display_as_summary(country) browse_online(country) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_country\n @single_city_data[\"sys\"][\"country\"]\n end", "def country\n data['country']\n end", "def represented_country; end", "def registered_country; end", "def country; end", "def country; end", "def country; end", "def region_of_country(country_code = 'JP')\n result = @re...
[ "0.76016486", "0.7420104", "0.7379968", "0.7351726", "0.72804105", "0.72804105", "0.72804105", "0.72547114", "0.7232474", "0.71334577", "0.7127241", "0.71272", "0.7089775", "0.708491", "0.70717144", "0.70615244", "0.7058763", "0.7039556", "0.70295686", "0.70279956", "0.702027...
0.78632003
0
check the input is a string or fixnum
def digit_or_word input = gets.strip.downcase input.match(/\d+/).to_s.to_i == 0 ? input : input.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def number?(str)\n !!Integer(str)\nrescue ArgumentError, TypeError\n false\nend", "def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this asks is input num has any letters in it.\nend", "def valid_number?(num)\n\n integer?(num) || float?(num)\n\n #num.match(/\\d/) # this...
[ "0.7460665", "0.73973626", "0.73973626", "0.7263427", "0.7236833", "0.71894115", "0.71755767", "0.71707666", "0.716606", "0.716606", "0.71638185", "0.7161648", "0.7151615", "0.71485186", "0.7132887", "0.70909905", "0.7090485", "0.708787", "0.70739913", "0.7070891", "0.7056218...
0.0
-1
Run `rspec /spec/username_spec.rb` to get started.
def format_name(first, last) (First[0]+last).downcase end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_check_user_name\n user = User.named(\"HansliCaramell\")\n\n assert(!user.name.nil? ,\"No User Name\")\n assert_equal(\"HansliCaramell\", user.name, \"Wrong User name\")\n end", "def test_is_username\n assert(StringChecker.is_valid_username?(\"ese\"))\n assert(!StringChecker.is_valid_user...
[ "0.61162275", "0.6105939", "0.6105773", "0.60648304", "0.60635483", "0.605991", "0.59905696", "0.5952525", "0.59419495", "0.59419495", "0.5938926", "0.589761", "0.57347393", "0.5695146", "0.5690247", "0.56885564", "0.56859624", "0.56583273", "0.55981666", "0.5597601", "0.5584...
0.0
-1
RedCounter::TestCase.create_fixtures(Redmine::Plugin.find(:red_counter).directory + '/tests/fixtures/', [:rc_types])
def setup TestUtils.set_workday_default TestUtils.enable_module_on_project 1 @request.session[:user_id] = 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_default_fixtures(files = ['sample_actors' , 'users', 'wiki_entries'])\n Fixtures.reset_cache\n files.each do |f|\n Fixtures.create_fixtures( File.dirname(__FILE__) + '/../fixtures' , File.basename( f , '.*'))\n end\nend", "def load_all_fixtures\n \n end", "def load_fixtures\n # f...
[ "0.6776879", "0.65703833", "0.65081245", "0.6399609", "0.63323057", "0.6288054", "0.6127184", "0.612064", "0.6112131", "0.6098784", "0.60510594", "0.604035", "0.6039325", "0.60387486", "0.5976574", "0.5955166", "0.5927808", "0.59264755", "0.5844803", "0.58405685", "0.5833745"...
0.0
-1
GET /results GET /results.json
def index @results = Result.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "def results\n with_monitoring do\n response = perform(:get, results_url, query_params)\n Search::ResultsResponse.from(response)\n end\n rescue => e\n handle_error(e)\n end", "def index...
[ "0.7627161", "0.7400975", "0.73309505", "0.73102474", "0.7303848", "0.7197686", "0.7027008", "0.7027008", "0.70246524", "0.69998884", "0.6963856", "0.6914666", "0.6851203", "0.68335116", "0.6798052", "0.674726", "0.67325014", "0.6720427", "0.66841894", "0.66758746", "0.667432...
0.69354475
11
GET /results/1 GET /results/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def results(path, params = {}, opts = {})\n get(path, params, opts)['results']\n end", "def index\n get_results\n end", "def get_results\n\t\trace_id = params[:id]\n\t\t\n\t\trace = Race.find_by_id(race_id)\n\t\tresults = Result.get_race_results(race_id)\n\t\t\n\t\trender :json=>{:results=>results}\n\t...
[ "0.73266965", "0.6979273", "0.69192237", "0.6817701", "0.67208", "0.6713047", "0.6713047", "0.66786873", "0.66508305", "0.66351783", "0.66351783", "0.66351783", "0.66351783", "0.6609092", "0.66036445", "0.65753514", "0.6566137", "0.64380974", "0.6395807", "0.63874984", "0.638...
0.0
-1
POST /results POST /results.json
def create @result = Result.new(result_params) respond_to do |format| if @result.save format.html { redirect_to @result, notice: 'Result was successfully created.' } format.json { render :show, status: :created, location: @result } else format.html { render :new } format.json { render json: @result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "def create\n #TODO we need to look into the need for transactions in mongodb\n #Api::V1::Result.with_session do |session|\n #session.start_t...
[ "0.79618156", "0.70347315", "0.6430695", "0.6363882", "0.62522346", "0.6239741", "0.60929143", "0.60929143", "0.60773784", "0.6060322", "0.6051018", "0.60151786", "0.59909177", "0.5975458", "0.59665865", "0.5965483", "0.5954307", "0.59362555", "0.59362555", "0.59213305", "0.5...
0.59725726
16
PATCH/PUT /results/1 PATCH/PUT /results/1.json
def update respond_to do |format| if @result.update(result_params) format.html { redirect_to @result, notice: 'Result was successfully updated.' } format.json { render :show, status: :ok, location: @result } else format.html { render :edit } format.json { render json: @result.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!(**args)\n @results = args[:results] if args.key?(:results)\n end", "def update!(**args)\n @results = args[:results] if args.key?(:results)\n end", "def update\n @result1 = Result1.find(params[:id])\n\n respond_to do |format|\n if @result1.update_attributes...
[ "0.6633545", "0.6633545", "0.65372896", "0.6470854", "0.6470854", "0.6470854", "0.6470854", "0.64311457", "0.6374878", "0.6374878", "0.6242018", "0.62343436", "0.622704", "0.6226439", "0.6225598", "0.61800575", "0.6157412", "0.61360973", "0.6116793", "0.61038065", "0.61038065...
0.6221451
17
DELETE /results/1 DELETE /results/1.json
def destroy @result.destroy respond_to do |format| format.html { redirect_to results_url, notice: 'Result was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @result.destroy\n\n respond_to do |format|\n format.html { redirect_to results_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @result = Result.find(params[:id])\n @result.destroy\n\n respond_to do |format|\n format.html { redirect_to results_...
[ "0.7422896", "0.7415153", "0.7415153", "0.7415153", "0.7415153", "0.7415153", "0.739529", "0.7390303", "0.7390303", "0.71879697", "0.71879697", "0.71879697", "0.71163774", "0.7045384", "0.6968828", "0.6960719", "0.6908872", "0.6899923", "0.6882427", "0.68696874", "0.6851931",...
0.70385545
16
Use callbacks to share common setup or constraints between actions.
def set_result @result = Result.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def result_params params.require(:result).permit(:name, :likes) 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
class TestDefinition0 < ProcessDefinition count end def xxxx_load_0
def test_load_0 map = {} @engine.register_participant("count") do |workitem| count = map[workitem.flow_id] count = unless count 1 else count + 1 end map[workitem.flow_id] = count end n = 1000 n.times do |i| li = LaunchItem.new(TestDefinition0) li.flow_id = i @engine.launch(li) end #while @engine.get_expression_storage.size > 1 # sleep 0.001 #end @engine.join_until_idle good = true n.times do |i| c = map[i] if c == 2 #if c == 1 print "." else print c good = false end end #puts "\n__good ? #{good}" assert good, "missing count" # 100 in 1s (in memory engine) # 1'000 in 14s (in memory engine) # 10'000 in 143s (in memory engine) # 1'000 in 31s (cache engine) # 10'000 in 321s (cache engine) # 1'000 in 113s (persistence only engine) # 10'000 in 1173s (persistence only engine) # # # ruby 1.8.5 (2006-12-25 patchlevel 12) [i686-darwin8.8.3] # # Machine Name: Mac # Machine Model: MacBook2,1 # Processor Name: Intel Core 2 Duo # Processor Speed: 2 GHz # Number Of Processors: 1 # Total Number Of Cores: 2 # L2 Cache (per processor): 4 MB # Memory: 2 GB # Bus Speed: 667 MHz # Thu Sep 13 15:38:46 JST 2007 # # 100 in 3s (in memory engine) # 1'000 in 85s (in memory engine) # 10'000 in s (in memory engine) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load_process_definition\n\n pdef, prep = load_process_def\n\n [ pdef, prep.to_a.to_json ]\n end", "def initialize(process); end", "def autoload(p0, p1) end", "def autoload(p0, p1) end", "def initialize(definition)\n process_metadata(definition)\n end", "def load_processfile(model, file, th...
[ "0.63024855", "0.604185", "0.58502847", "0.58502847", "0.57775867", "0.5735828", "0.564433", "0.564433", "0.5633783", "0.5589317", "0.5529081", "0.54733276", "0.54733276", "0.54733276", "0.54733276", "0.54733276", "0.54733276", "0.54733276", "0.54733276", "0.5433911", "0.5425...
0.5367531
25
GET /api/v2/source Get all sources for a customer
def list(limit = nil, cursor = nil) qs = {} qs[:limit] = limit if limit qs[:cursor] = cursor if cursor api.get('', qs) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sources(source: nil)\n params = {\n source: source\n }.compact\n\n _get(\"/account/sources\", params) { |json| json }\n end", "def account_sources(source)\n get('account/sources', {'source' => source})\n end", "def get_sources\n response = execute_get(\"/refere...
[ "0.77439713", "0.764057", "0.7515718", "0.716114", "0.6960482", "0.6799461", "0.6694224", "0.65499187", "0.653882", "0.64478236", "0.6442592", "0.6277184", "0.62686944", "0.622852", "0.62087476", "0.61819506", "0.6177918", "0.6173291", "0.6172909", "0.6166804", "0.61552924", ...
0.0
-1
POST /api/v2/source Create metadata (description or tags) for a specific source. Refer to the Swagger API docs for valid keys.
def create(body) raise ArgumentError unless body.is_a?(Hash) api.post('', body, 'application/json') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @source = Source.new(source_params)\n\n respond_to do |format|\n if @source.save\n format.html { redirect_to edit_source_path(@source), notice: 'Source was successfully created.' }\n format.json { render :show, status: :created, location: @source }\n else\n format....
[ "0.6935232", "0.68554217", "0.64222205", "0.63748235", "0.6332122", "0.6281105", "0.62593967", "0.62425154", "0.61860704", "0.61278796", "0.6104531", "0.6074531", "0.60655665", "0.6048231", "0.59781027", "0.59415144", "0.59271604", "0.5904945", "0.5894627", "0.58882636", "0.5...
0.0
-1
Convenience method to allow configuration options to be set in a block.
def configure yield self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(&block)\n raise ArgumentError, \"Block is required.\" unless block_given?\n yield @options\n end", "def config(&block)\n instance_eval(&block) if block_given?\n end", "def configure_with_block(&block)\n self.instance_eval(&block) if block_given?\n end", "def configure_wit...
[ "0.8297133", "0.7910444", "0.78920984", "0.78920984", "0.7842941", "0.78338", "0.7830759", "0.78208023", "0.78043556", "0.776433", "0.77523476", "0.7743826", "0.7743826", "0.77218664", "0.77026474", "0.7700929", "0.7698305", "0.7682381", "0.76723194", "0.76678455", "0.7667668...
0.0
-1
Create a hash of options and their values.
def options VALID_OPTIONS_KEYS.inject({}) do |option,key| option.merge!(key => send(key)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, opt...
[ "0.7768143", "0.7768143", "0.7768143", "0.7768143", "0.77439386", "0.77399594", "0.77399594", "0.77399594", "0.77399594", "0.77399594", "0.7730182", "0.75393707", "0.7476299", "0.7427791", "0.74242526", "0.74219304", "0.7376853", "0.73295194", "0.73295194", "0.73295194", "0.7...
0.734749
17
Reset all configuration options to default.
def reset self.access_token = DEFAULT_ACCESS_TOKEN self.authorization_endpoint = DEFAULT_AUTHORIZATION_ENDPOINT self.client_id = DEFAULT_CLIENT_ID self.client_secret = DEFAULT_CLIENT_SECRET self.endpoint = DEFAULT_ENDPOINT self.proxy = DEFAULT_PROXY self.user_agent = DEFAULT_USER_AGENT end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset!\n @options = defaults\n end", "def reset!\n @options = defaults\n end", "def reset\n CONFIGURATION_DEFAULTS.each { |k, v| send(\"#{k}=\", v) }\n self\n end", "def reset\n @options = VALID_OPTIONS_KEYS.inject({}) do |opts, k|\n default_option = OnTheSnow::Co...
[ "0.84116083", "0.84116083", "0.8322433", "0.8193893", "0.8148645", "0.8093593", "0.79255295", "0.78857106", "0.78715813", "0.7865288", "0.78531086", "0.78239715", "0.77768344", "0.7754632", "0.77183765", "0.76238275", "0.7580212", "0.74962825", "0.74686015", "0.7466416", "0.7...
0.6613178
82
Building the option dialogbox. Called during BasicDlgOptionsSetter.initialize main_vertical: vertical frame where to build all child controls
def on_build_vertframe(main_vertical) @widg_players_names = [] ix = 1 @settings["players"].each do |vv| hf = FXHorizontalFrame.new(main_vertical, LAYOUT_TOP|LAYOUT_LEFT|LAYOUT_FILL_X|PACK_UNIFORM_WIDTH) FXLabel.new(hf, "Giocatore #{ix}:", nil, JUSTIFY_RIGHT|LAYOUT_FILL_X|LAYOUT_CENTER_Y) txt_f = FXTextField.new(hf, 2, nil, 0, (FRAME_SUNKEN|FRAME_THICK|LAYOUT_FILL_X|LAYOUT_CENTER_Y|LAYOUT_FILL_COLUMN)) txt_f.text = vv[:name].to_s @widg_players_names << txt_f ix += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def InitializeComponent()\n\t\t\tself.@cancelButton = System.Windows.Forms.Button.new()\n\t\t\tself.@okButton = System.Windows.Forms.Button.new()\n\t\t\tself.SuspendLayout()\n\t\t\t# \n\t\t\t# cancelButton\n\t\t\t# \n\t\t\tself.@cancelButton.Anchor = (((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.For...
[ "0.68018395", "0.62683225", "0.6173676", "0.60522115", "0.5985287", "0.59040827", "0.58755624", "0.5806343", "0.5801407", "0.5783906", "0.5754165", "0.57329005", "0.56534535", "0.5620609", "0.5589882", "0.55841845", "0.55837333", "0.55837333", "0.55813587", "0.5580656", "0.55...
0.534452
26
Method called from TestRunnerDialogBox when go button is pressed
def run @log.debug "Run the tester..." settings = YAML::load_file(File.join(ResourceInfo.get_dir_appdata(), 'app_options.yaml')) dlg = NamesOptionsDlg.new(@main_app, settings, @main_app) dlg.execute end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\r\n @log.debug \"Run the tester...\"\r\n @dlg_box = CupSingleGameWin.new(@options)\r\n @dlg_box.create\r\n end", "def go_go_go\n \n # Catch errors so the GUI doesn't just mysteriously disappear\n begin\n \n # Make sure they have a RDT username and password\n unless g...
[ "0.63644606", "0.62964433", "0.62464285", "0.60698146", "0.60617983", "0.60617983", "0.60419524", "0.5927684", "0.58906287", "0.5877357", "0.583677", "0.5819967", "0.5819967", "0.5819967", "0.5804068", "0.57518095", "0.5742062", "0.573307", "0.57323927", "0.57088983", "0.5695...
0.5581627
39
Retrieve plugin specific configuration from the global configuration file gets passed to the plugin instance upon initilization.
def plugin_config(plugin) Jerakia::Lookup::PluginConfig.new(plugin) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pluginconf(plugin)\n @pluginconfig[plugin]\n end", "def config\n @config ||= YAML.load_file @options[:config_file]\n end", "def config\n @bot.config.plugins.options[self.class] || {}\n end", "def config\n @bot.config.plugins.options[self.class] || {}\n end", "d...
[ "0.7281502", "0.71163803", "0.7108594", "0.7108594", "0.7108594", "0.7061733", "0.69594187", "0.69156677", "0.6878163", "0.6849345", "0.67562926", "0.6725543", "0.66451824", "0.6644665", "0.66232985", "0.66232985", "0.65981066", "0.6595", "0.65789443", "0.6577961", "0.6564013...
0.6665647
12
lookup function: continue Will cause Jerakia to continue to the next lookup in the policy which is the default behaviour
def continue @proceed = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve(records, lookup_chain, domain)\n # check if key exists\n count = 0\n\n for keyHash in records[:ADDRESS]\n if keyHash.has_key? domain.to_sym\n count=1\n end\n end\n\n for keyHash in records[:CNAME]\n if keyHash.has_key? domain.to_sym\n count=1\n end\n end\n\n if count == 0\n...
[ "0.57202727", "0.54853976", "0.5467896", "0.54602116", "0.5413731", "0.5364005", "0.5354218", "0.53466433", "0.5250838", "0.5250838", "0.52301514", "0.5221761", "0.5200316", "0.5151956", "0.5128227", "0.51147974", "0.5102329", "0.50931597", "0.50682104", "0.5019007", "0.50175...
0.5330119
8
lookup function: invalidate Setting invalidate will mean this lookup will be skipped in the policy
def invalidate @valid = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lookup_uncached(val); end", "def lookup_uncached(val); end", "def invalidate\n @invalid=true\n end", "def write_invalidation(offset:)\n invalidate! if offset.between?(@cache_offset_begin, @cache_offset_end)\n end", "def invalidate\r\n @invalid=true\r\n end", "def invalidate\n ...
[ "0.575935", "0.575935", "0.57536674", "0.5741196", "0.5685166", "0.5545014", "0.5320189", "0.53179014", "0.52834135", "0.5212399", "0.5208969", "0.51370835", "0.5130603", "0.51212955", "0.51132417", "0.5112048", "0.5111466", "0.50882965", "0.5083123", "0.5074901", "0.50724643...
0.55245936
6
Display a specific order
def show @order = Order.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_order_contents\n\t\t@orders.each {|item| print item, \" -- \"}\n\tend", "def order\n \"Order nr. #{number}\"\n end", "def order\n \"Order nr. #{number}\"\n end", "def print_order(order)\n\tputs \"Here are the items you've ordered:\"\n\torder.each {|food| puts \"#{food.item}: $#{food.price...
[ "0.7749917", "0.74519897", "0.74519897", "0.7245423", "0.71778303", "0.7019009", "0.6999654", "0.6932858", "0.68941724", "0.68030185", "0.6752615", "0.67449087", "0.6617434", "0.6616171", "0.65817136", "0.6533804", "0.65170544", "0.64989656", "0.6470312", "0.64503807", "0.640...
0.6234985
40
Convert a cart into an order go through and check each cart entry, if in stock and valid then convert to an order entry. If the order is valid after the creation of the entry then ammend stock levels. Once all valid entries are generated save the whole thing and clear the shopping cart
def create candidateOrder = Order.new(email: params[:order][:Email], totalCost: cart_total, user: curr_user) cart.each do |pId, info| if (prod = Product.find_by(id: pId)) if prod.stockCount > info["Num"].to_i candidateOrder.order_entries.new( product: prod, quantity: info["Num"].to_i, unitprice: prod.price, totalprice: prod.price * info["Num"].to_i, order_id: candidateOrder.id ) candidateOrder.order_entries.last.validate! if candidateOrder.valid? prod.stockCount -= info["Num"].to_i Product.update(prod.id, stockCount: prod.stockCount) end end end end if candidateOrder.save! clear_cart redirect_to order_path(candidateOrder), notice: t(:order_placed) else redirect_to carts_path, error: t(:order_failed) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n # create new order object from form parameters\n @order = Order.new(order_params)\n\n # get the contents of the cart\n @cart = Cart.find(current_user.cart_id)\n\n # for security reasons, calculate the total amount from the actual cart (instead of taking a parameter)\n @total_amount, ...
[ "0.6655813", "0.64634234", "0.62644565", "0.62572646", "0.62338233", "0.6221731", "0.6160598", "0.60869896", "0.60228485", "0.5998863", "0.59857064", "0.59836817", "0.59468913", "0.59129775", "0.58774203", "0.5873198", "0.5858518", "0.58464986", "0.582184", "0.5810873", "0.58...
0.6795797
0
Empty the user's shopping cart
def clear_cart update_cart({}) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clear_carts\n current_user.carts.each_with_index do |cart, i|\n cart.delete if i != current_user.carts.length - 1\n end\n end", "def empty_cart\n self.each do |item|\n item.cart_id = nil\n item.save!\n end\n end", "def empty_cart\n puts \"========= Emptying Cart\"\n @b.go...
[ "0.8031044", "0.77986765", "0.7593933", "0.7593933", "0.739813", "0.7364413", "0.7336975", "0.7253655", "0.72161233", "0.71335286", "0.70281833", "0.6977616", "0.69772935", "0.69201314", "0.68642545", "0.6854456", "0.6851387", "0.68240815", "0.6815093", "0.67398065", "0.67084...
0.78453743
1
Get total cost of all products in the cart
def cart_total total = 0 cart.each do |pId, info| if (prod = Product.find_by(id: pId)) total += prod.price * info["Num"].to_i end end total end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def total_price\n total = 0\n self.carts.each do |item|\n total += item.quantity * item.product.price\n end\n return total\n end", "def cart_total\n total = 0\n cart.each do |product_id, details|\n if p = Product.find_by(id: product_id)\n total += p.pri...
[ "0.8293662", "0.8215741", "0.8215741", "0.80555874", "0.7956167", "0.7939108", "0.7927913", "0.791726", "0.77824396", "0.7778452", "0.77516174", "0.7708805", "0.7658332", "0.7639621", "0.76211673", "0.7582056", "0.7579942", "0.75787103", "0.7560054", "0.7533393", "0.7533393",...
0.8125215
3
returns first of the given paths that exists, or the last one if none exists
def first_existing(*paths) last_path = nil paths.each do |path| last_path = path break if @io.exist?(path) end last_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_first(*paths)\n xpath(*paths).first\n end", "def common_path(paths)\n return nil if paths.empty?\n strs = paths.map do |path|\n unless path.absolute?\n raise ArgumentError, \"Paths must be absolute #{path}\"\n end\n path...
[ "0.72064084", "0.6627912", "0.65136635", "0.6481619", "0.638956", "0.6097864", "0.6002848", "0.5953102", "0.5939572", "0.5894156", "0.58747023", "0.58626807", "0.57939816", "0.57574594", "0.57429886", "0.57225275", "0.5713313", "0.5698395", "0.56867754", "0.5674942", "0.56405...
0.8213236
0
does some basic form validation, uses the most recent Veritable analysis completed to make a prediction for the time the task will actually take, and adds the new task and estimates to the database
def register_estimate(params) # half-hour increments params.update(:user_estimate => [1, (params[:user_estimate].to_f * 2).round].max) if params[:user_estimate] > 0 # check to make sure that the user's estimate is meaningful a = most_recent_analysis_succeeded veritable_estimate = a.predict(stringify_hash_keys(params).update( 'true_time' => nil, # this is what we're predicting 'user_class' => params[:user_class] ))['true_time'] Task.create(params.update(:veritable_estimate => veritable_estimate)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def estimate\n if self.submitted? && (Time.now - self.updated_at) > 5 * 60\n # re-initialize the estimates\n self.estimated_cost = nil\n self.estimated_duration = nil\n # only estimate projects with a budget of $200K! because why bother!\n budget = self.budget_allocated\n if budge...
[ "0.59465456", "0.5757286", "0.5691471", "0.5658995", "0.5658576", "0.5628313", "0.56260484", "0.56186736", "0.5590127", "0.5581017", "0.55739576", "0.55511534", "0.55511534", "0.5532458", "0.55226046", "0.5512673", "0.5493022", "0.54827636", "0.5476906", "0.54667455", "0.5448...
0.57034844
2
every time a new task is completed, we run another analysis, which may not be appropriate for production apps with larger datasets
def register_completion(id, true_time) t = Task.get(id) t.update({ :true_time => (true_time.to_f * 2).round }) schema = most_recent_analysis_created.schema n = most_recent_analysis_created._id.split('_')[1].to_i + 1 if most_recent_analysis_created._id != most_recent_analysis_succeeded._id most_recent_analysis_created.delete end r = stringify_hash_keys(t.attributes) r['_id'] = r['id'].to_s r.delete('id') TABLE.upload_row(r) TABLE.create_analysis(schema, "veritabill_#{n}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def perform\n options.clean_options!\n at(0, 100, t('common.progress_initializing'))\n\n user = User.find(options[:user_id])\n dataset = user.datasets.active.find(options[:dataset_id])\n task = dataset.analysis_tasks.find(options[:task_id])\n\n task.name = t('.short_desc')...
[ "0.6940027", "0.6936757", "0.66777074", "0.66599137", "0.6420923", "0.6376106", "0.6270561", "0.6252552", "0.62487745", "0.62278503", "0.6192954", "0.61288834", "0.6111016", "0.61012614", "0.60936373", "0.60735357", "0.6056618", "0.60443026", "0.60374844", "0.60131305", "0.60...
0.0
-1
matt's sweet code def clamp_to_edgeeee(node, x, y base=BASE) originX = node % base originY = node / base if originX + x > base node = originX + x base end if originY + y > base node = base (originY + y base) end return node end
def clamp_to_edge(node, x, y, base=BASE) while base - (node % base) < x node -= 1 end while (node + (base*(y-1))) >= (base*base) node -= base end return node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def clamp; end", "def clamp(x, low, hi)\n x = low if x < low\n x = hi if x > hi\n return x\n end", "def h(node)\n (node.x - @end.x).abs + (node.y - @end.y).abs\n end", "def limit\n @nodes.each do |node|\n norm = normal(node.disposition.x, node.disposition.y)\n ...
[ "0.60007447", "0.59062517", "0.5570146", "0.5416254", "0.53874373", "0.5354287", "0.53438634", "0.5325704", "0.53165317", "0.529577", "0.5265072", "0.52428883", "0.51784825", "0.51435274", "0.50972915", "0.50513065", "0.5031904", "0.50245386", "0.50062066", "0.5004022", "0.50...
0.9105717
0
don't think this is needed? would assume a user is trying to sign up via extension
def install end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attemp_signup\n\n end", "def signup\n end", "def signup\n end", "def sign_up(resource_name, resource)\n true\n end", "def allow_sign_up?\n @allow_sign_up\n end", "def client_sign_up\n\n end", "def sign_up(resource_name, resource)\n true\n end", "def sign_up(resource_name, re...
[ "0.7856785", "0.7408825", "0.7408825", "0.7070852", "0.7024728", "0.70140195", "0.70129937", "0.70129937", "0.6928799", "0.6921636", "0.6823892", "0.67243785", "0.67159003", "0.6688691", "0.6627532", "0.6609308", "0.66084903", "0.66084903", "0.65946454", "0.65833044", "0.6573...
0.0
-1
For the purposes of this kata, some tests may have multiple answers; any valid solutions will be accepted. The input will always be valid (numbers will be an array of length 2 or greater, and all of the items will be numbers; target will always be the sum of two different items from that array). Based on: => twoSum [1, 2, 3] 4 === (0, 2)
def two_sum(numbers, target) arr = numbers num = target index_array = [] return_array = [] current_index = 0 loop do idx_counter = current_index current_element = arr[current_index] loop do break if idx_counter >= arr.length - 1 next_index = idx_counter + 1 next_element = arr[next_index] if current_element + next_element == num index_array << current_index << next_index end idx_counter += 1 end if return_array == [] current_index += 1 end break if return_array.reduce(:+) == num end p index_array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def two_sum(array, target)\n\n !!array.uniq.combination(2).detect { |a, b| a + b == target }\nend", "def bad_two_sum?(arr, target)\n sums = []\n arr.each_index do |i|\n (i+1...arr.length).each do |j|\n sums << arr[i] + arr[j]\n end\n end\n sums.include?(target)\nend", "def is_sum_of_any_two(targ...
[ "0.793329", "0.78229356", "0.7804584", "0.78011733", "0.77942216", "0.7748239", "0.77399576", "0.7694916", "0.76921254", "0.76395905", "0.76329875", "0.7619972", "0.76186657", "0.7565763", "0.7555659", "0.755184", "0.7548577", "0.7542765", "0.75381136", "0.75241697", "0.75232...
0.7509018
23
Use callbacks to share common setup or constraints between actions.
def set_product_in_storehouse @product_in_storehouse = ProductInStorehouse.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a trusted parameter "white list" through.
def product_in_storehouse_params params.require(:product_in_storehouse).permit(:quantity, :product_id, :storehouse_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7123669", "0.7054077", "0.69472784", "0.6902165", "0.6736001", "0.671985", "0.6687218", "0.6676269", "0.66602534", "0.6556639", "0.6527985", "0.645892", "0.645072", "0.64494324", "0.6445436", "0.64350927", "0.6415061", "0.6415061", "0.6393001", "0.6378958", "0.6378958", ...
0.0
-1
Public: serves as the getter and setter for the Array of Symbol column names. Union join the existing column names with those passed Example: ``` header.columns :name, :age, :location ``` `args` Array of Symbol arguments passed Returns as Array of Symbols
def columns(*args) @columns = @columns | args.map(&:to_sym) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column(name, *args)\n define_method name do\n instance_variable_get(\"@_#{name}\")\n end\n define_method \"#{name}=\" do |val|\n instance_variable_set(\"@_#{name}\", val)\n end\n self.columns = columns.concat([[name].concat(args)])\n end", "def named_columns( names )\n @colum...
[ "0.67176396", "0.6573496", "0.6359476", "0.63251394", "0.6318875", "0.6301126", "0.6283622", "0.62174606", "0.6158545", "0.61454654", "0.61317384", "0.6100073", "0.60494655", "0.60126406", "0.6001964", "0.59973043", "0.59882694", "0.59270465", "0.58921254", "0.5890751", "0.58...
0.81415546
0
Public: Define mappings of the Symbol column names to nicer, human names Example: ``` header.mappings name: 'Full name', age: 'Age of person' ``` `hash` Hash of mappings where the key is the column name to map and the value is the human readable value Returns a Hash of mappings
def mappings(hash = {}) @mappings.merge!(hash) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_column_mapping\n self.column_mapping = Hash.new.tap do |mapping|\n headers.collect { |h| canonicalize_header(h) }.each.with_index do |header, index|\n raise RuntimeError, \"Unrecognized canonical header #{header}\" unless HEADER_MAPPING.has_key?(header)\n if value = HEADER_MAPPING[he...
[ "0.65578604", "0.6396888", "0.63724834", "0.6246082", "0.621029", "0.61389667", "0.6048265", "0.5995724", "0.5842687", "0.5771993", "0.5653656", "0.5561997", "0.55097145", "0.5494023", "0.54799503", "0.5443157", "0.54364485", "0.54269636", "0.5408039", "0.54055625", "0.537429...
0.513987
46
Public: Convert column names, default inflector is :humanize Example: ``` header.inflector :titleize ``` `:titleize` one of ruby inflectors
def inflector(header_inflector) @inflector = header_inflector end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def camerize(tablename)\n tablename.split(\"_\").map {|word| word.capitalize }.join(\"\")\n end", "def columnName_to_fieldname (name)\n return name.downcase.gsub(' ','-')\nend", "def mapped_columns\n @columns.map do |column|\n @mappings[column] || column.to_s.send(@inflector)\n end\n e...
[ "0.67739445", "0.65588963", "0.65565646", "0.65240276", "0.6446608", "0.6302299", "0.6291594", "0.62675285", "0.6259997", "0.6253621", "0.6251851", "0.6222456", "0.6161914", "0.6135314", "0.61333627", "0.61024654", "0.6081763", "0.60761696", "0.60680443", "0.60675", "0.605765...
0.6427629
5
Public: converts columns and mappings into mapped columns ready for encoding. If a mapped value is found that is used, else the Symbol column name is humanized by default or can be specified with header_inflector option Returns an Array of Strings
def mapped_columns @columns.map do |column| @mappings[column] || column.to_s.send(@inflector) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def column_names(column_mappings)\n column_mappings.map { |c| (c['column'] || c['standard_mapping']).downcase }\n end", "def make_column_mapping\n self.column_mapping = Hash.new.tap do |mapping|\n headers.collect { |h| canonicalize_header(h) }.each.with_index do |header, index|\n raise Run...
[ "0.6813702", "0.6511555", "0.646128", "0.6441469", "0.6000217", "0.5928535", "0.5883122", "0.58591306", "0.5849231", "0.5843938", "0.58433", "0.5836539", "0.58239007", "0.5813955", "0.58128095", "0.580976", "0.57861865", "0.5762714", "0.57607377", "0.5745558", "0.5744659", ...
0.76826763
0
TODO bootstrap formatting TODO cache data TODO format output
def index #get new data @attributes=["name","price","block","nextretarget","blocksleft","measured","difficulty","estdifficulty","timeretarget"] @data={} @data["btc"]=generateBTCData(2016) @data["ltc"]=generateMapData("ltc","http://litecoinscout.com/chain/litecoin/q",150,2016) @data["ftc"]=generateMapData("ftc","http://explorer.feathercoin.com/chain/Feathercoin/q",150,504) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatter; end", "def formatter; end", "def formatter; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def format; end", "def preformatting\n\n end", "def output(data); end", "def format...
[ "0.62854195", "0.62854195", "0.62854195", "0.603524", "0.603524", "0.603524", "0.603524", "0.603524", "0.603524", "0.603524", "0.603524", "0.59537464", "0.59504", "0.59374535", "0.59374535", "0.5783593", "0.5762262", "0.57610136", "0.5756537", "0.5734288", "0.5711039", "0.5...
0.0
-1
GET /tipo_convenios/1 GET /tipo_convenios/1.json
def show @tipo_convenio = TipoConvenio.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @tipo_convenio } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @tipo_contrato = TipoContrato.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @tipo_contrato }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to ...
[ "0.7094906", "0.67918247", "0.67725545", "0.6759573", "0.67560804", "0.6745839", "0.65608364", "0.6555574", "0.6537344", "0.65112025", "0.64990485", "0.6467223", "0.6427331", "0.6426641", "0.6419957", "0.6419957", "0.6414807", "0.63988423", "0.6375387", "0.63596445", "0.63534...
0.7124635
0
GET /tipo_convenios/new GET /tipo_convenios/new.json
def new @tipo_convenio = TipoConvenio.new respond_to do |format| format.html # new.html.erb format.json { render json: @tipo_convenio } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "def new\n @tipo_pensum = TipoPensum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ...
[ "0.77312815", "0.7632935", "0.7581101", "0.7501306", "0.7468367", "0.74403334", "0.74272454", "0.7398976", "0.73842394", "0.7372472", "0.7366392", "0.733274", "0.73322", "0.7308771", "0.7290168", "0.7282418", "0.7263765", "0.7245985", "0.72378975", "0.72123754", "0.7205718", ...
0.7872798
0
POST /tipo_convenios POST /tipo_convenios.json
def create @tipo_convenio = TipoConvenio.new(params[:tipo_convenio]) respond_to do |format| if @tipo_convenio.save format.html { redirect_to @tipo_convenio, notice: 'Tipo convenio was successfully created.' } format.json { render json: @tipo_convenio, status: :created, location: @tipo_convenio } else format.html { render action: "new" } format.json { render json: @tipo_convenio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @cliente = Cliente.new\n if params[:type] == \"PessoaFisica\"\n @cliente.pessoa = PessoaFisica.new\n else\n @cliente.pessoa = PessoaJuridica.new\n end\n @cliente.assign_attributes(cliente_params)\n respond_to do |format|\n if @cliente.save\n format.html { redire...
[ "0.6784479", "0.6755005", "0.6635388", "0.6617056", "0.6607979", "0.65592074", "0.6539847", "0.6523403", "0.6498797", "0.64897305", "0.6486794", "0.6445604", "0.641651", "0.6395924", "0.63954407", "0.6392188", "0.6383946", "0.6374849", "0.63693905", "0.6363753", "0.63596064",...
0.66853106
2
PUT /tipo_convenios/1 PUT /tipo_convenios/1.json
def update @tipo_convenio = TipoConvenio.find(params[:id]) respond_to do |format| if @tipo_convenio.update_attributes(params[:tipo_convenio]) format.html { redirect_to @tipo_convenio, notice: 'Tipo convenio was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @tipo_convenio.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n authorize! :update, Tipo\n respond_to do |format|\n if @tipo.update(tipo_params)\n log(\"Se ha editado la nomina #{@lt}\", 1)\n format.html { redirect_to tipos_path, notice: 'Los datos de la nómina fueron actualizados exitosamente.' }\n format.json { head :no_content }\...
[ "0.6576078", "0.6518064", "0.6465294", "0.6370377", "0.6358648", "0.6271851", "0.6269607", "0.6230175", "0.6226274", "0.6214361", "0.6193123", "0.6178852", "0.6170548", "0.6162425", "0.6105472", "0.6090012", "0.60784835", "0.60717624", "0.60652345", "0.6060631", "0.60520023",...
0.63716155
3
DELETE /tipo_convenios/1 DELETE /tipo_convenios/1.json
def destroy @tipo_convenio = TipoConvenio.find(params[:id]) @tipo_convenio.destroy respond_to do |format| format.html { redirect_to tipo_convenios_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @tipo_contrato = TipoContrato.find(params[:id])\n @tipo_contrato.destroy\n\n respond_to do |format|\n format.html { redirect_to tipo_contratos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consumo = Consumo.find(params[:id])\n @consumo.destroy\n...
[ "0.7294594", "0.7150272", "0.70917165", "0.70767593", "0.7062537", "0.7028968", "0.70284116", "0.70270693", "0.7021605", "0.70079625", "0.69910973", "0.6971971", "0.69699985", "0.6962163", "0.6960114", "0.6957955", "0.6947555", "0.69464463", "0.6946137", "0.69455266", "0.6932...
0.7368083
0
SPACE WALK (CHANCE MISSION) ///////////////////////////////////
def spacewalk() puts " _..._ .' '. _ / .-\"\"-\\ _/ \\ .-| /:. | | | | \\ |:. /.-'-./ | .-'-;:__.' =/ .'= *=|NASA _.=' / _. | ; ;-.-'| \\ | / | \\ _\\ _\\ \\__/'._;. ==' ==\\ \\ \\ | / / / /-._/-._/ \\ `\\ \\ `-._/._/ _________ __ __ .__ __ / _____/__________ _____ ____ / \\ / \\_____ | | | | __ \\_____ \\| _ \\__ \\ / ___\\/ __ \\ \\ \\/\\/ /\\__ \\ | | | |/ / / \\ |_| / __ \\\\ \\__\\ ___/ \\ / / __ \\| |_| < /_______ / __(____ /\\____/\\___ > \\__/\\ / (____ /____/__|_ \\ \\/|__| \\/ \\/ \\/ \\/" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nasa_space_craft; end", "def award; end", "def backlog; end", "def backlog; end", "def starship; end", "def credits; end", "def wagner; end", "def who_we_are\r\n end", "def king_richard_iii; end", "def villian; end", "def online_special_ballot\n end", "def borrower\n end", "def waive...
[ "0.5873864", "0.5650388", "0.5633538", "0.5633538", "0.5548871", "0.5529054", "0.55225575", "0.5517337", "0.54853183", "0.54618436", "0.5410341", "0.53942347", "0.53899455", "0.5345536", "0.5343771", "0.532276", "0.53206104", "0.5315757", "0.53081286", "0.5297939", "0.5221779...
0.0
-1
Returns true if the current user is following the other user.
def following?(other_user) following.include?(other_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n end", "def following?(other_user)\n following.include?(other_user)\n ...
[ "0.85306346", "0.85111505", "0.85111505", "0.85111505", "0.8480705", "0.8480705", "0.8480705", "0.8480705", "0.84233135", "0.8413255", "0.83404523", "0.83404523", "0.83404523", "0.83404523", "0.83404523", "0.83404523", "0.83404523", "0.83404523", "0.83404523", "0.83404523", "...
0.83061314
91
GET /faxes GET /faxes.json
def index @faxes = Fax.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_faxes(opts = {})\n data, _status_code, _headers = get_faxes_with_http_info(opts)\n data\n end", "def get_faxes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FaxesApi.get_faxes ...'\n end\n allowable_values = ...
[ "0.7665524", "0.7437441", "0.68032384", "0.65644884", "0.64255446", "0.5986198", "0.59679914", "0.5958632", "0.5893894", "0.582781", "0.5819581", "0.5815399", "0.5805736", "0.5776036", "0.5769731", "0.5718689", "0.56752414", "0.565957", "0.564791", "0.5625505", "0.5612374", ...
0.7159742
2
GET /faxes/1 GET /faxes/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @faxes = Fax.all\n end", "def get_faxes(opts = {})\n data, _status_code, _headers = get_faxes_with_http_info(opts)\n data\n end", "def get_faxes_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FaxesApi.get_faxe...
[ "0.6904066", "0.69012874", "0.6875912", "0.6721544", "0.670126", "0.6151941", "0.611589", "0.5987312", "0.5979005", "0.59687763", "0.5860933", "0.5857329", "0.5817248", "0.58118486", "0.5791591", "0.57756853", "0.575676", "0.5718606", "0.5710551", "0.5701459", "0.5699748", ...
0.0
-1
POST /faxes POST /faxes.json
def create @fax = Fax.new(fax_params) respond_to do |format| if @fax.save format.html { redirect_to @fax, notice: 'Fax was successfully created.' } format.json { render :show, status: :created, location: @fax } else format.html { render :new } format.json { render json: @fax.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_faxes(faxes, opts = {})\n data, _status_code, _headers = post_faxes_with_http_info(faxes, opts)\n data\n end", "def post_faxes_with_http_info(faxes, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FaxesApi.post_faxes ...'\n end\n...
[ "0.7567552", "0.7502427", "0.6328821", "0.6292444", "0.5744277", "0.5717272", "0.57033557", "0.564159", "0.5538465", "0.5445058", "0.54337585", "0.5377283", "0.5369761", "0.5325375", "0.53133285", "0.52752966", "0.5209369", "0.5077021", "0.50402325", "0.5030058", "0.5025962",...
0.58929026
4
PATCH/PUT /faxes/1 PATCH/PUT /faxes/1.json
def update respond_to do |format| if @fax.update(fax_params) format.html { redirect_to @fax, notice: 'Fax was successfully updated.' } format.json { render :show, status: :ok, location: @fax } else format.html { render :edit } format.json { render json: @fax.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n\n format.json { render json: Axis.find(params[:id]).update( name: params[:name]) }\n end\n\n # end\n end", "def update\n @fax_typ = FaxTyp.find(params[:id])\n\n respond_to do |format|\n if @fax_typ.update_attributes(params[:fax_typ])\n forma...
[ "0.6405743", "0.6095538", "0.5998256", "0.5961049", "0.5931614", "0.58949435", "0.5893845", "0.5871725", "0.58678293", "0.5815141", "0.5793186", "0.5777657", "0.577376", "0.57529545", "0.57525903", "0.57495207", "0.5748024", "0.57470715", "0.5735325", "0.5734178", "0.571494",...
0.62733513
1
DELETE /faxes/1 DELETE /faxes/1.json
def destroy @fax.destroy respond_to do |format| format.html { redirect_to faxes_url, notice: 'Fax was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def destroy\n @axis.destroy\n respond_to do |format|\n format.html { redirect_to axes_url, notice: 'Axis was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n ...
[ "0.668589", "0.6590102", "0.6529944", "0.64363027", "0.6378425", "0.6369021", "0.6350011", "0.634973", "0.6342679", "0.63381755", "0.63297445", "0.6305522", "0.6300163", "0.62862", "0.62728167", "0.6258868", "0.62525505", "0.6238768", "0.6234341", "0.6230245", "0.6223411", ...
0.666336
1
Use callbacks to share common setup or constraints between actions.
def set_fax @fax = Fax.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 fax_params params.require(:fax).permit(:fax) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Just store it for later processing
def receive(number) puts "received number #{number}" @queue << number end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store?; end", "def stored_data; end", "def store; end", "def store; end", "def store; end", "def store_result()\n #This is a stub, used for indexing\n end", "def private; end", "def autorestore; end", "def storage; end", "def result_of_setting; end", "def storage() @storag...
[ "0.67965674", "0.6711053", "0.66920036", "0.66920036", "0.66920036", "0.6384689", "0.63025093", "0.62964463", "0.62794805", "0.6087402", "0.60511476", "0.5983519", "0.59697706", "0.59503764", "0.59406257", "0.59190786", "0.5808031", "0.5806474", "0.5806474", "0.5806474", "0.5...
0.0
-1
GET /descuento_adicionals GET /descuento_adicionals.json
def index @descuento_adicionals = DescuentoAdicional.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @item_adicionals = ItemAdicional.all\n end", "def destroy\n @descuento_adicional.destroy\n respond_to do |format|\n format.html { redirect_to descuento_adicionals_url, notice: 'Descuento adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", ...
[ "0.6345408", "0.6147245", "0.6063977", "0.6063977", "0.5915792", "0.5871646", "0.585145", "0.5846302", "0.5790004", "0.5759359", "0.5753114", "0.57437164", "0.5739775", "0.57258624", "0.57", "0.5699348", "0.5662103", "0.5654298", "0.56452703", "0.5627805", "0.56223935", "0....
0.769354
1
GET /descuento_adicionals/1 GET /descuento_adicionals/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def index\n @descuento_adicionals = DescuentoAdicional.all\n end", "def set_descuento_adicional\n @descuento_adicional = DescuentoAdicional.find(params[:id])\n end", "def set_descuento_adicional\n @descuento_adicional = ...
[ "0.74628246", "0.74628246", "0.6197751", "0.6197751", "0.6161126", "0.6131787", "0.6063931", "0.6052714", "0.604076", "0.58766615", "0.58630943", "0.5843038", "0.5834659", "0.5828711", "0.58231443", "0.58036417", "0.57932264", "0.5739739", "0.57353437", "0.57251334", "0.57225...
0.0
-1
POST /descuento_adicionals POST /descuento_adicionals.json
def create @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params) respond_to do |format| if @descuento_adicional.save format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional fue creado exitosamente.' } format.json { render :show, status: :created, location: @descuento_adicional } else format.html { render :new } format.json { render json: @descuento_adicional.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @descuento_adicional = DescuentoAdicional.new(descuento_adicional_params)\n\n respond_to do |format|\n if @descuento_adicional.save\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional was successfully created.' }\n format.json { render :show, status:...
[ "0.6745028", "0.6544405", "0.6544405", "0.6464977", "0.64624697", "0.6201955", "0.605923", "0.5940895", "0.58948404", "0.58948404", "0.58737224", "0.57324123", "0.57091653", "0.567408", "0.5621925", "0.55859756", "0.55783", "0.5558731", "0.55469257", "0.5537962", "0.55377775"...
0.6690199
1
PATCH/PUT /descuento_adicionals/1 PATCH/PUT /descuento_adicionals/1.json
def update respond_to do |format| if @descuento_adicional.update(descuento_adicional_params) format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional fue actualizado exitosamente.' } format.json { render :show, status: :ok, location: @descuento_adicional } else format.html { render :edit } format.json { render json: @descuento_adicional.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @descuento_adicional.update(descuento_adicional_params)\n format.html { redirect_to @descuento_adicional, notice: 'Descuento adicional was successfully updated.' }\n format.json { render :show, status: :ok, location: @descuento_adicional }\n else\...
[ "0.68740344", "0.6508011", "0.6374225", "0.634008", "0.6299347", "0.6268326", "0.62560046", "0.6252494", "0.6252113", "0.6248781", "0.6247315", "0.62207776", "0.6206411", "0.6186919", "0.61850315", "0.617283", "0.6169775", "0.6152704", "0.6147492", "0.6146387", "0.61308557", ...
0.6687972
1
DELETE /descuento_adicionals/1 DELETE /descuento_adicionals/1.json
def destroy @descuento_adicional.destroy respond_to do |format| format.html { redirect_to descuento_adicionals_url, notice: 'Descuento adicional fue eliminado exitosamente.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @descuento_adicional.destroy\n respond_to do |format|\n format.html { redirect_to descuento_adicionals_url, notice: 'Descuento adicional was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @item_adicional.destroy\n respond_to do |...
[ "0.7584859", "0.7107488", "0.69920623", "0.6938006", "0.68970776", "0.68573004", "0.68464035", "0.68457973", "0.6844119", "0.6829674", "0.6827674", "0.6827197", "0.68189293", "0.68072635", "0.67916226", "0.67914766", "0.6785067", "0.67733", "0.67674804", "0.67585856", "0.6753...
0.7483473
1
Use callbacks to share common setup or constraints between actions.
def set_descuento_adicional @descuento_adicional = DescuentoAdicional.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 descuento_adicional_params params.require(:descuento_adicional).permit(:descuento_adicional, :detalle) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
this will be useful if we want to `puts params` in the server log
def to_s @params.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def output_debug(params)\n Rails.logger.debug(\"\\n\\n\\n\\n------------------------------------------------\\n\")\n Rails.logger.debug(params.inspect)\n Rails.logger.debug(\"\\n------------------------------------------------\\n\\n\\n\\n\")\n end", "def log_request\n logger.info \"HTTP request rece...
[ "0.75409245", "0.75017816", "0.72487843", "0.70113087", "0.7004724", "0.67856485", "0.676497", "0.6665338", "0.66461235", "0.6624847", "0.65805256", "0.6577461", "0.6563905", "0.65606695", "0.6515263", "0.64926493", "0.64505297", "0.6413419", "0.640959", "0.6376653", "0.63758...
0.0
-1
this should return an array user[address][street] should return ['user', 'address', 'street']
def parse_key(key) key.gsub(/(\[|\])/, " ").split(/\s+/) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_data(users, username)\n user_array = []\n users.each do |user|\n if user['username'] == username\n user_array << user['name']\n user_array << user['username']\n user_array << user['password']\n user_array << user['admin']\n end\n end\n...
[ "0.60554117", "0.5764049", "0.5719801", "0.56254435", "0.55866015", "0.5446294", "0.54349995", "0.54079497", "0.53280914", "0.52007", "0.51558053", "0.51461625", "0.50951827", "0.50842553", "0.5081877", "0.50778097", "0.5074795", "0.50687027", "0.5064698", "0.5058538", "0.505...
0.0
-1
Creates a pipeline on AWS Elastic Transcoder
def create_pipeline name, input_bucket, output_bucket, role begin @elastictranscoder.create_pipeline( name: name, input_bucket: input_bucket, output_bucket: output_bucket, role: role ) rescue #Raise informative exception end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_pipeline(**args)\n params = parameters(args) do\n optional_params :name, :deal_probability, :order_nr, :active\n end\n request(:post, 'pipelines', params)\n end", "def pipeline(name)\n return PipelineT.new(name)\n end", "def to_pipeline\n p = Pipel...
[ "0.652446", "0.64508605", "0.6340263", "0.63075244", "0.62349594", "0.621768", "0.6021814", "0.58086044", "0.5745947", "0.5608509", "0.5604101", "0.5568337", "0.5525445", "0.55089235", "0.5487428", "0.546316", "0.5413003", "0.53632617", "0.5357884", "0.53394645", "0.53355235"...
0.74993247
0
Deletes a pipeline on AWS Elastic Transcoder given an id
def delete_pipeline id begin @elastictranscoder.delete_pipeline(id: id) rescue #Raise informative exception end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_pipeline(id:, **args)\n params = parameters(args) do\n optional_params\n end\n request(:delete, \"pipelines/#{id}\", params)\n end", "def delete_pipeline(id)\n delete(\"dealGroups/#{id}\")\n end", "def delete_pipeline(id, opts = {})\n data, status_...
[ "0.831177", "0.80013835", "0.72955346", "0.7219937", "0.70177466", "0.6564606", "0.62814873", "0.626145", "0.5979849", "0.58549", "0.57210433", "0.57043666", "0.56821215", "0.56635123", "0.56628966", "0.5651034", "0.5632525", "0.5617103", "0.55874884", "0.5555457", "0.5543756...
0.9011064
0
To verify data integrity, its a good idea to easily check headers and how many unique elements there are on the last column of the CSV
def preview_output path puts `head #{path}` last_columns = [] open(path) do |csv| csv.each_line do |line| last_columns.push(line.split(',').last.strip) end end p Hash[last_columns.sort.group_by {|x| x}.map {|k,v| [k,v.count]}] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_number_of_rows\n row_array = []\n CSV.foreach('testdata.csv', {headers: true}) {|row| row_array << row[1]} \n row_array.uniq.size\nend", "def check_duplicate_csv_headers(table)\n if table.headers.size != table.headers.uniq.size\n dups = table.headers.select{|e| table.headers.count(e) > 1 }\n ...
[ "0.72180647", "0.7186385", "0.7156484", "0.6971711", "0.6933744", "0.69251376", "0.69096893", "0.6859789", "0.6753944", "0.6720358", "0.6642854", "0.6543956", "0.64059967", "0.640305", "0.6380496", "0.63673365", "0.6366493", "0.62796265", "0.62711096", "0.6256302", "0.6122794...
0.5400881
78
Following methods use select instead of where to force retrieving prices even if they are not persisted
def book_tickets prices.select{ |p| p.type == 'Price::BookTicket' }.reject(&:blank?).sort_by(&:number) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prices(id, where)\n Price.find(:all, :conditions=>\"dish_id=#{id} and freezer='#{where}'\")\n end", "def active_prices\n prices.where('active = 1')\n end", "def all_prices\n request :public, :get, :price\n end", "def prices\n Excursion.all.each do |excursion|\n e...
[ "0.6748442", "0.6546701", "0.63549113", "0.6162604", "0.6039596", "0.60256654", "0.5946158", "0.5929014", "0.59220076", "0.5901812", "0.58832526", "0.58200175", "0.57957953", "0.5780098", "0.57524323", "0.57524323", "0.5746339", "0.5687618", "0.56817746", "0.56791365", "0.567...
0.0
-1
Tells if a free trial is defined in the price group
def has_free_trial? return (trial and trial.free?) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def trial?\n (plan_type == 'free_trial')\n end", "def free?\n cost == 0.0 || payment_not_required\n end", "def premium?\n \t! free?\n end", "def trial?\n price_is_zero = price_amount_micros == 0\n price_is_zero && payment_received?\n end", "def has_chosen_free_ite...
[ "0.7206481", "0.6949126", "0.6887819", "0.6801576", "0.67869574", "0.67436624", "0.6724147", "0.6675729", "0.6661419", "0.6626156", "0.6622098", "0.65532976", "0.65111524", "0.6496665", "0.6491064", "0.6484405", "0.6484405", "0.64556193", "0.6430888", "0.64216447", "0.6409723...
0.74790967
0
Method for accepts_nested_attributes_for :prices Tells if the price is valid regarding attributes passed Check if the price is valid by checking its valid? method
def reject_price attributes exists = attributes[:id].present? _price = Price.new(attributes.merge(price_group: self)) price_has_to_be_rejected = _price.has_to_be_rejected? || attributes[:delete_price].present? # Destroy if price exists and amount is nil attributes.merge!({:_destroy => 1}) if exists and price_has_to_be_rejected # Reject if price does't not exist yet and amount is nil return (!exists and price_has_to_be_rejected) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_attributes?\n true\n end", "def check_price\n return unless self.price.nil?\n if product && product.master_price\n self.price = product.master_price\n else\n errors.add_to_base(\"Must supply price for variant or master_price for product.\")\n return false\n ...
[ "0.6346616", "0.63246816", "0.6321266", "0.6204721", "0.6191313", "0.6106032", "0.6104835", "0.6088375", "0.60619634", "0.6026781", "0.60256666", "0.597858", "0.59772426", "0.5912503", "0.5895036", "0.5890304", "0.58326656", "0.58111614", "0.5795945", "0.5716297", "0.56999934...
0.6107574
5
def update card = AnswerCard.find(params[:id]) card.update(answer_card_params) render json: card end def destroy AnswerCard.find(params[:id]).destroy head :no_content end
def answer_card_params params.require(:answer_card).permit(:user_id, :answer_text, :question_card_id, :expiration_date) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n # @card = Card.find(params[:id])\n # @card.update(card_params)\n # render json: @card\n end", "def update\n @card = Card.find(params[:id])\n\n if @card.update(card_params)\n head :no_content\n else\n render json: @card.errors, status: :unprocessable_entity\...
[ "0.8172313", "0.8014409", "0.78973067", "0.7871751", "0.78175044", "0.766368", "0.7563084", "0.7562726", "0.7543309", "0.75148106", "0.75148106", "0.75148106", "0.75148106", "0.75148106", "0.75148106", "0.751174", "0.7504278", "0.7477327", "0.7468358", "0.7468358", "0.7468358...
0.0
-1
pascal implementation of euclid program euclid(input.output); var x.y: integer; function gcd(u.v: integer):integer; var t: integer; begin repeat if uy) and (y>0) then writeln(x,y.gcd(x.y)) end; end. 2.3 reduction of fraction to lowest terms recursively if u > v then gcd u,v == gcd v, uv
def gcd (v,u) if (u==v) return v elsif (u>v) u-=v gcd(v,u) else gcd(u,v) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gcd(p0) end", "def gcd(x, y) # finds greatest common factor of x,y\n while y != 0\n t = y\n y = x % y\n x = t\n end\n x\nend", "def gcd_ex(x, y)\n s1 = t0 = 0\n s0 = t1 = 1\n until y.zero?\n x, (q, y) = y, divmod(x, y)\n s0, s1 = s1...
[ "0.78156054", "0.7634887", "0.75282645", "0.7428897", "0.7423747", "0.7341764", "0.7283024", "0.7065813", "0.70368975", "0.70364934", "0.7034793", "0.6968274", "0.6870019", "0.6775002", "0.677368", "0.6773565", "0.67295843", "0.67229766", "0.6721197", "0.67091984", "0.6674868...
0.7412962
5
2.5 conversion from base ten to binary
def toBinary (x) if (x>1) toBinary(x/2) + (x%2).to_s elsif x==1 return x.to_s end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def base2to10(binary)\n\tresult = 0\n digits = binary.chars.reverse\n\n digits.each_with_index do |bit, idx|\n result += bit.to_i * (2**idx)\n end\n\n result\nend", "def to_binary(num)\n num_bin = ''\n current_power_of_2 = 1\n \n loop do\n num_bin.prepend ((num % (current_power_of_2 * 2))...
[ "0.7847013", "0.78076136", "0.77956134", "0.7770734", "0.7726147", "0.76939833", "0.7551123", "0.7544491", "0.7465557", "0.7461508", "0.74529403", "0.7439611", "0.74303555", "0.74026513", "0.7361329", "0.73552823", "0.7344205", "0.73306334", "0.73306334", "0.73259825", "0.725...
0.720507
21
2.8 gcd of three ints, calling 2.3
def gcd3 (v,u,w) if (u==v) return gcd(v,w) elsif (u>v) u-=v gcd(gcd(v,u),w) else gcd(gcd(u,v),w) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def gcd a,b\n if a<b\n gcd b,a\n elsif b==0\n a\n else\n gcd b,a%b\n end\nend", "def gcd(p0) end", "def gcd( a, b )\n return a if b.zero?\n gcd b, a % b\nend", "def gcd(a, b)\n if a % b == 0\n b\n else\n gcd(b, a % b)\n end\nend", "def gcd(a,b)\n if (b==0)\n a\n else\n gcd(b,a%...
[ "0.79757494", "0.79428476", "0.7741769", "0.7717525", "0.76527774", "0.76481843", "0.7642725", "0.76075107", "0.7520714", "0.751437", "0.75133854", "0.7512915", "0.74954647", "0.74920386", "0.74825287", "0.7471882", "0.7425406", "0.7421961", "0.7419071", "0.7407413", "0.74021...
0.7881803
2
sieve of eratosthenes page 16 for each i, a[i] true if prime for each i, setting array element corresponding to each multiple of i to false then loop through again, printing them out
def primes arr=Array.new arr[1]=false (2..1000).each {|i| arr[i]=true} (2..1000).each {|i| (i/2).floor (2..1000).each {|j| (j/i).floor arr[i*j] = false }} for i in 1..1000 if arr[i] == true puts i end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primeArray(number)\n @sieve = Array.new(number)\n \n for count in 2..Math.sqrt(number)\n next if @sieve[count]\n \n for inner_count in 2..number/count\n @sieve[count * inner_count] = true\n end\n end\n @sieve\nend", "def sieve_of_eratosthenes(max)\n list = Array.new(max + 1, true)\n l...
[ "0.7301977", "0.71271074", "0.707012", "0.70455533", "0.6976294", "0.69156003", "0.6885897", "0.6862523", "0.6739983", "0.6675054", "0.6634471", "0.6627764", "0.6622075", "0.66204506", "0.66199076", "0.6608538", "0.65779424", "0.6569534", "0.6550073", "0.6532301", "0.6477396"...
0.78390974
0
3.1 fill in 2d array of bools by setting a[i,j] to true if gcd i,j is 1 and false otherwise uses ruby's built in gcd function
def twoDArray(m,n) arr = Hash.new for m in 0..m for n in 0..n if m.gcd(n) == 1 arr[[m,n]] = true else arr[[m,n]] = false end end end for m in 0..m for n in 0..n if arr[[m,n]] == true puts "#{m} :m and #{n} :n" end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def iterate(arr)\n newArr = []\n (0...arr.size).each do |row|\n newArr[row] = []\n (0...arr.size).each do |col|\n num_neighbors = num_neighbors(row,col,arr)\n if arr[row][col]\n if num_neighbors == 2 || num_neighbors == 3\n newArr[row][col] = true\n else\n newArr[r...
[ "0.5793098", "0.5723635", "0.56556046", "0.5555622", "0.5550151", "0.54802334", "0.5469398", "0.5458594", "0.54552", "0.53868484", "0.53839964", "0.5356436", "0.5348506", "0.53313214", "0.53196746", "0.5301599", "0.5231826", "0.5228158", "0.5216013", "0.5214886", "0.5181425",...
0.60851043
0
3.4 solve the josephus problem with an array N people have decided to commit mass suicide by arranging themselves in a circle and killing the mth person around the circle, closing ranks as each person drops out of the circle. find out the order in which the people die
def josephus(n,m) arr = Array.new order = Array.new for i in 1..n arr[i] = i end arr.compact! for i in 0..n-1 arr= arr.rotate(m-1) order << arr[0] arr[0] = nil arr.compact! end puts "order: #{order.to_s}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def josephus_survivor(n,k)\n # (1..n) people are put into the circle\n items = (1..n).to_a\n Array.new(n){items.rotate!(k-1).shift}.last\nend", "def josephus_survivor(n,k)\n result = 1\n for i in 1...n + 1\n result = (result + k - 1) % i + 1\n end\n \n result\nend", "def josephus(n,m)\n\...
[ "0.66888964", "0.64809626", "0.62024534", "0.61218816", "0.6038506", "0.59638137", "0.59411454", "0.57927346", "0.5771708", "0.5732769", "0.5724178", "0.5691598", "0.5691496", "0.5671533", "0.56611985", "0.5651968", "0.56341136", "0.5632547", "0.55832565", "0.5575646", "0.554...
0.6649804
1
5.9 recursive Josephus implementation N people have decided to commit mass suicide by arranging themselves in a circle and killing the mth person around the circle, closing ranks as each person drops out of the circle. find out the order in which the people die
def josephus(n,m) while n.size>0 puts n.rotate!(m-1).shift(1) josephus(n,m) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def josephus_survivor(n,k)\n # (1..n) people are put into the circle\n items = (1..n).to_a\n Array.new(n){items.rotate!(k-1).shift}.last\nend", "def josephus(n,k)\n if(n == 1)\n return 0\n end\n\n (josephus(n-1, k) + k) % n\nend", "def josephus_survivor(n,k)\n result = 1\n for i in 1...n + 1\n ...
[ "0.6541671", "0.6340938", "0.6337015", "0.62028027", "0.6059637", "0.5977629", "0.5865469", "0.5836", "0.5833611", "0.580552", "0.5775551", "0.57754505", "0.5735182", "0.5722435", "0.5682892", "0.5675171", "0.5675109", "0.560567", "0.5578288", "0.5578102", "0.5573333", "0.5...
0.60070944
5
josephus([1,2,3,4,5,6,7,8,9],5) nonrecursive but still beautiful
def factorial(n) (1..n).inject(1) {|product, n| product * n } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def josephus(items,k)\n n = -1\n out = []\n while items.length > 0 do \n n = (n + k) % items.length \n out.push(items.slice!(n))\n n -= 1 \n end\n out\nend", "def josephus(items, k)\n result = []\n items.length.times do\n items.rotate!(k - 1)\n result << items.shift\n end\n result\nend", ...
[ "0.7068945", "0.68216574", "0.68065155", "0.67286474", "0.6677804", "0.6672863", "0.65613306", "0.64280576", "0.642564", "0.6402558", "0.6165049", "0.61328155", "0.60580647", "0.60088444", "0.59595394", "0.59188026", "0.59186095", "0.5899984", "0.58468854", "0.5791485", "0.57...
0.0
-1
because it makes no sense to make a recursive fibonacci call ...
def nonRecursiveFibonacci(n) a=Array.new a[0] = a[1] = 1 for i in 2..n a[i]=a[i-1] + a[i-2] end return a[n] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fibonacci (num)\n if num < 0\n puts \"error: cannot calcuate fibonacci of a negative number\"\n return 0\n elsif num == 0\n return 0\n elsif num == 1\n return 1\n end\n fibonacci(num - 1) + fibonacci(num - 2)\nend", "def fibonacci(n)\r\n if n == 0\r\n return 0\r\n elsif n == 1\r...
[ "0.8371596", "0.83181506", "0.82866067", "0.82221943", "0.8220371", "0.8213923", "0.82010597", "0.8175801", "0.816849", "0.8154221", "0.81525403", "0.81516314", "0.8147122", "0.8139514", "0.8139414", "0.8138696", "0.8132659", "0.81302536", "0.8127112", "0.8115452", "0.8113245...
0.0
-1
input = gets.chomp.strip do puts display_board
def valid_move? (board, index) if index.between?(0, 8) && !position_taken?(board, index) true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play(board)\n input = gets.strip\nend", "def input_board\r\n print \"Enter your board with no spaces (ex: CUTERUBYCUBEKOAN): \"\r\n line = gets.chomp\r\n if line.length != 16 then\r\n puts \"You input the board incorrectly.\"\r\n return\r\n end\r\n @board = line.to_s\r\n to_s\r\nend", "def inp...
[ "0.82752734", "0.7910965", "0.7334006", "0.7257549", "0.72522396", "0.72522396", "0.7227485", "0.7184913", "0.7141396", "0.71309173", "0.71083325", "0.7103268", "0.70772344", "0.70543283", "0.70354396", "0.7000058", "0.69922227", "0.6984464", "0.6982877", "0.6980854", "0.6975...
0.0
-1
turn(board,index) move(array,index,value = "X") display_board(board) else turn(board) end get input convert input to index if index is valid make the move for input else ask for input again until you get a valid input end
def position_taken?(board,index) foo = nil if (board[index] == "" || board[index] == " " || board[index] == nil) foo = false else foo = true end foo end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def turn(board)\n puts \"Please enter 1-9:\"\n input = gets.strip\n index = input_to_index(input)\n if valid_move?(board, index) == true\n move(board, index, token = \"X\")\n display_board(board)\n else\n turn(board)\n end\nend", "def turn (board)\n#Ask the user to tell you where they want to move...
[ "0.86453575", "0.86306924", "0.86284745", "0.8608867", "0.86050963", "0.8595847", "0.85849005", "0.8576422", "0.8570284", "0.85622907", "0.8533654", "0.8533654", "0.8528928", "0.8526603", "0.852346", "0.85180306", "0.8517789", "0.85125995", "0.85089785", "0.84984756", "0.8498...
0.0
-1
Return full path of requireable file given relative path.
def find_requireable_file(file) root = full_gem_path require_paths.each do |lib| base = File.join(root, lib, file) Gem.suffixes.each do |suf| path = "#{base}#{suf}" return path if File.file? path end end return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_relative_path(path)\n Util::path_rel_to_path(path, recipe_file.path).to_s\n end", "def require_path\n val = require_paths and val.first\n end", "def relative_path\n must_be File\n Pathname.new(self.full_path).relative_path_from(Pathname.new(Dir.pwd)).to_s\n end", "def require_relat...
[ "0.74855363", "0.74143714", "0.73208064", "0.7261118", "0.70347613", "0.6940703", "0.6902004", "0.6872478", "0.6856985", "0.68353003", "0.6803622", "0.6762107", "0.6758233", "0.674405", "0.6741542", "0.67345953", "0.6726295", "0.669072", "0.66726506", "0.6664007", "0.6629192"...
0.7173465
4
return the next line of the file that contains content, "EOF" if finished
def next lines.shift end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nextline\n # handle last file\n\n if @curr.nil?\n @curr=File.open @files.next rescue nil\n end\n\n return if @curr.nil? # Still Nil?\n\n # handle EOF\n if (line = @curr.gets).nil?\n @curr=nil\n ...
[ "0.7868099", "0.7150931", "0.682799", "0.681046", "0.68097353", "0.6637963", "0.65654916", "0.65270114", "0.6520292", "0.64652425", "0.6426724", "0.6370842", "0.63353896", "0.631827", "0.6264957", "0.6264957", "0.6264957", "0.6236848", "0.62321657", "0.62224424", "0.62224424"...
0.67533886
5
load the lines from the file, remove comments, blank lines, whitespace, set the ivar
def load_lines file lines = Array.new lines = @file.split("\n") #fuck that, i dont like the dyanmic feed, just pre-parse it lines.map! do |line| #map overwrites the old array if line.include? '#' split = line.split '#' #puts split.to_s split.shift else line end end #removing blank lines lines.delete_if do |line| true if line.empty? end lines.each { |line| line.chomp! } lines end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def load\n @lines.select! do |line|\n line.strip.length != 0\n end.select! do |line|\n line[0] != '#'\n end.map! do |line|\n line.split(\" \")\n end\n\n self\n end", "def load_data\n self.open if @io.nil?\n @lines = @io.readlines\n ...
[ "0.764171", "0.6941673", "0.6830841", "0.6649386", "0.65957516", "0.6537128", "0.6452292", "0.6394172", "0.63447845", "0.6273264", "0.6243285", "0.62396884", "0.62376386", "0.6186814", "0.6100277", "0.6082232", "0.6042146", "0.6033296", "0.5975077", "0.5934803", "0.5925693", ...
0.6953415
1
primary access control point: returns all tenant permissions for user currently not used as user will only have one tenant with current implementation
def current_tenant_permissions if current_or_guest_user current_or_guest_user.tenant_ids else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def primary_tenant_permission\n if current_or_guest_user\n current_or_guest_user.tenant_ids.first\n else\n nil\n end\n end", "def permission_grants\n return @permission_grants\n end", "def quota_view_only\n return Quotum.none if @force_empty\n if @user.presen...
[ "0.678953", "0.6761816", "0.67237586", "0.665139", "0.6650796", "0.65495807", "0.64620364", "0.64181876", "0.63737065", "0.63718957", "0.6366822", "0.6157869", "0.6147857", "0.6081552", "0.607618", "0.60743785", "0.60458297", "0.6045226", "0.6023286", "0.601517", "0.59624994"...
0.78868496
0
returns primary (base) tenant permission for user
def primary_tenant_permission if current_or_guest_user current_or_guest_user.tenant_ids.first else nil end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def current_tenant_permissions\n if current_or_guest_user\n current_or_guest_user.tenant_ids\n else\n nil\n end\n end", "def current_tenant\n Tenant.find_by_domain! current_user.email_domain\n end", "def current_tenant\n MultiTenant.current_tenant\n end", "def curr...
[ "0.73966545", "0.6493027", "0.64182276", "0.6390949", "0.6390949", "0.6390949", "0.6390889", "0.638754", "0.6242775", "0.6242775", "0.6242775", "0.6242775", "0.61415726", "0.6112098", "0.6027526", "0.59923315", "0.5970421", "0.59339327", "0.5917308", "0.589589", "0.58301973",...
0.8528185
0
Use callbacks to share common setup or constraints between actions.
def set_collection @collection = current_user.collections.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
Only allow a trusted parameter "white list" through.
def collection_params params.require(:collection).permit(:name, :user_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
Parses the given stream and returns a node tree
def load(stream, root_class = nil) root_class ||= PrisonParser::Node line_num = 0 nodes = [] @tokens = [] current_node = root_class.new while !stream.eof? do line = stream.readline.strip line_num += 1 tokenize(line) next if tokens.size == 0 # start a new node if "BEGIN" == tokens[0] nodes.push(current_node) label = tokens[1] current_node = current_node.create_node(label) if tokens.size > 2 # inline node if tokens.size % 2 != 1 raise UnevenTokenError.new("Unexpected number of tokens in an inline node definition on line #{line_num}") end unless "END" == tokens[tokens.size - 1] raise UnexpectedEndOfLineError.new("Unexpected end of inline node definition on line #{line_num}") end # Don't iterate the 'BEGIN', label, 'END' tokens[2..-2].each_slice(2) do |parts| current_node.add_property(parts[0], parts[1]) end upper_node = nodes.pop upper_node.finished_reading_node(current_node) current_node = upper_node else current_node.prevent_inlining! end elsif "END" == tokens[0] # end of multi-line section upper_node = nodes.pop upper_node.finished_reading_node(current_node) current_node = upper_node else # inside a multi-line section current_node.add_property(tokens[0], tokens[1]) end end if nodes.size != 0 raise UnexpectedEndOfFileError.new("Unexpected end of file!") end current_node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse(stream, encoding=nil)\n _parse(stream, false, encoding)\n @tree.get_document\n end", "def decode( inputstream)\n #Helper method on inputstream to read single bits\n class << inputstream\n def init\n @byte = 0\n @bit_count = 0\n end\n def rea...
[ "0.7480541", "0.63556576", "0.63311917", "0.6061552", "0.6050684", "0.5991325", "0.5863618", "0.582962", "0.5777376", "0.5757155", "0.5756618", "0.56822157", "0.5677197", "0.56628925", "0.5604052", "0.5592924", "0.5585131", "0.55820906", "0.5558012", "0.55352855", "0.5532359"...
0.6902235
1
Splits a line into a series of tokens
def tokenize(line) tokens.clear return if line.size == 0 line = line.tr("\t", ' ') token_start = 0 i = 0 chars = line.chars while i < line.size do c = chars[i] if c == ' ' # eat the spaces! if token_start != i tokens << line[token_start, i - token_start] end token_start = i + 1 elsif c == '"' # skip ahead to the next quote end_quotes = line.index('"', i + 1) raise UnmatchedQuoteError.new("Unmatched quote on '#{line}'") if end_quotes.nil? tokens << line[i + 1, end_quotes - i - 1] i = end_quotes token_start = i + 1 else # skip ahead to the next space next_space = line.index(' ', i) || -1 i = next_space - 1 break if i < 0 end i += 1 end if token_start < line.size # append the remainder of the string, after we ran out of spaces tokens << line[token_start, line.size - token_start] end return tokens end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def tokenize_line(line)\n # Adding spaces around parens to make tokenization trivial.\n line = line.gsub(/\\(/, ' ( ')\n line = line.gsub(/\\)/, ' ) ')\n line.split\n end", "def process_line(line)\n line.split ' '\n end", "def split_line(line)\n tmpLine = line.clone\n chu...
[ "0.7667002", "0.6967882", "0.69489825", "0.69461644", "0.6883082", "0.6859", "0.67830473", "0.67783755", "0.6654122", "0.6650294", "0.65709895", "0.6522022", "0.6449775", "0.6416128", "0.64105785", "0.6357944", "0.62834084", "0.62682664", "0.62504345", "0.62504345", "0.618787...
0.6803158
6
Creates a new resource instance, resource should be specified by its name or identifier.
def get_resource(resource_type) Occi::Log.debug("Instantiating #{resource_type} ...") if @model.get_by_id resource_type # we got a resource type identifier Occi::Core::Resource.new resource_type elsif @model.kinds.select { |kind| kind.term == resource_type }.any? # we got a resource type name Occi::Core::Resource.new @model.kinds.select { |kind| kind.term == resource_type }.first.type_identifier else raise "Unknown resource type! [#{resource_type}]" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_resource(_params)\n resource_class.new(resource_params)\n end", "def create(resource, options = {}, format = nil)\n base_create(resource, options, format)\n end", "def create(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def create_resource\n ...
[ "0.8225565", "0.74735874", "0.74709904", "0.7435916", "0.73996377", "0.736391", "0.7345037", "0.7329278", "0.7280913", "0.7243268", "0.72429705", "0.72133404", "0.7175528", "0.71637857", "0.71165985", "0.70752156", "0.7043156", "0.70320654", "0.7031223", "0.69984424", "0.6984...
0.0
-1
Retrieves all entity type identifiers related to a given type identifier
def get_entity_types_related_to(type_identifier) Occi::Log.debug("Getting entity type identifiers related to #{type_identifier}") collection = @model.get type_identifier collection.kinds.collect { |kind| kind.type_identifier } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity_type_identifiers\n get_entity_types_related_to Occi::Core::Entity.kind.type_identifier\n end", "def get_entity_type_identifiers\n get_kind_type_identifiers_related_to Occi::Core::Entity.kind.type_identifier\n end", "def get_resource_type_identifiers\n get_ent...
[ "0.7796788", "0.74293005", "0.69550896", "0.68346107", "0.6783869", "0.67296726", "0.67119765", "0.6372826", "0.6372268", "0.6317861", "0.6317861", "0.6285354", "0.62398446", "0.6012297", "0.5992851", "0.59634304", "0.5936028", "0.5860965", "0.5858274", "0.57935256", "0.57421...
0.8358175
0
Retrieves all available entity types.
def get_entity_types Occi::Log.debug("Getting entity types ...") @model.kinds.collect { |kind| kind.term } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity_types\n get_types(Occi::Core::Entity.kind)\n end", "def entity_types\n @entity_types ||= metadata.xpath('//EntityType').collect {|entity| entity.attributes['Name'].value}\n end", "def index\n @entity_types = EntityType.all\n end", "def list(type)\n get(resource_path_...
[ "0.82866675", "0.7752563", "0.75918645", "0.7248464", "0.7244958", "0.7227515", "0.72221315", "0.72221315", "0.7029091", "0.7029091", "0.6950121", "0.68591714", "0.6712268", "0.6696491", "0.6655576", "0.6602504", "0.6525311", "0.64333314", "0.6367737", "0.63387257", "0.627506...
0.82484925
1