query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
7db9057c89d028a1f53126746393f02d
define method for drawing game board
[ { "docid": "b0228ae2930f91be50d15200e4167b52", "score": "0.77001566", "text": "def drawBoard\n\t$firstRow.each do |i|\n\t\ti.printState\n\tend\n\tnewLine\n\t$secondRow.each do |i|\n\t\ti.printState\n\tend\n\tnewLine\n\t$thirdRow.each do |i|\n\t\ti.printState\n\tend\n\tnewLine\nend", "title": "" } ...
[ { "docid": "b8aa78c950f664ebec8f0cbfe6fd6baa", "score": "0.8010517", "text": "def draw_board\n\t\tfor i in 0..9\n\t\t\t@tile_Array[i].draw\n\t\tend\n\tend", "title": "" }, { "docid": "abbd5e7be3dbf41a9bc6f796e23a4432", "score": "0.7944154", "text": "def draw_board()\n @board\n...
50ae2275ca312aa8b9bea9c17f54f59c
Insert a review Insert a item review.
[ { "docid": "505f9fc0a74d27f7cb0a148dd530baf2", "score": "0.7865829", "text": "def insert_review(review, merchant_item_oid, opts = {})\n data, _status_code, _headers = insert_review_with_http_info(review, merchant_item_oid, opts)\n data\n end", "title": "" } ]
[ { "docid": "ffe566cb8fce175b6f6037060ef275a9", "score": "0.70583403", "text": "def create\n @review = Review.new(review_params)\n @review.user_id = current_user.id\n\n if @review.save\n flash[:success] = \"Added review\"\n redirect_to Item.find(@review.item_id)\n else\n flash[...
6b3c237a82ae70d71c147459e786f654
GET /characters/new GET /characters/new.json
[ { "docid": "c9fcb22522775a6fa2b92a7df705eba7", "score": "0.714788", "text": "def new\n @play = Play.find(params[:play_id])\n @character = @play.characters.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @character }\n end\n end", "tit...
[ { "docid": "35e54a3f02de225b54ab533a8f5938d1", "score": "0.8025913", "text": "def new #GIRO: POST /characters(.:format) characters#create\n @character = Character.new #GIRO: http://localhost:3000/characters/new\n end", "title": "" }, { "docid...
d86d0b636a36b731551b44e9b9edccd3
Gets the phones property value. All of the phone numbers associated with this conference.
[ { "docid": "50f082b63114a67b8de6f3a7665367df", "score": "0.80745053", "text": "def phones\n return @phones\n end", "title": "" } ]
[ { "docid": "496a13aa607054aef781d200839f62f4", "score": "0.7827874", "text": "def phones\n RubyRedtail::Query.run(\"contacts/#{contact_id}/phones\", @api_hash, \"GET\")\n end", "title": "" }, { "docid": "5f5ac7e6caf675f8393ab1f004bb8f42", "score": "0.77654386", "text": "d...
14a5bdfec44f1ecf1e507b30d0c249ac
Handle attributes expression `[:html, :attrs, attrs]`
[ { "docid": "02885b663bc5e0444358e52814ba2e25", "score": "0.74087775", "text": "def on_html_attrs(*attrs)\n [:multi, *attrs.map { |a| compile(a) }]\n end", "title": "" } ]
[ { "docid": "c180406afa086620ab2adf8775fc8fed", "score": "0.7832105", "text": "def html_attributes(attr); end", "title": "" }, { "docid": "342f21947880b78d11b802505d4f1aae", "score": "0.7560333", "text": "def on_html_attrs(*args) = [:html, :attrs, *args]", "title": "" }, ...
92c45c11ac35242572307163f088ed99
GET /outmessages/new GET /outmessages/new.json
[ { "docid": "be276c7deb338a30d9846f4ecba816a6", "score": "0.7979334", "text": "def new\n @outmessage = Outmessage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @outmessage }\n end\n end", "title": "" } ]
[ { "docid": "8660adb9daa66006fbb4ed9edb6e976c", "score": "0.7455105", "text": "def new\n @message = current_user.messages.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @message }\n end\n end", "title": "" }, { "docid": "d6d1be080e...
44ed35dcb6648ee1a25ca77c98ff9ac7
Returns the tile at pos
[ { "docid": "896c89aa7afcfb3fb55d3f31c6d41c10", "score": "0.8113502", "text": "def tile_at(pos)\n @parent.tile_at(pos)\n end", "title": "" } ]
[ { "docid": "34d2425babc4958c798b34d41c44d913", "score": "0.8733138", "text": "def tile_at(pos)\n tiles.each {|t| return t if t.position == pos}\n return nil\n end", "title": "" }, { "docid": "75ab8e952ebd629eaf72fccbececdaa9", "score": "0.83497405", "text": "def tile\n ...
3966d7e4e1f50901de0e8af14cd62e44
if form is already assigned to a Study Site, doesn't have form instances created and not taking part in any monitor view > it is removable
[ { "docid": "4a61c8ef608cb10b92ae46117fdb81ab", "score": "0.7219478", "text": "def removable?\n FormInstance.count(:conditions => { :\"form_versions.form_id\" => self.id},\n :include => \"form_version\") == 0 &&\n StudySiteFormVersion.count(:conditions => { :\"form_versions.fo...
[ { "docid": "20bcf0052431860c238bd04aec548a56", "score": "0.62246656", "text": "def no_form(form_name)\n @no_forms[form_name.to_s] = 1\n end", "title": "" }, { "docid": "e39cc3f0ccd65d3fbfb534abdbbe8bb0", "score": "0.600886", "text": "def show_copy_form\n # get the project\n ...
d5d837ae7f3808bc190eaa6beab2a140
Test the instance version of the same method
[ { "docid": "d8d9f0dc5e056ac19c4cc3a3b7796c90", "score": "0.0", "text": "def test_remove_friend_instance\n u = setup_user\n\n # Mock out the class method with the added params\n Bunchball::Nitro::User.expects(:remove_friend).with(u.user_id, 'piggly', u.session).returns('foo')\n\n response = u...
[ { "docid": "5f46cc6fe480d0f4430c05cf3b5bb93d", "score": "0.6847543", "text": "def assert_instance_method(method, content); end", "title": "" }, { "docid": "336b766fe378801675d1e3150999955b", "score": "0.6810147", "text": "def instanceMethodTest method\n assertInstanceMethod Ruby...
f6e2eed99a630ff5afc885d1eb44fc5a
Sets the title of the section
[ { "docid": "03d656377ceca6c8d64821623c2d6d24", "score": "0.0", "text": "def name=(name)\n set_if_changed(:name, name.to_s) do\n invalidate_cache!(:only_section => true)\n end\n end", "title": "" } ]
[ { "docid": "cd33e67a4801c216ef99f85d2e7d0647", "score": "0.79034376", "text": "def set_title(title)\n @title = title\n end", "title": "" }, { "docid": "486b0e7306bb5c5bd94cd8b5c5bf29d4", "score": "0.7762895", "text": "def setTitle(title)\r\n\t\t\t\t\t@title = title\r\n\t\t\t\tend...
d730061f425cc738a9146be313305a46
Removes the battle command, if it exists, from the entity's collection.
[ { "docid": "1837076258d1a0a26001ebafba9d4c86", "score": "0.7819756", "text": "def remove_battle_command(command)\n index = has_battle_command(command)\n @battle_commands.delete_at(index) if index\n end", "title": "" } ]
[ { "docid": "ea895eb3c5a625cacdf3b08ec426b32c", "score": "0.7773464", "text": "def remove_battle_command(command)\n index = has_battle_command(command)\n battle_commands.delete_at(index) if index\n end", "title": "" }, { "docid": "ca28bdb03693cc2efbbbb46a52bad8aa", "score": "...
b55175e63edd25f4f7110bd2abd96aae
=begin encrypt data =end
[ { "docid": "69b17aefe508bdc6efef589fbd8203a3", "score": "0.7471131", "text": "def encrypt(data)\n\tarray = splitencrypt(data)\n\tencryptedBlock = ''\n\tfor i in 0...array.length\n\t encryptedBlock << @blowfish.encrypt_block(array[i])\n\tend\n\treturn encryptedBlock\n end", "title": "" } ]
[ { "docid": "b942be72dc3a984ca50d24e7b41b666f", "score": "0.776877", "text": "def encrypt; end", "title": "" }, { "docid": "c833f7cb0c7a14840d77cfc75e36de09", "score": "0.71614", "text": "def encrypt(data)\n _encrypt(data, \"#{NOT_SEARCHABLE.chr}\\0#{@key_id.chr}\\0\")\n ...
3e6afc8f5d6bbb173744b0d53056c50f
Instance Method to return an array of FarMar::Sale instances associated with the product_id.
[ { "docid": "913bb1e476688da5fa6af792765c0fa4", "score": "0.78480536", "text": "def sales\n product_id = self.id\n all_sales = FarMar::Sale.all\n product_sales = all_sales.find_all {|p| p.product_id == product_id}\n return product_sales\n end", "title": "" } ]
[ { "docid": "c06fd73d2f46d4a0cb1453084eff116b", "score": "0.8581759", "text": "def sales\n return array_of_instances(FarMar::Sale.all, \"product_id\", product_id)\n end", "title": "" }, { "docid": "2c5af9aecc2615028182cfb4dbe01806", "score": "0.81305146", "text": "def sales\n s...
7095c2ba19eb9c746dafbd3f729e85be
default is add operation
[ { "docid": "b13e97ef68ce892f2528df746c0c0550", "score": "0.0", "text": "def my_calculate(*params)\n\n puts \"\\nStarting....\"\n\n operations = {}\n operands = []\n\n \n params.reverse.each do |p|\n\n puts \"param p is #{p.inspect}. Its class is #{p.class}\"\n\n #determine what p is\n oper...
[ { "docid": "8f71659614d193939f8fde552f6b65f4", "score": "0.8231932", "text": "def add \n end", "title": "" }, { "docid": "2c799b0dcd5b1905a0a63a66ebc2c5c2", "score": "0.8197718", "text": "def add\n end", "title": "" }, { "docid": "2c799b0dcd5b1905a0a63a66ebc2c5c2", ...
90ae455e00523b6c260807c3bab7b601
GET /recettes/1 GET /recettes/1.json
[ { "docid": "1dc89b333a1faddec02f115dfd0cddf5", "score": "0.6467255", "text": "def show\n @recette = Recette.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @recette }\n end\n end", "title": "" } ]
[ { "docid": "8834d8efeb766be337366e5b97600a76", "score": "0.7052012", "text": "def show\n @receipe = Receipe.find(params[:id])\n\n render json: @receipe\n end", "title": "" }, { "docid": "6e3654e06e02e365524391e29ed99f27", "score": "0.68641746", "text": "def show\n @resposta...
266921ba7f1ab24a46d3941a5938eb2f
DELETE /correo_plantillas/1 DELETE /correo_plantillas/1.xml
[ { "docid": "43ecb1a3efac7074ec66568c541f2cbb", "score": "0.74277204", "text": "def destroy\n @correo_plantilla = CorreoPlantilla.find(params[:id])\n @correo_plantilla.destroy\n\n respond_to do |format|\n format.html { redirect_to(correo_plantillas_url) }\n format.xml { head :ok }\n ...
[ { "docid": "f652b9b9af589a5e20da45b920fd40aa", "score": "0.7212611", "text": "def destroy\n @correspondencia = Correspondencia.find(params[:id])\n @correspondencia.destroy\n\n respond_to do |format|\n format.html { redirect_to(correspondencias_url) }\n format.xml { head :ok }\n en...
d6809b59eee28fd330b49a838fe9a46c
Just like _low_card_association, but returns nil when an association is not found, rather than raising an error.
[ { "docid": "c24ac2d5b0dab0637f54faf9f25746ac", "score": "0.7535762", "text": "def maybe_low_card_association(name)\n out = @associations.detect { |a| a.association_name.to_s.strip.downcase == name.to_s.strip.downcase }\n out ||= superclass_low_card_associations_manager.maybe_low_card_assoc...
[ { "docid": "648286d1cfb3b8ac9acc40fc8985dcc9", "score": "0.6618744", "text": "def rubyamf_retrieve_association association\n # Naive implementation that should work for most cases without\n # need for overriding\n send(association)\n end", "title": "" }, { "docid": "6e4cacd...
61351ff55669cfa6de0cc29df51aa269
puts newArr.inject(0, :+) PRIMES 1) Write a method called check_prime? that will test whether a number is Prime. The method will return true if Prime, false if not.
[ { "docid": "596bb07bb647cd97dcab46fbe8fb3d4b", "score": "0.0", "text": "def check_prime num\n require 'prime'\n return Prime.prime?(num)\nend", "title": "" } ]
[ { "docid": "11144f104d411555e1cdd5962085990c", "score": "0.77045435", "text": "def prime? (number)\n if number < 2 \n return FALSE\n elsif number == 2 || number == 3\n return TRUE\n end\n \n#creates new array and stores all numbers less than given number. Divides the number by all numbers...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "73580a4e9a6d9f860d6e7d09da06abee", "score": "0.0", "text": "def set_material\n @material = Material.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...
816cfbff49bf0dc809a695582d716ef4
Returns a string consisting of the constraint's id, followed by a colon, followed by the constraint's name.
[ { "docid": "93813e71aa6eaed0d1e5bc1a448ede73", "score": "0.0", "text": "def to_s\n \"#{@id}:#{@name}\"\n end", "title": "" } ]
[ { "docid": "1e8c6061146713279fbe73f21bf189c7", "score": "0.6921447", "text": "def constraint_name(table, field)\n \"fk_#{table}_#{field_list_name(field)}\"\n end", "title": "" }, { "docid": "79b4d9f359e62627711eafdfbbabc371", "score": "0.68799055", "text": "def foreign_key_nam...
af23f4e0c3790ef8841ef76f052424ce
get the offset from the main loop for the zigzag lines as stepover gets bigger, so the chance of missing bits around the edge inscreases, so make the offset smaller for large stepovers
[ { "docid": "6dd5c2abadafa3d09dd046fc1e3b1491", "score": "0.7108138", "text": "def getOffset\r\n div = (@stepOver >= 0.75) ? 3 : 2\r\n if (@stepOver >= 0.85)\r\n div = 4\r\n end\r\n if @keyflag == 1\r\n offset = @bit_diameter * @stepOver / div\r\n else\r\n ...
[ { "docid": "1ae3582557c3e45ab055bf5b4ba3a9d7", "score": "0.6401272", "text": "def pos_step_offset\n frontstep = @pattern == low_pattern_num\n case facing_direction_sub\n when 2\n frontstep ? [-HorzOffset, 0, false] : [HorzOffset, 0, true]\n when 8\n frontstep ? [HorzOffset, -VertLe...
5a1e52c55cf3df615175207e0b1b8ae7
Updates a draft message
[ { "docid": "6c09e415ad42fc0af48c92d19e583f43", "score": "0.66459864", "text": "def update_draft(recipients, msg_body, subject, attachment = nil, reply = false, should_clean = true)\n self.body = msg_body\n self.subject = subject\n self.attachment = attachment\n\n self.clean if shoul...
[ { "docid": "3c999d798d4b61b56957950716306e99", "score": "0.7496282", "text": "def update\n # find and update a specific message\n end", "title": "" }, { "docid": "cfc3576b1fed842c94e40cd8890c3750", "score": "0.737302", "text": "def update\n # find and update a specific mes...
841ce6741fcea6ea93e3ae9bacf67cef
Shows the login form.
[ { "docid": "69bd67d398d0f39669e725e51e0710e0", "score": "0.0", "text": "def new\n end", "title": "" } ]
[ { "docid": "08fdb97114e37cd374b81180f188768a", "score": "0.79620403", "text": "def login\n # show LOGIN form\n\n end", "title": "" }, { "docid": "f15c79bfd4968545eb3943bc75928b2f", "score": "0.7435875", "text": "def new\n \t# Renders view page for new login form\n end", "ti...
27d61ae75d0b1e1ae065c09f1fcb81fa
assert that the given actions are not being cached
[ { "docid": "349e30706e0e121b509ef1d62e3c2b28", "score": "0.8073182", "text": "def assert_not_cache_actions(*actions)\n \n fragment_cache_store.clear\n \n yield *actions\n \n raise NoRequestInBlockError.new(\"no request was send while executing block.\") if @controller.nil?\n \n...
[ { "docid": "f490f9f50f17361f678d7b6a8a6f9c35", "score": "0.82690716", "text": "def assert_cache_actions(*actions)\n check_options_has_controller(actions) if self.is_a?(ActionController::IntegrationTest)\n \n cache_store.reset\n \n yield *actions\n \n raise...
23bca9a01df6df10edc91f6d1b9383e6
Returns the value of attribute attributes. source://language_serverprotocol//lib/language_server/protocol/interface/workspace_symbol_registration_options.rb28
[ { "docid": "95ffebd9cbd702368807cff490fedf3e", "score": "0.0", "text": "def attributes; end", "title": "" } ]
[ { "docid": "d94790ef70842d38d45d677f13271991", "score": "0.63363135", "text": "def attribute_options(name)\n attributes[name.to_sym]\n end", "title": "" }, { "docid": "49f69d63844cb4ee05062935ade98003", "score": "0.6295802", "text": "def attributes\n %i[value]\n e...
c15e65cba05118a461c9ed6bb6736763
to solve binary search using a while loop to drive the search.
[ { "docid": "ec93c95ad01f4e4efd8bde2eeeb526ce", "score": "0.0", "text": "def chop(int, array)\n low = 0\n high = array.length - 1\n mid = array.length / 2\n i = 0\n\n while i < array.length\n if array[mid] > int\n high = mid\n mid = (high - low) / 2\n elsif array[mid] < int\n lo...
[ { "docid": "38d602a86ff5e4f6ab7c285d7728cb8b", "score": "0.7206824", "text": "def binsearch(ary, x)\n left = 0\n right = ary.length - 1\n while left < right\n middle = (left + right) / 2\n Tanj.array :ary, index: [:left..:right, :middle]\n if ary[middle] == x\n Tanj.message \"found it!\...
fda169e60a37a592ff44f3d7a9901b94
initialize the current lookup class for lookup use if it isn't already NOTE: early edition of this gem assumes id, name columns. FUTURE will allow more flexibility through configuration
[ { "docid": "c411ef74da68690a234ef75b3e9ba3bc", "score": "0.7096304", "text": "def acts_as_lookup_initialize\n Thread.exclusive do\n # double-check in case of race condition in calling code\n unless self.acts_as_lookup_initialized?\n if acts_as_lookup_options[:sync_with_db]\n ...
[ { "docid": "6fc192cc6d2a50cdb2e508856f1bfcfb", "score": "0.67972785", "text": "def instantiate_lookup(name); end", "title": "" }, { "docid": "ad9125127a4ea4d28657e9c15d04481c", "score": "0.6754108", "text": "def initialize(lookupds)\n @lookupds = lookupds\n end", "title":...
8907f019e73396679503244c25a05043
swift: class SingBase def self.value2 10 end end
[ { "docid": "3d029f9ccd7dbb92c635367a9f4267d6", "score": "0.0", "text": "def test_ston_overridden\n v1 = SingDerived.value2\n raise \"Bad value #{v1}\" unless v1 == 10\nend", "title": "" } ]
[ { "docid": "606c4aa2464af00d9b64b8e1b15b1ecb", "score": "0.62634325", "text": "def initialize(value); end", "title": "" }, { "docid": "cffb303713d86bc7ae15f08f8d6ded2a", "score": "0.624776", "text": "def val; end", "title": "" }, { "docid": "cffb303713d86bc7ae15f08f8d6ded...
a80cdec27a395d0fbae79c82f0c89efd
Sends an email with the contents of the contact form
[ { "docid": "45cdf53bf9b55e64b87af1b8e45f0e90", "score": "0.0", "text": "def send_contact_email\n UserMailer.contact(self).deliver_now\n end", "title": "" } ]
[ { "docid": "421e3a058b7bba5fb235ce48070bc9f2", "score": "0.7580431", "text": "def contact_form_message message\n @message = message\n\n mail(:subject => 'Contact Form', to: 'sean@seansehr.com')\n end", "title": "" }, { "docid": "12f187d7420cb3489ef46976c336f7d7", "score": "0.74878...
6f776809df8f4dc933bfe60134df0221
edit a task. this prepares the edit task form for the user to fill out
[ { "docid": "716f50c66126860a24ac94586cf0852d", "score": "0.76076293", "text": "def edit\n\t\t@task = Task.find(params[:id])\n\t\t@tags = @task.tags\n\n\t\t#as tasks are referred to in the url by an integer id, it might be possible for a user to view and modify\n\t\t#the tasks of another user. this condi...
[ { "docid": "a310ccb34e75ee06df177ebdba5d319a", "score": "0.84546256", "text": "def edit\n #Tasks will be set each time we have an edit. Since form is set based on @tasks, the form will be different each time. \n @task = Task.find params[:id]\n end", "title": "" }, { "docid": "36c68c62...
d3018d3de8c2fd1c4e1502b0b4803cc6
Adds a decision to the trace.
[ { "docid": "ebbcd7f22b3dc3ddd9f9d6eea1f5012b", "score": "0.7293033", "text": "def trace_decision(decision)\n response.trace << {type: :decision, decision: decision} if trace?\n end", "title": "" } ]
[ { "docid": "349396817c7f1f094196cb165213c141", "score": "0.62641937", "text": "def decision=(value)\n @decision = value\n end", "title": "" }, { "docid": "d70e68bbbe3e6bddffc617e1d0e514bb", "score": "0.6077542", ...
b3d69d142ca32d81f7bd7a6a248ee880
This method will update the existing micr record with aba_routing_number and payer_account_number from UI.
[ { "docid": "c69b83df29cf0c2eb11319cdcab9cae3", "score": "0.72214705", "text": "def update_micr_record\r\n @micr_exists = MicrLineInformation.find_by_aba_routing_number_and_payer_account_number(@aba_routing_number_frm_ui, @payer_account_number_frm_ui)\r\n if @micr_exists\r\n @check_information...
[ { "docid": "2037c8ef575ce291ffd3a6f2eb0c0dcc", "score": "0.6462105", "text": "def change_micr_reference\r\n @micr_exists = MicrLineInformation.find_by_aba_routing_number_and_payer_account_number(@aba_routing_number_frm_ui, @payer_account_number_frm_ui)\r\n if @micr_exists\r\n @check_informati...
7125fa54273caa7ce97c9045de99c6e7
PATCH/PUT /shops/1 PATCH/PUT /shops/1.json
[ { "docid": "a2c81b7acb6ca7c5d3729fbb7e78ff4d", "score": "0.5775577", "text": "def update\n respond_to do |format|\n if @shop.update(shop_params)\n format.html { redirect_to @shop, notice: 'Shop was successfully updated.' }\n format.json { render action: 'show', status: :ok, locatio...
[ { "docid": "e935208c66e79fd8f2be052bbf8fd8a9", "score": "0.6854453", "text": "def update_many\n if @shops.update_all(shop_params)\n render json: @shops, status: :ok, location: shops_url\n else\n render json: @shops.errors, status: :unprocessable_entity\n end\n end", "title": "" ...
3c10da98bb3e4daabe36996307aa8935
Initializes the log file parser instance. It will apply the language specific FileFormat module to this instance. It will use the line definitions in this module to parse any input that it is given (see parse_io). format:: The current file format instance options:: A hash of options that are used by the parser
[ { "docid": "c06fd446b238e6cee81be3642d4caa3d", "score": "0.74876773", "text": "def initialize(format, options = {}) \n @line_definitions = {}\n @options = options\n @source_files = options[:source_files]\n @parsed_requests = 0\n @requests = []\n \...
[ { "docid": "297153eb9864e287e8696929fe2a5926", "score": "0.7765948", "text": "def initialize(format, options = {}) \n @line_definitions = {}\n @options = options\n @parsed_lines = 0\n @parsed_requests = 0\n @skipped_lines = 0\n @current_io = nil\...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "1184161c62ff79a9a8c6a951ab5e6eee", "score": "0.0", "text": "def set_product\n @product = Product.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;...
a8757c6b8274758a53b70faf853b3d2c
This is the standard company presearch. Primarily it saves any non company fields prior to the search option so they are not lost on the object it can optionally validate the object
[ { "docid": "e87064b4fa0235bf6e65b01b6948389b", "score": "0.68054813", "text": "def wizard_company_pre_search(wizard_cached_object, wizard_page_object, overrides, validate)\n wizard_params = resolve_params(overrides)\n unless wizard_params.nil?\n merge_params_with_object(wizard_page_object, wi...
[ { "docid": "a7fa4b0fc0a46c4ed88fe7da0ba3c266", "score": "0.6673727", "text": "def wizard_company_search(wizard_cached_object, wizard_page_object, overrides)\n # Special POST and GET - Find Company\n search_for_companies if wizard_company_pre_search(wizard_cached_object, wizard_page_object, overrid...
436c92814873e10cb991787d103397d7
PATCH/PUT /reviews/1 PATCH/PUT /reviews/1.json
[ { "docid": "66724b8c6cc6a794eb94712b4867f995", "score": "0.0", "text": "def update\n unless @review.user == current_user or current_user.instructor_for?(@review.assignment.course)\n redirect_to @review.assignment, alert: \"You can only edit reviews you wrote.\"\n end\n\n # raise params.ins...
[ { "docid": "455cbeca2c9c63464a2e59c7d084acd4", "score": "0.7329756", "text": "def update\n @review.update!(review_params)\n\n render json: @review\n end", "title": "" }, { "docid": "4806851221678163d44d95394231929b", "score": "0.73006445", "text": "def update\n review = Rev...
f0c8ebc080c48c2f260ffb43b1834e56
GET /products/1 GET /products/1.json
[ { "docid": "5d9434b62419507584a3af76af76c4a9", "score": "0.0", "text": "def show\n @title=@product.name\n @cart_item = @current_cart.cart_items.new(product_id: @product.id, quantity:1)\n end", "title": "" } ]
[ { "docid": "b4b28cd3d622f32a8398a02f689e4baf", "score": "0.7935314", "text": "def get_product\n product = Product.find(params[:product_id])\n json_response(product)\n end", "title": "" }, { "docid": "a06eb43eff1d37c3950104b8608b37f8", "score": "0.7777529", "text": "def show\n ...
1379281a30aab9189e854ac06cc4dc27
Evaluate the free space on the file system. Runs the command "df" and creates a map containig information about used and free space on every partition. Free space is calculated respecting the spare_percentage given in second argument.
[ { "docid": "97980698e80261211a22c6ff14e775fa", "score": "0.8315697", "text": "def EvaluateFreeSpace(spare_percentage)\n partition = []\n # the sizes are in kB\n min_spare = 10 * 1024 # 10 MB\n max_spare = 1024 * 1024 # 1 GB\n\n target = Installation.destdir\n\n # get inform...
[ { "docid": "b7c32854e6c4b7d8c58c45b6d8ce7208", "score": "0.7318055", "text": "def disk_space()\n\n instructions = 'df -h'\n r = @ssh ? @ssh.exec!(instructions) : `#{instructions}`\n\n @results[:disk_usage] = {}\n\n a = r.lines.grep(/\\/dev\\/root/)\n\n puts ('a: ' + a.inspect).d...
5b3596b4c20bd9dbd90992908ab1174f
either good or combo (or blank)
[ { "docid": "d6a47f1341b1a2e876ed6ff771fcab20", "score": "0.5690404", "text": "def initial_selection\n first_good = question_stats.ascending.good_selected.first\n first_combo = question_stats.ascending.combo_selected.first\n\n if first_good || first_combo\n [first_good, first_combo].find_al...
[ { "docid": "d0df960e92ddd332f792974ffa467bda", "score": "0.61969805", "text": "def chosen_baptized_at_home_parish?\n show_empty_radio == 1 || show_empty_radio == 2\n end", "title": "" }, { "docid": "ac55ac394da6269d9ea434156d6087f6", "score": "0.60381025", "text": "def chosen_bap...
4eaaea8a089c67f908e8a6e45998ba1d
get the number of blocks that confirm this tx in the main chain
[ { "docid": "7fdecd8be80b2adee9f4374a7435f184", "score": "0.7687739", "text": "def confirmations\n return 0 unless get_block\n @store.get_head.depth - get_block.depth + 1\n end", "title": "" } ]
[ { "docid": "b30360cad27163bccd165a0abdc4e2cb", "score": "0.75763106", "text": "def confirmed_blocks\n eth_client.eth_block_number.to_i - self.block_number\n end", "title": "" }, { "docid": "5dd7a4747f2b4dcdaa57c458f82f7e99", "score": "0.72718674", "text": "def getblockcount\n ...
b542c7bb968e2210a99ab5079df4f7d5
GET /classpersonscores/1 GET /classpersonscores/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "6f2a5a0d4316e79ef1e18070743c2b8c", "score": "0.73606336", "text": "def index\n @classpersonscores = Classpersonscore.all\n end", "title": "" }, { "docid": "122f3dd6eea3a50d77bad2612fae3564", "score": "0.67178905", "text": "def index\n @scores = Score.all\n\n res...
a317a7fb35d8917bacce122417027374
Returns the ActiveRecord's option for :order i.e. ['attr1 [asc|desc]', 'attr2 [asc|desc]', ...]
[ { "docid": "c676dbe99a2d8836833027baea3c00c5", "score": "0.0", "text": "def sort_params\n return [] unless params['sort_by']\n\n orders = (params['sort_order'] ? params['sort_order'].split(\",\") : [\"\"])\n sort_order = params['sort_by'].split(\",\").zip(orders).collect do |attr, order|\...
[ { "docid": "5ce8461b03b587a8cf0e0cab8d3052d5", "score": "0.7450561", "text": "def order(order)\n attribute, order_type = order.gsub(/\\s+/, ' ').split(' ')\n raise 'Invalid attribute in order clause' unless (model.attributes.keys + ['id', 'created_at']).include?(attribute)\n\n attri...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "bfce5f87de24f081bf8820e373a19b6a", "score": "0.0", "text": "def set_report\n @report = Report.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...
cfac5dfb154cf003e81117bdab7e36f4
an alias for absolute_left
[ { "docid": "35bb3b079f51a19576cb767d2d2575ba", "score": "0.7718925", "text": "def left_side\n absolute_left\n end", "title": "" } ]
[ { "docid": "d6267ff03463fc567c5600d2d50e8841", "score": "0.82608974", "text": "def absolute_left\n @x\n end", "title": "" }, { "docid": "16d0519c5bcc41e9cb6dc56f985fbba5", "score": "0.7426265", "text": "def left\n origin.x\n end", "title": "" }, { "docid":...
08f44733be20eb760371f4f0b9fddffb
Return user options for collection of reports.
[ { "docid": "a24caa545e12b13570ae3f8a93927440", "score": "0.7644233", "text": "def user_options(reports)\n return User.where(\"id IN (?)\", field_options(reports, :user_id)).order(:employee_number).map {|u| [\"#{u.employee_number} - #{u.name}\", u.id]}\n end", "title": "" } ]
[ { "docid": "81dabe9153f5fbd334db2d0b33a994aa", "score": "0.66681546", "text": "def report_options\n {\n group: billing_group,\n user: user.guest?(store) ? nil : user\n }\n end", "title": "" }, { "docid": "aeec9a429b795bc1d3d9e700c46ee9b8", "score": "0.66048485", "tex...
5365950b40a6a814359463a7873f89ac
set items for query
[ { "docid": "f4b853b73fa7cc8bf3d132b20064e53c", "score": "0.0", "text": "def set_users\n \n columns=params[:columns]\n order=params[:order][\"0\"]\n search_list=User.attribute_names.select do |item|\n !@model_config[item].nil? && @model_config[item][\"searchable\"]\...
[ { "docid": "196229ee2b5d323eb4a136045010c2d5", "score": "0.59763634", "text": "def set_items\n @bill = Bill.find(params[:bill_id])\n end", "title": "" }, { "docid": "23dba7d3b9e4e39763b6c1c4283bda33", "score": "0.5925959", "text": "def set_item_list\n @item_list = ItemLi...
2dc91f3ad2800976eea95245758d00b2
Queries the API for the search term
[ { "docid": "fd14ca543d64fe310c756779562cb2a8", "score": "0.75553566", "text": "def search(search_term)\n search_options = options\n search_options[:query] = { 'keywords' => search_term }\n puts search_options\n self.class.get(\"/clips/search.json\", search_options)\n end", "ti...
[ { "docid": "b30660a7eb9a017c492118e636e3c036", "score": "0.8454368", "text": "def search(search_term)\n api.search(search_term)\n end", "title": "" }, { "docid": "649aacbf0d1636f740e3ebb3ad87cf69", "score": "0.77592283", "text": "def search(term)\n raise ArgumentErro...
96b0e72a96bee1b6db12b3d2bedc429d
Private method to define admin
[ { "docid": "221975d05f3a2e505b476a6f6a4d4fd0", "score": "0.0", "text": "def admin_user\n redirect_to(root_path) unless current_user.admin?\n end", "title": "" } ]
[ { "docid": "ee3ed234f4863daf711b690c0c13e6b1", "score": "0.8039458", "text": "def admin\n #TODO\n end", "title": "" }, { "docid": "64a70200e0aea56b7df3a3595f6dcd9d", "score": "0.8035515", "text": "def require_admin\n end", "title": "" }, { "docid": "c81a139b8bc978a89...
8be878add730bcf3c6642a8f58fadabd
=begin rdoc This method initiates the connection to the wAuth server.
[ { "docid": "875925807a759adc49168f7fff322e94", "score": "0.0", "text": "def _startConnection()\r\n #puts \"startConnection() called.\"\r\n valid_tag = \"ACCEPT\";\r\n # The client initiates the transaction\r\n mesg = \"CONNECT: WiKID Ruby Client v#{@@VERSION}\"\r\n mes...
[ { "docid": "855586aa166959557ae10454ad71a25e", "score": "0.64998657", "text": "def initialize\n\t\t@auth = {\n\t\t\t:username=>ENV['impac_username'], \n\t\t\t:password=>ENV['impac_password']\n\t\t}\n\tend", "title": "" }, { "docid": "ea20fd532063953fa411caeb759f1458", "score": "0.6389289...
6501b3bbb70ccf75e2b07b4143b87621
Tracks when a user submits OTP code sent to their phone
[ { "docid": "7860b7dcfe3d0d149ed6eeee2a9098ba", "score": "0.6868285", "text": "def idv_phone_otp_submitted(success:, phone_number:, failure_reason: nil)\n track_event(\n :idv_phone_otp_submitted,\n success: success,\n phone_number: phone_number,\n failure_reason: failure_...
[ { "docid": "68cee09426160ffbe5be477ace4e5785", "score": "0.7097348", "text": "def perform(code:, phone:, otp_created_at:, locale: nil)\n send_otp(TwilioService::Utils.new, code, phone) if otp_valid?(otp_created_at)\n end", "title": "" }, { "docid": "2bdcedf6b6602b862b1ce9695ad9da0a", ...
7014fb4498c7cd736bc0b02a75d794c9
Show the connect page method: GET
[ { "docid": "6c4606e257faf502424718cd40b42638", "score": "0.0", "text": "def show\n respond_to do |format|\n format.html\n end\n end", "title": "" } ]
[ { "docid": "cf06302bfac61e5b1a66df4691b4a72e", "score": "0.7130452", "text": "def GET; end", "title": "" }, { "docid": "a168b5d0f18058a54300b55543730d49", "score": "0.69105536", "text": "def GET \n puts('GET')\n render plain: 'GET'\n end", "title": "" }, { ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "d09f58bfda888f919ee7a122a16efd1b", "score": "0.0", "text": "def titulo_params\n params.permit(:diploma, :resolucion, :fecha_grado)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.7121987", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70541996", "text": "def expected_permitted_parameter_names; end", "title": "...
d253153695f10e01219d4cf65e9b9ae7
Returns the options that should be run in order to ssh to a virtual machine
[ { "docid": "7dc56d0a7f4ae8ada0897640298ba61e", "score": "0.7307197", "text": "def ssh_options(_machine)\n raise 'Do not use the Driver class directly, it is intended that it '\\\n 'should be inherited from.'\n end", "title": "" } ]
[ { "docid": "367df0c85f48440fbb91b52dbbd3531e", "score": "0.74296254", "text": "def ssh_options\n keys_option + host_key_check_options\n end", "title": "" }, { "docid": "e4558317b7ff139de9c004d4ca5a850e", "score": "0.7287382", "text": "def ssh_options\n {} # override and do...
4ff3d4ac25edba8f41efe85ecc4e1b0b
6. Write a loop to list out all the supplies you have for each holiday and the season. Output: Winter: Christmas: Lights and Wreath New Years: Party Hats
[ { "docid": "ffc973bbc36401a104003d6cbba8f2b2", "score": "0.8109704", "text": "def list_supplies(holiday_supplies)\n holiday_supplies.each do |season, holidays|\n puts season.to_s.capitalize + \":\"\n holidays.each do |holiday, supplies|\n holiday = holiday.to_s.split('_')...
[ { "docid": "adafb25adc6c78ae5af3e207a69ee3d9", "score": "0.80350137", "text": "def list_supplies_by_season(holiday_supplies)\n holiday_supplies.each do |season, holidays_hash|\n puts \"#{season.to_s.capitalize}:\"\n holidays_hash.collect do |holiday, supplies_array|\n pretty_holiday = holida...
f67fd9ab5bee239eab286f1eedbf04d2
GET /map_areas/new GET /map_areas/new.xml
[ { "docid": "27a6d0f99a763b8b99ab7f93c0e2f9e8", "score": "0.6814642", "text": "def new\n @map_area = MapArea.new\n @start = GeoLoc.new(:lat=>40.010492, :lng=> -105.276843)\n @zoom= 14\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @map_area }\n ...
[ { "docid": "f408e9eb271b3ace451fbe98e76162ad", "score": "0.73611414", "text": "def new\n @area = Area.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @area }\n end\n end", "title": "" }, { "docid": "9840a0c25740b0530079e4525c...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5c577f364dbb716da445a1a1e016b0b2", "score": "0.0", "text": "def switch_params\n params.require(:switch).permit(:name, :reference, :price, :nports, :port, :numerodepuertos,\n :puerto1,:puerto2,:puerto3,:puerto4,:puerto5,:puerto6,:puerto7,:puerto8,:puerto9,:puerto10,:puerto11,\n ...
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
47a7eff4e348a5a11d9ad9ff4150c64d
Escapes all entities in string except for "", "&", """, and "'".
[ { "docid": "baca33b730587211c158195c5bc6e4a1", "score": "0.721297", "text": "def normalize_entities(string)\n # Convert '&' to '&amp;' only if it's not followed by an entity.\n string.gsub(/&(?!lt|gt|amp|quot|apos)/, '&amp;')\n end", "title": "" } ]
[ { "docid": "08b0200e586196ed8a406f1db19ec6f4", "score": "0.78271276", "text": "def esc(str)\n str = str.to_s.gsub(\"&\", \"&amp;\")\n str = str.gsub(\"\\\"\", \"&apos;\")\n str = str.gsub(\"\\\"\", \"&quot;\")\n str = str.gsub(\"<\", \"&lt;\")\n str.gsub(\">\", \"&gt;\")\nend", "title": ""...
be2a9240d1d8111c053232e162bd7a8c
This API is used to reset pin using security question answer and email.
[ { "docid": "5dc021e83ef9d0eb27a711df9523f2fe", "score": "0.81569517", "text": "def reset_pin_by_email_and_security_answer(reset_pin_by_security_question_answer_and_email_model)\n if reset_pin_by_security_question_answer_and_email_model.blank?\n raise LoginRadius::Error.new, getValidationMess...
[ { "docid": "255eb642a7c57003e448ad8e036ee4dd", "score": "0.7896428", "text": "def reset_pin_by_phone_and_security_answer(reset_pin_by_security_question_answer_and_phone_model)\n if reset_pin_by_security_question_answer_and_phone_model.blank?\n raise LoginRadius::Error.new, getValidationMessa...
c76c5ed3a4903c078a9c9fd5e752721a
Check if an item is completed; return boolean.
[ { "docid": "f1859cfb9e4db899f478070e2b3b6b8f", "score": "0.77447844", "text": "def completed?\n @completed_status == true\n end", "title": "" } ]
[ { "docid": "c4e12dad1e0167b68891de3a8c6c6462", "score": "0.8864413", "text": "def completed?\n return @items.all? {|item| item.completion_status == true}\n end", "title": "" }, { "docid": "c4e12dad1e0167b68891de3a8c6c6462", "score": "0.8864413", "text": "def completed?\n retur...
f2449388abcd7dd5739f279762200e70
fulfilled_by? receives exactly one contract, and returns true/false if the inspected object responds to the same methods indicated by the contract's clauses.
[ { "docid": "ccdb578e1420ee16e6af810576f83b3f", "score": "0.68830585", "text": "def fulfilled_by?(contract)\n contract.each_clause do |clause|\n clause.legal_assesment(@subject).tap do |lawyer|\n unless lawyer.satisfied?\n @satisfied = false\n @messages << lawye...
[ { "docid": "a82bd530a273c4b06b445b9294a9da6e", "score": "0.6249786", "text": "def contract_notifications?\n contracts_as_buyer.each do |c|\n if c.under_negotiation && c.negotiation_receiver == self\n return true\n end\n if !c.decision_seen && c.negotiation_sender == self\n ...
17021e93c20a9285335fce78e6b8388a
Get last uploaded build version for a particular feature
[ { "docid": "f12b64575393926d8ab148ca76d3e1b7", "score": "0.6696834", "text": "def get_last_build_version(appName)\n appcenter_fetch_version_number(\n api_token: ENV['APPCENTER_API_TOKEN'],\n owner_name: ENV['APPCENTER_OWNER_NAME'],\n app_name: appName\n )\nend", "title": "" } ...
[ { "docid": "d9d382e2fcaed911af386aa76bf4d9e6", "score": "0.67845035", "text": "def latest_version\n files.last && files.last.versionnumber\n end", "title": "" }, { "docid": "7b257d1942d8fe26cbba9acf241ea1b1", "score": "0.6679482", "text": "def latest_version\n self.versions.or...
39bd45d16cdfa691827d231cf16a6c46
Fetch all unspent outputs per address.
[ { "docid": "c5e0317dc9a0dc73bb33bcd39c560e54", "score": "0.0", "text": "def utxos(_sources)\n raise Sibit::NotSupportedError, 'Not implemented yet'\n end", "title": "" } ]
[ { "docid": "bdcfb34ec23c8f017fe3ebb44562b196", "score": "0.74234736", "text": "def list_unspent(oa_address_list = [])\n btc_address_list = oa_address_list.map { |oa_address| oa_address_to_address(oa_address)}\n outputs = get_unspent_outputs(btc_address_list)\n result = outputs.map{|out| o...
47c7f990ec16dcb6f54230862e2c90be
GET /influencers/1 GET /influencers/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "544aada7f88d8d931587e72b7c5001f1", "score": "0.73321885", "text": "def index\n if params[:request_id]\n request = Request.find(params[:request_id])\n @influencers = request.influencers.page(params[:page]).per(50)\n else\n @influencers = current_user.influencers.page(para...
53315db7c935675995b3044ec27013e3
Check whether the temporal reference should be marked as inclusive
[ { "docid": "a96bac3f02e7a888399b978c9cfb982f", "score": "0.71581006", "text": "def inclusive_temporal_ref?\n # FIXME: NINF is used instead of 0 sometimes...? (not in the IG)\n # FIXME: Given nullFlavor, but IG uses it and nullValue everywhere...\n less_than_equal_tr = attr_val('../@highCl...
[ { "docid": "af9c1f4f13f3cdc2b7c707d8f94a9c17", "score": "0.6890546", "text": "def inclusive!\n @inclusive = true\n end", "title": "" }, { "docid": "4d2fd769047df710571142b83c4d5e83", "score": "0.6815615", "text": "def inclusive?\n !exclusive?\n end", "title": "" }, ...
d191d3680efca2f04679ebe845439230
=> true Book Answer: Algorithm: Chop off digits from the end of the number one by one Add each number to an array return the array.
[ { "docid": "dbbc56a2f47f8c97dc573484062f9eb9", "score": "0.65690595", "text": "def digit_list(number)\n digits = []\n loop do\n number, remainder = number.divmod(10)\n digits.unshift(remainder)\n break if number == 0\n end\n digits\nend", "title": "" } ]
[ { "docid": "91f24851c3daf7c6eeed3b826dd7abe7", "score": "0.71970296", "text": "def break_num(num)\n num_sarr = num.to_s.chars\n num_length = num.to_s.length\n num_broken_arr = []\n loop do\n dec = 10**(num_length - 1)\n num_broken_arr[num_length-1] = num_sarr[-num_length].to_i * dec\n num_...
b0d10706442d048cc800fe87b11e2aad
DELETE /geo/countries/1 DELETE /geo/countries/1.xml
[ { "docid": "eec2b3e8c2ad1dd386d397b1486a9e30", "score": "0.7278827", "text": "def destroy\n @geo_country = Geo::Country.find(params[:id])\n @geo_country.destroy\n\n respond_to do |format|\n format.html { redirect_to(geo_countries_url) }\n format.xml { head :ok }\n end\n end", ...
[ { "docid": "67a197e4e7e8fc9bc62b1ff240193698", "score": "0.6954144", "text": "def destroy\n @countries = Countries.find(params[:id])\n @countries.destroy\n\n respond_to do |format|\n format.html { redirect_to(countries_url) }\n format.xml { head :ok }\n end\n end", "title": "...
310359c9dcb34edf103fe43922a9106c
The +money+ amount is not used. The entire amount of the initial authorization will be captured.
[ { "docid": "0da1ca4716018ab9264bae16011530d0", "score": "0.0", "text": "def capture(money, reference, options = {})\n post = {}\n add_reference(post, reference)\n commit(:capture, post, SOURCE_CARD)\n end", "title": "" } ]
[ { "docid": "9341b36818f9a9b6434a7c90b03e246f", "score": "0.7303824", "text": "def capture(money, authorization, options = {})\n create_transaction(authorization, {:type => :prior_auth_capture, :amount => \"%.2f\" % (money / 100.0)})\n end", "title": "" }, { "docid": "3e735a372eaf...
ce855e49a2966d35d270b22c2228de77
used to hide characters in hangman.
[ { "docid": "d05336698d8002d61d1bca47aa19b0b1", "score": "0.0", "text": "def fill_in_the_blanks(guessed = '')\n\t remainder = ('A'..'Z').to_a + ('0'..'9').to_a - guessed.upcase.split(//)\n \tanswer.upcase.tr(remainder.to_s, '_')\n end", "title": "" } ]
[ { "docid": "55079d54c1d11034271baaf6067ed73d", "score": "0.73546207", "text": "def hidden_word(word, char)\n\t\t@hide = ''\n\t\tword.chars { |letter|\n\t\t\t@hide += (char.include? letter)? letter : \"_\" }\n\t\t@hide\n\tend", "title": "" }, { "docid": "1c627d158adadb722ef6801025a460fc", ...
2e0f9bd9c29a4c1341f57dcc7c34b9e6
think of these fields as actually only on Person
[ { "docid": "3ad97c784ce48c529f584a35e3de63e7", "score": "0.0", "text": "def partyize\n self.becomes(Party)\n end", "title": "" } ]
[ { "docid": "4a7515581181740360a35f110b623e39", "score": "0.6582062", "text": "def person_fields\n [ :id, :first_name, :last_name, :date_of_birth, :license, :gender, :city ]\n end", "title": "" }, { "docid": "43f8dcc644c79479900cb4cfd32e22e3", "score": "0.6128488", "text": "d...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "008aa0575f099ed92e03059ffd8b607b", "score": "0.0", "text": "def studio_params\n params.require(:studio).permit(:business_name, :location, :blurb, :format, :image_url)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
129bc5245455cb62c74bdc8ddf968013
Query the hierarchy out of the ancestors
[ { "docid": "5ef13d988aace8ea077b58845a20abfd", "score": "0.0", "text": "def lineage(db, commit_id)\n db.exec_params <<-SQL, [commit_id]\n WITH\n RECURSIVE ancestors (depth, id) AS (\n SELECT 0::integer, $1::integer\n\n UNION ALL\n\n SELECT prev.depth+1, crnt.parent_id\n ...
[ { "docid": "3a8e9d5bb1e3a3ce5941b4d24306e981", "score": "0.7495008", "text": "def ancestors\n get_class.all(scope_hash.merge(:lft.lt => lft, :rgt.gt => rgt, :order => [:lft.asc]))\n end", "title": "" }, { "docid": "78f18f46859d9ecf1716c84afbecc634", "score": "0.7488156", ...
c500251ff5f12b1be99cf20f93c013fc
This function parse the extension of the requested file and then looks up its content type
[ { "docid": "9cd990845ea1f43baab03a55abeef959", "score": "0.71118355", "text": "def content_type(path)\n\text = File.extname(path).split(\".\").last\n\tCONTENT_TYPE_MAPPING.fetch(ext, DEFAULT_CONTENT_TYPE)\nend", "title": "" } ]
[ { "docid": "f7076d74bf971d6ecedbca9fe1cb5b94", "score": "0.7963655", "text": "def recognize_content_type file\n ext = file.split('.')[-1].downcase # extract the file's extension\n if ext == 'jpg' or ext == 'jpeg' then # image\n return 'image/jpeg'\n elsif ext == 'gif' then\n ...
8882ce54c09a86afac145c43971d390f
DELETE /messages/1 or /messages/1.json
[ { "docid": "8ee88d403ec6620f1c4fa12b2697586f", "score": "0.0", "text": "def destroy\n @message.destroy\n respond_to do |format|\n format.html { redirect_to messages_url, notice: \"Message was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title": ""...
[ { "docid": "c542774c2fdbed1e693050a501a3506d", "score": "0.7927258", "text": "def delete\n msg = @user.messages.find(params[:id])\n if msg.nil?\n render json_status_response(404, \"Message not found\")\n return\n end\n\n msg.destroy\n render json_status_response(200, \"Message d...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6a1cff332280b48d7b552849cd91ac70", "score": "0.0", "text": "def gcategory_params\n params.require(:gcategory).permit(:name, :desc, :group_id)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69811666", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782836", "text": "def strong_params\n params.requ...
5ea7a988f273a984df56e59921b581b6
ok, that args is s=actually pointless, we can just do this
[ { "docid": "e4653d151a3d93a41e5b5a89cdb23414", "score": "0.0", "text": "def print_two_again(arg1, arg2)\n puts \"arg1: #{arg1}, arg2: #{arg2}\"\nend", "title": "" } ]
[ { "docid": "80d8f3c1048c92e53ae143bedd8593fc", "score": "0.7632878", "text": "def args(*) end", "title": "" }, { "docid": "89340ebc7b01b9a7710ceba16a205d69", "score": "0.75913644", "text": "def args=(_arg0); end", "title": "" }, { "docid": "89340ebc7b01b9a7710ceba16a205d6...
afe3d8ccf5e2856709333bc7786807c6
return auth token once user is authenticated
[ { "docid": "f169023bf84cdfb097edb7a03e7df184", "score": "0.0", "text": "def authenticate\n auth_token =\n AuthenticateUser.new(auth_params[:email], auth_params[:password]).call\n user = User.where(email: auth_params[:email]).first\n json_response(auth_token: auth_token, role: user.role, em...
[ { "docid": "be7f0848da811d8593cdd0df66f18b5a", "score": "0.8222713", "text": "def auth_token\n generate_auth_token if @auth_token.nil?\n return @auth_token\n end", "title": "" }, { "docid": "be7f0848da811d8593cdd0df66f18b5a", "score": "0.8222713", "text": "def auth_token...
bbf46b976d927dea670e778e65995746
Remove, delete XML nodes and items matching XPath expression Return the reuslts of editing an XML document by removing all of the nodes that match an input XPath expression
[ { "docid": "04d201f8ecdca3db03391b519cb2f25a", "score": "0.0", "text": "def convert_data_xml_remove_with_x_path_with_http_info(x_path_expression, input_file, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ConvertDataApi.convert_data_xml_remove_wi...
[ { "docid": "5b2901983d7897ffa28efc8e90c57045", "score": "0.6742785", "text": "def convert_data_xml_edit_remove_all_child_nodes_with_x_path(input_file, x_path_expression, opts = {})\n data, _status_code, _headers = convert_data_xml_edit_remove_all_child_nodes_with_x_path_with_http_info(input_file, x...
e944362dbe9ddfd666a4392e9d8483fe
STRETCH croon seperates word characters with dashes preserves whitespace between words
[ { "docid": "075960b948a9db5e175bb66a1b1ff400", "score": "0.6233501", "text": "def croon(lyrics)\n lyrics.split(\" \").map {|lyric| lyric.split(\"\").join(\"-\")}.join(\" \")\nend", "title": "" } ]
[ { "docid": "733abfaf52f29ecafcd0a93238dce79f", "score": "0.7531863", "text": "def croon (word)\n word.split(\" \").map {|word| word.split(\"\").join(\"-\") }.join(\" \")\nend", "title": "" }, { "docid": "8b0fe027821f5637db39cb32a22d4e5b", "score": "0.744163", "text": "def croon (str...
d087b18ef23596d0e988e38ce3f4fb44
Get scene hidden entities.
[ { "docid": "212e7c9c6a3c50f8eabe346944f755f9", "score": "0.75553393", "text": "def hidden_entities\n @hidden_entities\n end", "title": "" } ]
[ { "docid": "f9969d2cddeffb64dd476360a5aca086", "score": "0.60436326", "text": "def use_hidden_entities?\n @use_hidden_entities\n end", "title": "" }, { "docid": "64b5b56807e17dda5f1a44c5b06c0285", "score": "0.60288507", "text": "def find_hidden\n self.all(:active => false, :...
4a2e3d4c9de439bd708cef42d408347c
close the connection and don't try to reopen it
[ { "docid": "446b8c80ada8e9970847d71aee575b90", "score": "0.6784554", "text": "def close\n stop_monitoring_connection\n close_connection\n end", "title": "" } ]
[ { "docid": "a55978ec438ba68f51b0678a213ba147", "score": "0.8206961", "text": "def close_connection; end", "title": "" }, { "docid": "6373970b06e74223daec62af296983f8", "score": "0.8107567", "text": "def close\n connection.close if connection\n end", "title": "" }, { "...
f6d7f939a55cf2b87c533423ca470aec
Returns the keyvalue pair in the SortedAssociation with the minimum key.
[ { "docid": "2956c796b31afc7e240bbf4ddb6987b9", "score": "0.0", "text": "def min\n\t\teach_pair ASCENDING do |pair| return pair end\n\tend", "title": "" } ]
[ { "docid": "7093ae7262eeae3d15b28f1f65c3f292", "score": "0.72877747", "text": "def min\n return nil if self.empty?\n min_k = self.keys.first\n min_p = self[min_k]\n self.each do | k, p |\n min_k, min_p = k, p if p < min_p\n end\n [min_k, min_p]\n end", "title": "" }, { ...
c6a56b68430ede559f2e7da6e359782e
Makes the use of a Cape block parameter optional by forwarding nonCape method calls to the containing binding.
[ { "docid": "f48537df90f57f224092ca65e28cb728", "score": "0.0", "text": "def method_missing(method, *args, &block)\n @outer_self.send(method, *args, &block)\n end", "title": "" } ]
[ { "docid": "341e0d8d7563f1d05104af07f961a54c", "score": "0.5827179", "text": "def optional_args_block_call(block, args)\n if RUBY_VERSION >= \"1.9.0\"\n if block.arity == 0\n block.call\n else\n block.call(*args)\n end\n else\n block.call(*args)\n ...
2d6b1e13c887ea4c1798006625be2685
Sets a new temporary message
[ { "docid": "046aed6f18ee0f393967d6131751d032", "score": "0.0", "text": "def show_message(msg)\n status_bar.show_message msg\n end", "title": "" } ]
[ { "docid": "46b7dc92f07f994fb244ed2da9d379b0", "score": "0.6386427", "text": "def set_message\n end", "title": "" }, { "docid": "ab225137002fe1868ee02690637f5a44", "score": "0.6252057", "text": "def send_temporary_message(content, timeout, tts = false, embed = nil)\n @bot.sen...
a1ad9910b3ffe317018e80f23e1586bc
Checks authorship of any sort of object
[ { "docid": "0248cdaaa9843195494b34c1acc564cd", "score": "0.6253078", "text": "def is_author_of?(item)\n if item.respond_to?(:user)\n self == item.user\n elsif item.respond_to?(:pseud)\n self.pseuds.include?(item.pseud)\n elsif item.respond_to?(:pseuds)\n !(self.pseuds & item.pseu...
[ { "docid": "1eddec16870d9c819f6135a4b27a3487", "score": "0.6976931", "text": "def author_of?(object)\n object.user_id == id\n end", "title": "" }, { "docid": "3ea8f4aab73a4c01df0071b1b1f4440f", "score": "0.65381116", "text": "def existance_of_author\n if author.nil? or not Use...
48b5dea56404aa03f4b77bfaab8b4a55
Send a password update link to users with a verified email
[ { "docid": "d91afd4fe87b855f75ee919c9082aef7", "score": "0.0", "text": "def create\n if user\n user.regenerate_verification_token\n MinimalistAuthenticationMailer.update_password(user).deliver_now\n end\n # always display notice even if the user was not found to prevent leaking user e...
[ { "docid": "fe8c4b08340371c788c4e388636fb30b", "score": "0.7771565", "text": "def update_password\n user = User.find_by(email: \"active@example.com\")\n user.regenerate_verification_token\n MinimalistAuthenticationMailer.update_password(user)\n end", "title": "" }, { "docid": "eee6...
9b338c697dd75dadaa029cc81026cb8e
PATCH/PUT /plc/courses/1 PATCH/PUT /plc/courses/1.json
[ { "docid": "405d4a4dd4a0dacbd870244910756b7a", "score": "0.0", "text": "def update\n if @course.update(course_params)\n redirect_to @course, notice: 'Course was successfully updated.'\n else\n render action: :edit\n end\n end", "title": "" } ]
[ { "docid": "b4b030568b02e5ba2a8d9955805c74d3", "score": "0.6977112", "text": "def update\n @course.update(course_params)\n render_jsonapi_response(@course)\n end", "title": "" }, { "docid": "e45c7b4cbcc3f12fae7de5ef3ea06891", "score": "0.68191385", "text": "def update\n @co...
746ed4edc3da163a0eccce346cfbf0c4
a tiny example of the power of the to_textual method
[ { "docid": "4dd3bd966e56f1bf7ea0dc563cde3661", "score": "0.0", "text": "def run_file\n IO.foreach(\"./lib/the_input.txt\") { |line| puts line.to_textual } \n end", "title": "" } ]
[ { "docid": "245e1d62ac3434992230919efd010d1d", "score": "0.6220613", "text": "def power_text\n power = base_power\n return text_get(11, 12) if power == 0\n\n return power.to_s\n end", "title": "" }, { "docid": "fd8d470a6e29fe9a00f13a342816638d", "score": "0.5781394", ...
552d5a21a927fa9d55de15be115b3828
SESSION CODE help with login code from
[ { "docid": "8f8d73281df0f661ca9caf77549cebd8", "score": "0.0", "text": "def logged_in?\n !session[:user_id].nil?\n end", "title": "" } ]
[ { "docid": "096656013ed38b7b1dbeeac711e44c18", "score": "0.7292909", "text": "def login; end", "title": "" }, { "docid": "aca6ce1973ad48453e0052624c18ecd9", "score": "0.7136421", "text": "def check_login\n \t\t\tif self.session == nil\n \t\t\t\t login\n \t\t\tend\n ...
4a989bd2849915cd01b8569d1920d00b
Returns the periods during the courses take place in the following format: `DAYPERIOD`. Example: `monday0` for a course taking place at 8AM on a monday.
[ { "docid": "c95105ccc8f9eb59df4239a49aa2af26", "score": "0.7165889", "text": "def planning_periods\n return [] if plannings.empty? or course.nil?\n\n periods = []\n course.plannings.each do |planning|\n next if planning.week_day.nil? or Date::DAYNAMES[planning.week_day].nil?\n course_...
[ { "docid": "ff89ae1aa5da090f3cf37b39f766a388", "score": "0.6902547", "text": "def periods\n \"#{period}s\".to_sym\n end", "title": "" }, { "docid": "c9daefff6b007abc9fc2adbdab37af7b", "score": "0.62413067", "text": "def periods\n @periods ||= HTMLScanner.new(thead).all(\"th\...
8db531d880a8fb4a2dad1e0072874097
POST /api/deposit/depositions/456/actions/publish Need to have gotten or created the deposition for this to work
[ { "docid": "706b8dfc0d876d71ffa33ce78e894066", "score": "0.61592567", "text": "def publish\n ZC.standard_request(:post, @links[:publish])\n end", "title": "" } ]
[ { "docid": "3e99b39975d34677b3056acee07aa33a", "score": "0.6437359", "text": "def publish_deposit_with_http_info(deposit_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ActionsApi.publish_deposit ...'\n end\n # verify the required pa...
12e1912e463b2a539d27226613ae7771
Calls +block+ once for each element in +self+.
[ { "docid": "f35066f85f852c13db389d592caec078", "score": "0.0", "text": "def each(&block)\n return to_enum unless block_given?\n \n unless empty?\n yield(head)\n tail.each(&block)\n end\n \n self\n end", "title": "" } ]
[ { "docid": "1772a4983713901508a2cdbab93f74d8", "score": "0.74562466", "text": "def each(&block)\n @items.each(&block)\n self\n end", "title": "" }, { "docid": "d3cef24bd02df53c4b184316b8179272", "score": "0.72936535", "text": "def each(&block)\n i = @elements.length - 1...
1e5ae272f003efe8a07c4d8c9928f3a2
POST /diagnostic_test_types POST /diagnostic_test_types.json
[ { "docid": "72e09c58c991305db862a726316fffc4", "score": "0.704503", "text": "def create\n @diagnostic_test_type = DiagnosticTestType.new(params[:diagnostic_test_type])\n\n respond_to do |format|\n if @diagnostic_test_type.save\n format.html { redirect_to diagnostic_test_types_path, not...
[ { "docid": "815442c829f36228281aab34595b9941", "score": "0.63711935", "text": "def create\n @med_diagnostic_test_type = MedDiagnosticTestType.new(params[:med_diagnostic_test_type])\n\n respond_to do |format|\n if @med_diagnostic_test_type.save\n format.html { redirect_to med_diagnostic...
35d3ba79b69b5031a58a0e8fe9c2358f
attr_reader and attr_accessor would allow users to check whether or not a Door is closed, check whether or not it is locked, and look at the writing on the Door if there is any. attr_reader ensures that once the writing (inscription) on a Door is set, it cannot be changed. I assume that the user must provide an inscrip...
[ { "docid": "179528f22a77a3785fa729de5a94ff4b", "score": "0.61194533", "text": "def initialize(inscription, is_open, is_locked)\n @inscription = inscription\n @is_open = is_open # open = true, closed = false\n @is_locked = is_locked # locked = true, unlocked = false\n\n # Make sure the user p...
[ { "docid": "74ce15cdf6d4ad4915a96cb870381bd5", "score": "0.63414985", "text": "def lock\n if self.open?\n raise TypeError.new(\"Open doors cannot be locked. Close the door and try again.\")\n elsif self.locked?\n raise TypeError.new(\"Door is already locked. Locked doors cannot be locked...
85058c017396759c9ffc7c0fb00f588b
GET /profiles/new GET /profiles/new.json
[ { "docid": "a375ebf3530b0a78a5648c135955dd68", "score": "0.79118806", "text": "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @profile }\n end\n end", "title": "" } ]
[ { "docid": "86dc04a7d97cc7f76f401d43204bef36", "score": "0.78278595", "text": "def new\n @profile = Profile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @profile }\n end\n end", "title": "" }, { "docid": "a475195de0499627ff1d...
4fd91b58cadde3aefc06c31b4cc64f04
Rule 2: If a word begins with a consonant sound, move it to the end of the word, and then add an "ay" sound to the end of the word.
[ { "docid": "727c63605e2a2f4729ba596535c7611a", "score": "0.0", "text": "def translate words\n\twords = words.split\n\tvowels = ['a','e','i','o','u']\n\tpig_latin = ''\n\twords.each do |word|\n\t\tindex = 0\n\t\tuntil (vowels.include?word[index] and (word[index-1]+word[index] !='qu'))\n\t\t\tindex+=1\n\t...
[ { "docid": "047ed2eb0537424a9e05ddcd81c8b54c", "score": "0.7686958", "text": "def translate(word)\n #if word begins with a vowel sound add an 'ay' to the end\n if Vowels.include?(word[0])\n word + 'ay'\n #if word begins with a cosonant sound, move it to the end of the word,and then add an \"ay...
b37829322b1295953288e5211952e771
Unpack will return a 64bit integer as two unsigned 32bit integers (most significant first). Translate to signed 64bit
[ { "docid": "25dd221440a8acee2935d258fc7a80fb", "score": "0.63124716", "text": "def make_signed_int64(high, low)\n unsigned = (high << 32) | low\n unsigned >= 0x8000000000000000 ? unsigned - 0x10000000000000000 : unsigned\n end", "title": "" } ]
[ { "docid": "5f8789dabf6e2f8316243a2a3caa54e4", "score": "0.702576", "text": "def pack_int64le(val); end", "title": "" }, { "docid": "399fd77c4c55e1fa44237125cca7e8a2", "score": "0.6947338", "text": "def unpack_uint64(str)\n [str.unpack('Q').first, str[8..-1]]\n end", "title":...
094d3d1d69564c64543c2b45eeb9a4fa
Chapter 14 Blocks, Page 119 Passing blocks as arguments to a function
[ { "docid": "6edfe20784f202d7beb46a7db0c8418a", "score": "0.0", "text": "def profile block_description, &block\n start_time = Time.new\n block.call\n duration = Time.new - start_time\n puts \"#{block_description}: #{duration} seconds\"\nend", "title": "" } ]
[ { "docid": "d2e6d841503a5f22776bf8f9b83ae1f9", "score": "0.7813085", "text": "def block_arg; end", "title": "" }, { "docid": "46c65079deaf27c4cad0c36a0dd0c0ac", "score": "0.76556516", "text": "def pass_block(&block)\n call_block(&block)\nend", "title": "" }, { "docid": "...
d2c232920461a73a38f297cabf963ce9
Maps files to channels
[ { "docid": "701bec3708d3214613f8e8d1216cea20", "score": "0.61207527", "text": "def file_channel_mapping(errata, opts={}, &block)\n if opts[:shadow] && !errata.release.allow_shadow?\n raise \"Release #{errata.release.name} for errata #{errata.advisory_name} does not support shadow channels\"\n ...
[ { "docid": "4e7296424b4465f8f567f2d507ef5d3d", "score": "0.634985", "text": "def file_map; end", "title": "" }, { "docid": "8306c50c5fca65f079efc0e5b7de0524", "score": "0.60018563", "text": "def map(file_list)\r\n @mapper.map(file_list)\r\n @mapper.java_map\r\n end", "titl...
de21e3ef88580d6ad8a0f72a3c621744
Hard overwrite the rendering system to render the templates
[ { "docid": "afa8ed12a8b00594c45da291f8619d58", "score": "0.0", "text": "def render_to_body(options)\n # process the usual options (status, content_type, location)\n _process_options(options)\n # directly to the render text option\n return options[:text] if !options[:text].blank? && !options[...
[ { "docid": "0dd0fc7ec56f5fa83449f5a3342eb519", "score": "0.74609816", "text": "def process_default_render exp\n process_layout\n process_template template_name, nil, nil, nil\n end", "title": "" }, { "docid": "233027c02931ba217831fd15adf13637", "score": "0.7442798", "text": "d...