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
Never trust parameters from the scary internet, only allow the white list through.
def waitron_params params.require(:waitron).permit(:logon, :name, :surname, :mobile) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
z.rating(u,m) returns the rating that user u gave movie m in the training set, and 0 if user u did not rate movie m z.predict(u,m) returns a floating point number between 1.0 and 5.0 as an estimate of what user u would rate movie m z.movies(u) returns the array of movies that user u has watched z.viewers(m) returns the array of users that have seen movie m z.run_test(k) runs the z.predict method on the first k ratings in the test set and returns a MovieTest object containing the results. The parameter k is optional and if omitted, all of the tests will be run.
def movies(user) movies_he_watched = [] @training_set.each do |record| if record.user == user.to_i movies_he_watched.push(record.movie) end end return movies_he_watched end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def predict(u, m)\n if @testSet != nil\n aveUserRating = @testSet.average(@testSet.allUsersHash[\"#{u}\"].values) #returns the average rating u gave all movies\n popularity = @testSet.popularity(m)\n popularity + aveUserRating*0.01\n end\n end", "def predict u, m\n #for each movie mw wat...
[ "0.77911854", "0.7376028", "0.73554045", "0.73100823", "0.7233915", "0.7187857", "0.7091506", "0.7029589", "0.7009631", "0.69936025", "0.6927109", "0.6858751", "0.6842662", "0.6840126", "0.6824025", "0.6785551", "0.6768226", "0.67583853", "0.67536086", "0.67365855", "0.672800...
0.5425745
74
This will be called with both lines are the same
def match(event) @content << %Q|<span class="match">#{event.old_element}</span><br/>\n| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lineCheck (l1, l2)\n if(l1 == l2)\n true;\n else\n false;\n end\nend", "def is_same_line on_line, off_line\n\tif on_line == off_line\n\t\ttrue\n\telse\n\t\tfalse\n\tend\nend", "def same_line(line, start_index, end_index)\n if (start_index > end_index)\n start_index = reverse_direction(line, st...
[ "0.71547526", "0.71445155", "0.671782", "0.6573709", "0.6514605", "0.6196718", "0.6194537", "0.61822987", "0.61547846", "0.6093012", "0.6040366", "0.60284615", "0.60225654", "0.5982883", "0.59712005", "0.5966738", "0.5966738", "0.5961046", "0.5959356", "0.5913193", "0.5910471...
0.0
-1
This will be called when there is a line in A that isn't in B
def discard_a(event) @content << %Q|<span class="only_a">#{event.old_element}</span><br/>\n| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_file_must_not_contain_found()\n\t\tCfruby::FileEdit.file_must_not_contain(@multilinefilename, \"second line\")\n\t\tFile.open(@multilinefilename, File::RDONLY) { |fp|\n\t\t\tlines = fp.readlines()\n\t\t\tassert_equal(false, lines.include?(\"second line\\n\"))\n\t\t}\n\t\t\n\t\tCfruby::FileEdit.file_must_n...
[ "0.599272", "0.599179", "0.5958142", "0.5958142", "0.5851415", "0.58421123", "0.5814615", "0.57913405", "0.5778575", "0.57731664", "0.5772115", "0.5763419", "0.5747714", "0.5742573", "0.5737534", "0.57286483", "0.5717546", "0.5715223", "0.57090515", "0.57056564", "0.5697398",...
0.0
-1
This will be called when there is a line in B that isn't in A
def discard_b(event) @content << %Q|<span class="only_b">#{event.new_element}</span><br/>\n| end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_not_referenced_by_any_line_item\n \t\tif line_items.empty?\n \t\t\treturn true\n \t\telse\n \t\t\terrors.add(:base, 'Existe linha de item')\n\t\t \treturn false\n \t\tend\n \tend", "def missed_lines; end", "def missed_lines; end", "def ensure_not_referenced_by_any_line_item\r\n\t\tunless line_item...
[ "0.5774056", "0.56254184", "0.56254184", "0.5608872", "0.55935764", "0.55456376", "0.5544483", "0.5541151", "0.5538502", "0.55365944", "0.55360776", "0.55318964", "0.55287534", "0.55263066", "0.5520399", "0.5518537", "0.5514388", "0.55122894", "0.5508217", "0.54990685", "0.54...
0.0
-1
Internal: Create a new Kestrel Adapter uri the URI instance for this adapter to use
def initialize( uri, options = {} ) @uri = uri @addr = "#{@uri.host}:#{@uri.port}" @options = options @closed = false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uri\n uri = URI::Generic.new(\n self.class.adapter_scheme.to_s,\n nil,\n @opts[:host],\n @opts[:port],\n nil,\n \"/#{@opts[:database]}\",\n nil,\n nil,\n nil\n )\n uri.user = @opts[:user]\n uri.password = @opts[:password] if uri...
[ "0.66956145", "0.66956145", "0.649609", "0.6313436", "0.6027326", "0.5935463", "0.58820283", "0.5880134", "0.5880134", "0.58426785", "0.5811005", "0.5809309", "0.57325083", "0.5724902", "0.5703785", "0.5693304", "0.5683058", "0.5679543", "0.5675877", "0.56069714", "0.5601953"...
0.0
-1
Internal: Create a new Queue from this Adapter name the String name of the Queue Returns a Qup::Queue
def queue( name ) Qup::Adapter::Kestrel::Queue.new( @addr, name ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_queue(queue_name)\n QC::Queue.new(queue_name)\n end", "def create_queue(queue_name, default_visibility_timeout=nil)\n self.new\\\n Adapter.create_queue(\n queue_name,\n default_visibility_timeout\n )['CreateQueueResponse']['CreateQueueResult']['QueueUrl'...
[ "0.80235696", "0.72683376", "0.719257", "0.7086016", "0.7061211", "0.705837", "0.7011833", "0.69384724", "0.6875571", "0.68414795", "0.68356895", "0.68356895", "0.68272436", "0.677527", "0.67645794", "0.67634255", "0.6758756", "0.66839486", "0.663934", "0.65991193", "0.65945"...
0.82802993
0
Internal: Create a new Topic from this Adapter name the name of this Topic Returns a Qup::Topic
def topic( name ) Qup::Adapter::Kestrel::Topic.new( @addr, name ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create name\n response = client.create_topic(:name => name)\n Topic.new(response.topic_arn, :config => config)\n end", "def topic(name)\n Kazoo::Topic.new(self, name)\n end", "def topic(name)\n name = name.to_s\n\n @topics[name] ||= begin\n @topic_names = n...
[ "0.82587886", "0.81842554", "0.762831", "0.75437945", "0.74189705", "0.72633976", "0.7251017", "0.7229511", "0.71637696", "0.71483463", "0.71323776", "0.7054725", "0.70000404", "0.69601053", "0.68521106", "0.6826189", "0.6813846", "0.6757913", "0.6724504", "0.67175317", "0.66...
0.82303
1
Internal: Close the Kestrel adapter Return nothing
def close @closed = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @adapter.close\n end", "def close\n @adapter.close\n end", "def close()\n #This is a stub, used for indexing\n end", "def close\n\n # nothing to do here.\n end", "def close\n # no-op\n end", "def close\n # by default do nothing - close ...
[ "0.7514006", "0.7514006", "0.71077704", "0.70085114", "0.69321215", "0.69266325", "0.68889874", "0.68576014", "0.6834989", "0.67839754", "0.67436725", "0.6719754", "0.6710169", "0.67056644", "0.67056644", "0.66826546", "0.6681955", "0.66593194", "0.66304046", "0.6629169", "0....
0.6282446
99
Internal: Is the Kestrel Adapter closed Returns true or false
def closed? @closed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def closed?\n @adapter.closed?\n end", "def closed?\n return false\n end", "def closed?\n @connection_state == :closed\n end", "def closed?\n end", "def closed?\n end", "def closed?\n @connection.nil?\n end", "def closed?\n @connection.closed?\n end", "def clos...
[ "0.82231665", "0.7421506", "0.7420277", "0.741129", "0.741129", "0.73075753", "0.7245027", "0.72025764", "0.7150567", "0.71450007", "0.7133145", "0.71125054", "0.7101702", "0.7091877", "0.7091877", "0.7091877", "0.7091877", "0.70775473", "0.70708287", "0.7065151", "0.7045604"...
0.7022355
32
GET /ngos GET /ngos.json
def index @ngos = current_user.ngos @arrNgos = @ngos.to_a end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @ginasios }\n end\n end", "def index\n @ngos = Ngo.all\n # reset_session\n end", "def show\n @os_release = OsRelease.find(params[:id])\n\n respond_to do...
[ "0.6313982", "0.6220748", "0.61209863", "0.60902303", "0.5976827", "0.59625024", "0.592958", "0.5923358", "0.5912077", "0.5885353", "0.5863601", "0.58550215", "0.5854241", "0.57568944", "0.5727482", "0.5696483", "0.5688672", "0.5685403", "0.5683491", "0.5679237", "0.56727403"...
0.55766463
28
GET /ngos/1 GET /ngos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @os_release = OsRelease.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @os_release }\n end\n end", "def index\n @ginasios = Ginasio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json {...
[ "0.6190472", "0.6185292", "0.6153919", "0.60111576", "0.5983771", "0.59209585", "0.58899224", "0.58810884", "0.58398724", "0.5831035", "0.58210677", "0.58117753", "0.5800457", "0.57956266", "0.57642525", "0.57303435", "0.57272565", "0.57047254", "0.568663", "0.5678635", "0.56...
0.0
-1
POST /ngos POST /ngos.json
def create @ngo = current_user.ngos.build(ngo_params) respond_to do |format| if @ngo.save @ngo.reindex format.html { redirect_to @ngo, notice: 'The organization was successfully created.' } format.json { render :show, status: :created, location: @ngo } else format.html { render :new } format.json { render json: @ngo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @ngo = Ngo.new(ngo_params)\n\n respond_to do |format|\n if @ngo.save\n format.html { redirect_to @ngo, notice: 'Ngo was successfully created.' }\n format.json { render :show, status: :created, location: @ngo }\n else\n format.html { render :new }\n format.js...
[ "0.6367433", "0.6007579", "0.57024837", "0.56894183", "0.5598502", "0.55899435", "0.55382144", "0.5527362", "0.55186564", "0.5512789", "0.54931813", "0.5486429", "0.5486325", "0.5468763", "0.54675186", "0.54515195", "0.54481715", "0.5428618", "0.54107875", "0.54076064", "0.53...
0.5510745
10
PATCH/PUT /ngos/1 PATCH/PUT /ngos/1.json
def update respond_to do |format| if @ngo.update(ngo_params) redirect_to "ngos/#{@ngo.id}/new_post", notice: 'Ngo was successfully updated.' format.json { render :show, status: :ok, location: @ngo } else format.html { render :edit } format.json { render json: @ngo.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def put!\n request! :put\n...
[ "0.63634884", "0.62335473", "0.62328494", "0.6160265", "0.6097447", "0.606872", "0.6043169", "0.60350907", "0.59746885", "0.5970166", "0.59484196", "0.59017915", "0.58157265", "0.581542", "0.58085907", "0.57316256", "0.5720609", "0.5712889", "0.5712889", "0.5690036", "0.56900...
0.5495104
55
DELETE /ngos/1 DELETE /ngos/1.json
def destroy @ngo.destroy respond_to do |format| format.html { redirect_to ngos_url, notice: 'Ngo was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @nodo.destroy\n respond_to do |format|\n format.html { redirect_to nodos_url }\n format.json { head :no_content }\n en...
[ "0.7204766", "0.68759406", "0.68446994", "0.68351054", "0.6809199", "0.6809199", "0.6809199", "0.6809199", "0.67964685", "0.67935914", "0.6701147", "0.6669032", "0.6632768", "0.6631566", "0.6586696", "0.65676755", "0.65616655", "0.65616655", "0.6551518", "0.65510046", "0.6527...
0.6959396
3
Use callbacks to share common setup or constraints between actions.
def set_ngo @ngo = Ngo.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.61637366", "0.60446453", "0.59452957", "0.591511", "0.58885515", "0.5834122", "0.57761765", "0.5702554", "0.5702554", "0.5652102", "0.5619581", "0.5423898", "0.5409782", "0.5409782", "0.5409782", "0.5394745", "0.53780794", "0.5356209", "0.5338898", "0.53381324", "0.5328622...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def ngo_params params.require(:ngo).permit(:name, :address, :number, :longitude, :latitude, :email, :services, :about, :status, :link, :accepted_documents, images:[]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.6981606", "0.6784227", "0.6746523", "0.67439264", "0.67361516", "0.6593381", "0.6506166", "0.64994407", "0.6483518", "0.64797056", "0.64578557", "0.6441216", "0.63811713", "0.63773805", "0.6366333", "0.63217646", "0.6301816", "0.63009787", "0.6294436", "0.62940663", "0.629...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user_company @user_company = current_company.user_companies.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
Given the current state, run the next action as directed by the plan. Store the resulting event and update the state accordingly.
def run_next event = plan.action(state).new(event_log).execute event_log << event end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def execState\n findNextState\n current_state = @state_list[@state][@transition]\n\n @transition = eval \"#{@state}\"\n @history.push @state\n\n @finished = @state == :finish\n end", "def run_next\n return false if @events.empty?\n\n event = @events.top\n @events.pop\n\n # run...
[ "0.6771881", "0.6457229", "0.63213503", "0.6132888", "0.610104", "0.60767454", "0.6026656", "0.6010223", "0.5976205", "0.5918086", "0.58301544", "0.582591", "0.58136785", "0.579474", "0.57743025", "0.5764785", "0.5715244", "0.5699989", "0.5697475", "0.5679674", "0.56384045", ...
0.8488675
0
GET /place_visits GET /place_visits.json
def index @place_visits = PlaceVisit.all render json: { place_visits: @place_visits } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @place_visit\n end", "def index\n @visited_places = VisitedPlace.all\n end", "def index\n @places = Place.all\n render json: { places: @places }, methods: [:reviews, :visit_ids, :image_url_large]\n # render json: @places, methods: :reviews # return a place object not a ...
[ "0.74620587", "0.7102226", "0.6899463", "0.6658721", "0.66409945", "0.6621744", "0.64252573", "0.6377887", "0.6355767", "0.6353428", "0.6334423", "0.63308465", "0.63220143", "0.62754005", "0.62537473", "0.6234241", "0.6212664", "0.6206768", "0.62065285", "0.6191696", "0.61040...
0.8071398
0
GET /place_visits/1 GET /place_visits/1.json
def show render json: @place_visit end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @place_visits = PlaceVisit.all\n render json: { place_visits: @place_visits }\n end", "def index\n @places = Place.all\n render json: { places: @places }, methods: [:reviews, :visit_ids, :image_url_large]\n # render json: @places, methods: :reviews # return a place object not a places...
[ "0.7968688", "0.69448835", "0.682356", "0.6638784", "0.6630286", "0.6536961", "0.65290534", "0.6526746", "0.64725417", "0.64352757", "0.64148307", "0.6386845", "0.6360392", "0.6326967", "0.6289593", "0.6281193", "0.6269159", "0.62638646", "0.62391084", "0.62310016", "0.622769...
0.7499127
1
POST /place_visits POST /place_visits.json
def create PlaceVisit.collection.insert_many(params[:place_visits]) #save to batch to database mongoid awesome end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @place_visits = PlaceVisit.all\n render json: { place_visits: @place_visits }\n end", "def create\n @visited_place = VisitedPlace.new(visited_place_params)\n\n respond_to do |format|\n if @visited_place.save\n format.html { redirect_to @visited_place, notice: 'Visited place w...
[ "0.7073311", "0.7022071", "0.66288406", "0.64864415", "0.6149504", "0.61398244", "0.60852224", "0.6034792", "0.60329294", "0.60239387", "0.60238427", "0.6000026", "0.5982425", "0.5926414", "0.59208244", "0.5872451", "0.5787471", "0.5766735", "0.57643485", "0.5735958", "0.5735...
0.5939982
13
PATCH/PUT /place_visits/1 PATCH/PUT /place_visits/1.json
def update @place_visit = PlaceVisit.find(params[:id]) if @place_visit.update(place_visit_params) head :no_content else render json: @place_visit.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @visited_place.update(visited_place_params)\n format.html { redirect_to @visited_place, notice: 'Visited place was successfully updated.' }\n format.json { render :show, status: :ok, location: @visited_place }\n else\n format.html { render ...
[ "0.69335884", "0.67360926", "0.6477264", "0.6475958", "0.6475958", "0.6475958", "0.6475958", "0.6475958", "0.64418215", "0.6439813", "0.6437517", "0.6363493", "0.63155586", "0.62998664", "0.62964875", "0.62943846", "0.62899435", "0.62899435", "0.62899435", "0.62822324", "0.62...
0.76894265
0
DELETE /place_visits/1 DELETE /place_visits/1.json
def destroy @place_visit.destroy head :no_content end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @visited_place.destroy\n respond_to do |format|\n format.html { redirect_to visited_places_url, notice: 'Visited place was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @place = Place.find(params[:id])\n # delete the place and i...
[ "0.7327365", "0.71291935", "0.698105", "0.6938311", "0.68748564", "0.68686855", "0.68524975", "0.6836299", "0.68247676", "0.6755516", "0.6754482", "0.6754482", "0.6754482", "0.6754482", "0.6754482", "0.67008233", "0.6700257", "0.66991097", "0.66971326", "0.6690509", "0.668423...
0.76144886
0
Use callbacks to share common setup or constraints between actions.
def set_console @console = Console.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def console_params params.require(:console).permit(:name, :company) 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
Implement xml rpc functions return information about vm type group. +session+ string that represents user session +return[0]+ true or false whenever is successful or not +return[1]+ if an error occurs this is error message, if successful this is the information string
def pool(session) read_task('rvpe.vmtype.pool', session) do pool_e = REXML::Element.new('VMTYPE_POOL') VMType.each do |type| type_e = type.to_xml_element pool_e.add(type_e) end doc = REXML::Document.new doc.add(pool_e) [true, doc.to_s] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vmotion\n Puppet.debug \"Retrieving vmotion status flag of specified portgroup.\"\n begin\n myportgroup = find_portgroup\n ports = myportgroup.port\n if (ports !=nil)\n if ( myportgroup.port[0] != nil)\n type=myportgroup.port[0].type\n if (type == \"host\")\n ...
[ "0.60058314", "0.5886117", "0.5414758", "0.5402863", "0.5238977", "0.5223214", "0.5172547", "0.5143242", "0.51116675", "0.50930715", "0.50529397", "0.5045687", "0.5023775", "0.49432382", "0.4906717", "0.48751524", "0.4864114", "0.48632193", "0.48561385", "0.48198843", "0.4793...
0.5146234
7
return id of the givennamed vm type. +session+ string that represents user session +name+ name of a vm type +return[0]+ true or false whenever is successful or not +return[1]+ if an error occurs this is error message, if successful this is the id of the vm type
def ask_id(session, name) read_task('rvpe.vmtype.ask_id', session) do t = VMType.find_by_name(name).last raise "VMType[#{name}] is not found. " unless t [true, t.id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_id_from_model(name, type, options={})\n matching = connection.send(type, options).select {|x| x.name == name }\n if matching.size > 1\n raise(Puppet::Error, \"Found multiple #{type} matching: #{name}, Puppet expects this to be unique. Failing.\")\n elsif matching.empty?\n raise(Puppet::E...
[ "0.5797348", "0.5793439", "0.57721454", "0.5678029", "0.56402767", "0.5397764", "0.5396771", "0.5358592", "0.53449464", "0.5341352", "0.53074145", "0.52804613", "0.526344", "0.51623756", "0.51538074", "0.5092577", "0.5060547", "0.50374734", "0.4999816", "0.49576923", "0.49551...
0.7407444
0
return information about this vm type. +session+ string that represents user session +id+ id of the user +return[0]+ true or false whenever is successful or not +return[1]+ if an error occurs this is error message, if successful this is the string with the information about the user
def info(session, id) read_task('rvpe.vmtype.info', session) do type = VMType.find_by_id(id)[0] raise "VMType[#{id}] is not found." unless type type_e = type.to_xml_element doc = REXML::Document.new doc.add(type_e) [true, doc.to_s] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_type\n return Sessions.type(session[:session_id])\nend", "def user_type\n return Sessions.type(session[:session_id])\nend", "def getInfo\n if session[:userType] == \"Seller\"\n @usertype = \"Seller\"\n @CurrentSeller ||=Seller.find_by(id:session[:seller_id])\n elsif session[:userTy...
[ "0.60684407", "0.6022724", "0.59091944", "0.576447", "0.5648149", "0.54794097", "0.54717284", "0.54575974", "0.54061806", "0.5370462", "0.5348553", "0.53061324", "0.52521884", "0.5241987", "0.51947874", "0.518722", "0.51609975", "0.51394814", "0.5128436", "0.51219356", "0.511...
0.65571475
0
allocates a new vm type. +session+ string that represents user session +template+ a string containing the template of the vm type +return[0]+ true or false whenever is successful or not +return[1]+ if an error occurs this is the error message, if successful this is the associated id (int uid) generated for this vm type
def allocate(session, template) write_task('rvpe.vmtype.allocate', session, true) do type_def = ResourceFile::Parser.load_yaml(template) # check fields err_msg_suffix = ' in VM Type file.' # check name name = type_def[ResourceFile::VMType::NAME] unless name raise 'Specify ' + ResourceFile::VMType::NAME + err_msg_suffix end type = VMType.find_by_name(name).last raise "VMType[#{name}] already exists." if type # check cpu cpu = type_def[ResourceFile::VMType::CPU] unless cpu raise 'Specify ' + ResourceFile::VMType::CPU + err_msg_suffix end unless /^\d+$/ =~ cpu.to_s raise 'Format error of ' + ResourceFile::VMType::CPU + err_msg_suffix + ' Its value should be digits.' end # check memory memory = type_def[ResourceFile::VMType::MEMORY] unless memory raise 'Specify ' + ResourceFile::VMType::MEMORY + err_msg_suffix end unless /^\d+$/ =~ memory.to_s raise 'Format error of ' + ResourceFile::VMType::MEMORY + err_msg_suffix + ' Its value should be digits.' end # check weight weight = type_def[ResourceFile::VMType::WEIGHT] unless weight raise 'Specify ' + ResourceFile::VMType::WEIGHT + err_msg_suffix end unless /^\d+$/ =~ weight.to_s raise 'Format error of ' + ResourceFile::VMType::WEIGHT + err_msg_suffix + ' Its value should be digits.' end type = VMType.new type.name = name type.cpu = cpu type.memory = memory type.weight = weight type.description = type_def[ResourceFile::VMType::DESCRIPTION] type.create [true, type.id] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(vm_name, template_name, keep_vm_alive = false)\n @name = vm_name\n temp_pool = TemplatePool.new(client, -1)\n rc = temp_pool.info\n if OpenNebula.is_error?(rc)\n error rc.message\n return nil\n end\n template = temp_pool.find { |el| el.name == template_nam...
[ "0.56087476", "0.53950816", "0.5335512", "0.5325866", "0.5297105", "0.5219912", "0.5121714", "0.5114044", "0.5065239", "0.5056944", "0.5045905", "0.5034497", "0.5021427", "0.50203645", "0.50187933", "0.49899435", "0.49767613", "0.49046695", "0.48636112", "0.48532778", "0.4796...
0.74598277
0
deletes a vm type. +session+ string that represents user session +id+ id for the vm type we want to delete +return[0]+ true or false whenever is successful or not +return[1]+ if an error occurs this is error message, otherwise it does not exist.
def delete(session, id) write_task('rvpe.vmtype.delete', session, true) do type = VMType.find_by_id(id)[0] raise "VMType[#{id}] does not exist." unless type type.delete [true, ''] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @session_type = SessionType.find(params[:id])\n @session_type.destroy\n\n respond_to do |format|\n format.html { redirect_to session_types_url }\n format.json { head :no_content }\n end\n end", "def delete(id, type)\n check_login\n response = @client.req...
[ "0.65253216", "0.6253534", "0.6092479", "0.6066719", "0.60567045", "0.6021711", "0.6017159", "0.5983823", "0.5973366", "0.5960233", "0.59562904", "0.5954352", "0.5929465", "0.5929259", "0.5925328", "0.5907496", "0.59039176", "0.59030557", "0.5898071", "0.5897334", "0.58868384...
0.77837074
0
Creates a new Input object. If +input+ is a stream object that responds to read, then it will simply be wrapped. Otherwise, one will be created and opened using Kernelopen. When Inputclose is called, the stream object wrapped will be closed. An exception will be raised if the stream that is wrapped does not support rewinding. callseq: Archive::Tar::Minitar::Input.new(io) > input Archive::Tar::Minitar::Input.new(path) > input
def initialize(input) @io = if input.respond_to?(:read) input else ::Kernel.open(input, "rb") end unless Archive::Tar::Minitar.seekable?(@io, :rewind) raise Archive::Tar::Minitar::NonSeekableStream end @tar = Reader.new(@io) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(input)\n if input.respond_to?(:read)\n @io = input\n else\n @io = open(input, \"rb\")\n end\n @tarreader = Archive::Tar::Minitar::Reader.new(@io)\n end", "def with_input_io\n case input\n when IO, StringIO\n yi...
[ "0.7347888", "0.6390628", "0.62118316", "0.6130579", "0.6130579", "0.5892436", "0.58814096", "0.57675695", "0.5746535", "0.57211584", "0.57211584", "0.57211584", "0.56861854", "0.56604165", "0.5630816", "0.56162375", "0.56134707", "0.5603424", "0.5578862", "0.55461127", "0.55...
0.7779865
0
When provided a block, iterates through each entry in the archive. When finished, rewinds to the beginning of the stream. If not provided a block, creates an enumerator with the same semantics.
def each_entry return to_enum unless block_given? @tar.each do |entry| yield entry end ensure @tar.rewind end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def each(&block)\n @tarreader.each { |entry| yield entry }\n ensure\n @tarreader.rewind\n end", "def each_entry(&block)\n return enum_for(:each_entry) unless block_given?\n\n # XXX We have to re-open the archive on every call because libarchive is designed for streaming ...
[ "0.73218024", "0.69180554", "0.65916514", "0.640716", "0.63904774", "0.63100827", "0.6162462", "0.60303223", "0.59813094", "0.59800494", "0.59506655", "0.5819276", "0.5817608", "0.57911956", "0.5748173", "0.5729489", "0.5721248", "0.5718271", "0.57167315", "0.56910837", "0.56...
0.67324674
2
Extracts the current +entry+ to +destdir+. If a block is provided, it yields an +action+ Symbol, the full name of the file being extracted (+name+), and a Hash of statistical information (+stats+). The +action+ will be one of: :dir:: The +entry+ is a directory. :file_start:: The +entry+ is a file; the extract of the file is just beginning. :file_progress:: Yielded every 4096 bytes during the extract of the +entry+. :file_done:: Yielded when the +entry+ is completed. The +stats+ hash contains the following keys: :current:: The current total number of bytes read in the +entry+. :currinc:: The current number of bytes read in this read cycle. :entry:: The entry being extracted; this is a Reader::EntryStream, with all methods thereof.
def extract_entry(destdir, entry, options = {}, &block) # :yields action, name, stats: stats = { :current => 0, :currinc => 0, :entry => entry } # extract_entry is not vulnerable to prefix '/' vulnerabilities, but it # is vulnerable to relative path directories. This code will break this # vulnerability. For this version, we are breaking relative paths HARD by # throwing an exception. # # Future versions may permit relative paths as long as the file does not # leave +destdir+. # # However, squeeze consecutive '/' characters together. full_name = entry.full_name.squeeze("/") if /\.{2}(?:\/|\z)/.match?(full_name) raise SecureRelativePathError, "Path contains '..'" end if entry.directory? extract_directory(destdir, full_name, entry, stats, options, &block) else # it's a file extract_file(destdir, full_name, entry, stats, options, &block) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extract_entry(destdir, entry) # :yields action, name, stats:\n stats = {\n :current => 0,\n :currinc => 0,\n :entry => entry\n }\n\n if entry.directory?\n dest = File.join(destdir, entry.full_name)\n\n yield :dir, entry.full...
[ "0.8250495", "0.6709144", "0.6271846", "0.58250743", "0.5264476", "0.52196956", "0.5033261", "0.50239915", "0.4985965", "0.49328527", "0.490334", "0.48778212", "0.48586214", "0.48243997", "0.48205626", "0.4794626", "0.4746957", "0.4746639", "0.47190255", "0.46932825", "0.4605...
0.78277326
1
Returns false if the wrapped data stream is open.
def closed? @io.closed? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def open?\n @data_bytes[1] != 0\n end", "def closed?\n stream = @_st_stream\n if stream._equal?(nil)\n true\n else\n stream.closed?\n end\n end", "def stream?\n return false\n end", "def closed?\n io.closed?\n end", "def closed?...
[ "0.78518945", "0.72803706", "0.72658724", "0.72624075", "0.72578156", "0.71754605", "0.7172347", "0.71410024", "0.7124949", "0.7039688", "0.7022376", "0.6958977", "0.69523853", "0.69521207", "0.6938296", "0.692736", "0.6925317", "0.6925317", "0.6908641", "0.68955714", "0.6878...
0.7054524
9
Closes both the Reader object and the wrapped data stream.
def close @io.close @tar.close end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @reader.close\n end", "def close_reader\n @reader.close unless @reader.closed?\n end", "def close\n close_reader\n close_writer\n end", "def close\n close_stream\n end", "def close\n inputstream.close\n @closed = true\n end", "def close\n @stre...
[ "0.76726556", "0.7363862", "0.7248161", "0.6703099", "0.66882163", "0.66573477", "0.66565084", "0.6492038", "0.6341458", "0.6341458", "0.6341458", "0.62948674", "0.6287371", "0.6282954", "0.62594277", "0.6257769", "0.62521243", "0.62258106", "0.6198577", "0.6190324", "0.61710...
0.60995066
22
ARGV takes in variables input from the command line. For this exercise we'll take up to 4 variables from the user.
def introduction # def opens a function/ method puts "This is an introduction program to ruby." # puts includes \n newline before displaying a string puts "If you entered this from the command line it would have looked something like this..." puts "\n\t$\t#{$0}" # "#{$0}"" displays the script ran from the command line. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vars(argv = [])\n argv\n end", "def extract_arguments!\n return ARGV[0], nil, nil if ARGV.length == 1\n\n raise(ArgumentError, \"Usage: mixtape-bu SOURCE [CHANGES] [DEST]\") unless ARGV.length == 3\n\n ARGV.take(3)\nend", "def arguments\n args = OpenStudio::Measure::OSArgumentVector.new\n\n ...
[ "0.64445984", "0.6360605", "0.6174592", "0.6077797", "0.6042524", "0.5958843", "0.59535927", "0.5830957", "0.5826194", "0.5750085", "0.57301456", "0.5725737", "0.5669689", "0.565741", "0.56492746", "0.56398046", "0.5634914", "0.56180125", "0.5608867", "0.5606396", "0.5599669"...
0.0
-1
end, closes a function/ method
def userInput(first) puts "You have provided some variables. The first one is #{first}." # #{first} == #{variable} displays the value of a variable in a string print "Good value there." # display string without introducing a new line. end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close!\n end", "def closing; end", "def closing; end", "def closing?; end", "def close\n # ..\n end", "def close() end", "def close() end", "def close() end", "def close() end", "def close() end", "def do_close; end", "def close\n end", "def close\n end", "def close\n ...
[ "0.77997947", "0.7758069", "0.7758069", "0.7756518", "0.7749014", "0.7729815", "0.7729815", "0.7729815", "0.7729815", "0.7727357", "0.7643027", "0.7613587", "0.7613587", "0.7613587", "0.7613587", "0.7613587", "0.7613587", "0.7613587", "0.7613587", "0.7613587", "0.7547355", ...
0.0
-1
Mapping the hash to the spec object.
def mapping @meta = data.select { |v| v != 'paths' && v != 'components' } || nil @path = data['paths'] || nil @model = data.dig('components', 'schemas') || nil self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_spec(hash)\n hash = to_hash(hash) unless Hash === hash\n version = \":#{hash[:version]}\" if hash[:version]\n classifier = \":#{hash[:classifier]}\" if hash[:classifier]\n \"#{hash[:group]}:#{hash[:id]}:#{hash[:type] || DEFAULT_TYPE}#{classifier}#{version}\"\n end", "def h...
[ "0.6465066", "0.6364203", "0.6136087", "0.61177665", "0.6077842", "0.6022583", "0.6021434", "0.5990789", "0.59468937", "0.593396", "0.5903947", "0.5834131", "0.582985", "0.5829125", "0.58275425", "0.5805254", "0.5798774", "0.5792345", "0.5782314", "0.5782314", "0.5782314", ...
0.0
-1
Initializes the provisioner with the machine that it will be provisioning along with the provisioner configuration (if there is any). The provisioner should _not_ do anything at this point except initialize internal state.
def initialize(machine, config) @machine = machine @config = config end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_provisioning\n @provisioner = Souffle::Provisioner::System.new(@system, @provider)\n end", "def _initialize(name, machine)\n initialize_capabilities!(\n name.to_sym,\n { name.to_sym => [Class.new, nil] },\n Vagrant.plugin(\"2\").manager.provider_capabilitie...
[ "0.78066605", "0.7001654", "0.679365", "0.62299407", "0.6164894", "0.61231273", "0.60337526", "0.6009418", "0.5968908", "0.59613913", "0.59565735", "0.59512", "0.5885755", "0.58834565", "0.58322895", "0.5811745", "0.5747568", "0.5733088", "0.57207227", "0.5702692", "0.5683067...
0.58499134
14
Called with the root configuration of the machine so the provisioner can add some configuration on top of the machine. During this step, and this step only, the provisioner should modify the root machine configuration to add any additional features it may need. Examples include sharing folders, networking, and so on. This step is guaranteed to be called before any of those steps are done so the provisioner may do that. No return value is expected.
def configure(root_config) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure(machine, config_name, logger = @log, extra_files = [], chef_version = '16.1.16')\n logger.info(\"Configuring machine #{machine['network']} with #{config_name}\")\n remote_dir = '/tmp/provision'\n within_ssh_session(machine) do |connection|\n install_chef_on_server(connection, chef_versi...
[ "0.62108755", "0.6180862", "0.61704296", "0.6071559", "0.5865713", "0.5792793", "0.57885504", "0.57534295", "0.5713271", "0.5689062", "0.5683875", "0.5673778", "0.5670659", "0.5623927", "0.5621561", "0.5601054", "0.55914646", "0.55808955", "0.55658007", "0.55460835", "0.55329...
0.5873461
4
This is the method called when the actual provisioning should be done. The communicator is guaranteed to be ready at this point, and any shared folders or networks are already setup. No return value is expected.
def provision end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def begin_provisioning\n @provisioner = Souffle::Provisioner::System.new(@system, @provider)\n end", "def setup\n unless @platform.provisioning.empty?\n script = @platform.provisioning.join(' && ')\n dispatch(script)\n end\n end", "def provision\n ssh_user = mach...
[ "0.70627695", "0.64904183", "0.6251742", "0.62210757", "0.6209799", "0.619207", "0.6097622", "0.5878464", "0.5780822", "0.57711273", "0.5699578", "0.5567326", "0.55478996", "0.5536458", "0.55357325", "0.548727", "0.5429079", "0.54161173", "0.53164846", "0.5289942", "0.5283419...
0.6483328
2
This is the method called when destroying a machine that allows for any state related to the machine created by the provisioner to be cleaned up.
def cleanup case SubutaiConfig.provider when :hyper_v SubutaiDisk.hyperv_remove_disk end # cleanup virtual disks disks = SubutaiConfig.get(:_DISK_PATHES) unless disks.nil? disks.keys.each do |key| if File.exist?(disks[key]) begin File.delete(disks[key]) puts "==> default: Deleted file: #{disks[key]}" rescue Errno::EACCES puts "==> default: (Permission denied) Failed delete file: #{disks[key]}" end end end end # cleanup generated files if File.exist?(SubutaiConfig::GENERATED_FILE) begin File.delete SubutaiConfig::GENERATED_FILE puts "==> default: Deleted file: #{SubutaiConfig::GENERATED_FILE}" rescue Errno::EACCES puts "==> default: (Permission denied) Failed delete file: #{SubutaiConfig::GENERATED_FILE}" end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup(machine, opts)\n end", "def destroy_machine(action_handler, machine_spec, machine_options)\n raise \"#{self.class} does not implement destroy_machine\"\n end", "def after_destroy(machine)\n expire_cache_for(machine)\n MachineChange.create! machine: machine, change_type: Machine...
[ "0.7394449", "0.7215934", "0.72134507", "0.7090317", "0.6921168", "0.68856925", "0.6755937", "0.67236024", "0.66968304", "0.66968304", "0.66625595", "0.66403776", "0.662869", "0.6592024", "0.6565006", "0.6552652", "0.65407974", "0.65067387", "0.64748687", "0.64618033", "0.644...
0.0
-1
The scope of the parameter
def scope parameter[:scope] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def scope=(_arg0); end", "def scope=(_arg0); end", "def scope=(_arg0); end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope; end", "def scope_name; end", "def sc...
[ "0.77638334", "0.77638334", "0.77638334", "0.7672325", "0.7672325", "0.7672325", "0.7672325", "0.7672325", "0.7672325", "0.7672325", "0.7672325", "0.7672325", "0.7672325", "0.74900484", "0.73394835", "0.73394835", "0.7336765", "0.730739", "0.72785336", "0.71531755", "0.714932...
0.85076016
0
If the parameter is required
def required !!parameter[:required] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_missing_required_arg?\n !missing_required_arguments.empty?\n end", "def has_required?; end", "def check_params; true; end", "def required?\n\t\t@required\n\tend", "def verify_required_param(param)\n raise WhmArgumentError.new(\"Missing required parameter: #{param}\"...
[ "0.7797583", "0.77323705", "0.73808646", "0.7274431", "0.72686577", "0.72588694", "0.72529763", "0.72335666", "0.7213917", "0.71744037", "0.7145457", "0.7112711", "0.7108165", "0.7095209", "0.709505", "0.709505", "0.709505", "0.709505", "0.7089056", "0.7069739", "0.70586354",...
0.823981
0
The description of the parameter
def description parameter[:description] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n end", "def description\n end", "def parameter_string\n\t\tend", "def description=(_arg0); end", "def description=(_arg0); end", "def description=(_arg0); end", "def description; end", "def description; end", "def description; end", "def description; end", "def descri...
[ "0.75493616", "0.75493616", "0.75461876", "0.751961", "0.751961", "0.751961", "0.7472894", "0.7472894", "0.7472894", "0.7472894", "0.7472894", "0.7472894", "0.7472894", "0.7472894", "0.7472894", "0.7472894", "0.7449772", "0.7441943", "0.7375184", "0.73316085", "0.73316085", ...
0.8805214
0
allows access to the predicted deaths method and speed of spread method within the virus effects method.
def virus_effects predicted_deaths speed_of_spread end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def virus_effects\r\n predicted_deaths(self)\r\n speed_of_spread(self)\r\n end", "def virus_effects\n #removed parameters for predicted_deaths and speed_of_spread, as these are class variables and are accessible throughout the method\n predicted_deaths\n speed_of_spread\n end", "def virus_effe...
[ "0.833283", "0.83232063", "0.82569736", "0.8239258", "0.8230321", "0.82059145", "0.82059145", "0.81816334", "0.81793135", "0.81743944", "0.8154895", "0.8154895", "0.8154895", "0.8154895", "0.8154895", "0.8154895", "0.8154895", "0.8154895", "0.8154895", "0.8154895", "0.8154895...
0.0
-1
Takes in the same perametors as initialize method. Given the population density, it conditionally multiplies population by a given float and rounds down with the .floor method.
def predicted_deaths # predicted deaths is solely based on population density if @population_density >= 200 number_of_deaths = (@population * 0.4).floor elsif @population_density >= 150 number_of_deaths = (@population * 0.3).floor elsif @population_density >= 100 number_of_deaths = (@population * 0.2).floor elsif @population_density >= 50 number_of_deaths = (@population * 0.1).floor else number_of_deaths = (@population * 0.05).floor end print "#{@state} will lose #{number_of_deaths} people in this outbreak" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def density\n if @population_density >= 200\n 0.4\n elsif @population_density >= 150\n 0.3\n elsif @population_density >= 100\n 0.2\n elsif @population_density >= 50\n 0.1\n else\n 0.05\n end\n end", "def calc_density(percent)\n (@population * percent).floor\n\n en...
[ "0.7175961", "0.6917913", "0.6913841", "0.6840329", "0.6831766", "0.6814632", "0.67990947", "0.67556834", "0.6732655", "0.6720346", "0.66989434", "0.66711247", "0.6636579", "0.6605759", "0.65849435", "0.65829253", "0.6547387", "0.6537823", "0.6537558", "0.6524003", "0.6489908...
0.0
-1
Takes population density and state as perametors. Given the population density it adds to the speed of spread.
def speed_of_spread #in months # We are still perfecting our formula here. The speed is also affected # by additional factors we haven't added into this functionality. speed = 0.0 if @population_density >= 200 speed += 0.5 elsif @population_density >= 150 speed += 1 elsif @population_density >= 100 speed += 1.5 elsif @population_density >= 50 speed += 2 else speed += 2.5 end puts " and will spread across the state in #{speed} months.\n\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def speed_of_spread #(population_density, state) #in months\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n \n\n if @population_density >= 200\n @speed += 0.5\n elsif @population_density >= 150\n ...
[ "0.80399954", "0.79590666", "0.79272854", "0.7846103", "0.77844614", "0.77844614", "0.77844614", "0.77844614", "0.7781454", "0.7763098", "0.7763098", "0.7763098", "0.7763098", "0.7759986", "0.7757489", "0.77381927", "0.7736469", "0.7735924", "0.77307355", "0.77287436", "0.770...
0.0
-1
An Array of ResponseMessage
def messages @messages ||= parse_messages(@raw_messages) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def messages\n responses.map(&:messages).flatten\n end", "def batch_responses\n return [@result] unless @batch_response\n # if batch response, generate array based on the response hash.\n @result.map do |r|\n next r unless r.is_a?(Hash)\n hash = r[SUCCESS] || r[ERROR]...
[ "0.7804971", "0.72382677", "0.69583523", "0.6639514", "0.6608417", "0.65948254", "0.6432672", "0.64207757", "0.63587576", "0.6312051", "0.62893766", "0.62772995", "0.62704784", "0.6242973", "0.6238014", "0.6219582", "0.6102097", "0.6082215", "0.60496396", "0.6034529", "0.6022...
0.0
-1
this monstrosity of a function parses and (re)creates URLs, based on whether they are relative, absolute, or remote. input is the URL, and the selector hash, returns the generated local destination. will download the file is the local destination does not exist yet.
def mkurl(oldurl, selector) mlog("checking %p ...", oldurl) url = oldurl # yes, technically one can include a resource from FTP. # some people actually do that. # but you really shouldn't. if oldurl.match(/^(https?|ftp)/) or (autoscm = oldurl.match(/^\/\//)) then if autoscm then # in case of "//somehost.com/..." urls, just create an absolute url by # reusing the scheme from the mothership url = @parsed.scheme + ":" + oldurl end else # macgyver the url together from the mothership scheme and host url = String.new url << @parsed.scheme << "://" << @parsed.host # if the url starts with a slash, it's an absolute path (i.e., "/blah/something.js") if oldurl.match(/^\//) then url << oldurl else # otherwise, it's a relative one (i.e., "subdir/whatever/thing.js") url << File.dirname(@parsed.path) if ((url[-1] != "/") && (oldurl[0] != "/")) then url << "/" end url << oldurl end end localdest = File.join(@opts.resdir, Utils.mkname(url, selector)) fulldest = File.join(@opts.destination, localdest) # coincidentally, the local url is the same as the file dest. whudathunkit @flog[:urls] << {url: url, local: fulldest} if File.file?(fulldest) then return localdest end response = geturl(url) if response then mlog("storing as %p", fulldest) FileUtils.mkdir_p(File.join(@opts.destination, @opts.resdir)) response.to_file(fulldest) return localdest end raise Exception, "bad response from geturl?" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def download!(source_url, destination_file); end", "def by_http(url, destination_path)\n begin\n open(url, :allow_redirections => :safe) do |input|\n if @accepted_content_types.include?(input.content_type)\n\n if File.exists?(destination_path)\n return destination_path\n ...
[ "0.62578905", "0.6060655", "0.59954214", "0.59232557", "0.58594155", "0.58338356", "0.58219856", "0.5739256", "0.5695717", "0.56442815", "0.5635905", "0.5634253", "0.5622513", "0.5620071", "0.5618566", "0.5616079", "0.56108886", "0.560822", "0.5606196", "0.5596604", "0.559214...
0.79020154
0
Example 1: Input: [2, 1, 5, 2, 3, 2], S=7 Output: 2 Explanation: The smallest subarray with a sum great than or equal to '7' is [5, 2]. Example 2: Input: [2, 1, 5, 2, 8], S=7 Output: 1 Explanation: The smallest subarray with a sum greater than or equal to '7' is [8]. Example 3: Input: [3, 4, 1, 1, 6], S=8 Output: 3 Explanation: Smallest subarrays with a sum greater than or equal to '8' are [3, 4, 1] or [1, 1, 6]. O(1)S, O(n)T
def smallest_subarray(nums, s) min_length = Float::INFINITY start_position = 0 end_position = 0 sum = nums[start_position] while start_position < nums.length if sum < s end_position += 1 break if end_position == nums.length sum += nums[end_position] elsif sum >= s size = nums[start_position..end_position].size min_length = [min_length, size].min sum -= nums[start_position] start_position += 1 end end min_length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def subs_sums(arr)\n new_arr = []\n i = 0 \n while i < arr.length \n x = i \n sub_arr = []\n\n while x < arr.length \n sub_arr << arr[i..x]\n x += 1\n end\n new_arr += sub_arr\n i += 1 \n end\n\n big = arr.min \n\n new_arr.each do |sub_arr|\n \n if sub_arr.sum > big\n b...
[ "0.76417637", "0.7293095", "0.7232034", "0.7169589", "0.714653", "0.7131594", "0.71181095", "0.7065315", "0.70146865", "0.7007551", "0.6981157", "0.69732827", "0.6966945", "0.69494003", "0.68752867", "0.68563354", "0.6826153", "0.6821782", "0.67854977", "0.6777648", "0.676772...
0.79322773
0
later may allow some access to admins who are not the user
def charts @last_month_active_recipe_data = Recipe.recent_recipe_meals(current_user, true) @last_month_inactive_recipe_data = Recipe.recent_recipe_meals(current_user, false) @difficulty_level_last_month = Recipe.difficulty_level_of_recent_meals(current_user) @food_group_data = FoodGroup.recent_food_groups_in_meals(current_user) @difficulty_data = Recipe.current_user_difficulty_of_recipes(current_user) @ingredient_data = Recipe.ingredients_in_active_recipes(current_user) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_access_required\n access_denied unless admin?\n end", "def admin_user\n render_forbidden unless current_user.admin?\n end", "def admin_in!\...
[ "0.8029633", "0.8029633", "0.8029633", "0.7989175", "0.7958551", "0.7956109", "0.78723466", "0.78723466", "0.78540605", "0.78252715", "0.7800945", "0.7713434", "0.77039903", "0.76981914", "0.76866186", "0.7660947", "0.76453763", "0.76182", "0.7606588", "0.7582586", "0.755262"...
0.0
-1
Given a host construct a PATH that includes puppetbindir, facterbindir and hierabindir
def construct_puppet_path(host) path = %w[puppetbindir facterbindir hierabindir privatebindir].compact.reject(&:empty?) # get the PATH defaults path.map! { |val| host[val] } path = path.compact.reject(&:empty?) # run the paths through echo to see if they have any subcommands that need processing path.map! { |val| echo_on(host, val) } separator = host['pathseparator'] separator = ':' unless host.is_powershell? path.join(separator) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_puppet_paths_on(hosts)\n block_on hosts do |host|\n puppet_path = construct_puppet_path(host)\n host.add_env_var('PATH', puppet_path)\n end\n end", "def bin_path\n '/usr/local/bin'.p\n end", "def default_installed_bin_dir\n if Gem.win_platform?\n #...
[ "0.6579489", "0.63995004", "0.63947284", "0.6363291", "0.6332172", "0.62922776", "0.6288716", "0.62086934", "0.62086934", "0.62086934", "0.61904335", "0.61267394", "0.6120176", "0.6110579", "0.6107097", "0.60538197", "0.60252094", "0.60223883", "0.60124934", "0.5998688", "0.5...
0.86407846
0
Append puppetbindir, facterbindir and hierabindir to the PATH for each host
def add_puppet_paths_on(hosts) block_on hosts do |host| puppet_path = construct_puppet_path(host) host.add_env_var('PATH', puppet_path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_puppet_path(host)\n path = %w[puppetbindir facterbindir hierabindir privatebindir].compact.reject(&:empty?)\n # get the PATH defaults\n path.map! { |val| host[val] }\n path = path.compact.reject(&:empty?)\n # run the paths through echo to see if they have ...
[ "0.77391577", "0.6425584", "0.627907", "0.6254122", "0.594902", "0.5930356", "0.5928038", "0.58946174", "0.5748253", "0.57020485", "0.56720626", "0.5671805", "0.5663859", "0.56033134", "0.55919224", "0.55911934", "0.55884665", "0.5588052", "0.5560463", "0.55576444", "0.555764...
0.7799043
0
Remove puppetbindir, facterbindir and hierabindir to the PATH for each host
def remove_puppet_paths_on(hosts) block_on hosts do |host| puppet_path = construct_puppet_path(host) host.delete_env_var('PATH', puppet_path) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def construct_puppet_path(host)\n path = %w[puppetbindir facterbindir hierabindir privatebindir].compact.reject(&:empty?)\n # get the PATH defaults\n path.map! { |val| host[val] }\n path = path.compact.reject(&:empty?)\n # run the paths through echo to see if they have ...
[ "0.6613631", "0.6460282", "0.60829866", "0.6081375", "0.59418666", "0.59192115", "0.5907143", "0.5750862", "0.57366264", "0.57000965", "0.56908584", "0.56249744", "0.5611411", "0.5578191", "0.55634123", "0.55631316", "0.5542108", "0.5536527", "0.5491858", "0.54382306", "0.542...
0.7859198
0
Determine the puppet collection that matches a given package version. The package must be one of :puppet_agent (you can get this version from the `aio_agent_version_fact`) :puppet :puppetserver
def puppet_collection_for(package, version) valid_packages = %i[ puppet_agent puppet puppetserver ] raise "package must be one of #{valid_packages.join(', ')}" unless valid_packages.include?(package) case package when :puppet_agent, :puppet, :puppetserver version = version.to_s return 'puppet' if version.strip == 'latest' x, y, z = version.to_s.split('.').map(&:to_i) return nil if x.nil? || y.nil? || z.nil? pc1_x = { puppet: 4, puppet_agent: 1, puppetserver: 2, } return 'pc1' if x == pc1_x[package] # A y version >= 99 indicates a pre-release version of the next x release x += 1 if y >= 99 "puppet#{x}" if x > 4 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def relevant_packages\n packages.select { |p| p['version'] == version }\n end", "def query\n begin\n output = pacman(\"-Qi\", @resource[:name])\n\n if output =~ /Version.*:\\s(.+)/\n return { :ensure => $1 }\n end\n rescue Puppet::ExecutionFailure\n return {\n ...
[ "0.6445586", "0.59764844", "0.5661505", "0.5539709", "0.55264306", "0.5411131", "0.53854245", "0.5341183", "0.5341183", "0.5329802", "0.52619517", "0.5222828", "0.52212936", "0.5221191", "0.5191069", "0.5184851", "0.51598907", "0.5158428", "0.5157382", "0.5155258", "0.5149472...
0.80058724
0
Report the version of puppetagent installed on `host`
def puppet_agent_version_on(host) result = on(host, facter('aio_agent_version'), accept_all_exit_codes: true) return result.stdout.strip if result.exit_code.zero? nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pe_version(host)\n if on(host, 'test -f /opt/puppet/pe_version', :acceptable_exit_codes => [0,1]).exit_code == 0\n return on(host, 'cat /opt/puppet/pe_version').stdout.chomp\n elsif on(host, 'test -f /opt/puppetlabs/server/pe_version', :acceptable_exit_codes => [0,1]).exit_code == 0\n r...
[ "0.7660222", "0.71184886", "0.6922257", "0.6509883", "0.6498133", "0.6343293", "0.6278347", "0.62380016", "0.62140745", "0.61479", "0.5942343", "0.58948267", "0.57102746", "0.56759816", "0.562188", "0.56132615", "0.5608695", "0.5530883", "0.5498668", "0.54903346", "0.5480383"...
0.6565443
3
Report the version of puppetserver installed on `host`
def puppetserver_version_on(host) result = on(host, 'puppetserver --version', accept_all_exit_codes: true) if result.exit_code.zero? matched = result.stdout.strip.scan(/\d+\.\d+\.\d+/) return matched.first end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pe_version(host)\n if on(host, 'test -f /opt/puppet/pe_version', :acceptable_exit_codes => [0,1]).exit_code == 0\n return on(host, 'cat /opt/puppet/pe_version').stdout.chomp\n elsif on(host, 'test -f /opt/puppetlabs/server/pe_version', :acceptable_exit_codes => [0,1]).exit_code == 0\n r...
[ "0.7463847", "0.72411954", "0.7022648", "0.6979453", "0.67134345", "0.66703576", "0.6369738", "0.62615526", "0.61796665", "0.6168482", "0.61633146", "0.6159197", "0.6132135", "0.6095601", "0.608613", "0.60631484", "0.60597926", "0.60476476", "0.6040172", "0.6038946", "0.60284...
0.81551284
0
Configure the provided hosts to be of the provided type (one of foss, aio, pe), if the host is already associated with a type then remove the previous settings for that type
def configure_defaults_on(hosts, type) block_on hosts do |host| # check to see if the host already has a type associated with it remove_defaults_on(host) add_method = "add_#{type}_defaults_on" raise "cannot add defaults of type #{type} for host #{host.name} (#{add_method} not present)" unless respond_to?( add_method, host ) send(add_method, host) # add pathing env add_puppet_paths_on(host) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_type_defaults_on(hosts)\n block_on hosts do |host|\n has_defaults = false\n if host[:type]\n host_type = host[:type]\n # clean up the naming conventions here (some teams use foss-package, git-whatever, we need\n # to correctly hand...
[ "0.7328273", "0.70454603", "0.6002446", "0.5892396", "0.58267164", "0.5719579", "0.54997265", "0.54021466", "0.5307402", "0.52996576", "0.5226173", "0.52077854", "0.5207109", "0.5204931", "0.5195084", "0.5181412", "0.5141135", "0.5085425", "0.50553983", "0.50206286", "0.50130...
0.7277866
1
Configure the provided hosts to be of their host[:type], it host[type] == nil do nothing
def configure_type_defaults_on(hosts) block_on hosts do |host| has_defaults = false if host[:type] host_type = host[:type] # clean up the naming conventions here (some teams use foss-package, git-whatever, we need # to correctly handle that # don't worry about aio, that happens in the aio_version? check host_type = normalize_type(host_type) if host_type and host_type !~ /aio/ add_method = "add_#{host_type}_defaults_on" raise "cannot add defaults of type #{host_type} for host #{host.name} (#{add_method} not present)" unless respond_to?( add_method, host ) send(add_method, host) has_defaults = true end end if aio_version?(host) add_aio_defaults_on(host) has_defaults = true end # add pathing env add_puppet_paths_on(host) if has_defaults end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_defaults_on(hosts, type)\n block_on hosts do |host|\n # check to see if the host already has a type associated with it\n remove_defaults_on(host)\n\n add_method = \"add_#{type}_defaults_on\"\n raise \"cannot add defaults of type #{type} for host #{...
[ "0.7301213", "0.6628387", "0.6594948", "0.6505887", "0.60167354", "0.59697974", "0.5809835", "0.5790901", "0.5754736", "0.57504827", "0.57504827", "0.5630373", "0.55900574", "0.5576329", "0.55626726", "0.55515623", "0.5514815", "0.54580057", "0.5415642", "0.53816086", "0.5374...
0.7599393
0
If the host is associated with a type remove all defaults and environment associated with that type.
def remove_defaults_on(hosts) block_on hosts do |host| if host['type'] # clean up the naming conventions here (some teams use foss-package, git-whatever, we need # to correctly handle that # don't worry about aio, that happens in the aio_version? check host_type = normalize_type(host['type']) remove_puppet_paths_on(hosts) remove_method = "remove_#{host_type}_defaults_on" raise "cannot remove defaults of type #{host_type} associated with host #{host.name} (#{remove_method} not present)" unless respond_to?( remove_method, host ) send(remove_method, host) remove_aio_defaults_on(host) if aio_version?(host) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset\n self.instance_variables.each do |name|\n if name!= :@type\n instance_variable_set(name,NIL)\n end\n end\n end", "def clear\n @types = nil\n end", "def purge_type!(type)\n\n collection(type).remove\n end", "def clear_system_defaults\n @region = ...
[ "0.64787537", "0.6321343", "0.6299444", "0.6278218", "0.61227286", "0.6100814", "0.60560393", "0.59550166", "0.5944852", "0.5890042", "0.58597445", "0.5813103", "0.58030754", "0.57835937", "0.57770455", "0.5752861", "0.56672335", "0.5662118", "0.5658295", "0.5656063", "0.5645...
0.7142394
0
Uses puppet to stop the firewall on the given hosts. Puppet must be installed before calling this method.
def stop_firewall_with_puppet_on(hosts) block_on hosts do |host| case host['platform'] when /debian/ result = on(host, 'which iptables', accept_all_exit_codes: true) if result.exit_code == 0 on host, 'iptables -F' else logger.notify("Unable to locate `iptables` on #{host['platform']}; not attempting to clear firewall") end when /fedora|el-7/ on host, puppet('resource', 'service', 'firewalld', 'ensure=stopped') when /el-|centos/ on host, puppet('resource', 'service', 'iptables', 'ensure=stopped') when /ubuntu/ on host, puppet('resource', 'service', 'ufw', 'ensure=stopped') else logger.notify("Not sure how to clear firewall on #{host['platform']}") end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def shutdown\n run \"#{try_sudo} /sbin/service puppet stop\"\n end", "def disable_updates hosts, opts\n logger = opts[:logger]\n hosts.each do |host|\n next if host['platform'].include?('netscaler')\n\n logger.notify \"Disabling updates.puppetlabs.com by modifying hosts fi...
[ "0.61726", "0.5916867", "0.5837332", "0.5828892", "0.5804757", "0.57333875", "0.5695637", "0.5694581", "0.5680609", "0.5679791", "0.5613683", "0.55176455", "0.54935366", "0.5465246", "0.5458051", "0.54536265", "0.54114604", "0.53493893", "0.53403896", "0.53368634", "0.5323003...
0.85152894
0
GET /user_contacts GET /user_contacts.json
def index @user_contacts = UserContact.all render :json => user_contact_data(@user_contacts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end", "def user_contacts(user_id, options={})\n response = connection.get do |...
[ "0.8195133", "0.81132793", "0.8021946", "0.77860737", "0.7747413", "0.7697906", "0.76883715", "0.7636734", "0.75170845", "0.7476102", "0.7453506", "0.7374887", "0.7332935", "0.7314376", "0.73016554", "0.7288505", "0.7279456", "0.7265001", "0.7153229", "0.7135445", "0.712197",...
0.7576065
8
GET /user_contacts/1 GET /user_contacts/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n json_response(@contacts, user_id: @user.id, status: :ok)\n end", "def contacts\n respond_with_entity(api.get('/api/v1/profile/contacts'),\n NexaasID::Entities::Profile::Contacts)\n end", "def user_contacts(user_id, options={})\n response = connection.get do |...
[ "0.8047746", "0.77883464", "0.75901574", "0.74512625", "0.7423698", "0.7327702", "0.7260974", "0.7250017", "0.724055", "0.7239466", "0.72265685", "0.72097737", "0.7123663", "0.7058802", "0.7041131", "0.70410335", "0.70352185", "0.70326006", "0.7022845", "0.7000423", "0.696449...
0.0
-1
POST /user_contacts POST /user_contacts.json
def create @user_contact = UserContact.new(user_contact_params) respond_to do |format| if @user_contact.save format.html { redirect_to @user_contact, notice: 'User contact was successfully created.' } format.json { render :show, status: :created, location: @user_contact } else format.html { render :new } format.json { render json: @user_contact.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @contact = @current_user.contacts.new(contact_params)\n if @contact.save\n render json: {status: 201, contact: @contact}\n else\n render json: {status: 400}\n end\n end", "def create\n @contact = @user.contacts.build(contact_params)\n\n respond_to do |format|\n if @...
[ "0.77694476", "0.7415485", "0.7389057", "0.7306803", "0.713477", "0.701187", "0.6937161", "0.6872882", "0.686513", "0.6848679", "0.68151003", "0.67954814", "0.67536694", "0.6733457", "0.66579235", "0.6655906", "0.66434634", "0.6627257", "0.66014284", "0.6587029", "0.65787363"...
0.7151473
4
PATCH/PUT /user_contacts/1 PATCH/PUT /user_contacts/1.json
def update respond_to do |format| if @user_contact.update(user_contact_params) format.html { redirect_to @user_contact, notice: 'User contact was successfully updated.' } format.json { render :show, status: :ok, location: @user_contact } else format.html { render :edit } format.json { render json: @user_contact.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n contact = Contact.find(params[:id])\n\n if contact.user_id == current_user.id\n contact.update_attributes(params[:contact])\n render json: contact\n else\n render text: \"That's not your contact!\"\n end\n end", "def update\n if !params.has_key?(:ur_contact) then\n ...
[ "0.7179251", "0.6994853", "0.69317245", "0.67935705", "0.6677987", "0.66582924", "0.66276723", "0.66215223", "0.6602651", "0.65693825", "0.65672535", "0.65547687", "0.651809", "0.6510665", "0.65097123", "0.64994955", "0.644876", "0.64379364", "0.6437331", "0.6430759", "0.6416...
0.6753946
4
DELETE /user_contacts/1 DELETE /user_contacts/1.json
def destroy @user_contact.destroy respond_to do |format| format.html { redirect_to user_contacts_url, notice: 'User contact was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(contactname)\n\n end", "def destroy\n @contact.destroy\n render json: {status: 204}\n end", "def destroy\n @user_contact = UserContact.find(params[:id])\n @user_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to(user_contacts_url) }\n format.xml { head...
[ "0.74326885", "0.726746", "0.7251965", "0.7218873", "0.7162893", "0.71144754", "0.7050596", "0.7050596", "0.7050596", "0.70437133", "0.70318365", "0.70261985", "0.7017324", "0.69870585", "0.69870585", "0.69870585", "0.69870585", "0.6979205", "0.6973505", "0.6961395", "0.69503...
0.7252585
2
Use callbacks to share common setup or constraints between actions.
def set_user_contact @user_contact = UserContact.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.61642385", "0.60448", "0.5945487", "0.5915654", "0.58890367", "0.58330417", "0.5776098", "0.5703048", "0.5703048", "0.5654613", "0.5620029", "0.5423114", "0.540998", "0.540998", "0.540998", "0.5393666", "0.53783023", "0.53568405", "0.53391176", "0.5339061", "0.53310865", ...
0.0
-1
Only allow a list of trusted parameters through.
def user_contact_params params.require(:user_contact).permit(:name, :email, :address, :gender, :profile_pic, :phone_id, :product_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def param_whitelist\n [:role, :title]\...
[ "0.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.63264...
0.0
-1
GET /estimate_line_items GET /estimate_line_items.xml
def index @estimate_line_items = EstimateLineItem.all respond_to do |format| format.html # index.html.erb format.xml { render :xml => @estimate_line_items } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @estimate_line_item = EstimateLineItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @estimate_line_item }\n end\n end", "def new\n @estimate_line_item = EstimateLineItem.new\n\n respond_to do |format|\n format....
[ "0.68127745", "0.6360903", "0.6279066", "0.6210757", "0.6210757", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6022376", "0.6021986", "0.5921831", "0.5886116", "0.58665013", "0.58665013", ...
0.7210645
0
GET /estimate_line_items/1 GET /estimate_line_items/1.xml
def show @estimate_line_item = EstimateLineItem.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @estimate_line_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @estimate_line_items = EstimateLineItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estimate_line_items }\n end\n end", "def new\n @estimate_line_item = EstimateLineItem.new\n\n respond_to do |format|\n format.html # new...
[ "0.73542506", "0.6641797", "0.6505939", "0.64323324", "0.64323324", "0.6165646", "0.60865617", "0.60865617", "0.60865617", "0.59795463", "0.59782314", "0.59781206", "0.59781206", "0.59781206", "0.59781206", "0.59781206", "0.59781206", "0.59781206", "0.59781206", "0.59781206", ...
0.7142349
1
GET /estimate_line_items/new GET /estimate_line_items/new.xml
def new @estimate_line_item = EstimateLineItem.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @estimate_line_item } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @line_item }\n end\n end", "def new\n @line_item = LineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lin...
[ "0.7397915", "0.73552877", "0.73552877", "0.7242719", "0.7111254", "0.7058156", "0.68960816", "0.6869682", "0.6869682", "0.6869682", "0.6869682", "0.6869682", "0.6869682", "0.6869682", "0.6869682", "0.6869682", "0.6869682", "0.6847248", "0.68193793", "0.6708017", "0.6674081",...
0.7860677
0
POST /estimate_line_items POST /estimate_line_items.xml
def create @estimate_line_item = EstimateLineItem.new(params[:estimate_line_item]) respond_to do |format| if @estimate_line_item.save format.html { redirect_to(@estimate_line_item, :notice => 'Estimate line item was successfully created.') } format.xml { render :xml => @estimate_line_item, :status => :created, :location => @estimate_line_item } else format.html { render :action => "new" } format.xml { render :xml => @estimate_line_item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @estimate_line_item = EstimateLineItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estimate_line_item }\n end\n end", "def update\n @estimate_line_item = EstimateLineItem.find(params[:id])\n\n respond_to do |format|\n if @es...
[ "0.6169939", "0.6107706", "0.60900587", "0.6030817", "0.6029231", "0.6006534", "0.6006534", "0.5980085", "0.59727156", "0.59579694", "0.59525704", "0.59121996", "0.5903614", "0.58829665", "0.5882297", "0.57834214", "0.57711077", "0.5753968", "0.5753338", "0.57146794", "0.5691...
0.6877081
0
PUT /estimate_line_items/1 PUT /estimate_line_items/1.xml
def update @estimate_line_item = EstimateLineItem.find(params[:id]) respond_to do |format| if @estimate_line_item.update_attributes(params[:estimate_line_item]) format.html { redirect_to(@estimate_line_item, :notice => 'Estimate line item was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @estimate_line_item.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_estimate_item\n @estimate_item = EstimateItem.find(params[:id])\n end", "def set_estimate_item\n @estimate_item = EstimateItem.find(params[:id])\n end", "def update\n @line_item = @order.line_items.find(params[:id])\n\n if @line_item.update(line_item_params)\n head :no_conten...
[ "0.665398", "0.665398", "0.6524784", "0.6487548", "0.6484837", "0.6462043", "0.6438278", "0.6381715", "0.6310215", "0.6302495", "0.627584", "0.62721896", "0.62721896", "0.62721896", "0.62721896", "0.62721896", "0.62648666", "0.6260803", "0.6204333", "0.6198139", "0.61810035",...
0.75399834
0
DELETE /estimate_line_items/1 DELETE /estimate_line_items/1.xml
def destroy @estimate_line_item = EstimateLineItem.find(params[:id]) @estimate_line_item.destroy respond_to do |format| format.html { redirect_to(estimate_line_items_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @line_item.destroy\n destroy_line_item_response\n end", "def destroy\r\n @lineitem = Lineitem.find(params[:id])\r\n @lineitem.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(lineitems_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def des...
[ "0.6875031", "0.6795264", "0.6787227", "0.65687406", "0.6525909", "0.63714755", "0.63493985", "0.63493985", "0.63493985", "0.63493985", "0.63424313", "0.6342331", "0.63412136", "0.63231975", "0.62888396", "0.62886626", "0.6235822", "0.62328184", "0.62046194", "0.6189297", "0....
0.7642231
0
JR NC,r8 if C flag is reset then add immediate value to current address and jump to it
def jr_nc_r8 if (@f & C_FLAG) == 0x00 jump = signed_value $mmu.read_byte(@pc) result = @pc + 1 + jump @pc = result & 0xFFFF @branched = true else @pc += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jr_c_r8\n if (@f & C_FLAG) == C_FLAG\n jump = signed_value $mmu.read_byte(@pc)\n result = @pc + 1 + jump\n @pc = result & 0xFFFF\n @branched = true\n else\n @pc += 1\n end\n end", "def jr_r8\n jump = signed_value $mmu.read_byte(@pc...
[ "0.72341406", "0.62039155", "0.5999943", "0.59464085", "0.59178203", "0.58544576", "0.58300096", "0.57618606", "0.5702619", "0.5692271", "0.5685097", "0.56535274", "0.56519544", "0.5615145", "0.5586779", "0.5563824", "0.5489476", "0.541121", "0.54080707", "0.54044515", "0.539...
0.68260896
1
JR n Add immediate value to current address and jump to it. flags
def jr_r8 jump = signed_value $mmu.read_byte(@pc) result = @pc + 1 + jump @pc = result & 0xFFFF end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add\n match \"+\"\n comment \"+\"\n term\n emitln \"addl -(0x8*#{$stackdepth})(%rsp), %eax\"\nend", "def call(jmp_addr, no_params, level) \n base << [level, sp-no_params+1]\n s[base.last[1]-1] = ni + 4\n self.ni = jmp_addr\n @jump = true\n end", "def jump(x)\n @memory_pos...
[ "0.5919649", "0.5875039", "0.58620816", "0.5802085", "0.5676205", "0.56279695", "0.5612348", "0.5588019", "0.5577101", "0.5557907", "0.55499613", "0.5544111", "0.5513163", "0.55109185", "0.5499098", "0.54615915", "0.53921896", "0.539097", "0.5379916", "0.53704", "0.53674895",...
0.5257447
32
JR Z,r8 If Z flag is set then add immediate value to current address and jump to it
def jr_z_r8 if (@f & Z_FLAG) == Z_FLAG jump = signed_value $mmu.read_byte(@pc) result = @pc + 1 + jump @pc = result & 0xFFFF @branched = true else @pc += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_nz_a16\n # branch if Z flag is reset\n if (@f & Z_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end", "def jr_r8\n jump...
[ "0.65586865", "0.63339055", "0.61050117", "0.5865902", "0.5858448", "0.57526547", "0.5700161", "0.5683896", "0.5626479", "0.5620644", "0.56173825", "0.56111854", "0.56085604", "0.55401015", "0.5476984", "0.547466", "0.54377306", "0.5427309", "0.54242384", "0.53693247", "0.536...
0.7348343
0
JR C,r8 If C flag is set then add immediate value to current address and jump to it
def jr_c_r8 if (@f & C_FLAG) == C_FLAG jump = signed_value $mmu.read_byte(@pc) result = @pc + 1 + jump @pc = result & 0xFFFF @branched = true else @pc += 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jr_nc_r8\n if (@f & C_FLAG) == 0x00\n jump = signed_value $mmu.read_byte(@pc)\n result = @pc + 1 + jump\n @pc = result & 0xFFFF\n @branched = true\n else\n @pc += 1\n end\n end", "def jr_r8\n jump = signed_value $mmu.read_byte(@pc)...
[ "0.6831559", "0.6464848", "0.6119325", "0.5764632", "0.5621096", "0.56037515", "0.5569019", "0.55521965", "0.553406", "0.5515513", "0.54924244", "0.5473993", "0.5470682", "0.54412985", "0.5400941", "0.5396511", "0.53813756", "0.53803056", "0.5334976", "0.5265342", "0.5253548"...
0.7586759
0
RET NZ Set PC to memory location stored in the stack if Z flag is reset
def ret_nz if (@f & Z_FLAG) == 0x00 @pc = pop_from_stack true @branched = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_nz_a16\n # branch if Z flag is reset\n if (@f & Z_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end", "def execute_IRET\n\t\t@...
[ "0.6816079", "0.6331999", "0.62972665", "0.6280929", "0.6106571", "0.60711044", "0.60204273", "0.58842945", "0.5868526", "0.5817849", "0.5787045", "0.5711292", "0.5664987", "0.56406665", "0.5566938", "0.5550288", "0.55412", "0.55078614", "0.54794866", "0.5467379", "0.5467379"...
0.65811425
1
RET NC Set PC to memory location stored in the stack if C flag is reset
def ret_nc if (@f & C_FLAG) == 0x00 @pc = pop_from_stack @branched = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_pc(pc)\n pp('Patch the Program Counter') do\n # Force the thumb bit. Nothing will work otherwise as CM33 only support THUMB\n reg(:xpsr).bits(:t).write(1)\n reg(:xpsr).write!\n\n # Write the debug return address with the new PC\n # Add 1 to in...
[ "0.63568455", "0.6265807", "0.61525744", "0.6021325", "0.60089123", "0.5786668", "0.5784394", "0.5704744", "0.56412727", "0.55568457", "0.54467684", "0.5441168", "0.54385626", "0.54246145", "0.5383001", "0.53803897", "0.53298825", "0.5327533", "0.5320852", "0.5305583", "0.525...
0.6352156
1
JP NZ,a16 Jump to address from immediate value if Z flag is reset
def jp_nz_a16 if (@f & Z_FLAG) == 0x00 @pc = $mmu.read_word @pc @branched = true else @pc += 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_nz_a16\n # branch if Z flag is reset\n if (@f & Z_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end", "def ret_nz\n if ...
[ "0.7408838", "0.6449261", "0.6362802", "0.6360235", "0.6031491", "0.5953602", "0.59298897", "0.5910981", "0.5864618", "0.5863436", "0.58264434", "0.5697012", "0.5651164", "0.56104016", "0.55897397", "0.5563643", "0.55514985", "0.55249184", "0.55229294", "0.5471489", "0.544386...
0.67196304
1
JP NC,a6 Jump to address from immediate value if C flag is reset
def jp_nc_a16 if (@f & C_FLAG) == 0x00 @pc = $mmu.read_word @pc @branched = true else @pc += 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jr_c_r8\n if (@f & C_FLAG) == C_FLAG\n jump = signed_value $mmu.read_byte(@pc)\n result = @pc + 1 + jump\n @pc = result & 0xFFFF\n @branched = true\n else\n @pc += 1\n end\n end", "def jr_nc_r8\n if (@f & C_FLAG) == 0x00\n ...
[ "0.66876376", "0.6289165", "0.6227206", "0.5996827", "0.59596515", "0.5953186", "0.59131896", "0.5801242", "0.5782645", "0.5775579", "0.57605493", "0.5629522", "0.5627831", "0.5566833", "0.5562229", "0.5560887", "0.55595994", "0.5558137", "0.5540534", "0.5515515", "0.54389733...
0.5331129
27
JP a16 Jump to address from immediate value
def jp_a16 @pc = $mmu.read_word @pc end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jump(address)\n @pc = address\n end", "def execute_JMPFAR(pointer)\n\t\t@cs.direct_value = pointer.next_word_value # Segment\n\t\tjump_conditionally_to_signed_displacement(pointer, true) # Offset\n\tend", "def execute_DynamicJump\n method = get_register(@instruction.register)\n log.debug...
[ "0.68202883", "0.6519319", "0.6258263", "0.6224403", "0.6197592", "0.61615777", "0.61570406", "0.6152057", "0.6152057", "0.6152057", "0.614543", "0.61181843", "0.61017466", "0.6066593", "0.5949315", "0.5939745", "0.59313935", "0.5928093", "0.5877953", "0.570967", "0.5677028",...
0.5184565
52
CALL NZ,a16 store the current PC value onto the stack and call the next address from immediate value if Z flag is reset
def call_nz_a16 # branch if Z flag is reset if (@f & Z_FLAG) == 0x00 new_pc = $mmu.read_word @pc @pc += 2 push_onto_stack @pc @pc = new_pc @branched = true else @pc += 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jp_nz_a16\n if (@f & Z_FLAG) == 0x00\n @pc = $mmu.read_word @pc\n @branched = true\n else\n @pc += 2\n end\n end", "def call_nc_a16\n if (@f & C_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\...
[ "0.6755453", "0.6649772", "0.6499941", "0.58338654", "0.5727475", "0.55369294", "0.54968756", "0.5459892", "0.5450425", "0.5417658", "0.526409", "0.5229609", "0.5228584", "0.5227668", "0.51607263", "0.5101466", "0.50915545", "0.5077222", "0.50539696", "0.5028753", "0.5018563"...
0.81816596
0
CALL NC,a16 Call address if C flag is reset
def call_nc_a16 if (@f & C_FLAG) == 0x00 new_pc = $mmu.read_word @pc @pc += 2 push_onto_stack @pc @pc = new_pc @branched = true else @pc += 2 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def call_nz_a16\n # branch if Z flag is reset\n if (@f & Z_FLAG) == 0x00\n new_pc = $mmu.read_word @pc\n @pc += 2\n push_onto_stack @pc\n @pc = new_pc\n @branched = true\n else\n @pc += 2\n end\n end", "def jp_nc_a16\n ...
[ "0.68496823", "0.63915443", "0.6164252", "0.6120851", "0.6074977", "0.5971442", "0.58944553", "0.587132", "0.56976277", "0.5532148", "0.55263495", "0.5499435", "0.54936", "0.54850554", "0.5456822", "0.54119396", "0.54076993", "0.5395354", "0.537906", "0.5370925", "0.5352952",...
0.7349268
0
RST 0x00 Push present address onto stack. Jump to address 0x00.
def rst_00h push_onto_stack @pc @pc = 0x0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_08h\n push_onto_stack @pc\n @pc = 0x8\n end", "def rst_10h\n push_onto_stack @pc\n @pc = 0x10\n end", "def rst_30h\n push_onto_stack @pc\n @pc = 0x30\n end", "def rst_38h\n push_onto_stack @pc\n @pc = 0x38\n end", "def rst_...
[ "0.67920965", "0.66770566", "0.666869", "0.65553445", "0.6545716", "0.6308985", "0.6028266", "0.5679732", "0.56655043", "0.55211806", "0.5448579", "0.53715366", "0.5367048", "0.5350363", "0.53310424", "0.5301457", "0.52602947", "0.52419424", "0.5241526", "0.5233425", "0.52323...
0.7949873
0
RST 0x10 Push present address onto stack. Jump to address 0x10.
def rst_10h push_onto_stack @pc @pc = 0x10 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_00h\n push_onto_stack @pc\n @pc = 0x0\n end", "def rst_20h\n push_onto_stack @pc\n @pc = 0x20\n end", "def rst_30h\n push_onto_stack @pc\n @pc = 0x30\n end", "def rst_08h\n push_onto_stack @pc\n @pc = 0x8\n end", "def rst_3...
[ "0.70653045", "0.6784147", "0.67269045", "0.67041475", "0.6267723", "0.6200584", "0.6146662", "0.5492133", "0.53671855", "0.53584266", "0.53110075", "0.522761", "0.519435", "0.5183512", "0.5173677", "0.5168751", "0.515394", "0.51519984", "0.50912654", "0.5086875", "0.5067824"...
0.78580725
0
RST 0x20 Push present address onto stack. Jump to address 0x20.
def rst_20h push_onto_stack @pc @pc = 0x20 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_30h\n push_onto_stack @pc\n @pc = 0x30\n end", "def rst_00h\n push_onto_stack @pc\n @pc = 0x0\n end", "def rst_38h\n push_onto_stack @pc\n @pc = 0x38\n end", "def rst_10h\n push_onto_stack @pc\n @pc = 0x10\n end", "def rst_...
[ "0.68719923", "0.67139184", "0.6700343", "0.66742796", "0.64363", "0.6428138", "0.6409285", "0.53568006", "0.5315489", "0.5245694", "0.5212533", "0.52068317", "0.5194244", "0.51068187", "0.50941944", "0.50655943", "0.50624365", "0.5045344", "0.49708426", "0.48994204", "0.4874...
0.78704494
0
RST 0x30 Push present address onto stack. Jump to address 0x30.
def rst_30h push_onto_stack @pc @pc = 0x30 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_00h\n push_onto_stack @pc\n @pc = 0x0\n end", "def rst_38h\n push_onto_stack @pc\n @pc = 0x38\n end", "def rst_20h\n push_onto_stack @pc\n @pc = 0x20\n end", "def rst_28h\n push_onto_stack @pc\n @pc = 0x28\n end", "def rst_...
[ "0.71239984", "0.69888896", "0.69021076", "0.68299043", "0.67718464", "0.6540132", "0.6413367", "0.52375686", "0.5220552", "0.5172617", "0.51524", "0.5026084", "0.49944857", "0.49824172", "0.49605545", "0.49466223", "0.4944449", "0.49277386", "0.48935428", "0.4875243", "0.479...
0.79528475
0
RET Z Return if Z flag is set
def ret_z if (@f & Z_FLAG) == Z_FLAG @pc = pop_from_stack @branched = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ret_nz\n if (@f & Z_FLAG) == 0x00\n @pc = pop_from_stack true\n @branched = true\n end\n end", "def condition_zflag(result)\n if result == 0\n @zero_flag = 1\n else\n @zero_flag = 0\n end\n end", "def call_nz_a16\n # ...
[ "0.757497", "0.6710053", "0.66353774", "0.61193323", "0.5873661", "0.57986546", "0.5663451", "0.5531846", "0.5479586", "0.5408257", "0.5365215", "0.534657", "0.53456575", "0.5301335", "0.5272633", "0.5264736", "0.52124786", "0.5204915", "0.51589125", "0.5150072", "0.5127508",...
0.78037804
0
RST 08h Push present address onto stack. Jump to address 0x08
def rst_08h push_onto_stack @pc @pc = 0x8 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_00h\n push_onto_stack @pc\n @pc = 0x0\n end", "def rst_10h\n push_onto_stack @pc\n @pc = 0x10\n end", "def rst_38h\n push_onto_stack @pc\n @pc = 0x38\n end", "def rst_20h\n push_onto_stack @pc\n @pc = 0x20\n end", "def rst_...
[ "0.77186674", "0.7357219", "0.7247946", "0.7013218", "0.69907236", "0.671585", "0.663705", "0.5962381", "0.57576597", "0.5387444", "0.53340757", "0.52578205", "0.5240474", "0.5225361", "0.51648384", "0.5161326", "0.5128984", "0.51268", "0.51238066", "0.51238066", "0.51034003"...
0.84406656
0
RST 18h Push present address onto stack. Jump to address 0x18
def rst_18h push_onto_stack @pc @pc = 0x18 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_38h\n push_onto_stack @pc\n @pc = 0x38\n end", "def rst_30h\n push_onto_stack @pc\n @pc = 0x30\n end", "def rst_20h\n push_onto_stack @pc\n @pc = 0x20\n end", "def rst_28h\n push_onto_stack @pc\n @pc = 0x28\n end", "def rst...
[ "0.7631578", "0.74590456", "0.7278673", "0.72397953", "0.6867695", "0.68238133", "0.67457885", "0.56877303", "0.5621623", "0.54140735", "0.54135156", "0.5410217", "0.5371007", "0.5331223", "0.5217659", "0.5217659", "0.5123119", "0.5111619", "0.510354", "0.5096868", "0.5033505...
0.80627805
0
RST 28h Push present address onto stack. Jump to address 0x28
def rst_28h push_onto_stack @pc @pc = 0x28 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_38h\n push_onto_stack @pc\n @pc = 0x38\n end", "def rst_30h\n push_onto_stack @pc\n @pc = 0x30\n end", "def rst_08h\n push_onto_stack @pc\n @pc = 0x8\n end", "def rst_18h\n push_onto_stack @pc\n @pc = 0x18\n end", "def rst_...
[ "0.7828351", "0.748408", "0.7276819", "0.7182006", "0.71543986", "0.7121187", "0.6764916", "0.59753764", "0.572679", "0.5541012", "0.55340207", "0.54453593", "0.5377944", "0.5377944", "0.53115463", "0.5271622", "0.5238513", "0.5221805", "0.51984507", "0.51794684", "0.5154822"...
0.85281444
0
RST 38h Push present address onto stack. Jump to address 0x38
def rst_38h push_onto_stack @pc @pc = 0x38 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rst_28h\n push_onto_stack @pc\n @pc = 0x28\n end", "def rst_30h\n push_onto_stack @pc\n @pc = 0x30\n end", "def rst_18h\n push_onto_stack @pc\n @pc = 0x18\n end", "def rst_20h\n push_onto_stack @pc\n @pc = 0x20\n end", "def rst...
[ "0.73152065", "0.72239065", "0.71391404", "0.7086957", "0.700524", "0.69032246", "0.6447026", "0.6266446", "0.5842849", "0.5537067", "0.5523254", "0.54860896", "0.5389665", "0.5389665", "0.5374963", "0.5357993", "0.5337277", "0.53294057", "0.5317336", "0.52803355", "0.5272266...
0.85707504
0
p3 = a0 + a1 + a2 p4 = a0 + a1 + a2 + a3 p5 = a0 + a1 + a2 + a3 + a4 p6 = a0 + a1 + a2 + a3 + a4 + a5 sum between index x and y x = 3, y = 5 p6 p3 p[y + 1] p[x] O(n n) with prefix sums
def slow_max_slice(a) max_slice = 0 prefix = prefix_sum(a) a.size.times do |p| for q in p..(a.size - 1) sum = prefix[q + 1] - prefix[p] max_slice = [max_slice, sum].max end end max_slice end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix_sums(arr)\n arr_size = arr.size\n p_arr = Array.new(arr_size, 0)\n p_arr[0] = arr[0]\n\n (1...arr.size).each do |k|\n p_arr[k] = p_arr[k - 1] + arr[k]\n end\n\n p_arr\nend", "def compute_sums(n)\n return compute1_sum if n == 1\n pivot_index = n/2-1\n target_value = total_value/3\n ...
[ "0.68143386", "0.68079394", "0.66128254", "0.65384316", "0.64587605", "0.6426711", "0.6424236", "0.642026", "0.64198315", "0.6418878", "0.6418479", "0.6380671", "0.63191783", "0.6313998", "0.63062006", "0.6294432", "0.62911636", "0.6272397", "0.6260954", "0.6244056", "0.62283...
0.0
-1
O(n n) w/o prefix sums
def slow_maximal_slice(a) max_slice = 0 a.size.times do |p| sum = 0 for q in p..(a.size - 1) sum += a[q] max_slice = [max_slice, sum].max end end max_slice end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def prefix_sums(arr)\n arr_size = arr.size\n p_arr = Array.new(arr_size, 0)\n p_arr[0] = arr[0]\n\n (1...arr.size).each do |k|\n p_arr[k] = p_arr[k - 1] + arr[k]\n end\n\n p_arr\nend", "def prefix_sum(counts_array)\n prefix_sum = counts_array\n 1.upto(prefix_sum.size - 1) do |indx|\n prefix_sum[ind...
[ "0.7302685", "0.6955844", "0.6648552", "0.62721777", "0.6142655", "0.6136765", "0.6108837", "0.60879815", "0.6084422", "0.6009678", "0.5983653", "0.59752136", "0.5962899", "0.591188", "0.5901277", "0.5900428", "0.5867642", "0.5860214", "0.58566517", "0.58551115", "0.5825548",...
0.0
-1
Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. I worked on this challenge [by myself, with: ]. 1. Pseudocode What is the input? What is the output? (i.e. What should the code return?) What are the steps needed to solve the problem? 2. Initial Solution
def get_grade(array) length = array.length sum = array.inject{|element,result| element + result} get_grade = (sum/length) case get_grade when 90..100 "A" when 80..90 "B" when 70..80 "C" when 60..70 "D" when 0..60 "F" else "Error" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def input_string\n result = \"73167176531330624919225119674426574742355349194934\"\n result += \"96983520312774506326239578318016984801869478851843\"\n result += \"85861560789112949495459501737958331952853208805511\"\n result += \"12540698747158523863050715693290963295227443043...
[ "0.70365584", "0.63118327", "0.627401", "0.6166804", "0.61275864", "0.59908295", "0.5816009", "0.576787", "0.5724538", "0.57229644", "0.57192343", "0.57175267", "0.57117", "0.57046133", "0.56927586", "0.5679608", "0.5674604", "0.5665381", "0.5644406", "0.56321156", "0.5631733...
0.0
-1
I worked on this challenge by myself. Your Solution Below
def leap_year?(year) if year%4 == 0 && year%100 != 0 p true elsif year%400 == 0 p true elsif year%4 == 0 && year%100 == 0 && year%400 != 0 p false else p false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def solution4(input)\n end", "def challenge; end", "def solution(s, p, q)\r\n # write your code in Ruby 2.2\r\n # A -1\r\n # C -2\r\n # G -3\r\n # T -4\r\n # s - string with n charactekrs\r\n #cagccta\r\n #0123345\r\n #p,q - not empty arrays\r\n #\r\n #p[0]=2 q[0]=4 gcc 322 ...
[ "0.66697216", "0.6579151", "0.61461884", "0.6141358", "0.60662186", "0.60490596", "0.6009742", "0.5925656", "0.5918402", "0.5896674", "0.58874416", "0.5859605", "0.5854494", "0.5829171", "0.58285606", "0.58276975", "0.5824492", "0.5776962", "0.5770414", "0.5764735", "0.576381...
0.0
-1