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
Adds all specified classes/modules to the hidden list. E.g. it is a good idea to ignore +Kernel+, as this module is used almost everywhere.
def hide(*classOrModules) classOrModules.each do |classOrModule| @ignored[classOrModule] = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide_current_state\n\t\t@classes = Array.new\n\t\tObjectSpace.each_object(Class) do |klass|\n\t\t\t@classes.push klass\n\t\tend\n\t\t@modules = Hash.new\n\t\tObjectSpace.each_object(Module) do |mod|\n\t\t\t@modules[mod] = true\n\t\tend\n\tend", "def hide_tree(*classOrModules)\n\t\tclassOrModules.each do |cla...
[ "0.66178924", "0.6531296", "0.6465021", "0.6325448", "0.5983741", "0.5918271", "0.5918271", "0.5878157", "0.5870297", "0.5831609", "0.5808009", "0.5750044", "0.5750044", "0.57357603", "0.568527", "0.5675122", "0.56576324", "0.5629552", "0.55808187", "0.5576997", "0.554552", ...
0.7061887
0
Hides all specified classes/modules and their subclasses. E.g. useful to hide the +SWIG+ classes for FXRuby.
def hide_tree(*classOrModules) classOrModules.each do |classOrModule| @ignored_tree[classOrModule] = true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hide(*classOrModules)\n\t\tclassOrModules.each do |classOrModule|\n\t\t\t@ignored[classOrModule] = true\n\t\tend\n\tend", "def hide(*stuff)\n hide_methods(self, [Object], *stuff)\n end", "def hide_singletons(*stuff)\n hide_methods(singleton_class, [Class], *stuff)\n end", "def hide_method...
[ "0.80537355", "0.7160505", "0.69249374", "0.6764828", "0.66643965", "0.65248203", "0.62142605", "0.62142605", "0.62083936", "0.6201472", "0.60961556", "0.607149", "0.5970846", "0.5970846", "0.58691376", "0.58258575", "0.5780179", "0.5779363", "0.5761028", "0.57156724", "0.569...
0.710222
2
Generates the dot graph, and returns a string of the graph.
def generate(with_modules=true) str = %Q| digraph #{@graph_name} { #{"rankdir=LR;\n" if @left_to_right} #{"ordering=out;\n" if @sort_alphabetic} edge [color="#{@color_edge}",fontname="#{@font}",fontsize=#{font_size_edge}]; node [color="#{@color_hidden}",fontcolor="#{@color_hidden}",fontname="#{@font}",fontsize=#{font_size},shape=#{shape_class},height=#{@height},width=#{@width}]; | # get classes current = Array.new ObjectSpace.each_object(Class) do |klass| current.push klass end todo = current - @classes - @ignored.keys # remove all classes from ignore_tree todo.delete_if do |klass| klass = klass.superclass while klass && !@ignored_tree[klass] klass end todo = todo.sort_by { |klass| klass.to_s } todo.each do |klass| # all classes black str << %Q| "#{klass}" [height=#{@height},width=#{@width},color="#{@color}",fontcolor="#{@color}"];\n| end con = Hash.new # connections todo.each do |klass| while superclass = klass.superclass break if @ignored[superclass] con[ [superclass, klass] ] = true klass = superclass end end con.each_key do |superclass, klass| str << %Q{\t"#{superclass}" -> "#{klass}";\n} end str << "\n" gen_modules(str, todo) if with_modules str << "}" str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def dot\n RGL::DOT::Graph.new('elements' => dot_edges).to_s\n end", "def to_dot (params={}) to_dot_graph(params).to_s; end", "def to_dot (params={}) to_dot_graph(params).to_s; end", "def to_dot\n i = 0\n dot = [\"digraph G {\", \"#{i} [label=\\\"self\\\"];\"]\n _to_dot(dot, \"\", i, se...
[ "0.7877583", "0.7474248", "0.7474248", "0.7381871", "0.73514456", "0.7338884", "0.7243258", "0.70842546", "0.7081876", "0.7055181", "0.705158", "0.70044804", "0.69768965", "0.6903931", "0.6893293", "0.6819366", "0.6757849", "0.67157936", "0.66546035", "0.662403", "0.6598103",...
0.60193527
45
Create a new DNS monitor with the given +options+.
def initialize( options=DEFAULT_OPTIONS ) options = DEFAULT_OPTIONS.merge( options || {} ) options.each do |name, value| self.public_send( "#{name}=", value ) end @client = Whois::Client.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(options = {})\n @options = {\n :daemonize => DEFAULT_DAEMONIZE,\n :host => DEFAULT_HOST,\n :path => DEFAULT_PATH,\n :pid_file => DEFAULT_PID_FILE,\n :port => DEFAULT_PORT,\n :threads_number => DEFAULT_THREADS_NUM...
[ "0.6064956", "0.60221183", "0.5793687", "0.55477023", "0.5499154", "0.54941326", "0.5460354", "0.5424016", "0.5369096", "0.5354829", "0.5324311", "0.5321214", "0.53147143", "0.5308993", "0.53043556", "0.52905476", "0.5269478", "0.52592635", "0.52573234", "0.5248966", "0.52230...
0.0
-1
Return a clone of this object with its timeout set to +new_timeout+.
def with_timeout( new_timeout ) copy = self.clone copy.timeout = new_timeout return copy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def without_timeout\n\t\treturn self.clone( :timeout => 0 )\n\tend", "def timeout=(new_timeout)\n if new_timeout && new_timeout.to_f < 0\n raise ArgumentError, \"Timeout must be a positive number\"\n end\n @timeout = new_timeout.to_f\n end", "def connect_timeout=(new_timeout)\n if...
[ "0.64084935", "0.6082062", "0.5882083", "0.5701635", "0.5602263", "0.55298173", "0.546274", "0.54486436", "0.5408024", "0.5324225", "0.5262407", "0.5258866", "0.5258866", "0.5250542", "0.5217657", "0.51823545", "0.5137367", "0.5131997", "0.50728095", "0.50595796", "0.50453144...
0.86934096
1
Run the domain check for each of the specified Hash of +nodes+ and return a Hash of updates for them based on their DNS domain record's status.
def run( nodes ) self.log.debug "Got nodes to check with %p: %p" % [ self, nodes ] records = nodes.each_with_object( {} ) do |(identifier, node), hash| self.log.debug "Looking up whois info for %p (%p)" % [ identifier, node ] hash[ identifier ] = self.client.lookup( node['name'] ) end return records.each_with_object( {} ) do |(identifier, record), hash| parser = record.parser hash[ identifier ] = self.parse_record( parser, identifier ) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run( nodes )\n\t\t\tself.log.debug \"Got %d nodes to check with %p\" % [ nodes.length, self ]\n\t\t\tlookups = self.create_lookups( nodes )\n\t\t\treturn self.wait_for_responses( lookups, nodes )\n\t\tend", "def find_applying_nodes(hosts, statuses = [])\n Log.debug(\"checking applying status of #{host...
[ "0.64395267", "0.59737647", "0.59626085", "0.58956754", "0.57425475", "0.5713824", "0.56919813", "0.5617458", "0.5540912", "0.55262655", "0.5474444", "0.54590106", "0.54089713", "0.53691214", "0.53557086", "0.53376764", "0.53181106", "0.52742827", "0.5227042", "0.5222256", "0...
0.675163
0
Use the provided +parser+ to build an update for the node with the specified +identifier+ and return it as a Hash.
def parse_record( parser, identifier ) expires = parser.expires_on if parser.property_any_supported?( :expires_on ) if !parser.registered? return { error: 'Not registered.' } elsif expires && expires <= Time.now return { error: "Expired on #{expires}" } end return Whois::Parser::PROPERTIES.each_with_object({}) do |prop, data| next unless parser.property_any_supported?( prop ) val = parser.public_send( prop ) case prop when :nameservers data[ 'nameservers' ] = val.map( &:name ) when :available?, :registered? data[ prop.to_s[0..-2] ] = val when :registrant_contacts, :admin_contacts, :technical_contacts data[ prop ] = val.map do |contact| "%s <%s>" % [ contact.name, contact.email ] end when :status data[ prop ] = val.map( &:to_s ) else data[ prop ] = val.to_s end end rescue Whois::ParserError, NoMethodError => err msg = "%p while parsing record for %s: %s" % [ err.class, identifier, err.message ] self.log.error( msg ) self.log.debug { err.backtrace.join("\n ") } return { warning: "Record fetched, but the record could not be parsed." } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(hash); end", "def parse()\n r = Hash.new\n r[:timestamp] = @id >> Worker::TIMESTAMP_LEFT_SHIFT_BITS\n r[:time] = Worker::EPOCH.to_i + (@id >> Worker::TIMESTAMP_LEFT_SHIFT_BITS) / 1000.0\n r[:node] = (@id >> Worker::WORKERID_LEFT_SHIFT_BITS) & (-1 ^ (-1 << Worker::NODEID_BITS))\n ...
[ "0.49581718", "0.48748443", "0.46445203", "0.4626717", "0.4610098", "0.45846266", "0.45733577", "0.45426938", "0.45315206", "0.45207796", "0.4496077", "0.44676703", "0.44437933", "0.4423479", "0.4423479", "0.43993577", "0.43958464", "0.43929496", "0.43842736", "0.43687123", "...
0.4228231
30
Create a new DNS monitor with the given +options+.
def initialize( options=DEFAULT_OPTIONS ) options = DEFAULT_OPTIONS.merge( options || {} ) options.each do |name, value| self.public_send( "#{name}=", value ) end @resolver = Resolv::DNS.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(options = {})\n @options = {\n :daemonize => DEFAULT_DAEMONIZE,\n :host => DEFAULT_HOST,\n :path => DEFAULT_PATH,\n :pid_file => DEFAULT_PID_FILE,\n :port => DEFAULT_PORT,\n :threads_number => DEFAULT_THREADS_NUM...
[ "0.6064956", "0.60221183", "0.55477023", "0.5499154", "0.54941326", "0.5460354", "0.5424016", "0.5369096", "0.5354829", "0.5324311", "0.5321214", "0.53147143", "0.5308993", "0.53043556", "0.52905476", "0.5269478", "0.52592635", "0.52573234", "0.5248966", "0.5223063", "0.52216...
0.5793687
2
Run the domain check for each of the specified Hash of +nodes+ and return a Hash of updates for them based on their DNS domain record's status.
def run( nodes ) self.log.debug "Got %d nodes to check with %p" % [ nodes.length, self ] lookups = self.create_lookups( nodes ) return self.wait_for_responses( lookups, nodes ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run( nodes )\n\t\t\tself.log.debug \"Got nodes to check with %p: %p\" % [ self, nodes ]\n\n\t\t\trecords = nodes.each_with_object( {} ) do |(identifier, node), hash|\n\t\t\t\tself.log.debug \"Looking up whois info for %p (%p)\" % [ identifier, node ]\n\t\t\t\thash[ identifier ] = self.client.lookup( node['name...
[ "0.675163", "0.59737647", "0.59626085", "0.58956754", "0.57425475", "0.5713824", "0.56919813", "0.5617458", "0.5540912", "0.55262655", "0.5474444", "0.54590106", "0.54089713", "0.53691214", "0.53557086", "0.53376764", "0.53181106", "0.52742827", "0.5227042", "0.5222256", "0.5...
0.64395267
1
Create lookups for all the names in the specified +nodes+ and return a Hash of node identifiers keyed by the lookup Thread that is fetching the record.
def create_lookups( nodes ) return nodes.each_with_object( {} ) do |(identifier, node), hash| self.log.debug "Creating lookup for node: %p" % [ node ] name = node['name'] or next record_type = node['record_type'] || 'A' record_class = Resolv::DNS::Resource::IN.const_get( record_type ) or raise "Unsupported record type %p!" % [ record_type ] self.log.debug "Looking up %s record for %s (%s)" % [ record_type, name, identifier ] thr = Thread.new do self.resolver.getresources( name, record_class ) end hash[ thr ] = identifier end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_host_keys(_nodes, metadata)\n updated_metadata = {}\n # Get the list of nodes, per hostname (just in case several nodes share the same hostname)\n # Hash<String, Array<String> >\n hostnames = Hash.new { |hash, key| hash[key] = [] }\n metadata.each do |node, node...
[ "0.6362123", "0.6238826", "0.5902057", "0.57655853", "0.57206625", "0.5666619", "0.54756373", "0.54353553", "0.5363174", "0.531582", "0.531582", "0.53138226", "0.5165208", "0.5155551", "0.5141833", "0.51401424", "0.5122923", "0.51089525", "0.5098923", "0.50561416", "0.5052161...
0.7914847
0
Wait for the lookup threads in +lookups+ to finish and return a Hash of node updates.
def wait_for_responses( lookups, nodes ) update = {} until lookups.empty? lookups.keys.each do |thr| next if thr.alive? identifier = lookups.delete( thr ) begin records = thr.value if !records update[ identifier ] = { error: "Lookup failed (timeout)." } elsif records.empty? update[ identifier ] = { error: "Lookup failed (no records returned)." } else node_data = nodes[ identifier ] update[ identifier ] = self.compare_values( records, node_data ) end rescue SystemCallError => err msg = "%p: %s" % [ err.class, err.message ] self.log.error "%s while looking up %s" % [ msg, identifier ] update[ identifier ] = { error: msg } end end end return update end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run( nodes )\n\t\t\tself.log.debug \"Got %d nodes to check with %p\" % [ nodes.length, self ]\n\t\t\tlookups = self.create_lookups( nodes )\n\t\t\treturn self.wait_for_responses( lookups, nodes )\n\t\tend", "def create_lookups( nodes )\n\t\t\treturn nodes.each_with_object( {} ) do |(identifier, node), hash|\...
[ "0.6164099", "0.6056663", "0.5340351", "0.5247167", "0.5187989", "0.517058", "0.51317114", "0.5130107", "0.51201093", "0.5017466", "0.49810123", "0.49194014", "0.4897538", "0.48940453", "0.488707", "0.48503375", "0.48428032", "0.48377717", "0.47676444", "0.47662422", "0.46872...
0.7522926
0
Compare the given resolver +records+ with the +node_data+, and create an update hash describing the results.
def compare_values( records, node_data ) type = node_data['record_type'] case type when 'A' return self.compare_a_records( records, node_data['values'] ) when 'NS' return self.compare_ns_records( records, node_data['values'] ) when 'MX' return self.compare_mx_records( records, node_data['values'] ) else return { dns: "#{type} not comparable yet." } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_ns_records( records, hosts )\n\t\t\trecord_hosts = Set.new( records.map(&:name) )\n\t\t\thosts = Set.new( hosts.map {|name| Resolv::DNS::Name.create(name + '.')} )\n\n\t\t\tself.log.debug \"Comparing %p to %p\" % [ record_hosts, hosts ]\n\n\t\t\tstatus = nil\n\t\t\tif ( record_hosts ^ hosts ).empty?\n\...
[ "0.5970906", "0.5812563", "0.5770197", "0.5332086", "0.528021", "0.5234157", "0.5077164", "0.50481206", "0.49992508", "0.49362028", "0.49212083", "0.48143524", "0.4779476", "0.47244877", "0.47005835", "0.4669268", "0.46248737", "0.45822784", "0.45342234", "0.45327076", "0.451...
0.63428754
0
Compare the addresses in the specified +records+ with the given +addresses+ and error if any are not present.
def compare_a_records( records, addresses ) record_addresses = Set.new( records.map(&:address) ) addresses = Set.new( addresses.map {|addr| Resolv::IPv4.create(addr)} ) status = nil if addresses.subset?( record_addresses ) status = { a_record: {addresses: record_addresses.map(&:to_s)} } else missing = addresses - record_addresses status = { error: "missing A records: %s" % [ missing.map(&:to_s).join(', ') ] } end return status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_ns_records( records, hosts )\n\t\t\trecord_hosts = Set.new( records.map(&:name) )\n\t\t\thosts = Set.new( hosts.map {|name| Resolv::DNS::Name.create(name + '.')} )\n\n\t\t\tself.log.debug \"Comparing %p to %p\" % [ record_hosts, hosts ]\n\n\t\t\tstatus = nil\n\t\t\tif ( record_hosts ^ hosts ).empty?\n\...
[ "0.6614167", "0.6467907", "0.59206665", "0.5809993", "0.56610745", "0.55722725", "0.52838653", "0.5208784", "0.5201524", "0.51864046", "0.51519865", "0.5139839", "0.5101072", "0.508444", "0.5021086", "0.49941257", "0.4979793", "0.49712396", "0.49596435", "0.49403507", "0.4915...
0.83933824
0
Compare the expected +hosts+ with those in the fetched NS +records+.
def compare_ns_records( records, hosts ) record_hosts = Set.new( records.map(&:name) ) hosts = Set.new( hosts.map {|name| Resolv::DNS::Name.create(name + '.')} ) self.log.debug "Comparing %p to %p" % [ record_hosts, hosts ] status = nil if ( record_hosts ^ hosts ).empty? status = { ns_record: record_hosts.map(&:to_s) } elsif !( subset = record_hosts - hosts ).empty? status = { error: "missing NS records: %s" % [subset.map(&:to_s).join(', ')] } elsif !( subset = hosts - record_hosts ).empty? status = { error: "extra NS records: %s" % [subset.map(&:to_s).join(', ')] } end return status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_mx_records( records, hosts )\n\t\t\trecord_hosts = Set.new( records.map(&:exchange) )\n\t\t\thosts = Set.new( hosts.map {|name| Resolv::DNS::Name.create(name + '.')} )\n\n\t\t\tself.log.debug \"Comparing %p to %p\" % [ record_hosts, hosts ]\n\n\t\t\tstatus = nil\n\t\t\tif ( record_hosts ^ hosts ).empty...
[ "0.7051646", "0.6280299", "0.61838067", "0.5814303", "0.5810692", "0.56846297", "0.56522155", "0.56451154", "0.55988854", "0.55615735", "0.5445128", "0.5437142", "0.5374587", "0.5336497", "0.5333903", "0.5324774", "0.5277381", "0.5245956", "0.52327573", "0.52294654", "0.52182...
0.7778975
0
Compare the expected +hosts+ with those in the fetched MX +records+.
def compare_mx_records( records, hosts ) record_hosts = Set.new( records.map(&:exchange) ) hosts = Set.new( hosts.map {|name| Resolv::DNS::Name.create(name + '.')} ) self.log.debug "Comparing %p to %p" % [ record_hosts, hosts ] status = nil if ( record_hosts ^ hosts ).empty? record_strings = records. map {|rec| "%s[%d]" % [rec.exchange, rec.preference || 0] } status = { mx_record: record_strings.join( ', ' ) } elsif !( subset = record_hosts - hosts ).empty? status = { error: "missing MX records: %s" % [subset.map(&:to_s).join(', ')] } elsif !( subset = hosts - record_hosts ).empty? status = { error: "extra MX records: %s" % [subset.map(&:to_s).join(', ')] } end return status end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare_ns_records( records, hosts )\n\t\t\trecord_hosts = Set.new( records.map(&:name) )\n\t\t\thosts = Set.new( hosts.map {|name| Resolv::DNS::Name.create(name + '.')} )\n\n\t\t\tself.log.debug \"Comparing %p to %p\" % [ record_hosts, hosts ]\n\n\t\t\tstatus = nil\n\t\t\tif ( record_hosts ^ hosts ).empty?\n\...
[ "0.72329545", "0.6538074", "0.64268786", "0.6327804", "0.631965", "0.61163247", "0.6058553", "0.6029414", "0.5943307", "0.5832349", "0.5720855", "0.5710602", "0.56563276", "0.5607008", "0.5506667", "0.54989445", "0.5481852", "0.5473348", "0.5465271", "0.5459152", "0.54170203"...
0.80028486
0
send a signup email to the user, pass in the user object that contains the user's email address
def signup_email(user) @user = user mail(to: @user.email, subject: 'Thanks for signing up for our amazing app') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_signup_email(user)\n @user = user\n mail( to: @user.email,\n subject: \"Thanks for signing up, #{@user.email}!\")\n end", "def send_signup_email(user)\n @user = user\n mail(to: @user.email, subject: 'Thanks for signing up!')\n end", "def signup_email(user)\n mail( :to => user...
[ "0.85147613", "0.84859043", "0.84804153", "0.8466327", "0.8461068", "0.84345907", "0.83614045", "0.83595186", "0.8347467", "0.83424085", "0.83424085", "0.833232", "0.83076817", "0.8304023", "0.830207", "0.82883614", "0.8278261", "0.8244641", "0.8227462", "0.8217185", "0.82115...
0.8546309
0
GET /jobs GET /jobs.xml
def index respond_to do |format| format.html { @groups = Group.get_groups(current_user, params) } format.xml { render :xml => Group.get_groups(params.merge({:show => 'all'})) } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def jobs\n doc = Nokogiri::XML open(@url)\n\n doc.search('//job').map { |node|\n Job.new(attributes_from(node))\n }\n end", "def index\n @jobs = Job.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @jobs }\n end\n end", "d...
[ "0.73205507", "0.72729135", "0.71821696", "0.7130482", "0.7030642", "0.7021925", "0.6835374", "0.68151474", "0.68074626", "0.673195", "0.6662918", "0.6662918", "0.6662918", "0.6662918", "0.6662918", "0.6662918", "0.6662918", "0.66599715", "0.6652008", "0.6643812", "0.6624499"...
0.0
-1
GET /group/1 GET /group/1.xml
def show @group = Group.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @group.to_xml } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @group }\n end\n end", "def show\n @group = Group.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { re...
[ "0.7056438", "0.7051215", "0.7051215", "0.7051215", "0.7051215", "0.7051215", "0.69633293", "0.69633293", "0.6911578", "0.6901699", "0.6867055", "0.6867055", "0.682145", "0.6771966", "0.67499894", "0.6715324", "0.6703261", "0.6700914", "0.6695819", "0.66550297", "0.6605144", ...
0.7224538
0
GET /group/new GET /group/new.xml
def new @group = Group.new respond_to do |format| format.html format.xml { render :xml => @group.to_xml } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @group = Group.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end\n end", "def new\n @group = Group.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @group }\n end...
[ "0.8140932", "0.81277347", "0.81277347", "0.81277347", "0.81277347", "0.81277347", "0.81277347", "0.81277347", "0.81277347", "0.81277347", "0.80326277", "0.80315775", "0.802249", "0.7899247", "0.7870291", "0.7855039", "0.7848567", "0.782753", "0.779655", "0.7669039", "0.76665...
0.8025474
12
POST /groups POST /groups.xml
def create @group = Group.new(params[:group]) respond_to do |format| if @group.save group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('Owner').id) group_user.approve! flash[:notice] = "Group has been created!" format.html { redirect_to groups_path } format.xml { render :xml => @group.to_xml } else format.html { render :action => :new } format.xml { render :xml => @group.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate(groups)\n groups_params = groups.inject({}) do |params, (k, v)|\n params[\"groups[#{k}]\"] = 1\n params\n end\n\n response = RouteNGN.put self.class.base_url, {:id => self.id}.merge!(groups_params)\n response.success?\n end", "def create\n #logger.info \"Post parameters...
[ "0.660965", "0.6602641", "0.6588023", "0.6588023", "0.6567241", "0.6546185", "0.6518592", "0.63975435", "0.6392506", "0.6383147", "0.63828105", "0.6363887", "0.6356866", "0.6355277", "0.6355277", "0.6355277", "0.6323264", "0.6296784", "0.6214893", "0.61911434", "0.6170261", ...
0.60212445
42
GET /groups/1/edit GET /groups/1/edit.xml
def edit respond_to do |format| format.html format.xml { render :xml => @group.to_xml } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def edit\n respond_to do |format|\n format.html\n format.xml { render :xml => @group_user.to_xml }\n end\n end", "def edit\n @group = Group.find(params[:id])\n end", "def edit\n @group = Group.find(params[:id])\n end", "def edit\n @group = Group.find_by_id params[:id]\n en...
[ "0.7694557", "0.7006799", "0.69988525", "0.6979855", "0.6634475", "0.6613017", "0.6613017", "0.66038346", "0.66038346", "0.66038346", "0.66038346", "0.66038346", "0.66038346", "0.6591789", "0.65787894", "0.6555638", "0.65346366", "0.6505652", "0.6492212", "0.6462138", "0.6460...
0.7953539
0
PUT /groups/1 PUT /groups/1.xml
def update respond_to do |format| if @group.update_attributes(params[:group]) flash[:notice] = 'Group was successfully updated.' format.html { redirect_to groups_path } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @group.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n logger.info \"Put parameters: #{params.to_json}\"\n @group = Group.find(params[:id])\n\n if @group.update_attributes(params[:group])\n head :no_content\n else\n render json: @group.errors, status: :unprocessable_entity\n end\n end", "def update\n \n @group = Group.find(...
[ "0.6685341", "0.66725194", "0.66642857", "0.66642857", "0.664555", "0.6640031", "0.6640031", "0.6640031", "0.6640031", "0.6640031", "0.6640031", "0.6574576", "0.65679026", "0.6565279", "0.6562684", "0.654085", "0.6539202", "0.65080595", "0.6467505", "0.6426014", "0.6406329", ...
0.6516348
17
DELETE /groups/1 DELETE /groups/1.xml
def destroy @group.destroy unless @group.default respond_to do |format| format.html { redirect_to(groups_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Group.rebuild! if nil.|Group.find(:first).rgt\n\t @group = Group.find(params[:id])\n @group.destroy\n\n respond_to do |format|\n format.html { redirect_to(groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n Group.destroy(params[:id])\n\n respond_to do ...
[ "0.7521902", "0.74687797", "0.74159586", "0.74159586", "0.7407865", "0.73870426", "0.738377", "0.738377", "0.738377", "0.738377", "0.738377", "0.738377", "0.738377", "0.738377", "0.73704463", "0.72693354", "0.7252211", "0.72371393", "0.71676433", "0.7165356", "0.7137911", "...
0.7185538
18
GET /groups/1/join GET /groups/1/join.xml
def join @group = Group.find(params[:id]) if group_user = GroupUser.first(:conditions => ['group_id = ? AND user_id = ?', @group.id, current_user.id]) if ['cancelled', 'invite_declined'].include?(group_user.status) group_user.request! flash[:notice] = 'Your membership request was sent to group owner.' elsif group_user.status == 'approved' flash[:error] = 'You are already member of this group.' else flash[:error] = 'You cannot join this group.' end else group_user = GroupUser.create(:group_id => @group.id, :user_id => current_user.id, :role_id => Role.find_by_name('User').id) group_user.request! flash[:notice] = 'Your membership request was sent to group owner.' end respond_to do |format| format.html { redirect_to(groups_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def join\n @group = Group.find_by_id(params[:id])\n if @group\n @user.join_group(@group)\n flash[:success] = \"Join It Successed\"\n redirect_to :action => \"reports\", :id => @group\n else\n flash[:warning] = \"Not Exist Group to Join\"\n end\n end", "def join\n @person = Per...
[ "0.6410519", "0.63028866", "0.6271348", "0.61650723", "0.61116976", "0.5949017", "0.5712206", "0.5645062", "0.56180453", "0.5455591", "0.54521614", "0.5450662", "0.5440575", "0.5428224", "0.5402525", "0.53564525", "0.5349451", "0.5332109", "0.53220916", "0.53220916", "0.53058...
0.63111734
1
The view contains a more detailed account_setup form (step 2 signup process).
def account_setup # GET 'admins#account_setup' authenticate_admin if @current_admin == nil redirect_to root_path end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def account_complete # POST '/admin/account_setup'\n @admin = Admin.find(session[:admin_id])\n\n # This section of the site is built for new admin accounts.\n # Update the admin attributes with more detailed information from the\n # account_setup (step 2) form, && update the their first store which was...
[ "0.69698673", "0.6576694", "0.65688086", "0.65266263", "0.6369515", "0.62892467", "0.62160987", "0.6211264", "0.61650825", "0.6136421", "0.6136421", "0.6131539", "0.61231965", "0.6053946", "0.6034264", "0.59950346", "0.59885436", "0.598013", "0.5939335", "0.59365517", "0.5929...
0.6136644
9
Update the account & store with params sent from account_setup form.
def account_complete # POST '/admin/account_setup' @admin = Admin.find(session[:admin_id]) # This section of the site is built for new admin accounts. # Update the admin attributes with more detailed information from the # account_setup (step 2) form, && update the their first store which was # instantiated at the account_create action. if @admin.update(admin_params) && @admin.stores.first.update(store_params) ## Sign-up is successful and admin dashboard is loaded. redirect_to admin_path else render :account_setup end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n set_action(:update)\n set_account_type\n validate_account_type!\n assign_params\n set_affiliate\n set_updated_by\n\n after_update\n account\n end", "def update\n respond_to do |format|\n @account.assign_attributes(account_params)\n if @account.save\n form...
[ "0.78936625", "0.73299444", "0.7187067", "0.70923245", "0.7070606", "0.69922864", "0.69412386", "0.69100744", "0.6853872", "0.68528765", "0.68528765", "0.6838077", "0.68362284", "0.6815558", "0.680591", "0.68021846", "0.6765862", "0.6764676", "0.6737823", "0.6731071", "0.6716...
0.70518905
5
Managing a store Home page for a signed in admin: 'Dashboard'.
def dashboard # redirection to root_path if not logged into an admin account. if @current_admin == nil || @current_admin.empty? redirect_to root_path else @products = Product.all # See private function at the bottom. Refactored to be more DRY.. store_options_for_select @selected_store_products = @selected_store.products @staff_members = @selected_store.admins.map { |s| "#{s.first_name} #{s.last_name}" } @price_array = [] @hidden_items_array = [] @inventory_array = [] @gross_array = [] # Store products analytics @selected_store.products.each do |product| if product.quantity && product.price sum = product.quantity * product.price @gross_array << sum @price_array << product.price @inventory_array << product.quantity end if product.visibility && product.visibility == false @hidden_items_array << product end end unless @gross_array.blank? @gross_array.inject do |sum, x| @gross_income = sum + x end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def admin_index\n return if !user_is_allowed('pages', 'view') \n @domain = Domain.where(:domain => request.host_with_port).first\n @home_page = @domain ? Page.index_page(@domain.site_id) : nil\n if @domain && @home_page.nil?\n @home_page = Caboose::Page.create(:site_id => @dom...
[ "0.7092553", "0.7062843", "0.7044631", "0.69345635", "0.6927658", "0.68333244", "0.682641", "0.6808186", "0.67994493", "0.6759342", "0.6737024", "0.6721251", "0.6655804", "0.6628852", "0.66228056", "0.6607425", "0.6605968", "0.6604882", "0.65962106", "0.65921307", "0.653976",...
0.0
-1
Create a new campaign. Requires a name, templateId and at least one listId
def create(name, template_id, list_ids = [], attrs = {}) body = attrs.merge(name: name, templateId: template_id, listIds: list_ids) Iterable.request(conf, '/campaigns/create').post(body) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mccreate_campaign_template(type, opts)\n # setup_mcapi.campaigns.create(\"regular\", {list_id: \"a38ec3df9c\", subject: \"Gibbon is cool\", from_email: \"milton@gr33nmedia.com\", from_name: \"Darth Vader\", template_id: 198041, generate_text: true}, {})\n setup_mcapi.campaigns.create(type, opts, content ...
[ "0.6966859", "0.69255346", "0.6486239", "0.6331614", "0.6303938", "0.6069134", "0.6069134", "0.6010403", "0.5967475", "0.59510046", "0.59034526", "0.59006727", "0.5888634", "0.58681035", "0.58034587", "0.5803171", "0.5776307", "0.57684535", "0.5764754", "0.57470644", "0.57466...
0.86716205
0
Get recurring child campaigns for a campaign
def recurring(campaign_id) Iterable.request(conf, "/campaigns/recurring/#{campaign_id}/childCampaigns").get end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def campaigns\n response = get 'campaigns'\n response.map{|item| Hashie::Mash.new(item)}\n end", "def get_contact_campaigns(id)\n return make_request(\"#{self.endpoint}/#{id}/campaigns\")\n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => ...
[ "0.5981326", "0.5886731", "0.58036757", "0.57709426", "0.5763354", "0.5758741", "0.57077026", "0.56977236", "0.5695962", "0.56759095", "0.56620777", "0.56620777", "0.5660138", "0.5634783", "0.557007", "0.5441933", "0.5418714", "0.53877634", "0.5374748", "0.53566366", "0.53347...
0.8493955
0
Export metrics in CSV format for one or more campaigns
def metrics(campaign_ids = [], start_time = nil, end_time = nil) params = { campaignId: campaign_ids } if start_time params[:startTime] = start_time.to_date.strftime(Iterable::DATE_FORMAT) params[:endTime] = end_time.to_date.strftime(Iterable::DATE_FORMAT) end Iterable.request(conf, '/campaigns/metrics', params).get end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def write_to_csv(opts = {})\n filename = opts.fetch(:filename) { 'twords_report.csv' }\n write_file(filename, :to_csv, opts)\n end", "def write_csv_report\n unless @csv.nil?\n @csvexport.write(@csv)\n end\n end", "def output_csv(datastore)\n CSV.open(OUTPUT_CSV, \"wb\") do |csv|\n ...
[ "0.65281975", "0.6377574", "0.63710546", "0.63386273", "0.6303656", "0.618765", "0.618765", "0.60035276", "0.599142", "0.5974149", "0.59554225", "0.59412813", "0.5920252", "0.59174967", "0.5897788", "0.5889055", "0.58872867", "0.588151", "0.5874404", "0.58655864", "0.58565867...
0.58811414
18
Wrap test runs in a transaction to replicate AR's transactional fixtures See:
def run(*args, &block) Sequel::Model.db.transaction(rollback: :always, auto_savepoint: true) { super } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def spy_transaction!\n @within_transaction = nil\n allow(TestSqlCaller).to receive(:transaction).and_wrap_original do |meth, *args, &block|\n @within_transaction = true\n meth.call(*args, &block)\n ensure\n @within_transaction = false\n end\n end", "def with_transaction\n ActiveRec...
[ "0.7172905", "0.7034204", "0.70049345", "0.69483507", "0.692453", "0.67865217", "0.67865217", "0.67567015", "0.67567015", "0.67567015", "0.6741999", "0.67283875", "0.6690304", "0.66793776", "0.66793776", "0.66781414", "0.6628899", "0.6626953", "0.658819", "0.658819", "0.65201...
0.6446898
24
true when value was already assigned
def filled? @value.positive? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def assign?\n\t\ttrue\n\tend", "def explicitly_set_value?\n @explicitly_set_value == true\n end", "def value_constructed_by_mass_assignment?(_value)\n false\n end", "def value_set?\n @value_set == true\n end", "def assigning?\n !assign_stack.empty?\n end", "def set...
[ "0.78393275", "0.73788786", "0.7273575", "0.7266546", "0.70290065", "0.7000641", "0.6976678", "0.6906508", "0.67959327", "0.6760182", "0.6749322", "0.6699247", "0.66718113", "0.6659968", "0.66290164", "0.66290164", "0.6603629", "0.6603629", "0.6565545", "0.6535013", "0.651383...
0.0
-1
number of possible values at this position
def num_possible return -1 if filled? @possible.size end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count\n values.inject(0){|m, v| m + v.length}\n end", "def num_possible\n return -1 if filled?\n @possible.size\n end", "def value_count\n values.count\n end", "def count; @value.size; end", "def num_possible\n @possible\n end", "def length\n values.length\n ...
[ "0.75349104", "0.74319696", "0.7428594", "0.7411988", "0.72394055", "0.72371763", "0.7222108", "0.7222108", "0.7222108", "0.71478707", "0.708246", "0.7055507", "0.7026769", "0.6987042", "0.67609555", "0.6747905", "0.6729629", "0.6700157", "0.66934097", "0.6627457", "0.6586765...
0.74891293
1
exclude possibility return true if number was deleted
def exclude(num) return true if !filled? && @possible.delete(num) false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exclude(num)\n return true if !filled? && @possible.delete(num)\n false\n end", "def cannot_be_deleted\n return false if self.id == 1\n end", "def test_ok_to_delete\n assert_equal(false, Intensity.ok_to_delete?(2))\n assert_equal(false, Intensity.ok_to_delete?(1))\n #at this time, I hav...
[ "0.6699805", "0.6688743", "0.65604806", "0.63156945", "0.62685853", "0.62591946", "0.62591946", "0.6227051", "0.61972034", "0.61782956", "0.61782956", "0.6139152", "0.6083896", "0.6063883", "0.60551536", "0.6054716", "0.60399336", "0.60314626", "0.60247487", "0.60247487", "0....
0.67659307
0
include possibility return true if number was included
def include(num) return true if !filled? && @possible.insert(num - 1, num) false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def include?(num)\n self[num].include?(num)\n end", "def number_included(number)\n arr = [1, 3, 5, 7, 9, 11]\n puts \"number\": number\n puts arr.include? number\nend", "def include?(arr, num)\n arr.each{ |element| return true if element == num}\n return false\nend", "def include?(arr, number)\n ar...
[ "0.76985776", "0.7622094", "0.74142003", "0.7167877", "0.71227515", "0.70524013", "0.7003844", "0.700377", "0.700377", "0.700377", "0.700377", "0.700377", "0.68770146", "0.6713544", "0.66451263", "0.66409093", "0.6621245", "0.65714586", "0.65215695", "0.6519412", "0.65112996"...
0.7425215
2
For getters and setters
def initialize char1 @p=char1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def getters; end", "def name\n return @name\nend\ndef age\n return @age\nend\n#setters, allows you to change or set something\ndef name=(name)\n @name = name\nend", "def to_setter\n\t\t\t\t(to_getter.to_s+\"=\").to_sym\n\t\t\tend", "def setter_to_getter(node); end", "def setter_method\n :\"#{se...
[ "0.8170303", "0.7327501", "0.7088328", "0.6928124", "0.68670124", "0.67980784", "0.67834765", "0.67760384", "0.6766563", "0.6766563", "0.67421234", "0.67149687", "0.66916895", "0.6628344", "0.66181093", "0.65703", "0.65703", "0.65703", "0.65703", "0.65703", "0.65703", "0.65...
0.0
-1
Looks to see if device is statically configured, if not then call the set methods
def initialize # API support utilizes excon, if it isn't found an error will be raised require 'excon' # rXg production environments should ALWAYS have a valid certificate # If no valid certificate for device uncomment line below # Excon.defaults[:ssl_verify_peer] = false # Configure a static device address and API key here # Device address format example: https://google.com @device_address = set_device_address @device_api_key = set_api_key(@device_address) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setupDevice(devtype,param) \n case devtype\n when 'gtk', :gtk\n @device = MyCanvasGtk.new(param) ;\n## when 'gtk2'\n## @device = MyCanvasGtk2.new(param) ;\n when 'tgif', :tgif\n @device = MyCanvasTgif.new(param) ;\n when 'tk', :tk\n @device = MyCanvasTk.new(param) ;\n else...
[ "0.6319103", "0.6297391", "0.61364865", "0.6117838", "0.61052877", "0.6014249", "0.59481823", "0.59150475", "0.58944905", "0.58941984", "0.5853575", "0.5830868", "0.57593066", "0.5757208", "0.5737723", "0.5730444", "0.570976", "0.56861484", "0.5684176", "0.567845", "0.5640153...
0.0
-1
Invoked if device address is not defined, validates connection.
def set_device_address address_input = nil while address_input.nil? puts 'Enter device address (e.g.: https://google.com):' begin Excon.get($stdin.gets.chomp!, connect_timeout: 15) rescue StandardError puts 'Unable to connect to device, please check the address.' else address_input = $_ end end address_input end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_devices\n\traise \"No connected device was found.\" if no_device?\nend", "def check_address(_)\n raise NotImplementedError\n end", "def validate_devices\n [gateway_serial, transmitter_serial].each do |_serial|\n errors.add_to_base(\"Device #{_serial} is not available. Please verify the se...
[ "0.6138281", "0.5802578", "0.56302357", "0.5494217", "0.54739004", "0.54739004", "0.5449092", "0.5441649", "0.5281649", "0.5281649", "0.5233416", "0.5214443", "0.5205222", "0.51662564", "0.5141159", "0.51387495", "0.51349705", "0.51312983", "0.5108274", "0.5100574", "0.509332...
0.5636548
2
Invoked if API key is not defined, check if response status is 200 for successful request
def set_api_key(address) api_key_input = nil while api_key_input.nil? puts 'Enter your API key.' puts 'API key can be found at System > Admin, select your user and click Show.' get_response = Excon.get("#{address}/admin/scaffolds/switch_devices/index.json?api_key=#{$stdin.gets.chomp!}") if get_response.status === 200 api_key_input = $_ else puts 'Invalid key.' end end api_key_input end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_api_key\n return if api_key\n @logger.display('api_key_missing')\n exit 1\n end", "def check_api_key\n # Return 403 Forbidden if there is no api key in the request headers\n head :forbidden unless self.current_api_key\n end", "def verify_api_key\n # Confirm that it's a j...
[ "0.8188738", "0.7993975", "0.7755387", "0.7746557", "0.77318454", "0.76907986", "0.75247633", "0.74387705", "0.742795", "0.7313595", "0.730159", "0.7284073", "0.7218826", "0.72139716", "0.71080416", "0.7087966", "0.7086078", "0.7060449", "0.70391995", "0.70286494", "0.6996994...
0.0
-1
Connects to API and delivers payload via post Uses threads for parallel processing of post requests
def create_entry(payload_array, scaffold) api_url = "#{@device_address}/admin/scaffolds/#{scaffold}/create.json?api_key=#{@device_api_key}" api_connection = Excon.new(api_url, persistent: true) payload_array.map do |payload| Thread.new do api_connection.post( body: JSON[record: payload], headers: { 'Content-Type' => 'application/json' }, persistent: true ) end end.each(&:join) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post path_and_params, post_body\n start if not @pid\n @lock.synchronize do\n @last_use = Time.new.to_f\n\n # Make request to xtractr\n Net::HTTP.start('localhost', @port) do |http|\n http.request_post \"/#{path_and_params}\", post_body do |response|...
[ "0.6468379", "0.6223869", "0.6221298", "0.61462307", "0.61395264", "0.61217654", "0.60459155", "0.6043673", "0.6006896", "0.59055287", "0.5905483", "0.58910966", "0.5865252", "0.5849763", "0.58276635", "0.58213305", "0.5800709", "0.57840395", "0.57711834", "0.576592", "0.5749...
0.0
-1
Returns the body of get request, with option for passing a hash for filtering parameters
def get_table(scaffold, **filters) get_url = "#{@device_address}/admin/scaffolds/#{scaffold}/index.json?api_key=#{@device_api_key}" json_body = JSON.parse(Excon.get(get_url).body) if filters.any? filters.each do |name, value| json_body.keep_if { |return_item| return_item[name.to_s] == value.to_s } end end json_body end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get\n request_object.get_query\n end", "def body_params(request)\n body = request.body.read\n return {} if body.empty?\n\n JSON\n .parse(body)\n .each_with_object({}) { |(key, value), res| res[key] = filtered_value(key, value) }\n end", "def http_get_body(uri, credential...
[ "0.63484734", "0.6285159", "0.6257098", "0.6240063", "0.621525", "0.6056217", "0.6055301", "0.6053456", "0.6050894", "0.6046616", "0.60446924", "0.6020386", "0.5988293", "0.598794", "0.5987188", "0.5961442", "0.5961442", "0.5961442", "0.5961442", "0.5959406", "0.5904518", "...
0.0
-1
Gets all storage instances, instances must be filtered by the specified filter, filter (if set) must contain an Occi::Core::Mixins instance. Returned collection must contain Occi::Infrastructure::Storage instances wrapped in Occi::Core::Resources.
def storage_list(mixins = nil) storages = Occi::Core::Resources.new Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do volumes = @ec2_client.describe_volumes.volumes volumes.each do |volume| next unless volume storages << storage_parse_backend_obj(volume) end if volumes end storages end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def all\n storage\n end", "def all_storages\n hosts = all_hosts\n MiqPreloader.preload(hosts, :storages)\n hosts.collect(&:storages).flatten.compact.uniq\n end", "def storages\n IbmCloudRest.get \"#{@uri}/storage\"\n end", "def list(mixins = nil)\n # TODO: impl filter...
[ "0.6733361", "0.646533", "0.631976", "0.6300889", "0.62990654", "0.62872094", "0.6203506", "0.6121806", "0.6121806", "0.5918572", "0.5808153", "0.57654643", "0.57487977", "0.57340986", "0.5683546", "0.5622185", "0.5611591", "0.5582446", "0.55671453", "0.55671453", "0.553334",...
0.68213433
0
Gets a specific storage instance as Occi::Infrastructure::Storage. ID given as an argument must match the occi.core.id attribute inside the returned Occi::Infrastructure::Storage instance, however it is possible to implement internal mapping to a platformspecific identifier.
def storage_get(storage_id) filters = [] filters << { name: 'volume-id', values: [storage_id] } Backends::Ec2::Helpers::AwsConnectHelper.rescue_aws_service(@logger) do volumes = @ec2_client.describe_volumes(filters: filters).volumes volume = volumes ? volumes.first : nil return nil unless volume storage_parse_backend_obj(volume) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find(options = {})\n raise \"Unable to locate the storage named '#{options[:name]}'\" unless options[:id]\n response = Profitbricks.request :get_storage, \"<storageId>#{options[:id]}</storageId>\"\n Profitbricks::Storage.new(response.to_hash[:get_storage_response][:return])\n end", ...
[ "0.70809156", "0.69654936", "0.69528383", "0.69528383", "0.69528383", "0.69528383", "0.68170005", "0.67749244", "0.6626385", "0.6621228", "0.65538925", "0.6470883", "0.6440725", "0.64258957", "0.6402922", "0.6314419", "0.62876207", "0.6283339", "0.6281086", "0.62758887", "0.6...
0.7173718
0
Sets the site's url
def site_url if Rails.env.production? # Place your production URL in the quotes below "http://www.ezonline.com/" else # Our dev & test URL "http://ezonline-dev.com:3000" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_site_url\n @site_url = SiteUrl.find(params[:id]) if params[:id]\n end", "def set_site\n @site = Site.find_by(slug: params[:site_slug])\n\n # We just want a valid URL for the site\n @url = @site.routes.first.host_with_scheme if @site.routes.any?\n end", "def set_url\n @url = DEFAULT...
[ "0.81166565", "0.764335", "0.7636164", "0.7451123", "0.7438351", "0.7438351", "0.7438351", "0.7438351", "0.7438351", "0.742402", "0.7383348", "0.7332757", "0.7247373", "0.7215744", "0.71878105", "0.7182632", "0.7175835", "0.7175835", "0.7175835", "0.71576303", "0.7092747", ...
0.0
-1
Sets the author of the site
def meta_author # Change the value below between the quotes. "Team Tation" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_AuthorUsername(value)\n set_input(\"AuthorUsername\", value)\n end", "def author=(author)\n @author = author.to_s.strip\n end", "def set_author\n author_reference.reference = \"Patient/#{user.icn}\"\n end", "def author=(author)\n @author = author\n end", ...
[ "0.7599614", "0.75797874", "0.75769466", "0.7539164", "0.7435064", "0.7407946", "0.738863", "0.7374768", "0.73689765", "0.7353703", "0.73254436", "0.7293326", "0.72781205", "0.72464", "0.71533936", "0.71533936", "0.7140008", "0.7140008", "0.7140008", "0.7140008", "0.71172047"...
0.6746163
56
Sets the descriotion of the site
def meta_description # Change the value below between the quotes. "File Repository for EZ Troubleshooter" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_description(page)\n if !page.data['description']\n page.data['description'] = \"Check end-of-life, release policy and support schedule for #{page.data['title']}.\"\n end\n end", "def set_title_and_description\n website = Nokogiri::HTML(open(self.url))\n self.title = ...
[ "0.7389236", "0.6992278", "0.68011177", "0.66967404", "0.6505359", "0.64826983", "0.64793044", "0.64503634", "0.6393473", "0.63174766", "0.62601244", "0.6230144", "0.6230144", "0.6230144", "0.6230144", "0.6230144", "0.6230144", "0.6230144", "0.6230144", "0.6230144", "0.623014...
0.0
-1
Sets the key words for the site
def meta_keywords # Change the value below between the quotes. "ezonline, ez troubleshooter, repository" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_keywords\n\t\t\tself.keywords = [title, author, description].map(&:downcase).join(' ')\n\t\tend", "def the_keywords\n k = object.get_option(\"keywords\", \"\")\n k = h.current_site.the_keywords if object.class.name != \"CamaleonCms::Site\" && !k.present?\n k.to_s.translate(get_locale)\n end", ...
[ "0.7074105", "0.63755447", "0.63662577", "0.62822354", "0.6098856", "0.60911876", "0.6025354", "0.5941879", "0.5905031", "0.58012956", "0.5784372", "0.5767428", "0.5767428", "0.5767428", "0.5767428", "0.57613105", "0.57613105", "0.57613105", "0.56434494", "0.5585984", "0.5562...
0.52336025
65
Returns the full title on a perpage basis.No need to change any of this we set page_title and site_name elsewhere.
def full_title(page_title) if page_title.empty? site_name else "#{page_title} | #{site_name}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page_title\n @page_title ||= format_string(page[\"title\"]) || site_title\n end", "def title\n @title ||= begin\n if site_title && page_title != site_title\n page_title + TITLE_SEPARATOR + site_title\n elsif site_description && site_title\n site_titl...
[ "0.85687196", "0.8331109", "0.824858", "0.82197994", "0.81325006", "0.8109226", "0.8086481", "0.8071382", "0.8039476", "0.8034617", "0.79303885", "0.79068077", "0.79036236", "0.7898914", "0.7893025", "0.7887799", "0.78828776", "0.7867037", "0.7858253", "0.78459156", "0.784571...
0.8256091
7
Choose action depeding on level
def flash_class(level) case level when 'notice' then "alert alert-info" when 'success' then "alert alert-success" when 'error' then "alert alert-danger" when 'alert' then "alert alert-error" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_level_action(key)\n key = Access::Validate.level(key)\n get_hash_value(Access::Core.levels_hash, key, :action)\n end", "def action\n (@current_level = 'X' ; return) if ( @user_choice == 'X' || @user_choice == 'x')\n\n (menu_level_left ; return) if @user_choice == \"\\e[D\"\n\n ...
[ "0.68396413", "0.676429", "0.6751523", "0.6472519", "0.6215509", "0.61443734", "0.6142044", "0.6060048", "0.6034971", "0.60257566", "0.6013959", "0.5978408", "0.59598726", "0.59454983", "0.5935239", "0.5887355", "0.5865783", "0.5809525", "0.5809156", "0.5795123", "0.5770813",...
0.0
-1
puts "hi" puts "how are you" puts "I'm fine"
def say(words) puts words + '.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hello\n puts \"Hello Dude!!!\"\n puts \"Hellod Douchebag!!!\"\nend", "def saymessage\n puts \"hi programers\"\n puts \"I am hungy\"\nend", "def say_hello(anything)\n # write code\n puts anything\n puts \"Hello World!\"\nend", "def introduceMyself\n puts \"I am handsome\"\n puts \"I am talent...
[ "0.76101637", "0.7546645", "0.7523486", "0.74707955", "0.7434251", "0.7405326", "0.7393472", "0.73853785", "0.73527735", "0.73527735", "0.7350173", "0.73296875", "0.7326525", "0.7315331", "0.7311952", "0.72535115", "0.7166823", "0.7153316", "0.7135454", "0.7129923", "0.711861...
0.0
-1
r = 20 gK = 10
def g2r(n) n*(Math::PI/180) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def guage(n) \n r = (255 * n) / 100\n g = (255 * (100 - n)) / 100 \n b = 0\n return { :r => r, :g => g, :b => b }\nend", "def calc_k(n, g)\n H(n, n, g)\n end", "def gravitational_acceleration(r)\n return self.gravitational_parameter / r**2\n end", "def rpkm(counts, total_mapped_reads, gene_le...
[ "0.6338533", "0.6126679", "0.6123701", "0.60982937", "0.6056641", "0.60554034", "0.6044585", "0.60369277", "0.59697884", "0.59556246", "0.5948858", "0.59208816", "0.58816075", "0.5877764", "0.5877089", "0.5855692", "0.58093685", "0.5778032", "0.5773195", "0.5755947", "0.57454...
0.61902887
1
If token has existed for more than 6000 seconds, refresh it.
def refresh_token? if (@token_timer + 6000) < Time.now self.get_token true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def refreshToken\n # is there a token? (and is it's timestamp not older than 24h?)\n if @token.nil? or @tokenTimeStamp < Time.now - 86400\n @token = getToken(@email,@password)\n @tokenTimeStamp = Time.now\n end\n end", "def refresh_token\n get_comm_token if Time.now.to_i - @comm_token_tt...
[ "0.82410866", "0.8219974", "0.8219974", "0.81419677", "0.8070416", "0.798323", "0.78873384", "0.7586039", "0.75629735", "0.7454076", "0.74383026", "0.7424787", "0.73904794", "0.73677343", "0.73658806", "0.73493737", "0.7342838", "0.73345065", "0.7309849", "0.73093146", "0.729...
0.83003277
0
Conditional recursive function ends if nextPageToken is not available in response. Writes results to CSV.
def rest_lead_stream url, list_id response = self.get url json = JSON.parse(response.body, :symbolize_names => true) results = json[:result] if results results.each { |result| @csv << [result[:id]] } @csv.flush puts "#{Time.now} => REST:leadList:#{list_id}:Results:#{results.length}" if GoodDataMarketo.logging end next_page_token = json[:nextPageToken] # If there is another page, remember it and then attempt the next load. if next_page_token self.remember_next_page :token => token, :list => list_id domain = @marketo_domain parameters = "&fields=#{@fields}" endpoint= "/rest/v1/list/#{list_id}/leads.json" url = domain + endpoint + @token_uri + parameters + "&nextPageToken=" + next_page_token rest_lead_stream url, list_id else # Update the local and remote lead lists File.open('lead_list_ids.json','w'){ |f| JSON.dump(@lead_list_ids, f) } @webdav.upload('lead_list_ids.json') end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def export_csv\n\n group_array = []\n @page = 1\n @per_page = 50\n\n groups = @context.get(:groups, :page => @page, :per_page => @per_page, :access_token => ENV[\"API_TOKEN\"])\n group_array << groups\n group_array, group_hash = check_paging(groups, group_array, \"groups\", @context,...
[ "0.59054226", "0.5886693", "0.57631433", "0.56273973", "0.55369157", "0.53110886", "0.5273082", "0.5225724", "0.5205569", "0.5189812", "0.51852566", "0.5183687", "0.5146786", "0.50919545", "0.5083705", "0.50778383", "0.50744", "0.5055878", "0.5038904", "0.50206846", "0.501783...
0.4776956
47
endpoint to send a friend request
def add_friend # byebug #we get user_id from jwt! user = User.find(decode_jwt(cookies.signed[:jwt])["user_id"]) #we get friend_id from frontend if !Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty? return render json: {error: "There was a problem! (Ya been blocked!)"} end followee = User.find(follow_params[:user2]) #insert the one way relation in db! friend_request = Follow.new(follower_id: user.id, followee_id: followee.id) if friend_request.save render json: {friend_request: followee} else render json: {error: "There was a problem!"} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend_request\n\nend", "def send_friend_request\n request_response = post(\"/users/#{id}/request\")[\"response\"]\n @user = Foursquared::Response::User.new(client, request_response[\"userrequest_\"])\n end", "def send_friend_request user_id\n response = post(\"/users/#{user_id}/req...
[ "0.7959861", "0.7613023", "0.72850055", "0.70780396", "0.6974054", "0.6882777", "0.6867623", "0.6754856", "0.6735797", "0.66879493", "0.66366", "0.663658", "0.66163576", "0.66040903", "0.6525826", "0.6514932", "0.64763224", "0.6474545", "0.6456232", "0.64350164", "0.6428833",...
0.64390707
19
endpoint to accept friend request
def reply_pos puts 'aw yeah!!!!' # byebug # we've got user from cookie # we're passing in the 2nd user from follow_params[:user2] ret_errors=[] half_follow_a = Follow.new(follower_id: decode_jwt(cookies.signed[:jwt])["user_id"], followee_id: follow_params[:user2]) if !half_follow_a.save ret_errors.push("Failure in the first half of follow. ") end if !!ret_errors render json: {ret_errors: ret_errors} else render json: {friend_request: "friendship established"} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def friend_request\n\nend", "def requests_received\n friends = Friend.where(friend_id: params[:user_id], accepted: false)\n\t render json:friends\n end", "def send_friend_request\n request_response = post(\"/users/#{id}/request\")[\"response\"]\n @user = Foursquared::Response::User.new(...
[ "0.80551887", "0.6816098", "0.6752391", "0.6730919", "0.66701365", "0.66182554", "0.65832263", "0.65568876", "0.6523307", "0.65205026", "0.648987", "0.64888775", "0.6475923", "0.63806033", "0.6377061", "0.6357955", "0.63446057", "0.62786806", "0.627442", "0.6236807", "0.62128...
0.0
-1
endpoint to deny friend request
def reply_neg puts 'AWW BOO' # byebug friend_deny=Follow.find_by(follower_id: follow_params[:user2], followee_id: decode_jwt(cookies.signed[:jwt])["user_id"]) if friend_deny.destroy render json: {friend_deny: 'success'} else render json: {friend_deny: 'failure'} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deny_friend_request\n request_response = post(\"/users/#{id}/deny\")[\"response\"]\n @user = Foursquared::Response::User.new(client, request_response[\"user\"])\n end", "def deny_friend_request(username)\n # Requires authorization\n raise PutioError::AuthorizationRequired if auth...
[ "0.76746804", "0.75277454", "0.7499744", "0.73901665", "0.7110458", "0.70696723", "0.70221907", "0.6910222", "0.6761475", "0.6614006", "0.6559375", "0.6533936", "0.65114635", "0.64689326", "0.64272654", "0.64236087", "0.6419965", "0.64182174", "0.64138484", "0.63842076", "0.6...
0.700451
7
endpoint to unblock a friend
def unblock user = User.find(decode_jwt(cookies.signed[:jwt])["user_id"]) #we get friend_id from frontend if Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).empty? return render json: {error: "No block found!"} end Block.where(blocker_id: user.id, blockee_id:follow_params[:user2]).destroy_all # byebug return render json: {response: "Friend unblocked"} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unblock(me: nil)\n my_id = 't2_' + (me.is_a?(User) ? user.id : @client.get('/api/v1/me').body[:id])\n # Talk about an unintuitive endpoint\n @client.post('/api/unfriend', container: my_id, name: get_attribute(:name), type: 'enemy')\n end", "def unblock(me: nil)\n my_id = 't2_...
[ "0.7945566", "0.7932808", "0.7219855", "0.7083792", "0.69793594", "0.6964526", "0.6870644", "0.68424195", "0.67375034", "0.6691993", "0.66788363", "0.66154087", "0.6588053", "0.6587975", "0.657924", "0.65479064", "0.654257", "0.6537734", "0.6511017", "0.65061164", "0.6487089"...
0.77708054
2
endpoint to return count of friends
def number_for_profile # byebug # @user=User.where(username: count_params[:username]) @user = User.find(decode_jwt(cookies.signed[:jwt])["user_id"]) numfollowers=Follow.where(followee_id: @user.id).count numblocked=Block.where(blockee_id: @user.id).count render json: {followers: numfollowers, blocked: numblocked} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_friend_count\n response = twitter_user.request(:get, configatron.api_call_url + \"account/totals.json\")\n \n if response.is_a?(Net::HTTPSuccess)\n body = JSON.parse(response.body)\n body[\"friends\"]\n end\n end", "def get_counts\n #1 - @friend_count -> gets the number of curre...
[ "0.8007224", "0.7925994", "0.76246786", "0.75055397", "0.7488557", "0.7056454", "0.6957432", "0.69227356", "0.6920694", "0.68696636", "0.68534654", "0.6825913", "0.68071926", "0.67635906", "0.669968", "0.667672", "0.6559546", "0.6542103", "0.6507705", "0.64816487", "0.6457121...
0.6785197
13
GET /events GET /events.json
def under_construction end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "def get_events\n Resources::Event.parse(request(:get, \"Events\"))\n end", "def get_events()\n @client.make_request(:get, @client.concat_user_path(\"#{CALL_PATH}...
[ "0.8337474", "0.8240041", "0.7943668", "0.79278964", "0.7768141", "0.7740975", "0.7670209", "0.7665706", "0.765914", "0.76425344", "0.7621046", "0.761625", "0.761625", "0.76141375", "0.75690866", "0.75230986", "0.7489482", "0.74811614", "0.7470508", "0.7442612", "0.74410146",...
0.0
-1
GET /events/1 GET /events/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @event = Event.find(params[:id])\n render json: @event\n end", "def get(event_id)\n @client.request \"events/#{event_id}\"\n end", "def show\n event_id = params[:id]\n if event_id.present?\n @event = Com::Nbos::Events::Event.active_events.where(id: event_id, tenant_id: @use...
[ "0.75029767", "0.74019474", "0.7361382", "0.7348975", "0.73475033", "0.7338018", "0.7317425", "0.72875094", "0.72813755", "0.7246173", "0.72317284", "0.7219172", "0.7219172", "0.7218839", "0.7218839", "0.721464", "0.7204848", "0.71989256", "0.7196662", "0.71925515", "0.719221...
0.0
-1
POST /events POST /events.json
def create expire_action :action => [:shadyside, :south_side, :lawrenceville, :oakland, :bloomfield, :strip_district, :downtown] @event = current_user.events.build(event_params) #@event = Event.new(event_params) if @event.day == "Weekdays" @event.day = "Monday" @event_tue = current_user.events.build(event_params) @event_tue.day = "Tuesday" @event_wed = current_user.events.build(event_params) @event_wed.day = "Wednesday" @event_thu = current_user.events.build(event_params) @event_thu.day = "Thursday" @event_fri = current_user.events.build(event_params) @event_fri.day = "Friday" respond_to do |format| if @event.save && @event_tue.save && @event_wed.save && @event_thu.save && @event_fri.save #EventMailer.sample_email(current_user, @event).deliver Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now) format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' } format.json { head :no_content } format.js { render :layout => false } else format.html { render :new } format.json { render json: @event.errors, status: :unprocessable_entity } end end elsif @event.day == "Everyday" @event.day = "Monday" @event_tue = current_user.events.build(event_params) @event_tue.day = "Tuesday" @event_wed = current_user.events.build(event_params) @event_wed.day = "Wednesday" @event_thu = current_user.events.build(event_params) @event_thu.day = "Thursday" @event_fri = current_user.events.build(event_params) @event_fri.day = "Friday" @event_sat = current_user.events.build(event_params) @event_sat.day = "Saturday" @event_sun = current_user.events.build(event_params) @event_sun.day = "Sunday" respond_to do |format| if @event.save && @event_tue.save && @event_wed.save && @event_thu.save && @event_fri.save && @event_sat.save && @event_sun.save #EventMailer.sample_email(current_user, @event).deliver Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now) format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' } format.json { head :no_content } format.js { render :layout => false } else format.html { render :new } format.json { render json: @event.errors, status: :unprocessable_entity } end end elsif @event.day == "Weekend" @event_sat = current_user.events.build(event_params) @event_sat.day = "Saturday" @event_sun = current_user.events.build(event_params) @event_sun.day = "Sunday" respond_to do |format| if @event.save && @event_sun.save #EventMailer.sample_email(current_user, @event).deliver Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now) format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' } format.json { head :no_content } format.js { render :layout => false } else format.html { render :new } format.json { render json: @event.errors, status: :unprocessable_entity } end end else respond_to do |format| if @event.save #EventMailer.sample_email(current_user, @event).deliver Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now) format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully created.' } format.json { head :no_content } format.js { render :layout => false } else format.html { render :new } format.json { render json: @event.errors, status: :unprocessable_entity } end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_event event, data={}\n data[:event] = event\n post '/event', data\n end", "def create\n event = Event.new(event_params)\n event.save!\n render json: event\n end", "def create\n Rails.logger.debug(\"Received event #{params[:event]}\")\n head :ok\n end", "def crea...
[ "0.7714071", "0.7611226", "0.76028967", "0.7541319", "0.7444731", "0.73206913", "0.73138195", "0.728203", "0.7251226", "0.7235907", "0.7235907", "0.7215051", "0.71682763", "0.7150409", "0.7126664", "0.7118896", "0.7117831", "0.71162695", "0.70964044", "0.70907074", "0.7083036...
0.0
-1
PATCH/PUT /events/1 PATCH/PUT /events/1.json
def update expire_action :action => [:shadyside, :south_side, :lawrenceville, :oakland, :bloomfield, :strip_district, :downtown] respond_to do |format| if @event.update(event_params) Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now) format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Hour was successfully updated.' } format.json { render :show, status: :ok, location: @event } else format.html { render :edit } format.json { render json: @event.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch_event\n user_id = params[\"user_id\"]\n group_id = params[\"group_id\"]\n event_id = params[\"event_id\"]\n\n #TODO Handle 404 if event not found\n event = Event.find(event_id)\n\n json_body = JSON.parse(request.body.read)\n\n @@event_service.patch_event(j...
[ "0.75299805", "0.7372486", "0.71766764", "0.7172103", "0.7170955", "0.71424884", "0.70959055", "0.7082709", "0.7082709", "0.7057662", "0.70209146", "0.6989379", "0.69825095", "0.69775003", "0.69601995", "0.6954494", "0.6954494", "0.6951992", "0.692109", "0.692109", "0.692109"...
0.0
-1
DELETE /events/1 DELETE /events/1.json
def destroy expire_action :action => [:shadyside, :south_side, :lawrenceville, :oakland, :bloomfield, :strip_district, :downtown] @event.destroy respond_to do |format| Venue.where(id: @event.venue_id).first.update_attribute(:venue_verify, Time.now) format.html { redirect_to Venue.where(id: @event.venue_id).first, notice: 'Event was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @event = Event.using(:shard_one).find(params[:id])\n @event.destroy\n\n respond_to do |format|\n format.html { redirect_to events_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @event.destroy\n respond_to do |format|\n format.json { head :no_...
[ "0.769268", "0.76872975", "0.76872975", "0.76872975", "0.7680665", "0.7585337", "0.75682765", "0.7560537", "0.75407815", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7540473", "0.7539941",...
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_event @event = Event.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 event_params params.require(:event).permit(:special,:detail, :day, :venue_id, :start, :end, :tag_list, :event_verify, :varified_user, :event_date) 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
Sends the notice unless it is one of the default ignored exceptions.
def notify_or_ignore(exception, context = {}) notify(exception, context) unless ignored?(exception) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify_or_ignore(exception, opts = {})\n notice = build_notice_for(exception, opts)\n send_notice(notice) unless notice.ignore?\n end", "def notify_or_ignore(exception, opts = {})\n notice = build_notice_for(exception, opts)\n send_notice(notice) unless notice.ignore?\n end", "def...
[ "0.73556817", "0.73556817", "0.6492782", "0.61551136", "0.6142922", "0.6117215", "0.61099255", "0.6016112", "0.59590274", "0.59373856", "0.58329886", "0.57911223", "0.574737", "0.5742679", "0.5699931", "0.5695802", "0.5695802", "0.5661375", "0.5633226", "0.5614445", "0.559437...
0.65031064
2
Print a message at the top of the applciation's logs to say we're ready.
def report_for_duty! application = reporter.announce if application info("Configured correctly and ready to handle exceptions for '#{application}'") else error("Failed to report for duty, your application failed to authenticate correctly with stdin.crashlog.io") end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def report_ready\n self.logger.info \"Opbeat #{VERSION} ready to catch errors\"\n end", "def report_ready\n write_verbose_log(\"Notifier #{VERSION} ready to catch errors\", :info)\n end", "def report_ready\n self.logger.info \"Raven #{VERSION} ready to catch errors\"\n end", "def wait...
[ "0.6731967", "0.6669439", "0.64619195", "0.63470685", "0.6316203", "0.6254288", "0.62529546", "0.6133716", "0.61285174", "0.6105979", "0.6071732", "0.6045285", "0.6038749", "0.6029463", "0.59906834", "0.5976198", "0.5903672", "0.5876011", "0.5875308", "0.5844501", "0.58440995...
0.0
-1
Configure the gem to send notifications, at the very least an api_key is required.
def configure(announce = false, &block) if block_given? yield(configuration) if live? self.reporter = CrashLog::Reporter.new(configuration) if configuration.valid? if announce.eql?(true) report_for_duty! else debug("Configuration updated successfully") end elsif !configuration.invalid_keys.include?(:api_key) error("Not configured correctly. Missing the following keys: #{configuration.invalid_keys.join(', ')}") end end end configuration end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize(api_key: nil)\r\n Configuration.api_key = api_key\r\n end", "def initialize(x_api_token: nil, x_api_email: nil)\r\n Configuration.x_api_token = x_api_token\r\n Configuration.x_api_email = x_api_email\r\n end", "def initialize(api_key, params = {})\n @filters = []\n ...
[ "0.63896275", "0.63179916", "0.62401325", "0.6159049", "0.60380244", "0.6029999", "0.59597945", "0.5914346", "0.5847085", "0.5847085", "0.5821589", "0.5821589", "0.58030576", "0.57551575", "0.57129145", "0.57003975", "0.56888735", "0.5673955", "0.5665071", "0.56439394", "0.56...
0.0
-1
The global configuration object.
def configuration @configuration ||= Configuration.new end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def global_config\n @@global_config\n end", "def config\n @config ||= {}\n end", "def config\n @config ||= {}\n end", "def config\n @configuration ||= Configuration.new\n end", "def config\n @configuration ||= Configuration.new\n end", "def config\n ...
[ "0.8466089", "0.81432164", "0.81432164", "0.7828079", "0.7828079", "0.7784814", "0.7784814", "0.77504766", "0.7748834", "0.7745521", "0.7709197", "0.77064747", "0.7683163", "0.7662794", "0.75887907", "0.75597256", "0.75597256", "0.75597256", "0.75597256", "0.75597256", "0.755...
0.73600733
37
The default logging device.
def logger self.configuration.logger || Logger.new($stdout) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_logger\n Logger.new(debug? ? STDOUT : nil)\n end", "def default_logger\n log = ::Logger.new(STDOUT)\n log.level = ::Logger::INFO\n log\n end", "def init_logger \n if not Object.const_defined?(get_rails_default_logger_name)\n Logger.new(STDOUT)\n ...
[ "0.73106635", "0.69823974", "0.69325185", "0.686806", "0.6844342", "0.67556345", "0.67399937", "0.672019", "0.66074646", "0.659246", "0.65316397", "0.65316397", "0.6519563", "0.64846325", "0.6461179", "0.6457614", "0.6408749", "0.6396789", "0.63909763", "0.6367269", "0.636591...
0.5858611
100
Is the logger live Returns true if the current stage is included in the release stages config, false otherwise.
def live? configuration.release_stage? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def debug?\n DEBUG == log_level\n end", "def staging?\n self.environment == ENV_STAGE\n end", "def debug?\n severity == :DEBUG\n end", "def log_debug?\n @logger.debug?\n end", "def debug?\n @loggers.any? { |logger| logger.respond_to?(:debug?) && logger.debug? }\...
[ "0.66961265", "0.6560573", "0.65462697", "0.6542471", "0.64925534", "0.6458757", "0.6455649", "0.645095", "0.6423734", "0.639385", "0.63637185", "0.63637185", "0.6348001", "0.63463944", "0.6323715", "0.63054425", "0.62925965", "0.62831175", "0.6260614", "0.625884", "0.6248079...
0.81160575
0
Looks up ignored exceptions Returns true if this exception should be ignored, false otherwise.
def ignored?(exception) configuration.ignored?(exception) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore?\n configuration.ignored_errors.each do |error|\n return true if @exception.is_a? error\n end\n\n false\n end", "def ignore?\n @should_ignore\n end", "def ignore?\n !!@ignore\n end", "def ignored?\n !!ignored\n end", "def ignored?\n @ignore...
[ "0.8006646", "0.7350852", "0.7195413", "0.7142639", "0.70912725", "0.697696", "0.65832925", "0.65617436", "0.6544055", "0.6519214", "0.64191777", "0.6399227", "0.63532585", "0.63216203", "0.6268937", "0.6157815", "0.6155958", "0.6108784", "0.60998607", "0.60486263", "0.604382...
0.82893014
0
Advance to the next card, first stashing the current card and updating its status depending whether it passed or failed
def next_card if ["pass","fail"].include?(params[:card_status]) quiz = Quiz.find(params[:quiz_id]) user = quiz.user card = Card.find(params[:card_id]) card.pass(user) if params[:card_status] == "pass" card.fail(user) if params[:card_status] == "fail" cv = CardView.find_or_create(user, card) quiz.shuffle_card_into_queue(cv) current_card = quiz.current_card redirect_to quiz_card_path(quiz, current_card) else flash[:error] = "Couldn't figure out whether you passed or failed that particular card... try again?" redirect_to :back end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def flip_to_next_card\n @flashcard_deck.next_card\n @current_card = @flashcard_deck.current_card\n end", "def next_phase\n if phase == 'Action'\n reset_action_variables\n update_attributes(phase: \"Buy\") \n elsif phase == 'Buy'\n reset_player_balances\n current_player.discard...
[ "0.72943795", "0.6760288", "0.6730438", "0.6686069", "0.65777946", "0.65393955", "0.6482234", "0.64423966", "0.643125", "0.6353475", "0.6287692", "0.62747866", "0.62694", "0.6247394", "0.623715", "0.6227019", "0.62233144", "0.62193733", "0.61794186", "0.6125053", "0.61191374"...
0.80646867
0
Create the target instance
def create(state) info("Creating instance #{instance.name}") return if state[:server_id] domain = create_domain state[:server_id] = domain.id state[:hostname] = domain.public_ip_address instance.transport.connection(state).wait_until_ready info("Libvirt instance #{domain.name} created.") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_target_mock\n ref = self.service_name.downcase.gsub(/ /, '-')\n create_row = {\n ref: ref,\n display_name: self.service_name,\n type: 'instance',\n iaas_type: 'ec2',\n iaas_properties: {},\n project_id: self.project.id\n }\n ...
[ "0.77701956", "0.7059186", "0.7038512", "0.6935186", "0.6782983", "0.66949844", "0.65368384", "0.6534073", "0.65126467", "0.6511741", "0.6472529", "0.6472529", "0.64515924", "0.64464325", "0.6393916", "0.638048", "0.63799226", "0.63681304", "0.6237704", "0.6235831", "0.623075...
0.5989781
48
Destroy the target instance
def destroy(state) info("Destroying instance #{instance.name}") return if state[:server_id].nil? instance.transport.connection(state).close domain = load_domain(state[:server_id]) destroy_domain(domain) unless domain.nil? info("Libvirt instance #{state[:server_id]} destroyed.") state.delete(:server_id) state.delete(:hostname) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy!\n destroy_instance(_id)\n end", "def destroy!\n self.destroy\n end", "def teardown\n response = Vanagon::Utilities.http_request(\n \"#{@pooler}/vm/#{@target}\",\n \"DELETE\",\n nil,\n { 'X-AUTH-TOKEN' => @token }\n )\n if res...
[ "0.8236234", "0.7452323", "0.74413985", "0.7380395", "0.7368819", "0.7356065", "0.73176205", "0.72651625", "0.7252328", "0.7234828", "0.72163683", "0.72151816", "0.71572155", "0.71572155", "0.71491283", "0.70986295", "0.7098422", "0.7060006", "0.705898", "0.70420086", "0.7038...
0.72489876
9
The command string to use for finding the domain IP address
def default_ip_command %q( awk "/$mac/ {print \$1}" /proc/net/arp ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def description\n \"Query for the ip address of the given DNS name\"\nend", "def command(str)\n ar=str.split(/ /)\n case ar[0]\n when \"++addr\"\n if ar.size<2\n return @addr.to_s\n else \n @addr=ar[1].to_i\n end\n\n end\n return nil\n end", "de...
[ "0.65247685", "0.62867314", "0.6252401", "0.61461025", "0.600678", "0.5996924", "0.5995298", "0.5967437", "0.5939789", "0.593251", "0.59211797", "0.5920145", "0.5893078", "0.5885891", "0.5872979", "0.5871618", "0.5858549", "0.5847169", "0.58024335", "0.5798698", "0.57979286",...
0.60366035
4
Returns the default image name for the configured platform
def default_image "/var/lib/libvirt/images/kitchen-#{instance.platform.name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def default_image\n if instance.platform.name =~ /^(.*)-([^-]*)$/\n \"#{$1}:#{$2}\"\n else\n instance.platform.name\n end\n end", "def image_name(server)\r\n name = instance.platform.name\r\n return name unless server\r\n\r\n # 1:\r\n if ser...
[ "0.90075755", "0.7415205", "0.73246264", "0.7021422", "0.6962539", "0.6931464", "0.6927607", "0.6847147", "0.6842619", "0.6780967", "0.67274594", "0.67179024", "0.6715335", "0.6696803", "0.66665316", "0.6662556", "0.6640817", "0.663227", "0.6610321", "0.65983534", "0.6580736"...
0.77891964
1
The the default name for the domain
def default_name debug("Instance name: #{instance.name}") "#{instance.platform.name}-#{Time.now.to_i}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain_name\n @domain_name ||= default_name\n end", "def default_domain_name\n return @default_domain_name\n end", "def default_domain_name\n return @default_domain_name\n end", "def default_domain_name=(value)\n @default_doma...
[ "0.88208437", "0.87415904", "0.87415904", "0.85008746", "0.85008746", "0.79431206", "0.786928", "0.7796924", "0.767584", "0.74892884", "0.739076", "0.7323344", "0.7261558", "0.7261558", "0.7260703", "0.72138095", "0.71745044", "0.7170666", "0.7149342", "0.7145908", "0.7145908...
0.7273699
12
Create the domain, and all its dependencies
def create_domain debug("Creating domain #{domain_name}") debug("Using options: #{domain_options}") domain = client.servers.create(domain_options) prepare_domain(domain) domain end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_agent_domain\n return false unless validate_params\n puts '########## CREATING DOMAIN ##########'\n dme.create_domain(params[:domain])\n puts '########## CREATING DEFAULT RECORDS ##########'\n create_default_records\n puts '########## CREATING ADDITIONAL RECORDS ##########'\n create...
[ "0.68713975", "0.6569175", "0.6260142", "0.62500805", "0.6244911", "0.6242045", "0.6226356", "0.61096287", "0.6078012", "0.60581654", "0.6028687", "0.6008312", "0.59861284", "0.5936764", "0.59363437", "0.5932347", "0.5929594", "0.58943474", "0.583743", "0.5825705", "0.5784049...
0.6419313
2
Prepares the domain for SSH connections
def prepare_domain(domain) domain.start unless domain.active wait_for_ip_address(domain) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def generate_host\n uri = Addressable::URI.parse(self.url)\n self.site = uri.site\n self.domain_tld = [uri.domain,uri.tld].join('.')\n end", "def host=(_); end", "def setup(credentials = {})\n requires :public_key, :public_ip_address, :username\n\n credentials[:password] = password ...
[ "0.60419273", "0.59539175", "0.5933824", "0.59235036", "0.592104", "0.5908033", "0.5894757", "0.5872454", "0.5823063", "0.5801983", "0.578535", "0.57543963", "0.5749146", "0.57369584", "0.56678265", "0.56541187", "0.5648907", "0.5644008", "0.5643464", "0.5642489", "0.5607054"...
0.64611936
0
Create the domain, and all its dependencies
def destroy_domain(domain) debug("Destroying domain #{domain.id}") domain.halt if domain.active debug("Removing volumes for domain #{domain.id}") volume_cleanup(domain) domain.destroy end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_agent_domain\n return false unless validate_params\n puts '########## CREATING DOMAIN ##########'\n dme.create_domain(params[:domain])\n puts '########## CREATING DEFAULT RECORDS ##########'\n create_default_records\n puts '########## CREATING ADDITIONAL RECORDS ##########'\n create...
[ "0.6871099", "0.6570468", "0.6418222", "0.62601084", "0.624928", "0.62451583", "0.62402195", "0.62262994", "0.6110158", "0.6078027", "0.6057667", "0.6026131", "0.60088444", "0.5985398", "0.5936049", "0.59339637", "0.5931633", "0.5931287", "0.5892692", "0.5837641", "0.5825237"...
0.0
-1
Create a new volume from the source image
def clone_volume(source, target) debug("Creating Libvirt volume #{target}") debug("Cloning volume from #{source}") # Attempt to locate the target or source volume source_image = client.volumes.get(source) if source_image.name =~ /^fog-\d+/ error("Could not find target image: #{source}.") end # Clone the source volume source_image.clone_volume(target) client.volumes.all.find { |vol| vol.name == target } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def volume_create(name)\n @log.info \"Creating volume #{name} from offering id #{DISK_OFFERING}...\"\n ret = @cloud_stack.create_volume(name, ZONE, DISK_OFFERING)\n id = ret[\"createvolumeresponse\"][\"jobid\"]\n wait_for_job id\n vol_id = ret[\"createvolumeresponse\"][\"id\"]\n @log.info \"Creat...
[ "0.6528484", "0.64485526", "0.6294666", "0.6294666", "0.6188785", "0.60870904", "0.6076734", "0.6000879", "0.5948535", "0.5922403", "0.5920687", "0.5887592", "0.58557296", "0.5841752", "0.5839586", "0.58380365", "0.5810351", "0.5785783", "0.5745057", "0.5722244", "0.56802994"...
0.71551806
0
Create the extra disks
def create_volumes(volume_definitions) volume_definitions.each { |volume| client.volumes.create(volume) } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def attach_disks_specs\n attach_disk_array = []\n extraconfig = []\n attach_spod_array = []\n attach_spod_disk_info = {}\n\n pos = { :ide => 0, :scsi => 0 }\n disks_each(:no_exists?) do |disk|\n disk.one_item['TYPE']...
[ "0.70231146", "0.69995695", "0.68383676", "0.68118185", "0.6750576", "0.67435026", "0.66048616", "0.6545638", "0.65237164", "0.65123236", "0.629663", "0.62834424", "0.6283214", "0.62750745", "0.6208587", "0.61978734", "0.6118388", "0.6093614", "0.60689795", "0.605721", "0.602...
0.0
-1
Cleanup a domain's volumes
def volume_cleanup(domain) domain.volumes.each do |volume| debug("Removing volumes #{volume.key}") volume.destroy if volume.key end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cleanup_storage vm\n vm.volumes.each do |vol|\n @logger.debug \"Deleting volume #{vol.name} for OpenStack host #{vm.name}\"\n vm.detach_volume(vol.id)\n vol.wait_for { ready? }\n vol.destroy\n end\n end", "def cleanup\n case SubutaiConfig.provider\n when :...
[ "0.71809286", "0.68798983", "0.68682027", "0.6783374", "0.6367989", "0.6347211", "0.63415235", "0.62592435", "0.62468827", "0.62252426", "0.62249434", "0.62249434", "0.62228924", "0.62121224", "0.62121224", "0.62065923", "0.62065923", "0.62065923", "0.62065923", "0.618122", "...
0.866983
0
Create an array of all virtual disks for the domain
def domain_volumes # Use the domain name as our volume base name. base_name = domain_name if not config[:image_name] config[:image_name] = default_image end # Clone our root volume from our base image. root_volume = clone_volume(config[:image_name], "#{base_name}-root") # Return the array of created volumes [root_volume].concat( create_volumes( extra_volumes(base_name) ) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disks\n self.config.hardware.device.grep(RbVmomi::VIM::VirtualDisk)\n end", "def list_virtual_machine_disks\n request_path = '/services/disks'\n request = ManagementHttpRequest.new(:get, request_path, nil)\n response = request.call\n Serialization.disks_from_xml(response)\n ...
[ "0.73276126", "0.6938894", "0.676588", "0.6646116", "0.6485004", "0.6422962", "0.64167136", "0.63778716", "0.6317316", "0.63155466", "0.63019836", "0.6266429", "0.62215626", "0.6162207", "0.60976696", "0.60670096", "0.60431045", "0.6036013", "0.60063803", "0.596952", "0.59355...
0.67960477
2
Create a config structure for each additional volume.
def extra_volumes(base_name) configs = [] config[:extra_volumes].each_with_index do |data, index| disk_id = (index + 1).to_s.rjust(2, '0') data[:name] = "#{base_name}-extra-#{disk_id}" configs << data end configs end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_volume(volume_name, config:, **kwargs)\n object = { name: volume_name }.merge(config).merge(kwargs)\n log.info \"Creating volume: #{object}\"\n volumes << object\n end", "def create\n tmp = Puppet::FileSystem::Uniquefile.new('quobyte_volume_config')\n tmp.write(resource[:conten...
[ "0.65570027", "0.6094821", "0.6045592", "0.5926669", "0.58990616", "0.5826286", "0.5758792", "0.5730638", "0.57096523", "0.5702036", "0.56493527", "0.5637249", "0.56333816", "0.5633276", "0.5603496", "0.55852246", "0.5582181", "0.5579442", "0.55753416", "0.5566169", "0.552391...
0.720253
0
Prepare the options passed to create the domain
def domain_options @domain_options ||= { name: domain_name, persistent: config[:persistent], cpus: domain_cpus, memory_size: domain_memory, os_type: 'hvm', arch: config[:arch], domain_type: config[:domain_type], nics: [{ type: 'network', network: config[:network_name], bridge: config[:network_bridge_name] }], volumes: domain_volumes } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_options\n {\n 'action' => \"add#{\"Dynamic\" if domain.dynamic?}Record\",\n 'domain' => domain.host,\n 'field1' => self.host,\n 'type' => TYPE_NUMBERS[self.type],\n 'field2' => self.value,\n 'mxVal' => self.mx,\n 'ttl' => self.ttl.to_s\n }.merge...
[ "0.6602272", "0.6290079", "0.62878805", "0.6255625", "0.6244514", "0.6240076", "0.60917586", "0.5976988", "0.5966741", "0.593528", "0.593528", "0.58982664", "0.5893893", "0.5780929", "0.5748723", "0.5740976", "0.57197964", "0.5717144", "0.5716074", "0.5715341", "0.5670532", ...
0.69818443
0
Returns the domain memory size in KBs
def domain_memory (config[:memory] || 512) * 1024 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def memory\n domain_info[:memory]\n end", "def memory\n domain_info[:memory]\n end", "def memsize\n end", "def max_memory\n domain_info[:maxMem]\n end", "def max_memory\n domain_info[:maxMem]\n end", "def size_mb \n return size / 1048576 # (1024 * 1024) \n end", "de...
[ "0.76297045", "0.76297045", "0.75725186", "0.7562596", "0.7562596", "0.7260716", "0.712562", "0.7067322", "0.6961244", "0.6940051", "0.6827923", "0.68090016", "0.6799701", "0.6757472", "0.6748452", "0.6748452", "0.6739316", "0.6707153", "0.6704731", "0.6701376", "0.669562", ...
0.7438267
5
Return domain cpu count
def domain_cpus config[:cpus] || 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cpu_time_used\n domain_info[:cpuTime]\n end", "def cpu_time_used\n domain_info[:cpuTime]\n end", "def virtual_cpus\n domain_info[:nrVirtCpu]\n end", "def virtual_cpus\n domain_info[:nrVirtCpu]\n end", "def count\n\t\t\t\t# CPU count can change during the program runtime\...
[ "0.7719498", "0.7719498", "0.75121003", "0.75121003", "0.71274376", "0.6922787", "0.6892276", "0.6885346", "0.6882397", "0.68118423", "0.6788717", "0.6687688", "0.6669076", "0.66608906", "0.6637468", "0.66232055", "0.65831506", "0.65215737", "0.63739204", "0.63573784", "0.633...
0.75273395
2
Return the domain type
def domain_type config[:domain_type] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_type?\n type == \"domain\"\n end", "def valid_type?\n type == \"domain\"\n end", "def create_types\n\t[Domain]\nend", "def type\n fetch('company.type')\n end", "def allowed_types\n [Domain]\nend", "def allowed_types\n [Domain]\nend", "def allowed_types\n ...
[ "0.70587915", "0.70587915", "0.69794697", "0.6878422", "0.68655974", "0.68655974", "0.68655974", "0.6860498", "0.678803", "0.67498976", "0.67173016", "0.6676866", "0.66450995", "0.66329795", "0.6616654", "0.6616654", "0.6616654", "0.66165864", "0.6593503", "0.6581494", "0.658...
0.84000885
0
Return the domain name
def domain_name @domain_name ||= default_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def domain_name\n return @domain_name\n end", "def domain_name\n return @domain_name\n end", "def domain\n unless @domain\n if defined? ActiveSupport::CoreExtensions::String::Inflections\n @domain = name.tableize\n ...
[ "0.8715293", "0.8715293", "0.84037054", "0.8108712", "0.78313756", "0.7807225", "0.7807225", "0.7793504", "0.77840286", "0.7726059", "0.77096456", "0.77096456", "0.7699835", "0.76884186", "0.7661856", "0.7659795", "0.76500666", "0.76437926", "0.76437926", "0.7618178", "0.7588...
0.858935
2
Find and return a domain by it's id
def load_domain(domain_id) client.servers.get(domain_id) rescue ::Libvirt::RetrieveError debug("Domain with id #{domain_id} was not found.") nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_domain(id)\n logger.debug \"Finding domain #{id}\" if @mydebug\n domains.each { |domain| return domain if domain.id == id }\n\n raise RHC::DomainNotFoundException.new(\"Domain #{id} does not exist\")\n end", "def find_domain(id)\n debug \"Finding domain #{id}\"\n ...
[ "0.85829324", "0.8505713", "0.823245", "0.8121154", "0.80650884", "0.7813009", "0.73053604", "0.7104519", "0.7104519", "0.7049735", "0.69487494", "0.6835949", "0.6674546", "0.6646798", "0.66343254", "0.65661484", "0.65661484", "0.6547493", "0.6513821", "0.64812", "0.6474236",...
0.695631
10
Wait for the domain to receive its IP address
def wait_for_ip_address(domain, timeout = 300) debug('Waiting for domain network to assign an IP address') loop do break if timeout <= 0 if domain.public_ip_address debug("IP address: #{domain.public_ip_address}") break else debug('IP address not found...') timeout -= 5 sleep 5 end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def wait_for_startup\n TCPSocket.wait_for_service_with_timeout(:host => http_ip,\n :port => http_port,\n :timeout => 10)\n end", "def wait_connection; end", "def wait_connection; end", "def prepare_domain(domain...
[ "0.5925808", "0.5883973", "0.5883973", "0.58535105", "0.57947624", "0.5675791", "0.5657998", "0.5605223", "0.55885917", "0.5574352", "0.5573449", "0.54210705", "0.53711146", "0.5324268", "0.53106207", "0.5306715", "0.5298207", "0.52940786", "0.52822006", "0.5257564", "0.52512...
0.7786815
0
PUT /resource We need to use a copy of the resource because we don't want to change the current user in place.
def update @admin = Admin.find(params[:admin][:id]) self.resource = @admin @address = resource.address @address = resource.build_address if !@address prev_unconfirmed_email = resource.unconfirmed_email if resource.respond_to?(:unconfirmed_email) resource_updated = update_resource(resource, account_update_params) yield resource if block_given? if resource_updated AdminRoles.create!(:role_id => params[:role_id], :admin_id => resource.id) if params[:role_id] if params[:role_id] AdminRoles.where(:admin_id => resource.id).destroy_all AdminRoles.create!(:role_id => params[:role_id], :admin_id => resource.id) end if params[:admin][:attachment] resource.attachments.destroy_all if resource.attachments resource.attachments.create(:attachment => params[:admin][:attachment]) end resource.address.update_attributes(:street => params[:admin][:address][:street], :suit => params[:admin][:address][:suit], :city => params[:admin][:address][:city], :state => params[:admin][:address][:state], :country => params[:admin][:address][:country], :zip_code => params[:admin][:address][:zip_code]) if params[:admin][:address] #end if is_flashing_format? flash_key = update_needs_confirmation?(resource, prev_unconfirmed_email) ? :update_needs_confirmation : :updated set_flash_message :notice, flash_key end respond_with resource, location: after_update_path_for(resource) else clean_up_passwords resource respond_with resource end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://...
[ "0.7224355", "0.7005823", "0.69810694", "0.6971466", "0.69555235", "0.6954134", "0.6753178", "0.6746057", "0.6743163", "0.67177105", "0.67177105", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6707934", "0.6702649", "0.6697928",...
0.0
-1
GET /resource/cancel Forces the session data which is usually expired after sign in to be expired now. This is useful if the user wants to cancel oauth signing in/up in the middle of the process, removing all OAuth session data.
def cancel expire_data_after_sign_in! redirect_to new_registration_path(resource_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end", "def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registration_path(resource_name)\n end", "def cancel\n expire_session_data_after_sign_in!\n redirect_to new_registrat...
[ "0.7635437", "0.7635437", "0.7635437", "0.7635437", "0.7635437", "0.7635437", "0.7367191", "0.7279831", "0.7144859", "0.6624382", "0.6509149", "0.65029466", "0.64647144", "0.63581675", "0.63340735", "0.6330951", "0.6324643", "0.63008875", "0.6219802", "0.6115184", "0.60845864...
0.73111695
13
By default we want to require a password checks on update. You can overwrite this method in your own RegistrationsController.
def update_resource(resource, params) resource.update_with_password(params) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def should_validate_password?\n updating_password || new_record?\n end", "def should_validate_password?\n updating_password || new_record?\n end", "def need_change_password!\n return unless password_expiration_enabled?\n\n need_change_password\n save(validate: false)\n end", "...
[ "0.7431037", "0.7416546", "0.7395955", "0.7375806", "0.73549265", "0.73029804", "0.7261664", "0.72445995", "0.72270805", "0.7188048", "0.7187129", "0.71696925", "0.7148469", "0.7136121", "0.7136121", "0.71323127", "0.71269363", "0.7123784", "0.70972013", "0.708736", "0.708054...
0.0
-1
Build a devise resource passing in the session. Useful to move temporary session data to the newly created user.
def build_resource(hash=nil) self.resource = resource_class.new_with_session(hash || {}, session) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def build_resource(hash=nil)\n self.resource = resource_class.new_with_session(hash || {}, session)\n attrs = session[\"devise.user_attributes\"]\n self.resource.first_name = attrs[\"first_name\"]\n self.resource.last_name = attrs[\"last_name\"]\n self.resource.picture = attrs[\"picture\"]\n end", ...
[ "0.7091186", "0.6656826", "0.66357183", "0.6563214", "0.6234899", "0.6205804", "0.6152574", "0.61236125", "0.611247", "0.6099068", "0.6014181", "0.59724724", "0.59724724", "0.59543395", "0.59440666", "0.5900429", "0.58953875", "0.588996", "0.585942", "0.58219326", "0.58096445...
0.5726887
36
Signs in a user on sign up. You can overwrite this method in your own RegistrationsController.
def sign_up(resource_name, resource) sign_in(resource_name, resource) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def authenticate_user_with_sign_up!\n unless user_signed_in?\n store_location_for(:user, request.fullpath)\n redirect_to new_user_registration_path, alert: t(\"create_an_account_first\")\n end\n end", "def authenticate_user_with_sign_up!\n unless user_signed_in?\n store_location_for(...
[ "0.74822444", "0.7396724", "0.72480386", "0.711055", "0.71018165", "0.70786214", "0.70786214", "0.7010431", "0.6943396", "0.69256973", "0.6915402", "0.6913177", "0.6904785", "0.6899749", "0.68899375", "0.6874407", "0.68355083", "0.6826637", "0.68244773", "0.68235505", "0.6812...
0.6896803
14
The path used after sign up. You need to overwrite this method in your own RegistrationsController.
def after_sign_up_path_for(resource) after_sign_in_path_for(resource) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_sign_up_path_for(resource)\n after_register_path\n end", "def after_sign_up_path_for(resource)\n\n end", "def after_sign_up_path_for(_resource)\n edit_user_registration_path\n end", "def after_sign_up_path_for(resource)\n super\n end", "def after_sign_up_path_for(resource)\n ...
[ "0.828119", "0.8156382", "0.81545085", "0.81270283", "0.8126006", "0.8125953", "0.8093928", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", "0.8058524", ...
0.78639686
56
The path used after sign up for inactive accounts. You need to overwrite this method in your own RegistrationsController.
def after_inactive_sign_up_path_for(resource) #scope = Devise::Mapping.find_scope!(resource) #router_name = Devise.mappings[scope].router_name #context = router_name ? send(router_name) : self #context.respond_to?(:root_path) ? context.root_path : "/" after_sign_in_path_for(resource) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def after_inactive_sign_up_path_for(resource)\n after_signup_path\n end", "def after_inactive_sign_up_path_for(resource)\n \"/users/sign_up\"\n end", "def after_inactive_sign_up_path_for(resource)\n super\n end", "def after_inactive_sign_up_path_for(resource)\n super(resource)\n end", ...
[ "0.8187507", "0.81848", "0.81760675", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.8153954", "0.814797", "0.814797", "0.80890775", "0....
0.7571099
65