query_id stringlengths 32 32 | query stringlengths 7 6.75k | positive_passages listlengths 1 1 | negative_passages listlengths 88 101 |
|---|---|---|---|
4f21aae2bb1730fc7e48e15883d7d6a9 | Overwriting the sign_out redirect path method | [
{
"docid": "b8859b4509eeb67d1565d3d96414fee4",
"score": "0.76781523",
"text": "def after_sign_out_path_for(_resource)\n root_path\n end",
"title": ""
}
] | [
{
"docid": "9f04e62b663f6477f6c1d68d1b288eeb",
"score": "0.8252863",
"text": "def after_sign_out_path_for(resource)\n super\n end",
"title": ""
},
{
"docid": "82427fe165aea1e420f5e1332636a243",
"score": "0.8152324",
"text": "def sign_out\n redirect_to root_path\n end",
"t... |
79b0d8fd327ace96e0ae0ea3c7ab4b8f | can be reduced like the follow | [
{
"docid": "60d08bec75d2261f2b9e78c36ea8f1ff",
"score": "0.0",
"text": "def is_adult?(age)\n age >= 18\nend",
"title": ""
}
] | [
{
"docid": "175787b6c7ffc4133564b6de96387694",
"score": "0.66983575",
"text": "def _reduce_708(val, _values, result)\n yyerrok\n \n result\nend",
"title": ""
},
{
"docid": "bfb6f724940e00c36b22a1ccfca65733",
"score": "0.6648551",
"text": "def _r... |
59eae20365c03506762b1d1a845c950f | GET /xmt/menus GET /xmt/menus.json | [
{
"docid": "4fbb457f6b7ed1f3dba4c53faca29da5",
"score": "0.7370277",
"text": "def index\n @menus = Xmt::Nav::Menu.all\n end",
"title": ""
}
] | [
{
"docid": "a1f69b0cf34290856a33a9e5e6de3f90",
"score": "0.82107294",
"text": "def get_menu()\n res = get(\"menu/get\")\n return MultiJson.load(res.body)\n end",
"title": ""
},
{
"docid": "80c85e2723a2cabb26ed633bd8616c18",
"score": "0.7750742",
"text": "def index\n #... |
200b5de927b34b676595694ddfa51fa6 | Sends activation email and records the time it was sent | [
{
"docid": "b12461026813850381e5d266faecacfe",
"score": "0.8191106",
"text": "def send_activation_email\n UserMailer.account_activation(self).deliver_now\n update_attribute(:activation_sent_at, Time.zone.now)\n end",
"title": ""
}
] | [
{
"docid": "2dff6025d1819e7e7ef89fd314b455ce",
"score": "0.80429286",
"text": "def send_activation_email\n\t\tUserMailer.account_activation(self).deliver_now\n\tend",
"title": ""
},
{
"docid": "224d98e9e34c43495718299a0b99d7e6",
"score": "0.80156755",
"text": "def send_activation_ema... |
6cd97cb7f4a2323c08547bc0c6a3d6b9 | Access the resource for this controller. | [
{
"docid": "7a652424270801151ef5ce45d87cebfa",
"score": "0.0",
"text": "def resource\n\t\t@album\n\tend",
"title": ""
}
] | [
{
"docid": "1a72b19ad993bbcbc5496a3f23aa1a49",
"score": "0.7953717",
"text": "def resource\n @resource\n end",
"title": ""
},
{
"docid": "1a72b19ad993bbcbc5496a3f23aa1a49",
"score": "0.7953717",
"text": "def resource\n @resource\n end",
"title": ""
},
{
"d... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "54e751af60ec53bb1e26ad31d1005537",
"score": "0.0",
"text": "def set_job_request\n @job_request = JobRequest.joins(:job_posting)\n .joins(:user)\n .where('job_requests.user_id = ?', current_user.id)\n ... | [
{
"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;... |
1c1e579e1355fc226ae560749a1406fd | Updating a medical, with messages and redirects | [
{
"docid": "d7476706523f942d3c742b7419d3294e",
"score": "0.6830703",
"text": "def update\n respond_to do |format|\n if @medical.update(medical_params)\n format.html { redirect_to @medical, notice: 'Medical was successfully updated.' }\n format.json { head :no_content }\n else\... | [
{
"docid": "36e4eea5a8bf658287c72ecf3bf1f34c",
"score": "0.7005742",
"text": "def update\n @medio = Medio.find(params[:id])\n\n respond_to do |format|\n if @medio.update_attributes(params[:medio])\n flash[:notice] = 'Medio was successfully updated.'\n format.html { redirect_to(@... |
86e23a19b342301c2c619fec8da34499 | Chooses the current store based on a request. | [
{
"docid": "af0460130ac99b5b8df768a533e06f86",
"score": "0.67363536",
"text": "def store\n server_name = @request.env['SERVER_NAME']\n\n # We select a store which either matches our server name, or is default.\n # We sort by `default ASC` so that a store matching SERVER_NAME will co... | [
{
"docid": "b084fa40f832c38b0fefedd2584583eb",
"score": "0.7093004",
"text": "def set_store\n @store = Store.find_by name: (params[:name])\n end",
"title": ""
},
{
"docid": "dd4b55a059503a41543206b6372a6093",
"score": "0.7090719",
"text": "def set_store\n @store = Store.... |
423e0edac5027099f5543f0d474d6e48 | TODO: write exception tests | [
{
"docid": "f7c909b8c0694a1f3639ea4b234c07b9",
"score": "0.0",
"text": "def square(*coords)\n coords = format_coords(coords)\n each { |square| return square if square.coords == coords }\n raise ArgumentError, 'Coordinates passed are out of bounds.'\n end",
"title": ""
}
] | [
{
"docid": "0aa0db9270c5a88c81da713a1ee0e8f8",
"score": "0.701465",
"text": "def rescued_exception; end",
"title": ""
},
{
"docid": "6d967e0574a93ad1a7a438ecf62b646c",
"score": "0.69715023",
"text": "def ex; end",
"title": ""
},
{
"docid": "6d967e0574a93ad1a7a438ecf62b646... |
adf0c3a0e8572039a0d0253180d26d1d | Checks if the file is accessible or create a new one | [
{
"docid": "cf4d4fef8b5047b876ea3d6fb8821872",
"score": "0.0",
"text": "def access_safe(password = nil)\n if !File.file? @pw_file\n pa %[No password safe detected, creating one at #@pw_file], :blue, :bold\n @pw_hash = Encryptor.hash password || ask_for_password(%[please enter a new master p... | [
{
"docid": "79a9f01d5da789b5f9027425b2d53e0d",
"score": "0.6777123",
"text": "def accesible(f)\n begin\n File.open(f,\"r\")\n true\n rescue\n false\n end\nend",
"title": ""
},
{
"docid": "9d63943094cb9409ad88af2f47f5f7bf",
"score": "0.6641226",
"text": "def check_new\n ... |
c46703750a3e8c9216f47875aed2d717 | POST /jobs POST /jobs.json | [
{
"docid": "849ebadf7db25f8ad3441ebc9c50b650",
"score": "0.69820875",
"text": "def create\n @job = Job.new(params[:job])\n\n respond_to do |format|\n if @job.save\n format.html { redirect_to @job, notice: 'Job was successfully created.' }\n format.json { render json: @job, statu... | [
{
"docid": "f0ea857ece19f0d4f9252db0f3912625",
"score": "0.742115",
"text": "def create\n @job = Job.new(job_params)\n\n if @job.save\n render json: @job, status: :created\n else\n render json: @job.errors, status: :unprocessable_entity\n end\n end",
"title": ""
},
{
"... |
071a8e6f37112ddbd774ce88731e7794 | :begin :remove :apply Creates a new GuessMove object Arguments : +type+ > the type of Guess change (:begin, :remove) | [
{
"docid": "6d71a851030386ac09b0f1f22818724f",
"score": "0.0",
"text": "def initialize(type)\n\t\t@type = type\n\tend",
"title": ""
}
] | [
{
"docid": "c2966989f3abad5ef3a5a3aa6423e35c",
"score": "0.6049551",
"text": "def move_type(new_position, initial_position, colour)\n\n if is_approach(new_position, initial_position) then\n return :A\n elsif is_withdraw(new_position, initial_position) then\n return :W... |
de3082c132fd0f9737c261021c5adbc8 | The API doesn't give us the capability to update these | [
{
"docid": "d2b8deefdf5c9a691e2b034a872377c3",
"score": "0.0",
"text": "def insync?(is)\n return true\n end",
"title": ""
}
] | [
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.7428997",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
"score": "0.7428997",
"text": "def update; end",
"title": ""
},
{
"docid": "c3f11e80d4ed9199aaaf751efade4812",
... |
e858c4c709572e22d5ba9e235750f878 | Generated the Segment and return the name of the file where it was written. | [
{
"docid": "13c9100558b4c7e0d646a8c0c9b206c4",
"score": "0.0",
"text": "def build(build_elements: false)\n Eddy::Build.make_folders()\n if build_elements\n Eddy::Build::Elements.generate_elements(self.summary.elements)\n end\n path = self.folder || File.join(Eddy.con... | [
{
"docid": "f2f892606fd9581df4dd7fc505ad4b0d",
"score": "0.6759911",
"text": "def file_name\n puts write_file_name\n end",
"title": ""
},
{
"docid": "b034b23617ab9f48851a62564fd6d497",
"score": "0.63903517",
"text": "def out_file\r\n File.basename(@output)\r\n end",
"... |
411e7f15299b424981cdd0b8115265fd | POST /page_layouts POST /page_layouts.xml | [
{
"docid": "c00d1a82fc8ae68d96bea1f3928c107d",
"score": "0.63827485",
"text": "def create\n param_page_layout = params[:page_layout]\n param_page_layout[:root_id] = 0 if param_page_layout[:root_id].empty?\n param_page_layout[:parent_id] = 0 if param_page_layout[:parent_id].empty?\n \n ... | [
{
"docid": "a84518b589f28cef885a31abb3c18ecf",
"score": "0.67465943",
"text": "def create\n @page_layout = PageLayout.new(page_layout_params)\n\n respond_to do |format|\n if @page_layout.save\n format.html { redirect_to @page_layout, notice: 'Page layout was successfully created.' }\n ... |
df07fc11c0988357b82614a002ce98d7 | POST /paragraphs POST /paragraphs.xml | [
{
"docid": "876f2e374aef892632c59026a6fda331",
"score": "0.6736785",
"text": "def create\n @story = Story.find(params[:paragraph][:story_id])\n @paragraph = @story.paragraphs.new(params[:paragraph])\n\n respond_to do |format|\n if @paragraph.save\n format.html { redirect_to(@paragra... | [
{
"docid": "ca143c4bef394af8d53d92ab2090ebbf",
"score": "0.68771434",
"text": "def create\n\n document = Document.find(params[:document])\n # TODO: doesn't actually prevent this!\n if document.nil?\n raise ActiveRecord::RecordInvalid.new(@paragraph)\n end\n\n @paragraph = Paragraph.c... |
343e62cf457ef4af80c01f7999d3bcbc | shorthand for the :title that is in the reader as well as in the writer. Takes care of both with one attr_:title | [
{
"docid": "ba0317964e27ed4866b2e48a372c84f6",
"score": "0.0",
"text": "def initialize(title, first_name, last_name)\r\n\t\t@title=title\r\n\t\t@first_name=first_name\r\n\t\t@last_name=last_name\r\n\tend",
"title": ""
}
] | [
{
"docid": "53374a693f5cb467407de68681da26f5",
"score": "0.73515856",
"text": "def title\n title = read_attribute(:title)\n _(title) unless title.blank?\n end",
"title": ""
},
{
"docid": "b1f9af5d26d80036fd1fee05db87ebd2",
"score": "0.7338228",
"text": "def title=(title=\"Unti... |
375a17ddfeee32a2569114ca269c42ae | GET /trial_balances GET /trial_balances.json | [
{
"docid": "b2493675639ae08918f38ae67ff3d247",
"score": "0.73144937",
"text": "def index\n @trial_balances = TrialBalance.all\n end",
"title": ""
}
] | [
{
"docid": "adab4ce16492c8c4b1baa349293e8d8c",
"score": "0.7347677",
"text": "def my_balances\n path = \"/v1/account/accounts/#{@account_id}/balance\"\n request_method = 'GET'\n # balances = { 'account_id' => @account_id }\n perform(path, {}, request_method)\n end",
"title": ""
},
{... |
8a22f4f8981ff11ce253b6faeb4569f8 | Amount that was paid if there are one or more payment entries for this invoice in the ledger. | [
{
"docid": "eb377caf6c889b672df47310691bbe49",
"score": "0.8073983",
"text": "def amount_paid\n amount = Monkey::Accounting::Amount.zero\n if paid?\n (e = payment_entry).transactions.select { |t|\n t.account != business_account\n }.each { |t|\n amount += t.amoun... | [
{
"docid": "085cdce121e9fb9b34aeefdd17098053",
"score": "0.7400839",
"text": "def amount_paid\n (amount - refund_amount if paid? || won?).to_i\n end",
"title": ""
},
{
"docid": "81f361a8774a743776b19142912c612d",
"score": "0.7398891",
"text": "def paid_amount\n payments.collec... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "af9d972180407203e9904c293a380926",
"score": "0.0",
"text": "def osmotic_params\n params.require(:osmotic).permit(:name)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whit... |
86240e9afc854ef496d98ed951b57c39 | Calculate Total Price for Fax Messages sent | [
{
"docid": "9dd25c8545548408c10833e183707ce7",
"score": "0.681959",
"text": "def calculate_price(fax_message)\r\n # Validate required parameters.\r\n validate_parameters(\r\n 'fax_message' => fax_message\r\n )\r\n # Prepare query url.\r\n _query_builder = Configuration.ba... | [
{
"docid": "b93b7aa1647de6d01b5eb998a54a1d76",
"score": "0.69317925",
"text": "def subtotal\n fees = [ticket_fees_in_cents].sum\n\n discounted_total + fees\n end",
"title": ""
},
{
"docid": "bd3402493e16ac092677d3cc450ee655",
"score": "0.6917082",
"text": "def tota... |
5c5257b49486bf171529befb0b2404bc | A message is sent to observers if params includes a :event key. If there are no observers, the message is sent to clients. Others are sent to clients. | [
{
"docid": "2f5c7af1731dba64096004c5a6a911a6",
"score": "0.6079596",
"text": "def transmit(id, params)\n need_event_handling = false\n if event = params[:event]\n observers = @@observers.has_key?(@path) ? @@observers[@path].dup : nil\n observers.each do |name, obs|\n beg... | [
{
"docid": "1a00bc6e16cc3d378e7db9846ea096aa",
"score": "0.6662318",
"text": "def event_params\n {\n 'ToUserName' => 'FAKE_VALID_USERNAME',\n 'FromUserName' => 'FAKE_VALID_FROMUSERNAME',\n 'CreateTime' => '1501489767',\n 'MsgType' => 'event',\n 'Event' => 'click',\n 'E... |
2dc83c20cc899dd84bbc77b90ca4e5d2 | GET /places/1 GET /places/1.json | [
{
"docid": "074df5ec3ec1f7fc875c48d9e1fc8f16",
"score": "0.6231131",
"text": "def show\n @place = Place.includes(:events=>:items ).find(params[:id])\n\n #@events= @place.events.page(params[:page])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pla... | [
{
"docid": "6c6f23ccf7a32c2b2941dcc1b5fecf54",
"score": "0.7485506",
"text": "def show\n @place = Place.find(params[:id])\n\n respond_to do |format|\n format.json { render json: @place }\n end\n end",
"title": ""
},
{
"docid": "7ffe0f9631141c12ec4e224e94ba1ae1",
"score": "... |
2dab70893c6228c0ba5303cdb5f2f78c | Write a method that returns true if its integer argument is palindromic, false otherwise. A palindromic number reads the same forwards and backwards. palindromic_number?(34543) == true palindromic_number?(123210) == false palindromic_number?(22) == true palindromic_number?(5) == true | [
{
"docid": "03604023ac3864132a8ad9644994a1fd",
"score": "0.8768397",
"text": "def palindromic_number?(num)\n num.to_s == num.to_s.reverse\nend",
"title": ""
}
] | [
{
"docid": "41e49fdfefe2f8ae2aec3b3adfa3d6d1",
"score": "0.903353",
"text": "def palindromic_number?(number)\n p number.to_s.reverse.to_i == number\nend",
"title": ""
},
{
"docid": "1c2776bc3dffc67391d37a6d173e7347",
"score": "0.89909756",
"text": "def palindromic_number?(integer)\n... |
12e08e2907166cb7179ff487cfdb0d3a | GET /species GET /species.json | [
{
"docid": "43e539b935c8efb8f3262170e61e357e",
"score": "0.0",
"text": "def index\n @search = Specie.search do\n fulltext params[:search]\n order_by :specie_name_sortable, :asc\n\n if params[:all]\n paginate page: params[:page], per_page: 9999\n else\n paginate page:... | [
{
"docid": "9091445ab95149ce8ca5539d327139f2",
"score": "0.78866726",
"text": "def show\n render json: @species\n end",
"title": ""
},
{
"docid": "81f8eaefcc58e8bedc77f521aa2d48df",
"score": "0.7644663",
"text": "def index\n @species = Species.where(query_params)\n render j... |
9481183d2b0a7932be021e6f0709e2b2 | Returns whether the page is a recto page. | [
{
"docid": "5cfe07e32662bd4cb6ef21b508be606c",
"score": "0.6976797",
"text": "def recto_page? pgnum = nil\n (pgnum || page_number).odd?\n end",
"title": ""
}
] | [
{
"docid": "0de4c63ddabb1641e2cc9ae739651528",
"score": "0.71967065",
"text": "def recto_page? pgnum = nil\n (pgnum || page_number).odd?\n end",
"title": ""
},
{
"docid": "21fb5be9796e7dfacb97bd43157e4056",
"score": "0.68946606",
"text": "def rectangle?()\n return @typ... |
90d648254cfd13ae23a9f8e9296df324 | Returns the value of attribute deep_regexps. source://activesupport//lib/active_support/parameter_filter.rb98 | [
{
"docid": "c66a30539dd1ed886cf6f21cf697a436",
"score": "0.7331276",
"text": "def deep_regexps; end",
"title": ""
}
] | [
{
"docid": "ea65fbd14f47a2eafe875c75c5be60cb",
"score": "0.59622353",
"text": "def deep_filters?; end",
"title": ""
},
{
"docid": "7b4b399bf6ade141a782ad639da353b7",
"score": "0.5684861",
"text": "def url_match_attribute\n value = self.class.url_match_attribute\n return if ... |
a1b2586302b8e17bec9f28b448a14849 | DELETE /navns/1 DELETE /navns/1.json | [
{
"docid": "0b89eceb170e53c24630f9fac2d739e3",
"score": "0.705348",
"text": "def destroy\n @navn.destroy\n respond_to do |format|\n format.html { redirect_to navns_url, notice: 'Navn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "595ddc76b903107a59c9a116b687a80a",
"score": "0.65172076",
"text": "def destroy\n node = Node.find_by_namespace!(params[:namespace])\n node.destroy!\n render nothing: true, status: 204\n end",
"title": ""
},
{
"docid": "595ddc76b903107a59c9a116b687a80a",
"score": "0.... |
5488501882331e443126b07c1bd22d89 | func_ptr switch that determines if this ArgList is part of the argument list of an argument that is a function pointer. For eg cfunc int foo(int (bar)(int, float)). ^^^ This is an arg list inside a function. | [
{
"docid": "9590035b2e5c908855ade8f958388135",
"score": "0.0",
"text": "def analyse_statement local_scope, inside_func_ptr: false, extern: false\n @args.each do |arg|\n arg.analyse_statement(local_scope, inside_func_ptr: inside_func_ptr,\n extern: extern)\n end\... | [
{
"docid": "95f67610410ce75c8c1e42298aa424f7",
"score": "0.6436733",
"text": "def check_func_call(expression, ident_list)\n func = expression.value\n args = expression.args\n\n param_list = func.arg_list\n if args.size != param_list.size\n raise \"Expected #{param_list.size} arguments... |
b002c720cf679544e4f0df695c977c0e | Override to_s method for Character class | [
{
"docid": "abfc71947ae55c9bd1e38fdb845134dd",
"score": "0.0",
"text": "def to_s\r\n return \"Object of the Character class. Contains the following values: \\n\\tName: #{@name}\\n\\tRace: #{@race}\\n\\tHit Points: #{@hit_points}\\n\\tWeapons:\\n\\t\\t#{@weapons.join(\"\\n\\t\\t\")}\\n\\tClothes:\\n... | [
{
"docid": "f2dfbba6320b5ce060cdb3486f7bd62d",
"score": "0.82154906",
"text": "def to_s\n char.to_s\n end",
"title": ""
},
{
"docid": "b8f7c734878c76417cb3cb17d5ab96a1",
"score": "0.7491533",
"text": "def to_s\n self.ascii\n end",
"title": ""
},
{
"docid": "44... |
712390dc5836adc6340e9b5da72792dc | Processes the player's input and returns either an integer or the string "quit" for leaving the game early. If the input is not an integer or any of the exit strings, returns nil. | [
{
"docid": "f9ed53caae7e8f3d0f49fd2d99e97d57",
"score": "0.7893164",
"text": "def get_player_input\n input_val = gets.chomp.downcase\n return 'quit' if %w[quit exit q].include? input_val\n\n integer_val = input_val.to_i - 1\n return if integer_val == -1 && input_val != '0'\n\n integer_val... | [
{
"docid": "02cd78c66e14e81073d358d4e6e7022e",
"score": "0.7901585",
"text": "def get_input_or_exit\n\n\t\tinput = gets.chomp\n\n\t\tif input.upcase == \"EXIT\"\n\t\t\tputs \"Thanks for playing!\"\n\t\t\texit\n\n\t\telse\n\n\t\t\treturn input.to_i\n\n\t\tend\n\n\tend",
"title": ""
},
{
"doci... |
186af7f46673c593cfd672626404a9c5 | =begin Siirretty moduuliin /lib kansioon def average_rating ratings.average(:score) end =end | [
{
"docid": "bc98c570980efc1e5102f8195e2fc0b8",
"score": "0.0",
"text": "def to_s\n \t\"#{name} #{brewery.name}\"\n end",
"title": ""
}
] | [
{
"docid": "2b41b4dcae16a6381a98034568b4f175",
"score": "0.7986747",
"text": "def avg_rating\n @avg = self.ratings.average(:rating) \n @avg ? @avg : 0\n end",
"title": ""
},
{
"docid": "175ac1ac7481113a8a37101c641da906",
"score": "0.7974561",
"text": "def average_rating\n ... |
d9e125952c5a702926828cf0268e496d | parser rule dryingredient (in Ingredients.g) 55:1: dryingredient returns [value] : ingvalue WS u= drymeasure WS ingname ; | [
{
"docid": "f591c26d71241b241ce0cf9e426f2dd8",
"score": "0.86716956",
"text": "def dryingredient\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 3 )\n value = nil\n dryingredient_start_index = @input.index\n u = nil\n ingvalue8 = nil... | [
{
"docid": "fe5ba8a36b09ba30e683d9df2327f1b6",
"score": "0.7493849",
"text": "def ingredient\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 1 )\n value = nil\n ingredient_start_index = @input.index\n dryingredient1 = nil\n liquiding... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "5ea839c4c20d3630e6688fba2007ce77",
"score": "0.0",
"text": "def set_event_notice\n @event_notice = EventNotice.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... |
49da1f866ad149ad8015b219e795e3d7 | Custom attribute writer method with validation | [
{
"docid": "e8029002d5f0d60dac108d1c5f9c5ceb",
"score": "0.0",
"text": "def message=(message)\n if message.nil?\n fail ArgumentError, 'invalid value for \"message\", message cannot be nil.'\n end\n @message = message\n end",
"title": ""
}
] | [
{
"docid": "5a0bcdaca95c21b13aacca36f9fad742",
"score": "0.6955513",
"text": "def _write_attribute(attr_name, value); end",
"title": ""
},
{
"docid": "5812dd7a37c0eccc3d9481c23d74c649",
"score": "0.69278884",
"text": "def write_attribute(attr_name, value); end",
"title": ""
},
... |
c0c74616b4b2a2d4ead5a86a4b43855a | Message displayed when initiative has ended | [
{
"docid": "ab7369c68c6620a7f9aacedef9ecd8e1",
"score": "0.82012814",
"text": "def end_of_initiative_message\n \"End of initiative.\".freeze\n end",
"title": ""
}
] | [
{
"docid": "22830d5e49660db88b9fdd3af71dd89c",
"score": "0.66199255",
"text": "def initiative_not_started_message\n \"Initiative not started. To start tracking initiative, run the start command.\".freeze\n end",
"title": ""
},
{
"docid": "ad7e3d9b84a61ac9034af0b0053fd892",
"s... |
ab2c2c1291671f8a469d74fe60dc475c | Calls predicted_deaths and speed_of_spread methods | [
{
"docid": "0aea1ff6270ed24ee8d362f8d72bccff",
"score": "0.0",
"text": "def virus_effects\n predicted_deaths\n speed_of_spread\n end",
"title": ""
}
] | [
{
"docid": "8ae80dc3bf2d44902d41b75322efd717",
"score": "0.75499797",
"text": "def predicted_deaths\n \n # calls the private method to calculate the number_of_deaths.\n deaths_and_speed\n print \"#{@state} will lose #{@number_of_deaths} people in this outbreak\"\n\n end",
"title": ""
... |
ba1c8fa232fd5e014f2b6232f115ec1e | def note_contents=(content) self.note = Note.find_or_create_by(content: content) end def note_contents self.note ? self.note.content : nil end | [
{
"docid": "2440149fd000e960b0098d98781abe1f",
"score": "0.7255886",
"text": "def note_contents=(notes)\n #binding.pry\n notes.each do |note|\n #binding.pry\n if note.strip != \"\"\n self.notes.build(content: note) \n end\n end\nend",
"title": ""
}
] | [
{
"docid": "868246619433f304ac2bb5763a5f28c4",
"score": "0.805457",
"text": "def note_contents=(contents)\n contents.each do |content|\n if content != \"\"\n note = Note.find_or_create_by(content: content)\n self.notes << note\n end\n end\n end",
"title": ""
},
{
... |
bace14ca88e66446aaede52986fcb99b | import! This method is called in the Import instance during execution of import You may also call this method without any import instance e.g. User.import!(file: File.open(PATH_TO_FILE)) "insert" will be the default insert method for this If you want to use "upsert" or "error_duplicate", define it in your importer opti... | [
{
"docid": "ef26d902e5af9d10d703e86ffb64cff9",
"score": "0.6950349",
"text": "def import!(options = {})\n fail \"#{self.name} is not importable\" unless importable?\n\n import_object = options.fetch(:object, nil)\n execute = options.fetch(:execute, true)\n import_file = get_i... | [
{
"docid": "15c3f7535d657c78ff6fd927e074a98f",
"score": "0.7254334",
"text": "def import()\n # TODO\n end",
"title": ""
},
{
"docid": "d3adbe44c671e1a9ed55d4493fd47cbc",
"score": "0.7136595",
"text": "def import!\n return selected_importer.import!\n end",
"title": ""
... |
8659e152b7e7f7e2b5d05c8625106060 | Subscribed to the ledger stream. After calling this, :ledger events will be emitted via the websocket connection object. | [
{
"docid": "c3358a5638326777fc58f9280c4150e0",
"score": "0.75442994",
"text": "def subscribe_to_ledgers\n websocket.add_plugin :autoconnect unless websocket.plugin?(:autoconnect)\n websocket.add_plugin :command_dispatcher unless websocket.plugin?(:command_dispatcher)\n websocket.cmd(WebSo... | [
{
"docid": "45ac6df57b7775f2a6dd294cc6aa30dd",
"score": "0.6340169",
"text": "def subscribe_to_trade_data!\n @connection = PusherClient::Socket.new('de504dc5763aeef9ff52')\n @connection.connect(true)\n @connection.subscribe('live_orders')\n @connection.subscribe('live_trades')\n @connecti... |
b4cb94b0665c445d4276735b9ababff7 | The actual element for this view is created here. It is not assigned to | [
{
"docid": "d25c304751ca64de561db69516814756",
"score": "0.6507741",
"text": "def create_element\n scope = (self.parent ? parent.element : Element)\n\n if el = self.class.element\n scope.find el\n else\n scope.new tag_name\n end\n end",
"title": ""
}
] | [
{
"docid": "0f1f40bd2978f4ec769ccc37fed4ca41",
"score": "0.6343092",
"text": "def element\n self\n end",
"title": ""
},
{
"docid": "54457c0cb776708c96145553866ccb51",
"score": "0.63324213",
"text": "def element\n return @element if @element\n\n @element = create_ele... |
aeb1e367bb5afc9097aae728b9e4ac9e | returns an array of all the trips that have a .guest association to self, i.e. all the trips a given guest has taken | [
{
"docid": "ae0433c98659037764e2e13a1892c076",
"score": "0.6237298",
"text": "def listings\n trips.map {|trip| trip.listing}\nend",
"title": ""
}
] | [
{
"docid": "74d17c85a6d41fb1f8d8132876d600f8",
"score": "0.86964107",
"text": "def trips\n Trip.all.select{ |trip| trip.guest == self}\n end",
"title": ""
},
{
"docid": "66947128f4a087c404ded3f39b7f651b",
"score": "0.8621628",
"text": "def trips \n Trip.all.select do... |
2ae8750f475a018269ffbb692b934a7c | attr_accessor will create both the getter and the setter methods for us attr_reader will only create the getter attr_writer will only create the setter | [
{
"docid": "69370445f90895dd37196853d47c12a9",
"score": "0.0",
"text": "def initialize(width, height)\n\n @width = width\n @height = height\n end",
"title": ""
}
] | [
{
"docid": "235cc67bb6dde8e8df5d55ca3bb05ecb",
"score": "0.76061356",
"text": "def populating_attr_accessor(*symbols)\n attr_writer *symbols\n populating_attr_reader *symbols\n end",
"title": ""
},
{
"docid": "235cc67bb6dde8e8df5d55ca3bb05ecb",
"score": "0.76061356",
... |
7ef05501275b8ebb52e16cd1d8173f28 | Accesses the current session from the cookie. Creates a new session object if need be, but can return +nil+ if e.g. attempting to access session cookie data without SSL. | [
{
"docid": "369a462f5f1a1fa5bbed5b144035477f",
"score": "0.0",
"text": "def hubssolib_current_session\n @hubssolib_current_session_proxy ||= hubssolib_get_session_proxy()\n end",
"title": ""
}
] | [
{
"docid": "6bd9ab65a1475e5c492f763ade03e267",
"score": "0.73983335",
"text": "def session\n @session ||= Session.new(req)\n # constructs a cookie hash\n end",
"title": ""
},
{
"docid": "0aedad7b47dc851412de730b16ec12dd",
"score": "0.72348773",
"text": "def get_session\n... |
f6c547e5da435820a25db289b44733cc | on initialise la variable de classe | [
{
"docid": "d892320ffd058aa2ab007e55297cc6f9",
"score": "0.0",
"text": "def initialize(email_to_save, age_to_save)\n @email = email_to_save\n @age = age_to_save\n\n @@all_users << self\n end",
"title": ""
}
] | [
{
"docid": "8ab7b1caf2cb4e077357cd569b34f71c",
"score": "0.7984335",
"text": "def init\n\t\t\t\t\t\t\t\tend",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf9dda73c555f",
"score": "0.7980486",
"text": "def initalize; end",
"title": ""
},
{
"docid": "a747cf4388fb3d14718cf... |
d3dfc80da99094c6a8285a30075fb656 | populates the root_view using view_store data by recursively building and substituting in child views named in the structure | [
{
"docid": "f5a27468b25a3fb1f74cb73ee1358acd",
"score": "0.8193194",
"text": "def populate_view(root_view, view_store, view_info)\n root_view.containers.each {|e|\n next unless path = view_info[e[:name]]\n\n v = self.populate_view(View.new(path, view_store), view_store, view_inf... | [
{
"docid": "a0dab5478118478ebaec02f9cd9c5e23",
"score": "0.7679256",
"text": "def populate_view(root_view, view_info)\n root_view.containers.each {|e|\n next unless path = view_info[e[:name]]\n \n v = self.populate_view(View.new(path), view_info)\n self.reset_c... |
bad523493e71591122522efa4246227c | Return true if the node matches the transition parser. | [
{
"docid": "6326d8166a35721d33d89dd7b0637e65",
"score": "0.8000725",
"text": "def match_transition_parser?(env, node, parser_name)\n not(parse_transition(env, node, parser_name).nil?)\n end",
"title": ""
}
] | [
{
"docid": "d4d26150a96a391141f40ace9454ae60",
"score": "0.7318618",
"text": "def rule_transition?(env, node)\n match_transition_parser?(env, node, :rule_transition)\n end",
"title": ""
},
{
"docid": "f416ceeb40ad258fa588e7812696cfcc",
"score": "0.6882885",
"text": "d... |
2e3ceeb10661bd81f1d98b19d2e9e057 | Initialize a new read buffer for storing client request info | [
{
"docid": "f32b98f0dc11373035683488b520c1a1",
"score": "0.7730158",
"text": "def post_init\n initialize_request!\n @request_buffer = Protobuf::Rpc::Buffer.new(:read)\n end",
"title": ""
}
] | [
{
"docid": "d5992677b8d4f7e91a6e5a510796a21f",
"score": "0.68251413",
"text": "def init_ReaderBufferImpl\n @position = 0\n end",
"title": ""
},
{
"docid": "91dcf7382fdfe5dc951fc6c55237b457",
"score": "0.67545855",
"text": "def initialize(socket, request)\n @len = r... |
fcd8d0c5f55660fde70b0e5c5b2a7918 | take item from an NPC | [
{
"docid": "86f9235c67ecd97383508481e3b16fdf",
"score": "0.7566036",
"text": "def take(item_name)\n if current_room.npc && current_room.npc.has_item(item_name)\n npc_item = item_to_take(item_name)\n @player.add_to_inventory(npc_item)\n # this just doesn't seem to remove the item from N... | [
{
"docid": "82e703cae77098479547516455d68eb7",
"score": "0.70769596",
"text": "def get_item(user, item)\r\n position = user.get_position(item)\r\n x = user.show_item(position)\r\n self.add_item(x)\r\n user.give_away_item(position)\r\n end",
"title": ""
},
{
"docid": "2... |
cfd60af9b1feaed0fc560a8c0f96b31e | GET /course_requests/1 GET /course_requests/1.json | [
{
"docid": "c0e3d0d716139b88cf19c65c08ea4cab",
"score": "0.7326837",
"text": "def show\n @course_request = CourseRequest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @course_request }\n end\n end",
"title": ""
}
] | [
{
"docid": "b6452253edf98adc29c4df806b12d4a7",
"score": "0.68022585",
"text": "def new\n @course_request = CourseRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @course_request }\n end\n end",
"title": ""
},
{
"docid": "6f8... |
cbac26f95a84579fb2a378950a242282 | Example attached block ignored | [
{
"docid": "f5872ee26633756bf1f4de90a9959d90",
"score": "0.0",
"text": "def greetings\n puts 'Goodbye'\nend",
"title": ""
}
] | [
{
"docid": "1f4de66b0d57b9580ff74bc571bcd79e",
"score": "0.6652143",
"text": "def on_example_group_definition(&block); end",
"title": ""
},
{
"docid": "ef77f2fd544bd3036fb671872563950e",
"score": "0.65774405",
"text": "def block_label; end",
"title": ""
},
{
"docid": "ef7... |
288e81d4497a13d6e81794bdfb17b6ec | Redirect to the default namespace on logout | [
{
"docid": "53e15a4cbdd3aaab588ce35c343bed4e",
"score": "0.0",
"text": "def root_path\n namespace = ActiveAdmin.application.default_namespace.presence\n root_path_method = [namespace, :root_path].compact.join(\"_\")\n\n path = if Helpers::Routes.respond_to? root_path_method\n ... | [
{
"docid": "c7a62b669292da84f5431cdccc433ae9",
"score": "0.7544457",
"text": "def logout\n reset_session\n redirect_to url_for(:controller => :welcome, :action => :index), :notice => \"You have successfully logged out.\"\n end",
"title": ""
},
{
"docid": "670f6c6e4fc99afee027c33773336... |
5e71a251d9b705dd3d85696f712168f4 | sloppy regex to grab the URL | [
{
"docid": "632b0384e3df8583adaefe18bff36afe",
"score": "0.0",
"text": "def reg_fp; /src\\=\\\"(.+)/; end",
"title": ""
}
] | [
{
"docid": "17d5a33fb86d689e306b1dcc4e464b5d",
"score": "0.8118534",
"text": "def reg_url2; /(.+)\\//; end",
"title": ""
},
{
"docid": "7a45e3900b7e5e4440d85de27f2c8dd3",
"score": "0.7617003",
"text": "def reg_url; /(.+)/; end",
"title": ""
},
{
"docid": "2b1ec63c190cde90... |
44ae303aabdbf65b4611039b19e2251e | Are there no more active beams? | [
{
"docid": "4dce9fee042afa5a1a1f16ecf8f45678",
"score": "0.61299384",
"text": "def done?\n beam.empty?\n end",
"title": ""
}
] | [
{
"docid": "61663937427e702e83b8efff9797728d",
"score": "0.6616498",
"text": "def advert_campaign_thats_been_used?\n has_been_used = false\n if advertising_campaigns.count.positive?\n advertising_campaigns.each do |ac|\n if ac.has_users? == true\n has_been_used = true\n ... |
112b2bf22fc8c03c6b5af1f528409a67 | GET /inventory_issues/new GET /inventory_issues/new.json | [
{
"docid": "2860676062112bc6c3092c45ed25af91",
"score": "0.7944633",
"text": "def new\n @inventory_issue = InventoryIssue.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @inventory_issue }\n end\n end",
"title": ""
}
] | [
{
"docid": "7089f15792051e018f64d71afd3efc36",
"score": "0.781809",
"text": "def new\n\n @repo = Repo.new\n 1.times { @repo.issues.build}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @repo }\n end\n end",
"title": ""
},
{
"docid"... |
49da1f866ad149ad8015b219e795e3d7 | Custom attribute writer method with validation | [
{
"docid": "74b60b339a54b2efa4d33d1d40ff346a",
"score": "0.0",
"text": "def first_name=(first_name)\n if first_name.nil?\n fail ArgumentError, \"first_name cannot be nil\"\n end\n\n if first_name.to_s.length > 30\n fail ArgumentError, \"invalid value for 'first_name', the ch... | [
{
"docid": "0f4a74039d4b8dc62405e39b58357a05",
"score": "0.64708173",
"text": "def attr_writer_tag(text); end",
"title": ""
},
{
"docid": "ac55752dd9cc4f485a916c46d7b41237",
"score": "0.63147706",
"text": "def allowed_attributes=(_arg0); end",
"title": ""
},
{
"docid": "a... |
f030f4b55932e3ae3809878b74ebab22 | Enable a particular authentication at the given path. | [
{
"docid": "65af284155c71eac7a562f686d6cc4bf",
"score": "0.67203885",
"text": "def enable_auth(path, type, description = nil)\n payload = { type: type }\n payload[:description] = description if !description.nil?\n\n client.post(\"/v1/sys/auth/#{encode_path(path)}\", JSON.fast_generate(pay... | [
{
"docid": "c9653f26f46f166adc47b5fa4743b126",
"score": "0.662862",
"text": "def enable_authentication(password)\n @enablepwd = password\n end",
"title": ""
},
{
"docid": "d0dd0781f6a4b5dc071dfbd95d03ac53",
"score": "0.65753746",
"text": "def authenticate(*paths)\n s... |
b446089c78754499442ee219258c86b5 | Show invalid properties with the reasons. Usually used together with valid? | [
{
"docid": "68350ec0c07343af22892738f43340c6",
"score": "0.0",
"text": "def list_invalid_properties\n invalid_properties = Array.new\n return invalid_properties\n end",
"title": ""
}
] | [
{
"docid": "9dd8493868b224474a2e829ab4c4f12a",
"score": "0.76497203",
"text": "def list_invalid_properties\n invalid_properties = super\n if @class_id.nil?\n invalid_properties.push('invalid value for \"class_id\", class_id cannot be nil.')\n end\n\n if @object_type.nil?\n ... |
facccde014fe0817d65b0427c6cc5225 | method that grabs the id of the asset from the params and sets the right asset | [
{
"docid": "b3b60f5bd656450b9a6f277df1aadc7e",
"score": "0.0",
"text": "def set_location\n @location = Location.find_by(id: params[:id])\n end",
"title": ""
}
] | [
{
"docid": "baa3f9fa764921752f8478590438c8fe",
"score": "0.8109781",
"text": "def set_asset\n @asset = Asset.find(params[:id])\n end",
"title": ""
},
{
"docid": "98089c5dd5b47db7905ef105877ca969",
"score": "0.8059532",
"text": "def set_asset\n @asset = Asset.find(params[:id]... |
6424b9f524487e642972d8f48c8226ed | add/remove a student's recommended squares note: this is a kissin' cousin to update3_access in the teachers controller | [
{
"docid": "919628e4d3a8d290893144240fdd173e",
"score": "0.69922596",
"text": "def updateb_squares\n # add square to roster\n if params[:editb_add] \n if params[:add_square_id].present?\n @student.squares << Square.find(params[:add_square_id])\n end\n redirect_to editb_stude... | [
{
"docid": "8abdc0ba6564cb2a0880c708e6ff6d5f",
"score": "0.6704692",
"text": "def editb\n @student = Student.find(params[:id])\n @squares = @student.squares\n @squares_at_school = Square.where(school_id: @student.school_id)\n @squares_not_in_roster = Square.where(school_id: @student.school_i... |
927e454b0902180bb085918b73317615 | of the same string values, except with the vowels removed. | [
{
"docid": "400ba9d7fba0e7cedf971652be490cf1",
"score": "0.7180075",
"text": "def remove_vowels(array)\n # array.map { | word | word.gsub(/[aeiou]/i, \"\") }\n array.map { | word | word.delete(\"AEIOUaeiou\") }\nend",
"title": ""
}
] | [
{
"docid": "0392c74f1edc9e605165c617e6b8d0e8",
"score": "0.8085674",
"text": "def convert_vowels_and_no_repeats\n removed = []\n self.chars.to_a.reduce(nil) do |prev,cur|\n cur = 'a' if vowels.include?(cur) \n removed << cur unless prev.eql?(cur)\n cur \n end\n removed.join\n ... |
fdde4487563c3a3dd425a68bf6ef2681 | Scan Engine Shared Secret Returns the current valid shared secret or generates a new shared secret. The endpoint returns an existing shared secret if one was previously generated and it has not yet expired. Conversely, the endpoint will generate and return a new shared secret for either of the following conditions: a s... | [
{
"docid": "7471338f387ed7c006e6e93ad29e3506",
"score": "0.6259321",
"text": "def create_shared_secret_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScanEngineApi.create_shared_secret ...'\n end\n # resource path\n ... | [
{
"docid": "878de852b51a37bfee916a87a012c58c",
"score": "0.62650985",
"text": "def get_current_shared_secret_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ScanEngineApi.get_current_shared_secret ...'\n end\n # resource p... |
f86110545cdee6857353b8cf093e835f | Reset the start time to nil and elapsed time to zero | [
{
"docid": "f3d237ee42db03f8f03dbb6ac97ccae7",
"score": "0.75511426",
"text": "def reset\n @running = false\n @offset = 0\n @start_time = nil\n end",
"title": ""
}
] | [
{
"docid": "665a2613e63976f2393464101c10beca",
"score": "0.82628936",
"text": "def reset\n @totalDuration = Time.new(0)\n @timeStart = Time.now()\n self\n end",
"title": ""
},
{
"docid": "f3d9f16783cf35bff551be8d5d3e0d86",
"score": "0.8224404",
"text": "def re... |
62cc3f49daa1f5cd0db4f6d3c8e93053 | Downloadable track, NOT in rainbows. Given a track_id, make that track downloadable | [
{
"docid": "8382c0bdddfef12f3d76d12ffcdd05fc",
"score": "0.6612996",
"text": "def start_download\n @track = Track.find_by_id(params[:track_id])\n if @track.nil? then flash[:error] = 'No track exists with ID %s' / [h(params[:track_id])]\n elsif !@track.public? then flash[:error] = 'The specified... | [
{
"docid": "573b545e1a78a03322af411f343500dc",
"score": "0.6431993",
"text": "def toggle_downloadable!(turning_on)\n Content.transaction do\n if turning_on\n update_attribute(:downloadable, true)\n if file_download \n file_download.save # Force update\n ... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "37c059e63becf77879e30adf7f96cea9",
"score": "0.0",
"text": "def set_resistance_member\n @resistance_member = ResistanceMember.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... |
246a25602e80cf1657d4f4e12e705c21 | start_date is later date, end_date is earlier date | [
{
"docid": "f16983c13f49c66111a67e6da41723c4",
"score": "0.0",
"text": "def days_between_nepali_dates(initial_start_date, initial_end_date)\n start_date,end_date = (initial_end_date > initial_start_date) ? [initial_end_date,initial_start_date] : [initial_start_date,initial_end_date]\n start_year,s... | [
{
"docid": "606fb6bce3c2ba47c6dc3970c6fcc8a6",
"score": "0.77183104",
"text": "def zeitspanne\n self.start_date..self.end_date-1 unless self.start_date.nil? || self.end_date.nil?\n end",
"title": ""
},
{
"docid": "c21e08ffa6d1aa646d0db39c7d7d3eb0",
"score": "0.7158298",
"text": "... |
785c3d532182770a4306b3ab5ecbe0fb | This method is called whenever no records are found with slug. | [
{
"docid": "939ce69054b9649a1ba3f0d592f80ce7",
"score": "0.6624899",
"text": "def raise_slugged_record_not_found_exception!(slug)\n error = \"Couldn't find #{self.name} with #{self.slug_field}=#{slug}\"\n raise ActiveRecord::RecordNotFound, error\n end",
"title": ""
}
] | [
{
"docid": "a5c65e9396bc21d72f99b51b451fb21c",
"score": "0.69994813",
"text": "def not_found\n where(\"slug = ?\", not_found_slug).first()\n end",
"title": ""
},
{
"docid": "ec14f0ff829ae1034f66396caa522846",
"score": "0.64913857",
"text": "def not_found\n\t\t\tif @posts.empt... |
f74c29bdfc4a183e1ec1b91334cd5be2 | Use callbacks to share common setup or constraints between actions. | [
{
"docid": "2a6d4774faa24c3648d1703885a8c306",
"score": "0.0",
"text": "def set_series\n @series = Series.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;... |
f385cbc41572d7466b397663c4d1636e | For now, just make sure divergence is absolute. This is responsible to score a counter on the basis of its divergence | [
{
"docid": "3d546e89b6927d8f0cbd1f68736171e1",
"score": "0.71141803",
"text": "def score(divergence)\n return 0 if divergence.nil?\n divergence.abs\n end",
"title": ""
}
] | [
{
"docid": "88033a1aab4b2008215ceca0ed9f4495",
"score": "0.61166936",
"text": "def collision_tollerance\n 0.0\n end",
"title": ""
},
{
"docid": "983764deeb0bf63b081d6c1604bfbb28",
"score": "0.6092738",
"text": "def calculate_score\n # Calculate score given the number of lines ... |
10e7daef38b3e0b8c85a9f913967151a | It's fine to be in an odd group (and thus need to solo an extra day) once per phase, but we should avoid this happening to the same student(s) multiple times per phase. This metric is even more important than repeated pairings. This method returns an integer representing the number of times any student has exceeded the... | [
{
"docid": "ed57020c009a05796fd096d8e69bd254",
"score": "0.721938",
"text": "def extra_soloing(phase)\n times_in_odd_group = Hash.new { |h,k| h[k] = 0 }\n phase.each do |week|\n week.each do |group|\n if group.length % 2 == 1 \n badness = 1\n group.each do |student|\n... | [
{
"docid": "699fd1ed781cb28ad9165ee851bc53d2",
"score": "0.66502243",
"text": "def number_of_game_weeks_with_fixtures(no_users)\n if no_users.even?\n # No byes, every one plays each other, so number of rounds is no_users - 1\n NUMBER_OF_GAME_WEEKS - (NUMBER_OF_GAME_WEEKS % (no_users - 1))\n... |
8ae78a3e0b0cac66a613fbbfc0e2da40 | when initially displayed, set various fields to match the item | [
{
"docid": "985575fdf62b2a296e28b1d19cfa67b2",
"score": "0.0",
"text": "def created()\n self.setup(@@item)\n end",
"title": ""
}
] | [
{
"docid": "3d256d60aef5d35ecf1278bf799b4adc",
"score": "0.65194243",
"text": "def initialize_item\n # if we haven't come from a find, then preset some attributes needed by the form\n if !self.id.present?\n# self.id ||= 0\n self.item_name ||= \"\"\n \t self.image_file_name ... |
b334e78047e2b793841f07883cbfd9ff | returns true if given node supports the requested browser | [
{
"docid": "413a6ba15c1ce1bba9ee34461372a123",
"score": "0.70126003",
"text": "def has_driver?(node, browser)\n\t\tnode['driver'].each do |key, value|\n\t\t\treturn true if key.eql? browser\n\t\tend\n\t\tfalse\n\tend",
"title": ""
}
] | [
{
"docid": "e8c9326d07cb7e99b43b0db718be5575",
"score": "0.72895116",
"text": "def has_browser?\n b = Runtime.instance.get :browser\n return (not b.nil? and b.is_open?)\n end",
"title": ""
},
{
"docid": "8618a7af01863bfff1db131d6a0677de",
"score": "0.72541505",
"text": "... |
5a58a805ad3231e45815cf02461fa6ab | Decodes Zenaton's format in a valid Ruby object | [
{
"docid": "918fd73bb11af0703715474f954e7668",
"score": "0.0",
"text": "def decode(json_string)\n parsed_json = JSON.parse(json_string)\n @decoded = []\n @encoded = parsed_json.delete(KEY_STORE)\n case parsed_json.keys.first\n when KEY_DATA\n return parsed_jso... | [
{
"docid": "168312d5b963e4b40cdc730c58f798e0",
"score": "0.708941",
"text": "def decode(input)\n return Marshal.load(Zlib::Inflate.inflate(input))\n end",
"title": ""
},
{
"docid": "43b8f171679f63189e4fc46fb505623c",
"score": "0.6885408",
"text": "def decode(obj)\n valid... |
cd01dae6083a81f58fde15a8edd08dce | PATCH/PUT /shopkeepers/1 PATCH/PUT /shopkeepers/1.json | [
{
"docid": "a353877479de37484b3ef7c15f22ac52",
"score": "0.6861423",
"text": "def update\n @shopkeeper = Shopkeeper.find(params[:id])\n\n if @shopkeeper.update(shopkeeper_params)\n head :no_content\n else\n render json: @shopkeeper.errors, status: :unprocessable_entity\n end\n end... | [
{
"docid": "6bba8edafac20214124a347a79a8a0ff",
"score": "0.660647",
"text": "def update\n respond_to do |format|\n if @shopkeeper.update(shopkeeper_params)\n format.html { redirect_to @shopkeeper, notice: 'Shopkeeper was successfully updated.' }\n format.json { render :show, status... |
3d114b1bc57862071d6e419e722f5abe | DELETE /labels/1 DELETE /labels/1.xml | [
{
"docid": "e09c748fb4952e9aae1c7729fd72b115",
"score": "0.67867035",
"text": "def destroy\n @label = Label.find(params[:id])\n @label.destroy\n redirect_to labels_path, :notice => \"Label '#{@label.name}' was deleted and removed from all customers that had it.\"\n end",
"title": ""
}
] | [
{
"docid": "c1681b3d9aa488990ebcc150eace36b9",
"score": "0.72376764",
"text": "def delete(labels = [])\n call_container_method(:delete, labels)\n end",
"title": ""
},
{
"docid": "2b34bd51eadc5d230e76a9d7886298f4",
"score": "0.7143961",
"text": "def destroy\n @label = Label.fin... |
cca68a720a2c588eb0f8456721e188b4 | Builds an html tag with XHTML 1.0 Frameset doctype instead. | [
{
"docid": "9286809895f16fcd544cce6b60a4263d",
"score": "0.5987368",
"text": "def xhtml_frameset(attrs = {}, &block)\n self.tagset = Markaby::XHTMLFrameset\n xhtml_html(attrs, &block)\n end",
"title": ""
}
] | [
{
"docid": "583901e75557da5b50a6123a340820ed",
"score": "0.7759574",
"text": "def xhtml_doctype( doctype=:transitional )\n doctype = :transitional unless [:transitional, :strict, :frameset].include? doctype\n %(<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 #{doctype.to_s.capitalize}//EN\" \"http:/... |
736733d94d32cc535dcd84b72cfa57d8 | Function Declarations Usage Message Function | [
{
"docid": "e1e1b93b3b81eaae01bed23963f9e438",
"score": "0.0",
"text": "def usage\n print_line(\"Meterpreter Script to flood host with a process\")\n print_line(@exec_opts.usage)\n raise Rex::Script::Completed\nend",
"title": ""
}
] | [
{
"docid": "a8992b9e35cd67a7a500de288b8aead6",
"score": "0.6598317",
"text": "def functions\n\n end",
"title": ""
},
{
"docid": "0b47c7bbf158a08945a18c5355a04daf",
"score": "0.65585816",
"text": "def usage; end",
"title": ""
},
{
"docid": "0b47c7bbf158a08945a18c5355a04da... |
fbd5180725d0bb8929ada3715cd6fcb5 | Use Heroku's temp folder for uploads | [
{
"docid": "6988b8ba1c7c5828a60e3d991aaf06ba",
"score": "0.7174002",
"text": "def cache_dir\n \"#{Rails.root}/tmp/uploads\"\n end",
"title": ""
}
] | [
{
"docid": "28df59909996e1d307409f9322bc5797",
"score": "0.7279786",
"text": "def directory_path\n \"#{Rails.root}/public/tmp/\"\n end",
"title": ""
},
{
"docid": "211ebc6b090949dfc721e87d0e3ea9b9",
"score": "0.7260816",
"text": "def cache_dir\n \"/uploads/tmp\"\n end",
"... |
8141daa3491d86063b597fb8978b18bb | Idea: A special subenvironment for creating a post 1. Display: view, post number, date 2. Menu? 3. Edit/enter title 4. Edit teaser 5. Add views 6. Add tags 7. Import assets 8. Save 9. Quit Edit body after save/quit | [
{
"docid": "6d6d497af45850bb39297acdb56d6d3c",
"score": "0.0",
"text": "def ask(prompt) # elsewhere?\n print prompt\n str = gets\n str.chomp! if str\n str\nend",
"title": ""
}
] | [
{
"docid": "cfeaa743da4654551e7a138805441798",
"score": "0.6570933",
"text": "def create_post() \r\n puts `clear`\r\n puts(\"-----------------------\".white.on_black)\r\n puts(\"------CREATE POST------\".white.on_black)\r\n puts(\"-----------------------\".white.on_black)\r\n... |
b89f94aa26497340805508ea823a1ba2 | Get historical stats Fetches historical stats for each of your Fastly services and groups the results by service ID. | [
{
"docid": "42eeee18973d74b0588c7f6e44f1925a",
"score": "0.51851946",
"text": "def get_hist_stats(opts = {})\n data, _status_code, _headers = get_hist_stats_with_http_info(opts)\n data\n end",
"title": ""
}
] | [
{
"docid": "dc85982eb0ad67bf9c239f014f2018e3",
"score": "0.6723944",
"text": "def get_hist_stats_service_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_hist_stats_service ...'\n end\n # unbox the paramet... |
f688e1c76ebdb05021a9009c78871b2e | To customize the behavior of this controller, you can overwrite any of the RESTful actions. For example: | [
{
"docid": "c4297bb097762f1d401cf155010ce056",
"score": "0.0",
"text": "def index\n # byebug\n @user_resources = current_user.user_detail.pets\n @resources = @user_resources.page(params[:page]).per(10)\n super\n end",
"title": ""
}
] | [
{
"docid": "94bc18ba430eb79ea4ca2e1aff420758",
"score": "0.68419063",
"text": "def action\n super\n end",
"title": ""
},
{
"docid": "dbebed3aa889e8b91b949433e5260fb5",
"score": "0.65444124",
"text": "def action_methods; end",
"title": ""
},
{
"docid": "dbebed3aa88... |
ba1c437cb0f609e12a296c7d480e50f3 | Get club by Squash Matrix ID | [
{
"docid": "6d1a3ad2702b1be6f95f49c11bce3630",
"score": "0.55057305",
"text": "def clubs_squash_matrix_id_get_with_http_info(squash_matrix_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.clubs_squash_matrix_id_get ...\"\n end\... | [
{
"docid": "c38cc305c616d0fb35665b4e1c850028",
"score": "0.60101545",
"text": "def get_square_by_id(id)\n @squares.find { |obj| obj[:id] == id }\n end",
"title": ""
},
{
"docid": "47b5ee905926f367768569b4e44cda30",
"score": "0.57806563",
"text": "def club\n viewing.club\n end... |
1034b50dd0f59069575d1b489006692b | Converts input date_string to a Date object. Accepts %m/%d/%Y or %b %Y e.g. (Dec 2017). | [
{
"docid": "f0dd664b0670cad8fc4b030f6fbbc052",
"score": "0.8267249",
"text": "def to_date\n if date_string.match(/\\//)\n Date.strptime(date_string, \"%m/%d/%Y\")\n else\n Date.strptime(date_string, \"%b %Y\")\n end\n end",
"title": ""
}
] | [
{
"docid": "81a9e47518edabb5602d7e7f95e37bf5",
"score": "0.79934174",
"text": "def to_date(string)\n return !string || string.to_s.empty? ? nil : Date.strptime(string, '%d/%m/%Y')\n end",
"title": ""
},
{
"docid": "b19d49356e0f823efcf45ee14753fb2b",
"score": "0.7766409",
"text": ... |
a2099a77c85e91272ae2f9e35b937953 | Only allow a trusted parameter "white list" through. | [
{
"docid": "72e5bf50c4ea4ce9ae36dfd9aa773e62",
"score": "0.0",
"text": "def report_params\n params.require(:report).permit(:user_id, :date, :title, :body, :status)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7943618",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.69572574",
"text": "def permitted_params\n params.permit!\n end",
"title"... |
ef0febf8395386510de7a2ab6820a550 | Return all of the Photos that were uploaded by Users that this user has a DirectedUserToUserEdge pointing to. | [
{
"docid": "1216282b0fa75e1635fb88b20d16efae",
"score": "0.6686882",
"text": "def friend_photos\n Photo.where(owner_user_id: friend_ids)\n end",
"title": ""
}
] | [
{
"docid": "8c8ae47712d291884a14129e0ec81985",
"score": "0.670161",
"text": "def photos\n photo_arr = Photo.photos.select {|photo| photo.user == self}\n photo_arr\n end",
"title": ""
},
{
"docid": "c6b03e2c4a9f6d975b76125bbd0d2e5b",
"score": "0.63818884",
"text": "def user_fil... |
2fdb40680360a4cf53d287c0ccc33a5e | GET /titles GET /titles.xml | [
{
"docid": "e9041a94c037ef4bd836570623b179fc",
"score": "0.7226884",
"text": "def index\n @titles = @medium.titles.all\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @titles }\n end\n end",
"title": ""
}
] | [
{
"docid": "536ac3051519aefadd635435847154a8",
"score": "0.7416721",
"text": "def index\n @titles = Title.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @titles }\n end\n end",
"title": ""
},
{
"docid": "6d04b9e8ad77704fb1a55b... |
46518c2cf28fab9eece47c6e4fc6c785 | Returns the last Date of the month. | [
{
"docid": "4c8efa992fa66f7471bb80f77de7cbdc",
"score": "0.56018454",
"text": "def end_date\n\t\tself.next.start_date - 1\n\tend",
"title": ""
}
] | [
{
"docid": "ccc1589232ac873c416f7494623a1f66",
"score": "0.8480863",
"text": "def last_of_month\n # See if the month is December\n @last_of_month ||= if @month == 12\n # If so, return the day before the first of next year.\n Date.new(@year + 1, 1 ) - 1\n else\n # If not, ... |
6cb742f7d9756481772218689837dd40 | Params: username: password: app_uname | [
{
"docid": "334492af3d2315303d434f867918b8d4",
"score": "0.0",
"text": "def password_valid\n requires! :username\n requires! :password\n\n user = UsersManager.auth(params[:username], params[:password])\n raise Uasthree::LoginError.new unless user\n check_app!(user)\n\n access_token, re... | [
{
"docid": "620c473b25a3b22d8616f135fd78e7d1",
"score": "0.6859034",
"text": "def app_credentials\n {user: @config['mysql_app_user'], pass: @config['mysql_app_password']}\n end",
"title": ""
},
{
"docid": "93e8b80e6a728ece698e406841db32f5",
"score": "0.6729469",
"text": "def ... |
111ff1b13cd3eda47be942fff8114f66 | The release for this version (e.g. 1.2.0.a > 1.2.0). Nonprerelease versions return themselves. | [
{
"docid": "324095eaca0da8b0b8b10378723829d5",
"score": "0.0",
"text": "def release\n @@release[self] ||= if prerelease?\n segments = self.segments\n segments.pop while segments.any? {|s| String === s }\n self.class.new segments.join('.')\n else\n self\n end\n end",
"ti... | [
{
"docid": "ee2a9af43efb3088d88e7297acde3142",
"score": "0.75575197",
"text": "def release\n @release ||= ENV[\"RELEASE\"] || \"1\"\n end",
"title": ""
},
{
"docid": "cf33d99524f6095b19e2f7236c9b46b0",
"score": "0.72673726",
"text": "def get_release(project)\n info = get... |
8beb137eaec12fc88c2d9f70de73ad29 | POST /priorities POST /priorities.json | [
{
"docid": "9a7fd0df14f442edfeaf7e32fdecd9d0",
"score": "0.51622504",
"text": "def create\n player = current_user\n @priority = Priority.new(priority_params)\n @priority.player = player\n\n p params\n puts JSON.pretty_generate @priority.attributes\n # respond_to do |format|\n # if... | [
{
"docid": "b2d6c0ae5472e2287835a4eccfdaec99",
"score": "0.66040236",
"text": "def create\n @prior = Prior.new(params[:prior])\n\n respond_to do |format|\n if @prior.save\n format.html { redirect_to @prior, notice: 'Prior was successfully created.' }\n format.json { render json:... |
1f829eb7de9070623e98c1b2f9c3f15f | DELETE /salles/1 DELETE /salles/1.json | [
{
"docid": "5a4bd124e5cdf0f90130f5b693b3807b",
"score": "0.67987704",
"text": "def destroy\r\n @salle = Salle.find(params[:id])\r\n if @salle.machines.blank?\r\n @salle.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to salles_url }\r\n format.json ... | [
{
"docid": "9e6f59516c666fe0fe65a760cc2d864a",
"score": "0.7192623",
"text": "def destroy\n @salle.destroy\n respond_to do |format|\n format.html { redirect_to salles_url, notice: 'Salle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",
"title": ""
... |
1a37b09f4dc975b46d77112c2ab9f851 | Deletes a pipeline (dealGroup) with given id | [
{
"docid": "9d06fd7aa2440255b39f58cd3f9f531e",
"score": "0.9281041",
"text": "def delete_pipeline(id)\n delete(\"dealGroups/#{id}\")\n end",
"title": ""
}
] | [
{
"docid": "907c800714dd8b260e802a41e824484d",
"score": "0.7940949",
"text": "def delete_pipeline id\n begin\n @elastictranscoder.delete_pipeline(id: id)\n rescue\n #Raise informative exception\n end\n end",
"title": ""
},
{
"docid": "4180ae31cf59db3d322732310... |
4530c0398f4caf842d6b869dff4b0f06 | PATCH/PUT /series/1 PATCH/PUT /series/1.json | [
{
"docid": "e0352e1fe79876646ba9fff79ec9fe6e",
"score": "0.76550496",
"text": "def update\n @series.update(series_params)\n respond_with(@series)\n end",
"title": ""
}
] | [
{
"docid": "0719f150e8e9b24947043cb8ef0c09e7",
"score": "0.73983145",
"text": "def update\n @series = Series.find(params[:id])\n\n respond_to do |format|\n if @series.update_attributes(params[:series])\n format.html { redirect_to @series, notice: t('notice.series.updated') }\n f... |
f569e886f5e2ce11d7b431afbd005093 | OPTIMIZE let's add includes(:favouritable) to avoid N+1 query | [
{
"docid": "90ab4efb812b98dd2816ec1104823026",
"score": "0.53903115",
"text": "def all\n @favourites = Favourite.get_all(@user.id, 'Product').page(params[:page]).per(10)\n end",
"title": ""
}
] | [
{
"docid": "8ed4962dd06295d9d2a5a8a90c7571fb",
"score": "0.6749377",
"text": "def include_objects\n ActsAsFavable::Favorite.includes(:favable)\n end",
"title": ""
},
{
"docid": "820aa3798a14baf816f94e56591929f1",
"score": "0.65102345",
"text": "def favorited\r\n Favorite.f... |
0cee841f20ecd22d3d48326b11d92ef5 | Get city names from the hash | [
{
"docid": "76d6e5dc9723511c411dc40736916ef1",
"score": "0.66971624",
"text": "def get_city_names(somehash)\n puts \n somehash.each {|k,v| puts k}\nend",
"title": ""
}
] | [
{
"docid": "6a56f42736e77489e4935f0aeba43043",
"score": "0.8052428",
"text": "def get_city_names(city_hash)\n city_hash.keys\nend",
"title": ""
},
{
"docid": "a286782141e5d2c01670fd7d5e167da3",
"score": "0.78113794",
"text": "def get_city_names(somehash)\n # print out the names o... |
b8faf2b34149adfff870122bbe105faa | Create a new shift string from a standard string. | [
{
"docid": "d9811d008d73c14dbc43f513e7783f77",
"score": "0.0",
"text": "def initialize(str='', name=nil)\n super(str)\n @name = name\n end",
"title": ""
}
] | [
{
"docid": "42effc8952182a104dc9e0298ed6d58d",
"score": "0.70244986",
"text": "def shift(shift, input_string)\n\t\talphabet = ('a'..'z').to_a.join # alphabet string\n\t\tshift = shift % alphabet.length\n\t\tinput_string.downcase.tr(alphabet,alphabet[shift..-1] + alphabet[0..shift-1])\n\tend",
"title... |
7985227ee65f1c2756edb5b23951afec | Remembers a Coordinator in the database for use in persistent sessions. | [
{
"docid": "0bbc5d4efdedc9e87fc7e7f6266405d5",
"score": "0.5354285",
"text": "def remember\n self.remember_token = Coordinator.new_token\n update_attribute(:remember_digest, Coordinator.digest(remember_token))\n end",
"title": ""
}
] | [
{
"docid": "7a9c88984c3f33838a3d8c6c4052b3c2",
"score": "0.64710575",
"text": "def set_coordinator\n @coordinator = Coordinator.find(params[:id])\n end",
"title": ""
},
{
"docid": "7a9c88984c3f33838a3d8c6c4052b3c2",
"score": "0.64710575",
"text": "def set_coordinator\n @... |
a2b65573aa0684f005e452a59ff31539 | Public: Get information about all available accounts. Does a POST /accounts/get call to retrieve high level account information associated with an access_token's item access_token access_token who's item to fetch accounts for account_ids Specific account ids to fetch accounts for (optional) options Additional options t... | [
{
"docid": "9e08a8a793030ee6c126498214df0938",
"score": "0.7058644",
"text": "def get(access_token, account_ids: nil, options: nil)\n options_payload = {}\n options_payload[:account_ids] = account_ids unless account_ids.nil?\n options_payload = options_payload.merge(options) unless option... | [
{
"docid": "b1a0f34ca6089cbf7db363979c4c3550",
"score": "0.76493",
"text": "def accounts\n ensure_ready!(:authorization)\n response = connection.get('accounts')\n checked_response_body(response)\n end",
"title": ""
},
{
"docid": "7c46fb7f26c544cce1da743d6a810343",
"scor... |
ffb1dd74908b0a0a071ec227647a4fc6 | a container, content layout attribute of parent is vertical, and have a width value, we could say to_fluid means unset the width. | [
{
"docid": "ff197ead04166aad90824097bed6eb5c",
"score": "0.64533114",
"text": "def to_fluid()\n if self.root?\n block_min_width = html_attribute_values(\"page_min-width\")\n block_width = html_attribute_values(\"page_width\")\n block_margin = html_attribute_values(\"page_margi... | [
{
"docid": "700fce32ac43d6f8c60fce4566dabc8f",
"score": "0.65299475",
"text": "def to_fluid()\n if self.root?\n block_min_width = html_attribute_values(\"page_min-width\")\n block_width = html_attribute_values(\"page_width\")\n block_margin = html_attribute_values(\"page_margin\")\n ... |
af630984682f1a0b5a68e6092af0d102 | Update properties of this object | [
{
"docid": "1f43d3bdc1c01f8ec76abed4ca886162",
"score": "0.0",
"text": "def update!(**args)\n @responses = args[:responses] if args.key?(:responses)\n end",
"title": ""
}
] | [
{
"docid": "184b1b1ed771473d3eb9f338c0734c38",
"score": "0.73066413",
"text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end",
"title": ""
},
{
"docid": "5076c5a88404ae72986f958710f5687a",
"score": "0.72631145",
"text": "def update... |