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
file_info_hash methods are here.
def stanza_stats(file_info_hash: fih) stanza1_stats = Hash.new stanza2_stats = Hash.new stanza3_stats = Hash.new # @file_info[0..5].each { |f| # @file_info.each { |f| @fih.each { |f| # you can call extract_keywords here instead of duplicating this code. # actually ..not true, since ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n raise NotImplementedError.new(\"hash() must be implemented by subclasses of AbstractVersionedFile.\")\n end", "def hash\n return (path + file_id.to_s).hash\n end", "def file_hash\n return @file_hash\n end", "def compare_hashes_handler(hash_, fi...
[ "0.71057373", "0.7047873", "0.6956136", "0.68918025", "0.6875895", "0.68261737", "0.6495743", "0.6485983", "0.6462305", "0.6440361", "0.64291036", "0.6427911", "0.63979876", "0.6382787", "0.63619494", "0.63579756", "0.63532186", "0.63496906", "0.63496906", "0.62566644", "0.62...
0.0
-1
=begin def initialize(user, controller_namespace) case controller_namespace when 'Admin' can :manage, :all if user.has_role? 'admin' else rules for nonadmin controllers here end end =end
def initialize(user, controller_namespace) # Define abilities for the passed in user here. For example: # # user ||= User.new # guest user (not logged in) # if user.admin? # can :manage, :all # else # can :read, :all # end # # The first argument to `can` is the ac...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(user, controller_namespace, current_site = Site.current)\n if controller_namespace == 'Cdx::Admin'\n\n end\n end", "def initialize(user)\n # Admins can do everything\n if user.has_role? :admin\n can :manage, :all\n elsif user.has_role? :user\n can :manage, :all\n ...
[ "0.79123807", "0.71626484", "0.7116319", "0.7098158", "0.69897497", "0.6988261", "0.69138", "0.69101185", "0.6888179", "0.6878331", "0.6863645", "0.6856001", "0.68341005", "0.6822137", "0.6815622", "0.679604", "0.6787655", "0.67858386", "0.6783499", "0.67776465", "0.6757718",...
0.8379109
0
these MUST match keys in the questions block above
def headings # NOTE: "Comments" is shared between both sets if self.new_review_format ["Role Competence","Consulting Skills","Teamwork", "Contributions", "Comments"] else ["Tech","Client", "Ownership", "Leadership", "OldTeamwork", "Attitude", "Professionalism", "Organizational", "Innovative", "C...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def similar_questions\n\n end", "def questions\n \n end", "def setup_short_answer_questions(questions)\n questions[35..50].each do |questions_in_a_lesson|\n @unique_questions << questions_in_a_lesson.find_all{|question| question.question_type == 'short_answer'}[rand(2)]\n end\n end", ...
[ "0.65681195", "0.63199127", "0.6261108", "0.6203672", "0.6110406", "0.6060151", "0.6049991", "0.60430306", "0.60402095", "0.6011811", "0.59743947", "0.5964142", "0.59230214", "0.58979464", "0.587569", "0.58720773", "0.5821573", "0.5786208", "0.5771877", "0.57662636", "0.57458...
0.0
-1
========================== get between two time
def betweenTime page = params[:page] || 1 per = params[:per] || 10 if params[:start_time] and params[:end_time] surprise = @current_user.event.where(event_type: "surprise").where(date: params[:start_time]..params[:end_time]).page(page).per(per) render :json => { :event => surprise.as_json(:e...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_between(start_point, end_point)\n return 0 unless start_point.time && end_point.time\n end_point.time - start_point.time\n end", "def time_range\n start_time..end_time\n end", "def time_between?(time, from, to)\n time >= from && time <= to\n end", "def between?(t...
[ "0.72901785", "0.7126639", "0.7012188", "0.6660102", "0.6649244", "0.66286397", "0.6499885", "0.6405105", "0.64045465", "0.6399702", "0.6371346", "0.63616467", "0.63439184", "0.6333037", "0.631914", "0.6314796", "0.6283164", "0.62718916", "0.6251941", "0.6242401", "0.6242401"...
0.60041267
33
========================== get today surprise
def getToday page = params[:page] || 1 per = params[:per] || 10 surprise = @current_user.event.where(event_type: "surprise").where(date: Time.now.strftime('%F')).page(page).per(per) if surprise render :json => { :event => surprise.as_json(:except => [:created_at , :updated_at] , include: {surp...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def visit_today\n # TODO: the impossible - know the first date of visit with provider\n # {Is your visit today/{Was your visit on {DATE OF VISIT}}\n \"Is your visit today\"\n end", "def best_day\n\n end", "def get_date_scraped\n return Date.today.to_s\nend", "def get_date_scraped\n retur...
[ "0.6249886", "0.6134666", "0.61342967", "0.61342967", "0.6113873", "0.6090932", "0.6090932", "0.6045364", "0.59503174", "0.5866819", "0.58533555", "0.5821069", "0.5790416", "0.57614374", "0.57562417", "0.57517093", "0.573725", "0.56824183", "0.56708896", "0.56282496", "0.5600...
0.5369355
43
add money to the meter
def pay(payment) @total_paid += payment "You fed $#{payment} to the meter." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_money(value)\n @calculator.add_money value\n end", "def add_money\n @total += fee\n end", "def add_money_to_till(amount)\n @till += amount\nend", "def add(cash)\n @current_balance = @current_balance + cash\n end", "def add_amount(amount)\n @balance += amount\n end", "def se...
[ "0.7893994", "0.7695742", "0.7188582", "0.71868926", "0.7172836", "0.71415263", "0.7120608", "0.7011574", "0.70086336", "0.6917259", "0.6836981", "0.6826386", "0.68215257", "0.6812979", "0.67918074", "0.67894804", "0.6779121", "0.6766068", "0.6728319", "0.6694985", "0.6653395...
0.6174636
71
The parking space costs $1 for 60 min Return the number of minutes remaining
def minutes_remaining time_elapsed = (Time.new - @start_time) / 60 (@total_paid * 60 - time_elapsed).floor end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_minutes()\n current_time = Time.now\n start_time = Delay.find_newest_travel_time(stop_position.bus.id, current_time)\n predicted_time = start_time + minutes_delayed * 60\n return predicted_time - current_time\n end", "def work_needed(project_minutes, freelances)\n freelance_hours = 0\...
[ "0.68280077", "0.6734442", "0.6639665", "0.65380913", "0.6499671", "0.6469159", "0.6465067", "0.64584297", "0.6420415", "0.635506", "0.6314928", "0.629099", "0.62149286", "0.6201126", "0.6191967", "0.6181426", "0.6176524", "0.6164347", "0.6152461", "0.6136029", "0.6119903", ...
0.7383579
0
Check how much time is left on the meter
def check_meter puts "You have #{minutes_remaining} minutes remaining." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def time_left\n return 0.0 if free?\n return end_time - Time.now.to_f\n end", "def remaining_time()\n return @total_time_units - @done_time_units\n end", "def time_remaining\n end", "def time_remaining\n\n end", "def time_left\n @lifetime - @elapsed_time\n end", "def charged?\n...
[ "0.6917557", "0.6796963", "0.6745634", "0.66868687", "0.659418", "0.65673167", "0.6555565", "0.6508321", "0.6432355", "0.64019346", "0.63912463", "0.630435", "0.6289169", "0.62739736", "0.6250038", "0.62304914", "0.6220896", "0.6220717", "0.62179905", "0.6205312", "0.6166341"...
0.73730874
0
The meter maid checks if you have overstayed your meter If so, he / she writes a ticket The fine is 3x the number of minutes overstayed
def meter_maid_check if minutes_remaining < 0 fine = minutes_remaining * -3 "Bummer! You got a $#{fine} ticket." else 'The meter maid came and went.' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_meter\n puts \"You have #{minutes_remaining} minutes remaining.\"\n end", "def tired\t\r\n\tif $hours_asleep >= 8 then\r\n\t $hours_asleep = 0\r\n \t\treturn false\r\n \telse\r\n \t\t$hours_asleep += 1\r\n \t\treturn true\r\n \tend \t\t\r\nend", "def need_tock?\n if @second == 60\n @se...
[ "0.70104426", "0.657713", "0.6550462", "0.6515725", "0.6458331", "0.6406431", "0.63444376", "0.62779564", "0.62479883", "0.62239784", "0.62163687", "0.6188541", "0.6158583", "0.61474794", "0.61179215", "0.60869986", "0.6066026", "0.60631186", "0.60572314", "0.6024961", "0.601...
0.7837153
0
Create a temporary directory. This directory will exist for the life of the spec. id Identifier of the tmpdir (default: the default identifier). Returns a String.
def tmpdir(id=:default) @tmpdirs[id] ||= Dir.mktmpdir end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tmp_dir\n if(!File.directory? @temp_dir)\n Dir.mkdir(@temp_dir)\n end\n end", "def tempdir_name\n dir = File.join(Dir.tmpdir, SecureRandom.uuid)\n refute(Dir.exists?(dir))\n dir\n end", "def temp_dir\n name = 'tmp_' + rand.to_s.gsub(/\\D/, '')\n File.join(@temp_root...
[ "0.7154842", "0.7040018", "0.69932234", "0.68765", "0.6791887", "0.6772081", "0.66701984", "0.6649007", "0.65324557", "0.6475622", "0.6449118", "0.64315623", "0.6381197", "0.634251", "0.62738216", "0.625824", "0.62523896", "0.6212146", "0.62037164", "0.61762416", "0.61282396"...
0.7977997
0
Get the name of the test database. Returns a String.
def database_name "mysql_inspector_test" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n db_name = URI.parse(uri(self)).path.to_s.sub(\"/\", \"\")\n db_name.blank? ? database : db_name\n end", "def database_name\n __evaluate__(storage_options[:database])\n end", "def name\n @db_name\n end", "def database_name\n @database_name\n en...
[ "0.78354806", "0.7595039", "0.75584483", "0.75390947", "0.7415172", "0.7414389", "0.73725235", "0.73725235", "0.73640734", "0.7332413", "0.7322144", "0.7220553", "0.7143773", "0.7122749", "0.7022227", "0.69908965", "0.6753571", "0.6687802", "0.6668021", "0.6656109", "0.661077...
0.7034115
14
Create a test mysql database. The database will exist for the life of the spec. schema String schema to create (default: no schema). Returns nothing.
def create_mysql_database(schema="") @mysql_database = true MysqlUtils.create_mysql_database(database_name, schema) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_schema(schema)\n execute \"CREATE SCHEMA #{schema}\", 'Create Schema'\n end", "def create_database(name, _options = {})\n execute(\"CREATE SCHEMA `#{name}`\")\n end", "def create_schema schema_name\n execute \"CREATE SCHEMA #{quote_schema_name(schema_name)}\"\n end", ...
[ "0.715834", "0.7048721", "0.6969312", "0.6926661", "0.67939657", "0.66716486", "0.66586065", "0.6597792", "0.6526254", "0.64370316", "0.6311838", "0.62994087", "0.6228925", "0.6178383", "0.6177091", "0.6171182", "0.6155257", "0.60881907", "0.6086355", "0.60843176", "0.6049144...
0.81856865
0
Drop the test mysql database. Returns nothing.
def drop_mysql_database MysqlUtils.drop_mysql_database(database_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def drop_test_database!\n raise \"not a test database!!! database name must end in `_test`\" unless @database =~ /_test$/\n connection.drop_database(@database)\n end", "def drop_database\n puts \"Droping database #{@db_name}...\"\n begin\n client = Mysql2::Client.new(:host => ...
[ "0.82918644", "0.78351074", "0.7538086", "0.7464493", "0.7345335", "0.72736347", "0.7204516", "0.7178806", "0.7159141", "0.7156561", "0.7113994", "0.7089913", "0.7068077", "0.7064024", "0.69974697", "0.69722", "0.69646084", "0.69170606", "0.69170606", "0.6893772", "0.6869102"...
0.8041227
1
Get access to the mysql database. Returns a MysqlInspector:Access.
def access (@access ||= {})[database_name] ||= MysqlInspector::Access.new(database_name, "root", nil, "mysql") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def access\n MysqlInspector::AR::Access.new(ActiveRecord::Base.connection)\n end", "def database\n @database ? @database : Database::ADMIN\n end", "def getAccessInfo()\n @accessInfo\n end", "def mysql\n return @db if @db\n @db = Sequel.connect(\n :adapter => ...
[ "0.7638009", "0.5275938", "0.5164654", "0.5116704", "0.509536", "0.50511354", "0.49830124", "0.4918798", "0.4874201", "0.48536244", "0.48227984", "0.48138383", "0.480155", "0.47926462", "0.47898534", "0.47898534", "0.4768631", "0.47373486", "0.47318134", "0.47289953", "0.4724...
0.7805547
0
This cannot be run in parallel because it either stubs a constant or operates in a nonexclusive namespace
def test_deploying_to_protected_namespace_with_override_does_not_prune assert_deploy_success(deploy_fixtures("hello-cloud", subset: ['configmap-data.yml', 'disruption-budgets.yml'], protected_namespaces: [@namespace], prune: false)) hello_cloud = FixtureSetAssertions::HelloCloud.new(@namespace) hello_...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def constant; end", "def shareable_constant_value; end", "def shareable_constant_value; end", "def constants() end", "def intern() end", "def shareable_constant_value_specified?; end", "def parallelize_me!; end", "def included_constants; end", "def set_const\n <<-CODE\n next_literal;\n t1 ...
[ "0.62523764", "0.62311083", "0.62311083", "0.5982131", "0.5962649", "0.59527904", "0.5742722", "0.5739555", "0.57214105", "0.5689558", "0.56391513", "0.562219", "0.5622068", "0.5617454", "0.5611848", "0.5611848", "0.5590842", "0.55821043", "0.557745", "0.5545651", "0.54931456...
0.0
-1
This cannot be run in parallel because it needs to manipulate the global log level
def test_create_secrets_from_ejson logger.level = ::Logger::DEBUG # for assertions that we don't log secret data # Create secrets ejson_cloud = FixtureSetAssertions::EjsonCloud.new(@namespace) ejson_cloud.create_ejson_keys_secret assert_deploy_success(deploy_fixtures("ejson-cloud")) ejson_cloud...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_level=(level); end", "def log_level; end", "def log_level; end", "def log_level=(_arg0); end", "def log_level=(_arg0); end", "def check_global();puts $log_level;end", "def logger_level; end", "def ruby_test_logging_functions\n log(\"Log 1\")\n log2(message: \"Log 2\")\n log2(message:...
[ "0.7259461", "0.7229308", "0.7229308", "0.7224663", "0.7224663", "0.70379096", "0.681026", "0.67557883", "0.6735406", "0.6735406", "0.6682054", "0.6581286", "0.6581286", "0.6537335", "0.65252817", "0.6512795", "0.6512795", "0.6511672", "0.64633566", "0.64463323", "0.64463323"...
0.0
-1
This can be run in parallel if we allow passing the config file path to DeployTask.new See
def test_unreachable_context old_config = ENV['KUBECONFIG'] begin ENV['KUBECONFIG'] = File.join(__dir__, '../fixtures/kube-config/dummy_config.yml') kubectl_instance = build_kubectl(timeout: '0.1s') result = deploy_fixtures('hello-cloud', kubectl_instance: kubectl_instance) assert_deploy...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deploy_config_files(path, config_files = Rake::FileList.new(\"#{@base}/*.yml\"))\n config_files.each do |config_file|\n config_file_path = File.join(path, File.basename(config_file))\n @logger.info \"Deploying #{config_file} to #{config_file_path}\"\n cp config_file, config_file_path,...
[ "0.6608656", "0.6519944", "0.62596685", "0.6238272", "0.6233849", "0.6220675", "0.61226064", "0.6112781", "0.60607666", "0.605867", "0.60568625", "0.60371566", "0.60364413", "0.59879607", "0.59472215", "0.59453386", "0.5942658", "0.5935939", "0.5913919", "0.5913919", "0.59044...
0.0
-1
We want to be sure that failures to apply resources with potentially sensitive output don't leak any content. Currently our only sensitive resource is `Secret`, but we cannot reproduce a failure scenario where the kubectl output contains the filename (which would trigger some extra logging). This test stubs `Deployment...
def test_apply_failure_with_sensitive_resources_hides_template_content logger.level = 0 Krane::Deployment.any_instance.expects(:sensitive_template_content?).returns(true).at_least_once result = deploy_fixtures("hello-cloud", subset: ["web.yml.erb"], render_erb: true) do |fixtures| bad_port_name = "htt...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_multiple_invalid_k8s_specs_fails_on_apply_and_prints_template\n result = deploy_fixtures(\"hello-cloud\", subset: [\"web.yml.erb\"], render_erb: true) do |fixtures|\n bad_port_name = \"http_test_is_really_long_and_invalid_chars\"\n svc = fixtures[\"web.yml.erb\"][\"Service\"].first\n svc...
[ "0.5855069", "0.55794597", "0.545272", "0.5358275", "0.5343888", "0.5257648", "0.5172774", "0.5155489", "0.5128175", "0.5109771", "0.51044446", "0.50995773", "0.5088237", "0.5084933", "0.5077021", "0.5025295", "0.50248855", "0.49890634", "0.4988644", "0.498627", "0.49761435",...
0.73774254
0
test_global_deploy_black_box_failure is in test/integration/krane_test.rb because it does not modify global state. The following two tests modify global state and must be run in serially
def test_global_deploy_black_box_success setup_template_dir("globals") do |target_dir| flags = "-f #{target_dir} --selector app=krane" out, err, status = krane_black_box("global-deploy", "#{KubeclientHelper::TEST_CONTEXT} #{flags}") assert_empty(out) assert_match("Success", err) assert...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_global_deploy_black_box_failure\n setup_template_dir(\"resource-quota\") do |target_dir|\n flags = \"-f #{target_dir} --selector app=krane\"\n out, err, status = krane_black_box(\"global-deploy\", \"#{KubeclientHelper::TEST_CONTEXT} #{flags}\")\n assert_empty(out)\n assert_match(\"F...
[ "0.81095695", "0.6185367", "0.6140908", "0.6089369", "0.6015526", "0.5855507", "0.5805", "0.57967025", "0.577575", "0.57643765", "0.5755667", "0.57225794", "0.56866425", "0.56408805", "0.56257236", "0.5595733", "0.55872965", "0.5583549", "0.5565626", "0.55561435", "0.55486935...
0.7803769
1
Note: These tests assume a default storage class with a dynamic provisioner and 'Immediate' bind
def test_pvc pvname = "local0001" storage_class_name = "k8s-deploy-test" assert_deploy_success(deploy_global_fixtures_non_namespaced("pvc", subset: ["wait_for_first_consumer_storage_class.yml"])) TestProvisioner.prepare_pv(pvname, storage_class_name: storage_class_name) assert_deploy_success...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def storage_instance; end", "def storage_instance=(_arg0); end", "def determine_storage(opts)\n\n if ARGV.include?('--help')\n puts %{\n\nARGUMENTS for functional tests :\n\n --fs : uses Ruote::FsStorage\n\nelse uses the in-memory Ruote::Engine (fastest, but no persistence at all)\n\n }\n exit 0\n ...
[ "0.65233326", "0.61812794", "0.61750984", "0.6154205", "0.60571074", "0.6031288", "0.6009914", "0.5987344", "0.59370285", "0.5908682", "0.58916116", "0.58697134", "0.57020485", "0.5654213", "0.56326354", "0.5588031", "0.55215263", "0.55191433", "0.55151665", "0.54979014", "0....
0.0
-1
Defined just to meet Selfie::Formatter registration requirements below
def stop(n) super if defined?(super) # For forward compatibility :) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def formatter\n raise NotImplementedError\n end", "def formatter; end", "def formatter; end", "def formatter; end", "def formatters; end", "def formats; end", "def formats; end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter=(_arg0); end", "def formatter\n ...
[ "0.81067026", "0.80842006", "0.80842006", "0.80842006", "0.7788131", "0.7474626", "0.7474626", "0.7384355", "0.7384355", "0.7384355", "0.72367644", "0.7166353", "0.716044", "0.716044", "0.716044", "0.716044", "0.716044", "0.716044", "0.716044", "0.716044", "0.71359074", "0....
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_ptype @ptype = Ptype.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 ptype_params params.require(:ptype).permit(:name, :plural, :schedule_type, :opening, :closing) 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
only allows getter function attr_reader :username every time you create a new User class this method runs and sets all of the values
def initialize(first_name, last_name, username, email) @first_name = first_name @last_name = last_name @email = email @username = username end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username=(user) #method name is username= and it takes on the user parameter and sets it equals to the username variable \n @username = user\n end", "def username #for each attribute of a class you have two methods a reader and a writer method (same as a gettter and setter methods)\n return @username...
[ "0.7484791", "0.709738", "0.70876336", "0.70594996", "0.70053667", "0.7002139", "0.69805956", "0.69510293", "0.69361556", "0.6832513", "0.6785975", "0.6756845", "0.6756845", "0.6724278", "0.67046976", "0.6671224", "0.666556", "0.66418684", "0.66331404", "0.6630826", "0.662775...
0.0
-1
attr_accessor does the following for whatever is defined setter method, changing the username def set_username=(name)
def to_s "First name: #{first_name}, Last name: #{last_name}, Username: #{@username}, Email: #{email}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def username=(new_name)\n @username = new_name.upcase\n end", "def username=(user) #method name is username= and it takes on the user parameter and sets it equals to the username variable \n @username = user\n end", "def username=(new_username)\n @username = new_username\n end", "def user_...
[ "0.83534986", "0.8220897", "0.8209042", "0.81501985", "0.80691004", "0.80691004", "0.80290675", "0.79550403", "0.79550403", "0.79167813", "0.7829726", "0.7786177", "0.7744147", "0.772196", "0.76865965", "0.7649549", "0.76028895", "0.7557624", "0.74534273", "0.73584515", "0.73...
0.0
-1
Call the method directors_database to retrieve the NDS
def pretty_print_nds(nds) pp nds end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @dns = Dn.all\n end", "def db_ddns_access(data={})\n return nil if data.empty? || (!data.has_key?(:id) && !data.has_key?(:device_id) && !data.has_key?(:ip_address) && !data.has_key?(:full_domain))\n \n where_data = data.clone\n\n if data.has_key?(:full_domain) then\n full_domain ...
[ "0.5962282", "0.5917655", "0.573061", "0.573061", "0.5696976", "0.5647392", "0.5623889", "0.56018966", "0.5586423", "0.55815876", "0.55814934", "0.5535011", "0.5483551", "0.54736954", "0.5452035", "0.5441273", "0.5437387", "0.5412612", "0.5402453", "0.5402453", "0.5395019", ...
0.0
-1
Attempts to return parameter Search string if available. If search String not available, then return IP address Zip Code. If IP Zip Code not available, then just return St.Louis zip code.
def getSearchString(searchString) return params[:search] if (params[:search].present?) @IP_ZipCode = request.location.postal_code return @IP_ZipCode if (@IP_ZipCode.present?) return "63101" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def postal_code_search(_zip, _city, _country, or_search)\n unless or_search\n Rails.logger.debug \"\\t1) Determine longitude/latitude using exact search (AND)\" \n else\n Rails.logger.debug \"\\t\\t1.1) Determine longitude/latitude using matched search (OR)\"\n end\n \n geo_...
[ "0.6679851", "0.64014035", "0.6298561", "0.62338173", "0.6151822", "0.6126624", "0.6103957", "0.60358435", "0.59050494", "0.5813308", "0.57374996", "0.5716294", "0.5689505", "0.56476825", "0.5623668", "0.55930626", "0.55901444", "0.55813664", "0.5573815", "0.55611426", "0.555...
0.8211378
0
Multi update of FOOD tasks per time range: morning, midday or evening
def mark_as_doing_food # for performance reasons, we update directly into the DB without passing by the models @tasks.update_all(doing: true, user_doing_id: current_user.id) # Needed because update_all calls directly the DB. # Hence the objects are not updated. @tasks.reload respond_to do |for...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_late_tasks\n # find project\n project = Project.find(params[:id])\n # check user is manager of project\n if (!@superuser_is_superadmin && !(superuser_is_part_of_project? project))\n flash[:warning] = \"You can't do this action for this project\"\n redirect_to lato_core....
[ "0.6406914", "0.6284889", "0.6208722", "0.6158972", "0.60969454", "0.6053492", "0.6020562", "0.5992072", "0.59815633", "0.59667265", "0.59480417", "0.5891062", "0.58804333", "0.58741313", "0.5866213", "0.5853234", "0.5846235", "0.5845379", "0.5843773", "0.5812054", "0.5798093...
0.0
-1
write a function and do it 10 times
def indoor_plants(plants, pots) puts "I've got #{plants} plants ready to be potted." puts "And I've got #{pots} pots." if plants > pots puts "I need some more pots!" elsif pots > plants puts "Time to get to potting!" elsif pots == plants puts "Wow, perfect! Time to get to work!" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scrape(num)\n num.times do\n single_scrape()\n end\nend", "def invoke_10_times(proc)\n 10.times { proc.call }\nend", "def do_something\n 10000.times { \"cat\" }\n end", "def repeater(repeats=1, &proc)\n repeats.times {proc.call}\nend", "def repeater(times=1, &prc)\n times.ti...
[ "0.7112786", "0.71000093", "0.70885557", "0.6919277", "0.6791045", "0.67698836", "0.6740172", "0.67117554", "0.6711448", "0.6658763", "0.66444206", "0.66281587", "0.6619069", "0.6619069", "0.6619069", "0.653336", "0.6502691", "0.6486468", "0.64787716", "0.64580625", "0.641216...
0.0
-1
Lesson 2 Ruby control flow Is It Chicken Tenders Day? 5/??/2014 To test any of your functions from the command line, type $ ruby lesson2.rb and follow the instructions... I Do Specification: write a function tenders(day) that will return true if day == "THURSDAY" and false otherwise. Examples: tenders('THURSDAY') => tr...
def tenders(day) if day == 'THURSDAY' true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_eat(food, season)\n if food == \"hot chocolate\" && season == \"summer\"\n return \"False\"\n elsif food == \"ice cream\" && season == \"winter\"\n return \"False\"\n else return \"true\"\n end\nend", "def tenders_ci(day)\n\tif day.upcase == 'THURSDAY' #convert our string to uppercase and t...
[ "0.70559", "0.66689426", "0.6649614", "0.65383524", "0.65197355", "0.64335644", "0.64325154", "0.6370524", "0.6353161", "0.63471705", "0.6332055", "0.6317288", "0.63036376", "0.6300612", "0.6276219", "0.6253272", "0.62096936", "0.620277", "0.61866266", "0.6186499", "0.615775"...
0.7226776
0
We Do Specification: write a function tenders_ci(day) that will return "It's Chicken Tenders Day!" if the day is Thursday (caseinsensitive) and "Nope." otherwise Examples tenders_ci('THURSDAY') => "It's Chicken Tenders Day!" tenders_ci('tHuRsDaY') => "It's Chicken Tenders Day!" tenders_ci('thursday') => "It's Chicken T...
def tenders_ci(day) if day.upcase == 'THURSDAY' #convert our string to uppercase and then test "It's Chicken Tenders Day!" else "Nope." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_day_name(day) \n day_name = \"\"\n\n case day \n when \"Mon\"\n day_name = \"Monday\"\n when \"Tues\"\n day_name = \"Tuesday\"\n when \"Wed\"\n day_name = \"Wednesday\"\n when \"Thur\"\n day_name = \"Thursday\"\n when \"Fri\"\n day_name = \"Friday\"...
[ "0.68299377", "0.6492586", "0.64805335", "0.6395318", "0.63431436", "0.6219996", "0.61048555", "0.5825884", "0.5817033", "0.5810343", "0.5797848", "0.57389104", "0.57253313", "0.56615096", "0.56375045", "0.5606832", "0.5578682", "0.557286", "0.55584204", "0.5544396", "0.55147...
0.9019338
0
Specification: write a function tenders_flip() that will return "It's Chicken Tenders Day!" if Random.rand(2) == 0 and "Nope" otherwise. This achieves 50/50 probability... Examples tenders_flip() => "It's Chicken Tenders Day!" tenders_flip() => "Nope." tenders_flip() => "It's Chicken Tenders Day!"
def tenders_flip() if Random.rand(2) == 0 #achieves 50/50 probability "It's Chicken Tenders Day!" else "Nope." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coin_flip\n return (rand(1..2) == 1 ? \"HEADS\" : \"TAILS\")\nend", "def flip(chance = 0.5)\n rand < chance\n end", "def coin_flip_spelled_out(coin)\n if coin == \"h\"\n coin = \"Heads\"\n elsif coin == \"t\"\n coin = \"Tails\"\n end\n end", "def coin_flip_spelled_out(coin)\n ...
[ "0.7678562", "0.70043564", "0.6646345", "0.66372967", "0.62627375", "0.62232786", "0.6207758", "0.61767584", "0.597585", "0.5945124", "0.5942603", "0.5895894", "0.5828815", "0.58286047", "0.5826325", "0.5759788", "0.56973433", "0.56973433", "0.56838536", "0.567933", "0.567645...
0.9248462
0
GET /invitations/1 GET /invitations/1.json
def show @invitation = Invitation.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @invitation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @invitations = Invitation.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @invitations }\n end\n end", "def received_invitations\n user = User.find(params[:user_id])\n @invitations = user.invitations\n\n ren...
[ "0.75913405", "0.7526508", "0.75251997", "0.7464685", "0.74266523", "0.74266523", "0.74266523", "0.7416057", "0.7392427", "0.73693264", "0.7242686", "0.72115725", "0.71856487", "0.7128858", "0.71254545", "0.70345855", "0.7029703", "0.6960833", "0.6922483", "0.6912704", "0.690...
0.72811294
13
GET /invitations/new GET /invitations/new.json
def new @invitation = Invitation.new respond_to do |format| format.html # new.html.erb format.json { render json: @invitation } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @invitation = Invitation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @invitation }\n end\n end", "def new\n @title = 'New Invitation'\n @invitation = Invitation.new\n\n respond_to do |format|\n form...
[ "0.7941579", "0.78695714", "0.76084334", "0.76084334", "0.76084334", "0.74486166", "0.7427489", "0.73509425", "0.7335179", "0.7335179", "0.7227275", "0.7227275", "0.7221134", "0.71565616", "0.7108594", "0.70116955", "0.6997947", "0.6992694", "0.6967593", "0.69276696", "0.6892...
0.79464066
1
POST /invitations POST /invitations.json
def create @invitation = Invitation.new(params[:invitation]) respond_to do |format| if @invitation.save format.html { redirect_to @invitation, notice: 'Invitation was successfully created.' } format.json { render json: @invitation, status: :created, location: @invitation } else ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sent_invitations\n user = User.find(params[:user_id])\n @invitations = Invitation.created_by_user(user)\n\n render json: @invitations\n end", "def create_and_invitation_studant(params = {})\n run(:post, \"/invitations\", [201,422], JSON.dump(params))\n end", "def received_invitations\...
[ "0.74625444", "0.71738625", "0.70617986", "0.7045898", "0.68818", "0.6838542", "0.6797677", "0.6790132", "0.67516214", "0.67260355", "0.6697047", "0.6660709", "0.66208273", "0.6608182", "0.6548802", "0.6547871", "0.65414256", "0.6501991", "0.64919865", "0.64832705", "0.648253...
0.6912948
4
PUT /invitations/1 PUT /invitations/1.json
def update @invitation = Invitation.find(params[:id]) respond_to do |format| if @invitation.update_attributes(params[:invitation]) format.html { redirect_to @invitation, notice: 'Invitation was successfully updated.' } format.json { head :no_content } else format.html { rend...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @invitation = Invitation.find(params[:id])\n @invitation.update_attributes(params[:invitation])\n respond_with(@invitation)\n end", "def update\n @invitation = Invitation.with_token!(params[:id])\n\n authorize! @invitation\n\n @invitation.update_attributes(invitation_params)\n\n ...
[ "0.7184447", "0.71410334", "0.7041767", "0.69879746", "0.6941577", "0.6833829", "0.6786673", "0.6765365", "0.67333144", "0.6702696", "0.6680272", "0.6630103", "0.65944374", "0.65944374", "0.65944374", "0.65944374", "0.65944374", "0.6589721", "0.6553685", "0.64920783", "0.6492...
0.7007649
5
DELETE /invitations/1 DELETE /invitations/1.json
def destroy @invitation = Invitation.find(params[:id]) @invitation.destroy respond_to do |format| format.html { redirect_to invitations_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n respond_to do |format|\n format.html { redirect_to invitations_url }\n format.json { head :ok }\n end\n end", "def destroy\n @invitation = Invitation.find(params[:id])\n @invitation.destroy\n\n...
[ "0.7809238", "0.7671447", "0.7610469", "0.74955773", "0.7465351", "0.7465351", "0.74499756", "0.74499756", "0.74499756", "0.74499756", "0.73516375", "0.73394334", "0.73394334", "0.73394334", "0.73394334", "0.73394334", "0.7255408", "0.7255408", "0.7230616", "0.72155535", "0.7...
0.7798266
4
Resolve the given event object into a Coordination::Task and a Coordination::Models::Task
def resolve_task(task) if root_task && task.kind_of?(Roby::Task) root_task.plan.add(task) model_task = Coordination::Models::Task.new(task.model) script_task = instance_for(model_task) bind_coordination_task_to_instance(scri...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def resolve_event(event)\n if event.respond_to?(:to_sym)\n symbol = event\n if root_task\n event = root_task.find_event(symbol)\n else\n event = model.root.find_event(symbol)\n e...
[ "0.6552672", "0.56529444", "0.5433586", "0.5276607", "0.52376544", "0.51389134", "0.511857", "0.51146585", "0.50879365", "0.5060328", "0.50562835", "0.503233", "0.5006381", "0.49974385", "0.49958584", "0.49473998", "0.49395826", "0.49356943", "0.49319753", "0.492658", "0.4912...
0.6473611
1
Resolve the given event object into a Coordination::Event and a Coordination::Models::Event
def resolve_event(event) if event.respond_to?(:to_sym) symbol = event if root_task event = root_task.find_event(symbol) else event = model.root.find_event(symbol) end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def event\n valid_events = model_class.state_machine.events.map(&:name)\n valid_events_for_object = @object ? @object.state_transitions.map(&:event) : []\n\n if params[:e].blank?\n errors = t('api.errors.missing_event')\n elsif valid_events_for_object.include?(params[:e].to_sym)\n @object.sen...
[ "0.57254994", "0.5583834", "0.554242", "0.5508535", "0.5502345", "0.54651344", "0.544591", "0.54295176", "0.5401916", "0.5373947", "0.5373947", "0.53576666", "0.533205", "0.5288423", "0.5280893", "0.52730507", "0.5252763", "0.5249518", "0.5222656", "0.52189595", "0.52185947",...
0.65449303
0
Start the given task at that point in the script, and wait for it to emit its start event
def start(task, explicit_start: false, **dependency_options) task, model_task = resolve_task(task) model.start(model_task, explicit_start: explicit_start, **dependency_options) task end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def starting?; event(:start).pending? end", "def start\n TaskScheduler.add_task(self)\n end", "def start\n until @done\n job = retrieve_job\n job.execute if job\n end\n end", "def start()\n raise ValidateError.new(\"#{full_name} not validated.\") unless @prep...
[ "0.65049994", "0.64585483", "0.63733196", "0.635484", "0.63186044", "0.6292746", "0.62583417", "0.62123686", "0.62059957", "0.61771566", "0.61308247", "0.60616076", "0.5965789", "0.5914518", "0.5903054", "0.585843", "0.5824594", "0.5790437", "0.57585406", "0.57449144", "0.571...
0.56250066
26
Wait for an event to be emitted
def wait(event, options = {}) event, model_event = resolve_event(event) model.wait(model_event, **options) event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for(event)\n @mootex.synchronize do\n (@waiting[event] ||= ConditionVariable.new).wait(@mootex)\n end\n self\n end", "def wait_until\n poll do\n transition! if yield\n end\n end", "def wait_until_ready\n # th...
[ "0.7058396", "0.69339114", "0.68980575", "0.6879262", "0.68771464", "0.68381894", "0.67674124", "0.6730951", "0.6630047", "0.6562171", "0.6533357", "0.64866716", "0.6478818", "0.64671034", "0.6400367", "0.6326391", "0.63184434", "0.62589705", "0.6252855", "0.6247924", "0.6247...
0.68042797
6
Waits until the given block returns true
def wait_until poll do transition! if yield end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_until(timeout=10, &block)\n time = Time.now\n success = false\n until success\n if (Time.now - time) >= timeout\n raise \"Waited for #{timeout} seconds, but block never returned true\"\n end\n sleep 0.5\n success = yield\n end\n end", "def wait...
[ "0.7970039", "0.7566952", "0.75521064", "0.7509724", "0.72355986", "0.71698326", "0.7072731", "0.7030144", "0.6992863", "0.69785976", "0.69359744", "0.68965787", "0.68945277", "0.6882766", "0.6808327", "0.68058485", "0.68058336", "0.67973673", "0.6795852", "0.6770375", "0.673...
0.6852736
14
Sleep for a given number of seconds
def sleep(seconds) task = start(Tasks::Timeout.new(delay: seconds), explicit_start: true) wait task.stop_event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sleep(dur=0) end", "def delay(seconds)\n sleep(seconds)\n end", "def sleep(n)\n Kernel.sleep(n)\n end", "def delay(seconds); end", "def delay(seconds); end", "def sleep_after(seconds)\n write_bytes(27, 56, seconds)\n end", "def sleep_secs(secs)\n sleep(Duration.from...
[ "0.8269573", "0.82175094", "0.805263", "0.79531187", "0.79531187", "0.78447604", "0.7737649", "0.76893353", "0.761425", "0.7613569", "0.75967115", "0.75652856", "0.7535539", "0.7533716", "0.75012845", "0.7423818", "0.74152553", "0.73236424", "0.7322622", "0.7297452", "0.72505...
0.8300899
0
Emit the given event
def emit(event) event, model_event = resolve_event(event) model.emit(model_event) event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def emit event, *args\n @services.emit event, self, *args\n end", "def emit event, *args\n if @callbacks.key?(event)\n @callbacks[event].call(*args)\n end\n end", "def emit(event, data = nil)\n self.process_event(event, data)\n end", "def emit_event(event)\n log.trace \"in_se...
[ "0.7541939", "0.7528936", "0.7508008", "0.7152958", "0.69705003", "0.6957223", "0.6896134", "0.6863849", "0.68388826", "0.65879875", "0.65708274", "0.63643664", "0.6253275", "0.6191883", "0.61326313", "0.60877687", "0.6055247", "0.60493654", "0.6008665", "0.5981526", "0.59330...
0.7637944
0
Execute the provided block once per execution cycle, until the given event is emitted
def poll_until(event, &block) raise ArgumentError, "poll_until requires a block" unless block event, model_event = resolve_event(event) model.instructions << Script::Models::PollUntil.new(model_event, block) event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def go\n while(true)\n process_event(wait_for_event)\n end\n end", "def start(&block)\n loop do\n event_data = self.next\n block.(event_data)\n end\n end", "def while(&block)\n\t\t\t\t\trepeat &block\n\t\t\t\tend", "def signal_wait_until(pr, &block...
[ "0.6482546", "0.6448393", "0.64289904", "0.6381102", "0.63427657", "0.624725", "0.62293684", "0.6210012", "0.6209789", "0.6209789", "0.6209789", "0.6204279", "0.6119524", "0.6109478", "0.61044914", "0.6088158", "0.60855013", "0.6054549", "0.6033164", "0.5957118", "0.59426033"...
0.69525623
0
Execute the script instructions given as block. If they take more than the specified number of seconds, either generate an error or emit an event (and quit the block)
def timeout(seconds, options = {}, &block) timeout = timeout_start(seconds, options) parse(&block) timeout_stop(timeout) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_script\n %[timeout $((PBS_WALLTIME-300)) \"#{script}\"]\n end", "def script_timeout=(seconds); end", "def run_command interval, duration\n (duration / interval).times do \n yield\n sleep(interval)\n end\nend", "def execute(exec_num, &block)\n exec_num.times do timed(&block)\n e...
[ "0.6403208", "0.637248", "0.61799115", "0.6090156", "0.60236967", "0.6016109", "0.59955376", "0.587519", "0.577101", "0.57502943", "0.5732055", "0.56964636", "0.56567043", "0.5631982", "0.56135577", "0.56112933", "0.561011", "0.5605958", "0.5571913", "0.5559224", "0.54839605"...
0.5173222
71
Start a timeout operation. Usually not used directly
def timeout_start(seconds, options = {}) options, timeout_options = Kernel.filter_options options, emit: nil if event = options[:emit] _, model_event = resolve_event(event) end model.timeout_start(seconds, timeout_options.merge(emit: mo...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def timeout(args = {}, &block)\n return Knjappserver::Threadding_timeout.new({\n :kas => self,\n :block => block,\n :args => []\n }.merge(args)).start\n end", "def set_timeout timeout\r\n command 'setTimeout', timeout\r\n end", "def set_timeout timeout\r\n command 'setTimeout', tim...
[ "0.6981207", "0.6907444", "0.6907444", "0.67463857", "0.6669018", "0.66577196", "0.6589166", "0.6457133", "0.6457133", "0.6355139", "0.6355139", "0.6355139", "0.6338115", "0.62316364", "0.6230479", "0.61810124", "0.61497676", "0.6121524", "0.61030966", "0.6087177", "0.6080639...
0.5849951
52
Stop a timeout operation. Usually not used directly
def timeout_stop(timeout) model.timeout_stop(timeout) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def stop! timeout = nil\n stop\n wait! timeout\n end", "def stop(timeout=nil)\n timeout ||= @timeout +1\n @shutting_down = true\n @thread.join timeout\n @running = false\n end", "def stop\n @timer.cancel\n end", "def stop\n @t...
[ "0.7963575", "0.76160437", "0.74017084", "0.74017084", "0.69578385", "0.6704031", "0.66996694", "0.66823417", "0.66517717", "0.664356", "0.6638529", "0.65962917", "0.6584261", "0.6556356", "0.6540514", "0.652411", "0.6523253", "0.6523253", "0.6523253", "0.652109", "0.6506559"...
0.83985806
0
Adds a task script that is going to be executed while this task instance runs.
def script(options = {}, &block) execute do |task| script = model.create_script(task, &block) script.prepare script.step end model.create_script(self, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def addTask(sourceDescription, sourceURL, context, taskText)\n\t\n\t\tapplication=Appscript.app(self.getApplicationName())\n\t\n\t\t#Applescript dictionary defines this list as \"default list\", rbappscript uses an underscore to replace spaces in situations like this.\n\t\tapplication.default_list.make(:new => :re...
[ "0.62214357", "0.60862124", "0.6074016", "0.6043118", "0.59940624", "0.59844166", "0.5961221", "0.59468484", "0.59296376", "0.5908607", "0.5894791", "0.58801925", "0.5861106", "0.58552986", "0.57832175", "0.57517594", "0.5750544", "0.57494146", "0.57295096", "0.5710411", "0.5...
0.63146585
0
perhamps cut these things
def down? @hp <= 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def suivre; end", "def schubert; end", "def anchored; end", "def malts; end", "def terpene; end", "def celebration; end", "def stderrs; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def ignores; end", "def offe...
[ "0.7062768", "0.6991299", "0.66623014", "0.6501657", "0.64738804", "0.6325535", "0.63088673", "0.62240756", "0.61286587", "0.6093686", "0.6093686", "0.6093686", "0.6093686", "0.6065289", "0.60599774", "0.6053806", "0.59965765", "0.59867823", "0.5937249", "0.59284216", "0.5928...
0.0
-1
Return priority of current attack
def attack_priority if @action == "items" return $data.items[@item_id].priority else return 3 if @skill_id == nil return $data.skills[@skill_id].priority end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getPriority\r\n\t\t\t\t\treturn @priority\r\n\t\t\t\tend", "def priority\n return data.priority\n end", "def priority\r\n 25\r\n end", "def priority_score\n return @priority_score\n end", "def calculated_priority\n @calculated_priority = true\n\n return 8...
[ "0.7021376", "0.7004166", "0.6895235", "0.68634915", "0.68333143", "0.67028576", "0.659859", "0.65621775", "0.65529054", "0.6547078", "0.65029395", "0.64684796", "0.64626414", "0.64488447", "0.63956624", "0.6363521", "0.6311759", "0.6250937", "0.6226392", "0.62027884", "0.620...
0.8484985
0
all buttons come here, so we first have to look at the button value
def save_selected next_id = next_collecting_event_id selected = params[:selected] if selected.blank? message = 'Nothing to save.' success = false else any_failed = false selected.each {|item_id| ce = CollectingEvent.where(project_id: sessions_current_project_id).find(item...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getvalue\n @button_group.value\n end", "def buttons; end", "def button(value)\n # return button at index.\n return ele_index UIAButton, value if value.is_a? Numeric\n ele_by_json_visible_contains UIAButton, value\n end", "def buttons_exact(value)\n eles_by_json_visible_exac...
[ "0.69239175", "0.6885163", "0.68419147", "0.67182213", "0.6682878", "0.66215724", "0.6619016", "0.66168773", "0.65366113", "0.64774233", "0.6422029", "0.63172466", "0.6305872", "0.6296033", "0.62922674", "0.6280587", "0.6270327", "0.6251135", "0.62191844", "0.6171097", "0.615...
0.0
-1
TODO: deprecate for valud from view/helper
def next_collecting_event_id filters = parse_filters(params) Queries::CollectingEventDatesExtractorQuery.new( collecting_event_id: collecting_event_id_param, filters: filters) .all .with_project_id(sessions_current_project_id) .order(:id) .limit(1) .pluck(:id)[0] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def helpers; end", "def helpers; end", "def helpers; end", "def private; end", "def _view; end", "def instance_helper\n\tend", "def formation; end", "def custom; end", "def custom; end", "def version_helper; end", "def version_helper; end", "def version_helper; end", "def version_helper; en...
[ "0.68674356", "0.68674356", "0.68674356", "0.6296447", "0.59585845", "0.5833671", "0.57317", "0.5723587", "0.5723587", "0.571629", "0.571629", "0.571629", "0.571629", "0.5715812", "0.5715812", "0.5689832", "0.56753504", "0.5655368", "0.5650751", "0.56441534", "0.56378084", ...
0.0
-1
Show invalid properties with the reasons. Usually used together with valid?
def list_invalid_properties invalid_properties = Array.new invalid_properties end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n invalid_properties.push('invalid value for \"object_type\", object_type cannot be nil....
[ "0.76497203", "0.76497203", "0.76497203", "0.76497203", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7637422", "0.7356452", "0.7334807", "0.72685325", "0.7238964", "0.7231359", "0.72258264", "0.7208294", "0.71760833" ]
0.7170241
82
Check to see if the all the properties in the model are valid
def valid? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validate_properties\n true\n end", "def validate_properties\n true\n end", "def validate\n super\n\n check_optional_property :collection, String\n check_optional_property :create, String\n check_optional_property :delete, String\n check_optional_property :...
[ "0.78992486", "0.78992486", "0.70971805", "0.70782334", "0.7032205", "0.7031276", "0.69510347", "0.6869891", "0.6858077", "0.6858077", "0.68287027", "0.6823878", "0.6820306", "0.68144894", "0.6794656", "0.6752167", "0.66843414", "0.6676546", "0.6667755", "0.66296124", "0.6618...
0.0
-1
Checks equality by comparing each attribute.
def ==(o) return true if self.equal?(o) self.class == o.class && ad_mode_begin == o.ad_mode_begin && ad_mode_complete == o.ad_mode_complete && bytes_delivered == o.bytes_delivered && engagement_score == o.engagement_score && play_rate == o.play_rate && ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ==(other)\n attributes == other.attributes\n end", "def ==(other) # :nodoc:\n @attrs == other.attrs\n end", "def eql?(other)\n return true if self == other\n @@ATTRIBUTES.each do |att|\n return false unless self.send(att).eql?(other.send(att))\n end\n true\n en...
[ "0.7291717", "0.7188103", "0.70395297", "0.7007927", "0.68874705", "0.6861532", "0.6707156", "0.6660597", "0.66147524", "0.658478", "0.6584619", "0.6580019", "0.65543133", "0.6543933", "0.65068495", "0.6479513", "0.6456241", "0.6415999", "0.6412208", "0.6412208", "0.6412208",...
0.0
-1
Calculates hash code according to all attributes.
def hash [ad_mode_begin, ad_mode_complete, bytes_delivered, engagement_score, play_rate, play_request, video, duration, video_engagement_1, video_engagement_25, video_engagement_50, video_engagement_75, video_engagement_100, video_impression, name, video_percent_viewed, video_seconds_viewed, video_view].hash ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attr_hash\n Digest::MD5.hexdigest(\"#{@name}:#{@ruby_type}\")\n end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash() end", "def hash\n code = 17\n code = 37*code + @x.hash\n code = 37*code + @y.hash\n ...
[ "0.7118691", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.70400536", "0.68960655", "0.67847186", "0.6707762", "0.670052", "0.6688737", "0.66705376", "0.6489735", "0.6462376", "0.6462376", "0.64444333", "0.6413127", "0.6395483", "0.638...
0.0
-1
Builds the object from hash
def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.openapi_types.each_pair do |key, type| if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key) self.send("#{key}=", nil) elsif type =~ /\AArray<(.*)>/i ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build(hash)\n obj = new\n hash.each_pair do |k,v|\n obj[k] = v if variables[k]\n end\n return obj\n end", "def build_from_hash(attributes)\n\n end", "def build_from_hash(hash)\n instance = self.new\n\n # Add the instance attributes dynamically ...
[ "0.8011074", "0.7470833", "0.7457607", "0.7256629", "0.72455454", "0.70060325", "0.6973257", "0.6955014", "0.69459796", "0.69398683", "0.69363195", "0.6917627", "0.6872358", "0.6796184", "0.6783521", "0.67575246", "0.67575246", "0.67560464", "0.67514306", "0.67136854", "0.666...
0.0
-1
Deserializes the data based on type
def _deserialize(type, value) case type.to_sym when :Time Time.parse(value) when :Date Date.parse(value) when :String value.to_s when :Integer value.to_i when :Float value.to_f when :Boolean if value.to_s =~ /\A(true|t|yes|y|1)\z/...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i\n when :Float\n value.to_f\n when :BOOLEAN\n if value.to_s...
[ "0.7330926", "0.7274019", "0.72504056", "0.7245751", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", "0.72291344", ...
0.0
-1
Returns the string representation of the object
def to_s to_hash.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s\n @object.to_s\n end", "def to_s\n object.to_s\n end", "def serialize(object)\n object.to_s\n end", "def to_s\n self.inspect\n end", "def to_s\n @string || @object.to_s('F')\n end", "def to_s\n @string || @object.to_s('F')\n end", "de...
[ "0.901024", "0.89506465", "0.84703195", "0.83409667", "0.8337169", "0.8337169", "0.8332247", "0.82546586", "0.8145818", "0.8144667", "0.81357557", "0.812714", "0.8093436", "0.8086725", "0.8073356", "0.8039774", "0.80308646", "0.80064154", "0.80064154", "0.80064154", "0.800641...
0.0
-1
to_body is an alias to to_hash (backward compatibility)
def to_body to_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_body\r\n to_hash\r\n end", "def to_body\n to_hash\nend", "def to_body\n to_hash\nend" ]
[ "0.84283537", "0.8347048", "0.8347048" ]
0.0
-1
Returns the object in the form of hash
def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_hash\n object\n end", "def hash\r\n return to_s.hash\r\n end", "def hash\n to_a.hash\n end", "def hash\n [_hash, name, owner].hash\n end", "def hash\n return to_s.hash\n end", "def hash\n @hash\n end", "def hash\n @hash.hash\n end", "def hash\n ...
[ "0.8270299", "0.78767854", "0.78726953", "0.7802364", "0.7789188", "0.77806795", "0.7775915", "0.7767511", "0.7760525", "0.7760525", "0.77559966", "0.7731286", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916", "0.7713916",...
0.0
-1
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [value].hash\n end", "def hash\n [value].hash\n end", "def hash\n\t\tvalue.hash\n\tend", "def hash\n value.hash\n end", "def hash\n @value.hash\n end", "def hash\r\n return to_s.hash\r\n end", "def to_hash\n @value\n end", "def to_hash\n @va...
[ "0.6719518", "0.6719518", "0.666832", "0.66565555", "0.6586841", "0.6452931", "0.6414911", "0.6414911", "0.6382046", "0.6346188", "0.6302933", "0.62237245", "0.6151989", "0.6101756", "0.60795677", "0.60795677", "0.60717124", "0.6035991", "0.6021168", "0.5936472", "0.5903488",...
0.0
-1
Sends a friend request to another user
def send_friend_request(other_user) friend_requests << other_user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_friend_request\n request_response = post(\"/users/#{id}/request\")[\"response\"]\n @user = Foursquared::Response::User.new(client, request_response[\"userrequest_\"])\n end", "def send_friend_request user_id\n response = post(\"/users/#{user_id}/request\")[\"response\"]\n @u...
[ "0.8311592", "0.8290018", "0.79111433", "0.7644739", "0.764217", "0.7380371", "0.7333644", "0.7333317", "0.73185664", "0.72076225", "0.7148009", "0.7132653", "0.71241385", "0.71024853", "0.7083705", "0.70697665", "0.7046677", "0.7000568", "0.6939181", "0.6925127", "0.692164",...
0.8275144
2
Returns an array of users who offered the current user a friend request
def pending_friends self.passive_relationships.where(status_flag: 0) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend_requests\n @user_fr.inverse_friendships.map { |friendship| friendship.user unless friendship.confirmed }.compact\n end", "def friend_requests\n inverse_friendships.map{|friendship| friendship.user if !friendship.confirmed}.compact\n end", "def friends_as_requester\n\t\taccepted_friendship = ...
[ "0.7877591", "0.7837649", "0.77895", "0.77738994", "0.7727558", "0.7727558", "0.77190435", "0.76864225", "0.7656867", "0.75719535", "0.7542151", "0.74765825", "0.7465938", "0.7443325", "0.74198496", "0.7408522", "0.7369078", "0.7307006", "0.7282442", "0.72412604", "0.7238539"...
0.0
-1
Creates a user in canvas based on the passed user storing the new canvas user id in the object. Be sure to call user.save at some point after using this.
def create_user(user) open_canvas_http # the v1 is API version, only one option available in Canvas right now # accounts/1 refers to the Beyond Z account, which is the only one # we use since it is a custom installation. request = Net::HTTP::Post.new('/api/v1/accounts/1/users') requ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_user_in_canvas(user, username, timezone = nil, docusign_template_id = nil)\n user_student_id = nil\n enrollment = Enrollment.find_by_user_id(user.id)\n user_student_id = enrollment.student_id unless enrollment.nil?\n\n # the v1 is API version, only one option available in Canvas righ...
[ "0.77080536", "0.6904284", "0.6885695", "0.6885695", "0.6802862", "0.6783388", "0.6767503", "0.67553544", "0.67511076", "0.6728698", "0.6658359", "0.6634111", "0.66327393", "0.654548", "0.65426785", "0.65190125", "0.65116066", "0.6509488", "0.64960396", "0.64632434", "0.64632...
0.8296947
0
Looks up the user in canvas, setting the ID locally if found, and creating the user on Canvas if not. Don't forget to call user.save after using this.
def sync_user_logins(user) canvas_user = find_user(user.email) if canvas_user.nil? create_user(user) else user.canvas_user_id = canvas_user['id'] end user end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user\n @user = User.find_by_external_id(params[:id])\n @user = User.create!(name: params[:name], email: params[:email], external_id: params[:external_id]) unless @user\n end", "def associate_with_user\n if user_id.nil? || user.email == Address::PLACEHOLDER_EMAIL\n self.user_id = User...
[ "0.7308465", "0.7129072", "0.7111945", "0.69456136", "0.6824956", "0.6809885", "0.6763061", "0.67431134", "0.6722719", "0.67166364", "0.6714587", "0.67089945", "0.6695912", "0.66810936", "0.6679052", "0.667366", "0.66653025", "0.66645664", "0.6662802", "0.6659223", "0.6658566...
0.67140156
11
Enrolls the user in the new course, without modifying any existing data
def enroll_user_in_course(user, course_id, role, section) return if role.nil? open_canvas_http role = role.capitalize request = Net::HTTP::Post.new("/api/v1/courses/#{course_id}/enrollments") data = { 'access_token' => Rails.application.secrets.canvas_access_token, 'enro...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enroll\n company = Company.find( params[:company_id])\n current_user_id = current_user( company.slug).id\n #user = User.find( current_user_id)\n course = Course.find( params[:id])\n if course.category == 1\n #public auto add user\n signup = course.course_signups.build\n signup.use...
[ "0.78194827", "0.750828", "0.7204917", "0.696588", "0.69173324", "0.68535215", "0.68130904", "0.6793369", "0.67547446", "0.67369944", "0.669724", "0.6664565", "0.66264325", "0.6505596", "0.6479689", "0.6453512", "0.6349354", "0.63400966", "0.6305274", "0.62841415", "0.6284141...
0.67827326
8
Syncs the user enrollments with the given data, by unenrolling from existing courses, if necessary, and enrolling them in the new course+section. The goal of this method is to make Canvas's internal data match the spreadsheet data, allowing for bulk fixes via csv import.
def sync_user_course_enrollment(user, course_id, role, section) @course_enrollment_cache = {} if @course_enrollment_cache.nil? if @course_enrollment_cache[course_id].nil? @course_enrollment_cache[course_id] = get_course_enrollments(course_id) end existing_enrollment = nil @course...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_enrollment_and_user(canvas_role, course_id, section_id, campus_data_row, enrollments_csv, known_users, users_csv)\n uid = campus_data_row['ldap_uid']\n enrollments_csv << {\n 'course_id' => course_id,\n 'user_id' => derive_sis_user_id(campus_data_row),\n 'role' => canvas_r...
[ "0.5948096", "0.58007973", "0.5670456", "0.5662757", "0.56397235", "0.55556875", "0.54699016", "0.54521024", "0.54458714", "0.54387003", "0.5403481", "0.5403251", "0.54014367", "0.5387619", "0.53800285", "0.53659534", "0.53553337", "0.5353408", "0.53157616", "0.5302131", "0.5...
0.61877424
1
Returns an array of enrollments objects for the user.
def get_user_enrollments(user_id) open_canvas_http request = Net::HTTP::Get.new( "/api/v1/users/#{user_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}" ) response = @canvas_http.request(request) info = JSON.parse response.body info end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_enrollments(user_id)\n request = Net::HTTP::Get.new(\n \"/api/v1/users/#{user_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n info = get_all_from_pagination(response)\n\n info\n end"...
[ "0.7328801", "0.701661", "0.6042091", "0.6042091", "0.5967976", "0.5945997", "0.5945997", "0.5945997", "0.5945997", "0.5927173", "0.5901118", "0.5890391", "0.58855706", "0.57678884", "0.5732751", "0.5732751", "0.56941885", "0.56649625", "0.56143296", "0.5604097", "0.55791175"...
0.71692896
1
Returns an array of enrollments objects for the course.
def get_course_enrollments(course_id) open_canvas_http request = Net::HTTP::Get.new( "/api/v1/courses/#{course_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}" ) response = @canvas_http.request(request) info = JSON.parse response.body info ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_course_enrollments(course_id)\n request = Net::HTTP::Get.new(\n \"/api/v1/courses/#{course_id}/enrollments?per_page=100&access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n info = nil\n if response.code == '200'...
[ "0.70940316", "0.68464005", "0.6476687", "0.6476687", "0.6476687", "0.6476687", "0.64201903", "0.62144536", "0.61998034", "0.6138071", "0.6138071", "0.6137352", "0.6107977", "0.6094833", "0.6063617", "0.6024686", "0.6024686", "0.5978394", "0.5954884", "0.5924875", "0.5802351"...
0.71440285
0
Get the enrollment object from the get_user_enrollments method
def cancel_enrollment(enrollment) return if enrollment.nil? open_canvas_http request = Net::HTTP::Delete.new("/api/v1/courses/#{enrollment['course_id']}/enrollments/#{enrollment['id']}") data = { 'access_token' => Rails.application.secrets.canvas_access_token, 'task' => 'delete...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_user_enrollments(user_id)\n request = Net::HTTP::Get.new(\n \"/api/v1/users/#{user_id}/enrollments?access_token=#{Rails.application.secrets.canvas_access_token}\"\n )\n response = open_canvas_http.request(request)\n info = get_all_from_pagination(response)\n\n info\n end"...
[ "0.7069499", "0.7041148", "0.699715", "0.6886651", "0.65414506", "0.61335754", "0.60402334", "0.5810034", "0.56704503", "0.56704503", "0.56704503", "0.56704503", "0.56666434", "0.5647174", "0.5644282", "0.56323093", "0.5629873", "0.5629873", "0.5619783", "0.55503887", "0.5545...
0.0
-1
Opens a connection to the canvas http api (the address of the server is pulled from environment variables).
def open_canvas_http if @canvas_http.nil? @canvas_http = Net::HTTP.new(Rails.application.secrets.canvas_server, Rails.application.secrets.canvas_port) if Rails.application.secrets.canvas_use_ssl @canvas_http.use_ssl = true if Rails.application.secrets.canvas_allow_self_signed_s...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open_canvas_http\n \n # NOTE: disabling the re-use of connections. When connecting to Heroku hosted\n # apps over SSL, the first request works but the second fails with:\n # \"OpenSSL::SSL::SSLError: SSL_connect returned=1 errno=0 state=error: tlsv1 alert protocol version\"\n # Leaving this method ...
[ "0.76732016", "0.7211857", "0.69073266", "0.68206084", "0.6748747", "0.67001134", "0.6609211", "0.6597508", "0.6545846", "0.626623", "0.6263016", "0.6249289", "0.6200013", "0.619169", "0.61724806", "0.61553127", "0.61262715", "0.6071233", "0.60619676", "0.6027268", "0.6008491...
0.79232174
0
max=0 accounts.each_with_index do |account,index| accountsum = account.inject(:+) if max < accountsum max = accountsum end end return max end
def maximum_wealth(accounts) accounts.map {|account| account.sum }.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def max_profit(prices)\n sum = max = 0\n (0...prices.size - 1).each do |i|\n sum = [0, sum += prices[i + 1] - prices[i]].max\n max = [max, sum].max\n end\n max\nend", "def solution2(a)\n\n total_max, current_max = a[0], 0\n\n a.each do |int|\n current_max = [current_max + int, int]...
[ "0.7664258", "0.73661524", "0.73415077", "0.7288501", "0.7273721", "0.7212434", "0.7194058", "0.71888816", "0.71788704", "0.71663594", "0.71438694", "0.71122605", "0.7106171", "0.7104187", "0.7084544", "0.7078391", "0.7066198", "0.7065691", "0.70556664", "0.7044685", "0.70434...
0.82145035
0
just display the form and wait for user to enter a name and password
def login session[:user_id] = nil session[:is_admin] = nil session[:is_editor] = nil if request.post? user = User.authenticate(params[:name], params[:password]) puts user if user session[:user_id] = user.id session[:is_admin] = (user.is_admin == 1) session[:i...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fill_form\n\t\tfill_in('username', :with => 'test36650@gmail.com')\n\t\tfill_in('password', :with => 'examplepass')\n\t\tclick_button('Sign in')\n\tend", "def login_with_proper_credentials\r\n\r\n set_text(USERNAME_TEXTFIELD_NAME, VALID_USERNAME)\r\n set_text(PASSWORD_TEXTFIELD_NAME, VALID_PASSWORD)\r\...
[ "0.71031815", "0.6866774", "0.6816726", "0.67053074", "0.6584318", "0.6581573", "0.6566391", "0.6517546", "0.65161884", "0.65120345", "0.65069985", "0.65043646", "0.64908594", "0.6477352", "0.6455633", "0.6416809", "0.6340015", "0.632019", "0.63044727", "0.6290549", "0.626481...
0.0
-1
Retrieves crumbs related to the user
def crumbs_for(opts = {}) klass = Redcrumbs.crumb_class klass.targetted_by(self).all(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crumbs_as_user(opts = {})\n opts[:limit] ||= 100\n arr = crumbs_for \n arr += crumbs_by\n arr.all(opts)\n end", "def crumbs_by\n crumb_or_custom_class.all(:creator_id => self[Redcrumbs.creator_primary_key], :order => [:created_at.desc])\n end", "def crumbs\n ...
[ "0.7340025", "0.72058", "0.7130024", "0.70086646", "0.6949436", "0.691699", "0.660683", "0.6517684", "0.6488504", "0.6243522", "0.6208531", "0.62061614", "0.60113674", "0.5888716", "0.5861089", "0.5785612", "0.5785612", "0.5734177", "0.57327825", "0.5700467", "0.56873524", ...
0.6670065
6
Retrieves crumbs created by the user
def crumbs_by(opts = {}) klass = Redcrumbs.crumb_class klass.created_by(self).all(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def crumbs_by\n crumb_or_custom_class.all(:creator_id => self[Redcrumbs.creator_primary_key], :order => [:created_at.desc])\n end", "def crumbs\n [self]\n end", "def crumbs\n get_or_set_ivar \"@_crumbs\", []\n end", "def crumbs_as_user(opts = {})\n opts[:limit] ||= 100\...
[ "0.7754804", "0.7420526", "0.7292362", "0.7209947", "0.6996616", "0.688018", "0.6873564", "0.68295306", "0.6681257", "0.6354985", "0.6089824", "0.5999287", "0.5951158", "0.5903401", "0.5842924", "0.58428293", "0.5841766", "0.58178633", "0.58178633", "0.57699084", "0.5655048",...
0.7472238
1
Or queries don't seem to be working with dmredisadapter. This is a temporary workaround.
def crumbs_as_user(opts = {}) opts[:limit] ||= 100 arr = crumbs_by.to_a + crumbs_for.to_a arr.uniq! arr.sort_by! {|c| [c.created_at, c.id]}.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def n_plus_one_query_enable=(_arg0); end", "def data_query_exists?\n # TODO: add_data_query.php says: \"If the data query was already associated, it will be reindexed\"\n # we may need to figure it out somehow to avoid reindexes.\n #\n # use --check patch: returns true if data query does not exist, returns f...
[ "0.5742662", "0.55746764", "0.5566851", "0.53377163", "0.53044856", "0.53038573", "0.5241508", "0.5213033", "0.5145668", "0.5074203", "0.50274944", "0.50144947", "0.5010366", "0.50053465", "0.4995231", "0.4995231", "0.49721533", "0.4954841", "0.49350032", "0.4934753", "0.4928...
0.0
-1
, :require_http_basic_auth TODO [11/2/10 2:35 AM] => TEST_AND_REMOVE_CODE (:enable_light_box, :disable_light_box) def enable_light_box
def require_http_basic_auth if APP_CONFIG['perform_authentication'] authenticate_or_request_with_http_basic do |login, password| login==APP_CONFIG['username'] and password == APP_CONFIG['password'] end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def basicauth_enabled?\n true\n end", "def check_basic_auth_request\n tracker.find_call(:target => nil, :method => :authenticate_or_request_with_http_basic).each do |result|\n if include_password_literal? result\n warn :result => result,\n :code => @include_password,\n ...
[ "0.65784466", "0.6090028", "0.60488755", "0.6041323", "0.5907221", "0.5903721", "0.58233994", "0.57471734", "0.5738717", "0.5725363", "0.5663728", "0.5635611", "0.5633571", "0.561775", "0.5580093", "0.55544436", "0.5549377", "0.5547919", "0.55069375", "0.549018", "0.54782856"...
0.6354312
1
Uses regex to parse the php punbb config file
def get_forum_config_data config_hash = Hash.new c = File.read( File.join( RAILS_ROOT, 'public' , 'forum', 'config.php' ) ) c.scan(/\$(\w*)\s*=\s*['&quot;](.*)['&quot;];/).each do |pair| config_hash[pair[0].to_sym] = pair[1] end config_hash end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parse_config(config); end", "def config_parse(line)\n line.strip!\n return nil if line.nil? || line.empty? || line[0] == '#'\n action, line = line.split(' ', 2)\n return :domain, [line] if action == 'domain'\n return :substitution, line.split(' ', 2) if action.start_with?('sub')\n ...
[ "0.6759677", "0.64234126", "0.63757885", "0.6026935", "0.59751844", "0.593065", "0.58842266", "0.58008564", "0.57717735", "0.5717277", "0.57078075", "0.5559243", "0.5530412", "0.5526842", "0.5519484", "0.55193025", "0.550459", "0.5495805", "0.54820925", "0.5457514", "0.544514...
0.51389235
47
This methos is executed by knife in response to a "knife kitchen doctor" command
def run # Grab all the config params from command line, knife.rb etc self.config = Chef::Config.merge!(config) # Check if we have a knife.rb puts "Check location of knife.rb" checkfiles(:config_file,"The config file (knife.rb) should be stored in a .chef folder here or higher...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doctor(_kitchen_state)\n false\n end", "def doctor(_kitchen_state)\n false\n end", "def knife(sub_cmd)\n chef_exec(knife_cmd(sub_cmd))\nend", "def run\n begin\n Kitchenplan::Log.info \"Kitchenplan run ready to begin.\"\n Kitchenplan::Log.debug \"Started with options: #{opt...
[ "0.6128127", "0.6102623", "0.6084628", "0.5897641", "0.56800693", "0.5632652", "0.5628465", "0.5593724", "0.5589105", "0.5488839", "0.54872835", "0.54572946", "0.5447473", "0.53982466", "0.53847206", "0.5380225", "0.53801674", "0.53511065", "0.53454775", "0.5339292", "0.53299...
0.58557546
4
This method checks for presence of one or more files/dirs in a config item. The config may be singular (String) or multiple (Array) so we need to check [configKey] is a param name from knife.rb, command line or generated by Knife/Chef [description] is used to pass a helpful message to the user if the param is missing
def checkfiles(configKey, description) # Check if the file/dir name is actually set if config[configKey].nil? puts ui.color(" #{configKey} is not set", :red) puts ui.color(" #{description}", :magenta) else # Check if we have been passed an array of files/dirs ...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_config\n list = []\n %w(app_key secret_key endpoint).map do |k|\n list << k unless config.has_key? k\n end\n\n raise \"[#{list.join(', ')}] not included in your yaml file.\" unless list.empty?\n end", "def exists?(config, *keys)\n hash = retrieve_value(conf...
[ "0.67838466", "0.6615919", "0.6511784", "0.61491406", "0.6043815", "0.601396", "0.59162456", "0.58802605", "0.58777285", "0.5843441", "0.5840589", "0.5830081", "0.58274037", "0.58195204", "0.5816476", "0.5816301", "0.5795825", "0.5786843", "0.57724506", "0.573475", "0.5670309...
0.6977825
0
This method is called by checkfiles to verify an individual file [configKey] is a param name from knife.rb, command line or generated by Knife/Chef [fileName] is the actual value of the configKey [description] is used to pass a helpful message to the user if the param is missing
def checkfile(configKey, fileName, description) # Check if the file exists if ::File.exists?(File.expand_path(fileName)) # Yes, so display it puts ui.color(" #{configKey} is set to '#{fileName}'",:green) else # No, so tell the user it's missing puts ui.co...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def checkfiles(configKey, description)\n # Check if the file/dir name is actually set\n if config[configKey].nil?\n puts ui.color(\" #{configKey} is not set\", :red)\n puts ui.color(\" #{description}\", :magenta)\n else\n # Check if we have been passed an array...
[ "0.6585794", "0.6210241", "0.6207822", "0.616082", "0.6158676", "0.6071396", "0.5945041", "0.5906583", "0.58883166", "0.5847664", "0.58241457", "0.5777634", "0.5752615", "0.5728349", "0.5712874", "0.5686373", "0.56833714", "0.56690556", "0.5667249", "0.5657754", "0.5647372", ...
0.74285835
0
This method checks for the existence of specified parameters [configKey] is a param name from knife.rb, command line or generated by Knife/Chef [description] is used to pass a helpful message to the user if the param is missing
def checkparm(configKey,description) # Check if the [configKey] is set if config[configKey].nil? # No, so tell the user a bit about what it does, why its needed, what to do etc. puts ui.color(" #{configKey} is not set", :red) puts ui.color(" #{description}", :magenta)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_config\n list = []\n %w(app_key secret_key endpoint).map do |k|\n list << k unless config.has_key? k\n end\n\n raise \"[#{list.join(', ')}] not included in your yaml file.\" unless list.empty?\n end", "def read_and_validate_params\n if @name_args.length ...
[ "0.6326165", "0.6290437", "0.62481284", "0.59744924", "0.5946896", "0.59261686", "0.5854289", "0.5830143", "0.58153343", "0.5805975", "0.57946044", "0.57468164", "0.5713861", "0.5685847", "0.56478626", "0.5638576", "0.56308264", "0.5628859", "0.5625242", "0.56180507", "0.5575...
0.75547063
0
GET /armor_slots GET /armor_slots.json
def index @armor_slots = ArmorSlot.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ship_armor_slots = ShipArmorSlot.all\n end", "def set_armor_slot\n @armor_slot = ArmorSlot.find(params[:id])\n end", "def index\n @item_slots = ItemSlot.all\n end", "def armor_slot_params\n params.require(:armor_slot).permit(:armor_id, :character_id, :ammo_slot_id, :item_id)...
[ "0.72533476", "0.68847245", "0.66314065", "0.6621131", "0.65625155", "0.65417093", "0.6450959", "0.6425295", "0.64078784", "0.6360171", "0.6332291", "0.62221456", "0.6214652", "0.61764956", "0.61562544", "0.61379254", "0.6107353", "0.6068392", "0.6052737", "0.5993852", "0.597...
0.7861766
0
GET /armor_slots/1 GET /armor_slots/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @armor_slots = ArmorSlot.all\n end", "def set_armor_slot\n @armor_slot = ArmorSlot.find(params[:id])\n end", "def index\n @ship_armor_slots = ShipArmorSlot.all\n end", "def set_ship_armor_slot\n @ship_armor_slot = ShipArmorSlot.find(params[:id])\n end", "def create\n ...
[ "0.75960195", "0.7055455", "0.69717246", "0.65679055", "0.6547635", "0.6487522", "0.63343966", "0.6304052", "0.6300589", "0.6283867", "0.62765163", "0.62622947", "0.62213725", "0.6142036", "0.60907155", "0.6075765", "0.5991787", "0.59682196", "0.59568167", "0.59492284", "0.59...
0.0
-1
POST /armor_slots POST /armor_slots.json
def create @armor_slot = ArmorSlot.new(armor_slot_params) respond_to do |format| if @armor_slot.save format.html { redirect_to @armor_slot, notice: 'Armor slot was successfully created.' } format.json { render :show, status: :created, location: @armor_slot } else format.html...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def armor_slot_params\n params.require(:armor_slot).permit(:armor_id, :character_id, :ammo_slot_id, :item_id)\n end", "def create\n @ship_armor_slot = ShipArmorSlot.new(ship_armor_slot_params)\n\n respond_to do |format|\n if @ship_armor_slot.save\n format.html { redirect_to @ship_armor_...
[ "0.7162898", "0.70379174", "0.6709292", "0.669116", "0.66619134", "0.6647565", "0.6541873", "0.654061", "0.6449068", "0.6439462", "0.641873", "0.638226", "0.6372998", "0.6324825", "0.63209474", "0.6295671", "0.6272441", "0.62672853", "0.625631", "0.6230306", "0.6192042", "0...
0.7458791
0
PATCH/PUT /armor_slots/1 PATCH/PUT /armor_slots/1.json
def update respond_to do |format| if @armor_slot.update(armor_slot_params) format.html { redirect_to @armor_slot, notice: 'Armor slot was successfully updated.' } format.json { render :show, status: :ok, location: @armor_slot } else format.html { render :edit } format.jso...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @ship_armor_slot.update(ship_armor_slot_params)\n format.html { redirect_to @ship_armor_slot, notice: 'Ship armor slot was successfully updated.' }\n format.json { render :show, status: :ok, location: @ship_armor_slot }\n else\n format.html...
[ "0.7415876", "0.7073778", "0.69908315", "0.69386953", "0.693111", "0.6792426", "0.677183", "0.677183", "0.67617035", "0.6744727", "0.6719327", "0.66947216", "0.66630876", "0.66347057", "0.66046447", "0.65873593", "0.6580569", "0.6548413", "0.65451455", "0.65262264", "0.638170...
0.7695627
0
DELETE /armor_slots/1 DELETE /armor_slots/1.json
def destroy @armor_slot.destroy respond_to do |format| format.html { redirect_to armor_slots_url, notice: 'Armor slot was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ship_armor_slot.destroy\n respond_to do |format|\n format.html { redirect_to ship_armor_slots_url, notice: 'Ship armor slot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @readied_item_slot.destroy\n respond_to do |format|\n...
[ "0.7610787", "0.71579504", "0.7090967", "0.70518684", "0.69625556", "0.68869543", "0.6867919", "0.6843064", "0.6843064", "0.6843064", "0.68289155", "0.6825464", "0.67484605", "0.6714945", "0.6705634", "0.67019254", "0.66859233", "0.66017634", "0.6572232", "0.6566057", "0.6533...
0.7734725
0
Use callbacks to share common setup or constraints between actions.
def set_armor_slot @armor_slot = ArmorSlot.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 armor_slot_params params.require(:armor_slot).permit(:armor_id, :character_id, :ammo_slot_id, :item_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
=> "red Default Arugments Let's make num an optional parameter. By default, num will have the value of 1
def repeat(message, num = 1) message * num end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method (number, default1 = 1, default2 = 2)\nend", "def default(a,b,c=2)\n puts \"c should equal 3 now: \"\n puts c\nend", "def two_arg_method_defaults(arg1=0, arg2=\"020202\")\n puts \"Here are my args: #{arg1}, #{arg2}\"\nend", "def default _args\n \"default _args;\" \n end", "def add_two(...
[ "0.68406516", "0.6304588", "0.6290998", "0.6155342", "0.6106144", "0.6088524", "0.6077812", "0.6074967", "0.6050315", "0.6037476", "0.6036537", "0.60252535", "0.59917545", "0.59578514", "0.59175986", "0.59127", "0.59057516", "0.59020233", "0.58966786", "0.5893214", "0.5878924...
0.0
-1
=> "hihihi" Common to use nil
def greet(person_1, person_2 = nil) if person_2.nil? p "Hey " + person_1 else p "Hey " + person_1 + " and " + person_2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def noop\n \"\"\n end", "def nil \n \"nil\" \n end", "def void_string(*args)\n return nil.to_s\n end", "def if_nil(argument)\n if argument == nil \n \"\"\n else\n argument\n end\n end", "def process_nil(exp)\n return \"NULL\"\n end", "def ...
[ "0.70866036", "0.70706815", "0.70541537", "0.6823004", "0.673175", "0.6701814", "0.66431046", "0.6419884", "0.6370077", "0.6369553", "0.63521457", "0.6326296", "0.63035595", "0.63031447", "0.62627894", "0.6244839", "0.62121856", "0.6208502", "0.6197155", "0.6144423", "0.61348...
0.0
-1
=> "Hey Chao and Arittro" Option Hashes
def method(hash) p hash # {"location"=>"SF", "color"=>"red", "size"=>100} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def optionMapping(options, name, mes = false)\n # in this method I recieve the missing options for a given choice which I \n # then map over and add to the global string \n # incase this method wants to be used by another program for example the rspec\n # I have added the mes variable if given a string...
[ "0.66301113", "0.6588409", "0.6557578", "0.6390985", "0.6305846", "0.6181031", "0.6157908", "0.614994", "0.6093577", "0.6075823", "0.60361654", "0.59953636", "0.59746975", "0.59746975", "0.59680176", "0.5962644", "0.59421635", "0.5899235", "0.5841093", "0.5827966", "0.5801607...
0.0
-1
=> "BYEBYEBYE" add default arguments for readability
def modify_string(str, options = { "upper" => false, "repeats" => 1 }) str.upcase! if options["upper"] p str * options["repeats"] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default _args\n \"default _args;\" \n end", "def hi(name = 'World')\n puts \"Hello 'k' #{name.capitalize}\"\nend", "def say_hello(name = \"world!\")\n puts \"Hello, #{name}\"\nend", "def say_hello(name = \"Ruby Programmer\")\n puts \"Hello #{name}!\"\nend", "def say_hello(name = \"Ruby Progr...
[ "0.70004195", "0.6918039", "0.68279266", "0.67566955", "0.67566955", "0.67566955", "0.67566955", "0.67566955", "0.67545074", "0.6752957", "0.67474717", "0.674468", "0.67022425", "0.6647611", "0.66365737", "0.65919876", "0.6490626", "0.6456815", "0.64341253", "0.63952416", "0....
0.0
-1
=> "BYEBYEBYE" Splat Operator Using splat to accept additional arguments this results in an error
def method(arg_1, arg_2) p arg_1 p arg_2 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def __splat(x) end", "def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end", "def not_just_splat(x, *args, y)\n puts x\n puts y\n puts args.inspect\nend", "def test_parallel_assignments_with_splat_operator\n first_name, *...
[ "0.7433094", "0.6831947", "0.66885996", "0.62302315", "0.6198854", "0.61901104", "0.6187874", "0.6175328", "0.6131735", "0.6073292", "0.60380936", "0.5954946", "0.59124774", "0.59054583", "0.57999617", "0.5777324", "0.5772359", "0.57606155", "0.57341236", "0.57341236", "0.571...
0.0
-1
if you skip adding extra args, it will be [] always use splat at the end Using splat to decompose an array
def greet(first_name, last_name) p "Hey " + first_name + ", your last name is " + last_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def splat_mth(*mult_arg)\n p mult_arg #it's array :) !\n p mult_arg.class\n p mult_arg.object_id\n mult_arg.map {|arg| }\n end", "def __splat(x) end", "def parse_splat_args\n unless self.empty?\n args = self#.flatten\n case args.size\n when 1\n return args.first # if there was ...
[ "0.7887851", "0.7769471", "0.7624088", "0.7157138", "0.7084845", "0.7002068", "0.6962843", "0.6901346", "0.6704924", "0.6680541", "0.66672415", "0.666544", "0.6624008", "0.6566655", "0.6555947", "0.65445834", "0.64280504", "0.6416423", "0.63733363", "0.6372024", "0.636165", ...
0.0
-1
=> 6 Bubble Sort
def bubble_sort(array) sorted = false while !sorted sorted = true (0...array.length - 1).each do |i| if array[i] > array[i + 1] array[i], array[i + 1] = array[i + 1], array[i] sorted = false end end end array end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bubble_sort!(a)\n n = a.size - 1\n n.times { n.times { |i| a[i], a[i + 1] = a[i + 1], a[i] if a[i] > a[i + 1] } }\nend", "def bubble_sort!(arr)\n arr.size.times do |iteration|\n arr.each_index do |x|\n break if arr.size-1 == x\n if arr[x] > arr[x+1]\n arr[x], arr[x+1] = arr[x+1], arr[x...
[ "0.78756064", "0.7860907", "0.76925695", "0.7686036", "0.7657085", "0.7622978", "0.7616518", "0.7587133", "0.75767845", "0.7576497", "0.7571613", "0.75702816", "0.75634557", "0.75622076", "0.75612515", "0.75509566", "0.75460213", "0.75397813", "0.75357884", "0.7492566", "0.74...
0.0
-1
Instance method This instance method simply passes along the arguments used when creating the object to the class method self.to which then runs the same calculation.
def to(upper_limit) SumOfMultiples.to(upper_limit, @args) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(to,from) end", "def initialize(from, to, by)\n @from, @to, @by = from, to, by\n end", "def initialize(from, to, options = {})\n @from = from\n @to = to\n @before = options.fetch(:before, nil)&.to_proc\n @after = options.fetch(:after, nil)&.to_proc\n end", "...
[ "0.6088044", "0.58766043", "0.58728534", "0.5845818", "0.5737231", "0.5736996", "0.5676407", "0.5676407", "0.5676407", "0.5676407", "0.56344146", "0.5571687", "0.55533457", "0.549073", "0.5427351", "0.5342309", "0.5320632", "0.5309681", "0.52959913", "0.5288932", "0.5278335",...
0.0
-1
returns nil if there is no winner at the given position, or returns the string representing the winning chip if there is
def check_winner_at(x, y, num_to_win) chip = get_chip_at(x, y) # Find the end points of all sequences of chips containing the chip at # (x, y). Then check if any of them are a winning sequence end_points = find_end_points(x, y, chip) if end_points.any? { |point| winning_end_point?(point, num_to_win)...
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def winner\n tie_string = \"\"\n @players.each do |player|\n if @position[player] == @length\n tie_string << \"#{player}\"\n end\n end\n\n if tie_string.length > 1\n return \"no one\"\n else\n return tie_string[0]\n end\n\n end", "def winner\n index = won?\n if...
[ "0.7982563", "0.7784484", "0.77530175", "0.77228487", "0.77074164", "0.76847756", "0.75772643", "0.7515266", "0.7487751", "0.74623907", "0.7461603", "0.7447156", "0.74377084", "0.74365824", "0.74352974", "0.74284947", "0.74161774", "0.7412249", "0.73910844", "0.7385197", "0.7...
0.0
-1