query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
26392360525a8dfe5ee19702cb7b2874
GET /events GET /events.json
[ { "docid": "3da9fcec204590415e22942fdb6abd39", "score": "0.7463956", "text": "def index\n @events = Event.where(user_id: @current_user.id)\n render json: {events: @events}, status: :ok\n end", "title": "" } ]
[ { "docid": "483079b80dfb97ee802273ad3849fa6b", "score": "0.795317", "text": "def events\n @page = 'events'\n respond_to do |format|\n format.html {\n @events = Event.find(:all)\n }\n format.json {}\n end\n end", "title": "" }, { "docid": "a85255d083e155277c720...
333db973c25bfc7c9a42696e2629d472
User can get engine (normally browser instance or iframe element)
[ { "docid": "ab4af52aa2413ae81787b2757395a0b5", "score": "0.57309777", "text": "def engine\n SettingMaster.engine\n end", "title": "" } ]
[ { "docid": "fb46a66ca02284109a6f91acdb6aac10", "score": "0.69745046", "text": "def engine\n @engine\n end", "title": "" }, { "docid": "c9998a76b31a8c732f0b31402269541c", "score": "0.69409055", "text": "def engine\n data[:engine]\n end", "title": "" }, { ...
ee1359c71387608f0b1956d2b7c6d895
It's easy if we can fit all of the tiles on one row. For example: win: [..., 0, 8] win in one: [..., 0, 4, 4] win in two: [..., 0, 2, 2, 4]
[ { "docid": "beeecb5a3d758443e8ae1928a8aa8d9e", "score": "0.0", "text": "def build_generic_wins(max_moves)\n max_moves = max_resolve_depth if max_moves > max_resolve_depth\n\n state_array = [0] * (board_size**2 - 1) + [max_exponent]\n result = [State.new(state_array)]\n\n top_index = ...
[ { "docid": "03dfd3bfcef9c49bd7ea213eb033a056", "score": "0.67674905", "text": "def draw_tiles\n num = 7 - @their_tiles.length\n # fills tiles array until it has 7 letters from the given tile bag\n if num > 0\n new_tiles = @tilebag.draw_tiles(num)\n @their_tiles << new_tiles\n return @t...
d96e918f111219855b24e71821445b8e
Like param, except this defines required parameter.
[ { "docid": "ea8509b65bbf7750148b992b2b6c8c19", "score": "0.7033372", "text": "def param!( name, *args, &block )\n param( name, *args, required: true, &block )\n end", "title": "" } ]
[ { "docid": "c3474b21bc91be3a322e03c50d30b91d", "score": "0.73626614", "text": "def required=(_arg0); end", "title": "" }, { "docid": "9c2c5776f4fbfb5df3f4fe776b63e42d", "score": "0.71381384", "text": "def param\n raise \"Must give parameter name\"\n end", "title": "" }, {...
eb1cfcd8216ca49e8aaa0d616b01adcc
Returns the page number. By default, this is the page parameter or 1 if it is empty.
[ { "docid": "dcdc47fbc8e34a8891a4f5af90a6a856", "score": "0.87916833", "text": "def page\n return 1 if !params[page_param] || params[page_param].empty?\n params[page_param].to_i\n end", "title": "" } ]
[ { "docid": "4471ce72531b70db1878a5d8b3902a60", "score": "0.88303", "text": "def page_num\n params.fetch(page_num_key, page_num_default).to_i\n end", "title": "" }, { "docid": "5e91da98392eac313042b39da9f2bc3b", "score": "0.869347", "text": "def page_number\n @page_nu...
250046bd8299c73a18ea5aac3ab6210b
The adjusted filenames of the files in the zipfile, without the Build folder prefix. index.html, assets/images/logo.png
[ { "docid": "78291ef7eecc3f3bb11b77ca7d6606c6", "score": "0.6897954", "text": "def filenames\n return @filenames if @filenames\n filenames = zipfile_filenames\n\n filenames = filenames.select do |zipfile|\n !(zipfile =~ /__MACOSX/ or zipfile =~ /\\.DS_Store/ or zipfile.end_with? \"/\" or zi...
[ { "docid": "2ec3701b830ee093fa6465b415c3ef32", "score": "0.65556604", "text": "def zipfile_filenames\n zipped_file.entries.collect(&:name)\n end", "title": "" }, { "docid": "106bcfe1fbc06baaffc67500c821b8b3", "score": "0.6498019", "text": "def file_name\n \"#{full_identifier}....
44b090d91fba643a5d3cfe59fe312b99
Checks that a binding is in a local file context. Extracted from source://prynav//lib/prynav.rb16
[ { "docid": "08c8168a2a5bda80f30f94b4ca155478", "score": "0.6344549", "text": "def check_file_context(target); end", "title": "" } ]
[ { "docid": "b8942ffaf0a664016ce8e3f31cb56a03", "score": "0.73547304", "text": "def check_file_context\n unless PryDebugger.check_file_context(target)\n raise Pry::CommandError, 'Cannot find local context. Did you use `binding.pry`?'\n end\n end", "title": "" }, { ...
e4c1d1db137fd7b49f1732103d0045a5
end of parse function
[ { "docid": "84dd5a16328d05d510ce65a95013eb51", "score": "0.0", "text": "def main\n log_file=File.open(\"foodwine.log\", \"a+\")\n urls = File.open(\"urls\",\"r\")\n while test_url = urls.gets\n parse(test_url, log_file)\n end\n end", "title": "" } ]
[ { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.8773175", "text": "def parse; end", "title": "" }, { "docid": "cfc64655d8a635c2b0e52549825348ed", "score": "0.8773175", "text": "def parse; end", "title": "" }, { "docid": "5c992738078fd55d4beaf0f584d51e39", "...
af605d447b6692006eab812cd1072509
POST /liftdata POST /liftdata.json
[ { "docid": "8ca73663227a4b528a2437550353a828", "score": "0.6093812", "text": "def create\n @liftdatum = Liftdatum.new(liftdatum_params)\n\n respond_to do |format|\n if @liftdatum.save\n format.html { redirect_to @liftdatum, notice: 'Liftdatum was successfully created.' }\n forma...
[ { "docid": "dc2361bb680355251a23bb0ab1af67e1", "score": "0.5778822", "text": "def create\n @iot_datum = IotDatum.new(iot_datum_params)\n\n respond_to do |format|\n if @iot_datum.save\n format.html { redirect_to @iot_datum, notice: \"Iot datum was successfully created.\" }\n form...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ae16fe658f5d9f541b5adfb87230d978", "score": "0.0", "text": "def set_heroe\n @heroe = Heroe.find(params[:hero_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;...
5fcc9a3b39b699292f1c020b5d13f67e
This not a test
[ { "docid": "a37a3e8a174053c350332cefa4252a36", "score": "0.0", "text": "def test_001\n assert true\n end", "title": "" } ]
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.72362393", "text": "def desired; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", "score": "0.7019342", "text": "def spec; end", "title": "" }, { "docid": "072514f3348fe62556dcdfd4b06e3d08", ...
f621854a48f8fa28d1cb506ec1cea006
This API method: Marks the conversion of the campaign for a particular goal 1. validates the arguments being passed 2. Checks if user is eligible to get bucketed into the campaign, 3. Gets the assigned deterministic variation to the user(based on user_d), if user becomes part of campaign 4. Sends an impression call to ...
[ { "docid": "78b1b9f73c6640f73a9b4bc9032612e3", "score": "0.5850008", "text": "def track(campaign_test_key, user_id, goal_identifier, *args)\n if args.is_a?(Array)\n revenue_value = args[0]\n elsif args.is_a?(Hash)\n revenue_value = args['revenue_value']\n end\n\n # Check for valid ...
[ { "docid": "3697303ade655de4d84d4131ec4fda78", "score": "0.6396752", "text": "def track(campaign_key, user_id, goal_identifier, *args)\n if args[0].is_a?(Hash)\n revenue_value = args[0]['revenue_value'] || args[0][:revenue_value]\n custom_variables = args[0]['custom_variables'] || args[0][:...
4cfd595e740f0b41dab655c18750f0cc
POST /ra_khoi_dangs POST /ra_khoi_dangs.json
[ { "docid": "64276f5569a3fd122e3ee242110f7789", "score": "0.7063042", "text": "def create\n @ra_khoi_dang = RaKhoiDang.new(ra_khoi_dang_params)\n\n respond_to do |format|\n if @ra_khoi_dang.save\n format.html { redirect_to @ra_khoi_dang, notice: 'Ra khoi dang was successfully created.' ...
[ { "docid": "e46d9c4d74e9e30bc2312eda1f88c904", "score": "0.66213447", "text": "def ra_khoi_dang_params\n params.require(:ra_khoi_dang).permit(:name, :description, :enabled, :ngay_ra_khoi_dang, :hinh_thuc_ra_khoi_dang)\n end", "title": "" }, { "docid": "1855a170c24c2bdd6916e5de852f77c...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "78385fd6e0a6916dd5152852c9df8b7f", "score": "0.0", "text": "def bet_params\n params.require(:bet).permit(:team_one, :team_two, :team_one_chance, :team_two_chance, :team_one_value, :team_two_value, :winner, :bets_on_team_one, :bets_on_team_two, :match_starts_at, :game, :bestof, :stream_l...
[ { "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...
91764dd84022f6bae60e5c89b7afb1a7
generic method to click on a button
[ { "docid": "455aef0dcd2180208c8d9efcaed3d0b1", "score": "0.81806403", "text": "def click_on_a_button(selector)\n\n click_button(selector)\n\n end", "title": "" } ]
[ { "docid": "a875d299e16621213a3e414b2850d3cd", "score": "0.8082766", "text": "def click_button(button = T.unsafe(nil)); end", "title": "" }, { "docid": "0bc31ba6e224c69b27f9ee4d67eea650", "score": "0.77958995", "text": "def click_button(value = nil)\n find_button(value).click\n ...
9dbc8db136f2cc5a6419cbd3aa594c60
GET /product_product_groups/1 GET /product_product_groups/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "8d02c77a17f65addcb79711e1d088db4", "score": "0.75215185", "text": "def show\n @product_group = ProductGroup.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @product_group }\n end\n end", "title": "" }, { ...
a296a94c9f9a81961d9c88f098d48821
Screen X sets X based on current map position
[ { "docid": "fab96d5c410e82e3d3e1391bced6836c", "score": "0.7791194", "text": "def screen_x\n x = (@real_x - $game_map.display_x + 3) / 4\n return x\n end", "title": "" } ]
[ { "docid": "f4e322f9f64b14e731cc4e8c1434cb74", "score": "0.7797414", "text": "def screen_x\r\n ret = ((@real_x - self.map.display_x) / Game_Map::X_SUBPIXELS).round\r\n ret += @width * Game_Map::TILE_WIDTH / 2\r\n return ret\r\n end", "title": "" }, { "docid": "a71439d5804ebbc93cb37...
debeb2552955ab7de945c230d0e3713a
, :except => [:index, :show] GET /courses
[ { "docid": "728483e02a019cb86197f4be32742c98", "score": "0.77987146", "text": "def index\n if is_admin?(current_user)\n @courses = Course.find(:all, :order => \"code\")\n @allow_create = true\n else\n # TODO: show own courses\n @courses = Course.find(:all, :order => \"code\")\n...
[ { "docid": "763dd0d1c31030e1c0d6a618a06407a6", "score": "0.7776144", "text": "def index\n @courses = Course.all\n respond_to do |format|\n format.html\n end\n end", "title": "" }, { "docid": "0c131d9434c785c004b76521c97c2d58", "score": "0.77761114", "text": "def index\...
7c45e4d5120434715edca080ccf11af7
=begin Close GroupLoan =end return the active_group_loan_memberships.count (always changing weekly) bad_debt_allowance should be updated on uncollectible creation, uncollectible clearance, and on the run_away end_of_cycle resolution it should be updated on group loan close: we use member's compulsory savings to cover f...
[ { "docid": "9ee5b8ce5b7d0843a4fe8bfb6a743407", "score": "0.0", "text": "def weekly_collection_amount \n if self.group_loan_weekly_collections.count == 0 \n return 0 \n else\n return self.group_loan_weekly_collections.first.amount_receivable\n end\n \n end", "title": "" } ]
[ { "docid": "2cbd0e331d9b3b2f63225340af319752", "score": "0.6959802", "text": "def active_group_loan_memberships\n current_week_number = self.week_number\n \n if not group_loan.is_closed?\n # puts \"NON-CLOSED case.. the current week number: #{current_week_number}\"\n return group_loan...
6a9ea7878e4984520d329496d85fc9f0
This enables us to have a group of checkboxes that is backed by the array stored in Spotlight::BlacklightConfigurationdocument_index_view_types
[ { "docid": "04689c5cb14730a085c289db76b26862", "score": "0.69070446", "text": "def document_index_view_types\n vals = configuration.document_index_view_types\n Blacklight::OpenStructWithHashAccess.new.tap do |s|\n view_type_options.each do |k|\n s[k] = vals.include?(k.to_s)\n ...
[ { "docid": "72f68caff9d0dde33df213c50ff821f7", "score": "0.5956596", "text": "def index\n @chkboxes = Chkbox.all\n end", "title": "" }, { "docid": "26aa236416a987073e07fc78c1a70941", "score": "0.5829136", "text": "def index_fields_for_view view = :list\n index_fields.select ...
3acb16473f4f723ff9266205f3c9c23e
Aspect.new (:around | :before | :after | :after_returning | :after_raising ) \ (:pointcuts => [...]), | \ ((:types => [...] | :types_and_ancestors => [...] | :types_and_descendents => [...] \ :objects => [...]), :methods => [], :method_options => [...], \ :attributes => [...], :attribute_options[...]), \ (:advice = adv...
[ { "docid": "573321331986cb41950f5922620c41c4", "score": "0.0", "text": "def initialize *options, &block\n @first_option_that_was_method = []\n opts = rationalize options\n init_specification opts, CANONICAL_OPTIONS, &block\n init_pointcuts\n validate_specification\n ...
[ { "docid": "c52b723e7b47a692c619fb4f7e46b92e", "score": "0.6617826", "text": "def advice_applicable(aspect, klass, meth)\n wp = WeavePoint.new(klass,meth)\n aspect.crosscut(wp) if aspect.crosscheck?(wp)\n end", "title": "" }, { "docid": "e3d7dc1c74742d363765b270854e4690", ...
f95c55c08c1299c2aed739e95c05adb2
Return true if the file or directory path exists.
[ { "docid": "1783f34470e0ecf85a4424a5382c60bb", "score": "0.0", "text": "def exists?(ftp_path)\n File.exists?(expand_ftp_path(ftp_path))\n end", "title": "" } ]
[ { "docid": "ff490a8c18fd68d1d3d719eb1ea450ab", "score": "0.87666184", "text": "def exists?\n File.exists? path\n end", "title": "" }, { "docid": "e71a4fc54a651fc9a8d6a415a9dac0a7", "score": "0.8736754", "text": "def file_exists? path\n (File.exists? path) && !(File.direc...
ab5fa21e51930c2e21172bb6555bea15
return an array of the products actually bought
[ { "docid": "dc96cc76aa3dd923091ce30bee051c5d", "score": "0.7906645", "text": "def get_products_bought\n res = []\n\n @data.product_qty.each do |prd_id, qty|\n qty = qty.to_i\n if qty > 0\n res << [ qty, @data.products.with_id(prd_id) ]\n end\n end\n\n res\n end", "...
[ { "docid": "f27c3416fbf017a8ddf7ea6d853b1990", "score": "0.76351076", "text": "def products\n products_this_vendor_sells = []\n products_to_check = FarMar::Product.all\n products_to_check.each do |product_to_check|\n if self.id == product_to_check.vendor_id\n products_this_vendor_...
b2135831ec0e164206cafd655e483de4
GET /groups/1 GET /groups/1.json
[ { "docid": "38672b0bc55025a197b61e31fd25e430", "score": "0.0", "text": "def show\n @friends = []\n @ids = []\n @Imgs = []\n @group.friendships.each do |friendship|\n @friends.push(User.find(friendship.friend_id).name)\n @ids.push(friendship.friend_id)\n @Imgs.push(User.find(fr...
[ { "docid": "7761dcbf8079fbe8d9838f059e843811", "score": "0.8015803", "text": "def groups\n @page = 'groups'\n respond_to do |format|\n format.html {\n @groups = Group.find(:all)\n }\n format.json { }\n end\n end", "title": "" }, { "docid": "1f843b01e13360c0143...
176289defc2586b7cb851643874660db
DELETE /products/1 DELETE /products/1.json
[ { "docid": "b686c2543d0ee1a1f8b052a97ba05336", "score": "0.0", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to @product.page, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "2fa0a3656e86962ca1a10fa31aede189", "score": "0.7657799", "text": "def destroy\n @productos_json.destroy\n respond_to do |format|\n format.html { redirect_to productos_jsons_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "65950...
3e89f0177b7d472c0624058ccaaa5abf
encode a string for use in rest call
[ { "docid": "a866ef932fab912f34929a2faffe702e", "score": "0.7032214", "text": "def url_encode(string)\n string = CGI.escape string\n end", "title": "" } ]
[ { "docid": "4093fb796cd8a6ab5f319912d314d7cc", "score": "0.82580954", "text": "def encode_string; end", "title": "" }, { "docid": "b47f72c1d89292e5604042675145e65f", "score": "0.810062", "text": "def encode(string); end", "title": "" }, { "docid": "3bbb1f58ac7790b988f9758...
917d27d3b7a291ff0675e10b298fdbb3
creates song post as buzz
[ { "docid": "a6f1f0c23de2f85d5e452a352753e50d", "score": "0.69131386", "text": "def song_buzz_post\n @status = true\n if request.xhr?\n begin\n @song = Song.find params[:id]\n @buzz = Post.create_post_for @song, @user, @actor, par...
[ { "docid": "e03faea7954bf0862d2c501936e2a206", "score": "0.6834681", "text": "def create\n user_id = @session.user_id\n @post = Post.create(user_id: user_id)\n @song = Song.exists?(spotify_url: params[:song][:spotify_url]) ? Song.find_by(spotify_url: params[:song][:spotify_url]) : Song.create(s...
1f15c46c1a2b8e5cbd5350c35dcc36bf
Initializes a basic scanned client to do an ismaster check.
[ { "docid": "df4bec6dc12a551c9bef391aa82fbaf1", "score": "0.0", "text": "def initialize_scanned_client!\n Mongo::Client.new(ADDRESSES, TEST_OPTIONS.merge(database: TEST_DB))\nend", "title": "" } ]
[ { "docid": "eb11846e0b9764c75f3e8c2ed4353e44", "score": "0.71610296", "text": "def initialize_scanned_client!\n ClientRegistry.instance.global_client('basic')\nend", "title": "" }, { "docid": "623ea8f3191e8949289fccc5719b59bc", "score": "0.7063258", "text": "def clientSetup\n b...
052131abe3d8932414b4bcee898c2454
PATCH/PUT /qa_sessions/1 PATCH/PUT /qa_sessions/1.json
[ { "docid": "8843e283458da9fbd8d03283ac977661", "score": "0.7228708", "text": "def update\n respond_to do |format|\n if @qa_session.update(qa_session_params)\n format.html { redirect_to @qa_session, notice: 'QA session was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "c53fdbafebb96b41db600e393e5b003e", "score": "0.675417", "text": "def touch\n session_check!\n begin\n JSON.parse(put(full_path(\"sessions/#{session_id}\")))\n rescue => error\n handle_request_exception(error)\n end\n end", "title": "" }, { "do...
cc9d4d1140d6194713fe7695b95fc1d9
PATCH/PUT /deletemes/1 PATCH/PUT /deletemes/1.json
[ { "docid": "e2c9054ac70a0d31ca7317637d61b003", "score": "0.6220466", "text": "def update\n respond_to do |format|\n if @deleteme.update(deleteme_params)\n format.html { redirect_to @deleteme, notice: 'Deleteme was successfully updated.' }\n format.json { render :show, status: :ok, ...
[ { "docid": "b637f7971f99842ccc3b5275b234cfc8", "score": "0.6693644", "text": "def destroy\n @deleteme = Deleteme.find(params[:id])\n @deleteme.destroy\n\n respond_to do |format|\n format.html { redirect_to deletemes_url }\n format.json { head :no_content }\n end\n end", "title...
773ba09b17bcb9491394e5f633823f3c
Creates a new Person object
[ { "docid": "f0d7cf8b9bad950b20abd45d249ab9d8", "score": "0.7239399", "text": "def new\n @person = Person.new\n end", "title": "" } ]
[ { "docid": "d89a40bbf15d861e0926d07110b2e5b4", "score": "0.7953122", "text": "def new_person\r\n @person = Person.new\r\n end", "title": "" }, { "docid": "9949975d046e33d1f55e6f725d256f66", "score": "0.7177833", "text": "def create_person\n Neography::Node.create(\"object_...
b9edb0f6ddc3fa7585dc4673a7c77d9e
Raw hash of user info needed when the FieldData Hash[] overrides are an annoyance
[ { "docid": "4e1dfd0ce84b15140a8bb98d2d216fd4", "score": "0.0", "text": "def info_hash\r\n return {} if data.nil?\r\n JSON.parse data\r\n end", "title": "" } ]
[ { "docid": "5455797d804e55771d0ddf1e5eac24c2", "score": "0.72645205", "text": "def hash\n super +\n @authentication_method.hash +\n @fingerprint.hash +\n @port.hash +\n @user.hash\n end", "title": "" }, { "docid": "71f3fdf81e1bc9a8f918c4ceefb311f2", "score": "...
d6acc16b3d3455a61ff1ecae733ffe61
Send the current report in text format
[ { "docid": "3a6f42fb98e36a08f2792d90315d7d5f", "score": "0.69095945", "text": "def render_txt\n report = report_for_rendering\n filename = filename_timestamp(report.title)\n disable_client_cache\n send_data(report.to_text, :filename => \"#{filename}.txt\")\n end", "title": "" } ]
[ { "docid": "754f04d7d80f0aaa623023bdde3fec24", "score": "0.69030905", "text": "def output_report\n report = \"\"\n report << '<html>'\n report << ' <head>'\n report << \" <title>#{@title}</title>\"\n report << ' </head>'\n report << ' <body>'\n @text.each { |line| report << \"...
a4f7ead2812838660fd6971796399494
Register the given platform handler classes Parameters:: platform_handlers (Hash): The platform handler classes, per platform type name
[ { "docid": "6ef3f5ab06f30f1f2ba8b6eff11d3e64", "score": "0.8427596", "text": "def register_platform_handlers(platform_handlers)\n register_plugins(:platform_handler, platform_handlers)\n end", "title": "" } ]
[ { "docid": "417f654e9240a456b241d6565c211da7", "score": "0.6862744", "text": "def register(platform_class)\n raise \"Cannot register class #{platform_class} which does not subclass from Platform\" unless platform_class < Platform\n @platforms_by_name[platform_class.name] = platform_class\n end", ...
def3ac82aa8daecf8e0b7b1ce7331bad
GET /matches/1 GET /matches/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1a1b3c4b949ec99da514a1e554ca3e5e", "score": "0.7709942", "text": "def index\n @matches = Match.all\n\n respond_to do |format|\n format.html\n format.json { render json: @matches }\n end\n end", "title": "" }, { "docid": "cfc19ca3848dd73ca0c6f751f54fcaa0", ...
83475102b91803491988d930f6efa0be
Display the trend icon : === Optional parameters :empty: true|false. Show an empty transparent image when no trend or no measure. Default is false. :big : true|false (default is false). Default is 10x10px. Big is 16x16px. === Examples trend_icon('ncloc') trend_icon(measure('ncloc')) trend_icon('ncloc', :empty => true)
[ { "docid": "4d5a033d1a5e6fa855fe59fd9935ac4e", "score": "0.7967419", "text": "def trend_icon(metric_or_measure, options={})\n m=nil\n if metric_or_measure.is_a? ProjectMeasure\n m = metric_or_measure\n elsif @snapshot\n m = @snapshot.measure(metric_or_measure)\n end\n\n if optio...
[ { "docid": "2772678bc2fd86e1461c11437de05d45", "score": "0.7893009", "text": "def tendency_icon(metric_or_measure, small=true, no_tendency_img=true)\n trend_icon(metric_or_measure, {:big => !small, :empty => !no_tendency_img})\n end", "title": "" }, { "docid": "2d98caecd468b7903337d1ae61...
f068259806455578f617777106e077ad
GET /people/new GET /people/new.json
[ { "docid": "2f25c9e30b697e6f23d50df4ecc5a9cc", "score": "0.7132117", "text": "def new\n @person = Person.new\n @hair_colours = Person.get_hair_colours\n @eye_colours = Person.get_eye_colours\n @heights_feet = Person.get_heights_feet\n @heights_inches = Person.get_heights_inches\n\n res...
[ { "docid": "6591334d64f5ace8500a624da05f811a", "score": "0.79892075", "text": "def new\n @person = people_type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "title": "" }, { "docid": "e4e2f0df213a8b75729f7...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "d3aadd45362f4d84deda2f354a9832f4", "score": "0.0", "text": "def examen_tipo_params\r\n params.require(:examen_tipo).permit(:tipo)\r\n end", "title": "" } ]
[ { "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...
e06226ed3bbc16b9e72cbab0fe8f503f
Get local file size in bytes.
[ { "docid": "29c6a742647ee4f42d00e02c4d7a8fc7", "score": "0.8175527", "text": "def local_size\n return @local_size if defined?(@local_size)\n @local_size = File.size(\"#{resource[:name]}\")\n end", "title": "" } ]
[ { "docid": "0959cc7a1b0d9ae629f573fd515d5873", "score": "0.7677811", "text": "def getFileSize()\n getRealFileSize(file) / MEGABYTE\n end", "title": "" }, { "docid": "937e42216f7e7b38f4425b2380b8b250", "score": "0.7566095", "text": "def file_size\n stream.size\n end", ...
c3c38f6e48c3e9fb378e1f2df7af0a6c
Extract the file name from given path or input file.
[ { "docid": "1d58bc0006e64380bc8964d8c0ac338b", "score": "0.76945573", "text": "def file_name\n path[/([^\\/]+\\.[^\\/]+)$/, 1] || begin\n if base.input\n base_name(base.input.path).tap do |name|\n if base.profile\n name << \".#{base.profil...
[ { "docid": "cf0ae39b22df0ba2b93204dff4e4ffcf", "score": "0.83989793", "text": "def extract_name(file_path)\n ::File.basename(file_path)\n end", "title": "" }, { "docid": "a6251ca28c897c558c3afde76e9e4505", "score": "0.80712086", "text": "def extract_name(file_path)\n if file...
e90501ffaca0c50b4a93875e105d7576
param_to_dword(v) assembles the buffers "in" and "inout"
[ { "docid": "d06378ae363f5385337c61145347159b", "score": "0.0", "text": "def assemble_buffer(direction, function, args)\n\t\t\t\t\t\t\tlayout = {} # paramName => BufferItem\n\t\t\t\t\t\t\tblob = \"\"\n\t\t\t\t\t\t\t#puts \" building buffer: #{direction}\"\n\t\t\t\t\t\t\tfunction.params.each_with_index do...
[ { "docid": "8bcff6f4b7c7718ce92a30e703e0a024", "score": "0.70718133", "text": "def param_to_dword(v)\n\t\t\t\t\t\t\tif v.class == Fixnum then\n\t\t\t\t\t\t\t\treturn v # ok, it's already a number\n\t\t\t\t\t\t\telsif v.class == Bignum then\n\t\t\t\t\t\t\t\treturn v # ok, it's already a number\n\t\t\t\t\...
a91e73cbeffc3a4cb8634eabfeadec99
Name search helper function.
[ { "docid": "340f87b8e3b19ed913a7ff057e99a16f", "score": "0.0", "text": "def user_by_name(name_input)\n name_info = name_input.tickets.first.user_id\n name_with_band = name_input.tickets.first.band_name\n puts \"-- Looks like #{User.find(name_info).name} has a ticket for #{name_with_band}....
[ { "docid": "acc7fcde2bb7397d0f6b0950c7f94418", "score": "0.78261954", "text": "def name_search(namespace); end", "title": "" }, { "docid": "acc7fcde2bb7397d0f6b0950c7f94418", "score": "0.78261954", "text": "def name_search(namespace); end", "title": "" }, { "docid": "4391...
857bd731450a832491b7634a2f119fb0
Returns the first email address within the list of contact details.
[ { "docid": "fe713565147be7a4ff605b678b5cb6c9", "score": "0.5730411", "text": "def email\n find_by_type('email')\n end", "title": "" } ]
[ { "docid": "6f25c9ff6b17bb5e7752eb3a81bcda51", "score": "0.78123474", "text": "def primary_email\n primary_contacts(emails, :email_rank_code, &:first)\n end", "title": "" }, { "docid": "de629c7b9bcaf1d25f6af30060692b3e", "score": "0.75458294", "text": "def email_address\n ...
308c0616bab7e0aa2720d5437d8b65c9
Public: Marks a piece as forcefully added.
[ { "docid": "0c954dc0bbf592f06fb05ae6e7d03d87", "score": "0.50302374", "text": "def mark_as_forced!\n @forced = true\n end", "title": "" } ]
[ { "docid": "160ee6b38dc86d36aedfd1693fff3504", "score": "0.66445506", "text": "def add_piece piece\n @pieces.push piece\n piece\n end", "title": "" }, { "docid": "94d7f0c4c8d7e89c9115da17d7e40ef1", "score": "0.66124725", "text": "def add_piece(piece)\n\n\tend", "title": ""...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "e7240c230e588e1cf7d152e7528aaac5", "score": "0.0", "text": "def set_betum\n @betum = Betum.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;...
698c66a0e426a5e41842cfaa720b46cc
Turn the player toward the event of it's choice
[ { "docid": "8e20ac3736965dd20b84551948d5070b", "score": "0.0", "text": "def look_to_event(event = '0')\n event = event.to_i\n event == 0 ? $game_player.look_to($game_system.map_interpreter.event_id) : $game_player.look_to(event)\n end", "title": "" } ]
[ { "docid": "de50c2e3ccc19ecb38076698b6e130f8", "score": "0.67281395", "text": "def turn_around\n turn_left\n turn_left\n end", "title": "" }, { "docid": "872675ae5b43026acb73d4157ae32d78", "score": "0.66420406", "text": "def turn\r\n place = current_player.select_place(self...
d007fe7702b49940ce5ee605a2b5dd81
Write a method that searches for all multiples of 3 or 5 that lie between 1 and some other number, and then computes the sum of those multiples. For instance, if the supplied number is 20, the result should be 98 (3 + 5 + 6 + 9 + 10 + 12 + 15 + 18 + 20). You may assume that the number passed in is an integer greater th...
[ { "docid": "758a5be6be2840c530c7fa9c6c9a7d5e", "score": "0.0", "text": "def multisum(num)\n ary = []\n\n num.times do\n ary << num if num % 5 == 0 || num % 3 == 0\n num -= 1\n end\n\n sum = 0\n ary.each { |n| sum += n }\n sum\nend", "title": "" } ]
[ { "docid": "497795de8378018793f15eb8611acaae", "score": "0.8406351", "text": "def sum_multiples_of_3_or_5\n (1..999).to_a.select { |n| n.multiple_of?(3) or n.multiple_of?(5) }.inject(&:+)\nend", "title": "" }, { "docid": "f47c495f0562acd3c3964d7814e68947", "score": "0.8371121", "tex...
946959267662e9a65d49d2f139c766a7
root mean square error of prediction
[ { "docid": "7acb86f33ae8ea0b0a8c7f8e4564c25f", "score": "0.6644807", "text": "def rms\n result=0\n @predictions.each do |pred|\n result=result+(pred[:prediction]-pred[:rating])**2\n end\n return (result/@predictions.length)**0.5\n end", "title": "" } ]
[ { "docid": "a39fff7ffcf86c6c4ee36a320206679f", "score": "0.74670166", "text": "def mean\n sum = 0\n pred_error.each{|e| sum += e}\n sum/pred_error.length.to_f\n end", "title": "" }, { "docid": "fe5f9177d8165eed0dd732cf6934d6dd", "score": "0.73948956", "text": "def mean\n\t\...
411f33cea6677b737f3664365ac24833
Searches for a Handle based on an +hdl:+ identifier. Displays a 404 (via raised +Blacklight::Exceptions::RecordNotFound+ that is handled with +Hydra::Catalog+) if no item is found.
[ { "docid": "75ef486fe873e4c1533d72e7cb92b070", "score": "0.5918541", "text": "def show\n query = query_for_identifier(Spot::Identifier.new('hdl', params[:id]))\n result, _documents = repository.search(query)\n\n raise Blacklight::Exceptions::RecordNotFound if result.response['numFound'].zero?\n...
[ { "docid": "6d8a6fc5a3c97205087c8e1b576689a4", "score": "0.57205427", "text": "def record_not_found\n render :text => \"404 Not Found\", :status => 404\n end", "title": "" }, { "docid": "e75d7e53ff7bd6f3fd4c1f6a8df45a24", "score": "0.5671869", "text": "def find(hand...
77bc21717cf11a4cb2d363095b57976a
Similar to Datasetjoin_table, but uses unambiguous aliases for selected columns and keeps metadata about the aliases for use in other methods. Arguments: dataset :: Can be a symbol (specifying a table), another dataset, or an SQL::Identifier, SQL::QualifiedIdentifier, or SQL::AliasedExpression. join_conditions :: Any c...
[ { "docid": "f3bef077f43f13fa4c5f61e504c39260", "score": "0.72410256", "text": "def graph(dataset, join_conditions = nil, options = OPTS, &block)\n # Allow the use of a dataset or symbol as the first argument\n # Find the table name/dataset based on the argument\n table_alias = options[:ta...
[ { "docid": "d4820e4e5d9c4fc59e57cea6b865a5db", "score": "0.71457016", "text": "def _join_table_dataset(opts)\n ds = model.db.from(opts.join_table_source)\n opts[:join_table_block] ? opts[:join_table_block].call(ds) : ds\n end", "title": "" }, { "docid": "6a5a82079d23...
b939a559d2bdc4aca0ea54fd0b19b59f
DELETE /project_planifications/1 DELETE /project_planifications/1.json
[ { "docid": "0c0768e06011ba91d868d71e0818845a", "score": "0.74761856", "text": "def destroy\n @project_planification.destroy\n respond_to do |format|\n format.html { redirect_to project_planifications_url, notice: 'Project planification was successfully destroyed.' }\n format.json { head ...
[ { "docid": "1767b8160b1264046406a40f1ebb0b5e", "score": "0.75897485", "text": "def destroy\n @plan_project = PlanProject.find(params[:id])\n @plan_project.destroy\n\n respond_to do |format|\n format.html { redirect_to plan_projects_url }\n format.json { head :no_content }\n end\n ...
38bdda46463859eeef51ed00f10f527f
GET /wikiraces GET /wikiraces.json
[ { "docid": "8021f18af83375c6f05a3de8ec7d18ee", "score": "0.79262125", "text": "def index\n @wikiraces = Wikirace.all\n end", "title": "" } ]
[ { "docid": "06d02292cc11c78cabdf174bd6e3bf55", "score": "0.6723427", "text": "def index\n @wikis = Wiki.all\n\n render json: @wikis\n end", "title": "" }, { "docid": "c6799eca6c4a83bef4a7194094bd6e21", "score": "0.6489699", "text": "def show\n @wiki = Wiki.find(params[:id])...
fe5fdbd3a926d272aa52ce94e7743929
add a work which will be assigned to existing project
[ { "docid": "54332455da10ba2a864d0b3182eb9951", "score": "0.57748497", "text": "def add_version\n @disable_footer = true\n # show all works under this project (all versions)\n # @works = @project.works.all\n\n end", "title": "" } ]
[ { "docid": "0a856151fc2a523106d9bb3d529045c1", "score": "0.66306204", "text": "def add_work(&bl)\n client.add_work &bl\n end", "title": "" }, { "docid": "cb4ae9a05b829ca18559d2f8595b3bb0", "score": "0.6469831", "text": "def add machinename, title, description, maintainers...
cc83535972e4eb7b3280ff1d1d47a9cc
send a signup email to the user, pass in the user object that contains the user's email address
[ { "docid": "340881b4dd59530c03ef109b09ac67de", "score": "0.7882892", "text": "def send_signup_email(user)\n @user = user\n mail(:to => @user.username,\n :subject => 'Welcome to The Super Star Productions ')\n end", "title": "" } ]
[ { "docid": "c4f54f4a7ea8a136d1594326e89ffbca", "score": "0.86395794", "text": "def signup_email(user)\n @user = user\n mail(\n to: user.email,\n subject: 'Thanks for signing up'\n )\n end", "title": "" }, { "docid": "bec8e458a1de30df6d976a01b138f00a", "score": "0.8534...
16f3a0a823516328a27769fb05406a26
calculate deviation from value to mean
[ { "docid": "cb60c1863ce8e6f87a5d164a5da8bcf1", "score": "0.8107371", "text": "def deviation(datum)\n datum.to_f - mean.to_f\n end", "title": "" } ]
[ { "docid": "8d445019476c46ef6bf670e3356dc021", "score": "0.7886075", "text": "def stddev()\n if mean == -1\n mean()\n end\n\n sum = 0\n @difference.each do |item|\n sum += (item - @mean) ** 2\n end\n\n stddev = (sum / difference.length) ** 0.5\n\n return stddev\n end", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "ddd61e0b686571ad014731193e5cc7de", "score": "0.0", "text": "def agent_params\n params.require(:agent).permit(:fname, :lname, :username, :password, :password_confirmation, :old_password, :req_password, :isAdmin)\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...
646cc78b95f0bce49b2c9fc707ca625d
POST /loantypemasters POST /loantypemasters.xml
[ { "docid": "c636c0c7ef30823c519a1a704ef4804b", "score": "0.65757924", "text": "def create\n @loantypemaster = Loantypemaster.new(params[:loantypemaster])\n\n respond_to do |format|\n if @loantypemaster.save\n format.html { redirect_to(@loantypemaster, :notice => 'Loantypemaster was suc...
[ { "docid": "84cd04a338c14e270e6d75c8778211a0", "score": "0.58686167", "text": "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "title": "" }, { "docid": "fd806d00ec42bc52a68ddf49413...
5458a911b19b2066abb89866ba449bb8
set stream by Param
[ { "docid": "c2992165cbf6fa8c2dcb50f3541d9c66", "score": "0.84942263", "text": "def setStreamByParam(param)\n strm = $stdout ;\n\n if(param.key?('stream'))\n strm = param['stream'] ;\n elsif(param.key?('filename'))\n strm = File::open(param['filename'],\"w\") ;\n openfilep = TRUE ...
[ { "docid": "5b8ca405a4f9860e68513d574c009879", "score": "0.75502056", "text": "def stream(arg)\n @stream = arg\n end", "title": "" }, { "docid": "6ccfc991744279ace61062224c06d5a5", "score": "0.7497093", "text": "def set_stream\n @stream = Stream.find(params[:id] || params[...
25ebfa73363f698cdd806d1b507e5b17
Prepare with a predefined configuration:
[ { "docid": "83c5811412dff532ca24d980e70df85e", "score": "0.0", "text": "def initialize(opts={})\n update_options(opts)\n end", "title": "" } ]
[ { "docid": "6d959cc05a17881fd084c750d8be7081", "score": "0.78693205", "text": "def prepare!\n configure if configuration_valid?\n end", "title": "" }, { "docid": "c462f70069dd7cfbfc3653b459e42199", "score": "0.68289614", "text": "def prepare\n end", "title": "" }, { ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "52e2e7204623c468af6df99606a66448", "score": "0.0", "text": "def set_post\n @post = Post.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165422", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60457647", "text": "def action_hook...
e5e8e650b1d5e2d13aa1e5db330ac458
get_contestant_name(data, "Cruise Ship Singer")
[ { "docid": "40d804af9ae356d9ec041a818d6acdec", "score": "0.0", "text": "def count_contestants_by_hometown(data, hometown)\n count = 0\n data.each do |key,value|\n value.each do |ele|\n ele.each do |key2,value2|\n if value2 == hometown\n count += 1\n end\n end\n e...
[ { "docid": "0a3b9b90392b6c31abfba7a376aaf8d4", "score": "0.7953974", "text": "def get_contestant_name data, occupation\n all_contestants(data).find{|person| person[\"occupation\"] == occupation}[\"name\"]\nend", "title": "" }, { "docid": "92e385590ee2f9a15a65c86ad1fdb278", "score": "0.7...
2262ca886d6106ca3fd88b76069ef600
Returns number of new issue
[ { "docid": "9f4ee4243d3e97cd9cb546d0bd2333a4", "score": "0.68153715", "text": "def new_issue(title)\n result = YAML.load(RestClient.post(\"https://github.com/api/v2/yaml/issues/open/#{@repository}\", :login => @username,\n :token => @api_token, :title => title))\n result[\"issue\"][\"number\"...
[ { "docid": "16120749f5de0afb85abf106be13ecec", "score": "0.6865219", "text": "def issue_count\n issue_count = 0\n self.sections.each { | section| issue_count += section.issue_count }\n issue_count\n end", "title": "" }, { "docid": "ba6adfb8c9c60cf8c45a574935af25a1", "score": "0...
5be08d220ef775c72ce2885cfbb31909
GET /foods/1 GET /foods/1.json
[ { "docid": "19b169d68417d90e48996ab0060e8f50", "score": "0.0", "text": "def show\n @remarks = @food.food_remarks.order(created_at: :desc).paginate(:page => params[:page])\n end", "title": "" } ]
[ { "docid": "1d75d0e51aa63155c707992528aea5f9", "score": "0.7138306", "text": "def food_info(food_id)\n get(\"/foods/#{food_id}.json\")\n end", "title": "" }, { "docid": "21ec62b145b846fb79ccb3fe133cfdf4", "score": "0.6934759", "text": "def show\n\n @food = Food.find(params...
fc52bccfb7b348ca6c155c70295c2a35
helper methods for working with a calendar week
[ { "docid": "e71c99280cebb2efd12c365c89ee23cd", "score": "0.0", "text": "def days_between(first, second)\n if first > second\n second + (7 - first)\n else\n second - first\n end\n end", "title": "" } ]
[ { "docid": "54f5c244b729713312644322cdcf0a27", "score": "0.80622435", "text": "def week() @week end", "title": "" }, { "docid": "f2cb3a06f55e1a77697325a02da87141", "score": "0.8050246", "text": "def week; end", "title": "" }, { "docid": "e7b9c5d2ebc166d7252e6479c51cd02b",...
254c82f5736da94c22f55ea4ae391e34
match is over if every team_list is empty but one
[ { "docid": "6e36f3b819896c29f54d6706e8f583a1", "score": "0.0", "text": "def is_over?() \n return false #currently hard-coded for non-elimination\n end", "title": "" } ]
[ { "docid": "f2354ca13b89df8fdf1131a502b1e0dc", "score": "0.67707217", "text": "def match!(team_name)\n GameMachine.logger.info \"match! team_name:#{team_name} teams:#{teams}\"\n if team = teams.teams.select {|team| team.name != team_name}.first\n return GameMachine::Models::StartM...
d7e547d3550bac2c2b4f7ad1bc970ca4
added should clean up strings with arbitrary spaces around commas
[ { "docid": "b258b4cec31bdf12a8d5d62c397d235c", "score": "0.0", "text": "def test_arbitrary_spaces_support\n p = Post.new\n p.tag_list = \"spaces,should, not,matter\"\n p.save!\n p.tags.reload\n assert_equal [\"spaces\",\"should\",\"not\",\"matter\"], p.tag_list.to_a\n end", "title":...
[ { "docid": "af02ffc1ba0b1dff2a546fdc52ba33e1", "score": "0.78378046", "text": "def cleanupstr (str)\n str.strip.gsub(/\\s+/, ' ').gsub(/ ,/, ',') unless str.nil?\n end", "title": "" }, { "docid": "af02ffc1ba0b1dff2a546fdc52ba33e1", "score": "0.78378046", "text": "def cleanupstr (...
a076ee2362b0235beaaf971dc16b7c93
GET /bets/new GET /bets/new.json
[ { "docid": "f73ad48e8fff150796447c427a065c63", "score": "0.0", "text": "def new\n\n # @horse = Horse.find(params[:horse_id])\n @gate = Gate.find(params[:gate_id])\n @horse = @gate.horse\n @race = @gate.race\n #@race = Race.find(params[:race_id])\n \n @card = @race.card\n @...
[ { "docid": "5c22d61d9ad4fa40424d324dce301e51", "score": "0.7772414", "text": "def new\n @beet = Beet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @beet }\n end\n end", "title": "" }, { "docid": "ec77d71e65e8f46234d2d4a750f87d42"...
1becd39699df870e5661c50d59beac5b
general move piece method
[ { "docid": "e7887eb7cd0641043343fe6e7ac2b7f2", "score": "0.0", "text": "def move(movement)\n possible_position = [@current_position[0] + movement[0], @current_position[1] + movement[1]]\n if @board.valid_move?(possible_position) || @board.valid_attack?(possible_position)\n @first_move = false...
[ { "docid": "69792e728f5615f6cae9f45d9f2e3063", "score": "0.82988393", "text": "def move_piece!(from_pos, to_pos)\n end", "title": "" }, { "docid": "be764c2c9e6ea636357553cc312dc474", "score": "0.8291914", "text": "def make_move(_game, piece)\r\n piece\r\n end", "title": ...
2ee73fb9fdd5ee795283c3fde169e4b1
GET /websites/new GET /websites/new.xml
[ { "docid": "ccf36b958c168e4330aa7f228270bbd1", "score": "0.7266667", "text": "def new\n\t\t@website = Website.new\n\n\t\trespond_to do |format|\n\t\t\tformat.html # new.html.erb\n\t\t\tformat.xml\t{ render :xml => @website }\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "dc46d36c95f44e4b8fad31e1f02a1369", "score": "0.76250535", "text": "def new\n @website = Website.new params[:website]\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @website }\n end\n end", "title": "" }, { "docid": "a831...
8eec5a6988779257b315b03f0dea1ebb
PUT /questions/1 PUT /questions/1.json
[ { "docid": "d2cc8130eb8a2c09795d479f59f39442", "score": "0.0", "text": "def update\n @question = Question.find(params[:id])\n\n respond_to do |format|\n if @question.update_attributes(params[:question])\n @question.create_activity :update, owner: current_user\n format.html { red...
[ { "docid": "e200c2e45d5e06159f21daee27b74aa8", "score": "0.7163646", "text": "def update\n @v1_question = V1::Question.find(params[:id])\n\n if @v1_question.update(question_params)\n render json: @v1_question, status: :ok\n else\n render json: @v1_question.errors, status: :unprocessab...
efd91a789cdb1670f18a3685ce80667b
GET /boards GET /boards.json
[ { "docid": "c7732b8d1fb3f1a3f89bc08a581c627f", "score": "0.74179566", "text": "def index\n @boards = Board.all\n end", "title": "" } ]
[ { "docid": "9a77e97096ac1f3857c1e712645f0337", "score": "0.7871452", "text": "def boards\n return @boards if @boards\n @boards = Client.get(\"/organizations/#{id}/boards/all\").json_into(Board)\n end", "title": "" }, { "docid": "cb820ec88fba6fcbc685dc832bef9b8c", "score": "0...
605cdf5c2b93e5583601789b2f10e468
Return normalized version of scheme, if any
[ { "docid": "e88f2fb7b4c16eb759145e3e7f473cac", "score": "0.7910781", "text": "def normalized_scheme\n scheme.strip.downcase if scheme\n end", "title": "" } ]
[ { "docid": "d431e47a1452c459091a56674e61610a", "score": "0.66337657", "text": "def normalize_scheme(scheme)\n return \"http\" unless scheme\n scheme.to_s[/^\\w+/]\n end", "title": "" }, { "docid": "67287b644726204738a521b30be7f3e0", "score": "0.6199161", "text": "def nor...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "58d8739799e7df43ad1b93912d2ad7a2", "score": "0.0", "text": "def score_params\n params.permit(:value, :user_id, :exam_id)\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...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b94d64b2a50b0bf31bb1bb2b982895f8", "score": "0.0", "text": "def one_offspring_params\n params.require(:one_offspring).permit(:germination_id, :individual, :color_id, :status, :headSize, :flowering, :numPetals, :form)\n end", "title": "" } ]
[ { "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...
eb0aaee035b98de94de0d6b3b2aa7972
def get_scores(report_cycle) report_cycle_scores = [] object.scores.each do |score| if score.lesson.report_cycle == report_cycle report_cycle_scores << score end end return report_cycle_scores end
[ { "docid": "41a3c2b4aeb4bc5ebfcf4dede325fbf1", "score": "0.64235073", "text": "def average_score(report_cycle)\n report_cycle_scores = report_cycle.scores.where(set_pupil: object)\n return 0 if report_cycle_scores.length < 1\n average = (report_cycle_scores.map(&:value).reduce(:+)) / (report_cy...
[ { "docid": "9124e733dd1b177cd2ed246848559720", "score": "0.6164322", "text": "def scores\n @scores\n end", "title": "" }, { "docid": "d698407783121d5834370e426e12ac9f", "score": "0.58517134", "text": "def obtenirScores\n\t\tif @scores == nil\n\t\t\tcalculerScores()\n\t\tend\n\t\t...
f43c816c231d1669fbc524aca19ed20d
FILL IN PASSWORD FUNCTIONS
[ { "docid": "0b57c33d8d8bbb031f11125da65e1b63", "score": "0.7404656", "text": "def fill_password\n fill_in PASSWORD_NAME, with: DUMMY_PASSWORD\n sleep 1\n end", "title": "" } ]
[ { "docid": "88c14550e988cd6f08c22fe5b9f65cbb", "score": "0.78861284", "text": "def password=(_); end", "title": "" }, { "docid": "a5cd0dadd93f483fae9d4ab15905cf27", "score": "0.78827435", "text": "def password()\n perturb()\n end", "title": "" }, { "docid": "d2680...
6b83d50112b77faf011589b9521e8ae3
Define a method that, given a word, returns a hash with the letters in the word as keys and the frequencies of the letters as values.
[ { "docid": "69611833bd9c9ead42d79da64fd9e451", "score": "0.8118463", "text": "def letter_counts(word)\n frequency_count = Hash.new(0)\n\n word.split(\"\").each do |char|\n frequency_count[char] += 1\n end\n frequency_count\nend", "title": "" } ]
[ { "docid": "065c2f50e406bca4eb40f8a9eb2c81ca", "score": "0.82948", "text": "def letter_counts(word)\n hashed = {}\n word.each_char do |el|\n count = word.count el\n hashed[el] = count\n end \n hashed\nend", "title": "" }, { "docid": "ecb42d271ad735b20f5bc41eee427d24", "score":...
6dfd25cc66a7509fd45e27783fa34649
this is not Hash deep merge, so be careful that the value of the duplicated key will be overwritten
[ { "docid": "1b4c3983b61b875e708b5c28f33fb597", "score": "0.0", "text": "def merge_to_cluster_role(conf)\n return if conf.nil? or conf.empty?\n @cluster_role.default_attributes.merge!(conf)\n end", "title": "" } ]
[ { "docid": "d44b455b6460f4d5dd6033df3dc6b9db", "score": "0.7644069", "text": "def deep_merge(source, hash); end", "title": "" }, { "docid": "d44b455b6460f4d5dd6033df3dc6b9db", "score": "0.7644069", "text": "def deep_merge(source, hash); end", "title": "" }, { "docid": "cf...
e03884b907c11d986a2085b4c268ff5e
DELETE /job_postings/1 DELETE /job_postings/1.json
[ { "docid": "3bd83fec9455794912ac3c7b29f790b9", "score": "0.74797565", "text": "def destroy\n @job_posting.destroy\n respond_to do |format|\n format.html { redirect_to job_postings_url, notice: 'Job posting was successfully destroyed.' }\n format.json { head :no_content }\n end\n end"...
[ { "docid": "22591f3bc1ee2f784e22f9aa044cbd98", "score": "0.78327024", "text": "def destroy\n @job_posting = JobPosting.find(params[:id])\n @job_posting.destroy\n\n respond_to do |format|\n format.html { redirect_to job_postings_url }\n format.json { head :no_content }\n end\n end"...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "d7aa9858359153410337038163b73046", "score": "0.0", "text": "def opening_cash_params\n params.require(:opening_cash).permit(:id, :fecha_apertura, :monto_efectivo, :cash_id, :employee_id)\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...
da0c6edbbac01c89022fffaa5f9e6edf
PUT /farmjobequipments/1 PUT /farmjobequipments/1.xml
[ { "docid": "f49c61259f45556c3d97e488f3b82ac1", "score": "0.60829926", "text": "def update\n @farmjobequipment = Farmjobequipment.find(params[:id])\n\n respond_to do |format|\n if @farmjobequipment.update_attributes(params[:farmjobequipment])\n format.html { redirect_to(@farmjobequipmen...
[ { "docid": "ad54471b285e5e357d9be959c8ade2d8", "score": "0.629053", "text": "def update\n path = \"/workflow/#{repo}/objects/druid:#{druid}/workflows/#{workflow}/#{step}\"\n conn = Faraday.new(url: config['host'])\n conn.basic_auth(config['user'], config['password'])\n conn.headers['content-...
f6cc3af196b2b5ed6c07f725e179e6fb
Find any given square on the board
[ { "docid": "d12160b7f03d943dc0a3db5e008ec56e", "score": "0.0", "text": "def find opts\n opts.inject(self) do |squares,option|\n squares.select{ |square| square.method(option.first).call == option.last }\n end\n end", "title": "" } ]
[ { "docid": "8babe8f8f5fe754bdafbd45f7657622f", "score": "0.75497884", "text": "def find_square_neighbors(x, y)\n result = []\n @board.each_with_index do |row, i|\n row.each_with_index do |cell, j|\n next if [i, j] == [x, y]\n result << cell if [i / 3, j / 3] == [x / 3,...
43e7d8780330c0c0481c34e0b3e89aed
Redirects to 'Home', if a wrong user tries to access protected pages
[ { "docid": "8ad9297e4655b4b6b603b0f7659e3a2b", "score": "0.0", "text": "def correct_user\n @user = User.find(params[:id])\n redirect_to(root_path) unless current_user?(@user)\n end", "title": "" } ]
[ { "docid": "d1d12cfeb173a931fba1b9bc507b5b04", "score": "0.77005297", "text": "def redirect_to_user_home\n flash[:message] = \"You are not authorized\"\n redirect \"/users/#{current_user.id}\"\n end", "title": "" }, { "docid": "24c0755b790cd1f811f7b0ae0a81ca90", "score...
2e84da6c7b71781fa533a710ed94ffd4
POST /orders or /orders.json
[ { "docid": "04505532569d58d660ae67a6930b8437", "score": "0.6496341", "text": "def create\n @order = Order.new(order_params)\n\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: \"Order was successfully created.\" }\n format.json { render :show,...
[ { "docid": "ee8d8e8e024d35ee13910acc551b370b", "score": "0.7806605", "text": "def create_order\n post_request \"orders\"\n end", "title": "" }, { "docid": "845035633d004ad773ad8d0df67d69fd", "score": "0.7478484", "text": "def create\n response = Unirest.post(\"http://local...
311f0c609aa45cca20d1084a04757ec2
Adds the given mixin to this instance. Attributes defined in the mixin will be transfered to instance attributes.
[ { "docid": "16d8742b867394009c4dd4cdcfbe2715", "score": "0.8081061", "text": "def add_mixin(mixin)\n unless mixin\n raise Occi::Core::Errors::MandatoryArgumentError,\n 'Cannot add a non-existent mixin'\n end\n\n # TODO: handle adding actions\n mixins <...
[ { "docid": "0a30a942a8fef6f358a03cdbef1badbc", "score": "0.69685566", "text": "def add_mixin(model)\n raise InvalidMixin.new(\"#{model.name} already mixed in to this model\") if mixins.include?(model)\n raise InvalidMixin.new(\"Mixin cannot be a parent\") if ancestors.include?(model)\n \n # ...
e8afb5b504e6e1958c4dcab733297a99
Delete a Customer's address
[ { "docid": "2746a16165a1df450e2bd23e1ad65bc9", "score": "0.7556557", "text": "def delete_address(customer_id,\r\n address_id,\r\n idempotency_key = nil)\r\n # Prepare query url.\r\n _path_url = '/customers/{customer_id}/addresses/{address_id}'\r\n ...
[ { "docid": "58d9b2b527608f654e63dd00efd95316", "score": "0.84465027", "text": "def destroy\n @customer = User.find_by(id: params[:customer_id])\n address = @customer.addresses.find_by(id: params[:id])\n address.deleted = true\n address.save!\n #redirect_to customer_addresses_path(@custome...
86873baf905f6839efe9d68720dea081
If a connection is available, pass it to the block, otherwise pass the fiber to the queue till a connection is available
[ { "docid": "4466bb5e4cff8efe80db8b8e9a4236dc", "score": "0.7458177", "text": "def hold()\n fiber = Fiber.current\n conn = acquire(fiber)\n yield conn\n end", "title": "" } ]
[ { "docid": "b8de924b4bcd01893bbf39ccabe6683a", "score": "0.73015773", "text": "def acquire(fiber)\n\t\t\t\tif !@connections.empty?\n\t\t\t\t\t@busy_connections[fiber] = @connections.shift\n\t\t\t\telsif (@connections.length + @busy_connections.length) < @size\n\t\t\t\t\tconn = @connection_proc.call\n\t\...
1a34814d1afeaaf66fd26f9951931ce7
Calculates square root sum of the collection.
[ { "docid": "af601467774f32671b7cdcd6b664d8cb", "score": "0.70919263", "text": "def square_root_sum\n inject(nil) { |sum, x| sum ? sum + x ** 2 : x ** 2 }\n end", "title": "" } ]
[ { "docid": "83d6587e183c161fd3811d004304b422", "score": "0.72685397", "text": "def square_sum\n self.inject(0.0){|accum, i| accum +i**2 }\n end", "title": "" }, { "docid": "69fbf6faacefb6537083dee1bbaed6d2", "score": "0.71111566", "text": "def sum_of_squares\n\t\t\tinject(0) do |...
e7bb7a7cafb932ca3a84b46e66ea7942
Create a TLS reporting record policy
[ { "docid": "296ecacca4002b69bad6cdecd82db85e", "score": "0.66316366", "text": "def generate_tls_reporting_record(generate_tls_reporting_record_options, opts = {})\n data, _status_code, _headers = generate_tls_reporting_record_with_http_info(generate_tls_reporting_record_options, opts)\n data\n...
[ { "docid": "2635b12e4448f8aa684a4237420bef23", "score": "0.62160766", "text": "def generate_tls_reporting_record_with_http_info(generate_tls_reporting_record_options, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ToolsControllerApi.generate_tls_...
84dd91e84db2b0eae9cae07ef19e3cce
Delete function [path] /projects/test_project/registration/functions/functionname [method] DELETE [return] delete result +true+ or +false+
[ { "docid": "0fbdc98199172e35eb46debefefdc29b", "score": "0.82136023", "text": "def delete\n res = ODPS.conn.delete \"projects/#{ODPS.current_project}/registration/functions/#{self.alias}\"\n res.status == 204\n end", "title": "" } ]
[ { "docid": "df68c546037e38a96a89255500e04312", "score": "0.7233461", "text": "def destroy\n @admin_function.destroy\n respond_to do |format|\n format.html { redirect_to admin_functions_url, notice: 'Function was successfully destroyed.' }\n format.json { head :no_content }\n end\n en...
a202c9e49abd5c41c45adff3c8e011e3
If there is a reference to the optimised table, sort on this column in order to optimise any join with optimised table Else, sort by PK to optimise any joins or filter on this table
[ { "docid": "d95dd21e774ca3b42bb4064b10a44f67", "score": "0.6853843", "text": "def sort_keys\n sort_key_column_names = if can_optimise_for_different_table?\n [foreign_key_column_name_to_optimised_table]\n else\n [primary_key...
[ { "docid": "3580c0c6d04c5a8855ee1d0df19e6beb", "score": "0.5859196", "text": "def sorted\n all.order(Arel.sql(%[ #{quoted_table_name}.\"recorded_at\" ASC, #{quoted_table_name}.\"hid\" ASC ]))\n end", "title": "" }, { "docid": "0f76ba1adb62bb00c027a1ac29f7244e", "score": "...
7acfbfdd4013fa7f6a4a3ecc631e0771
Not used now: for now it is done with JS on client side
[ { "docid": "b66472c25b52d40afc027223232cca65", "score": "0.0", "text": "def genes_in_complex_names_only\n ComplexPattern.from_string(genes_in_complex).map{|genename_with_id|\n genename_with_id.match(/^(?<gene_name>.+)#(?<gene_id>\\d+)$/)[:gene_name]\n }.to_s\n end", "title": "" } ]
[ { "docid": "978b14f9ece0b9d6a4cb9f75a2a1f1eb", "score": "0.69128263", "text": "def js\n end", "title": "" }, { "docid": "433c55678275c3382731f6f2e959fb21", "score": "0.6904831", "text": "def javascript\n end", "title": "" }, { "docid": "e60eb0254422373ae81045fb07cb2...
f6b96ce7b7982451368248d3a192a5fc
DELETE /assignments/1 DELETE /assignments/1.json
[ { "docid": "f1213f9e4a6303dae5d2f085d031c318", "score": "0.74596244", "text": "def destroy\n @assignment = Assignment.find(params[:id])\n @assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to assignments_url }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "9a6dcddc8c8c8b462afb6e5570dbb409", "score": "0.7463973", "text": "def destroy\n @assignment = Assignment.find(params[:id])\n @assignment.destroy\n\n respond_to do |format|\n format.html { redirect_to assignments_url }\n format.json { head :ok }\n end\n end", "title...
6f5e111910ad4f54768c131da4f8d55e
prints out a lovely string of the list
[ { "docid": "00da42c18de6e460444436f4c90b3891", "score": "0.7143132", "text": "def toString\n\t\tif (!@head)\n\t\t\tputs \"Empty List\\n\\n\"\n\t\telse\n\t\t\tcurrent = @head\n\t\t\tstring = \"Head->\"\n\t\t\twhile (current)\n\t\t\t\tstring += current.get_item().to_s + \"->\"\n\t\t\t\tcurrent = current.g...
[ { "docid": "277d504adc12aacb3ef21ec2994d2bdd", "score": "0.76849645", "text": "def print_list; end", "title": "" }, { "docid": "51475338149874dde673d930b8e8f198", "score": "0.76288146", "text": "def to_s\n printed_list = \"\"\n @list.each do |item, quantity|\n printed_list...
76f5317992e828f66f5d781ef57425bc
Creates a backup of your current local development database in case you want to restore it.
[ { "docid": "ab01b38323bb3b45fc1d5829f73e31ab", "score": "0.70488584", "text": "def dump_local\n `pg_dump -Fc --no-acl --no-owner -h localhost -U #{user} YOUR_LOCAL_DB_NAME_HERE > tmp/development-#{date}.dump`\n end", "title": "" } ]
[ { "docid": "7e2849eb3d3caf84d378ffacca70a301", "score": "0.7428241", "text": "def backup_db\n\t\tif File.exists?(@dbLoc)\n\t\t\tnewLoc = \"#{@dbLoc}.backup\"\n\t\t\tputs \"Creating db backup at #{newLoc}\"\n\t\t\tFileUtils.mv(@dbLoc, newLoc)\n\t\tend\n\tend", "title": "" }, { "docid": "709c0...
f70f8db065ac21cfe7c27ad416ef707d
Name of the action, as referred to by the CLI
[ { "docid": "1e5979094d122fe814e09f70d91c5b19", "score": "0.0", "text": "def name\n camel = self.class.to_s.gsub(/.*::/, '')\n camel.gsub(/(\\S)([A-Z])/, '\\1_\\2').downcase\n end", "title": "" } ]
[ { "docid": "9646d4fe5095a520facb506dfdbc9cb7", "score": "0.8011176", "text": "def action_name\n @action.to_s.upcase\n end", "title": "" }, { "docid": "b913b47765026881e279980a586ffa75", "score": "0.78000474", "text": "def action_name\n return @action_name\n ...
b95464582902cd7c7c3a47878a7c7bb8
Start the pattern selection dialog. If the UI does not support the PatternSelector, start the detailed selection with "patterns" as the initial view.
[ { "docid": "574b6f3189e4a5edd7de7443b32e73e6", "score": "0.71735305", "text": "def RunPatternSelector\n Builtins.y2milestone(\"Running pattern selection dialog\")\n\n if !UI.HasSpecialWidget(:PatternSelector) ||\n UI.WizardCommand(term(:Ping)) != true\n return RunPackageSelecto...
[ { "docid": "3269f40c0ef4055bb83b8583980e431a", "score": "0.57361484", "text": "def ask_select prompt=\"Enter selection pattern: \"\n ret = ask(prompt, String) {|q| yield q if block_given? }\n return if ret.nil? || ret == \"\"\n indices = get_matching_indices ret\n return if indices....
bfef2c0ef7a665abeecfeeeb92fd2ba8
Produces a random sound made by a dog
[ { "docid": "9801364d90e15bcce895c53f623c58f6", "score": "0.6684952", "text": "def sound; end", "title": "" } ]
[ { "docid": "2e310776daf1aec20886052ed8f2f090", "score": "0.6976614", "text": "def make_a_sound\n\t\tputs \"ROARRRR!!!\"\n\tend", "title": "" }, { "docid": "29a1d759c8bc0c15c1303a8d30acf71e", "score": "0.6904285", "text": "def random_animal\n\t animals.sample\n end", "title": ""...
6782f68f593bf2b2649a7cc24bb30afd
This filter is used to set the selected tab.
[ { "docid": "42a6fb71899ff4b8d9b5c5232f5245a5", "score": "0.0", "text": "def city_layout_setup\n @tab = :city\n @parent_tab = :universities\n end", "title": "" } ]
[ { "docid": "7397bf7c4a046958aca76fe087a29e46", "score": "0.68183696", "text": "def set_tab\n @active_tab = 'products'\n end", "title": "" }, { "docid": "16188827950046af7aa75f8e3601a4fb", "score": "0.6817962", "text": "def set_tab\r\n @active_tab = 'products'\r\n end", "t...
44531073966d53f291c94dacaf832361
data = [ 3, 6, 9, 2, 1 ] 2 pointers pointing at same element
[ { "docid": "391384b3dac99201ff4ffa4a19067521", "score": "0.0", "text": "def reverse(data)\n current = @head\n previous = nil\n\n while current != nil\n @next = current.next_node\n current.next_node = previous\n previous = current\n current = @next\n end\n @head = previ...
[ { "docid": "fccceb768c9f0817916b4aab6ba50036", "score": "0.59293926", "text": "def index data\r\n current = @first\r\n i = 0\r\n while !current.nil?\r\n return i if current.data == data\r\n current = current.next\r\n i += 1\r\n end\r\n nil\r\n end", "...