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
Build notification channel with recipient's id for uniqueness
def build_notification_id(id) "Notification-#{id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_notification(chatroom)\n last_message = chatroom.messages.last\n user = last_message.user\n other_user = chatroom.other_user user.id\n n = other_user.notification || Notification.create(user_id: other_user.id)\n n.count += 1\n n.save\n last_message.notification_id = n.id\n last_m...
[ "0.6494224", "0.6371563", "0.62326276", "0.6015568", "0.60095704", "0.6007749", "0.6003157", "0.5968473", "0.5921255", "0.5906491", "0.5903533", "0.58895266", "0.5872908", "0.5842301", "0.5792226", "0.5790746", "0.56935334", "0.56517667", "0.56467193", "0.5646183", "0.5631943...
0.658753
0
MERGE SORT this will require a tmp array into which sorting is made then the sorted array is inserted into the original array
def merge numbers, si, mi1, ei mi2 = mi1+1 verboser "Merging: #{numbers[si..mi1].inspect} and #{numbers[mi2..ei]}" # TODO: your cool code goes here verboser " Merged subset: #{tmp.inspect}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def inplace_merge(arr1, arr2)\n i = 0\n w = 0\n while i < arr1.length\n while w < arr2.length\n if arr1[i] > arr2[w]\n temp = arr1[i]\n arr1[i] = arr2[w]\n arr2[w] = temp\n sort_array(arr2)\n end\n w += 1\n end\n i += 1\n w = 0\n end\n \"#{arr1}, #{arr2}\...
[ "0.72010505", "0.7152265", "0.70169735", "0.6960118", "0.6919255", "0.68916965", "0.6879373", "0.6844455", "0.6815519", "0.68037057", "0.67956895", "0.67718166", "0.676876", "0.6752991", "0.6744357", "0.6727301", "0.66862285", "0.6674212", "0.66727436", "0.66602963", "0.66281...
0.0
-1
sort the part of the array between given start and end positions si start index ei end index
def merge_sort numbers, si=0, ei=nil # TODO: your cool code goes here end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def merge_sort(array, start_index, end_index)\n if start_index < end_index\n middle_index = (start_index + end_index)/2\n merge_sort(array, start_index, middle_index)\n merge_sort(array, middle_index + 1, end_index)\n merge(array, start_index, middle_index, end_index)\n end\nend", "def merge(arr, s...
[ "0.7239957", "0.69410694", "0.68556356", "0.66685927", "0.66316485", "0.6569115", "0.6508895", "0.6379982", "0.63430446", "0.63360417", "0.63270694", "0.6309002", "0.63049173", "0.6285914", "0.6281585", "0.62781805", "0.6277261", "0.6263953", "0.6253597", "0.6253597", "0.6232...
0.0
-1
GET /v1_users/1 GET /v1_users/1.xml
def show @user = V1::User.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def list_users\n self.class.get('/users')\n end", "def me\n users(request(\"users/authenticate.xml\", :auth => true))\n en...
[ "0.7324316", "0.7263191", "0.70334387", "0.703133", "0.7022669", "0.6952381", "0.69311726", "0.69284964", "0.6906805", "0.6877214", "0.6863679", "0.6861693", "0.6852877", "0.68417597", "0.6838022", "0.6819364", "0.67944705", "0.6774524", "0.6770582", "0.6769768", "0.67685175"...
0.6979554
5
GET /v1_users/new GET /v1_users/new.xml
def new @user = V1::User.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @user } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n logger.debug(\"Create a new user\")\n @user = User.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @user = User.new\n\n respond_to do |format|\n format.xml { render xml: @user}\n end\n end"...
[ "0.7770934", "0.7676611", "0.7537759", "0.7489337", "0.7476299", "0.7476299", "0.7476299", "0.7476299", "0.7476299", "0.7449802", "0.7449802", "0.7439228", "0.74284256", "0.74212873", "0.7412579", "0.7412579", "0.7412579", "0.7412579", "0.7412579", "0.7412579", "0.7412579", ...
0.77271026
1
POST /v1_users POST /v1_users.xml
def create @user = V1::User.new(params[:user]) respond_to do |format| if @user.save flash[:notice] = 'V1::User was successfully created.' format.html { redirect_to(@user) } format.xml { render :xml => @user, :status => :created, :location => @user } else format.html { render :action => "new" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post b...
[ "0.7097466", "0.65232956", "0.64493406", "0.6405738", "0.6386564", "0.6360857", "0.6254345", "0.62370557", "0.6159514", "0.61357844", "0.6111976", "0.61005384", "0.6092859", "0.6067044", "0.60634506", "0.60494655", "0.6014319", "0.59985685", "0.59955853", "0.59836286", "0.596...
0.64502066
2
PUT /v1_users/1 PUT /v1_users/1.xml
def update @user = V1::User.find(params[:id]) respond_to do |format| if @user.update_attributes(params[:user]) flash[:notice] = 'V1::User was successfully updated.' format.html { redirect_to(@user) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @user.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def UpdateUser params = {}\n \n APICall(pa...
[ "0.672018", "0.65514594", "0.63528115", "0.6310416", "0.63083714", "0.6283871", "0.6262443", "0.6235099", "0.62273854", "0.6217405", "0.6203473", "0.61896455", "0.61524713", "0.61441886", "0.61353064", "0.61217386", "0.6071993", "0.60674876", "0.60571223", "0.60388726", "0.60...
0.69450897
0
DELETE /v1_users/1 DELETE /v1_users/1.xml
def destroy @user = V1::User.find(params[:id]) @user.destroy respond_to do |format| format.html { redirect_to(v1_users_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\...
[ "0.7400963", "0.70577294", "0.70307136", "0.7027561", "0.7009527", "0.7004813", "0.6991697", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "0.69428486", "...
0.74574465
0
Returns a hash of cards SheetName => CardName => Card Modifies defaultFile
def read_worksheet(ws, defaultFile) cards = {} keys = [] (1..ws.getNumRows()).each do |row| if (row == 1) cards[ws.getTitle()] = {} end card = {} (1..ws.getNumCols()).each do |col| cell = ws.getCell(row, col) if cell.empty? then next end # first row should be keys if (row == 1) keys << cell.gsub(' ', '_').downcase else card[keys[col-1]] = cell end end unless (card.empty?) cards[ws.getTitle()][card['name']] = card end if (defaultFile and card['count']) defaultFile['cards'] << card.select do |field| ['name', 'count'].include?(field) end end end return cards end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def hash\n [color, cards, address_placement, custom_envelope, double_sided, extra_service, mail_type, return_envelope, bleed, file_original_url].hash\n end", "def card_on_file(card)\n all_cards = cards.map(&:card)\n end", "def digest\n @digest ||= begin\n Digest::SHA1.hexdigest \"defaults-#...
[ "0.6096654", "0.571326", "0.5590168", "0.5418507", "0.538461", "0.5345174", "0.5306743", "0.5304567", "0.5300065", "0.5268721", "0.5168882", "0.5166409", "0.515816", "0.51117015", "0.51057327", "0.50802505", "0.5061582", "0.5029597", "0.5029331", "0.49997294", "0.4990277", ...
0.600847
1
Defines global method of user's complete name
def full_name(user) user.first_name + ' ' + user.last_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def user_method(name = nil)\n @user_method = name unless name.nil?\n @user_method ||= :user\n end", "def my_name\n end", "def user_name\n \"someone\"\n end", "def my_name # Definisi dalam membuat kunci my_name\n puts \"Bagus Wachyu Nuralam\" # Isi dari kunci definisi\nend...
[ "0.7304595", "0.72069484", "0.7170344", "0.67818743", "0.6690285", "0.66405606", "0.66405606", "0.66405606", "0.66405606", "0.6640308", "0.65937096", "0.6519074", "0.65088004", "0.6458329", "0.6441535", "0.6406145", "0.6390145", "0.6377516", "0.6377516", "0.6365739", "0.63581...
0.0
-1
Full Name Formal Format
def formal_format(user) user.last_name + ', ' + user.first_name + '.' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def format_name\n put_together_name(:full)\n end", "def full_name\n \"#{first_name} #{last_name}\".titleize\n end", "def full_name\n \"#{first_name} #{last_name}\".titleize\n end", "def short_name\r\n return \"#{first_name[0].chr}. #{last_name}\"\r\n end", "def full_name\n \"#{first_name...
[ "0.7951059", "0.78557795", "0.78557795", "0.78472084", "0.77989334", "0.7765546", "0.7755177", "0.77548975", "0.77548975", "0.77302575", "0.7727197", "0.7727009", "0.7725848", "0.7705046", "0.7705046", "0.7705046", "0.76984614", "0.76983774", "0.76952374", "0.76849365", "0.76...
0.0
-1
Defines global method of solicitante's complete name
def sol_full_name(user) user.sol_f_name + ' ' + user.sol_fl_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request_method_symbol; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; end", "def method_name; en...
[ "0.6328091", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60772026", "0.60729295", "0.6049537", "0.5992357", "0.5979624", "0.59693676", "0.5968338", "0.59447163", "...
0.0
-1
Export the entire class definition as an OWL ontology. ==== Example Person.to_owl returns string representation of the OWL ontology in Turtle. Person.to_owl(:json) returns string representation of the OWL ontology in RDFJSON.
def to_owl(*args) g = Graph.new owl = Namespace.new('http://www.w3.org/2002/07/owl', 'owl', true) foaf = Namespace.new("http://xmlns.com/foaf/0.1/", "foaf") rdf = Namespace.new("http://www.w3.org/1999/02/22-rdf-syntax-ns", "rdf", true) rdfs = Namespace.new("http://www.w3.org/2000/01/rdf-schema", 'rdfs', true) xsd = Namespace.new('http://www.w3.org/2001/XMLSchema', 'xsd', true) for property in properties g << Triple.new(BNode.new('john'), foaf.knows, BNode.new('jane')) end return g end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def owl_export\r\n graph = RDF::Graph.new\r\n owl = OWL::OWLDataFactory.new(graph)\r\n otus = Otu.find(:all, :conditions => \"(proj_id = #{@proj.id})\")\r\n otus.each do |otu|\r\n Ontology::Mx2owl.translate_otu(otu, owl)\r\n end\r\n all_codings = Coding.find(:all, :conditions => \"(proj_id =...
[ "0.68955207", "0.63211143", "0.54239297", "0.5383889", "0.5383889", "0.5290624", "0.5257335", "0.5232529", "0.51571465", "0.5136714", "0.51310617", "0.50712633", "0.5068511", "0.504956", "0.50343484", "0.50343484", "0.50316393", "0.5024953", "0.5023942", "0.49347442", "0.4914...
0.71039104
0
Create the basic OWL triples for the class, without the properties. ==== Example Person.triple_for_class_definition returns a graph of the triples representing the bare class in OWL. ==== Rules for creating the ontology The class itself will be represented by a bnode. ==== Returns
def triples_for_class_definition declare_namespaces g = Graph.new b = BNode.new(self.name) g << Triple.new(b, URIRef.new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), URIRef.new('http://www.w3.org/2002/07/owl#Class')) return g end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def make_triples (c1,rdf_class,maketype,dtypes=Array.new,rdf_type=true)\n rdf_ns=\"http://www.w3.org/1999/02/22-rdf-syntax-ns#\"\n ipref= uri rdf_class.to_s+'/'\n is_literal=false\n dtype,lang,ret=\"\",\"\",\"\"\n object_property = nil\n triples =\"\"\n\n unless c1[:id]\n id_row = c1.sele...
[ "0.5579664", "0.52879083", "0.49345756", "0.48922223", "0.4817509", "0.4728497", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.4666913", "0.46462542", "0.4645764",...
0.7491388
0
Create the OWL triples for a DataMapper property. ==== Example Person.triples_for_property(Person.properties[:id]) returns a graph of the triples representing the id property on Person in OWL. ==== Returns
def triples_for_property(property) g = Graph.new b = BNode.new(property.field) t = Triple.new(b, URIRef.new('http://www.w3.org/1999/02/22-rdf-syntax-ns#type'), URIRef.new('http://www.w3.org/2002/07/owl#DatatypeProperty')) g << t return g end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def property_ids\n result = Array.new\n self.properties.each do |p|\n result << p.id\n end\n result\n end", "def relationship_get_all_props id\n headers = {\n 'Accept' => 'application/json; charset=UTF-8',\n }\n get_request 'relationship/' + id + '/properties', headers\n end", ...
[ "0.5753868", "0.5497396", "0.541085", "0.53753597", "0.5325469", "0.53057456", "0.509781", "0.50788236", "0.50493073", "0.5009893", "0.49909544", "0.49608135", "0.4953707", "0.49434432", "0.49336532", "0.49327007", "0.48956886", "0.48527429", "0.48527429", "0.48167402", "0.48...
0.81186235
0
Utility method to declare a bunch of useful namespaces. ==== Example Person.declare_namespaces instantiates some useful namespaces.
def declare_namespaces foaf = Namespace.new("http://xmlns.com/foaf/0.1/", "foaf") rdf = Namespace.new("http://www.w3.org/1999/02/22-rdf-syntax-ns", "rdf", true) rdfs = Namespace.new("http://www.w3.org/2000/01/rdf-schema", 'rdfs', true) xsd = Namespace.new('http://www.w3.org/2001/XMLSchema', 'xsd', true) owl = Namespace.new('http://www.w3.org/2002/07/owl', 'owl', true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def namespace_declarations(ctx); end", "def namespace_declarations(ctx); end", "def register_namespaces(namespaces); end", "def register_namespaces(namespaces); end", "def define_namespaces #:nodoc:\n unless self.respond_to?(:namespaces)\n send(:define_singleton_method, :namespaces) { @namespaces }...
[ "0.75440854", "0.75440854", "0.736702", "0.736702", "0.72799885", "0.71502215", "0.71502215", "0.71502215", "0.71502215", "0.6645348", "0.6449004", "0.6407811", "0.63631", "0.63597524", "0.6318325", "0.63072926", "0.6255909", "0.6255909", "0.61990136", "0.61990136", "0.619496...
0.78323376
0
Credit to the original author. This method retrieves a deep copy of the current object. Returns: Deep copy of the same object.
def deepcopy Marshal.load(Marshal.dump(self)) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def deep_copy\r\n Marshal.load(Marshal.dump(self))\r\n end", "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def deep_copy\n Marshal.load(Marshal.dump(self))\n end", "def deep_copy\n Marshal.load(Mar...
[ "0.8405484", "0.8364518", "0.8359349", "0.8359349", "0.82695425", "0.8260108", "0.82586366", "0.82137305", "0.8163084", "0.8158311", "0.81468284", "0.81088006", "0.81088006", "0.80858094", "0.80858094", "0.79604286", "0.79542583", "0.79395646", "0.79395646", "0.79395646", "0....
0.8292451
4
Convert object to boolean. Example: "foo".to_bool => true false.to_bool => false nil.to_bool => nil true.to_bool => true Returns: Boolean or nil.
def to_bool if [FalseClass, NilClass].include? self.class self else true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_boolean(str)\n str == 'true'\nend", "def to_boolean(string)\n string == 'true'\nend", "def convert_to_boolean(val)\n return val if val.is_a?(TrueClass) || val.is_a?(FalseClass)\n val = val.to_s.clean\n return nil if val.blank?\n if val.match?(/\\A(false|f|n|no)\\z/i)\n false...
[ "0.79276013", "0.7795183", "0.77255815", "0.77148724", "0.762079", "0.7605198", "0.75702304", "0.75484055", "0.7542715", "0.7472855", "0.74656534", "0.7459272", "0.7458515", "0.74533063", "0.74152863", "0.7305351", "0.73045814", "0.7285131", "0.72694033", "0.7267777", "0.7245...
0.70021135
37
GET /:mount_point/auth/:provider/callback POST /:mount_point/auth/:provider/callback
def create # TODO: # * guard based on "state" param: # if `session['omniauth.state]`, `params[:state]` must match. authorization = Corkboard::Authorization.create!(auth_attrs) subscription = Corkboard::Subscription.create!(provider, authorization) Corkboard.publish!(subscription.backlog) redirect_to(authorizations_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def login_with(provider)\n post \"/auth/#{provider}/callback\", params: OmniAuth.config.mock_auth[provider.to_sym]\n end", "def login_with(provider)\n post \"/auth/#{provider}/callback\", params: OmniAuth.config.mock_auth[provider.to_sym]\n end", "def callback\n self.oaw_callback(params[:oauth_verif...
[ "0.6538423", "0.6538423", "0.6353385", "0.63533753", "0.63533753", "0.62225723", "0.6167551", "0.61658394", "0.61616355", "0.61517507", "0.60876554", "0.60803777", "0.6061493", "0.6057918", "0.60354775", "0.60305214", "0.6005606", "0.5981451", "0.59734416", "0.5953592", "0.59...
0.0
-1
Load the metadata. Should yield an IOlike object to a block; that block will deserialize the metadata from that object and return the metadata. Returns the metadata, or nil if it could not be loaded.
def load(&_block) nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def read_metadata\n @metadata =\n if !disabled? && File.file?(metadata_file)\n content = File.binread(metadata_file)\n\n begin\n Marshal.load(content)\n rescue TypeError\n SafeYAML.load(content)\n rescue ArgumentError => e\n Jekyll.lo...
[ "0.68362975", "0.6697924", "0.6695487", "0.6695487", "0.6215201", "0.61565614", "0.6082304", "0.6082304", "0.591639", "0.5908312", "0.58686626", "0.58283377", "0.58219236", "0.57575154", "0.5729059", "0.5724777", "0.5661977", "0.5607366", "0.5571443", "0.5570953", "0.5560958"...
0.5101779
48
GET /asignaciones GET /asignaciones.json
def index @asignaciones = Asignacione.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @asignaturas = Asignatura.all\n end", "def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end", "def show\n @asignatura = Asignatura.find(params[:id])\n\n res...
[ "0.66929483", "0.64084345", "0.64084345", "0.6375693", "0.62422055", "0.6200706", "0.6180802", "0.6142473", "0.613062", "0.60766166", "0.6075529", "0.6066304", "0.6054506", "0.60474503", "0.60399735", "0.6017307", "0.6016035", "0.60146576", "0.60071844", "0.59974766", "0.5989...
0.7086205
0
GET /asignaciones/1 GET /asignaciones/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asignatura }\n end\n end", "def show\n @asignatura = Asignatura.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n ...
[ "0.7047089", "0.7047089", "0.69400126", "0.66943336", "0.6621779", "0.65289605", "0.650952", "0.64471537", "0.6421427", "0.63770634", "0.63122857", "0.6295308", "0.6293499", "0.62904716", "0.6276856", "0.6254075", "0.6245213", "0.6244486", "0.6243239", "0.623749", "0.623292",...
0.0
-1
POST /asignaciones POST /asignaciones.json
def create @asignacione = Asignacione.new(asignacione_params) respond_to do |format| if @asignacione.save format.html { redirect_to asignaciones_url, notice: 'Asignacione Se creó correctamente.' } format.json { render :index, status: :created, location: @asignacione } else format.html { render :new } format.json { render json: @asignacione.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @asignatura = Asignatura.new(asignatura_params)\n\n respond_to do |format|\n if @asignatura.save\n format.json { render json: \"Asignatura Creada\", status: :created, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_en...
[ "0.69499505", "0.67620045", "0.6509578", "0.6494808", "0.6383536", "0.61583954", "0.61330295", "0.60703856", "0.6061938", "0.60456383", "0.60264313", "0.59847665", "0.59686124", "0.59438384", "0.5943105", "0.5930582", "0.5921087", "0.5891517", "0.5870029", "0.5859305", "0.585...
0.6691863
2
PATCH/PUT /asignaciones/1 PATCH/PUT /asignaciones/1.json
def update respond_to do |format| if @asignacione.update(asignacione_params) format.html { redirect_to asignaciones_url, notice: 'Asignacione Se ha actualizado correctamente.' } format.json { render :index, status: :ok, location: @asignacione } else format.html { render :edit } format.json { render json: @asignacione.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @asignatura.update(asignatura_params)\n format.json { render json: \"Asinatura Actualizada\", status: :ok, location: @asignatura }\n else\n format.json { render json: @asignatura.errors, status: :unprocessable_entity }\n end\n end\n end",...
[ "0.67150855", "0.67116004", "0.6676339", "0.6604165", "0.658328", "0.6546478", "0.65423894", "0.65317166", "0.6499939", "0.64866084", "0.6468909", "0.64338267", "0.64194757", "0.64100486", "0.6403175", "0.63999057", "0.6393827", "0.6380185", "0.637993", "0.637594", "0.6366851...
0.65345347
7
DELETE /asignaciones/1 DELETE /asignaciones/1.json
def destroy @asignacione.destroy respond_to do |format| format.html { redirect_to asignaciones_url, notice: 'Asignacione Fue destruido con éxito.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @asignatura.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @asignatura = Asignatura.find(params[:id])\n @asignatura.destroy\n\n respond_to do |format|\n format.html { redirect_to asignaturas_url }\n format.json { he...
[ "0.78542054", "0.77204746", "0.77204746", "0.73918027", "0.73609", "0.73272926", "0.7310968", "0.73044634", "0.7299248", "0.72535414", "0.7249215", "0.72261065", "0.7222302", "0.72005993", "0.71886706", "0.71746546", "0.7162525", "0.7152822", "0.71376973", "0.71346253", "0.71...
0.7458385
3
Use callbacks to share common setup or constraints between actions.
def set_asignacione @asignacione = Asignacione.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.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.532...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def asignacione_params params.require(:asignacione).permit(:PKASIGNACION, :PKGRUA, :PKOPERADOR, :AS_FECHAINICIO, :AS_FECHAFIN, :AS_OBSERVACIONES) 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
Select which users to include. Return true to include the user.
def include_user(user) # Komentorivillä mainitut käyttäjät return false unless LIMIT_EMAILS.empty? || LIMIT_EMAILS.include?(user.email) # Hylkää käyttäjät, jotka eivät maksa henkilöjäsenmaksua return false if not LASKUTETAVAT_JASENLUOKAT.include?(user["jasenluokka"]) # Hylkää käyttäjät, joilla ei ole sähköpostiosoitetta puts "Ei sähköpostiosoitetta: #{user.nimi}" if (user.email == nil) return false if (user.email == nil) # Hylkää käyttäjät, joille on jo lähetetty tänä vuonna jäsenmaksulasku laskutettu = user.laskutettu?(CURRENT_YEAR) puts "On jo laskutettu tänä vuonna: #{user.nimi}" if laskutettu return false if laskutettu # Poista käyttäjät jotka ovat maksaneet maksanut = (user.maksanut?(CURRENT_YEAR) || user.maksanut?(CURRENT_YEAR+1)) puts "On jo maksanut: #{user.nimi}" if maksanut return false if maksanut return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users_include?(*user_ids)\n user_ids.map { |user_id| @users.include?(user_id) }.all?\n end", "def include?(name)\n inclusively { users.has_key?(name) }\n end", "def user_included?(user,selector)\n if selector == user || selector=='*'\n true\n elsif user.nil?\n selector=='$anony...
[ "0.7256995", "0.7037244", "0.68592906", "0.6466132", "0.64049107", "0.6348443", "0.6318995", "0.6282148", "0.61893815", "0.61428815", "0.6114443", "0.60869986", "0.6034475", "0.6030384", "0.60044885", "0.59808016", "0.5977501", "0.5886813", "0.58853596", "0.58565253", "0.5842...
0.59718764
17
Return a string to set to the "sent" status. nil for setting nothing.
def mark_sent(user) return "email #{LASKUPV}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sent?\n status == \"sent\"\n end", "def sent?\n self.status == 'sent'\n end", "def status\n return \"draft\" if self.draft?\n return \"sent\" if self.sent?\n return \"batch\" if self.batch_sent?\n end", "def mailout_status_display\n if self.mailout_status == 'n'\n return...
[ "0.7370231", "0.7349279", "0.69955814", "0.6797876", "0.6751375", "0.6693716", "0.665995", "0.6630954", "0.64742666", "0.64742666", "0.63539493", "0.6300166", "0.6255376", "0.6251144", "0.62446237", "0.61688673", "0.6067282", "0.6050569", "0.60147136", "0.5961018", "0.5944031...
0.60495156
18
Returns an array of valid moves for a piece at the given position. Note: this method doesn't exclude moves that lead current king to be attacked (See +safe_moves+ method)
def valid_moves(from) piece = @board.at(from) if piece.king? || piece.knight? piece.moves.map do |move| to = relative_coords(from, move) to if possible_move?(to) end.compact elsif piece.pawn? pawn_valid_moves(from) else valid_moves_recursive(from) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_valid_moves(pos)\n piece = self[pos]\n color = piece.color\n potential_moves = piece.potential_moves\n valid_moves = []\n potential_moves.each do |to_pos|\n if self.valid_move?(pos, to_pos, color)\n valid_moves << to_pos\n end\n end\n valid_moves\n ...
[ "0.8185849", "0.7812936", "0.74946195", "0.74220675", "0.73997205", "0.73979944", "0.7337812", "0.73360693", "0.7335365", "0.7282508", "0.725148", "0.72455806", "0.7196486", "0.71641606", "0.71571183", "0.71517473", "0.7138756", "0.7129622", "0.71145797", "0.7079941", "0.7073...
0.7443711
3
Returns coordinates that will be reached after applying the +move+, starting from the +from+ coordinates
def relative_coords(from, move) [from[0] + move[0], from[1] + move[1]] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_move\n cols = %w(a b c d e f g h)\n rows = %w(8 7 6 5 4 3 2 1)\n\n from_pos, to_pos = nil, nil\n until from_pos && to_pos\n @display.draw\n if from_pos\n row, col = from_pos\n piece = @display.board[from_pos].class\n puts \"#{piece} at #{cols[col]}#{rows[row]} sel...
[ "0.6785309", "0.6652342", "0.6520607", "0.64795303", "0.64261705", "0.64005244", "0.6397645", "0.6369637", "0.6346817", "0.63239735", "0.63122606", "0.6307506", "0.6291631", "0.62254333", "0.62195057", "0.61803865", "0.61793727", "0.61729735", "0.6155689", "0.6155479", "0.613...
0.7902153
0
Returns true if: The 8x8 board exists at given coordinates Board at given coordinates is empty or it contains a piece with the same color as the current_color
def possible_move?(coords) if @board.exists_at?(coords) piece = @board.at(coords) return (piece.nil? || piece.color != @current_color) end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def own_piece?(pos, board)\r\n board[pos].color == @color unless board[pos].nil?\r\n end", "def occupied?(x, y)\n game.pieces.where(x_coordinates: x, y_coordinates: y).present?\n end", "def occupied?(x,y) # board position !nil\n !self.board.grid[x][y].nil?\n end", "def touching?(board)\n @po...
[ "0.75873244", "0.7320814", "0.73124367", "0.7310062", "0.7302868", "0.72241026", "0.71883094", "0.7149845", "0.712294", "0.71059525", "0.7095906", "0.70437247", "0.7008888", "0.6984433", "0.69529545", "0.69522965", "0.69173354", "0.6905462", "0.6905242", "0.6890431", "0.68757...
0.713146
8
Returns true if the current king is attacked after the given move
def fatal_move?(from, to) is_fatal = false move = Move.new(@board, from, to) move.commit is_fatal = true if king_attacked? move.rollback is_fatal end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def legal_move?(move)\n captured_piece = @board.data[move[0]][move[1]]\n move_current_piece(move)\n king = @king_location || move\n result = safe_king?(king)\n @board.data[move[0]][move[1]] = captured_piece\n result\n end", "def legal_move?(move)\n captured_piece = @board.data[move[0]][move...
[ "0.6995761", "0.6995761", "0.683071", "0.6794473", "0.67933196", "0.6655382", "0.66428125", "0.66428125", "0.6567343", "0.6535022", "0.65295804", "0.65294135", "0.647339", "0.6467945", "0.6465358", "0.6431901", "0.6366063", "0.63029397", "0.6297273", "0.6291199", "0.62841064"...
0.58184576
94
Returns additional valid coordinates for the pawn if available
def en_passant_coords(from) pawn = @board.at(from) [1, -1].each do |x| next_coords = [from[0] + x, from[1]] next_piece = @board.at(next_coords) if next_piece.class == Pawn && next_piece == @last_piece && next_piece.moves_count == 1 && from[1].between?(3, 4) return [from[0] + x, from[1] + pawn.direction] end end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pawn(p1)\n row = get_row_from_index(p1)\n col = get_col_from_index(p1)\n valid = []\n\n # Piece color defines direction of travel. Enemy presence defines\n # the validity of diagonal movements\n if @@color == \"red\"\n if unoccupied?(p1 - 8)\n valid << (p1 - 8)\n end\n i...
[ "0.67126155", "0.65279365", "0.63808465", "0.61852264", "0.61790967", "0.6148613", "0.6114918", "0.6041643", "0.59342945", "0.5903827", "0.58609873", "0.5844218", "0.5839292", "0.5834986", "0.58304584", "0.581266", "0.57921386", "0.5783001", "0.57773286", "0.5773813", "0.5771...
0.6461994
2
This method is used by valid_moves for pieces like Queen, Rook and Elephant, that should move recursively
def valid_moves_recursive(from) piece = @board.at(from) piece.moves.inject([]) do |valid_moves, move| valid_moves.push(*repeated_move(from, move)) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #pu...
[ "0.76016694", "0.7324892", "0.7321883", "0.7308644", "0.7247166", "0.71517324", "0.7144865", "0.7121223", "0.70800674", "0.70583564", "0.70496464", "0.70420474", "0.7032291", "0.7018141", "0.6971988", "0.6963675", "0.6948388", "0.694427", "0.6924276", "0.69210607", "0.6919651...
0.71693075
5
Push value to heap. [value] Will be pushed value.
def push(value) if values.length <= @pos raise RuntimeError.exception @errormessage end i = @pos @pos += 1 while i > 0 idx = (i-1)/2 break if values[idx] <= value values[i] = values[idx] i = idx end values[i] = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def push(value)\n push_at(size, value)\n end", "def insert(value)\n @heap << value\n perc_up(@heap.length - 1)\n end", "def push(val)\n @store << val\n idx = count - 1\n @store = BinaryMinHeap.heapify_up(@store, idx, &prc)\n end", "def insert(value)\n self.heap.append(value)\n ...
[ "0.83797544", "0.83761847", "0.8374083", "0.8316124", "0.82909113", "0.81794727", "0.81556946", "0.8042554", "0.79862094", "0.798473", "0.78831685", "0.78428006", "0.78130794", "0.7793407", "0.77696705", "0.7749843", "0.7749137", "0.76952034", "0.7667207", "0.7639708", "0.761...
0.76736265
18
Pop value from heap.
def pop if @pos <= 0 raise RuntimeError.exception @errormessage end ret = values[0] @pos -= 1 x = values[@pos] i = 0 while i*2+1 < @pos l, r = i*2+1, i*2+2 l = r if r < @pos and values[r] < values[l] break if values[l] >= x values[i] = values[l] i = l end values[i] = x ret end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def pop\n @heap.pop\n end", "def remove\n swap(0, self.heap.length-1, self.heap)\n value_to_remove = self.heap.pop\n self.sift_down(0, self.heap.length-1, heap)\n return value_to_remove\n end", "def remove\n swap(0, @heap.length - 1, @heap)\n value_to_remove = @heap.pop\n sift_down(0,...
[ "0.84589607", "0.82389003", "0.8151331", "0.81082684", "0.79473424", "0.7850068", "0.7789662", "0.7783225", "0.77629894", "0.76868236", "0.764917", "0.75756", "0.7571949", "0.75167376", "0.7494926", "0.7479976", "0.7438348", "0.74274826", "0.74219185", "0.7408341", "0.740317"...
0.73145825
35
to_s override. Call values to_s.
def to_s @values.to_s end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end", "def to_s() end"...
[ "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8416983", "0.8300485", "0.8300485", "0.8300485", "...
0.81468683
75
add constants before validation
def before_validate self.initial_output :alias => 'PREVOUT' unless self.initial_output self.previous_input :alias => 'PREVIN' unless self.previous_input self.previous_output :alias => 'PREVOUT' unless self.previous_output self.outputs<< output(0) if self.outputs.empty? super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def literal_validation; end", "def literal_validation; end", "def constants() end", "def setting_validations\n errors.add(:value, I18n.t(:blank, :scope => 'activerecord.errors.messages')) if validators['presence'] && ['1','true',true].include?(validators['presence']) && self.value.nil?\n errors.add(:va...
[ "0.6525904", "0.6525904", "0.6271109", "0.6242165", "0.61091894", "0.60864747", "0.5987065", "0.5984505", "0.5927121", "0.5889196", "0.58884066", "0.5856184", "0.5844246", "0.5780844", "0.5777973", "0.57770276", "0.57602805", "0.57417625", "0.5701958", "0.570052", "0.570052",...
0.0
-1
GET /despatches GET /despatches.json
def index @despatches = Despatch.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @despatch.destroy\n respond_to do |format|\n format.html { redirect_to despatches_url, notice: 'Despatch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_despatch\n @despatch = Despatch.find(params[:id])\n end", "def index\n @...
[ "0.5995585", "0.56333554", "0.5449495", "0.5426829", "0.5375252", "0.5372147", "0.5310042", "0.529576", "0.5267658", "0.52673787", "0.522316", "0.52227986", "0.5205848", "0.5205848", "0.51992226", "0.5176816", "0.513539", "0.5132224", "0.5118664", "0.51121175", "0.51109844", ...
0.7511226
0
GET /despatches/1 GET /despatches/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @despatches = Despatch.all\n end", "def destroy\n @despatch.destroy\n respond_to do |format|\n format.html { redirect_to despatches_url, notice: 'Despatch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def show\n @scratcher = Scratcher.fi...
[ "0.73625445", "0.59933716", "0.59666866", "0.5937096", "0.5560053", "0.5555813", "0.55088705", "0.54871666", "0.5472103", "0.5458925", "0.54157495", "0.5381021", "0.5364854", "0.53639865", "0.53639865", "0.53559864", "0.5326005", "0.5325002", "0.5310936", "0.5310778", "0.5287...
0.0
-1
POST /despatches POST /despatches.json
def create @despatch = Despatch.new(despatch_params) respond_to do |format| if @despatch.save format.html { redirect_to @despatch, notice: 'Despatch was successfully created.' } format.json { render :show, status: :created, location: @despatch } else format.html { render :new } format.json { render json: @despatch.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @despatches = Despatch.all\n end", "def destroy\n @despatch.destroy\n respond_to do |format|\n format.html { redirect_to despatches_url, notice: 'Despatch was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def set_despatch\n @despatch = Des...
[ "0.69399965", "0.62738734", "0.59600383", "0.57216907", "0.5477452", "0.51411057", "0.507427", "0.5061916", "0.49846593", "0.49512577", "0.49468046", "0.4903353", "0.4845712", "0.48189908", "0.48124397", "0.48099357", "0.48040098", "0.47980928", "0.47962403", "0.47889853", "0...
0.64376336
1
PATCH/PUT /despatches/1 PATCH/PUT /despatches/1.json
def update respond_to do |format| if @despatch.update(despatch_params) format.html { redirect_to @despatch, notice: 'Despatch was successfully updated.' } format.json { render :show, status: :ok, location: @despatch } else format.html { render :edit } format.json { render json: @despatch.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def patch!\n request! :patch\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def api_patch(path, data = {}...
[ "0.62995243", "0.6295111", "0.6138229", "0.5969121", "0.59660304", "0.59349906", "0.5791801", "0.576948", "0.56792367", "0.56792367", "0.567347", "0.56725097", "0.56696016", "0.5664288", "0.56471527", "0.56426495", "0.5595384", "0.5589089", "0.55873764", "0.5569512", "0.55630...
0.6312195
0
DELETE /despatches/1 DELETE /despatches/1.json
def destroy @despatch.destroy respond_to do |format| format.html { redirect_to despatches_url, notice: 'Despatch was successfully destroyed.' } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_del\n header 'Content-Type', 'application/json'\n\n data = File.read 'sample-traces/0.json'\n post('/traces', data, 'CONTENT_TYPE': 'application/json')\n\n id = last_response.body\n\n delete \"/traces/#{id}\"\n assert last_response.ok?\n\n get \"/traces/#{id}\"\n\n contents = JSON....
[ "0.70344007", "0.6781829", "0.66554826", "0.66049296", "0.65602446", "0.65396565", "0.64981943", "0.6456154", "0.6433085", "0.6426203", "0.6416008", "0.6415835", "0.6403857", "0.6402571", "0.636574", "0.63648695", "0.6362354", "0.63610226", "0.6354375", "0.6349672", "0.634677...
0.6976659
1
Use callbacks to share common setup or constraints between actions.
def set_despatch @despatch = Despatch.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 despatch_params params.require(:despatch).permit(:day, :product_id, :quantity, :unit, :client_id, :d_c_number) 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.69802505", "0.6781974", "0.67470175", "0.67430073", "0.67350477", "0.6593221", "0.6504263", "0.64988977", "0.6481794", "0.64800006", "0.64568025", "0.64411247", "0.6379476", "0.63765615", "0.6368045", "0.6320141", "0.6300363", "0.6300057", "0.62952244", "0.6294712", "0.629...
0.0
-1
Maybe try a map after sort....instead of patching with an empty array, push, & flatten?
def sort_array_desc(collection) i = 0 result = [] while i < collection.length result = collection.sort { |a, b| b <=> a } i += 1 end return result.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_array_plus_one(a)\n # Q2 CODE HERE\n a.sort.map {|elem| elem + 1}\nend", "def sort_entries; end", "def dictionary_sort_wrap some_array\n dictionary_sort some_array, []\nend", "def sort arr\n rec_sort arr, []\nend", "def sort some_array # This \"wraps\" rec_sort so you don't have to pass rec_s...
[ "0.6683903", "0.64223576", "0.6318844", "0.6252737", "0.62385625", "0.6230885", "0.6230364", "0.622354", "0.622354", "0.6196715", "0.61666214", "0.61653805", "0.6159629", "0.6141722", "0.6140054", "0.6138881", "0.6112106", "0.6111505", "0.6108563", "0.6088582", "0.60139644", ...
0.0
-1
Override the directory where uploaded files will be stored. This is a sensible default for uploaders that are meant to be mounted:
def store_dir "uploads/#{model.class.to_s.underscore}/#{mounted_as}/#{model.id}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def store_dir\n 'file_uploads'\n end", "def store_dir\n 'uploads'\n end", "def store_dir\n \"uploads\"\n end", "def store_dir\n if Rails.env == \"production\"\n ENV['CONFIG_FILE_UPLOAD_PATH']\n else\n \"uploads\"\n end\n end", "def store_dir\n '%suploads/peopl...
[ "0.7866478", "0.762767", "0.76221263", "0.7618018", "0.75756973", "0.7488916", "0.74855983", "0.74539375", "0.74539375", "0.74539375", "0.7399524", "0.7399524", "0.7399524", "0.7399524", "0.7399524", "0.73839206", "0.736413", "0.7357356", "0.73573387", "0.7348109", "0.7340677...
0.0
-1
Provide a default URL as a default if there hasn't been a file uploaded:
def default_url "/images/fallback/" + [version_name, "default.png"].compact.join('_') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def url_with_default *args\n unless file_name.nil?\n url_without_default *args\n else\n nil\n end\n end", "def default_url\n nil\n end", "def default_url\n end", "def default_url\n url 'default'\n end", "def default_url\n file_path = [\n 'fallbacks',\n ...
[ "0.788327", "0.77585304", "0.74635595", "0.7161452", "0.713886", "0.7078496", "0.69854933", "0.69454616", "0.6932205", "0.69272566", "0.6924041", "0.6924041", "0.6924041", "0.691804", "0.6916976", "0.690665", "0.6888884", "0.6869819", "0.68616575", "0.68318623", "0.67751837",...
0.6651211
31
Add a white list of extensions which are allowed to be uploaded. For images you might use something like this:
def extension_white_list %w(jpg jpeg gif png) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def extension_whitelist\n %w(jpg jpeg gif png)\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w[jpg jpeg gif png]\n end", "def extension_whitelist\n %w(jpg jpeg gif png)\n end", ...
[ "0.8157517", "0.8148662", "0.8148662", "0.8148662", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.812408", "0.81232256", "0.8092104", "0.8092104", "0.8092104", "0.8089607", ...
0.7649368
91
Use callbacks to share common setup or constraints between actions.
def set_fd_funcionario @fd_funcionario = FdFuncionario.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_...
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576"...
0.0
-1
Only allow a trusted parameter "white list" through.
def fd_funcionario_params params.require(:fd_funcionario).permit(:nome_funcionario, :desc_telefone, :desc_celular, :data_exclusao, :fd_cargo_id, :fd_endereco_id, :fd_empresa_id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", ...
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.638045...
0.0
-1
remove both the local download file and remote eb config
def clean(mute=false) return if @options[:dirty] UI.say "Cleaning up eb remote config and local files" unless mute eb.delete_configuration_template( application_name: @updater.app_name, template_name: current_name ) unless @options[:noop] FileUtils.rm_f(@current_path) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove!\n FileUtils.rm(File.join(remote_path, remote_file))\n end", "def remove!\n begin\n connection.sync_clock\n connection.delete_object(bucket, File.join(remote_path, remote_file))\n rescue Excon::Errors::SocketError; end\n end", "def clean_remote\n ...
[ "0.67433846", "0.6425313", "0.6320292", "0.62727034", "0.6229026", "0.6153338", "0.61465937", "0.61449295", "0.61324906", "0.6122585", "0.6085128", "0.6078729", "0.60775816", "0.60434383", "0.602657", "0.59735346", "0.59546304", "0.5900189", "0.587504", "0.5861206", "0.585924...
0.6544966
1
a log where multiple processes, and therefore more than one formatter instance writing to log
def test_mult_pids # NOTE: If this test is failing, make sure your IDE did not strip off trailing space on the two 'D' lines below str =<<-EOS I 2016-05-13T16:06:02.702771 [19893,,16c,2,6435] : Parameters: {"flash"=>"false"} I 2016-05-13T16:06:02.705831 [19893,,16c,3,58fb] : Completed 200 OK in 3ms (Views: 0.4ms | ActiveRecord: 0.0ms) D 2016-05-13T16:06:03.193366 [19892,,d84,5,f82f] : D 2016-05-13T16:06:03.193544 [19892,,d84,6,9b54] : I 2016-05-13T16:06:03.193710 [19892,,d84,7,3e40] : Started GET "/" for ::1 at 2016-05-13 16:06:03 -0500 EOS parser = ChainLog::Parser.new str.split("\n").each { |line| entry = parser.parse_and_validate_line line assert !entry.nil?, "Parse error on line #{line}" assert !entry.hash_chain_broken? ,"Invalid chain on line #{line}" } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def log_formatter; end", "def log_formatter; end", "def log_formatter=(_arg0); end", "def log_formatter=(_arg0); end", "def formatter \n original_formatter = Logger::Formatter.new\n Proc.new do |severity, datetime, progname, msg|\n original_formatter.call(severity, datetime, \n ...
[ "0.7167674", "0.7167674", "0.71609366", "0.71609366", "0.6446054", "0.63414174", "0.62889326", "0.6104614", "0.6061141", "0.60205966", "0.60205966", "0.60205966", "0.59324276", "0.5914956", "0.5827998", "0.5814784", "0.580534", "0.57925475", "0.57512486", "0.5734333", "0.5727...
0.0
-1
DELETE /tweets/1 or /tweets/1.json
def destroy @tweet.destroy respond_to do |format| format.html { redirect_to tweets_url, notice: "Tweet was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n user = user_from_token\n user.tweets.destroy(params[:id])\n head :no_content\n end", "def destroy\n @tweet = Tweet.find(params[:id])\n @tweet.destroy\n\n respond_to do |format|\n format.html { redirect_to tweets_url }\n format.json { head :no_content }\n end\n end",...
[ "0.75788456", "0.74131566", "0.74131566", "0.7408176", "0.7398179", "0.7365146", "0.7278487", "0.7263215", "0.7252409", "0.7251072", "0.72109735", "0.715863", "0.715863", "0.715863", "0.715863", "0.715863", "0.715863", "0.713616", "0.71121174", "0.70829034", "0.7080435", "0...
0.715355
21
Use callbacks to share common setup or constraints between actions.
def set_tweet @tweet = Tweet.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
Baseline implementation for the create_device_registry REST call
def create_device_registry request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_create_device_registry_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::DeviceRegistry.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @registry = Registry.new(create_params)\n\n # Check the reachability of the registry.\n unless params[:force]\n msg = @registry.reachable?\n unless msg.empty?\n logger.info \"\\nRegistry not reachable:\\n#{@registry.inspect}\\n#{msg}\\n\"\n msg = \"#{msg} You can skip ...
[ "0.65665287", "0.64571744", "0.639681", "0.6346075", "0.63215065", "0.6275868", "0.615725", "0.6118277", "0.6117805", "0.6105618", "0.60538757", "0.60113376", "0.59451836", "0.59277546", "0.57531714", "0.57111335", "0.56329435", "0.5564706", "0.5551917", "0.55459106", "0.5542...
0.7206692
0
Baseline implementation for the get_device_registry REST call
def get_device_registry request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_get_device_registry_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::DeviceRegistry.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_registry\n @registry = Spree::Registry.find_by_access_hash!(params[:id])\n end", "def registry\n @registry ||= client.registry\n end", "def create_device_registry request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n ...
[ "0.6414344", "0.63427097", "0.6275052", "0.62702143", "0.61037225", "0.6052286", "0.60123277", "0.5901356", "0.58795774", "0.58400446", "0.58000004", "0.58000004", "0.5796119", "0.572173", "0.56915635", "0.56387043", "0.5636897", "0.56368756", "0.56115913", "0.5584582", "0.55...
0.7165653
0
Baseline implementation for the update_device_registry REST call
def update_device_registry request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_update_device_registry_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::DeviceRegistry.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @registry = Registry.find(params[:id])\n @registry.assign_attributes(update_params)\n @can_change_hostname = !Repository.any?\n\n # Check the reachability of the registry.\n check_reachability(\"edit\")\n return if @unreachable\n\n if @registry.save\n # NOTE: if we decide to ...
[ "0.6544306", "0.6397128", "0.60932773", "0.6076052", "0.60323465", "0.60219467", "0.59819824", "0.5930979", "0.5878621", "0.58272964", "0.58272964", "0.57602423", "0.5705622", "0.5692469", "0.5673611", "0.56483406", "0.5622039", "0.55978286", "0.55978286", "0.5562857", "0.554...
0.71623635
0
Baseline implementation for the delete_device_registry REST call
def delete_device_registry request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_delete_device_registry_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @registry = Registry.find(params[:id])\n @registry.destroy\n\n respond_to do |format|\n format.html { redirect_to registries_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @registry = Registry.find(params[:id])\n @registry.destroy\n logger.info...
[ "0.6678598", "0.64973116", "0.64344144", "0.6356241", "0.62678915", "0.6188022", "0.6179569", "0.6136864", "0.61301553", "0.6117857", "0.61041653", "0.60915935", "0.6054046", "0.60346687", "0.602476", "0.60200715", "0.601763", "0.601763", "0.601763", "0.601763", "0.5996484", ...
0.7706852
0
Baseline implementation for the list_device_registries REST call
def list_device_registries request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_device_registries_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::ListDeviceRegistriesResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @device_registrations = DeviceRegistration.all\n end", "def calc_reg_list(device = :all)\n registrars.find_all { |dev, reg| device.to_sym == :all || device.to_s == dev }.map { |vp| vp[1] }\n end", "def index\n @bridal_registries = spree_current_user.bridal_registries\n respond_wit...
[ "0.6678728", "0.66782385", "0.62170297", "0.616881", "0.6099848", "0.5954673", "0.5906578", "0.58905977", "0.585306", "0.5850263", "0.5813769", "0.5807204", "0.5780627", "0.5707221", "0.5692937", "0.56886655", "0.55822414", "0.5568046", "0.55411273", "0.55298465", "0.5504572"...
0.73563457
0
Baseline implementation for the create_device REST call
def create_device request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_create_device_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::Device.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @device = Device.create!(device_params)\n json_response(@device, :created)\n end", "def device_create_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DevicesApi.device_create ...'\n end\n # verify the requ...
[ "0.76700026", "0.7212943", "0.7111125", "0.7038411", "0.68873525", "0.68498117", "0.6795869", "0.678471", "0.6757632", "0.67240757", "0.67192733", "0.67192733", "0.67192733", "0.67192733", "0.671811", "0.6717783", "0.67062944", "0.6701651", "0.66944015", "0.66924685", "0.6640...
0.6586002
22
Baseline implementation for the get_device REST call
def get_device request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_get_device_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::Device.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_device_data(param = false)\n\n # get the user-agent\n if param == false\n user_agent = ''\n if !@headers.nil?\n user_agent = @headers['HTTP_USER_AGENT']\n end\n elsif param == true\n\t\t\tuser_agent = @settings.test_useragent\n else\n if @request.nil?\n @reques...
[ "0.6800168", "0.65949285", "0.6578728", "0.6522494", "0.65135634", "0.6477868", "0.6468373", "0.6404003", "0.6383859", "0.6365089", "0.62849194", "0.6275248", "0.62642545", "0.62614286", "0.62497973", "0.622994", "0.621961", "0.6189881", "0.61835283", "0.6117116", "0.6117116"...
0.64595926
7
Baseline implementation for the update_device REST call
def update_device request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_update_device_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::Device.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @device.update(device_params)\n head :no_content\n end", "def update\n respond_to do |format|\n if @device.update(device_params)\n format.json { head :no_content }\n else\n format.json { render json: {errors: @device.errors}, status: :unprocessable_entity }\n e...
[ "0.7605351", "0.7273915", "0.7082013", "0.700525", "0.697887", "0.6964972", "0.694652", "0.6936144", "0.69320804", "0.6905444", "0.6829858", "0.6799253", "0.67778164", "0.67497337", "0.67489934", "0.6739813", "0.6721979", "0.6701901", "0.6701901", "0.6701901", "0.6701901", ...
0.65907776
44
Baseline implementation for the delete_device REST call
def delete_device request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_delete_device_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Protobuf::Empty.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @device.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n# @device.destroy\n# respond_to do |format|\n# format.html { redirect_to devices_url, notice: 'Device was successfully destroyed.' }\n# format.json { head :no_content }...
[ "0.7490874", "0.7454417", "0.7393073", "0.7212595", "0.7192695", "0.7164795", "0.716131", "0.71611315", "0.71611315", "0.71611315", "0.7160061", "0.71351606", "0.7132521", "0.7093013", "0.70908636", "0.70901185", "0.7079604", "0.7064358", "0.705461", "0.7035577", "0.6952687",...
0.72354305
3
Baseline implementation for the list_devices REST call
def list_devices request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_devices_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::ListDevicesResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_list\n @devices = Device.all\n end", "def device_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DevicesApi.device_list ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && op...
[ "0.77348846", "0.7566501", "0.741081", "0.70471406", "0.7038363", "0.7010545", "0.6928239", "0.69081485", "0.6635972", "0.6602811", "0.655804", "0.6551054", "0.6518726", "0.64532065", "0.6449699", "0.64483947", "0.64452827", "0.64440304", "0.64341426", "0.6433142", "0.6417839...
0.68784016
8
Baseline implementation for the modify_cloud_to_device_config REST call
def modify_cloud_to_device_config request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_modify_cloud_to_device_config_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::DeviceConfig.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_configuration\n if @@initialized\n url = 'http://'+ENV['CONSUL_IP']+':8500/v1/kv/docker_nodes?raw'\n #log_message('Updating configuration from: ' + url)\n response = HTTPService.get_request(url)\n log_message('Dynamo changed, updating configuration to: ' + response.body)\n re...
[ "0.6099665", "0.59873724", "0.59873724", "0.58969736", "0.5886794", "0.57737046", "0.5697701", "0.5606722", "0.56054664", "0.55634046", "0.5484844", "0.54658407", "0.54615057", "0.5446909", "0.54028964", "0.5396395", "0.53524715", "0.5334794", "0.5324197", "0.53020674", "0.52...
0.71567464
0
Baseline implementation for the list_device_config_versions REST call
def list_device_config_versions request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_device_config_versions_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::ListDeviceConfigVersionsResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fetch_versions\n http_get(\"#{host}/#{Configuration.versions_file}\").body\n end", "def versions\n service_config.keys\n end", "def versions\n JSON.parse(RestClient.get(\"#{VERSION_URL}/.json\", self.default_headers))[\"versions\"].collect { |v| v[\"id\"] }.uniq\n end", "def versi...
[ "0.6457863", "0.64567167", "0.63657725", "0.6311317", "0.6234896", "0.6084378", "0.6006962", "0.59808946", "0.5979559", "0.595399", "0.59407306", "0.59115654", "0.58932126", "0.5888292", "0.58559114", "0.58157194", "0.5809579", "0.58024323", "0.5792559", "0.57822347", "0.5772...
0.7709235
0
Baseline implementation for the list_device_states REST call
def list_device_states request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_list_device_states_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::ListDeviceStatesResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def device_states_list\n get \"deviceStates\"\n end", "def device_states_get(device_name)\n get \"deviceStates/#{device_name}\"\n end", "def get_states\n perform(:get, 'enum/states', nil, nonauth_headers).body\n end", "def device_states=(value)\n @device_states = value\...
[ "0.84070873", "0.71763724", "0.71014345", "0.7092896", "0.6907781", "0.6382492", "0.6299889", "0.60669214", "0.60669214", "0.6060274", "0.6016376", "0.5996348", "0.58977956", "0.5868375", "0.5862362", "0.5826167", "0.5825951", "0.58122855", "0.5782019", "0.57624483", "0.57489...
0.7230817
1
Baseline implementation for the set_iam_policy REST call
def set_iam_policy request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_set_iam_policy_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_iam_policy request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, _query_string_params = transcode_set_iam_policy_request request_pb\n response = @client_stub.make_post_request(\n uri: ...
[ "0.73515016", "0.73350567", "0.6489853", "0.6337034", "0.6288687", "0.62879145", "0.6186744", "0.61719", "0.61613643", "0.61386836", "0.61386836", "0.61386836", "0.61386836", "0.6126765", "0.6117474", "0.60144264", "0.5993755", "0.594115", "0.59206474", "0.59202284", "0.58686...
0.72337353
4
Baseline implementation for the get_iam_policy REST call
def get_iam_policy request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_get_iam_policy_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Iam::V1::Policy.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_iam_policy request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_get_iam_policy_request request_pb\n response = @client_stub.make_get_request(\n uri: ...
[ "0.7179648", "0.7041259", "0.6849178", "0.6636959", "0.6161805", "0.6160939", "0.6151644", "0.60975635", "0.6084114", "0.6078038", "0.6073283", "0.6056764", "0.60269094", "0.60200477", "0.60021526", "0.59973663", "0.59821934", "0.58614767", "0.58421403", "0.582436", "0.581778...
0.6943633
5
Baseline implementation for the test_iam_permissions REST call
def test_iam_permissions request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_test_iam_permissions_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Iam::V1::TestIamPermissionsResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def test_iam_permissions *permissions\n ensure_service!\n grpc = service.test_table_permissions instance_id, name, permissions.flatten\n grpc.permissions.to_a\n end", "def test_permissions *permissions\n permissions = Array(permissions).flatten\n permissions = ...
[ "0.77584827", "0.7571176", "0.74744654", "0.74605376", "0.7222943", "0.72213197", "0.7122959", "0.68318284", "0.6755011", "0.6707382", "0.6495402", "0.6258991", "0.62329686", "0.6212032", "0.61627346", "0.6146438", "0.60971093", "0.60104674", "0.6003622", "0.59420025", "0.593...
0.7303708
7
Baseline implementation for the send_command_to_device REST call
def send_command_to_device request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_send_command_to_device_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::SendCommandToDeviceResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send command\n raise Error.new('implement me via subclass')\n end", "def send_command_old(*args)\n # flatten the args, make sure each byte is between 0-0xFF, and send it.\n command_str = \"char-write-cmd 0x001b \" + args.flatten.map {|b| sprintf(\"%02X\", b & 0xFF)}.join\n # puts command_str...
[ "0.6634094", "0.66100866", "0.6499423", "0.6493932", "0.6484907", "0.64073056", "0.6402479", "0.6402184", "0.63448644", "0.6315867", "0.6311386", "0.6297668", "0.6290541", "0.6260072", "0.6249201", "0.62179613", "0.6203289", "0.62021494", "0.61958766", "0.61686414", "0.616793...
0.7165435
0
Baseline implementation for the bind_device_to_gateway REST call
def bind_device_to_gateway request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_bind_device_to_gateway_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::BindDeviceToGatewayResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def bind_m_f_a_device(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'BindMFADevice'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'...
[ "0.58107615", "0.561477", "0.55363345", "0.5459145", "0.5459145", "0.5459145", "0.5459145", "0.54244465", "0.5369707", "0.53547305", "0.53489894", "0.53449863", "0.533122", "0.52646595", "0.5228263", "0.5228263", "0.51684374", "0.5138289", "0.5137244", "0.51328415", "0.512777...
0.751215
0
Baseline implementation for the unbind_device_from_gateway REST call
def unbind_device_from_gateway request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? verb, uri, query_string_params, body = ServiceStub.transcode_unbind_device_from_gateway_request request_pb query_string_params = if query_string_params.any? query_string_params.to_h { |p| p.split "=", 2 } else {} end response = @client_stub.make_http_request( verb, uri: uri, body: body || "", params: query_string_params, options: options ) operation = ::Gapic::Rest::TransportOperation.new response result = ::Google::Cloud::Iot::V1::UnbindDeviceFromGatewayResponse.decode_json response.body, ignore_unknown_fields: true yield result, operation if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def unbind\n @gateway_handler.disconnect(self)\n end", "def unbind_m_f_a_device(optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'UnbindMFADevice'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'https'\n\t\tif optional.key? :_method\n\t\t\...
[ "0.7488919", "0.68790984", "0.6549522", "0.6503967", "0.63586783", "0.63355607", "0.6286007", "0.6215152", "0.61849654", "0.61678743", "0.61363894", "0.6133773", "0.6084829", "0.6065382", "0.6036824", "0.6015723", "0.596348", "0.5946149", "0.59461266", "0.59404343", "0.591475...
0.800281
0
Register this field with the class, overriding a previous one if needed.
def add_field(field_defn, method_conflict_warning: field_defn.method_conflict_warning?) # Check that `field_defn.original_name` equals `resolver_method` and `method_sym` -- # that shows that no override value was given manually. if method_conflict_warning && CONFLICT_FIELD_NAMES.include?(field_defn.resolver_method) && field_defn.original_name == field_defn.resolver_method && field_defn.original_name == field_defn.method_sym && field_defn.hash_key == NOT_CONFIGURED && field_defn.dig_keys.nil? warn(conflict_field_name_warning(field_defn)) end prev_defn = own_fields[field_defn.name] case prev_defn when nil own_fields[field_defn.name] = field_defn when Array prev_defn << field_defn when GraphQL::Schema::Field own_fields[field_defn.name] = [prev_defn, field_defn] else raise "Invariant: unexpected previous field definition for #{field_defn.name.inspect}: #{prev_defn.inspect}" end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_field(field)\n\t\tend", "def configure_field\n end", "def initialize_field(key)\n class_name = model_class.properties[key.to_s].try(:class_name)\n return super unless class_name\n\n self[key] += [class_name.new]\n end", "def configure_field\n end", "def set_field(f...
[ "0.61195433", "0.609602", "0.60847735", "0.60718596", "0.5914307", "0.58922094", "0.58770365", "0.5856423", "0.58501124", "0.5825592", "0.5774278", "0.56767845", "0.56593806", "0.5653252", "0.5648738", "0.563118", "0.56216407", "0.56047237", "0.5590034", "0.55483216", "0.5538...
0.5672171
12
If `type` is an interface, and `self` has a type membership for `type`, then make sure it's visible.
def visible_interface_implementation?(type, context, warden) if type.respond_to?(:kind) && type.kind.interface? implements_this_interface = false implementation_is_visible = false warden.interface_type_memberships(self, context).each do |tm| if tm.abstract_type == type implements_this_interface ||= true if warden.visible_type_membership?(tm, context) implementation_is_visible = true break end end end # It's possible this interface came by way of `include` in another interface which this # object type _does_ implement, and that's ok implements_this_interface ? implementation_is_visible : true else # If there's no implementation, then we're looking at Ruby-style inheritance instead true end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def check_type\n \t self.type = TYPES[0] if !TYPES.include?(self.type)\n\t end", "def applies_type?(scope, type); end", "def will_be?(type)\n single_class <= type\n end", "def type?(type)\n\t\treturn self.type == type\n\tend", "def type?(type)\n\t\treturn self.type == type\n\tend", "def has_ty...
[ "0.58582586", "0.57667893", "0.57647943", "0.57389575", "0.57389575", "0.5654344", "0.56332684", "0.55245245", "0.55170536", "0.5486915", "0.54701686", "0.5402161", "0.5233993", "0.5222909", "0.52178586", "0.52141565", "0.5200213", "0.51834226", "0.515426", "0.51444966", "0.5...
0.6797543
0
Default method, subclasses must override this
def run super entity_name = _get_entity_name entity_type = _get_entity_type_string # Make sure the key is set api_key = _get_task_config("spyse_api_key") # Set the headers headers = {"api_token" => api_key} # Returns aggregate information by subdomain word : total count of subdomains, list of IPs of subdomains and subdomain count on every IP, # list of countries and subdomain count from it, list of CIDRs /24, /16 and subdomain list on every CIDR. if entity_type == "String" url = "https://api.spyse.com/v1/domains-starts-with-aggregate?sdword=#{entity_name}" get_subdomains entity_name, api_key, headers, url # Returns aggregate information by domain: total count of subdomains, list of IPs of subdomains and subdomain count on every IP, # list of countries and subdomain count from it, list of CIDRs /24, /16 and subdomain list on every CIDR. elsif entity_type == "Domain" url = "https://api.spyse.com/v1//subdomains-aggregate?domain=#{entity_name}" get_subdomains entity_name, api_key, headers, url else _log_error "Unsupported entity type" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def overrides; end", "def custom; end", "def custom; end", "def default; end", "def default; end", "def private; end", "def special\n override\n end", "def defaults\n super\n end", "def implementation; end", "def implementation; end", "def default\n end", "def defaults; end", ...
[ "0.7415135", "0.73552763", "0.73552763", "0.69906104", "0.69906104", "0.69614184", "0.6957141", "0.68249804", "0.6801128", "0.6801128", "0.67357564", "0.66936326", "0.66936326", "0.66936326", "0.66936326", "0.66936326", "0.66936326", "0.66936326", "0.66936326", "0.66936326", ...
0.0
-1
end run Returns aggregate information by subdomain word and domain
def get_subdomains entity_name, api_key, headers, url response = http_get_body(url,nil,headers) json = JSON.parse(response) #check if entries different to null if json["count"] != 0 # Create subdomains json["cidr"]["cidr16"]["results"].each do |e| e["data"]["domains"].each do |s| _create_entity("DnsRecord", "name" => s) end end # Create subdomains json["cidr"]["cidr24"]["results"].each do |e| e["data"]["domains"].each do |s| _create_entity("DnsRecord", "name" => s) end end # Create list of related organizations json["data"]["as"]["results"].each do |e| _create_entity("Organization", "name" => e["entity"]["organization"]) end # Create list of related countrys json["data"]["country"]["results"].each do |e| _create_entity("PhysicalLocation", "name" => e["entity"]["value"]) end # Create list of related IPs json["data"]["ip"]["results"].each do |e| _create_entity("IpAddress", "name" => e["entity"]["value"]) end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def publications_by_subdomain(subdomain)\n rvalue = []\n\n (ActiveFedora::SolrService.query(\"+press_sim:#{subdomain} AND +visibility_ssi:open\", rows: 100_000, sort: \"date_modified_dtsi desc\") || []).each do |solr_doc|\n sm = ::Sighrax.from_solr_document(solr_doc)\n ...
[ "0.6668927", "0.66360015", "0.6509577", "0.650161", "0.6465895", "0.6358833", "0.63268876", "0.61990005", "0.6142464", "0.60701275", "0.60457", "0.60061634", "0.5960041", "0.59470063", "0.59470063", "0.59470063", "0.59470063", "0.59227204", "0.5916619", "0.5898594", "0.588241...
0.6273273
7
For each letter in the string, advance one letter forward and return the output (add one to the index).
def encrypt(string) new_string="" idx=0 while idx < string.length new_string << string[idx].next unless if string[idx] == "z" string[idx] = "a" new_string << string[idx] end idx+=1 end new_string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def next_letters(string)\r\n\r\n string = swap_names(string)\r\n \r\n letters = string.split(\"\")\r\n \r\n \r\n next_letters = letters.map! do |letter|\r\n next_vowel?(letter)\r\n end\r\n \r\n next_letters.join(\"\")\r\n \r\n \r\nend", "def increment_letter(letter)\n vowels = %w('a', 'e', 'i', 'o...
[ "0.7734827", "0.7429589", "0.7333033", "0.72979397", "0.72367954", "0.72025204", "0.71783173", "0.71258205", "0.71101886", "0.7090887", "0.70783603", "0.70662075", "0.7054454", "0.7031979", "0.70149297", "0.700426", "0.7002199", "0.6997224", "0.69680744", "0.6956497", "0.6941...
0.0
-1
Pseudocode Decrypt For each letter in the string, go back in the alphabet one letter (subtract one to the index).
def decrypt(string) idx = 0 alphabet = "abcdefghijklmnopqrstuvwxyz" while idx < string.length string[idx] = alphabet[alphabet.index(string[idx]) - 1] idx += 1 end string end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def decrypt(string)\n alphabet = (\"a\"..\"z\").to_a\n result = \"\"\n idx = string.length\n idx.times do |i|\n letter = string[i]\n\n if letter == \" \"\n result += \" \"\n else\n n = alphabet.index(letter)\n n_minus = (n - 1) % alphabet.length\n result += alphabet[n_minus]\n e...
[ "0.86573255", "0.85693634", "0.8425183", "0.8422532", "0.8361351", "0.8340958", "0.8337222", "0.83247256", "0.83069235", "0.8298669", "0.8292981", "0.82832867", "0.8260784", "0.8221807", "0.8219849", "0.8197005", "0.8173877", "0.8163505", "0.81621486", "0.81605583", "0.815925...
0.84838337
2
protected Checks whether it's a json format or not
def json_request? request.format.json? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_json(json)\n JSON(json)\n #NOTE: Rescuing TypeError too in case json is not a String\n rescue ::JSON::ParserError, TypeError\n nil\n end", "def json?\n true\n end", "def content_is_json?\n @content_type =~ /json$/i ? true : false\n end", "def j...
[ "0.7947242", "0.7818035", "0.7747321", "0.7711472", "0.76174307", "0.76007926", "0.75990003", "0.75990003", "0.759288", "0.75136685", "0.7510619", "0.7492625", "0.7492625", "0.74712574", "0.7450629", "0.7450035", "0.7450035", "0.74354887", "0.73972416", "0.7386472", "0.734124...
0.717378
32
GET /finger_prints GET /finger_prints.json
def index @finger_prints = FingerPrint.all respond_to do |format| format.html # index.html.erb format.json { render json: @finger_prints } format.csv { send_data FingerPrint.scoped.to_csv, filename: "fingerprints-#{Date.today}.csv"} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n #debugger\n @finger_print = FingerPrint.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @finger_print }\n end\n end", "def show\n @magnetic_finger_print = MagneticFingerPrint.find(params[:id])\n\n respond_to do |forma...
[ "0.70003617", "0.6442571", "0.62798816", "0.5989847", "0.5939047", "0.58718115", "0.56917995", "0.56889105", "0.56443363", "0.56184477", "0.54789317", "0.5418445", "0.5403665", "0.53857815", "0.5342019", "0.53330874", "0.5326029", "0.5318693", "0.5313361", "0.52723336", "0.52...
0.6855805
1
GET /finger_prints/1 GET /finger_prints/1.jsonl
def show #debugger @finger_print = FingerPrint.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @finger_print } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @finger_prints = FingerPrint.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @finger_prints }\n format.csv { send_data FingerPrint.scoped.to_csv, filename: \"fingerprints-#{Date.today}.csv\"}\n end\n end", "def show\n @magnetic_fi...
[ "0.6479714", "0.6391914", "0.6370339", "0.604717", "0.60026324", "0.588337", "0.5803498", "0.5600463", "0.55965716", "0.5577841", "0.55751806", "0.5539471", "0.55241925", "0.5510952", "0.5508203", "0.54869884", "0.5478965", "0.54719114", "0.54546636", "0.5420122", "0.5414768"...
0.6829708
0
GET /finger_prints/new GET /finger_prints/new.json
def new @finger_print = FingerPrint.new respond_to do |format| format.html # new.html.erb format.json { render json: @finger_print } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @printing_screen = PrintingScreen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @printing_screen }\n end\n end", "def new\n @sprint = Sprint.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render ...
[ "0.6946628", "0.6929953", "0.68610036", "0.6812665", "0.67136365", "0.66725713", "0.6641457", "0.6638654", "0.64757776", "0.64066136", "0.63722366", "0.63675994", "0.63521135", "0.6331472", "0.63280535", "0.625957", "0.62562996", "0.62520987", "0.62317044", "0.6231045", "0.62...
0.7873111
0
POST /finger_prints POST /finger_prints.json
def create @finger_print = FingerPrint.check_exist(params[:finger_print]) respond_to do |format| format.html { redirect_to @finger_print, notice: 'FingerPrint was successfully created.' } format.json { render json: @finger_print, status: :created, location: @finger_print } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @magnetic_finger_print = MagneticFingerPrint.new(params[:magnetic_finger_print])\n\n respond_to do |format|\n if @magnetic_finger_print.save\n format.html { redirect_to @magnetic_finger_print, notice: 'Magnetic finger print was successfully created.' }\n format.json { render j...
[ "0.63952565", "0.6353884", "0.6251653", "0.6163068", "0.60271955", "0.59848714", "0.5953886", "0.58710885", "0.58605963", "0.5827934", "0.5651706", "0.5637469", "0.5622873", "0.56122464", "0.55771923", "0.55719745", "0.55350626", "0.5448159", "0.54045486", "0.53290445", "0.53...
0.6608446
0
PUT /finger_prints/1 PUT /finger_prints/1.json
def update @finger_print = FingerPrint.find(params[:id]) respond_to do |format| if @finger_print.update_attributes(params[:finger_print]) format.html { redirect_to @finger_print, notice: 'Finger print was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @finger_print.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @magnetic_finger_print = MagneticFingerPrint.find(params[:id])\n\n respond_to do |format|\n if @magnetic_finger_print.update_attributes(params[:magnetic_finger_print])\n format.html { redirect_to @magnetic_finger_print, notice: 'Magnetic finger print was successfully updated.' }\n ...
[ "0.62285423", "0.60389096", "0.60265845", "0.5983842", "0.5958007", "0.5944725", "0.57651126", "0.5729494", "0.57281893", "0.57135636", "0.5680018", "0.5591839", "0.55909795", "0.55655414", "0.55199784", "0.551913", "0.54924124", "0.5482307", "0.54783326", "0.5477434", "0.547...
0.7068139
0
DELETE /finger_prints/1 DELETE /finger_prints/1.json
def destroy @finger_print = FingerPrint.find(params[:id]) @finger_print.destroy respond_to do |format| format.html { redirect_to finger_prints_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @magnetic_finger_print = MagneticFingerPrint.find(params[:id])\n @magnetic_finger_print.destroy\n\n respond_to do |format|\n format.html { redirect_to magnetic_finger_prints_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spore_print.destroy\n res...
[ "0.7033649", "0.6689001", "0.6592074", "0.6592074", "0.658346", "0.6577583", "0.6575321", "0.6560739", "0.6543123", "0.6476248", "0.6473159", "0.64669645", "0.64214", "0.6409763", "0.6405029", "0.6401641", "0.6401063", "0.6384437", "0.63783187", "0.63687044", "0.6363836", "...
0.7671966
0
responsible for handling the loc_page view
def loc_view end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page; end", "def page\n\n end", "def show_location\n\n end", "def set_page\n end", "def p...
[ "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.68470365", "0.6682881", "0.6648841", "0.66419846", "0.6637194", "0.64833814", "0.64787585", "0.6452935", "0.64244103", ...
0.78954995
0
Passes an array of fingerprint readings to the model to localize
def localization #debugger searched = params[:finger_print] @coordinates = FingerPrint.KNN(searched) puts @coordinates respond_to do |format| format.html format.json {render json: @coordinates} end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def locale_array=(locale_array)\n begin\n @locale_array = locale_array.map { |l| l.to_sym }\n rescue\n nil\n end\n end", "def locale_array=(locale_array)\n config.locale_array = locale_array\n end", "def upcase_local_patient_ids\n self.local_patient_id = local_patie...
[ "0.49208415", "0.48301882", "0.47375816", "0.47297955", "0.47097278", "0.4694174", "0.4694174", "0.4646421", "0.4609651", "0.45713994", "0.4568629", "0.45425078", "0.454169", "0.4532457", "0.45264092", "0.45204335", "0.45204335", "0.45204335", "0.45116416", "0.45100597", "0.4...
0.5311048
0
Magnetic variation in degrees
def magnetic_variation_degrees self.class.nsew_signed_float(@fields[10], @fields[11]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def magnetic_variation_degrees\n self.class.nsew_signed_float(@fields[4], @fields[5])\n end", "def magnetic_deviation_degrees\n self.class.nsew_signed_float(@fields[5], @fields[6])\n end", "def true_to_magnetic(heading)\r\n value = heading - @variance\r\n value += 360....
[ "0.7892756", "0.7360166", "0.72956914", "0.67894644", "0.66193265", "0.6564241", "0.6343376", "0.6274908", "0.6244177", "0.6169047", "0.6157117", "0.61421156", "0.61395437", "0.6133403", "0.61273795", "0.60327035", "0.6023581", "0.60170364", "0.6009613", "0.5999295", "0.59915...
0.79345196
0
Execute a request on a distant object
def new_brb_out_request(meth, *args, &blck) Thread.current[:brb_nb_out] ||= 0 Thread.current[:brb_nb_out] += 1 raise BrBCallbackWithBlockingMethodException.new if is_brb_request_blocking?(meth) and block_given? block = (is_brb_request_blocking?(meth) or block_given?) ? Thread.current.to_s.to_sym : nil if block args << block args << Thread.current[:brb_nb_out] end if block_given? # Simulate a method with _block in order to make BrB send the answer meth = "#{meth}_block".to_sym end args.size > 0 ? brb_send([MessageRequestCode, meth, args]) : brb_send([MessageRequestCode, meth]) if block_given? # Declare the callback declare_callback(block, Thread.current[:brb_nb_out], &blck) elsif block # Block until the request return #TimeMonitor.instance.watch_thread!(@timeout_rcv_value || 45) begin r = recv(block, Thread.current[:brb_nb_out], &blck) rescue Exception => e raise e ensure #TimeMonitor.instance.remove_thread! end if r.kind_of? Exception raise r end return r end nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def request url, klass, object\n url = URI url\n\n request = klass.new url.path\n\n if object\n request.body = object.to_xml\n end\n\n dispatch request, to: url\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def perf...
[ "0.707096", "0.6627264", "0.66057956", "0.658504", "0.65347606", "0.6525185", "0.6513853", "0.64792883", "0.64712304", "0.6462888", "0.6461716", "0.64348125", "0.6420879", "0.63778186", "0.6320396", "0.6300052", "0.6295686", "0.62199074", "0.62175536", "0.6212323", "0.6203698...
0.0
-1
Execute a request on the local object
def new_brb_in_request(meth, *args) if is_brb_request_blocking?(meth) m = meth.to_s m = m[0, m.size - 6].to_sym idrequest = args.pop thread = args.pop begin r = ((args.size > 0) ? @object.send(m, *args) : @object.send(m)) brb_send([ReturnCode, r, thread, idrequest]) rescue Exception => e brb_send([ReturnCode, e, thread, idrequest]) BrB.logger.error e.to_s BrB.logger.error e.backtrace.join("\n") #raise e end else begin (args.size > 0) ? @object.send(meth, *args) : @object.send(meth) rescue Exception => e BrB.logger.error "#{e.to_s} => By calling #{meth} on #{@object.class} with args : #{args.inspect}" BrB.logger.error e.backtrace.join("\n") raise e end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def run\n make_request(@path)\n end", "def call(env)\n self.class.perform_request env\n end", "def execute!\n validate_request!\n perform_request!\n\n build_response\n end", "def request(*args, &block); end", "def request(*args)\n Request.new(self).request(*args)\n end...
[ "0.67466414", "0.6577798", "0.65440667", "0.65379703", "0.65225893", "0.6522001", "0.64389837", "0.64328", "0.64214367", "0.6402137", "0.6362606", "0.63419944", "0.6338101", "0.6307461", "0.6297941", "0.6264492", "0.6225674", "0.6215193", "0.6168293", "0.614809", "0.61402804"...
0.0
-1
===================== Complex validations: =====================
def validate # first check whether combo fields have been selected is_valid = true if is_valid is_valid = ModelHelper::Validations.validate_combos([{:qc_test_id => self.qc_test_id}],self) end # #now check whether fk combos combine to form valid foreign keys # if is_valid # is_valid = set_qc_test # end # if is_valid # is_valid = ModelHelper::Validations.validate_combos([{:qc_inspection_type_code => self.qc_inspection_type_code}],self) # end # #now check whether fk combos combine to form valid foreign keys # if is_valid # is_valid = set_qc_inspection_type # end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def validation; end", "def validation; end", "def is_valid; end", "def validate\n \n \n end", "def valid?(_) true end", "def valid?(_) true end", "def validate; end", "def validate; end", "def validate; end", "def validate; end", "def valid?\n \n \n \n \n \n \n ...
[ "0.7435418", "0.7435418", "0.7371372", "0.73529345", "0.73466796", "0.73466796", "0.73167086", "0.73167086", "0.73167086", "0.73167086", "0.7314407", "0.7277813", "0.72398275", "0.7219688", "0.72083765", "0.71629184", "0.71590775", "0.71590775", "0.71233153", "0.7086428", "0....
0.0
-1
POST /user POST /user.json
def create @user = User.where(uuid: user_params[:uuid]).first_or_initialize @user.update user_params if @user.save render action: 'show', status: :ok, location: @user else render json: @user.errors, status: :unprocessable_entity end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.sa...
[ "0.74958384", "0.74958384", "0.7493669", "0.7461458", "0.7448467", "0.744005", "0.7432512", "0.7432512", "0.7432512", "0.7399874", "0.7377769", "0.7377463", "0.7368083", "0.7368083", "0.7349678", "0.73458093", "0.7344565", "0.7342582", "0.7334526", "0.73287", "0.73264", "0....
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy @user = User.find(params[:user_uuid]) @user.destroy head :ok end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\...
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935"...
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def user_params params.require(:user).permit(:uuid, :gcm_id, :name, :latitude, :longitude) 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
=END !Router! =BEGIN !Convertor!
def master_info( code ) { :bool => true, :code => code } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def router; end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def routes=(_arg0); end", "def router=(_arg0); end", "def routes_map; end", "def _routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def routes; end", "def r...
[ "0.6859182", "0.66982645", "0.66982645", "0.66982645", "0.664582", "0.6322484", "0.628017", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.62008744", "0.61852676", "0.6127279", "0....
0.0
-1
the form should be SETTINGS := SETTING[;...SETTING] SETTING := ATOM || ATOM(ATTR=VAL,...)
def parse_service_settings(settings) settings && settings.split(';').map{|setting|ServiceSetting.parse(setting)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def settings=(_arg0); end", "def settings=(_arg0); end", "def settings=(setting_options = [])\n # for arrays, set in raw form \n @settings = if setting_options.is_a?(Array)\n setting_options\n # set optional shortcuts for settings\n # :keyword_match_setting => { :opt_in => false } # ...
[ "0.63856685", "0.63856685", "0.613985", "0.59483856", "0.5858644", "0.5617598", "0.5573659", "0.5478118", "0.5444805", "0.5366784", "0.53519696", "0.5293961", "0.52886736", "0.5283204", "0.52572954", "0.5250583", "0.52334154", "0.5232165", "0.522362", "0.5205263", "0.52018964...
0.5464295
8
Disable SQL logging. You can use this method to turn off logging SQL when the migration is munging data that may vary between environments.
def disable_sql_logging(&block) sql_logging(enabled: false, &block) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 1\nend", "def enable_activerecord_sql_logging\n ActiveRecord::Base.logger.level = 0\nend", "def disable_verbose_log()\n PureHailDB.ib_cfg_set(\"print_verbose_log\", :bool, false)\n end", "def disable_logging\n @session.co...
[ "0.7638811", "0.73547393", "0.7012727", "0.69116277", "0.6882021", "0.6860995", "0.6671341", "0.6474205", "0.645211", "0.6391882", "0.6294125", "0.62443805", "0.62040585", "0.62040585", "0.607154", "0.6011172", "0.5978407", "0.5954865", "0.594431", "0.5910163", "0.59079236", ...
0.8257666
0