query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
42cb84c79ef711724d4346b58e8e3bff
GET /sounds/new GET /sounds/new.json
[ { "docid": "42143c8ebdc8c523113f785f0eb135d3", "score": "0.0", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @user }\n end\n end", "title": "" } ]
[ { "docid": "723dd2e365dc9c8fc9b30a50e949cd2f", "score": "0.83050597", "text": "def new\n add_breadcrumb I18n.t(\"sound.plural\"), :sounds_path\n\n @sound = Sound.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sound }\n end\n end", "ti...
2f4e274e9482ba461c9812b36e129781
Adds member and triggers the optout workflow. Use when you want to send a confirmation email.
[ { "docid": "34e64460ab147af45e56128f3447e9ac", "score": "0.5240487", "text": "def add_member_signup(params = {})\n post(\"/members/signup\", params)\n end", "title": "" } ]
[ { "docid": "009110ca300e1163a9d8a862d94df5b1", "score": "0.65267456", "text": "def add_member(member, options = {})\n role.grant_to member, options\n end", "title": "" }, { "docid": "e5711c1cbdb8513e833033712323f7f9", "score": "0.62482905", "text": "def add_member(member)\n ...
f5d2d2f2620d4b4e1ebabaa0e8d16be7
We don't data migrations being created without authoring information.
[ { "docid": "893e00a3118cdb8860366bd47362afc5", "score": "0.55632824", "text": "def authoring_information_present?\n self.class.migration_information[:author_email].present? and\n ValidateEmail.valid?(self.class.migration_information[:author_email]) and\n self.class.migration_informati...
[ { "docid": "f7fdc1be007f1f93d46212ae9c89ca99", "score": "0.64638263", "text": "def change\n # data migration only, dont run on init\n\n end", "title": "" }, { "docid": "f82c8cbd18b505e9ed852f3affeccc95", "score": "0.63688385", "text": "def before_migration\n\t\t\treturn true\n\t\...
c709f28e06b119c355311dc34c383a7b
Performs SHA256 hashes for input
[ { "docid": "07d7f40742c486a3de7d7e60e8119ac5", "score": "0.0", "text": "def hasher(cancellation)\n lambda do |(tick, chunk)|\n next puts('hasher interrupted') if cancellation.cancelled?\n\n digest = Digest::SHA256.hexdigest(chunk).tap { sleep 0.1 }\n [tick, digest]\n end\nend", "title": "...
[ { "docid": "a56f30612df71b171fbfbd42eb41b07c", "score": "0.81865287", "text": "def hash_sha256(input)\n Digest::SHA2.new(256).digest(input)\n end", "title": "" }, { "docid": "982f629f0be1a5c93e6762d3ddcb29b7", "score": "0.7838724", "text": "def do_hash(input)\n a = Ope...
d984a6c21e76ade1afd0220a984697a3
GET /device_interests GET /device_interests.json
[ { "docid": "2d23fb00fb78c4b1a65adb44b4c0cdd9", "score": "0.7209084", "text": "def index\n @device_interests = DeviceInterest.all\n end", "title": "" } ]
[ { "docid": "7a1822a2fc686c92347098a73605b996", "score": "0.6991785", "text": "def interests\n user_uid = params[:id]\n if !User.find_by_uid(user_uid)\n render :json => {\n \"success\" => false,\n \"message\" => \"User Not Found\"\n }\n ...
536efe9290c81cb6f5dfc3508098c2ed
GET /machine_locations/1 GET /machine_locations/1.xml
[ { "docid": "3f01f40c7c54370e7e8f715387ff57df", "score": "0.71479934", "text": "def show\n @machine_location = MachineLocation.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @machine_location }\n end\n end", "title": "" ...
[ { "docid": "805e5b54273bb44407911c3295be9010", "score": "0.6533113", "text": "def list_locations\n headers = default_headers\n headers['Accept'] = 'text/xml'\t# JSON locations not supported\n Nokogiri.XML(get('/locations', headers))\n end", "title": "" }, { "docid": "83bb45ac8ed88e...
e424523024172592a22adac6d2bf8e81
GET /panel/clients/1 GET /panel/clients/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "674af6bcc13e19daf685f2dc8677a5b4", "score": "0.7440651", "text": "def index\n @panel_clients = Panel::Client.all\n @panel_client = Panel::Client.new\n end", "title": "" }, { "docid": "11367d36e4c90c8a0de89176b3b870a4", "score": "0.7321506", "text": "def index\n ...
68f6dd88ac80dc483626e8f4434d46e9
Some basic window behavior
[ { "docid": "68beab98145b8b5ecbdbf196f438d727", "score": "0.0", "text": "def reshape(w, h)\n\t\tGL.Viewport(0, 0, w, h)\n\t\tGL.MatrixMode(GL::PROJECTION)\n\t\tGL.LoadIdentity()\n\t\tGL.Ortho(-$WIDTH, $WIDTH, -$HEIGHT, $HEIGHT, -1.0, 1.0)\n\t\tGL.MatrixMode(GL::MODELVIEW)\n\t\t\n\t\t#GLU.LookAt(-5.0, -5....
[ { "docid": "233691e280f06ab3c2c87d10926c1b89", "score": "0.7590522", "text": "def main_window ; end", "title": "" }, { "docid": "54d0df1e7d93c567f1e8c382053fb35c", "score": "0.7565659", "text": "def windows; end", "title": "" }, { "docid": "54d0df1e7d93c567f1e8c382053...
3f7ab1524223c8008c358ed01cd8b553
Terminates current user session (Sign Out)
[ { "docid": "6ca1bb14d5cd924124005b7f1b585deb", "score": "0.0", "text": "def destroy\n sign_out\n redirect_to root_path\n end", "title": "" } ]
[ { "docid": "ff0771cbf1ce8626c189079f380b0adc", "score": "0.8533971", "text": "def sign_out\n session.delete :user_id\n @current_user = nil\n end", "title": "" }, { "docid": "a717698de2eb1d3dd6c10145cfee94e6", "score": "0.85309815", "text": "def sign_out\n session.dele...
3904ce8f8608154cc16e58e867959a8d
Fetch client from memcache once Author: Aman Date: 25/01/2019 Reviewed By:
[ { "docid": "cc7c3b90878be81cbc0acbe876e7fa3e", "score": "0.72806823", "text": "def fetch_client(client_id)\n c = nil\n\n if @all_clients[client_id].present?\n c = @all_clients[client_id]\n else\n c = Client.get_from_memcache(client_id)\n @all_clients[client_id] = c\n ...
[ { "docid": "8193ed58910c597fcc8d55a3cd67fcd0", "score": "0.81352913", "text": "def fetch_client\n @client = Client.get_from_memcache(@client_id)\n end", "title": "" }, { "docid": "027052d386dc27ae20f00e2e523f5d2c", "score": "0.7550074", "text": "def fetch_client\n @c...
9e63caf020b9cb1444c226ba0a6bc2b9
Cancel a running event
[ { "docid": "56f705926141b1ffa01d812648e08913", "score": "0.6913054", "text": "def cancel\n state_change(:cancel) if transition.trigger?(:cancel)\n add_cancel_notifications\n run\n clear_state_notifications\n end", "title": "" } ]
[ { "docid": "8ddd3eb23b314fd2ef1c7baabaa21652", "score": "0.76973283", "text": "def cancel\n return unless @running\n @running = false\n end", "title": "" }, { "docid": "608f0e5d8955e3970a4f3222fd4df8e5", "score": "0.7640563", "text": "def cancel_event(msg = nil)\n ...
3b2c949e084d8fa0c210affcea7aa612
=> id of jenkins container
[ { "docid": "da32752466f603a8d3b242e92a4655da", "score": "0.7621496", "text": "def jenkins_id(opts)\n\tres = run_in_shell \"docker ps -aqf \\\"name=#{opts[:name]}\\\"\", true\n\tres.gsub( /\\n/, '' )\nend", "title": "" } ]
[ { "docid": "cff411c3afbced53ab4a1fd3b2f78083", "score": "0.7319733", "text": "def id\n container.id\n end", "title": "" }, { "docid": "22dce10cf7193b77da83cb2c679cba72", "score": "0.71292305", "text": "def container_id\n @container_info[\"Id\"]\n end", "title"...
6c442b72bc9aac711f5d0f1e32628bf5
PATCH/PUT /paises/1 PATCH/PUT /paises/1.json
[ { "docid": "e2f4dc32e50c37d0545e8d1acb2acb79", "score": "0.6717427", "text": "def update\n respond_to do |format|\n if @pais.update(pais_params)\n format.html { redirect_to paises_url }\n format.json { render :show, status: :ok, location: @pais }\n else\n format.html {...
[ { "docid": "23938c68ef9abf0f7f952b2be1a5b0e8", "score": "0.67975044", "text": "def update\n @pelicula = Pelicula.find(params[:id])\n @pelicula.update(update_params)\n render json: @pelicula, status: :ok\n end", "title": "" }, { "docid": "082e164fc33f65e5994ae620433bd774", "scor...
80ce64721a3d6485020f8ff62e08cbc4
def allow_iframe_requests response.headers.delete('XFrameOptions') end GET /alumnis GET /alumnis.json GET /alumnis/1 GET /alumnis/1.json
[ { "docid": "e85cf6ec404258c20b1104be4c99a429", "score": "0.0", "text": "def show\n @alumni = Alumni.find_by(id: params[:id])\n if @alumni.view\n @alumni.view += 1\n else\n @alumni.view = 1\n end\n @alumni.save\n end", "title": "" } ]
[ { "docid": "a1fbc501fe8afd9a6209364a0c70907e", "score": "0.69046724", "text": "def allow_iframe_requests\n response.headers.delete('X-Frame-Options')\n end", "title": "" }, { "docid": "a19f68c2ff74daa3a44ccd4d5126c5b2", "score": "0.6903379", "text": "def allow_iframe\n respons...
acad99e29faee36f2f88108224201f3a
Apply change for one group object
[ { "docid": "b5a77dc26f23c7eae0be3c598be515f2", "score": "0.0", "text": "def update\n respond_to do |format|\n if @group.update(group_params)\n format.json { head :no_content }\n else\n format.json { render json: @group.errors, status: :unprocessable_entity ...
[ { "docid": "dbd85c6cbe61cb923517842fb361d00a", "score": "0.6538835", "text": "def update_group(increment)\n end", "title": "" }, { "docid": "a000141a87cb02fd8ea5660c695c2e0f", "score": "0.64935243", "text": "def set_group_belonging\n #group_number = self.id % 4\n #self.update_...
93364f8ee4de228026e29e081ae69a16
Get Opening from moves (as symbols or strings)
[ { "docid": "22efcd96a4f2098519eb0a0db24d2c6e", "score": "0.5067888", "text": "def from_moves(moves)\n @tree.search moves\n end", "title": "" } ]
[ { "docid": "e09450a94dd718e2441df00d9b1c87cb", "score": "0.6136189", "text": "def get_opening\n if params[:moves]\n render json: {\n opening: EcoClassifier.classify_moves(params[:moves]).as_json\n }\n else\n render json: {}\n end\n end", "title": "" }, { "doci...
5b448bb273bcf812efdf7bbf2b62f019
Finds the appropriate Provider for this url and returns an OEmbed::Response, using Providerget.
[ { "docid": "5f043f05aea0b3d3cf376010c44f5f93", "score": "0.7172481", "text": "def get(url, options = {})\n provider = find(url)\n if provider\n provider.get(url, options)\n else\n fallback.each do |p|\n return p.get(url, options) rescue OEmbed::Error\n ...
[ { "docid": "901d330d2d4c26bd5391e42ea46fd060", "score": "0.62118083", "text": "def url_to_html\n # Registering Providers - Youtube and Instagram\n OEmbed::Providers.register(OEmbed::Providers::Youtube, OEmbed::Providers::Instagram)\n resource = OEmbed::Providers.get(params[:url])\n respond_t...
f29050e049fa476ed35d8ead3aa6b19e
GET /necesidades GET /necesidades.json
[ { "docid": "e68acaae7063c56f7c1d0adc790516e4", "score": "0.6142018", "text": "def index\n\t\tauthorize! :index, Necesidad\n #@necesidades = Necesidad.all\n @necesidades = Necesidad.page(params[:page]).search query: params[:q]\n end", "title": "" } ]
[ { "docid": "45e2f3402418b5a77093c8ef9dbe94e6", "score": "0.6766087", "text": "def lista\n @entidades = Entidade.select(\"entidade, slug, latitude, longitude, telecentro, id\").where(\"#{params[:tipo]} = true\")\n\n respond_to do |format|\n format.json { render json: @entidades }\n end\n e...
1520af6677eabb3e5365df01de4f6637
called after every single test
[ { "docid": "884336866087527c10063a6dbcfd311b", "score": "0.0", "text": "def teardown\n\t\t@invoice = nil\n\tend", "title": "" } ]
[ { "docid": "4c19dfa9f5fd3f7e08fe8999045be7d0", "score": "0.8837899", "text": "def after_test(_test); end", "title": "" }, { "docid": "4c19dfa9f5fd3f7e08fe8999045be7d0", "score": "0.8837899", "text": "def after_test(_test); end", "title": "" }, { "docid": "4c19dfa9f5fd3f7e...
4963338a348bd1c3c4a14dbb717fe627
RTesseract => Gem (biblioteca) responsavel por wrapping do tesseract com imagemagick
[ { "docid": "ecc883e97c2ecc7b85814f0f5d0f90cd", "score": "0.774847", "text": "def retornoImagem(registro)\n\t@img = RTesseract.new(registro, {processor: \"mini_magick\", psm: 9, lang: \"eng\" } )\nend", "title": "" } ]
[ { "docid": "b9194c3a1b4057a1017ec661d3755766", "score": "0.7353144", "text": "def ocr(image)\n image.save_image('test.png')\n tesse = Tesseract::Engine.new {|e|\n e.language = :eng\n e.page_segmentation_mode = 10\n e.whitelist = '0123456789'\n }\n return tesse.text_for('test.png').strip()\nend", ...
543d5d25b24453751438d5b5d8800f0d
POST select a particular ticket
[ { "docid": "4b0709fdf1876a7581f2e70f27686ac0", "score": "0.0", "text": "def select_flight\n @flight = FlightInformation.find(params[:id])\n @current_employee = current_user.employee\n token = @current_employee.create_token\n @transact = @current_employee.create_transaction(token.id, @flight)...
[ { "docid": "90bee53eb6f3bb29dce7e66c52353134", "score": "0.6831277", "text": "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "title": "" }, { "docid": "90bee53eb6f3bb29dce7e66c52353134", "score": "0.6831277", "text": "def set_ticket\n @ticket = Ticket.find(params[...
7789057a00d49928ac0183f62ce56e24
PUT /zgloszenias/1 PUT /zgloszenias/1.xml
[ { "docid": "c4d2a00e2e59ce37556d9e1dee729943", "score": "0.60969526", "text": "def update\n @zgloszenia = Zgloszenia.find(params[:id])\n\n respond_to do |format|\n if @zgloszenia.update_attributes(params[:zgloszenia])\n format.html { redirect_to(@zgloszenia, :notice => 'Zgłoszenie zost...
[ { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.69034046", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "7dcf61d28367255f0ec9cea7ade341d...
f3c4db29dda8681226decc0f262cab77
enabled? Query whether Gem is enabled.
[ { "docid": "45b71ec4803c30b3daa6eabaa1936dbe", "score": "0.7551681", "text": "def enabled?\n \n return @enabled\n \n end", "title": "" } ]
[ { "docid": "3d614a5e1a7bbd84563282196bf2d7ea", "score": "0.7724444", "text": "def enabled?\n return enabled\n end", "title": "" }, { "docid": "45d7f1075d83e5e04d1911b0b21e187c", "score": "0.7527964", "text": "def enabled?\n\n return @enabled\n\n end", "title": "" }, {...
66725c637c7d1f9252e0cad52c9d3893
I worked on this challenge [with: Sabri Helal] I spent [1.25] hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? An array, and an integer or string What ...
[ { "docid": "8057b2a007203349412213e8f516738a", "score": "0.0", "text": "def pad!(array, min_size, value = nil) #destructive\n if array.length >= min_size\n return array\n else\n while array.length < min_size\n array << value\n end\n end\n array\nend", "title": "" } ]
[ { "docid": "55b0f3f094dc759ebf27605653747dc3", "score": "0.6787475", "text": "def array_translate(array)\n new_arr = []\n\n array.each_with_index do |ele, i|\n num = array[i + 1]\n num.to_i.times { new_arr << array[i] }\n end\n\n return new_arr.join(\"\").to_s\nend", "title": "" }, { ...
0a15e0276386fd7bd97c1e9569aa4db0
GET /nodes/new GET /nodes/new.xml
[ { "docid": "1c2de6828c579c047c05869c7ab9590a", "score": "0.7245461", "text": "def new\n @node = @job.nodes.build \n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n format.json { render :json => @node } \n end\n end", "...
[ { "docid": "32d23e457194194ed523de156ee89693", "score": "0.77779174", "text": "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "title": "" }, { "docid": "a090ddaf839578568ed168...
273ee9b5da67d62b13f2c1b685b8cba5
Entry point for the Girard poller
[ { "docid": "2886c82ab19a649a2948ac46b16d1043", "score": "0.5613123", "text": "def main()\n # check for proper usage\n host = ARGV[0] || ENV[\"HOST\"]\n port = (ARGV[1] || ENV[\"PORT\"]).to_i()\n seed = (ENV[\"SEED\"] || Random.new_seed()).to_i()\n Random.srand(seed)\n length = (ENV[\"L...
[ { "docid": "99660f47fff69b66af1876aa4b070b3a", "score": "0.6063783", "text": "def poll\n \tend", "title": "" }, { "docid": "33972aeeae25610b06dfd91ec17a685c", "score": "0.5904217", "text": "def run\n @running = true\n while @running\n poll\n end\n ...
ae8f9bef0913941ba67784dbf29fe73b
A method we're giving you. This "flattens" Arrays of Arrays so: [[1,2], [3,4,5], [6]] => [1,2,3,4,5,6].
[ { "docid": "ceaaad85fdba96b54ea36c2860ec6584", "score": "0.0", "text": "def flatten_a_o_a(aoa)\n result = []\n i = 0\n\n while i < aoa.length do\n k = 0\n while k < aoa[i].length do\n result << aoa[i][k]\n k += 1\n end\n i += 1\n end\n\n result\nend", "title": "" } ]
[ { "docid": "73a02dd2094c26c61a294b0c2ba932dd", "score": "0.8190562", "text": "def using_flatten(array_of_arrays)\n array_of_arrays.flatten \nend", "title": "" }, { "docid": "346a9c96c2781bfdf1f6bd9cd3ffede7", "score": "0.81878465", "text": "def using_flatten (arrays)\n arrays.f...
737784e7761649dace61dbce41149184
Returns a visited page for the +url+ passed in, otherwise nil
[ { "docid": "079f32a3344ac4fed16ccb8c8a671fda", "score": "0.7270232", "text": "def visited? url\n url = url.href if url.respond_to? :href\n\n @agent.visited_page url\n end", "title": "" } ]
[ { "docid": "8645afb332262105a6fe5c15b269e2c8", "score": "0.7606845", "text": "def visited_page(url); end", "title": "" }, { "docid": "8645afb332262105a6fe5c15b269e2c8", "score": "0.7606845", "text": "def visited_page(url); end", "title": "" }, { "docid": "cc2e2342e02b7453...
4159216267c90445644cd18fbd1da566
Filter an array to return only unseen links. all_urls Array of String URLs. Checks to see if each URL has already been seen for this Analytics profile. Returns an Array of new links only.
[ { "docid": "de05f137c2e426ca6aafea2b8676511c", "score": "0.692844", "text": "def determine_new_links(all_urls)\n all_urls.select {|url| url_exists?(url) == false }\n end", "title": "" } ]
[ { "docid": "6656ec14a1188c2e72cf122b9cdebd95", "score": "0.6039107", "text": "def get_all_new_urls(results)\n all_urls = results.map { |result| result.absolute_linked_resources }.flatten\n all_urls.uniq!\n #TODO: handle any other url parsing error\n all_urls.delete_if { |url| !a_doma...
73ea20f59ba44128017a71dd8dd444bd
Define this method to silence deprecation warnings when we are using the nonActiveRecord class in Rails forms.
[ { "docid": "dad762b0b3cbe300edbf3aea860ce151", "score": "0.0", "text": "def id\n nil\n end", "title": "" } ]
[ { "docid": "d1b856784af0feb1cac827a81be20c9d", "score": "0.71301216", "text": "def deprecation; end", "title": "" }, { "docid": "7b648fdf921d6fbe886c47d0ea48692d", "score": "0.68572325", "text": "def deprecation_warn; end", "title": "" }, { "docid": "703ddc1cfb0ceb4f94a2d...
1a2590a54bfb0a4643f1765e634d886d
Gets all the console output from the stream logs.
[ { "docid": "914811465acea6c0702bfc28977272ed", "score": "0.0", "text": "def parse_streams(e_ary)\n e_ary.map { |x| x.is_a?(Hash) && x['stream'] }.compact.join\n end", "title": "" } ]
[ { "docid": "60f0c6df7404a46b46d62be5569a87e5", "score": "0.72110456", "text": "def log_messages\n\t\treturn Thread.current[ 'logger-output' ] || []\n\tend", "title": "" }, { "docid": "bb22418483af384a682415f75303dde2", "score": "0.7103907", "text": "def all_stdout\n process_mo...
8a9f816c6e621560500fbbb43e5cbbdb
Return all patients who have died
[ { "docid": "8f041444e16d9f6a0a6b021bce306e5b", "score": "0.0", "text": "def dead\n \nend", "title": "" } ]
[ { "docid": "10708a3cdfc782ff73a7b848e7c72180", "score": "0.7382515", "text": "def dead\n Patient.where(is_alive: false)\nend", "title": "" }, { "docid": "bd18d8fa68f85c0951d947e9089febdf", "score": "0.7030992", "text": "def patients \n patients = Patient.all.select do |...
3cc2d920c83d54f3b6ee89a1b405f377
Draw elemental resistance enemy : enemy x : window xcoordinate
[ { "docid": "cff344c65f08d70efbea59cd668d559c", "score": "0.64520484", "text": "def draw_element_resist(enemy, x)\n max_elment = [Max_Elements_Shown, 8].min\n y = (200 - (max_elment * 25)) / 2\n elements = $data_enemies[enemy.id].element_ranks\n base = value = 0\n case Element_Resists_Exhi...
[ { "docid": "490224f45364f47c25eacce2965a6dea", "score": "0.6700307", "text": "def adjust_coords\n adjust_x = Graphics.width / 544.0\n adjust_y = Graphics.height / 416.0\n @enemies.each do |enemy|\n enemy.screen_x *= adjust_x\n enemy.screen_y *= adjust_y\n end\n end", "title": ...
ea358d47aa08c13015340e817aab97fe
TEST VERIFYING THAT MINING CONSISTENTLY RETURNS THE SAME VALUES AFTER TWO ITERATIONS OF THE FUNCTION USING THE SAME PARAMETERS
[ { "docid": "745160861e3e5aeaf4f3ab0d35570872", "score": "0.658058", "text": "def test_consistency_ruby_test\r\n rubyArr = [1,1]\r\n seed = 10\r\n r = Random.new(seed)\r\n firstIteration = mine(rubyArr, r)\r\n secondIteration = mine(rubyArr, r)\r\n if firstIterat...
[ { "docid": "bfc762f6ce338f12d93cd3054ac7e389", "score": "0.6373598", "text": "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "title": "" ...
6269d049681a22a89932deedcb91603c
Add more helper methods to be used by all tests here... Url for a users gravatar photo
[ { "docid": "4d4f7cfe5e52f9e820a4a46e08ff7678", "score": "0.71846235", "text": "def gravatar_url_for(user, options = {size: 80})\n gravatar_id = Digest::MD5::hexdigest(user.email.downcase)\n size = options[:size]\n \"https://secure.gravatar.com/avatar/#{gravatar_id}?s=#{size}\"\n end", "tit...
[ { "docid": "03603e25200dc56cfc3b9b11636f1f2a", "score": "0.7914476", "text": "def gravatar_url\n \"http://#{GRAVATAR_HOST}#{self.gravatar_path}\"\n end", "title": "" }, { "docid": "9e7f027489b3d604307b3b45d63f28e9", "score": "0.7763414", "text": "def gravatar_url()\n \"http://...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0b708e16a97bff63c553ff04845325a8", "score": "0.0", "text": "def set_customertype\n @customertype = Customertype.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook;...
a3bb9c781fb35e5faf3b82e7ebc72e15
annotate column names of an AR model
[ { "docid": "888ab2a2550edff53b2d67f1520f0bae", "score": "0.5942719", "text": "def show(obj)\n y(obj.send(\"column_names\"))\nend", "title": "" } ]
[ { "docid": "e808fa07327e99d4b00b4a0eb53dbbab", "score": "0.6959806", "text": "def autoreport_association_name_columns(reflection)\n %w(name email title)\n end", "title": "" }, { "docid": "a967f86110632a8f44f5bf4e478dd826", "score": "0.6843643", "text": "def model_colu...
36785d48713579ce79496ce12c2b7c87
GET /allowed_packages/1 GET /allowed_packages/1.json
[ { "docid": "cf62000702b0a29fa74cbcd340e28e05", "score": "0.7008201", "text": "def show\n @allowed_package = AllowedPackage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @allowed_package }\n end\n end", "title": "" } ]
[ { "docid": "edf5c2348ba95692ad84e20246ff899e", "score": "0.6870258", "text": "def get_packages\n\n user = User.find(decode_token)\n\n packages = user.packages\n\n render json: packages\n end", "title": "" }, { "docid": "1140bbda05b105664cc9c96655a89093", "score": "0.6765217", ...
9c9e38fa27301717a3af72d9aa04c2ab
turns a list of waypoints into a bingapifriendly "wp.1", "wp.2", etc...
[ { "docid": "0cfec8531536f4fd743b81469fd3d78d", "score": "0.66084754", "text": "def hashify_waypoints(waypoints)\n counter = 1\n waypoints.inject({}) do |hash, waypoint|\n hash[\"wp.#{counter}\"] = format_waypoint(waypoint)\n counter = counter + 1\n hash\n end\n end...
[ { "docid": "e24edb7740c232ca89143b480f673d9c", "score": "0.54802316", "text": "def waypoints\n # expecting something like \"(#,#),(#,#),...\"\n points = self.route.blank? && self.region || self.region.blank? && self.route \n \n # produces \"#,#),(#,#\"\n chomped = poin...
106e4528a1fb7111fb572360155a5fa3
C000 EOR $c080,X C002 BRK
[ { "docid": "46cae78ef7a044bee65e61ff7c4e8540", "score": "0.0", "text": "def test_EOR_absolute_x\n reset_and_load_memory %w[5d 80 c0 00]\n\n @cpu.accumulator = 0b0110_0110\n @cpu.x_register = 0x10\n @cpu.write_ram(address: 0xc090, data: 0b0011_1100)\n @cpu.execute(address: @base_address)\n...
[ { "docid": "99b25ccd4208b2867cd85661ef26ce2e", "score": "0.6319101", "text": "def alu_c0; @bits[12]; end", "title": "" }, { "docid": "4e4fece32d782a9972f51f5ab24dc0b0", "score": "0.60988104", "text": "def control_codes\n 'CC12345'\n end", "title": "" }, { "doc...
565f26bc1e45832ab0b69a578f9eb349
Problem 3: You have an unsorted array of integers. Write a recursive solution to count the number of occurrences of a specific value.
[ { "docid": "0a877acaac15a7abd5ac97d994b56d44", "score": "0.7355228", "text": "def num_occur(array, target)\n if array.empty?\n return 0\n end\n \n if array[-1] == target\n return num_occur(array[0...-1], target) + 1\n else\n return num_occur(array[0...-1], target)\n end\n \nend", "ti...
[ { "docid": "c4d55b1f26464c24bc1f4a83f04bf9b9", "score": "0.784265", "text": "def count(arr, val)\n if arr.length == 0\n return 0\n end\n\n if val == arr[0] \n cnt = 1\n else \n cnt = 0\n end\n \n cnt + count(arr[1..-1], val)\nend", "title": "" }, { "...
bf56d7e042afade92a21ef6c7006be0b
Gets the set property value. The [set] in which the relation is relevant.
[ { "docid": "d66f4e4230a40e0f09078ac60c76bfe2", "score": "0.66682565", "text": "def set\n return @set\n end", "title": "" } ]
[ { "docid": "700e6fbed6505d4464f52b40181fb4e2", "score": "0.69687116", "text": "def get_set_field\n @setfield\n end", "title": "" }, { "docid": "96545335787f9931dfc414e5a11d4721", "score": "0.6379164", "text": "def to_set\n self\n end", "title": "" }, { "do...
db3d9ae924824837f75e2d73e87ddfef
DELETE /se_use_consumption_consumable_datas/1 DELETE /se_use_consumption_consumable_datas/1.xml
[ { "docid": "775bffab1c732d241f9440b3d20c3c38", "score": "0.5678006", "text": "def destroy\n @se_use_consumption_consumable_data = SeUseConsumptionConsumableData.find(params[:id])\n \n @se_use_consumption_consumable_data.destroy\n\n respond_to do |format|\n format.js { render :action =>...
[ { "docid": "c1592c9a7c989d01a99d8c2f4e789eab", "score": "0.68496996", "text": "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "title": "" }, { "docid": "cc3bf21e77d56214ba6e5ba85227f355...
109f28218bab6ec48612352f32705739
Return a string to print using one of the USPS Intelligent Mail Barcode fonts. Each character of the string will be one of: 'T' for a tracking mark (neither ascender nor descender) 'A' for an ascender mark 'D' for a descender mark 'F' for a full mark (both ascender and descender)
[ { "docid": "a4adc29083ee57a7b82ed7d3b6be56a6", "score": "0.6491653", "text": "def barcode_letters\n symbols.map(&:letter).join\n end", "title": "" } ]
[ { "docid": "78a3000475d7f93f23e5d789b0deb252", "score": "0.6142591", "text": "def convert_1_character_to_1_font(character,font)\n if character==\"0\"\n return font[0]\n end\n if character==\"1\"\n return font[1]\n end\n if character==\"2\"\n return font[2]\n end\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "73be3dafa02535dd90e3cc604b4b4ab7", "score": "0.0", "text": "def set_purchase\n @purchase = Purchase.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
3a2a3e5f4643aa7e3709c0ddd1d4d316
gem install json =======================
[ { "docid": "b7eb4d1add9cf98d9e00c35c444528c0", "score": "0.0", "text": "def print_welcome()\n puts \"=========================\".colorize(:color => :light_blue)\n puts \"Welcome to the main menu\".colorize(:color => :light_blue)\n puts \"=========================\".colorize(:color => :light_blue)\n ...
[ { "docid": "2b14d7d17a471602b252e9b7dc5b9f3e", "score": "0.644916", "text": "def to_json(*a)\n begin\n JSON\n rescue NameError\n # Instead of doing \"require 'json'\" at the top of the file, like\n # would normally be done, we only require it if this particular\n # method is ca...
e56446aa32077af9e715b88a350a7e6c
If there are any received faxes, returns an array of fax_ids for those faxes.
[ { "docid": "a583d7c48804f91208c7609be2f906b7", "score": "0.0", "text": "def receive_fax(count)\n fax_count = (count > 500) ? 500 : count\n connection = SFax::Connection.incoming\n\n path = @path.receive_fax(fax_count.to_s)\n response = connection.get path do |req|\n req.body =...
[ { "docid": "f20a96ae00f4c8505164e2f23429a516", "score": "0.5857487", "text": "def getAxesNumbers\n foundAxes=Set.new\n parameters=self.instancevalues.select(:name)\n parameters.each do |parameter|\n axisName=parameter.name.split(\":\")[0]\n if (!axisName.empty?)\n foundAxes.add...
5e96011466d7bbb014c66d382a136bf2
Check if all provider times in a day start at the same time True if they start at the same time
[ { "docid": "b42664e32d5afd85586d185c85f4f2f0", "score": "0.73593056", "text": "def check_providers_day_times(date)\n\t\tday_open = \"\"\n\t\tProviderTime.where(:service_provider_id => self.service_providers.pluck(:id), :day_id => date.cwday).each do |pt|\n\t\t\tif day_open == \"\"\n\t\t\t\tday_open = pt...
[ { "docid": "a7efdf427d9733a07abdf6450595db92", "score": "0.73264354", "text": "def clocked_in\n if clock_in_times.select {|c| c.time.localtime.to_date == Date.today}.count >= 1\n true\n end\n end", "title": "" }, { "docid": "8b9409905ca4868bdc170c3a1241062a", "score": "0.7184...
0302d6700ee187f5c28abe03a7cce389
default to Active Model Serializers
[ { "docid": "8bdd932b76805c6bb56a74de9950d14d", "score": "0.0", "text": "def index\n if params[:last_requested]\n expires_in 2.second, :public => true, :must_revalidate => false\n respond_with Post.order(\"created_at DESC\").where('created_at > ?', params[:last_requested])\n else\n r...
[ { "docid": "ad75a298d7cc9868bf7bbd4ca2f42cd1", "score": "0.7626089", "text": "def serializer; end", "title": "" }, { "docid": "fb5b0c4dc6dc2ed3ad71717b9ea71135", "score": "0.7502072", "text": "def active_model_serializer\n self.class.active_model_serializer\n end", "title": "...
99c492e08c4a354bbe4f8dca42e0e689
=begin _|_|_| _|_|_|_| _|_| _|_|_| _| _| _| _| _| _| _| _|_|_| _|_|_| _|_|_|_| _| _| _| _| _| _| _| _| _| _| _| _|_|_|_| _| _| _|_|_| =end
[ { "docid": "00f96769db9b4dfa74e28ee01f3d537d", "score": "0.0", "text": "def projects\n @projects = Project.all\n #@projects.each { |p| p.task_cache = p.tasks }\n \n #t = @projects.map { |p| p.tasks }\n #@tasks = {}\n #t.flatten.each{ |t| ( @tasks[t.project_id].nil? ) ? @tasks[t.project...
[ { "docid": "1b7f2745c5153bc76ab2921cc27c0cdc", "score": "0.6409475", "text": "def part_begin\n end", "title": "" }, { "docid": "d28b62ec28e2eec14ac5efdae0c0348c", "score": "0.61595213", "text": "def almost_all\n self.begin.end\n end", "title": "" }, { "docid": ...
68a44e3318b7c10905c5884b73c182a5
Written by Gregory Eglen Goal: Find the input that produces the longest chain of Collatz values from 1 to 1,000,000. Collatz Sequence: Given an input of 'n', the next number in is defined by: n > n/2 (if n is even) n > 3n + 1 (if n is odd) Sequence continues until n is equal to 1 I wrote this solution on my own:
[ { "docid": "b8655a63d1ae9a8e03da34ac1978bb07", "score": "0.8783775", "text": "def find_longest_collatz_chain(n)\r\n longest_chain = 0\r\n while n <= 1000000\r\n number = n\r\n count = 1\r\n if number == 1\r\n number += 1\r\n end\r\n while number > 1\r\n if number % 2 == 0\r\n ...
[ { "docid": "8962e232694cc8d173fb9950fa214e8f", "score": "0.8414829", "text": "def longest_collatz_sequence(n)\n\n longest_length = 0\n longest_collatz = 0\n i = n\n\n while i > 4\n current_sequence = [i]\n current_length = 0\n j = 0\n\n while current_sequence[j] > 1\n integer = curr...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "1bf5f7a4607f5ec8fb0425d09824d7a0", "score": "0.0", "text": "def tik_tok_params\n params.require(:tik_tok).permit(:description, :link, :user_id, :category_id, :favorite)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
3f9f3721a45d53de96406cca4cbfb2d2
POST /cars1s POST /cars1s.json
[ { "docid": "e4ee1e73d704b84956af09716cfcd28d", "score": "0.5928855", "text": "def create\n @cars1 = current_user.cars1.new(car_params)\n \n\n respond_to do |format|\n if @cars1.save\n format.html { redirect_to @cars1, notice: 'Cars1 was successfully created.' }\n format.json { ...
[ { "docid": "2acf3008094f5840bfcbed5a32367782", "score": "0.6537231", "text": "def create\n @car = Car.new(car_params)\n\n if @car.save\n render json: @car, status: :created, location: @car\n else\n render json: @car.errors, status: :bad_request\n end\n end", "title": "" }, ...
a2c78527b46095831b43ec0f8ab6c775
:callseq: run.expiry=(time) > bool Set the expiry time of this run to _time_. The format of _time_ should be something that the Ruby Time class can parse. If the value given does not specify a date then today's date will be assumed. If a time/date in the past is specified, the expiry time will not be changed.
[ { "docid": "6a87157dff329b929c29a4e0b3a60352", "score": "0.8142066", "text": "def expiry=(time)\n # need to massage the xmlschema format slightly as the server cannot\n # parse timezone offsets with a colon (eg +00:00)\n date_str = Time.parse(time).xmlschema(2)\n date_str = date_str[...
[ { "docid": "7e2c32356ecf028f58ac3145d6d8c0dc", "score": "0.75107026", "text": "def expiry=(value)\n @expiry = value\n end", "title": "" }, { "docid": "7e2c32356ecf028f58ac3145d6d8c0dc", "score": "0.75099885", "text": "def expiry=(value)\n @expiry = value\n end", "...
3db320401da395dfcd002945285cda19
Return the local hostname for the machine
[ { "docid": "f36100a43311ca61407c5b5fe7617efb", "score": "0.0", "text": "def hostname(subdomain)\n \"#{subdomain}.coveryourbasics.dev\"\n end", "title": "" } ]
[ { "docid": "6e7956f0a3932380d1946542dfc256aa", "score": "0.8411701", "text": "def host_name\n `hostname`.chomp\n end", "title": "" }, { "docid": "43bc5a0411ebaee5e31765923a847513", "score": "0.8354125", "text": "def local_name\n Socket.gethostname\n end", "title": "" ...
b4074f186d1bca083d86aee2a0225aec
change name and domain
[ { "docid": "9f4b4324146f9661fa045139344b1992", "score": "0.0", "text": "def pivot(domain, name)\n @name = name\n @domain = domain\n end", "title": "" } ]
[ { "docid": "f480bd291da81dd2a58bc2db632dda5f", "score": "0.81466293", "text": "def change_host_name(name)\n\n # First set the machine name (hostname)\n components = name.split('.')\n hostname = components.first\n domainname = components.slice(1, components.size).join('.')\n\n super(host...
779561cbf0d1d5235a8ce3fe86ca2d47
add a callback that gets (usually) executed after loading the library
[ { "docid": "93876eb6578c9dbe367c1e3ed53a0a17", "score": "0.74966955", "text": "def add_library_callback(lib, &block)\n lib = lib.to_s\n @lib_hooks[lib] << block\n end", "title": "" } ]
[ { "docid": "559eb8b8b2169ea17563f1187fa634b1", "score": "0.7538681", "text": "def add_callback(type, options, &block); end", "title": "" }, { "docid": "9774467eef0926d0e584f3963364545f", "score": "0.6898423", "text": "def definecallback(&b)\r\n\t\t\t@callback = b\r\n\t\tend", "ti...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c6555a48be045a5dbf63ec93346ede39", "score": "0.0", "text": "def set_list_element\n @list_element = ListElement.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
0a06a7f971a1597ba6a4a011ea143d89
TODO DRY this up. specifically: error conditions. FIXME need to warn if there are completed user checklists and ... trying to change fields that cannot be changed if there are already completed items
[ { "docid": "4f99750f96399ff3c3baa4d0b902514d", "score": "0.6257918", "text": "def update\n params_with_corrected_list_pos = params_with_corrected_list_pos(master_checklist_params)\n\n begin\n\n if @master_checklist.update(params_with_corrected_list_pos)\n respond_to do |format|...
[ { "docid": "4ea9d26e965bbcef6a413666b9b7fd6c", "score": "0.64156115", "text": "def add_status_for_completed_non_undergraduate_items(sir_checklist_items)\n sir_checklist_items.each do |item|\n next unless is_completed_non_undergraduate_item?(item)\n application_nbr = item.try(:[]...
2904e209b4d09e9d82004560005fe0ab
GET /videos GET /videos.json
[ { "docid": "d50cb48abdebad8916a3270bc8b1b386", "score": "0.0", "text": "def index\n if params[:keywords].present?\n @videos = Video.where(\"user_id = ? and description like ?\", current_user.id, \"%#{params[:keywords]}%\").order(\"created_at desc\")\n else\n @videos = Video.where(user: c...
[ { "docid": "24b55059068ab0d5a2d271c5910b82f2", "score": "0.76694834", "text": "def all_videos\n videos = Video.all\n\n if videos\n render json: {\n videos: videos\n }\n else\n render json:{\n status: 500\n }\n end\n end", "title": "" }, { "docid...
9f11c3759b41ce686f85448dc25ece31
Get a job's promotion config
[ { "docid": "3022570876f8465e3e6a70fac282cc56", "score": "0.7586395", "text": "def get_promote_config(job_name, process)\n @logger.info \"Getting promote config for job '#{job_name}' process '#{process}'\"\n @client.get_config(\"/job/#{job_name}/promotion/process/#{process}/config.xml\")\n ...
[ { "docid": "7978d6ef2108ef76c93678da12ff942c", "score": "0.6248704", "text": "def fetch_config(job_id)\n response = get(\"/jobs/#{job_id}\")\n if (200..299).include?(response.status)\n response.body['job']['config']\n else\n # TODO: I should probably raise here\n nil\...
0cde1ab55274877e9f924f8db972cb31
GET /rounds/1 GET /rounds/1.json
[ { "docid": "8f797ffde9836c964f22a73cac2f1666", "score": "0.0", "text": "def show\n @round = Round.where(id: params[:id]).includes(:holes, :tour_part, :competition, :scores, :tee).first\n @user = User.where(id: @round.user_id).first\n @holes = Hole.where(tee_id: @round.tee_id)\n end", "titl...
[ { "docid": "af48200034ed391c6c3dbc4101b8f861", "score": "0.76152664", "text": "def index\n @rounds = Round.all\n\n render json: @rounds\n end", "title": "" }, { "docid": "6cf53e8c218b9d1d5c19e497e8b12c12", "score": "0.76026386", "text": "def index\n @rounds = Round.all\...
ddce9b7295d4b8db065a7a446ddd1c68
Call this to get rickshawformatted data for a given sensor
[ { "docid": "f351a058100fc3d9a6ebdd6ee7fd4baf", "score": "0.4787296", "text": "def get_last_week(sensor_id, access_token)\n data = get_interval_data(sensor_id, access_token, \"week\")\n return mk_rickshaw_format_localtime(data)\n end", "title": "" } ]
[ { "docid": "94becb9e0cdd88beff91bded954a8dbc", "score": "0.6217809", "text": "def getData(sensor)\n\n\t\t# We return the data in an array of hashes\n\t\tdataInput = []\t\t\n\n\t\t# Query the data\n\t\tdataQuery = Reading.select(:recorded_at, :temperature, :humidity).where(node_id: sensor, recorded_at: T...
b7afac10bf1d32e7bd5979914550a4ff
TODO: check the order. there must be a mistake!
[ { "docid": "bc5d1c38603080023270e58e2a2b4cb5", "score": "0.0", "text": "def show\n @preliminaries = Match.preliminary.group_by { |m| m.group.to_s }.sort_by { |group, m| group }\n @finals = Match.final.group_by { |m| m.round }\n @tips = current_user.tips\n @user = current_user\n end", "t...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.747789", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.6767733", "text": "def probers; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2deaaa52d2254154962ee26fa775629f", "score": "0.0", "text": "def set_budget\n @budget = Budget.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.6032574", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015663", "text": "def...
9d670c3419d991009f69cb625a5f36d5
method_javascript_function needs this method
[ { "docid": "7e4d1bd1bce6d8fe6212598da618aaa4", "score": "0.0", "text": "def protect_against_forgery?\n false\n end", "title": "" } ]
[ { "docid": "433c55678275c3382731f6f2e959fb21", "score": "0.77765405", "text": "def javascript\n end", "title": "" }, { "docid": "978b14f9ece0b9d6a4cb9f75a2a1f1eb", "score": "0.7617997", "text": "def js\n end", "title": "" }, { "docid": "0f3616d2173be236c98ed950c43ee...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6f4f786c06f5fd42111a38a1df11cab4", "score": "0.0", "text": "def image_params\n params.require(:image).permit(:filename, :private, :user_id, :tag_id, tags_attributes: [:tag_string])#params.require(:image).permit(:filename, :private, :user_id, :tag_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496729", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958585", "text": "def strong_params\n params.require(:request).permit(param_white...
e9522e0e17dac325762be860ac0209b8
Allows the user to swap their org affiliation on the fly
[ { "docid": "2de0c1a6f9ca83a4210e2b8e4dd4674d", "score": "0.5305623", "text": "def org_swap?\n @user.can_super_admin?\n end", "title": "" } ]
[ { "docid": "2ab420572d4652ed4bed2e4a6ab25347", "score": "0.6411578", "text": "def change_affiliation(person)\n @voters.each do |voter|\n if voter[:name] == person\n puts \"You want to change the affiliation of the Voter named \\\"#{voter[:name]}\\\" who is currently \\\"#{voter[:affiliati...
1c26e258dcc16d16147a5b90bc36f642
PUT /micro_array_validations/1 PUT /micro_array_validations/1.xml
[ { "docid": "c397d54df385222b228b919962d4c787", "score": "0.6959711", "text": "def update\n @micro_array_validation = MicroArrayValidation.find(params[:id])\n @title = \"Micro array validation\"\n\n respond_to do |format|\n if @micro_array_validation.update_attributes(params[:micro_array_va...
[ { "docid": "c21503323810311527b19a335d278f0b", "score": "0.5799293", "text": "def create\n @micro_array_validation = MicroArrayValidation.new(params[:micro_array_validation])\n @title = \"Micro array validation\"\n\n respond_to do |format|\n if @micro_array_validation.save\n format....
a0f65dd3a29cb7bf6d34d1b312a2e7ab
Given an object, write out the json file
[ { "docid": "0edcc9a6a93bf0681614019cc2295c3d", "score": "0.7503723", "text": "def write_raw(obj)\n\n # To write\n raw_data = obj.to_json\n\n # File name\n file_name = \"#{Repository.data_dir}#{obj.id}.json\"\n\n File.open(file_name, 'w') do |f|\n f.puts(raw_data)\n end\n end", ...
[ { "docid": "1f032ae142909d96fe3a00dbbe193280", "score": "0.8717207", "text": "def write_json(file, object)\n return unless file && object\n begin\n File.open(file, 'w') { |f| f.write(JSON.pretty_generate(object)) }\n end\n end", "title": "" }, { "docid": "162341bc321...
20ec9c1d2f7e0b96fc55ff00287238f9
Stages the application. Everything is loaded but the application is not started. Accepts the same arguments as run.
[ { "docid": "5ec41695283129b95aa7b904b6ad8adf", "score": "0.0", "text": "def stage(*args)\n return if staged?\n @staged = true\n prepare(args)\n end", "title": "" } ]
[ { "docid": "613a8e040a7596af8348364440cde65c", "score": "0.64500946", "text": "def launch\n end", "title": "" }, { "docid": "d5d3fea807b518a1a398909d5342c0e0", "score": "0.6265848", "text": "def boot\n Thread.new do\n sleep 1 until EM.reactor_running?\n \n ...
7dbbc9df8471ed5d9303d5e246161048
List gets a list of WorkflowApproversHistory records matching a given set of criteria.
[ { "docid": "34c62835957c65aa3d5beef6237b041c", "score": "0.7543182", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::WorkflowApproversHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"Pa...
[ { "docid": "4fae5d3c0185f04d9c36c7c75a2ebb91", "score": "0.67536736", "text": "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::WorkflowHistoryListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"...
67fd52d1debe6766f0f041529cc1320c
GET /visits GET /visits.json
[ { "docid": "aae966022bdadbf5fd19f8f56bab8153", "score": "0.0", "text": "def index\n if current_user\n all_visits = Visit.for_user(current_User)\n @visits = all_visits.reject(&:todo?)\n @todos = all_visits.select(&:todo?)\n\n else\n redirect_to '/'\n end\n end", "title":...
[ { "docid": "a6cd3ec8c1ec4ad1bc45721a8b29650d", "score": "0.7859481", "text": "def index\n # @visits = Visit.all\n render status: :ok, json: @visits\n end", "title": "" }, { "docid": "7eb8b246106ecb69a705a5684f1f1d36", "score": "0.7740704", "text": "def show\n u...
13a25bf991f72692776bbb0b9271f4c2
Activates the user in the database.
[ { "docid": "fcf4371fdf4f6b91e182839cd023d4b9", "score": "0.6692429", "text": "def activate\n @activated = true\n self.activated_at = Time.now.utc\n self.activation_code = nil\n save!\n end", "title": "" } ]
[ { "docid": "1817726e9d65e0c7ef9049b7126496cb", "score": "0.7746603", "text": "def activate\r\n Marketplace::Database.instance.delete_deactivated_user(self)\r\n Marketplace::Database.instance.add_user(self)\r\n Marketplace::Activity.create(Activity.USER_REACTIVATE, self, \"#{self.name} has...
71d0816312ba33a0b8c2e57186e78e75
Basic Features Pet Feature Check if you have more than one items related to your pet, if not, your pet will be angry
[ { "docid": "335952786f51ddb294d73d3a1fc924c8", "score": "0.7169002", "text": "def check_pet(pet_name)\n @pet_name = pet_name\n count = 0\n @items.each { |item| count += 1 if item.description.upcase.include?(@pet_name.upcase) }\n if count > 1\n puts \"You have #{count} item(s) related to...
[ { "docid": "7379c374bd6e08ae60911943561d6ee8", "score": "0.7039203", "text": "def pet_is_angry\n @items.each do |item|\n if item.description.upcase.include?(@pet_name.upcase)\n pet_first(item)\n else\n item.set_priority(1)\n end\n end\n end", "title": "" }, { ...
4d1b8a9c7d4c40c13ce62ee755e54e7c
This returns a client ready to query the FA API
[ { "docid": "ee14e3164a550749b11122c3ba99e48e", "score": "0.6137685", "text": "def client(resource, parameters = {})\n url = \"https://#{self.subdomain}.freeagentcentral.com/#{resource}#{parameters.empty? ? \"\" : \"?\" + parameters.collect { |p| p.join(\"=\") }.join(\"&\")}\"\n RestClient::Resourc...
[ { "docid": "2823ff5e2403320020a187bd7fa3d54f", "score": "0.7259554", "text": "def client\n @client ||= Faraday.new(api_host) do |faraday|\n faraday.headers[\"Authorization\"] = \"Bearer #{access_token}\"\n faraday.response :logger if Rails.env.test?\n faraday.adapter Faraday.default_ad...
2754824aa620b6789ee6ad55880985a9
Which driver made the most money?
[ { "docid": "1fd2a2924ae56b94e66af62fc01268e2", "score": "0.6427209", "text": "def max_earner(structured_data)\n earnings = driver_earnings(structured_data)\n max_earnings = earnings.values.max\n\n if earnings.values.count(max_earnings) > 1\n max_earner = (earnings.map { |driver, earnings| driver i...
[ { "docid": "bf24c9ac4e38feda7409e3b380bf00c9", "score": "0.80343944", "text": "def finds_who_made_most_money(ride_info)\n\n #initialize variables\n most_money = 0\n driver_made_most_money = \"\"\n\n # grabs list containing total cost for each driver\n money_made_each = finds_total_cost(ride_info)\n...
aef094e043995c63876f61384e2710c7
Calls the pipeline, passing +state+.
[ { "docid": "3fe074f1518776fd840cf77bcb2aee0f", "score": "0.8998825", "text": "def call(state)\n @__pipeline.call(state)\n end", "title": "" } ]
[ { "docid": "492cd6fc4ac24a9946b6bc8eaa0fecd9", "score": "0.7616149", "text": "def invoke_state(state)\n puts \"#{name}: transition: #{last_state} to #{state}\"\n puts \" ...#{state}\"\n \n ### DISCUSS: at this point, we finally know the concrete nex...
4ec734c9f31cd007e3bf91cf0470dc0a
Sets the attribute runtime
[ { "docid": "3c96bd70b58531054ceed74935058440", "score": "0.5960481", "text": "def runtime=(_arg0); end", "title": "" } ]
[ { "docid": "caf0c0f8e531a1474f29faa7e6974c6c", "score": "0.694586", "text": "def runtime=(name)\n @runtime = Runtime[name.to_sym]\n end", "title": "" }, { "docid": "d309dffd28fdac85d4496f776991c611", "score": "0.6556339", "text": "def attribute=(attr_name, value); end", ...
92c9b2c6ae2132636bec0ddd0a7f2f0f
getting input.csv accounts / hardcoded "input.csv" file (in the main directory in this case)
[ { "docid": "e03aea07a94761541cd82ab1837bc6fa", "score": "0.69679874", "text": "def run\r\n table = CSV.parse(File.read(\"input.csv\"), headers: true)\r\n table.each do |account|\r\n INPUT_ACCOUNTS << [\"#{account[\"Account ID\"]}\", \"#{account[\"First Name\"]}\", \"#{account[\"...
[ { "docid": "05212116ed37c4e32cd9e434d90a6439", "score": "0.63403624", "text": "def csv(filename)\n File.expand_path(\"../samples/#{filename}\", __FILE__)\nend", "title": "" }, { "docid": "5d25d04498e5f2128a511cb450c6740c", "score": "0.6251654", "text": "def get_new_csv_name\n p...
60670cabdc9906d4cc06f0478a8d45db
POST /sampling_sites POST /sampling_sites.xml
[ { "docid": "e873e94ced7b7ec93b7822977a1474a5", "score": "0.6407974", "text": "def create\n @sampling_site = SamplingSite.new(params[:sampling_site])\n @title = \"Sampling site\"\n\n respond_to do |format|\n if @sampling_site.save\n format.html { redirect_to(@sampling_site, :notice =...
[ { "docid": "10a2a535b61bf3fade0afcd0f727c37c", "score": "0.5688243", "text": "def create\n @sampling = Sampling.new(sampling_params)\n\n respond_to do |format|\n if @sampling.save\n format.html { redirect_to @sampling, notice: t('create_success') }\n format.json { render :show, ...
abe4f9490de612db3f0b53f6b1b39144
This method generates an array of all moves that can be made after the current move.
[ { "docid": "aaf3307d4621466f2f90bcc465e343f7", "score": "0.0", "text": "def children\n empty = []\n (0..2).each do |i|\n (0..2).each do |j|\n empty << [i,j] if @board.empty?([i,j])\n end \n end \n\n childs = []\n empty.each do |pos|\n board = @board.dup \n board...
[ { "docid": "ab6b87d439d2ac15bdfbf3aebcff6da0", "score": "0.7375318", "text": "def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @...
e2096e017b0af5bd8a8540b54a26f3f5
4.1 Calculating Table Size The size of the dynamic table is the sum of the size of its entries. The size of an entry is the sum of its name's length in octets (as defined in Section 5.2), its value's length in octets (see Section 5.2), plus 32. The size of an entry is calculated using the length of the name and value w...
[ { "docid": "fc5bfbadc8baab129b274af4d41eb2fd", "score": "0.7175597", "text": "def size\n @dynamic_entries\n .map(&:size)\n .reduce(0, :+)\n end", "title": "" } ]
[ { "docid": "418623e575d6478899c3795f4bb40cb8", "score": "0.7441522", "text": "def current_table_size\n\t\t\t\t@table.inject(0) {|r, (k, v)| r + k.bytesize + v.bytesize + 32}\n\t\t\tend", "title": "" }, { "docid": "9e2f9ae1b32442c2216b450631815fa7", "score": "0.71619755", "text": "def...
b73060bcc4382ff4747aa53b02662a7b
stop processes by swapping it out if it is running, and removing it from queues.
[ { "docid": "c6a33609b2a2b4ea79440746b495489a", "score": "0.7168303", "text": "def end_process id\n taskswap 0 if @cur_proc_id == id\n @processes -= [id]\n @queue[0] -= [id]\n @queue[1] -= [id]\n end", "title": "" } ]
[ { "docid": "5c79ac4a0c2e30997dd7b3cd22831bfc", "score": "0.68754107", "text": "def stop\n return unless services.any? { |s| s.process }\n puts \"Stopping the services...\"\n services.map {|s| Thread.new { s.stop } }.map(&:join)\n end", "title": "" }, { "docid": "1cd87131b11b82b59b5...
1406376b5b2d48b2ccebb8c49084a3ee
def default_attributes Get the type of this package class. For "Foo::Bar::BAZ" this will return "baz"
[ { "docid": "a964dc41cf11411b9dc582e3bf9ed582", "score": "0.0", "text": "def type\n self.name.split(':').last.downcase\n end", "title": "" } ]
[ { "docid": "07a6c445acdf8ebd839e5c38a4ce072f", "score": "0.6809442", "text": "def class_name\n attribute 'class'\n end", "title": "" }, { "docid": "0d11a174c816715f1208f7b508b838f3", "score": "0.6786361", "text": "def class\n\t\tbegin\n\t\t\tdefined?(::Rails) && @attribut...
0fefe4ee273529ca56b89af176d17a19
See ActionController::RequestForgeryProtection for details
[ { "docid": "a75ce27291c6de18fc1cca8576d8916c", "score": "0.0", "text": "def play\n \n chains_in_play = []\n \n Chain.all.each do |chain|\n \n if chain.posts.length <= 11\n \n chains_in_play << chain\n \n end\n \n end\n \n @chain = chains_in...
[ { "docid": "fe697d8a1a507e23997fb1222df48ee6", "score": "0.7633662", "text": "def protect_against_forgery?; end", "title": "" }, { "docid": "2901d60ab009777382b4329372ee3ba2", "score": "0.7591454", "text": "def protect_against_forgery?; false; end", "title": "" }, { "doci...
ad551def36fc1b2610eb1b84f07b01fa
PATCH/PUT /sessions/1 PATCH/PUT /sessions/1.json
[ { "docid": "dd75d18a68b3e27ec327bc400baaad7a", "score": "0.6563782", "text": "def update\n respond_to do |format|\n if @session.update(session_params)\n format.html { redirect_to @session, notice: 'Session was successfully updated.' }\n format.json { render :show, status: :ok, loca...
[ { "docid": "15dafabd9ab0b0e6db7c04ff119b5578", "score": "0.69155777", "text": "def update\n @session = @event.sessions.find(params[:id])\n\n respond_to do |format|\n if @session.update_attributes(params[:session])\n format.html { redirect_to [@event, @session], notice: 'Session was suc...
5ba429dc04d78f95b02efbd79b802cf2
This shows and clears the event trace
[ { "docid": "2c3cba6a6be7e89d224a16ad8ddb7353", "score": "0.0", "text": "def show_events\n @events = Event.order(\"created_at\").to_a\n end", "title": "" } ]
[ { "docid": "cac7e9b92604072a544d9a9e6f04c2e3", "score": "0.67408586", "text": "def remove_trace_func\n Kernel.clear_trace_func\n end", "title": "" }, { "docid": "b593ab077ab7c52994fe81886003c093", "score": "0.65180975", "text": "def reset\n @events = []\n end", ...
f4b50bf80bdde67fc98eb13a0f4016b0
dumps the original json string
[ { "docid": "d7abaf854108783ad45e6e68ecad8912", "score": "0.0", "text": "def dump\n execute_within_oj(&:dump)\n end", "title": "" } ]
[ { "docid": "6f9fd5bb13c9e25b27257c39d7710dac", "score": "0.79058784", "text": "def stringify(jsonified); end", "title": "" }, { "docid": "6f9fd5bb13c9e25b27257c39d7710dac", "score": "0.79058784", "text": "def stringify(jsonified); end", "title": "" }, { "docid": "6f9fd5bb...
1733436f250f87618589c9180578ca01
is this data hash an environment data hash without a project name?
[ { "docid": "a33ee71dc1e9f6f1c9e96dcfe53b69b2", "score": "0.0", "text": "def needs_project_scoping?(data)\n repository_depth(data) == 1\n end", "title": "" } ]
[ { "docid": "be2ec4cbd66ee005a3f1a93511a2ce2e", "score": "0.5917473", "text": "def env_hash\n read_env || reset_env unless defined?(DataCache.env_hash)\n DataCache.env_hash\n end", "title": "" }, { "docid": "37ea91bbe3e67be7a9a8249cffaa836a", "score": "0.5789174", "text":...
a406d61b94ea16ae46f9def88bd21549
Recive la accion que se solicitaron por pantalla y se llaman las funciones que cumplan los requisitos del usuario
[ { "docid": "c19a98e74fefb5c62e4732d26a13590e", "score": "0.0", "text": "def hacer_accion(action, args=[])\n case action\n when 'listar'\n listar(args)\n when 'buscar'\n palabra_clave = args.shift\n buscar(palabra_clave)\n when 'agregar'\n agregar\n when 'eliminar'\n ...
[ { "docid": "daca775f36d526e8985a45ed089a7174", "score": "0.59732854", "text": "def registro_login_ventas\n\n #consierar que no si no es nadie (cualquier cosa diferente de supervisor, admin, ventas, por ejemplo nil u otro valor desconocido, ok ted.) sea ventas el acceso.\n if( (session[:current_user].t...
9a69c3a3f92cccf2f3dbafa54286c6ec
PATCH/PUT /emu_people/1 PATCH/PUT /emu_people/1.json
[ { "docid": "ded04ad7325ef5cf03c91ee0de52724f", "score": "0.689802", "text": "def update\n respond_to do |format|\n if @emu_person.update(emu_person_params)\n format.html { redirect_to @emu_person, notice: 'Emu person was successfully updated.' }\n format.json { head :no_content }\n...
[ { "docid": "6eddf15605851198cb1f19714d1003f9", "score": "0.6999917", "text": "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json...
c6a6da4e1b24c95f743164b30ff0a18a
Private method Returns key of hash in Redis
[ { "docid": "cbebbd80abc1c36567150a4253ba7bce", "score": "0.0", "text": "def hash\n 'instrument_ids'\n end", "title": "" } ]
[ { "docid": "14fdb2118b788f9ef124e062ecda7070", "score": "0.8008183", "text": "def redis_key; end", "title": "" }, { "docid": "f2fcbb888bee6d8224eb94659ed77a9c", "score": "0.7817945", "text": "def hash_key; end", "title": "" }, { "docid": "5053c7660a36ee6adfcbcff330ab4aab"...
ff601035d4a1a987cf3af4c1fb5b7084
Mongrel2 async upload callback allow uploads to proceed.
[ { "docid": "0e21c9667a6731ee7101b3163d10bca0", "score": "0.75921214", "text": "def handle_async_upload_start( request )\n\t\tself.log.info \"Upload started: %s\" % [ request.header.x_mongrel2_upload_start ]\n\t\treturn nil # Do nothing\n\tend", "title": "" } ]
[ { "docid": "218d7622dd53b77ffc5851f635b361f2", "score": "0.66959494", "text": "def upload_finalize( payload )\n notify( :finished_upload )\n\n @chronicle.process_file!( connection_token )\n end", "title": "" }, { "docid": "041c1675b36e52dacf0b07540159f134", "score": "0.6538753", ...
054dd4e7c43afc35ad85d37cea5edae0
GET /Embeddable::Biologica/biologica_pedigrees/new GET /Embeddable::Biologica/biologica_pedigrees/new.xml
[ { "docid": "961e9003d3ca85178df88641fca2fe7c", "score": "0.61959684", "text": "def new\n @biologica_pedigree = Embeddable::Biologica::Pedigree.new\n modify_organism_ids\n if request.xhr?\n render :partial => 'remote_form', :locals => { :biologica_pedigree => @biologica_pedigree }\n else...
[ { "docid": "23cdde8d4b1a2be0bc3eecca07b39e74", "score": "0.6615713", "text": "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ontology }\n end\n end", "title": "" }, { "docid": "dbe4cd5d83e0b187f57633242211e881", "score": "0....
c7defcf9fbbf8e64187e82b64c679f54
GET /comments/1 GET /comments/1.json
[ { "docid": "5833407ae6bc7668c4a132fc2ef9aa69", "score": "0.0", "text": "def show\n @comment = Comment.find(params[:id])\n end", "title": "" } ]
[ { "docid": "db20166192f49f573bb8746e971d1bf0", "score": "0.82822865", "text": "def comments\n client.get(\"/#{id}/comments\")\n end", "title": "" }, { "docid": "2d7ceb879edc63d117e7ddc1136c4c54", "score": "0.74435043", "text": "def comments\n @list.client.get(\"#{url}/co...
6c0d4b0e46a14fce17dc09c996fe77a1
Remove this shape the next turn. Note: Internal use. Use unregister to properly remove a moveable.
[ { "docid": "97ddaf154bde177b6fdaaa8077d9d77a", "score": "0.6123613", "text": "def remove shape\n @remove_shapes << shape\n end", "title": "" } ]
[ { "docid": "02c87d2c1c34956c414bf42d356917ba", "score": "0.5806008", "text": "def remove_shape\n\t\t@shapes.delete_at(0)\n\tend", "title": "" }, { "docid": "d8b852fd3de7239230cc07325798ff74", "score": "0.534814", "text": "def unregister\n @is_registered = false\n self\n ...
cdd285d9657840f0fe72f33bc3837af4
GET /suspects_teams GET /suspects_teams.json
[ { "docid": "575581790bc2346669281afaaeae47a1", "score": "0.7518977", "text": "def index\n #@suspects_teams = SuspectsTeam.all\n end", "title": "" } ]
[ { "docid": "b639011324d5e2f1ecaa9dfbeb820c3c", "score": "0.74662626", "text": "def get_teams\n Resources::Team.parse(request(:get, \"Teams\"))\n end", "title": "" }, { "docid": "0f7f09960a4c3f7ead9fa7dfea0b652e", "score": "0.73206174", "text": "def get_teams\n @client.raw(...
46138603dceda5864973d88a46985835
parser rule exception_group (in ANTLRv3Grammar.g) 210:1: exception_group : ( ( exception_handler )+ ( finally_clause )? | finally_clause );
[ { "docid": "80539c1f2bdb17f8d4b08dc934c182b3", "score": "0.8224787", "text": "def exception_group\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 18 )\n return_value = ExceptionGroupReturnValue.new\n\n # $rule.start = the first token seen befo...
[ { "docid": "b56a1e31f651a62cf0c493bbfc81bbd6", "score": "0.82489675", "text": "def exception_group\n # -> uncomment the next line to manually enable rule tracing\n # trace_in(__method__, 18)\n return_value = ExceptionGroupReturnValue.new\n\n # $rule.start = the first token seen befor...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "215e247ec23e153668686e3c1c276a44", "score": "0.0", "text": "def update!(**args)\n @name = args[:name] if args.key?(:name)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...