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
assign attributes from hash (but only these listed in PORT_ATTRIBUTES)
def assign_port_attributes(record) (record.keys & self.class::PORT_ATTRIBUTES).each do |key| instance_variable_set("@#{key}".intern, record[key]) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign_port_attributes(record)\n (record.keys & self.class::PORT_ATTRIBUTES).each do |key|\n instance_variable_set(\"@#{key}\".intern, record[key])\n end\n end", "def attributes=(hash)\n return unless hash\n\n hash.transform_keys { |key| \"#{key}=\".to_sym }\n .each { |at...
[ "0.80330515", "0.62974745", "0.61617976", "0.60884184", "0.60624737", "0.59904456", "0.5971317", "0.59359914", "0.58563924", "0.58417577", "0.5832475", "0.58183074", "0.5796984", "0.57805353", "0.57649875", "0.5764135", "0.5742111", "0.57416594", "0.57259554", "0.57124215", "...
0.7707926
1
Interface method required by package resource type. Returns the current value of package_settings property.
def package_settings properties[:package_settings] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_settings\n settings.get\n end", "def settings\n attributes.fetch(:settings)\n end", "def settings\n self.class.settings\n end", "def setting\n return @setting\n end", "def settings\n return @settings\n e...
[ "0.7250892", "0.70969284", "0.70129424", "0.69890827", "0.69246733", "0.69246733", "0.68076146", "0.6775565", "0.676962", "0.6677559", "0.6662261", "0.66311145", "0.6609274", "0.6599779", "0.65354973", "0.6516662", "0.6493183", "0.6472634", "0.6406607", "0.6403034", "0.639691...
0.8575731
1
Reinstall package to deploy (new) build options.
def package_settings=(opts) reinstall(opts) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reinstall\n end", "def reinstall(options)\n if @portorigin\n do_portupgrade portorigin, reinstall_options, options\n else\n warning \"Could not reinstall package '#{name}' which has no port origin.\"\n end\n end", "def reinstall(options)\n if @portorigin\n do_portupgrade po...
[ "0.73900783", "0.72157145", "0.72157145", "0.703479", "0.66874593", "0.6408658", "0.63790524", "0.62822783", "0.62140405", "0.6192676", "0.61705303", "0.60128146", "0.5959836", "0.5958977", "0.59447956", "0.5927521", "0.59109116", "0.5902285", "0.5902285", "0.58713657", "0.58...
0.6569329
5
For internal use only
def do_portupgrade(name, args, package_settings) cmd = args + [name] begin sync_package_settings(package_settings) if portupgrade(*cmd) =~ /\*\* No such / raise Puppet::ExecutionFailure, "Could not find package #{name}" end rescue revert_package_settings raise end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def probers; end", "def schubert; end", "def refutal()\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def internal; end", "def implementation; end", "def implementation; end", "def used?; end", "def suivre; end", "def operations...
[ "0.8013419", "0.6570498", "0.6400972", "0.63930404", "0.63763446", "0.63763446", "0.63763446", "0.63763446", "0.63270533", "0.6173311", "0.6173311", "0.60299", "0.5977834", "0.5971244", "0.5971244", "0.5958265", "0.59286034", "0.59286034", "0.5925395", "0.5925395", "0.5925395...
0.0
-1
install new package (only if it's not installed).
def install # we prefetched also not installed ports so @portorigin may be present name = @portorigin || resource[:name] do_portupgrade name, install_options, resource[:package_settings] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def install_package(target_package_path); raise NotImplementedError; end", "def install\n nil\n end", "def install\n # nothing to do\n end", "def install\n end", "def install(nofail = false)\n name = @resource[:name]\n should = @resource[:ensure]\n is = self.query\n if is[:ensure...
[ "0.7399877", "0.73753816", "0.73015255", "0.7215114", "0.71421087", "0.714095", "0.7129852", "0.7129852", "0.7116717", "0.70953053", "0.7079094", "0.7078568", "0.7064016", "0.7046797", "0.70430195", "0.7042956", "0.7021282", "0.70197725", "0.69912386", "0.69740754", "0.69397"...
0.64253384
67
reinstall already installed package with new options.
def reinstall(options) if @portorigin do_portupgrade portorigin, reinstall_options, options else warning "Could not reinstall package '#{name}' which has no port origin." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reinstall\n uninstall and install\n end", "def reinstall\n end", "def package_settings=(opts)\n reinstall(opts)\n end", "def package_settings=(opts)\n reinstall(opts)\n end", "def reinstall formula\n # Add the used_options for each named formula separately so\n # that the opt...
[ "0.76397586", "0.75545454", "0.7173503", "0.7173503", "0.68531066", "0.6547404", "0.649713", "0.64272773", "0.63977975", "0.63977975", "0.63535494", "0.6343839", "0.6335455", "0.6250083", "0.61856157", "0.61308426", "0.61297125", "0.61297125", "0.6081212", "0.6025627", "0.602...
0.78286535
1
upgrade already installed package.
def update if properties[:ensure] == :absent install elsif @portorigin do_portupgrade portorigin, upgrade_options, resource[:package_settings] else warning "Could not upgrade package '#{name}' which has no port origin." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade_package host, package_name\n host.upgrade_package package_name\n end", "def upgrade_package(name, cmdline_args = '')\n raise \"Package #{name} cannot be upgraded on #{self}\"\n end", "def upgrade_package(name, cmdline_args = '')\n raise \"Package #{name} cannot be upgrade...
[ "0.77149427", "0.7085009", "0.7085009", "0.7030519", "0.6848694", "0.6848694", "0.6830961", "0.67861295", "0.6760051", "0.67270595", "0.672131", "0.6706763", "0.6702722", "0.66519517", "0.6649963", "0.66028535", "0.6600193", "0.6600193", "0.65224236", "0.65020925", "0.6445378...
0.6949678
4
uninstall already installed package
def uninstall cmd = uninstall_options + [pkgname] portuninstall(*cmd) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uninstall_package host, package_name\n host.uninstall_package package_name\n end", "def uninstall(packagename)\n\t\t\tend", "def uninstall\n cmd = [:uninstall]\n case (pkg :version).chomp\n when /052adf36c3f4/\n cmd << '-r'\n end\n cmd << @resource[:name]\n self.unhol...
[ "0.8137958", "0.80556875", "0.77982146", "0.75423354", "0.7494633", "0.7461895", "0.7461895", "0.7461895", "0.7448538", "0.7419331", "0.7418826", "0.7400702", "0.73505837", "0.722813", "0.7193577", "0.7107596", "0.7107556", "0.7064469", "0.7059405", "0.7046412", "0.7023626", ...
0.73155653
13
If there are multiple packages, we only use the last one rubocop: disable MethodLength, AbcSize, CyclomaticComplexity
def latest # If there's no "latest" version, we just return a placeholder result = :latest oldversion = properties[:ensure] case portstatus when '>', '=' result = oldversion when '<' raise Puppet::Error, "Could not match version info #{portinfo.inspect}." \ unless (m = portinfo.match(/\((\w+) has (.+)\)/)) source, newversion = m[1, 2] debug "Newer version in #{source}" result = newversion when '?' warning "The installed package '#{pkgname}' does not appear in the " \ 'ports database nor does its port directory exist.' when '!' warning "The installed package '#{pkgname}' does not appear in the " \ 'ports database, the port directory actually exists, but the ' \ 'latest version number cannot be obtained.' when '#' warning "The installed package '#{pkgname}' does not have an origin " \ 'recorded.' else warning "Invalid status flag #{portstatus.inspect} for package " \ "'#{pkgname}' (returned by portversion command)." end result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def packages; end", "def package_by_name(package_name)\n raise RuntimeError, \"#{self.class} needs to overwrite package_by_name\"\n end", "def packages_for_multiple_projects\n ::Packages::Package.for_projects(projects_visible_to_current_user)\n end", "def main_package_se...
[ "0.68529814", "0.63911945", "0.6378435", "0.6211845", "0.6201613", "0.6183548", "0.6161018", "0.6161018", "0.6118878", "0.60997933", "0.6004001", "0.59475565", "0.593783", "0.59285367", "0.5928515", "0.5892291", "0.5878873", "0.58584064", "0.5849439", "0.58307993", "0.5830715...
0.0
-1
rubocop: enable MethodLength, AbcSize, CyclomaticComplexity
def query # support names, portorigin, pkgname and portname (inst = self.class.instances([name]).last) ? inst.properties : nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def implementation; end", "def implementation; end", "def probers; end", "def schubert; end", "def suivre; end", "def operations; end", "def operations; end", "def big_bad; end", "def anchored; end", "def intensifier; end", "def code_of_conduct; end", "def private_method...
[ "0.72250146", "0.6078558", "0.6078558", "0.60375524", "0.5952739", "0.58659685", "0.58367705", "0.58367705", "0.5815719", "0.5778662", "0.5742261", "0.572433", "0.5714145", "0.5681647", "0.5681647", "0.56810296", "0.56726754", "0.56726754", "0.56726754", "0.56726754", "0.5650...
0.0
-1
Time complexity: O(log10(n)), where n is the size of the integer Space complexity: O(1)
def is_palindrome(number) return false if number == nil || number < 0 i = 0 placeholder = number until placeholder == 0 placeholder /= 10 i += 1 end until i <= 0 i -= 1 if number % 10 != number / 10 ** i return false end number -= (number / 10 ** i) * 10 ** i number /= 10 i -= 1 end return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cout(n)\n\tw=[0,1,2,3,4,5,6,7,8,9]\n\tx=[]\n\tk=1\n\twhile x!=w do \n\t\tm=n*k\n\t\t\twhile m>0 do\n\t\t\t\tt=m%10\n\t\t\t\tx=x.push(t)\n\t\t\t\tx.sort!\n\t\t\t\tx.uniq!\n\t\t\t\tm=m/10\t\n\t\t\tend\n\t\tk=k+1\n\tend\nreturn (k-1)*n\nend", "def ten\n acc = 0\n (find_primes_below 2000000).each do |i|\n a...
[ "0.6577328", "0.6557303", "0.65161884", "0.6512071", "0.6447428", "0.6354096", "0.6325481", "0.631042", "0.6303311", "0.62792087", "0.6245064", "0.62183535", "0.6216077", "0.62157094", "0.6165188", "0.6143786", "0.6143318", "0.61393726", "0.61322135", "0.6126381", "0.61193496...
0.0
-1
START FUNCTIONALITY FOR SUGGESTING USERS TO FOLLOW
def get_following_ids_string following_ids = self.followed_users.pluck(:id) << self.id following_ids.reduce('(') { |final_string, id| final_string + id.to_s + ','}.chop + ')' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def follow\n\n end", "def calc_am_slow_start(user, target)\n VAL_0_5 if user.turn_count < 5\n end", "def follow_users\n puts \"Are you sure you want to follow ALL of the unique users of #{@other_user.strip}? Y/N\"\n @decision = gets\n\n case @decision.strip\n when \"Y\"\n @unique_user_ids.each ...
[ "0.6062817", "0.57808954", "0.5763881", "0.5717494", "0.57034856", "0.56508845", "0.5649488", "0.5628032", "0.56040424", "0.55827785", "0.55770415", "0.5572805", "0.5566614", "0.5560953", "0.555902", "0.5455062", "0.5446153", "0.5441281", "0.5426716", "0.5408663", "0.5404166"...
0.0
-1
END FUNCTIONALITY FOR SUGGESTING USERS TO FOLLOW
def get_nested_objects(self_association_method, pluck_field_sym, class_name) nested_objects_ids = self_association_method.pluck(pluck_field_sym) nested_objects_ids_string = nested_objects_ids.reduce('(') { |final_string, id| final_string + id.to_s + ','}.chop + ')' class_name.where("id in #{nested_objects_ids_string}") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def who_we_are\r\n end", "def probers; end", "def anchored; end", "def offences_by; end", "def schubert; end", "def suivre; end", "def leeway; end", "def leeway; end", "def wagner; end", "def superweening_adorningly(counterstand_pyrenomycetales)\n end", "def hints; end", "def corrections;...
[ "0.63558847", "0.61740404", "0.6112337", "0.6101196", "0.60748804", "0.60437024", "0.60307425", "0.60307425", "0.5789904", "0.5751886", "0.57350695", "0.5722713", "0.57193244", "0.56930184", "0.5672694", "0.56418943", "0.56165177", "0.5614019", "0.5610782", "0.5591751", "0.55...
0.0
-1
GET /toon_skill_levels/1 GET /toon_skill_levels/1.xml
def show @toon_skill_level = ToonSkillLevel.find(:first, :conditions => ["id = ?", params[:id]], :select => "id, toon_id, source_id, skill_level") users_toon = Toon.find(:first, :conditions => ["id = ?", @toon_skill_level.toon_id], :select => "id, user_id").user_id == current_user[:id] respond_to do |format| if users_toon then format.html # show.html.erb format.xml { render :xml => @toon_skill_level } else format.html {redirect_to(signin_path, :notice => "You can only see your own toon's professions")} end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @skill_levels = SkillLevel.all\n end", "def show\n @skill_level = SkillLevel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @skill_level }\n end\n end", "def new\n @skill_level = SkillLevel.new\n\n respond_to d...
[ "0.6592805", "0.6584417", "0.59871286", "0.598656", "0.58953714", "0.58799875", "0.58799875", "0.5790204", "0.5724749", "0.5705815", "0.5677201", "0.5670371", "0.56397814", "0.5613299", "0.55872643", "0.5553315", "0.5551541", "0.5542237", "0.5509238", "0.54960763", "0.5486804...
0.5844208
7
GET /toon_skill_levels/new GET /toon_skill_levels/new.xml
def new @toon_skill_level = ToonSkillLevel.new @toon = Toon.find(:all, :conditions => ["user_id = ?", current_user[:id]], :order => "name", :select => "id, name") @source = Source.find(:all, :conditions => ["crafting_allowed = ?", true], :order => "description", :select => "id, description") respond_to do |format| format.html # new.html.erb format.xml { render :xml => @toon_skill_level } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @skill_level = SkillLevel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @skill_level }\n end\n end", "def create\n @skill_level = SkillLevel.new(params[:skill_level])\n\n respond_to do |format|\n if @skill_level.save\n f...
[ "0.7595437", "0.7301642", "0.7045477", "0.69104534", "0.68243027", "0.6780718", "0.6740713", "0.6740161", "0.6738661", "0.6651608", "0.66498244", "0.65685767", "0.64801365", "0.6434836", "0.6427862", "0.6421659", "0.6419659", "0.6417373", "0.6350163", "0.63414985", "0.6335201...
0.7419419
1
POST /toon_skill_levels POST /toon_skill_levels.xml
def create @toon_skill_level = ToonSkillLevel.new(params[:toon_skill_level]) @source = Source.find(:all, :conditions => ["crafting_allowed = ?", true], :order => "description", :select => "id, description") users_toon = Toon.find(:first, :conditions => ["id = ?", @toon_skill_level.toon_id], :select => "id, user_id").user_id == current_user[:id] respond_to do |format| if @toon_skill_level.save format.html { redirect_to(@toon_skill_level, :notice => 'Toon skill level was successfully created.') } format.xml { render :xml => @toon_skill_level, :status => :created, :location => @toon_skill_level } else format.html { render :action => "new" } format.xml { render :xml => @toon_skill_level.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @skill_level = SkillLevel.new(params[:skill_level])\n\n respond_to do |format|\n if @skill_level.save\n format.html { redirect_to(@skill_level, :notice => 'SkillLevel was successfully created.') }\n format.xml { render :xml => @skill_level, :status => :created, :location => @...
[ "0.6535228", "0.64989567", "0.6484885", "0.6295518", "0.5807421", "0.5801166", "0.57038677", "0.56923854", "0.5668176", "0.5656692", "0.5654246", "0.5645057", "0.564001", "0.56392294", "0.5628134", "0.56251353", "0.5614152", "0.5608082", "0.55889964", "0.55837", "0.55520123",...
0.6482549
3
PUT /toon_skill_levels/1 PUT /toon_skill_levels/1.xml
def update @toon_skill_level = ToonSkillLevel.find(:first, :conditions => ["id = ?", params[:id]], :select => "id, toon_id, source_id, skill_level") respond_to do |format| if @toon_skill_level.update_attributes(params[:toon_skill_level]) format.html { redirect_to(@toon_skill_level, :notice => 'Toon skill level was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @toon_skill_level.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @skill_level = SkillLevel.find(params[:id])\n\n respond_to do |format|\n if @skill_level.update_attributes(params[:skill_level])\n format.html { redirect_to(@skill_level, :notice => 'SkillLevel was successfully updated.') }\n format.xml { head :ok }\n else\n forma...
[ "0.70271856", "0.6689988", "0.6571936", "0.64211905", "0.6244261", "0.61687684", "0.61451495", "0.61076075", "0.61010927", "0.6091394", "0.60449344", "0.6039102", "0.6035729", "0.6031875", "0.597826", "0.5963096", "0.5960884", "0.5947074", "0.59223974", "0.59073347", "0.58995...
0.72782505
0
DELETE /toon_skill_levels/1 DELETE /toon_skill_levels/1.xml
def destroy @toon_skill_level = ToonSkillLevel.find(:first, :conditions => ["id = ?", params[:id]], :select => "id, toon_id, source_id, skill_level") @toon_skill_level.destroy respond_to do |format| format.html { redirect_to(toon_skill_levels_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @skill_level = SkillLevel.find(params[:id])\n @skill_level.destroy\n\n respond_to do |format|\n format.html { redirect_to(skill_levels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vip_skill.destroy\n respond_to do |format|\n format.html { redirec...
[ "0.72608745", "0.662595", "0.66110206", "0.6514028", "0.6512183", "0.6469977", "0.63883936", "0.6373307", "0.6262461", "0.6260746", "0.6240075", "0.6205362", "0.6205067", "0.619331", "0.61807233", "0.61611897", "0.6158469", "0.61539954", "0.61503565", "0.61176956", "0.611696"...
0.7448428
0
Create methods to get our path, method, post data, and request headers
def path return @path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_request(method); end", "def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end", "def request_method; end", "def kernel_prepare\n $METHOD = get_method\n $HEADERS = get_head...
[ "0.7049", "0.6846964", "0.6844459", "0.6810579", "0.67337334", "0.6611206", "0.65719277", "0.65302056", "0.6527001", "0.651718", "0.651718", "0.6482838", "0.6460604", "0.6424962", "0.6393799", "0.63499033", "0.634828", "0.63475895", "0.6322815", "0.6319989", "0.6313066", "0...
0.0
-1
Allow a cutsom status to be sent if the user doesn't want to send 404 or 200
def status(stat) @headers << "HTTP/1.1 #{stat}\r\n" @accepted = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_not_acceptable\n respond_to do |format|\n format.any { head :not_acceptable }\n end\n end", "def status_forbidden\n respond_to do |format|\n format.any { head :forbidden }\n end\n end", "def status(value = nil)\n\t\t\tresponse.status ||= 200\n\t\t\tresponse.headers['X-Cascade...
[ "0.7273065", "0.7081744", "0.7005686", "0.68556565", "0.6844323", "0.67722", "0.67586666", "0.67586666", "0.67206734", "0.6606858", "0.65859425", "0.65859425", "0.65859425", "0.65662074", "0.6562147", "0.6548339", "0.6538879", "0.6538879", "0.653691", "0.6517775", "0.6500884"...
0.0
-1
Allow a custom content type to be set
def content_type(type) @headers << "Content-Type: #{type}\r\n" @content_type = true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def content_type=(content_type); end", "def content_type=(value)\n @content_type = value\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set_ContentType(value)\n set_input(\"ContentType\", value)\n end", "def set...
[ "0.8078528", "0.7788997", "0.7621972", "0.7621972", "0.7621972", "0.7621972", "0.76041114", "0.7547337", "0.7502296", "0.7444515", "0.7444515", "0.7415505", "0.7384144", "0.7384144", "0.736611", "0.73594904", "0.73550177", "0.7351174", "0.7350838", "0.73063445", "0.73015046",...
0.69900686
41
Basically just the anti of accept, allow for 404 messages to be sent
def not_found content_type("text/plain") @headers << "HTTP/1.1 404 Not Found\r\nServer: Rsws/0.1.0\r\n" puts "#{@method} #{@path} 404 Not Found" send end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_not_acceptable\n respond_to do |format|\n format.any { head :not_acceptable }\n end\n end", "def check_404\n end", "def on_ignored_request\n end", "def not_found\n respond_with 404\n end", "def not_found\n respond_with 404\n end", "def accept!\n accepted!\n end"...
[ "0.6617129", "0.6461133", "0.63767666", "0.63579744", "0.63183665", "0.63063073", "0.6251171", "0.62176", "0.6213253", "0.61377996", "0.61350816", "0.61350816", "0.61350816", "0.613149", "0.61130315", "0.60992736", "0.6097285", "0.6082178", "0.60681945", "0.60645014", "0.6064...
0.61644185
9
Read and send in a file
def send_file(path) @buffer = File.read(path) send end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def recieve_and_read_file\n read_file(@message)\n end", "def send_file(path); end", "def read_request(client, filename)\n aFile = File.open(filename, 'r')\n if aFile\n contents = File.read(filename)\n client.puts \"\\n\\nCONTENTS OF #{filename}\\n*****************\\n\\n#{contents}\\n\\n****...
[ "0.76245517", "0.7259722", "0.6848899", "0.6653362", "0.6651551", "0.6633001", "0.6626497", "0.66159743", "0.65744656", "0.65270203", "0.6497912", "0.6453595", "0.6385853", "0.6360456", "0.6300694", "0.6292925", "0.62244266", "0.6186702", "0.61769277", "0.61628926", "0.609747...
0.7691146
0
The following print data to the buffer
def puts(msg) @buffer << "#{msg}\n" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def print_buffer(buf)\n $stdout.print buf if @flush_buffer\n $stdout.flush unless $stdout.sync\n end", "def print(str)\n @buf << str\n end", "def buffer; end", "def buffer; end", "def buffer; end", "def write(buf); end", "def process_output(buf)\n force_utf8(buf)\n print_buffer(buf)\n\...
[ "0.747795", "0.69192195", "0.68793905", "0.68793905", "0.68793905", "0.6866643", "0.6801474", "0.67653394", "0.6699243", "0.66595554", "0.6649778", "0.6649778", "0.6555269", "0.6498804", "0.6497007", "0.64959955", "0.6490964", "0.64864117", "0.64861256", "0.64834815", "0.6471...
0.66093385
12
When we're finally done, send all the data to the client
def send if @accepted then # Calculate content length before sending @headers << "Content-Length: #{@buffer.length}\r\n" if !@content_type then @headers << "Content-Type: text/html\r\n" end # Send our data and close the connection @server.puts @headers @server.puts "\r\n" @server.puts @buffer @server.close else puts "[Rsws] ERROR: Trying to send response without first accepting it" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def done\n @closed = true\n send_headers\n ::EM.next_tick { @body.succeed }\n end", "def done\n client.exit\n end", "def flush\n @socket.flush if @socket\n end", "def flush\n @sendbuf_lock.synchronize {\n while @sendbuf.size > 0\n send_data(@sendbu...
[ "0.6881462", "0.6643862", "0.64741075", "0.64736176", "0.64361966", "0.6423211", "0.64021903", "0.64021903", "0.6375806", "0.6375806", "0.6375806", "0.6372827", "0.63664556", "0.6334271", "0.6288299", "0.6288299", "0.62447715", "0.6240573", "0.62306064", "0.62265176", "0.6209...
0.5791913
70
Where most of the logic happens
def run loop do client_sock = @server.accept client = Rsws_client.new(client_sock) yield client end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def processor; end", "def operations; end", "def operations; end", "def private; end", "def probers; end", "def post_process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end...
[ "0.64711285", "0.6438143", "0.6438143", "0.6320902", "0.62910354", "0.6235963", "0.6094996", "0.6094996", "0.6094996", "0.6094996", "0.6094996", "0.6094996", "0.6094996", "0.6094996", "0.6073556", "0.6045877", "0.6045877", "0.6035398", "0.6006725", "0.5980524", "0.5980524", ...
0.0
-1
load_and_authorize_resource :member, class: 'User'
def index if current_user.has_role?(:superadmin) @users = User.with_role(:member). order(:email). search(filter). paginate(page: params[:page], per_page: 12) else redirect_to authenticated_root_url, alert: 'You are not authorized to access this page.' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_users\n authorize :user\n end", "def show\n @user = User.find(params[:id])\n authorize @user\n end", "def find_user\n @user = User.find(params[:id])\n authorize @user\n end", "def show\n authorize @user\n end", "def show\n authorize @user\n end", "def set_user\n ...
[ "0.7128278", "0.6961245", "0.69008774", "0.685875", "0.685875", "0.68382126", "0.6756836", "0.6734789", "0.6709979", "0.6709979", "0.67012364", "0.6654253", "0.66314894", "0.6578167", "0.6578167", "0.6566601", "0.6559037", "0.6550981", "0.65381014", "0.65261865", "0.6514525",...
0.0
-1
def member_params params.require(:user).permit(:email, :password) end
def filter @filter = params[:q] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def member_params\n params.permit(:email, :password)\n end", "def member_params\n\t\tparams.require(:member).permit(:username, :password)\n\tend", "def user_params\n params.require(:member).permit!\n end", "def member_params\n params.require(:member).permit(:email, :name, :passwo...
[ "0.9580385", "0.9385843", "0.91763717", "0.9133077", "0.9128022", "0.9016194", "0.89968574", "0.8957559", "0.88525265", "0.8771629", "0.8621671", "0.8594492", "0.85056823", "0.8421323", "0.8410655", "0.84097123", "0.8402229", "0.8383458", "0.8352991", "0.83163625", "0.8315772...
0.0
-1
PUT /renters/1 PUT /renters/1.json
def update @renter = Renter.find(params[:id]) respond_to do |format| if @renter.update_attributes(params[:renter]) format.html { redirect_to @renter, notice: 'Renter was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @renter.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @renter = Renter.find(params[:id])\n\n respond_to do |format|\n if @renter.update_attributes(params[:renter])\n format.html { redirect_to @renter, :notice => 'Renter was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"...
[ "0.6693333", "0.662878", "0.6618143", "0.6319349", "0.6180283", "0.61791074", "0.6168684", "0.6096566", "0.6091855", "0.583134", "0.57391393", "0.57235396", "0.57141906", "0.56759006", "0.5636818", "0.5614106", "0.557738", "0.5555812", "0.5546365", "0.553929", "0.55323476", ...
0.6673322
1
DELETE /renters/1 DELETE /renters/1.json
def destroy @renter = Renter.find(params[:id]) @renter.destroy respond_to do |format| format.html { redirect_to renters_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @renter.destroy\n respond_to do |format|\n format.html { redirect_to renters_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @renter = Renter.find(params[:id])\n @renter.destroy\n\n respond_to do |format|\n format.html { redirect_to renters_ur...
[ "0.74639994", "0.74578124", "0.7119949", "0.6624053", "0.6573586", "0.65502185", "0.65438515", "0.6527255", "0.65249985", "0.6522564", "0.6515491", "0.6512301", "0.6512301", "0.6504901", "0.64909214", "0.6484019", "0.6483613", "0.6469262", "0.64529055", "0.6438567", "0.641031...
0.74660707
0
GET /users GET /users.json
def index # FIXME: if logged in as an author, only show own user's crUd stuff; for # admins, show all CRUD operations for all users if logged_in? @users = User.order(:name) else respond_to do |format| format.html { redirect_to root_url, notice: 'Cannot view all users.' } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n para...
[ "0.8208805", "0.7873034", "0.7858698", "0.78104997", "0.7803906", "0.76755923", "0.7655751", "0.76297164", "0.75797266", "0.75276095", "0.74864763", "0.7446078", "0.7437236", "0.74351376", "0.74251926", "0.73960173", "0.73960173", "0.73960173", "0.73960173", "0.73748064", "0....
0.0
-1
GET /users/1 GET /users/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n ...
[ "0.81046426", "0.7703556", "0.77011716", "0.76262826", "0.7582106", "0.74818", "0.7461394", "0.7446168", "0.730656", "0.7300699", "0.72902125", "0.72781444", "0.72358584", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.72335744", "0.722...
0.0
-1
POST /users POST /users.json
def create @user = User.new(user_params) respond_to do |format| if @user.save format.html { redirect_to @user, notice: 'User was successfully created.' } format.json { render :show, status: :created, location: @user } else format.html { render :new } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69...
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update respond_to do |format| if @user.update(user_params) format.html { redirect_to @user, notice: 'User was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "de...
[ "0.7225568", "0.7129473", "0.70036036", "0.6903525", "0.6821961", "0.68157715", "0.6708618", "0.66936064", "0.66810983", "0.6673763", "0.6672601", "0.6664346", "0.6664346", "0.6659468", "0.6659468", "0.6654875", "0.66486204", "0.66436917", "0.6641295", "0.6635214", "0.6618464...
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user.destroy respond_to do |format| format.html { redirect_to users_url, notice: 'User was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.78736883", "0.7750104", "0.77121806", "0.76086843", "0.7469663", "0.7404115", "0.7404115", "0.7366872", "0.7342664", "0.7337474", "0.7324886", "0.73062795", "0.73061144", "0.73034054", "0.72948426", "0.728822", "0.7287865", "0.72866887", "0.72804254", "0.7247041", "0.72470...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_user @user = User.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:name, :password, :password_confirmation) 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
Check for the existance of a generic Windows NT service.
def windows?(id, verbose=false) logger.trace "executing locally: sc query \"#{id}\"" if logger and verbose $1.to_i if `sc query "#{id}"` =~ /STATE +: +([0-9])+ +([^ ]+)/ ensure logger.trace " service status => #{$2} (#{$1})" if logger and verbose end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def windows_service_exists?(service)\n if defined?(Win32)\n ::Win32::Service.exists?(service)\n else\n false\n end\n end", "def exists?(service_name)\n open_service(service_name, SC_MANAGER_CONNECT, SERVICE_QUERY_STATUS) do |_|\n true\n end\n rescue...
[ "0.73590994", "0.6840361", "0.65441656", "0.6457661", "0.63942856", "0.6315684", "0.6283908", "0.6262255", "0.6242067", "0.6186856", "0.617068", "0.61270523", "0.60828173", "0.6042172", "0.6006012", "0.6006012", "0.58019394", "0.5776132", "0.5708773", "0.5706877", "0.569856",...
0.54830974
36
Defines a recipe to control a generic Windows NT service.
def windows(id,*args) options = Hash===args.last ? args.pop : {} svc_name = id.to_s svc_desc = next_description(:reset) || (svc_name.capitalize unless options.delete(:hide)) svc_actions = DEFAULT_ACTIONS svc_actions += args.pop if Array === args.last namespace id do case args.first when String; id = args.shift.intern when Symbol; id = args.shift end [:default, :status].each do |k| desc "#{svc_desc}: #{SVC_ACTION_CAPTIONS[:status]}" if svc_desc task k, options do service.windows? id, true or abort "Failed to get service status for #{svc_name}" end end DEFAULT_ACTIONS.each do |svc_action| svc_action = svc_action.intern if String === svc_action desc "#{svc_desc}: #{SVC_ACTION_CAPTIONS[svc_action]}" if svc_desc task svc_action, options do local_run "net #{svc_action} \"#{id}\"" end end desc "#{svc_desc}: #{SVC_ACTION_CAPTIONS[:restart]}" if svc_desc task :restart, options do case service.windows?(id) when 4, 2; stop when NilClass; abort "Failed to get service status for #{svc_name}" end start end instance_eval { yield } if block_given? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_service(resource, actions)\n service_name = get_service_name()\n\n case resource.service_type\n when \"upstart\"\n service service_name do\n provider Chef::Provider::Service::Upstart\n supports :status => true, :restart => true, :reload => true\n action a...
[ "0.6386172", "0.615455", "0.6151659", "0.6126648", "0.5937976", "0.5734985", "0.5724599", "0.570082", "0.5592431", "0.5514095", "0.5501322", "0.54961544", "0.5395047", "0.53913736", "0.5377328", "0.5375335", "0.535128", "0.53434074", "0.5273689", "0.52585804", "0.5232232", ...
0.56372744
8
Calls the function represented passing params.
def invoke *o,&b @invoker ||= create_invoker() invoker.invoke *o,&b end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run_function(name, params)\n payload = Payload.new\n payload.function_name = name\n payload.params = params\n call_route(:function, name, payload)\n end", "def my_function(param)\n param.call\n end", "def call\n @func[*@args]\n end", "def call(*params)\n ...
[ "0.7399359", "0.71747637", "0.7012487", "0.69831616", "0.6882025", "0.6839063", "0.6527474", "0.6527474", "0.6502418", "0.6499302", "0.64414513", "0.64338845", "0.6425923", "0.6406874", "0.6387432", "0.6355957", "0.62929785", "0.625523", "0.6239711", "0.62246686", "0.622347",...
0.0
-1
Binds function by defining a method on `where` to `name`.
def attach where,name this = self where.singleton_class.define_method(name) do |*args, &b| this.invoke(*args, &b) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def where_func(func) # :nodoc:\n func ? {:$where => func} : {}\n end", "def alias_column_method(params)\n logical_name = params[:new]\n original_name = params[:original]\n \n define_method logical_name do\n self.send(original_name)\n end \n ...
[ "0.59076357", "0.55041987", "0.5487596", "0.5481917", "0.54181504", "0.53776705", "0.5355881", "0.5314712", "0.5290807", "0.52755636", "0.5209774", "0.5179415", "0.51789653", "0.51780844", "0.51736677", "0.51732916", "0.5170367", "0.5162984", "0.514929", "0.5133519", "0.51110...
0.72004783
0
Invokes the function passing paramaters.
def call *o raise ArgumentError.new("#{o.length} for #{arguments.length}") unless o.length == arguments.length invoked = [] arguments.each_with_index do |a,i| a.set o[i] ptr = a.for_invoke if a.value == nil # do not wrap nil, pass it as is ! invoked << nil else invoked << ptr end end # call the function r = @lib.call(get_return_type,@name.to_s,*invoked) arguments.each do |a| a.set nil end return(@return_type.type == :void ? nil : @return_type.to_ruby(r)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def _perform(args); end", "def invoke(fun, args, normal, exception, name = \"\")\n invoke2(nil, fun, args, normal, exception, name)\n end", "def call\n @func[*@args]\n end", "def call(*args); end", "def invoke(args)\n @call_back.call *args\n end", "def invoke\n execute_only(:...
[ "0.69853735", "0.67797333", "0.66935813", "0.668284", "0.6669006", "0.665285", "0.66512525", "0.66500175", "0.6619743", "0.6576779", "0.6574878", "0.6565331", "0.6540124", "0.6526148", "0.6487505", "0.64221084", "0.6418565", "0.6380387", "0.6343872", "0.63340807", "0.6307978"...
0.0
-1
TODO use the xdoc if available
def test_assert_xhtml_for_forms assert_xhtml SAMPLE_FORM, &assemble_form_example end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def doc; end", "def doc; end", "def doc; end", "def doc; end", "def docs; end", "def request_doc\n \n end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def document; end", "def do...
[ "0.7461044", "0.7461044", "0.7461044", "0.7461044", "0.74007434", "0.72796506", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", "0.7044701", ...
0.0
-1
TODO blog that we return the first top node!
def test_assert_xhtml_counts_its_shots assert_xhtml SAMPLE_LIST do ul :style => 'font-size: 18' do li 'model' do li :xpath! => 'position() = 1' do text 'Billings report' end li :xpath! => 'position() = 2' do text /sales report/i end li :xpath! => '1' do text 'Billings report' end li :xpath! => '3' do text 'Billings criteria' end end end end @teh_scope_bug_be_fixed = 'Billings report' assert_xhtml SAMPLE_LIST do |x| x.li /model/ do x.without! do x.li :xpath! => 'position() = 2' do x.text @teh_scope_bug_be_fixed end end end end assert_xhtml_flunk SAMPLE_LIST do ul :style => 'font-size: 18' do li 'model' do li(:xpath! => '1'){ text 'Sales report' } li(:xpath! => '2'){ text 'Billings report' } li(:xpath! => '3'){ text 'Billings criteria' } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def top\n self.root.first\n end", "def node_first\n @head\n end", "def peek\n @nodes[0]\n end", "def peek\n @nodeset[1]\n end", "def head\n return @root\n end", "def top()\n return @head ? @head.val : nil\n end", "def first(path_stack, node); end", "def fir...
[ "0.7796771", "0.76678413", "0.73096323", "0.7093668", "0.7093483", "0.7042912", "0.6989409", "0.6939879", "0.68330675", "0.6807096", "0.6798415", "0.6787534", "0.6785769", "0.6785495", "0.6747505", "0.6745957", "0.673782", "0.67368394", "0.6729105", "0.67263174", "0.6690867",...
0.0
-1
TODO diagnostic message for be_html_with!
def test_censor_bangs assert_xhtml '<select/>' do select! end assert_xhtml_flunk SAMPLE_FORM do select! :id => 42 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def html?; end", "def html?; end", "def html?; end", "def inner_html(options = T.unsafe(nil)); end", "def html_markup_html(text); end", "def html=(b); end", "def to_html; end", "def inner_html(*args); end", "def inner_html(*args); end", "def html_markup_org(text); end", "def inner_html\n #...
[ "0.78294414", "0.78294414", "0.78294414", "0.7222857", "0.7169356", "0.7137272", "0.7120507", "0.7059173", "0.7059173", "0.6889796", "0.6875814", "0.6818779", "0.6818779", "0.6799076", "0.6727494", "0.66917455", "0.66368186", "0.66368186", "0.66368186", "0.66368186", "0.66281...
0.0
-1
ERGO this test does not actually cover anything...
def toast_verbosity assert_xhtml SAMPLE_FORM do fieldset do legend 'Personal Information' li :verbose! => true do label 'First name', :for => :user_name input :type => :text, :name => 'user[name]' br end end end # TODO verbose is supposed to work even if the inner html has a bug! end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spec; end", "def spec; end", "def private; end", "def self_test; end", "def self_test; end", "def __dummy_test__\n end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def assertions; end", "def assertions; end", "def covered?; end", "def checks; end",...
[ "0.6721908", "0.6721908", "0.6451249", "0.6312835", "0.6312835", "0.62679803", "0.6195358", "0.6195358", "0.6195358", "0.6195358", "0.6096406", "0.6096406", "0.6080465", "0.6072394", "0.60717356", "0.6007749", "0.5961604", "0.59545773", "0.59467953", "0.5945298", "0.5903289",...
0.0
-1
TODO does the latest assert_raise take a Regexp
def test_assert_xhtml_queries_by_complete_path assert_xhtml SAMPLE_LIST do ul{ li{ ul{ li 'Sales report' } } li{ ul{ li 'All Sales report criteria' } } } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assertMatchFailTest pattern, value\n rescue_assertion ASSERT_MATCH_ERROR do\n assertMatch pattern, value\n end\n end", "def expect_error(xml, regex, line = nil, col = nil, pos = nil)\n\tbegin\n\t toker = NQXML::Tokenizer.new(xml)\n\t toker.each { | tok | }\n\t assert_fail(\"expec...
[ "0.6834203", "0.68314755", "0.6715854", "0.6633846", "0.66193306", "0.6590961", "0.6577587", "0.6525624", "0.65255207", "0.65102136", "0.6503964", "0.64906055", "0.64799356", "0.64696527", "0.64408165", "0.6406131", "0.6399929", "0.63845533", "0.6346503", "0.63456416", "0.634...
0.0
-1
GET /food_deliveries GET /food_deliveries.json
def index @halalfoodhunt_seos = HalalfoodhuntSeo.all @search = FoodDelivery.ransack(params[:q]) @search.sorts = 'created_at DESC' if @search.sorts.empty? @food_deliveries = @search.result.where(draft: false) @qualifying_type = QualifyingType.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def index\n json_response(current_restaurant.restaurant_food_items)\n end", "def index\n @food_products = FoodProduct.all\n render json: @food_products\n end", "def list(options = {})\n get(\"customers/#{custome...
[ "0.66024446", "0.6388341", "0.63016", "0.626077", "0.6258108", "0.62522215", "0.62522215", "0.62274534", "0.6200089", "0.6151743", "0.61489344", "0.61392796", "0.61328256", "0.6097653", "0.60629886", "0.604636", "0.6012476", "0.5998075", "0.59830964", "0.59332883", "0.5925682...
0.57222575
37
GET /food_deliveries/1 GET /food_deliveries/1.json
def show @search = FoodDelivery.ransack(params[:q]) @food_deliveries = @search.result.where(draft: false) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "def retrieve(delivery_id)\n get(\"customers/#{customer_id}/deliveries/#{delivery_id}\")\n end", "def show\n #get the deliverable id from URL\n @deliverable = Deliverable.find(params[:id])\n #get the deliverable type for ...
[ "0.6780181", "0.6449821", "0.63358766", "0.62702715", "0.6251159", "0.6218465", "0.6214328", "0.61954886", "0.6188699", "0.61706287", "0.61603045", "0.6124126", "0.6124126", "0.6121847", "0.6113426", "0.60798186", "0.60660744", "0.5986459", "0.59823704", "0.5937837", "0.59356...
0.5655962
42
POST /food_deliveries POST /food_deliveries.json
def create @food_delivery = current_merchant.food_deliveries.new(food_delivery_params) respond_to do |format| if @food_delivery.save format.html { redirect_to @food_delivery, notice: 'Food delivery was successfully created.' } format.json { render :show, status: :created, location: @food_delivery } else format.html { render :new } format.json { render json: @food_delivery.errors, status: :unprocessable_entity } end end @food_delivery.food_delivery_type_ids = params[:food_delivery][:food_delivery_type_ids] @food_delivery.food_item_ids = params[:food_delivery][:food_item_ids] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n json_response(current_restaurant.restaurant_food_items.create!(food_item_params), :created)\n end", "def create\n @food = @fridge.foods.create(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def create(options = {})\n post(\"customers/#{custo...
[ "0.6444413", "0.6403582", "0.63438463", "0.63262266", "0.6266596", "0.62604547", "0.6191418", "0.6139031", "0.6094875", "0.60619324", "0.60593945", "0.5975809", "0.59602803", "0.5947383", "0.5933388", "0.5897042", "0.5895301", "0.5876572", "0.5876234", "0.58606696", "0.585059...
0.7114783
0
PATCH/PUT /food_deliveries/1 PATCH/PUT /food_deliveries/1.json
def update respond_to do |format| if @food_delivery.update(food_delivery_params) format.html { redirect_to @food_delivery, notice: 'Food delivery was successfully updated.' } format.json { render :show, status: :ok, location: @food_delivery } else format.html { render :edit } format.json { render json: @food_delivery.errors, status: :unprocessable_entity } end end @food_delivery.food_delivery_type_ids = params[:food_delivery][:food_delivery_type_ids] @food_delivery.food_item_ids = params[:food_delivery][:food_item_ids] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @food.update(food_params)\n respond_with @food, location: -> { kitchen_board_path }\n end", "def update\n json_response(@food_item.update!(food_item_params))\n end", "def update\n @food = Food.find(params[:id])\n\n respond_to do |format|\n if @food.update_attributes(p...
[ "0.6738258", "0.6642931", "0.63942826", "0.63551813", "0.6221442", "0.6215893", "0.6209553", "0.61815065", "0.6179871", "0.6172536", "0.615038", "0.61378765", "0.6136614", "0.61263996", "0.6116029", "0.6112439", "0.6106612", "0.6098979", "0.60607934", "0.60433894", "0.5998791...
0.66135573
2
DELETE /food_deliveries/1 DELETE /food_deliveries/1.json
def destroy @food_delivery.destroy respond_to do |format| format.html { redirect_to food_deliveries_url, notice: 'Food delivery was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { redirect_to foods_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food = Food.find(params[:id])\n @food.destroy\n\n respond_to do |format|\n format.html { re...
[ "0.71006143", "0.71006143", "0.6978009", "0.6952066", "0.69147426", "0.68827564", "0.687212", "0.68696237", "0.6835201", "0.6835201", "0.6835201", "0.68315595", "0.682219", "0.68008", "0.68005913", "0.67852825", "0.67852247", "0.67678", "0.6765018", "0.67531365", "0.6752458",...
0.7241808
0
Use callbacks to share common setup or constraints between actions.
def set_food_delivery @food_delivery = FoodDelivery.friendly.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def food_delivery_params params.require(:food_delivery).permit(:brand_name, :general_email, :contactable_hours, :general_contact_number, :website, :ordering_link, :facefood_delivery, :instagram, :question_1, :question_2, :question_3, :question_4, :question_5, :expiry_date, :halal_expiry, :friends_rewards_terms, :merchant_id, :draft, :verified, :friends_reward_id, :listing_id, :region_id, :cuisine_type_id, :food_delivery_type_id, :delivery_location_id, :price_range_id, :friends_code, :qualifying_type_id, :featured_image, :image, :image_2, :image_3, :image_4, :document_1, :document_2, :document_3, :document_4, :logo, food_item_ids: []) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
Get the next turn for the given player
def next_turn(player) Turn.new(player, self.min, self.max) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_player\n\t\tvar = -1\n\t\tvar = 1 if self.flowing_right\n\t\tplayers_remaining = self.players_remaining\n\t\tlast_turn = self.turns.last\n\t\tplayers_remaining[(players_remaining.index(last_turn.player) + var) % players_remaining.size]\n\tend", "def next_turn\n if @current_player == @player_1\n ...
[ "0.8242226", "0.78034586", "0.7772463", "0.77520466", "0.7709306", "0.7670125", "0.7637821", "0.75535005", "0.75535005", "0.7516568", "0.74944985", "0.74272406", "0.7338559", "0.71557915", "0.71172065", "0.7077265", "0.6971292", "0.69232994", "0.68703204", "0.6827959", "0.682...
0.81318605
1
Display both players' scores and lives
def display_status puts self.playerOne.status puts self.playerTwo.status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_scores\n puts \"P1: #{@player1.lives}/3 vs P2: #{@player2.lives}/3\"\n end", "def print_scores\n puts \"+--------------+\"\n @players.each do |player|\n puts \"| Player #{player.player_number} : #{player.lives} |\"\n end\n puts \"+--------------+\"\n end", "def display_scorebo...
[ "0.87124336", "0.8285432", "0.79732347", "0.7935359", "0.76798934", "0.76796794", "0.7672872", "0.75650537", "0.75481224", "0.7540017", "0.7475963", "0.74383134", "0.74044883", "0.7395785", "0.729339", "0.7272092", "0.72691953", "0.7250698", "0.70677525", "0.70538306", "0.700...
0.6451059
59
Definiert das Verhalten von Buttons und Formularen anhand des ClaimStatus Bestimmte Buttons und Formularfelder sollen deaktiviert bzw. Readonly sein, wenn der Claim abgeschlossen ist
def define_form_behaviour(claim) if claim.is_terminated? logger.info("Current claim is terminated, setting readonly form behaviour.") @readonly_form = true else @readonly_form = false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_status_from_buttons(params, draft_check=false)\r\n if(draft_check and params['savedraft.x'])\r\n self.draft = true\r\n elsif params['publish.x'] || params[:clicked_button] == 'publish' || params['makepublic.x']\r\n self.priv = false\r\n self.draft = false\r\n elsif params['unpubl...
[ "0.5743132", "0.55726343", "0.55714303", "0.55628246", "0.5561803", "0.54462963", "0.5419232", "0.54008263", "0.53815454", "0.53698266", "0.5341386", "0.5336147", "0.53263766", "0.52941984", "0.528589", "0.5281368", "0.5259035", "0.52489597", "0.5237752", "0.5229303", "0.5228...
0.54359025
6
Confirms a loggedin user.
def logged_in_user unless logged_in? store_location flash[:danger] = "Bitte anmelden." redirect_to login_url end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def correct_user\n @user = User.find(params[:id])\n if !current_user?(@user)\n message = \"currently logged in as #{current_user.name}. Not you? \"\n message += \"#{view_context.link_to('Log out.', log_out)}\".html_safe\n flash[:warning] = message\n redirect_to(root_url)\n ...
[ "0.70087826", "0.6982988", "0.6919373", "0.688131", "0.6845446", "0.68326277", "0.67944413", "0.67929715", "0.6642435", "0.6624581", "0.66114175", "0.66022736", "0.6589018", "0.65539706", "0.65349805", "0.65303934", "0.6512816", "0.650312", "0.64878744", "0.6487622", "0.64804...
0.0
-1
Modules in Curate's CurationConcern::Work that we _might_ pull in later include Curate::ActiveModelAdaptor include CurationConcern::WithLinkedContributors include CurationConcern::WithRelatedWorks
def to_solr(solr_doc={}, opts={}) super(solr_doc).tap do |solr_doc| Solrizer.set_field(solr_doc, 'generic_type', 'Work', :facetable) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def work_types\n Hyrax.config.curation_concerns\n end", "def concerns(*args); end", "def show_presenter\n # CurationConcerns::WorkShowPresenter\n ::SamplePresenter\n end", "def work\n raise \"implement this in a class that includes this module\"\n end", "def curation\n end", "def ...
[ "0.64043164", "0.58211786", "0.55948895", "0.54414105", "0.53949153", "0.52994263", "0.52961236", "0.52814156", "0.5220372", "0.5164837", "0.51597023", "0.51521623", "0.51142627", "0.50922644", "0.5070346", "0.5011336", "0.49949664", "0.49765077", "0.49506372", "0.49379689", ...
0.0
-1
waitpid(pid_t pid, int stat_loc, int options);
def waitpid(pid, opt=1) pstatus = ("\x00"*SIZEOFINT).to_ptr r = CALLS["libc!waitpid:IPI=I"].call(pid, pstatus, opt).first raise SystemCallError.new("waitpid", DL.last_error) if r == -1 return [r, pstatus.to_s(SIZEOFINT).unpack('i_').first] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def waitpid(pid, opt=1)\n pstatus = (\"\\x00\"*SIZEOFINT).to_ptr\n r = CALLS[\"libc!waitpid:IPI=I\"].call(pid, pstatus, opt).first\n raise SystemCallError.new(\"waitpid\", DL.last_error) if r== -1\n \n # maybe I should return a Hash?\n return [r, pstatus.to_s(SIZEOFINT).unpack('i_').f...
[ "0.73489785", "0.72232175", "0.718632", "0.7136686", "0.71161866", "0.6968328", "0.6968328", "0.6903286", "0.6895925", "0.6755009", "0.67301834", "0.6647595", "0.65339845", "0.6510491", "0.6503679", "0.6276242", "0.6242623", "0.61421853", "0.6133072", "0.6018399", "0.6006603"...
0.7338045
1
kill(pid_t pid, int sig);
def kill(pid, sig) DL.last_error = 0 r = CALLS["libc!kill:II=I"].call(pid,sig).first raise SystemCallError.new("kill",DL.last_error) if r != 0 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def kill(pid, sig)\n DL.last_error = 0\n r = CALLS[\"libc!kill:II=I\"].call(pid,sig).first\n raise SystemCallError.new(\"kill\",DL.last_error) if r != 0 \n end", "def kill(signo)\n Process.kill(signo, pid)\n end", "def kill\n sig :KILL\n end", "d...
[ "0.79813516", "0.7758138", "0.7714868", "0.7678296", "0.7670362", "0.76154214", "0.7591122", "0.75541455", "0.7511199", "0.7508408", "0.7395743", "0.73809725", "0.7377234", "0.7369757", "0.73646593", "0.728098", "0.71959925", "0.70640105", "0.70308965", "0.70212805", "0.69924...
0.793876
1
Updates the rank to secondary if current rank is primary
def demote_primary_rank_to_secondary(phone_type) return unless self.phone_rank_code == 1 secondary_rank = NcsCode.for_list_name_and_local_code('COMMUNICATION_RANK_CL1', 2) if !secondary_rank.blank? && phone_type == self.phone_type_code self.phone_rank = secondary_rank self.save end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def upgrade_rank\n if self.rank.nil? || self.rank.rank == 0\n rank1 = Rank.find_by_rank(1)\n self.update_attribute(:rank_id, rank1.id) unless rank1.nil?\n end\n end", "def update_rank\n self.score = calculate_score\n self.save\n end", "def update_user_ranking\n return if last_rank? |...
[ "0.6664734", "0.60440356", "0.5973898", "0.587568", "0.58724535", "0.58206856", "0.5760567", "0.5757291", "0.5732463", "0.57212484", "0.57040054", "0.5658129", "0.56250674", "0.56146854", "0.55671346", "0.5516927", "0.55159336", "0.55109423", "0.549047", "0.5436287", "0.54335...
0.723861
0
Create the Enrar tasks
def initialize(name=:secretary) @name = name @database_config = 'config/database.yml' @verbose = verbose yield self if block_given? define end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_tasks\n make_clean_task\n make_wix_folder_task\n make_copy_file_tasks\n make_sourcery_wxs_file_task\n make_sourcery_wixobj_file_task\n make_product_wxs_file_task\n make_product_wixobj_file_task\n make_msi_file_task\n make_msi_task\n make_test_task\n end", "def define_tasks...
[ "0.6315559", "0.61258626", "0.6083611", "0.6060992", "0.59667337", "0.59646857", "0.5841327", "0.5809464", "0.57984585", "0.57698965", "0.57656986", "0.5750389", "0.5746544", "0.5746544", "0.5726704", "0.57254726", "0.56981045", "0.5689825", "0.567885", "0.56714207", "0.56568...
0.0
-1
Create the tasks defined by this task lib.
def define desc "Create & migrate the DB for your named TIMESHEET" task "#{@name}:prepare", [:timesheet] => ["#{@name}:env"] do |t, args| Enrar::Migrator.new.migrate! end desc "Print the URL for the provided TIMESHEET" task "#{@name}:url", [:timesheet] => ["#{@name}:env"] do |t, args| require 'socket' ip = Socket::getaddrinfo(Socket.gethostname,"echo",Socket::AF_INET)[0][3] puts "http://#{ip}:#{@config[:port] || 8912}/" end task "#{@name}:env", [:timesheet] do |t, args| @timesheet = File.expand_path('~/.secretary') unless args[:timesheet] @config = Vim::Secretary::Config.from_timesheet(@timesheet) end self end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def define_tasks\r\n define_repeat_task\r\n define_clobber_task\r\n define_build_task\r\n end", "def define_tasks\r\n define_clobber_task\r\n define_build_task\r\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def make_tasks\n ...
[ "0.7606729", "0.7325037", "0.73218364", "0.73150355", "0.72710544", "0.7211392", "0.72080183", "0.7176689", "0.71062285", "0.70869637", "0.7025319", "0.69870484", "0.6883644", "0.6845661", "0.6837366", "0.6808642", "0.67390406", "0.6733832", "0.6724307", "0.6697595", "0.66771...
0.61233234
69
Use callbacks to share common setup or constraints between actions.
def set_school @school = School.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def school_params params.require(:school).permit(:name, :schooldistrict_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n...
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076",...
0.0
-1
devolve o maximo de anuncios que pode ter em simultaneo
def max_ads self.plans.sum(:ads_limit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jugada_max\r\n movimiento.max_by{|x| x.nivel} #Devuelve el objeto de enumeración que da el valor máximo\r\n end", "def nivel_no_final\r\n #collect llama al bloque una vez por cada elemento del mismo y crea un nuevo arreglo que contiene los valores retornados\r\n #nivels = movimiento.collect{ |val...
[ "0.74644876", "0.7048585", "0.69472414", "0.6757769", "0.6699834", "0.6699834", "0.65726537", "0.64918524", "0.64918524", "0.64549357", "0.6440293", "0.6395896", "0.6378646", "0.63690156", "0.63103926", "0.63066524", "0.63003093", "0.62989235", "0.62806094", "0.62791085", "0....
0.0
-1
devolve o maximo de eventos que pode ter em simultaneo
def max_events self.plans.sum(:event_limit) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_events_slots\n #num de eventos dos pacotes - num de eventos que possui\n self.max_events - self.active_events_count\n end", "def send_maxed(event)\n send_maxable(event, true)\nend", "def calc_all_day_max\n max = 0\n @events_all_day = []\n (0..(num_days-1)).each do |day|\n ...
[ "0.695848", "0.67855585", "0.6343697", "0.62572265", "0.59878683", "0.5961543", "0.5914336", "0.58432394", "0.57006514", "0.5649433", "0.55846095", "0.5583318", "0.55747557", "0.555182", "0.55380285", "0.55380285", "0.55107534", "0.54624367", "0.54486746", "0.54272354", "0.54...
0.5906054
7
devolve o numero de anuncios que o utilizador tem ativos
def active_ads_count self.ads.where("expire_date >= ?", Date.today).where(:is_deleted => false, :is_active => true).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def uno_mas\n\t\t@edad += 1\n\t\tif @edad < EDAD_MAXIMA\n\t\t\t@altura += @inc_alt\n\t\t\t@contador += prod_nar if @edad >= @ini_fru\n\t\telse\n\t\t\tmuere\n\t\tend\n\t\t@edad\n\tend", "def numarulTotalDePersoane()\n @@instantePersoana += 1\n puts \"Numarul total de persoane: #@@instantePersoana\"\...
[ "0.6186454", "0.60392785", "0.59854436", "0.59850293", "0.59042174", "0.5892695", "0.5891368", "0.5741389", "0.5740461", "0.5677671", "0.567322", "0.5651985", "0.56052995", "0.5589778", "0.5582536", "0.5568924", "0.55247134", "0.5523565", "0.55198276", "0.55189216", "0.550328...
0.0
-1
devolve o numero de evento que o utilizador tem ativos
def active_events_count self.events.where("end_day >= ?", Date.today).where(:deleted => false).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remaining_events_slots\n #num de eventos dos pacotes - num de eventos que possui\n self.max_events - self.active_events_count\n end", "def new_event_id\n @stats[:events_sent] ||= 0\n return @stats[:events_sent] += 1\n end", "def events_notification_number\n @notifications = Notifica...
[ "0.6397114", "0.5853185", "0.5839221", "0.57686347", "0.56914574", "0.56914574", "0.56681216", "0.5608693", "0.5597622", "0.5572336", "0.55263007", "0.5516082", "0.5448328", "0.5427463", "0.5412451", "0.5346205", "0.533639", "0.5303369", "0.5292586", "0.52780384", "0.52682954...
0.0
-1
conta o numero slots para anuncios que o utilizador tem restantes
def remaining_ads_slots #num de anuncios dos pacotes - num de anuncios que possui ativos self.max_ads - self.active_ads_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slots_available\n 5 - users.size\n end", "def available_slots()\n return @size - @used_spaces\n end", "def available_slots\n # Doit regarder le board et renvoyer un array avec les slots restants\n slots = []\n @board.each do |k,v|\n v.each_with_index { |num,i| slots << k + (i+1).to_s ...
[ "0.7324049", "0.67245513", "0.671386", "0.6697308", "0.66881317", "0.6492287", "0.6428776", "0.640011", "0.6397633", "0.6397077", "0.63898253", "0.6317291", "0.63062257", "0.6178909", "0.5973488", "0.59015334", "0.58343434", "0.58036333", "0.57820326", "0.5776645", "0.5689273...
0.61741006
14
conta o numero slots para eventos que o utilizador tem restantes
def remaining_events_slots #num de eventos dos pacotes - num de eventos que possui self.max_events - self.active_events_count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def slots_available\n 5 - users.size\n end", "def inc_time_slot\n # ex. with 4 bits -> we want range 1..15, \n @lock.synchronize{@current_slot = (@current_slot % @max_slot) + 1}\n end", "def slot_time\n 0\n end", "def add_slot\n @limit += 1\n end", "def vacant_slots(fro...
[ "0.6430298", "0.6314384", "0.6281911", "0.6171873", "0.6165905", "0.6051925", "0.5965906", "0.59348065", "0.590835", "0.57707775", "0.5767484", "0.57625294", "0.57533866", "0.57364935", "0.57098615", "0.56916666", "0.5656416", "0.5655591", "0.5609647", "0.55936426", "0.555762...
0.7389888
0
fica a seguir 'target' target.class = user
def follow(target) link = self.user_follows.where("following_id = ?",target.id).first if link == nil imperative_follow(target) end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_user_target\n @user_target = UserTarget.find(params[:id])\n end", "def target=(target)\n @target = target\n end", "def target\n @target\n end", "def target\n @target\n end", "def set_target\n @user = current_user\n render \"target\"\n end", "def target\n ...
[ "0.7171851", "0.67753935", "0.66695327", "0.6656473", "0.66132975", "0.66126215", "0.658192", "0.658192", "0.6561889", "0.6540922", "0.65371346", "0.6529093", "0.650472", "0.6497097", "0.64820445", "0.6465199", "0.64617187", "0.6328531", "0.63281536", "0.63161075", "0.6267756...
0.0
-1
todos conversas do utilizador
def all_talks Talk.all_talks(id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def connect\n \t\t#Se sigue la convencion para la identificacion del usuario\n \t\t#y buscamos alusuario que se intenta conectar\n \t\tself.current_user = find_user\n \tend", "def causas_conocidas\n %w{ cheque-propio cheque-de-terceros efectivo transferencia retenciones }\n end", "def transact; end...
[ "0.527021", "0.52562964", "0.51882327", "0.516376", "0.50987357", "0.50866574", "0.5063248", "0.5056641", "0.5051245", "0.50451195", "0.5039116", "0.5037964", "0.5031524", "0.50241435", "0.50225747", "0.49667782", "0.49583036", "0.49551898", "0.4940461", "0.49394482", "0.4937...
0.0
-1
Primeiro + Ultimo nome
def first_last_name names = name.split names.first + " " + names.last end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def nombre_completo\n\tprimer_nombre+\" \"+primer_apellido\n#fin del metodo\nend", "def nombre_y_apellido \n primer_nombre + ' ' + primer_apellido\n end", "def retorna_nome_primeiro_produto\n nome_primeiro_produto.greenify\n nome_primeiro_produto.text\n end", "def nome_prop...
[ "0.73960817", "0.71633226", "0.7120229", "0.69806594", "0.69720656", "0.6880851", "0.68092984", "0.6781707", "0.6694038", "0.66803175", "0.65932244", "0.6555688", "0.6423237", "0.6402555", "0.63643366", "0.6320697", "0.6305345", "0.62258494", "0.6204062", "0.6184077", "0.6146...
0.0
-1
busca todos os ads fora da validade do utilizador
def expired_ads self.ads.where("expire_date < ?", Date.today) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_validated\n\t\t@ads = Ad.all\n\tend", "def atributos\n valid = false\n if self.interreps_vencidos.any?\n valid = true\n\n elsif presente_reunioes == true\n valid = true\n end\n\n # elsif Time.now.year - ano_de_fundacao <= 1 \n # valid = true\n # end\n\n valid\n end", ...
[ "0.59432405", "0.5755096", "0.56596655", "0.5561232", "0.5539093", "0.544451", "0.537862", "0.5304377", "0.5297941", "0.52902424", "0.5288291", "0.5279858", "0.5208112", "0.5204732", "0.51774496", "0.51725304", "0.5167929", "0.516678", "0.51502645", "0.51335055", "0.5103413",...
0.48903286
55
inserir dados pelo omniauth
def apply_omniauth(omniauth) if omniauth['provider'] == 'facebook' #Buscar info self.email = omniauth['info']['email'] self.name = omniauth['info']['name'] #location é composto por "Cidade, Pais" if omniauth['info']['location'] != nil location = omniauth['info']['location'].split(", ") else location = '' end #location = omniauth['info']['location'].split(", ") #buscar cidade do location city = City.find_by city: location[0] if city != nil self.city = city end #buscar imagem #if omniauth['info']['image']!=nil # self.avatar = URI.parse(omniauth['info']['image']) #end omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid']) elsif omniauth['provider'] == 'twitter' #Buscar info self.name = omniauth['info']['name'] #buscar cidade do location city = City.find_by city: omniauth['info']['location'] if city != nil self.city = city end #buscar imagem #if omniauth['info']['image']!=nil # self.avatar = URI.parse(omniauth['info']['image']) #end omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid']) elsif omniauth['provider'] == 'google_oauth2' #Buscar info self.email = omniauth['info']['email'] self.name = omniauth['info']['name'] #Google não contem cidade omni_authentications.build(:provider => omniauth['provider'], :uid => omniauth['uid']) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def save_user\n client = create_db_client\n client.query(\"INSERT INTO users(name, email, password, bio) VALUES('#{@name}', '#{@email}', '#{@password}', '#{@bio}')\")\n \n id = client.last_id\n rawData = client.query(\"SELECT * FROM users WHERE id='#{id}'\")\n users = Arra...
[ "0.63966995", "0.61834973", "0.61709714", "0.6141134", "0.60792774", "0.6052122", "0.60225034", "0.5990265", "0.59838325", "0.5981507", "0.5977074", "0.5976106", "0.59712404", "0.59565747", "0.58583367", "0.58098155", "0.5804102", "0.5772835", "0.57722676", "0.5753664", "0.57...
0.5457661
54
This API method deletes a db instance identifier
def delete_db_instance( options = {} ) raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier) params = {} params['DBInstanceIdentifier'] = options[:db_instance_identifier] params["SkipFinalSnapshot"] = options[:skip_final_snapshot].to_s if options.has?(:skip_final_snapshot) params["FinalDBSnapshotIdentifier"] = options[:final_db_snapshot_identifier].to_s if options.has?(:final_db_snapshot_identifier) return response_generator(:action => "DeleteDBInstance", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy_instance_database\n instance_database.delete!\n end", "def destroy_instance_database\n instance_database.delete!\n end", "def delete_instance instance_id\n instances.delete_instance name: instance_path(instance_id)\n end", "def delete_instance instance_id\n execut...
[ "0.78104347", "0.78104347", "0.7799437", "0.77426463", "0.7248361", "0.714576", "0.7043967", "0.7032964", "0.70260894", "0.7016758", "0.6994279", "0.6905751", "0.6812868", "0.6792614", "0.671709", "0.6646642", "0.6606696", "0.65913296", "0.6585981", "0.6585312", "0.65517557",...
0.786375
0
This API method creates a db parameter group
def create_db_parameter_group( options = {} ) raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name) raise ArgumentError, "No :engine provided" if options.does_not_have?(:engine) raise ArgumentError, "No :description provided" if options.does_not_have?(:description) params = {} params['DBParameterGroupName'] = options[:db_parameter_group_name] params['Engine'] = options[:engine] params['Description'] = options[:description] return response_generator(:action => "CreateDBParameterGroup", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db_parameter_group(group_name, group_family, description)\n request({\n 'Action' => 'CreateDBParameterGroup',\n 'DBParameterGroupName' => group_name,\n 'DBParameterGroupFamily' => group_family,\n 'Description' => description,\n\n :parser ...
[ "0.8339679", "0.6753", "0.64806265", "0.6449287", "0.64271754", "0.6417512", "0.6388532", "0.63715506", "0.62892306", "0.6284379", "0.6247824", "0.6201234", "0.6144675", "0.6142298", "0.60952145", "0.60433537", "0.6039145", "0.6013998", "0.59971625", "0.5981272", "0.59618366"...
0.81451076
1
This API method creates a db security group
def create_db_security_group( options = {} ) raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name) raise ArgumentError, "No :db_security_group_description provided" if options.does_not_have?(:db_security_group_description) params = {} params['DBSecurityGroupName'] = options[:db_security_group_name] params['DBSecurityGroupDescription'] = options[:db_security_group_description] return response_generator(:action => "CreateDBSecurityGroup", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_db_security_group(name, description = name)\n request({\n 'Action' => 'CreateDBSecurityGroup',\n 'DBSecurityGroupName' => name,\n 'DBSecurityGroupDescription' => description,\n :parser => Fog::Parsers::AWS::RDS::CreateDBSecurityGroup.new\n ...
[ "0.81838906", "0.7399367", "0.7374812", "0.7240508", "0.7095768", "0.70691437", "0.70563245", "0.7035626", "0.69273025", "0.6834308", "0.6797045", "0.6789039", "0.678529", "0.67655665", "0.67390543", "0.6682541", "0.6651886", "0.6631465", "0.65775806", "0.65339804", "0.649694...
0.825356
0
This API method creates a restoreable db snapshot
def create_db_snapshot( options = {} ) raise ArgumentError, "No :db_snapshot_identifier provided" if options.does_not_have?(:db_snapshot_identifier) raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier) params = {} params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier] params['DBInstanceIdentifier'] = options[:db_instance_identifier] return response_generator(:action => "CreateDBSnapshot", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_db\n\n begin\n self.rds.restore_db_instance_from_db_snapshot(new_snap.id,\n backup_server_id,\n {\"DBSubnetGroupName\" => @opts['db_subnet_group_name'],\n ...
[ "0.6801502", "0.6743974", "0.65255", "0.63955307", "0.6309826", "0.628981", "0.6236281", "0.6220807", "0.62182647", "0.61614007", "0.6157242", "0.6152", "0.61007875", "0.60727644", "0.60258055", "0.5986596", "0.59751034", "0.593476", "0.59304047", "0.5916274", "0.5838655", ...
0.68608165
0
This API method authorizes network ingress for an amazon ec2 group
def authorize_db_security_group( options = {} ) raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name) params = {} params['DBSecurityGroupName'] = options[:db_security_group_name] if options.has?(:cidrip) params['CIDRIP'] = options[:cidrip] elsif options.has?(:ec2_security_group_name) && options.has?(:ec2_security_group_owner_id) params['EC2SecurityGroupName'] = options[:ec2_security_group_name] params['EC2SecurityGroupOwnerId'] = options[:ec2_security_group_owner_id] else raise ArgumentError, "No :cidrip or :ec2_security_group_name and :ec2_security_group_owner_id provided" end return response_generator(:action => "AuthorizeDBSecurityGroupIngress", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.autorize_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('authorize_security_group_IP_ingress')\n end", "def authorize_secu...
[ "0.77207625", "0.7579153", "0.74571866", "0.7232789", "0.72269493", "0.72269493", "0.71997434", "0.71826684", "0.6954542", "0.6949452", "0.6949452", "0.69218844", "0.68057144", "0.67845947", "0.63282657", "0.62337834", "0.6133068", "0.60377026", "0.601596", "0.59780097", "0.5...
0.6010394
19
This API method deletes a db paramter group
def delete_db_parameter_group( options = {} ) raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name) params = {} params['DBParameterGroupName'] = options[:db_parameter_group_name] return response_generator(:action => "DeleteDBParameterGroup", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_db_parameter_group(group_name)\n request({\n 'Action' => 'DeleteDBParameterGroup',\n 'DBParameterGroupName' => group_name,\n\n :parser => Fog::Parsers::AWS::RDS::DeleteDbParameterGroup.new\n })\n end", "def deleteGroup _args\n \"deleteG...
[ "0.86176175", "0.68168294", "0.67991805", "0.67957574", "0.67957574", "0.6521029", "0.62758386", "0.6263053", "0.61893827", "0.61789614", "0.61789614", "0.61726594", "0.61356586", "0.61316824", "0.6097984", "0.60911584", "0.60797507", "0.60715365", "0.60555464", "0.6048046", ...
0.8256912
1
This API method deletes a db security group
def delete_db_security_group( options = {} ) raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name) params = {} params['DBSecurityGroupName'] = options[:db_security_group_name] return response_generator(:action => "DeleteDBSecurityGroup", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_db_security_group(name)\n request({\n 'Action' => 'DeleteDBSecurityGroup',\n 'DBSecurityGroupName' => name,\n :parser => Fog::Parsers::AWS::RDS::DeleteDBSecurityGroup.new\n })\n end", "def delete_security_group( options = {} )\n optio...
[ "0.8618899", "0.75298107", "0.75248986", "0.75248986", "0.74767214", "0.74767214", "0.7456203", "0.745136", "0.7338191", "0.7317395", "0.7021062", "0.69947094", "0.68517923", "0.68500507", "0.6766943", "0.6745984", "0.672948", "0.67209244", "0.6715335", "0.67087483", "0.67087...
0.85740334
1
This API method deletes a db snapshot
def delete_db_snapshot( options = {} ) raise ArgumentError, "No :db_snapshot_identifier provided" if options.does_not_have?(:db_snapshot_identifier) params = {} params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier] return response_generator(:action => "DeleteDBSnapshot", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete_snapshot snapshot\n subscriber.delete_snapshot snapshot: snapshot_path(snapshot)\n end", "def delete_snapshot(snapshot_id)\n end", "def delete_db_snapshot(group_name)\n \n request({\n 'Action' => 'DeleteDBSnapshot',\n 'DBSnapshotIdentifier'...
[ "0.7989397", "0.7799646", "0.76302737", "0.7525291", "0.74766856", "0.7384944", "0.7370046", "0.7266423", "0.72105217", "0.71430814", "0.7056672", "0.7040057", "0.6973365", "0.6952715", "0.68709934", "0.68602556", "0.68184763", "0.677617", "0.67542523", "0.6658884", "0.661851...
0.78868943
1
This API method describes the db instances
def describe_db_instances( options = {} ) params = {} params['DBInstanceIdentifier'] = options[:db_instance_identifier] if options.has?(:db_instance_identifier) params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records) params['Marker'] = options[:marker] if options.has?(:marker) return response_generator(:action => "DescribeDBInstances", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def info\n specified_db_or_all { |db| display_db_info db }\n end", "def db_info\n @conn.query({url_path: \"#{database}\", method: :get})\n end", "def databases\n get '_all_dbs'\n end", "def db_instance_c...
[ "0.7248942", "0.71864706", "0.70754975", "0.704524", "0.6940128", "0.69293463", "0.6928141", "0.6769266", "0.67625034", "0.66378766", "0.6608421", "0.65857303", "0.6565562", "0.65471476", "0.65471476", "0.65245986", "0.65201384", "0.6494262", "0.64839464", "0.6461213", "0.645...
0.6990226
4
This API method describes the default engine parameters
def describe_engine_default_parameters( options = {} ) raise ArgumentError, "No :engine provided" if options.does_not_have?(:engine) params = {} params['Engine'] = options[:engine] params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records) params['Marker'] = options[:marker] if options.has?(:marker) return response_generator(:action => "DescribeEngineDefaultParameters", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_parameters\n {}\n end", "def default_params\n {}\n end", "def engine_opts\n @setup[:engine_opts] ||= engine_args.inject({}) { |opts, a| a.is_a?(Hash) ? opts.update(a) : opts.update(a => true) }\n end", "def default_operation_params\n {\n tr_96_384_program: '96_to_3...
[ "0.688537", "0.6514385", "0.6484185", "0.6435421", "0.6427833", "0.64241713", "0.63189167", "0.63189167", "0.63189167", "0.63189167", "0.63189167", "0.63189167", "0.63189167", "0.63189167", "0.63189167", "0.63189167", "0.63035405", "0.63035405", "0.63035405", "0.6289244", "0....
0.7713643
0
This API method returns information about all DB Parameter Groups for an account if no DB Parameter Group name is supplied, or displays information about a specific named DB Parameter Group. You can call this operation recursively using the Marker parameter.
def describe_db_parameter_groups( options = {} ) params = {} params['DBParameterGroupName'] = options[:db_parameter_group_name] if options.has?(:db_parameter_group_name) params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records) params['Marker'] = options[:marker] if options.has?(:marker) return response_generator(:action => "DescribeDBParameterGroups", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def parameter_groups\n @dbi.db_parameter_groups\n end", "def parameter_groups\n @dbi.db_parameter_groups\n end", "def db_parameter_groups\n data[:db_parameter_groups]\n end", "def describe_cache_parameter_groups(name = nil, options = {})\n request({\n ...
[ "0.6822189", "0.6822189", "0.67132163", "0.63226897", "0.6308075", "0.62227696", "0.58050305", "0.5600635", "0.5546178", "0.5513059", "0.5494037", "0.5380133", "0.53589296", "0.52047867", "0.5178956", "0.51543945", "0.5104271", "0.5104271", "0.5104271", "0.50680333", "0.50181...
0.77086633
0
This API method returns information about parameters that are part of a parameter group. You can optionally request only parameters from a specific source. You can call this operation recursively using the Marker parameter.
def describe_db_parameters( options = {} ) raise ArgumentError, "No :db_parameter_group_name provided" if options.does_not_have?(:db_parameter_group_name) params = {} params['DBParameterGroupName'] = options[:db_parameter_group_name] params['Source'] = options[:source] if options.has?(:source) params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records) params['Marker'] = options[:marker] if options.has?(:marker) return response_generator(:action => "DescribeDBParameters", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def group_param_string\n @group_param_string ||= search.params.fetch_params_for(@key)\n end", "def test_group_parameters(opts = {})\n test_group_parameters_with_http_info(opts)\n nil\n end", "def getParameterGroup\n MU::Cloud::AWS.elasticache(region: @region, credentials: @cre...
[ "0.6183422", "0.5989656", "0.5988335", "0.59750354", "0.5925296", "0.5880427", "0.5880427", "0.5880427", "0.57108146", "0.5704844", "0.5576082", "0.55700654", "0.5541139", "0.5465979", "0.5454398", "0.5449471", "0.5441204", "0.54264903", "0.5393681", "0.5392517", "0.538127", ...
0.57217586
8
This API method returns all the DB Security Group details for a particular AWS account, or for a particular DB Security Group if a name is specified. You can call this operation recursively using the Marker parameter.
def describe_db_security_groups( options = {} ) params = {} params['DBSecurityGroupName'] = options[:db_security_group_name] if options.has?(:db_security_group_name) params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records) params['Marker'] = options[:marker] if options.has?(:marker) return response_generator(:action => "DescribeDBSecurityGroups", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_security_groups( options = {} )\n options = { :group_name => [] }.merge(options)\n params = pathlist(\"GroupName\", options[:group_name] )\n return response_generator(:action => \"DescribeSecurityGroups\", :params => params)\n end", "def authorize_db_security_group( options...
[ "0.6452177", "0.62381905", "0.6217081", "0.61651415", "0.6125316", "0.60981196", "0.6033228", "0.5938788", "0.59141463", "0.58836275", "0.58807003", "0.58482194", "0.58482194", "0.5787961", "0.5784067", "0.5733445", "0.5711698", "0.5684364", "0.5684364", "0.56276417", "0.5605...
0.7274175
0
This API method returns information about the DB Snapshots for this account. If you pass in a DBInstanceIdentifier, it returns information only about DB Snapshots taken for that DB Instance. If you pass in a DBSnapshotIdentifier,it will return information only about the specified snapshot. If you omit both DBInstanceIdentifier and DBSnapshotIdentifier, it returns all snapshot information for all database instances, up to the maximum number of records specified. Passing both DBInstanceIdentifier and DBSnapshotIdentifier results in an error.
def describe_db_snapshots( options = {} ) raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier) params = {} params['DBInstanceIdentifier'] = options[:db_instance_identifier] params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier] if options.has?(:db_snapshot_identifier) params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records) params['Marker'] = options[:marker] if options.has?(:marker) return response_generator(:action => "DescribeDBSnapshots", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_rds_snapshots(options = {}, snapshot_type = 'manual')\n days_old = options[:days_old]\n found_snap_shots = []\n\n snapshots_info = @rds.describe_db_snapshots(snapshot_type: snapshot_type)[:db_snapshots]\n\n snapshots_info.each do |snapshot_info|\n next if snapshot_info[:status] ...
[ "0.62364715", "0.6189102", "0.61695254", "0.60792506", "0.59420675", "0.58706", "0.58423316", "0.5805329", "0.5752382", "0.57303363", "0.5703655", "0.5644326", "0.5549427", "0.5539714", "0.54713124", "0.54453516", "0.54052275", "0.53920054", "0.52783954", "0.52345407", "0.519...
0.7598571
0
This API method Returns information about events related to your DB Instances, DB Security Groups, and DB Parameter Groups for up to the past 14 days. You can get events specific to a particular DB Instance or DB Security Group by providing the name as a parameter. By default, the past hour of events are returned. If neither DBInstanceIdentifier or DBSecurityGroupName are provided, all events are be retrieved for DB Instances and DB Security Groups.
def describe_events( options = {} ) params = {} params['SourceIdentifier'] = options[:source_identifier] if options.has?(:source_identifier) params['SourceType'] = options[:source_type] if options.has?(:source_type) params['StartTime'] = options[:start_time] if options.has?(:start_time) params['EndTime'] = options[:end_time] if options.has?(:end_time) params['Duration'] = options[:duration] if options.has?(:duration) params['MaxRecords'] = options[:max_records].to_s if options.has?(:max_records) params['Marker'] = options[:marker] if options.has?(:marker) return response_generator(:action => "DescribeEvents", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def describe_events(options={})\n request({\n 'Operation' => 'DescribeEvents',\n :parser => Fog::Parsers::AWS::ElasticBeanstalk::DescribeEvents.new\n }.merge(options))\n end", "def events\n requires :label, :application_na...
[ "0.56033653", "0.5453656", "0.537574", "0.5328001", "0.5265312", "0.5207175", "0.50890744", "0.50266737", "0.50234497", "0.5019458", "0.50052035", "0.49440947", "0.49219558", "0.49031928", "0.48904434", "0.48640504", "0.48640504", "0.48191258", "0.48008108", "0.47852984", "0....
0.4761563
21
This API changes the settings of an existing DB Instance. Changes are applied in the following manner: A ModifyDBInstance API call to modify security groups or to change the maintenance windows results in immediate action. Modification of the DB Parameter Group applies immediate parameters as soon as possible and pendingreboot parameters only when the RDS instance is rebooted. A request to scale the DB Instance class results puts the database instance into the modifying state. The DB Instance must be in available or modifying state for this API to accept changes.
def modify_db_instance( options = {}) raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier) # handle a former argument that was misspelled raise ArgumentError, "Perhaps you meant :backup_retention_period" if options.has?(:backend_retention_period) params = {} params['DBInstanceIdentifier'] = options[:db_instance_identifier] params["AllocatedStorage"] = options[:allocated_storage].to_s if options.has?(:allocated_storage) params["DBInstanceClass"] = options[:db_instance_class] if options.has?(:db_instance_class) params["Engine"] = options[:engine] if options.has?(:engine) params["MasterUsername"] = options[:master_username] if options.has?(:master_username) params["MasterUserPassword"] = options[:master_user_password] if options.has?(:master_user_password) params["Port"] = options[:port].to_s if options.has?(:port) params["DBName"] = options[:db_name] if options.has?(:db_name) params["DBParameterGroupName"] = options[:db_parameter_group_name] if options.has?(:db_parameter_group_name) params.merge!(pathlist("DBSecurityGroups.member", [options[:db_security_groups]].flatten)) if options.has_key?(:db_security_groups) params["AvailabilityZone"] = options[:availability_zone] if options.has?(:availability_zone) params["PreferredMaintenanceWindow"] = options[:preferred_maintenance_window] if options.has?(:preferred_maintenance_window) params["BackupRetentionPeriod"] = options[:backup_retention_period].to_s if options.has?(:backup_retention_period) params["PreferredBackupWindow"] = options[:preferred_backup_window] if options.has?(:preferred_backup_window) return response_generator(:action => "ModifyDBInstance", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def modify_db_instance(db_name, apply_immediately, options={})\n if security_groups = options.delete('DBSecurityGroups')\n options.merge!(Fog::AWS.indexed_param('DBSecurityGroups.member.%d', [*security_groups]))\n end\n\n if vpc_security_groups = options.delete('VpcSecurityGro...
[ "0.7070238", "0.6429231", "0.607918", "0.60231954", "0.58584386", "0.57739925", "0.5416651", "0.5245029", "0.50991404", "0.50663006", "0.5050215", "0.50039715", "0.49466795", "0.49044967", "0.48947906", "0.48735172", "0.48647597", "0.48483443", "0.4845091", "0.48327625", "0.4...
0.7016179
1
This API method reboots a DB Instance. Once started, the process cannot be stopped, and the database instance will be unavailable until the reboot completes.
def reboot_db_instance( options = {} ) raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier ) params = {} params['DBInstanceIdentifier'] = options[:db_instance_identifier] if options.has?(:db_instance_identifier) return response_generator(:action => "RebootDBInstance", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reboot\n # There is no trackable status change for the instance being\n # rebooted, so it's up to CPI client to keep track of agent\n # being ready after reboot.\n # Due to this, we can't deregister the instance from any load\n # balancers it might be attached to, and reattach once the...
[ "0.68726414", "0.683292", "0.6408678", "0.6298295", "0.6157003", "0.6140423", "0.61209804", "0.6113409", "0.61131006", "0.6071969", "0.6056089", "0.60245436", "0.5915481", "0.58795136", "0.586171", "0.5822765", "0.5815072", "0.5753229", "0.57167923", "0.57167035", "0.57017124...
0.77208495
0
This API method restores a db instance to a snapshot of the instance
def restore_db_instance_from_snapshot( options = {} ) raise ArgumentError, "No :db_snapshot_identifier provided" if options.does_not_have?(:db_snapshot_identifier) raise ArgumentError, "No :db_instance_identifier provided" if options.does_not_have?(:db_instance_identifier) raise ArgumentError, "No :db_instance_class provided" if options.does_not_have?(:db_instance_class) params = {} params['DBSnapshotIdentifier'] = options[:db_snapshot_identifier] params['DBInstanceIdentifier'] = options[:db_instance_identifier] params['DBInstanceClass'] = options[:db_instance_class] params['Port'] = options[:port].to_s if options.has?(:port) params['AvailabilityZone'] = options[:availability_zone] if options.has?(:availability_zone) return response_generator(:action => "RestoreDBInstanceFromDBSnapshot", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_db\n\n begin\n self.rds.restore_db_instance_from_db_snapshot(new_snap.id,\n backup_server_id,\n {\"DBSubnetGroupName\" => @opts['db_subnet_group_name'],\n ...
[ "0.7672407", "0.69910777", "0.64310646", "0.6271856", "0.6247364", "0.62125814", "0.60931945", "0.6078142", "0.60769117", "0.5933311", "0.58894867", "0.58693135", "0.5846475", "0.58156013", "0.5762505", "0.5685789", "0.5674184", "0.56652653", "0.56622374", "0.56578666", "0.56...
0.75455475
1
This API method restores a DB Instance to a specified time, creating a new DB Instance. Some characteristics of the new DB Instance can be modified using optional parameters. If these options are omitted, the new DB Instance defaults to the characteristics of the DB Instance from which the DB Snapshot was created.
def restore_db_instance_to_point_in_time( options = {} ) raise ArgumentError, "No :source_db_instance_identifier provided" if options.does_not_have?(:source_db_instance_identifier) raise ArgumentError, "No :target_db_instance_identifier provided" if options.does_not_have?(:target_db_instance_identifier) params = {} params['SourceDBInstanceIdentifier'] = options[:source_db_instance_identifier] params['TargetDBInstanceIdentifier'] = options[:target_db_instance_identifier] if options.has?(:use_latest_restorable_time) && options.has?(:restore_time) raise ArgumentError, "You cannot provide both :use_latest_restorable_time and :restore_time" elsif options.has?(:use_latest_restorable_time) params['UseLatestRestorableTime'] = case options[:use_latest_restorable_time] when 'true', 'false' options[:use_latest_restorable_time] when true 'true' when false 'false' else raise ArgumentError, "Invalid value provided for :use_latest_restorable_time. Expected boolean." end elsif options.has?(:restore_time) params['RestoreTime'] = options[:restore_time] end params['DBInstanceClass'] = options[:db_instance_class] if options.has?(:db_instance_class) params['Port'] = options[:port].to_s if options.has?(:port) params['AvailabilityZone'] = options[:availability_zone] if options.has?(:availability_zone) return response_generator(:action => "RestoreDBInstanceToPointInTime", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_db_instance_from_snapshot( options = {} )\n raise ArgumentError, \"No :db_snapshot_identifier provided\" if options.does_not_have?(:db_snapshot_identifier)\n raise ArgumentError, \"No :db_instance_identifier provided\" if options.does_not_have?(:db_instance_identifier)\n raise Argu...
[ "0.68326974", "0.64783525", "0.6113297", "0.59822285", "0.58398825", "0.5815707", "0.5780978", "0.5524278", "0.54245776", "0.5388271", "0.5277953", "0.5237104", "0.523271", "0.5225178", "0.51948106", "0.5188107", "0.509467", "0.50929403", "0.5060347", "0.5001828", "0.49888393...
0.7235767
0
This API method authorizes network ingress for an amazon ec2 group
def revoke_db_security_group( options = {} ) raise ArgumentError, "No :db_security_group_name provided" if options.does_not_have?(:db_security_group_name) params = {} params['DBSecurityGroupName'] = options[:db_security_group_name] if options.has?(:cidrip) params['CIDRIP'] = options[:cidrip] elsif options.has?(:ec2_security_group_name) && options.has?(:ec2_security_group_owner_id) params['EC2SecurityGroupName'] = options[:ec2_security_group_name] params['EC2SecurityGroupOwnerId'] = options[:ec2_security_group_owner_id] else raise ArgumentError, "No :cidrip or :ec2_security_group_name and :ec2_security_group_owner_id provided" end return response_generator(:action => "RevokeDBSecurityGroupIngress", :params => params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authorize_security_group_IP_ingress(name, owner, from_port, to_port, protocol='tcp', cidr_ip='0.0.0.0/0')\n @ec2.autorize_security_group_ingress_IP(name, protocol, from_port, to_port, cidr_ip) \n rescue Exception\n on_query_exception('authorize_security_group_IP_ingress')\n end", "def authorize_secu...
[ "0.77207625", "0.7579153", "0.74571866", "0.7232789", "0.72269493", "0.72269493", "0.71997434", "0.71826684", "0.6954542", "0.6949452", "0.6949452", "0.69218844", "0.68057144", "0.67845947", "0.63282657", "0.62337834", "0.6133068", "0.60377026", "0.601596", "0.6010394", "0.59...
0.4737146
71
t.integer "user_id" t.integer "flight_id" t.string "class_status" t.boolean "round_trip?" t.float "price"
def book_flight system('clear') puts "Please enter your destination (e.g. 'Paris, France'): " destination = gets.chomp puts "Please enter the departure location, or press enter for all flights to #{destination}." start_location = gets.chomp start_location.empty? ? matched_flights = Flight.all.where(destination: destination) : matched_flights = Flight.all.where(destination: destination, origin: start_location) matched_flights.each_with_index do |flight, idx| puts "All Available Flights: " puts "#{idx + 1}.) \nAirline: #{flight.airline} \nOrigin: #{flight.origin} \nDestination: #{flight.destination} \nDeparture Time: #{flight.departure_time}\n Arrival Time: #{flight.arrival_time}" end puts "Please enter the number associated with the flight to continue booking a reservation." res_num = gets.chomp.to_i puts "Please enter the number of passenger in your party (PLEASE DO NOT include yourself in this count, if there are no additional passengers please press enter to continue.): " party_num = gets.chomp.to_i self.current_person.update(party_count: party_num) 0.upto(party_num) do |int| Ticket.create({user_id: self.current_person.id, flight_id: (matched_flights[res_num - 1]).id, class_status: 'economy', round_trip?: false, price: rand(100..5000).to_f}) end puts "Thank you for your purchase. Your reservation is booked. You can access your flight information from either the menu or from your purchase receipt sent to your email address." return_to_menu end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flights\n Flight.user_is(self)\n end", "def create\n prev_trip = Trip.where(featured: true)\n @trip = Trip.find(params[:trip_id])\n @trip.featured = true\n\n if @trip.save\n prev_trip.update_column(:featured, false)\n end\n\n respond_to do |format|\n if @trip.save\n for...
[ "0.57830846", "0.5701", "0.5604135", "0.5544724", "0.5425245", "0.5419456", "0.53386235", "0.5324938", "0.53071517", "0.5249398", "0.52224636", "0.5197861", "0.51926273", "0.5172311", "0.5163193", "0.51623493", "0.5113087", "0.51094174", "0.5101968", "0.5098831", "0.5084926",...
0.0
-1
def view_flight_info puts "To view your entire flight records input 'all', or enter your flight number: " input = gets.chomp if Integer(input) flight = self.current_person.flights.where(id: input) flight else self.current_person.flights.each do |flight| puts flight end puts "Press enter to return to the menu" input = gets.chomp if input.empty? menu end end flight_num = gets.chomp.to_i self.flights.find_by(id: flight_num)
def view_flight_info self.current_person.flights.each do |flight| puts "----------------------------------------" puts "Flight ID : #{flight.id}" puts "Airline : #{flight.airline}" puts "Origin : #{flight.origin}" puts "Destination: #{flight.destination}" puts "Departure Time: #{flight.departure_time}" puts "Arrival Time: #{flight.arrival_time}" puts "Duration: #{flight.duration}" puts "" puts "----------------------------------------" end return_to_menu end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def display_solicited_flight(flights, query)\n puts \"-\"*80\n puts \"Vuelos disponibles From: #{query[0]} To: #{query[1]}\"\n puts \"-\"*80\n if flights.empty? \n puts \"No se encontraron vuelos disponibles para tu destino\"\n else \n num = 0\n flights.each do |flight|\n num +...
[ "0.7596984", "0.7091919", "0.7062067", "0.70388776", "0.68869007", "0.6829362", "0.6805133", "0.67728454", "0.6700438", "0.66900957", "0.6687641", "0.66810566", "0.6639248", "0.6622418", "0.66080016", "0.65825367", "0.65531695", "0.6533628", "0.6503497", "0.64988047", "0.6459...
0.7566717
1
GET /item_alerts GET /item_alerts.json
def index authorize! :read, ItemAlert @item_alerts = ItemAlert.all respond_to do |format| format.html # index.html.erb format.json { render json: @item_alerts } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n end\n end", "def index\n @alerts = Alert.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @alerts }\n ...
[ "0.6896544", "0.6896544", "0.67798275", "0.67271096", "0.6645895", "0.6645895", "0.6645895", "0.6595972", "0.643492", "0.63026255", "0.6301869", "0.62518966", "0.6243623", "0.6212262", "0.62083435", "0.61927855", "0.6130933", "0.61191714", "0.6109132", "0.6098855", "0.6085433...
0.78087133
0