query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
12838c797312dd4b1800ba2f7c5d824b
GET /approvals GET /approvals.json
[ { "docid": "8e985526973dced9f344cdfa5763b2fe", "score": "0.7030107", "text": "def index\n authorize! :manage, :all\n @approvals = Approval.all\n end", "title": "" } ]
[ { "docid": "e23dd97b3b9bcc8cd1350816b283ea1a", "score": "0.73584044", "text": "def index\n @approvals = Approval.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @approvals }\n end\n end", "title": "" }, { "docid": "2d0072e9725...
5423e111af9de5427c1c4d73b9f7d980
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Objective Status? ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
[ { "docid": "044b2b68c92f52d6f0bb9cbab6f41b77", "score": "0.64996725", "text": "def objective_status?(status_check, *obj)\n return false if obj.empty?\n case status_check\n when :failed then !(obj & @failed_objectives).empty?\n when :complete then obj.size == (obj & @complete_objectives).si...
[ { "docid": "01fa540acfadf5050f27e27a43d66f68", "score": "0.7018191", "text": "def status(object) \n end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d3df9c9", "score": "0.67479813", "text": "def status; end", "title": "" }, { "docid": "ae3c11352bdb588f5cd98db97d...
0fd0dcb1641ff02821c4ad32dccb04ce
//Save an activity to user profile (for later reference) POST /activities/save_activity Params: user_id, activity_id Returns: success
[ { "docid": "fdc123e58e0bf1f0af8e8452690b83f1", "score": "0.71974534", "text": "def save_activity\n \n @status = ActivityStatus.where(:user => params[:user_id], :activity => params[:activity_id])\n @status = ActivityStatus.new(:user => params[:user_id], :activity => params[:activity_...
[ { "docid": "d1dcff39599006bb87f8e9ade85080f8", "score": "0.7151237", "text": "def create\n @user_activity = UserActivity.new(user_activity_params)\n @user_activity.user_id = current_user.try(:id)\n \n respond_to do |format|\n if @user_activity.save\n format.html { redirect_to @us...
aaed00aa1313955a690c585d61483d8e
TESTING this method is just for testing the overview process it is a simplification of get_overview_info must supply car and model id to get overview for
[ { "docid": "b9afdd2eee90dbb51b49eef4d0082d47", "score": "0.72075534", "text": "def get_overview_info_for_model(car_id, model_id)\n if car_id.nil? || model_id.nil?\n puts \"ERROR - car_id and model_id are required\"\n exit\n end\n\n start = Time.now\n\n # open the json file of all cars and mode...
[ { "docid": "ac042b04857503032d2c27c46f4ab72b", "score": "0.6615389", "text": "def get_specification_info_for_model(car_id, model_id, year_limit=4)\n if car_id.nil? || model_id.nil?\n puts \"ERROR - car_id and model_id are required\"\n exit\n end\n\n start = Time.now\n\n # open the json file of...
b670274956e5ba9c035dac6c23173cb6
POST /flower_colors POST /flower_colors.json
[ { "docid": "83bac162e1a08b62807a6d25dd904802", "score": "0.7553349", "text": "def create\n @flower_color = FlowerColor.new(flower_color_params)\n\n respond_to do |format|\n if @flower_color.save\n format.html { redirect_to @flower_color, notice: 'Flower color was successfully created.'...
[ { "docid": "d9811b666fc1d9fd444353c076f59185", "score": "0.6809354", "text": "def create\n @color = Color.new(color_params)\n\n respond_to do |format|\n if @color.save\n format.html {redirect_to @color, :flash => {success: 'Color creado exitosamente'}}\n format.json {render json...
04b5c6c09d5a5e5fbbe72155499ab8df
end of most_popular Recipe Class method Helper Method for self.most_popular
[ { "docid": "6e6f4b8166d3fed8770e686d0f5a4dbc", "score": "0.569457", "text": "def popular_recipe_card\n RecipeCard.all.select do |recipe_card_ob|\n #binding.pry\n # to test this pry - call this method on an instance of a Recipe\n #(IE - taco.popular_recipe_card)\n recipe_card_ob.recipe == se...
[ { "docid": "4d4fd85e973ccbde83e466844769539d", "score": "0.75152254", "text": "def most_popular\n\n # Recipecard.all.select {|rc| rc.recipe ==self}\n # most_popular.map {|rc| rc.users}\n recipe_hash = {}\n RecipeCard.all.each do |recipecard|\n if recipe_hash[recipecard.name]==...
4c592a818df3fef9fa4e57a6c8d8617e
Returns the id of the instance in a split path form. e.g. returns 000/001/234 for an id of 1234. Stolen from paperclip...
[ { "docid": "d144e2c0140fbef2dc66c153b8565225", "score": "0.7103595", "text": "def id_partition\n format('%09d', model.id).scan(/\\d{3}/).join('/')\n end", "title": "" } ]
[ { "docid": "9b72fa7fb8659c8685769445fe819b6d", "score": "0.7822228", "text": "def id_path\n full_path.collect(&:id).join(\":\")\n end", "title": "" }, { "docid": "833a4dcadeb630eb171d3e79b252d164", "score": "0.7382451", "text": "def id_partition\n (\"%09d\".freeze ...
3d6cf2d96745a79138cfc4d14796ddc0
List Club Administrators Returns a list of the administrators of a given club.
[ { "docid": "3e9dc670ae5537e811581761481795ab", "score": "0.0", "text": "def get_club_admins_by_id_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: ClubsApi.get_club_admins_by_id ...\"\n end\n # verify the required para...
[ { "docid": "ccada98e638f0c407caca0826f3ddc1c", "score": "0.68530387", "text": "def index\n @club_admins = ClubAdmin.all\n end", "title": "" }, { "docid": "e6b1e2d894b2ee3fb63a2f76a64e194a", "score": "0.620194", "text": "def index\n redirect_to adminboard_administrator_path(cur...
f6ba77c3062bbccf28f899fa6c338838
used to add pictures for new category
[ { "docid": "6f5bdb82dbaf4c5de1d1eba4881ff5ed", "score": "0.0", "text": "def with_picture\n self.pictures.build if self.pictures.blank?\n self\n end", "title": "" } ]
[ { "docid": "4b65f8d71f694d9a624a7aab2a501463", "score": "0.7534036", "text": "def create\n @category = Category.find_or_create_by_name params[:name]\n @image = Image.find(params[:image_id])\n\n if @category.save\n @image.categories << @category\n end\n end", "title": "" }, { ...
5bedd0d96dc293db915aac94587b5db1
POST /screenplays POST /screenplays.json
[ { "docid": "a2522198479e40ebb4e6dd763d4e30f1", "score": "0.7491296", "text": "def create\n @screenplay = Screenplay.new(screenplay_params)\n\n respond_to do |format|\n if @screenplay.save\n format.html { redirect_to screenplays_url, notice: 'Screenplay was successfully created.' }\n ...
[ { "docid": "82bd9607e8c9b35d45469f787e696422", "score": "0.6989314", "text": "def screenplay_params\n params.require(:screenplay).permit(:name)\n end", "title": "" }, { "docid": "312e963d889eb9aa11b4b61489e6105f", "score": "0.63441783", "text": "def index\n @screenplays = ...
7a386835169bbba05caf26f9be9d6f01
PATCH/PUT /plans/1 PATCH/PUT /plans/1.json
[ { "docid": "3d477273c5714f5bbed1c21ee5308782", "score": "0.6911576", "text": "def update\n unless @plan.update(plan_params)\n render json: {status: 'failed', message: '更新失败,请稍后重试 !'}\n end\n end", "title": "" } ]
[ { "docid": "468319d294c8832c42a52628f535bed3", "score": "0.72273284", "text": "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { ...
6e9b8ba0b15de33a7f999e80f85a11ce
GET /televisions/1 GET /televisions/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "b49133742fa3468e942eef1f3003013e", "score": "0.7504283", "text": "def index\n @televisions = Television.all\n end", "title": "" }, { "docid": "ccd841272167c7d457c1969a235f255a", "score": "0.68359816", "text": "def show\n @television = Television.find(params[:id])\n...
a076d01bb5f4bb1b29e24efec7513b93
Delete Okta Identity Provider
[ { "docid": "f32acde67765c7c0d116241921553094", "score": "0.6538547", "text": "def delete_identityproviders_okta(opts = {})\n data, _status_code, _headers = delete_identityproviders_okta_with_http_info(opts)\n return data\n end", "title": "" } ]
[ { "docid": "c73efc281cf36a993262b7d497c6011b", "score": "0.757884", "text": "def delete_identity_provider(identity_provider_id)\n start.uri('/api/identity-provider')\n .url_segment(identity_provider_id)\n .delete()\n .go()\n end", "title": "" }, { "docid...
7135bdc3bd50f66f73ff80731ded7e75
Simple text message contains important informations
[ { "docid": "ef24ca6331141e02e2322ddfcd04b802", "score": "0.65680414", "text": "def text_message(type, context)\n issue = context[:issue]\n journal = context[:journal]\n\n if type == :update\n text = l(:field_chatty_crow_issue_updated) + \" ##{issue.id}\\n\\n\"\n te...
[ { "docid": "44d84af450f26d2fa34ad20818d02ff6", "score": "0.72828704", "text": "def message_text\n 'Message text for Subfeature 1'\n end", "title": "" }, { "docid": "66ee848f9b10d7de4e0c1ea669bf98c9", "score": "0.7201689", "text": "def message\n # byebug\n \"...
febda19fae566585ad1b2c399719f9fc
String to represent a user (email, name, etc.)
[ { "docid": "532761feb0ae7292e533b045d403ba45", "score": "0.0", "text": "def to_s\n \"#{first_name} #{last_name}\"\n end", "title": "" } ]
[ { "docid": "b1cf6773971d7c3d5fcf2f0ed0c439c4", "score": "0.7428794", "text": "def user_string(user)\n slack_identifier = SlackIdentifier.find_by_user_id(user.id)\n return \"<@#{slack_identifier.identifier}>\" if slack_identifier.present?\n user.email\n end", "title": "" }, { ...
1c6d78fa5c53bbbf708bdcc7acbb704b
DELETE /survey_questions/1 DELETE /survey_questions/1.json
[ { "docid": "a5ca2d5ec45fcec4f588d21434042e07", "score": "0.7656779", "text": "def destroy\n @survey_question.destroy\n respond_to do |format|\n format.html { redirect_to survey_questions_url, notice: 'Survey question was successfully destroyed.' }\n format.json { head :no_content }\n ...
[ { "docid": "6f7dad95b9346fb82c2f30f3333861a7", "score": "0.8067709", "text": "def destroy\n @survey_question.destroy\n render json: get_survey_questions\n end", "title": "" }, { "docid": "25b33ecbffc31a34feb8687db21db0f7", "score": "0.78844124", "text": "def destroy\n @su...
ea5286677a15595e3baf1ad8a7523051
DELETE /sivic_models/1 DELETE /sivic_models/1.json
[ { "docid": "f2be77f22d5a0829d7593f6bec6afdfa", "score": "0.76886153", "text": "def destroy\r\n @sivic_model.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_models_url }\r\n format.json { head :no_content }\r\n end\r\n end", "title": "" } ]
[ { "docid": "49066d2583817205c954b3e3c10a5525", "score": "0.7117668", "text": "def destroy\n @oid_model.destroy\n respond_to do |format|\n format.html { redirect_to oid_models_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "14fac5a720ca857...
527a7837be545ad98ecb3a515a229611
New method adds XP for every skill uses (if applicable) and handles skill level ups and learning new skills
[ { "docid": "f1ee4d67200f17615cabfd19adebc42f", "score": "0.7010129", "text": "def calculateSkillPoints(subject, item, target, enemy = true)\n\n calcStuff = false;\n #term shown when actor learns a new skill\n learnNewSkillMsg = \" lernt \";\n\n skillTypeList = SKILLINFO::SKILL_CLASS_MEMBERS[...
[ { "docid": "f8d024a6e21172a1f8c3c219376e839d", "score": "0.7007615", "text": "def gain_experience(_xp)\n\t\t@experience += _xp\n\tend", "title": "" }, { "docid": "751cd6f722b542ae6899cd1f5120732f", "score": "0.68431604", "text": "def calculateSkillPointsInMenu(subject, item)\n\n c...
d233b010f0c95f6e85a6e719f58efab2
The current highlight token for the item at y, x if the token is unknown returns :text
[ { "docid": "ec415b7241ca37bcce71a3f8e796aa0d", "score": "0.6849307", "text": "def highlight_at(y, x)\n highlight_at!(y, x)\n\n rescue HighlighterUnknownSegment\n :text\n end", "title": "" } ]
[ { "docid": "7ebdf9a7daffd4c30fd3cfb5411a8b18", "score": "0.6723329", "text": "def highlighted_text\n element.getAdditionalText()\n end", "title": "" }, { "docid": "890cbf36486b88db4a9e2cd3d87a438d", "score": "0.6698082", "text": "def token_text\n source[@start, (@current...
29dbe47a1ae21ddd31047aa20a0d0324
GET /jewelry_types/new GET /jewelry_types/new.json
[ { "docid": "abe47e3a4b1179972c0342d82e1cd3dd", "score": "0.7809712", "text": "def new\n @jewelry_type = JewelryType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @jewelry_type }\n end\n end", "title": "" } ]
[ { "docid": "615c1e1c8a1ddd10fae6d3c3e710813d", "score": "0.7796523", "text": "def new\n @type = Type.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @type }\n end\n end", "title": "" }, { "docid": "35d8f3d54afb0ecfdb9ee9761b57ec61"...
1702d91f06cc84b0c29eadd0a2116600
just test a few
[ { "docid": "10d3f23b5897cd711461fe1a0e0c941a", "score": "0.0", "text": "def test_should_report_errors_on_create\n new_session_as(:jack) do |jack|\n jack.assert_report people_path, 'people/new', {}, :person, nil, :name, :password\n end\n end", "title": "" } ]
[ { "docid": "16a6d5e8eabd975007f205c109c50890", "score": "0.6864605", "text": "def testing; end", "title": "" }, { "docid": "c5b8264aa341c1e4c0ce9e8874d0aace", "score": "0.6755974", "text": "def test_loot_three_cathy\n\t\n\t\t@c.checkForLoot 1\n\t\t@c.checkForLoot 1\n\t\t@c.checkForLo...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "2b0b8e6234d7fa50e4e350733cc71efe", "score": "0.0", "text": "def vehicle_type_params\n params.require(:vehicle_type).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...
bc00dbb2ab66e96974aa6b1e337c3802
Registers form subit hooks This way the standard form serialization can be overwritten
[ { "docid": "aa49f83111d80115be67cb3cf1940489", "score": "0.56897265", "text": "def reporting_form_hooks(reporting)\n hooks = OpenStruct.new\n yield(hooks)\n\n json = []\n %w(select).each do |hook|\n next if hooks.send(hook).nil?\n json << \"#{hook}: function...
[ { "docid": "9b0c1fc206916b14eff6fdfeeca9c99f", "score": "0.6080812", "text": "def _forme_form_options(obj, attr, opts)\n super\n\n opts[:_after] = lambda do |form|\n if (obj = form.opts[:obj]) && obj.respond_to?(:forme_inputs) && (forme_inputs = obj.forme_inputs)\n ...
6db0a690fd7c0da433757b9999152219
DELETE /review_comments/1 DELETE /review_comments/1.xml
[ { "docid": "10f7e0d2bdcf74a92a0f68c084e35498", "score": "0.6989058", "text": "def destroy\n @review_comment = ReviewComment.find(params[:id])\n @review_comment.destroy\n flash[:notice] = _('ReviewComment was successfully deleted.')\n respond_to do |format|\n format.html { redirect_to(:a...
[ { "docid": "42d57d4e9534105ff77e58ba395372b1", "score": "0.70309424", "text": "def destroy\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to @node.content }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "195f747f5edd69f96752def...
0cf6e63689e095b8851773ea34800a29
Get statistics for downlink router port on tier1 router Segment ID is the ID of the segment that is connected to the the tier1
[ { "docid": "4530bf901a4c1a5886ee5b37266f3d8e", "score": "0.66880614", "text": "def get_downlink_port_statistics_summary_for_tier1_segment_0_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConne...
[ { "docid": "abfcbca5c8f2c82003db1309b8835b4e", "score": "0.7069782", "text": "def get_downlink_port_statistics_for_tier1_segment_with_http_info(tier_1_id, segment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier...
13ae4385177646495aec239612a64e21
Note: rubys `each` and `next` are analogous to `more_commands?` & `advance` def more_commands? end def advance end
[ { "docid": "aefdb9828d29910ec846164731da1771", "score": "0.0", "text": "def command_type\n if arithmetic?\n \"C_ARITHMETIC\"\n else\n \"C_#{arg_0.upcase}\"\n end\n end", "title": "" } ]
[ { "docid": "5b08f1d61ab4327e9e5de0ca695cbf16", "score": "0.7022008", "text": "def each\n while true do\n yield\n break if ! advance\n end\n end", "title": "" }, { "docid": "15bd602fbfea6107a0411515bf01e628", "score": "0.68783236", "text": "def adv...
ab0539dc723576f860dd42c46b53f736
the record methods require the use of lookup tables. Other (nongeneric) modules statically define lookups in the tables, but we must define the lookups dynamically before the record method is invoked.
[ { "docid": "b658e7e68fd370d03ef2d57cddfcfd78", "score": "0.0", "text": "def add_lookup_code(lookup_hash)\n return if @codes.nil? || @codes.empty?\n\n sym = self.symbol()\n value = {\n description: @codes.first['display'],\n codes: {}\n }\n ...
[ { "docid": "dd634988bef3cbda8a94486413375360", "score": "0.6791832", "text": "def lookup; end", "title": "" }, { "docid": "dd634988bef3cbda8a94486413375360", "score": "0.6791832", "text": "def lookup; end", "title": "" }, { "docid": "ce07e1b571178d6bed4e4f787b729ccb", ...
268b7373dcb6815d333bfaa9b08b242b
Get the total number of comics
[ { "docid": "a48e989fbc47d8bb2c65ed79662e2036", "score": "0.7452396", "text": "def comic_count\r\n \tsorted_articles.length\r\n end", "title": "" } ]
[ { "docid": "64601aac653ab2bb387b3662758e9f61", "score": "0.7329598", "text": "def cc_count\n stats = self.association_stats\n stats['cc_conditions'] + stats['cc_loops'] + stats['cc_questions'] +\n stats['cc_sequences'] + stats['cc_statements']\n end", "title": "" }, { "docid": ...
e9fa7a66b47a6e41cd5359cc3f4c350e
skip_before_action :authenticate!, only: [:reset_bots]
[ { "docid": "34cef391da9caafc4a9cddbf8ed2bca6", "score": "0.0", "text": "def active_tasks\n @tasks = @buyer.tasks.available_tasks.paginate( page: params[:page], per_page: 30)\n render \"tasks\"\n end", "title": "" } ]
[ { "docid": "bb689c39868f9c0d27f1b61126921ca0", "score": "0.63275856", "text": "def after_init\n if token.nil?\n disable_agent\n end\n end", "title": "" }, { "docid": "eeb2df16d68caeafa43e91802f888b69", "score": "0.6243794", "text": "def unauthorised\n flash[:no...
1d55674fab048e5f3cc93a53ef7444cb
test setting a user's locale on registration works and changes the session locale
[ { "docid": "a3ff29f17a68cef1e27f0773a53850aa", "score": "0.70222837", "text": "def test_registering_user_with_unknown_locale_gives_default\n get '/register'\n post '/registration', { :username => \"unique_test\", :password => \"test_pass\", :terms => 'true', :locale => 'timbucktu', :email => \"uni...
[ { "docid": "28d9d7229fd2089c6c9f1e7e28c224fa", "score": "0.8082067", "text": "def test_registered_user_can_change_their_locale\n @user = users(:participant)\n sign_in(@user)\n\n visit root_path\n click_link('Eesti keeles')\n assert_text('Oksjonil olevad domeenid')\n @user.reload\n\n ...
b54ee9a78010bcb0319c81032065da4a
should return an array of places a Piece can move to
[ { "docid": "78ca9ab3163629e525ded64332b214cd", "score": "0.0", "text": "def moves\n possible_moves = []\n\n move_dirs.each do |dir|\n possible_moves.concat(grow_unblocked_moves_in_dir(dir[0], dir[1])) \n end\n\n possible_moves \n end", "title": "" } ]
[ { "docid": "c509740437707f8698a27ac88e4ab665", "score": "0.7898405", "text": "def possible_moves(side)\n possible_moves = []\n # initialize an 8x8 array of coordinates 1-8\n coords = Array.new(8) { [*1..8] }\n coords.each_with_index do |i, j|\n i.each do |t|\n # t is the x, i[j] ...
8375f512ca360d1afbe26eab0397df82
def insert_value_into_field(field, input_value) value = (input_value.class == Fixnum ? input_value : $STASH[value]) send_value_to(field, value) end
[ { "docid": "9eff63e30c0671d64e439c94beb8f2e7", "score": "0.0", "text": "def smartphones_are_visible\n wait = Selenium::WebDriver::Wait.new(:timeout => 0.2)\n preloader_wait\n $driver.manage.timeouts.implicit_wait = 0\n begin\n search_result = wait.until { $driver.f...
[ { "docid": "68cff14b6dad2713ba2f45ae337c57a5", "score": "0.64571476", "text": "def insert(value)\n # YOUR WORK HERE\n end", "title": "" }, { "docid": "a3e3e40e9d0dd94b1f39527f5141dd6a", "score": "0.6425534", "text": "def insert(value)\n #YOUR WORK HERE\n end", "title": ""...
c10de9c451e6d49e9eb52d176bd60159
Test the reduce method on KeyBuzz
[ { "docid": "99206d5f91bbe6914900194debc651b0", "score": "0.82253534", "text": "def test_reduce\n assert_equal('12Key4BuzzKey78KeyBuzz11Key1314KeyBuzz',\n @kb.reduce { |acc, res| acc + res })\n end", "title": "" } ]
[ { "docid": "0168770aad65ea6a678c8e1bed817835", "score": "0.70618707", "text": "def test_reduce\n assert_equal 54, @triple.reduce(:*)\n end", "title": "" }, { "docid": "69dd833dfa8998d1a902439d0d18feef", "score": "0.6976459", "text": "def test_reduce\n assert_equal('12B...
f08a7083da45bacc62dd8cc95b9fa4e1
POST /extra_tasks POST /extra_tasks.json
[ { "docid": "0d1974016f838c6ae2e88643876dc644", "score": "0.72083473", "text": "def create\n @extra_task = ExtraTask.new(extra_task_params)\n\n respond_to do |format|\n if @extra_task.save\n format.html { redirect_to @extra_task, notice: 'Extra task was successfully created.' }\n ...
[ { "docid": "2b72d5075535e1988ebdd433bd4a6ce1", "score": "0.69261736", "text": "def extra_task_params\n params.require(:extra_task).permit(:name, :result_id, :tactic_task_id)\n end", "title": "" }, { "docid": "17c43e93e119faade2f63a207c4703c6", "score": "0.6743406", "text": "d...
9f4455486288d78f1fdd1087600a2333
POST /locations POST /locations.json
[ { "docid": "78389d87a0d4f1a483c8575a6982c775", "score": "0.64825976", "text": "def create\n @location = Location.new(location_params)\n #@activities = Activity.all\n #@location_types = LocationType.all\n\n respond_to do |format|\n if @location.save\n format.html { redirect_to @lo...
[ { "docid": "650e8f9cbfd39222c1fdff06ea2b383e", "score": "0.7120676", "text": "def create\n @species_location = SpeciesLocation.new(species_location_params)\n\n if @species_location.save\n render json: @species_location, status: :created, location: @species_location\n else\n render jso...
ced5df6c4046d8ec6bd671a5cd9497cc
Decode You are given an encoded string. The code is defined as follows: Each character in the encoded string is followed by a singledigit number. The number represents how many times the character appears in a row. Write a function that takes in an encoded string and returns the original. Example: encoded_string = "m1i...
[ { "docid": "33739736c5c6c6c224c75ef964c3b60d", "score": "0.7057433", "text": "def decoded(string)\n result = []\n int = []\n str = []\n\n string.chars.each_with_index do |c, i|\n i % 2 == 0 ? str << c : int << c.to_i\n end\n\n i = 0\n while i < str.length\n result << (str[i] * int[i])\n ...
[ { "docid": "71ab011f4fb28191c79c4835ee4d7d12", "score": "0.7520234", "text": "def decode(string)\n decoded = ''\n string = string.to_s\n token = 0\n while token <= string.size - 1\n number = decode_map[string[token]].to_s\n decoded += number.size == 1 ? \"0#{number}\" :...
b6b3c00a0747880a9697ea0a2020cd96
Sets the value of the `undeploy_hosted_engine` attribute.
[ { "docid": "a0ebd5e71b24ec3238376b44865cb1cf", "score": "0.8934711", "text": "def undeploy_hosted_engine=(value)\n @undeploy_hosted_engine = value\n end", "title": "" } ]
[ { "docid": "ff18e8cf45486ee90d2711afb6e1e931", "score": "0.7506171", "text": "def undeploy_hosted_engine\n @undeploy_hosted_engine\n end", "title": "" }, { "docid": "c8b019f27baba444dd336963c8dbaded", "score": "0.7094268", "text": "def deploy_hosted_engine=(value)\n @dep...
a6654bffdb0f7eebaa2b8fc73f425951
Restituisce un hash con tutti i parametri da implementare sulla ricerca
[ { "docid": "55992c387629f9bf656059568edae83e", "score": "0.0", "text": "def get_query_params\n out = {}\n search_attributes.each do |val|\n out[val.field] = self.send(val.field) unless self.send(val.field).blank?\n end\n\n out\n end", "title": "" } ]
[ { "docid": "fbb9f3d380a0c5c808032a4b81e39d3f", "score": "0.71630496", "text": "def params=(hash); end", "title": "" }, { "docid": "fbb9f3d380a0c5c808032a4b81e39d3f", "score": "0.71630496", "text": "def params=(hash); end", "title": "" }, { "docid": "ae1a628dcfbcd0df0510d0...
9c03119b22c9f0695fb487ee1c3c3c66
Processes queue. Usually used in worker Thread.
[ { "docid": "6685de3c5e724286f451e18e5e8fa5d1", "score": "0.0", "text": "def process! non_block=false\n @running = true\n while @running && (message = shift(non_block))\n @transport.send_message(message)\n end\n message\n end", "title": "" } ]
[ { "docid": "d16aef58829f75efe1b70151ea1c5c0e", "score": "0.77236897", "text": "def process_queue\n begin\n while blk = Merb::Dispatcher.work_queue.pop\n # we've been blocking on the queue waiting for an item sleeping.\n # when someone pushes an item it wakes up this threa...
b8af0ecffa76f033d8494cb5ed592aca
Similar to consume with the difference this one spits out raw JSON and has no parsing on the data received. Use it for a faster consumtion. +stream_method+ param accepts the same options as consume.
[ { "docid": "37b955ea8e41ad8b02b6c69c37f73ef4", "score": "0.6642991", "text": "def consume_raw stream_method=:common\n raise ArgumentError, \"Block required, non given\" unless block_given?\n if stream_method == :common\n read_stream do |data|\n yield(data)\n en...
[ { "docid": "a04e9a72c8444758da5710d52e0090a4", "score": "0.7006501", "text": "def consume_json stream_method=:common\n raise ArgumentError, \"Block required, non given\" unless block_given?\n if stream_method == :common\n read_stream do |data|\n yield(data.map{|item| pa...
288ef3aafa277e8b601414c858a12bda
GET /tv_shows/new GET /tv_shows/new.json
[ { "docid": "5ba98a42f144eb60680cbf526c8953d3", "score": "0.8045032", "text": "def new\n @tv_show = TvShow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tv_show }\n end\n end", "title": "" } ]
[ { "docid": "18da5596a881f22ef461dfcbfbf8d93a", "score": "0.7698778", "text": "def new\n @show = @auditorium.shows.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @show }\n end\n end", "title": "" }, { "docid": "55d6750ec5f6fc1fbeea...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6768cdcf3a75ea71cb8cf95b715ec8d2", "score": "0.0", "text": "def timesheet_params\n params.require(:timesheet).permit(:week, :job_id, :reg_hours, :ot_hours, :gross_pay)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6980384", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6782743", "text": "def strong_params\n params.requi...
a8d8485c7f8e4561c27a160dcf3d8411
Prints a message from the worker.
[ { "docid": "4bf026e8b2e98acc187052dc59e581fd", "score": "0.663775", "text": "def log(worker_index, message)\n puts message\n end", "title": "" } ]
[ { "docid": "793d3d785ad3b97cc39b8ef8f60f24ae", "score": "0.7457274", "text": "def print msg\n @w.print msg\n end", "title": "" }, { "docid": "ae375846b2ca763a3927545f6369622d", "score": "0.7391142", "text": "def print_message(msg)\n print \">> #{msg.to_s} \\n\"\n en...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2a92ebc2aca912e6bc29f8b2828fb635", "score": "0.0", "text": "def set_contact\n @contact = Contact.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...
efd98609747f060ea92838eb3ab4c70b
Copied from: Add this template directory to source_paths so that Thor actions like copy_file and template resolve against our source files. If this file was invoked remotely via HTTP, that means the files are not present locally. In that case, use `git clone` to download them to a local temporary dir.
[ { "docid": "aeb9dbf914894c2d1e0a5fbe41f6d0d1", "score": "0.7771645", "text": "def add_template_repository_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require 'tmpdir'\n source_paths.unshift(tempdir = Dir.mktmpdir('jumpstart-rails-api-'))\n at_exit { FileUtils.remove_entry(tempdir) }\n ...
[ { "docid": "8d2e2908a5d31e4d28398b56e1f6b2e5", "score": "0.83225876", "text": "def add_template_directory_to_source_path\n if __FILE__ =~ %r{\\Ahttps?://}\n require \"tmpdir\"\n source_paths.unshift(tempdir = Dir.mktmpdir(\"rails-template\"))\n at_exit { FileUtils.remove_entry(tempdir) }\n ...
24114da1d148c47b5542de0dcd59c06d
Define method using x and y target coordinates to see if move is vertical
[ { "docid": "471cc0ba4043fb044845bb468d94b964", "score": "0.78839374", "text": "def check_vertical(x_target, y_target)\n #bottom to top\n if coordinate_y < y_target\n (coordinate_y+1..y_target-1).each do |y|\n return true if is_occupied?(x_target, y)\n end\n return false\n ...
[ { "docid": "c3e1cba4cfac56f9e1219f422cca7872", "score": "0.7805347", "text": "def vertical_move?(x_position, x, y_position, y)\n x_position == x && y_position != y\n end", "title": "" }, { "docid": "1ab763a20133af9ab264eec7ce57b77a", "score": "0.74933314", "text": "def vertical_m...
acd8693f15950d295d15eba666aa1776
Respond to messages in chatrooms
[ { "docid": "43899298b01f9fefcf0797629d1e6076", "score": "0.0", "text": "def got_MSG(message)\n @logger.info(\"got_MSG()\")\n @logger.info(\"got_MSG() - #{message['message']}\")\n\tif message['message'] =~ /^!roulette (.*)?/i\n\t\tmsglist = message['message'].split(/roulette (.*)?/i)\n\t\tmsg = \"/...
[ { "docid": "21b5c99fa3d159e40e30d32d150d6a5a", "score": "0.71464974", "text": "def chatroom_message(msg)\n body = msg.body.to_s\n out(\"received chatroom message #{body}\")\n\n # update room status every config[\"msgs_until_refresh\"] messages\n # Use a countdown and not mod to avoid skips h...
5bec26b0f603545abda74464fe025195
actual payment is done in above method onlyhere the invoice processing is done
[ { "docid": "285907dac6097e285c9c91a53f9f66b9", "score": "0.7754535", "text": "def make_the_payment_paypal\n #here i need to refresh the order because the total entry field is changed\n order=CompetitionsUser.find(session[:order].id)\n if order and order.invoices.last\n @invoice = order.ge...
[ { "docid": "0aa0436fa5e20635b77eb10dcd1488f4", "score": "0.78616285", "text": "def make_the_payment\n\n session[:purchasable] = nil\n if @order and @order.invoices.last\n @invoice = @order.generate_invoice_extra_entry(@current_user, params[:invoicing_info])\n else\n @invoice = @orde...
ab1c614df4c55e99e9f2000e9c0982af
Expire the repository status, branch, and tag cache once per push.
[ { "docid": "11ee358b8e94bf272defba58ad17ae4a", "score": "0.7072947", "text": "def expire_caches(post_received, repository)\n repository.expire_status_cache if repository.empty?\n repository.expire_branches_cache if post_received.includes_branches?\n repository.expire_caches_for_tags if post_rec...
[ { "docid": "bac333b4317426ddc5daff58a9b77132", "score": "0.7168562", "text": "def metasmoke_push_hook\n Rails.cache.delete_matched %r{code_status/.*##{CurrentCommit}}\n end", "title": "" }, { "docid": "21cc494ee4b38f1940eda7d2e35293da", "score": "0.67740446", "text": "def expire_...
1687f7127b756875e65f8add54b65f12
Zip/assemble results for a given output port over selected sweep's runs, results for a run (for all output ports), or all results for all output ports and all runs.
[ { "docid": "2e99721d9cc6c379ea11f93de743437d", "score": "0.62679774", "text": "def download_results\n @sweep = Sweep.find(params[:id], :include => { :runs => :outputs })\n\n if params[:download].blank?\n respond_to do |format|\n flash[:error] = \"You must select at least one output to ...
[ { "docid": "808f82d3646d58b6c9ddb5fa87208502", "score": "0.59296924", "text": "def get_outputs(run, refs, outfile, dir, zip_out=nil)\n data_lists = run.get_output(dir, refs)\n print_flattened_result(outfile, data_lists)\n if zip_out\n add_to_zip_file(dir, data_lists, zip_out)\n end\n e...
dcfb931ecf8685d647aab977e9c43c7a
PATCH/PUT /dedications/1 PATCH/PUT /dedications/1.json
[ { "docid": "af8479002764bb711c26ce9c152a6542", "score": "0.61828893", "text": "def update\n authorize @dedication\n respond_to do |format|\n if @dedication.update(dedication_params)\n format.html { redirect_to @dedication, notice: 'La dedicación se ha modificado correctamente.' }\n ...
[ { "docid": "7f7c16b9e14f1352bb07fd27f83679a7", "score": "0.65579426", "text": "def patch(path, params: {}, headers: {})\n request_json :patch, path, params, headers\n end", "title": "" }, { "docid": "d5eaea298e64625a71a15a970f3b75ed", "score": "0.63216764", "text": "def patch...
f7591e04e40f5b926bc501e8b6fad957
This allows the user to use the cursor keys to adjust the position of the widget.
[ { "docid": "07e36f41fe0d227237e523e779c99f5d", "score": "0.63854617", "text": "def position\n # Declare some variables\n orig_x = @win.getbegx\n orig_y = @win.getbegy\n key = 0\n\n # Let them move the widget around until they hit return\n while key != Ncurses::KEY_ENTER && ...
[ { "docid": "e19bdcb8313cc4e8ec782ba778565f53", "score": "0.73545843", "text": "def relocate_cursor\n return unless @active\n set_cursor(@textstart + 1 + (Mouse.x - self.rect.x - 1 - @factor/2)/@factor)\n end", "title": "" }, { "docid": "9beed6a6e0062c21e83a29608e6aa0ef", "sc...
06dbb21b9740b329951ffcb780e64a13
DELETE /template_tasks/1 DELETE /template_tasks/1.json
[ { "docid": "680d0c40ab6f1676494314afbd7471a7", "score": "0.7662419", "text": "def destroy\n @template_task.destroy\n respond_to do |format|\n format.html { redirect_to template_tasks_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "71c59fe3b50a1a1d546ca5d68e390cfc", "score": "0.73051035", "text": "def destroy\n @template_task = TemplateTask.find(params[:id])\n @template_task.destroy\n\n respond_to do |format|\n format.html { redirect_to(template_tasks_url) }\n format.xml { head :ok }\n end\n end...
8e972bedee6ead21ca1d889c1a972c78
PUT /admins/1 PUT /admins/1.json
[ { "docid": "516d4be7feebbaf2d42087c0512fb272", "score": "0.66400814", "text": "def update\n @admin = Admin.find(params[:id])\n\n respond_to do |format|\n if @admin.update_attributes(params[:admin])\n format.html { redirect_to @admin, notice: 'Admin was successfully updated.' }\n ...
[ { "docid": "4ca03678ee189fdd297e71012e61a355", "score": "0.69734687", "text": "def update\n update_object(@admin, admins_url, secure_params)\n end", "title": "" }, { "docid": "d4999aa4aef4504de020e4b1c4413dfb", "score": "0.68772304", "text": "def edit_admins\n end", "title...
1e0e8a7474657649b08a96ba8815f0dc
DELETE /orders/1 DELETE /orders/1.json
[ { "docid": "8dc94b23065674b022e7291a2d1c914e", "score": "0.73572004", "text": "def destroy\n @order = Order.find(params[:id])\n @order.destroy\n\n respond_to do |format|\n format.html { redirect_to orders_url }\n format.json { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "d95245ee8d8e63ffab2dfbac802158ee", "score": "0.808749", "text": "def destroy\n delete(\"/orders/#{id}/delete\")\n end", "title": "" }, { "docid": "8e531349d930fb6fede4efc401d68904", "score": "0.7670167", "text": "def destroy\n @order.destroy\n\n render json:...
26392360525a8dfe5ee19702cb7b2874
GET /events GET /events.json
[ { "docid": "1785858de6f3a8196ef0150c012eae2c", "score": "0.0", "text": "def index\n @events = Event.all\n if params[:search_content] || params[:contains_tags].to_a.size > 1\n @events = @events.filter(params.slice(:search_content, :contains_tags))\n end\n if params[:event_type_id]\n ...
[ { "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...
5d8682ea51000eecbc3a6381bcf7baf8
add to exceptions when needed
[ { "docid": "1a3364c7d31b3b905d17fe4afae9e788", "score": "0.0", "text": "def create\n Lesson.create(lesson_params)\n # redirect_to\n end", "title": "" } ]
[ { "docid": "fe4579a8b911d5f578c266d6a8013be2", "score": "0.7781138", "text": "def exceptions; end", "title": "" }, { "docid": "64d8d44eecc1767b305769006b8d4050", "score": "0.76660067", "text": "def exceptions\n end", "title": "" }, { "docid": "f0c49c2fb48b95f09222ccf...
af5f3767c9f47ed86646271847275bfd
checking the move of one possible direction
[ { "docid": "845db72cfd9b5fc67b9078f4f0cea1a1", "score": "0.7429545", "text": "def check_direction(dir)\n\t\tdirectional_moves = []\n\t\tcur_pos = pos\n\t\tloop do\n\t\t\tcurx, cury = cur_pos[0] + dir[0], cur_pos[1] + dir[1]\n\t\t\tcur_pos = [curx, cury]\n\t\t\tbreak unless board.valid_pos?(cur_pos)\n\n\...
[ { "docid": "bb22d23f65d0e2c7b28ec89f5d1e4ab5", "score": "0.8013963", "text": "def valid_move?(x, y)\n standard_move?(x, y) || castling_move?(x, y)\n end", "title": "" }, { "docid": "796145a3b903b33f755c217fbce72844", "score": "0.7901504", "text": "def check_move(x, y)\n re...
2fc040cdfdad7e2eb05880aa8fa79586
Renames the collection. This changes the collections name and updates the Collections hash.
[ { "docid": "6909975fe8b4a17682d44fab260ee28e", "score": "0.73933035", "text": "def rename! new_name\n Rindle.collections.delete @name\n @name = new_name\n Rindle.collections[@name] = self\n end", "title": "" } ]
[ { "docid": "fd05383e7448c2203211eaf7397a9fec", "score": "0.809872", "text": "def rename_collection(database,collection,new_name)\n options={:basic_auth => @auth, :body => {:name => new_name}}\n handle_result self.class.put(\"/databases/#{database}/collections/#{collection}\", options)\n end...
a5f113dc286e3ea8493e9513da4b2aca
Clicks on the Capture Screen button in the application header,sets the filename, and whether to include the patient details in the capture Params: filename optional filename to give the screenshot hidePatientDetails to hide the patient information or not
[ { "docid": "76b28a4a742ebaee6286a5c22980d07e", "score": "0.7713547", "text": "def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooterEdit.captureScreen(filename, hidePatientDetails)\n return self\n end", "title": "" } ]
[ { "docid": "315fec7610bb7a10794bbd81624eac91", "score": "0.7805806", "text": "def captureScreen(filename=nil, hidePatientDetails=false)\n @appHeaderFooter.captureScreen(filename, hidePatientDetails)\n return self\n end", "title": "" }, { "docid": "315fec7610bb7a10794bbd81624eac91", ...
0dc5c148f5bd20b7c143b5398081c002
Action will display form for registering a new user.
[ { "docid": "ca1dfea8c4e7d779a2c22178e3465229", "score": "0.0", "text": "def register\n end", "title": "" } ]
[ { "docid": "737f4b73ddfbe2a739ee4b97a7be4f2f", "score": "0.75660115", "text": "def new # implicitly renders app/views/users/new.html.erb - signup registration form\n @user = User.new # @user = instance for form_for to wrap around in signup form view\n end", "title": "" }, { "docid": "848...
f957963680babc0f459b912e20c08e6c
GET /notices/1 GET /notices/1.json
[ { "docid": "bcc5ffac7196a64aa905e40f2cb76299", "score": "0.6967799", "text": "def show\n @notice = Notice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end", "title": "" } ]
[ { "docid": "063010108bacf4bf0b44a2ca4fe95596", "score": "0.7227371", "text": "def show\n @notice = @person.notices.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @notice }\n end\n end", "title": "" }, { "docid": "ce...
aed9593f05db6bfef731e3474b6e030d
Full Name (fname mname lname)
[ { "docid": "95bc48cfc5ef59e9dbb87a22eb4bf22e", "score": "0.0", "text": "def full_name\n (self.first_name if self.first_name) +\n (self.middle_name + ' ' if self.middle_name) +\n (self.last_name + ' ' if self.last_name)\n end", "title": "" } ]
[ { "docid": "139e4c3f42a1de0d78483f2a714a5b19", "score": "0.8788177", "text": "def full_name\n fname + ' ' + lname\n end", "title": "" }, { "docid": "da4f73f9613af986405657c7d26ae655", "score": "0.85513806", "text": "def full_name\n\t\t\"#{fname} #{lname}\".strip\n\tend", "tit...
1c48b1badaedfc7451d657dc3df69ebe
PATCH/PUT /has_documents/1 PATCH/PUT /has_documents/1.json
[ { "docid": "e34a8ec214b14ede130f659b58ae91ce", "score": "0.7084845", "text": "def update\n respond_to do |format|\n if @has_document.update(has_document_params)\n format.html { redirect_to @has_document, notice: 'Has document was successfully updated.' }\n format.json { render :sho...
[ { "docid": "84e8982bd2f1f4b905cf33d97dd2db88", "score": "0.696267", "text": "def update\n document = Document.find(params[:id])\n if document.update(params_document)\n render json: document, status: 200\n else\n render json: document.errors, status: 422\n end\...
fa11086b54a5405720f671fbba86ac60
PUT /daily_reports/1 PUT /daily_reports/1.xml
[ { "docid": "3276efe9b15169a23288b84a9c716bf0", "score": "0.6633326", "text": "def update\n @daily_report = DailyReport.find(params[:id])\n\n respond_to do |format|\n if @daily_report.update_attributes(params[:daily_report])\n flash[:notice] = 'DailyReport was successfully updated.'\n ...
[ { "docid": "76947a495f8371e8e772fdb40663d3b8", "score": "0.6577261", "text": "def update_report_template(args = {}) \n put(\"/reports.json/template/#{args[:templateId]}\", args)\nend", "title": "" }, { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.649531", "text": "def upd...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "bb38281732221146612211e402b4e690", "score": "0.0", "text": "def photo_params\n params.permit(:andrew_id, :photo_url)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79439425", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69581985", "text": "def permitted_params\n params.permit!\n end", "title...
fbd1666a4fcd677082a5063966e04c87
number The Integer that will be cubed Examples cube(5) => '125' Returns the cubed Integer.
[ { "docid": "bda2ce74cf0989af6ead3e65c174abd0", "score": "0.5364962", "text": "def square(number)\n return number*number*number\nend", "title": "" } ]
[ { "docid": "d6b397ce2e3af0b08e25fd9794966cb2", "score": "0.8213973", "text": "def cube(number)\n number.to_i\n return number**3\nend", "title": "" }, { "docid": "982b061084da17789eba289ccf661204", "score": "0.777724", "text": "def cube(number)\n return number ** 3\nend", ...
d82be252daf8557907468e5adcaddffb
Enumerates the toplevel worlds
[ { "docid": "fbff229e7febd181d68b422fb64f06ff", "score": "0.58130985", "text": "def each_world\n return enum_for(__method__) if !block_given?\n xml.elements.each do |element|\n if element.name == 'world'\n yield(World.new(element, self))\n ...
[ { "docid": "92826f77b669ecaeb5beb85726a7d142", "score": "0.63512874", "text": "def each_world(recursive: false)\n return enum_for(__method__, recursive: recursive) if !block_given?\n xpath_query =\n if recursive then './/world'\n else 'world'\n ...
082565ae795d7f2ce77e030853387bb8
returns if the last backup is too long ago
[ { "docid": "97261f1ec2462ddabdeb2f5c0d85f023", "score": "0.7553513", "text": "def should_backup?\n last_backup = Backup.order(\"created_at desc\").first\n return true unless last_backup\n should_backup = (Time.now - last_backup.created_at > 24.hours)\n end", "title": "" } ]
[ { "docid": "67fb126f0c2be9a35bf15e8d9ac524b3", "score": "0.6686376", "text": "def is_recent?\n Time.now.gmtime - aws_snapshot.created_at < 300.seconds\n end", "title": "" }, { "docid": "9953bcf10946193bb32e3fcde150f873", "score": "0.65484697", "text": "def is_backed_up?\n jobs...
a8c588f176155f17d5b813cf035f0f30
GET /student_majors/1 GET /student_majors/1.json
[ { "docid": "85ca892038bbab1d3c4f0db7bca864f1", "score": "0.7129478", "text": "def show\n @student_major = StudentMajor.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @student_major }\n end\n end", "title": "" } ]
[ { "docid": "552519b360ba392784193f6912b221b7", "score": "0.7200803", "text": "def index\n @majors = majors\n respond_to do |format|\n format.json{\n return render json: ret\n }\n end\n end", "title": "" }, { "docid": "967c1e05b3d0af3437c301331c176827", "score":...
e5323f9f5ea0cfc50e1c55c490110e65
Checks in the book, making it available and setting borrower array to empty. Returns the borrower array before emptying it to clear the book from borrower object. Not very elegant. Is there a this for the book object? so I could call a borrower.checked_out.delete(this)?
[ { "docid": "fc3c82eb25e441be1da459c516fd7f5a", "score": "0.620559", "text": "def check_in\n @status = 'available'\n return @borrower\n @borrower = []\n end", "title": "" } ]
[ { "docid": "f880b6180fe6c70a69e72a8051c3eff9", "score": "0.7678215", "text": "def check_in_book(book)\n borrower = book.check_in\n #Removes the book from the borrower's checked out array\n borrower.first.checked_out.delete(book)\n end", "title": "" }, { "docid": "bbe6cd650b99e9817a...
dfc8761d71abe781f52e8bae1667b77d
Makes Aggregation Group and Project objects from an array
[ { "docid": "9b53fd64288d7895cd86bf83050b7d61", "score": "0.5801141", "text": "def make_grp_prj_nodes\n grp = {}; prj = {}\n @nodes_fields.each do |node|\n grp[node] = '$' + node\n prj[node] = '$_id.' + node\n end\n return [grp, pr...
[ { "docid": "6d70ef9f3d92d9b90fbd08895248e06f", "score": "0.6270834", "text": "def groupby_fields\n ids = {}\n ids.merge!(make_grp_prj_periods[0])\n ids.merge!(make_grp_prj_nodes[0])\n { '_id' => ids }\n end", "title": "" }, { "docid": "f7a38...
d9faf83dc1fb4f164d481c05dd6f121b
DELETE /task_notes/1 DELETE /task_notes/1.json
[ { "docid": "057f3d89c984ca7df97568f49225e2c2", "score": "0.76574934", "text": "def destroy\n @task_note.destroy\n respond_to do |format|\n format.html { redirect_to task_notes_url, notice: 'Task note was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "t...
[ { "docid": "5955ccd4b0c810a56696ac20d0cc1901", "score": "0.72875017", "text": "def delete\n RTM::Tasks::Notes::Delete.new(\n RTM::API.token, \n RTM::Timeline.new(RTM::API.token).to_s,\n id).invoke\n end", "title": "" }, { "docid": "a041278373358be0e4842ebaa260b...
aff3fd4b39de9e57d8872e25ffbb3f55
Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/taskrouter/v1/workspace/task/reservation.rb398
[ { "docid": "84c2aa104b8a70acbe3f11eca76559b3", "score": "0.0", "text": "def to_s; end", "title": "" } ]
[ { "docid": "bfc75f5b9977085edc97fce0ced51c08", "score": "0.6403895", "text": "def reservations\n end", "title": "" }, { "docid": "1a3c708e75911b36f22e674e94ca6898", "score": "0.6283398", "text": "def reservation_params\n params.require(:reservation).permit(:name, :start_time, :...
e743921320c103bc93213c199d5b8b2c
before_action :authenticate_admin!, only: [:new, :create, :edit, :update, :destroy]
[ { "docid": "b16ab56ed504bb6bc8df52950f104e95", "score": "0.0", "text": "def index\n\n @stamps = Stamp.all\n sort_attribute = params[:sort]\n sort_order = params[:sort_order]\n search_term = params[:search_term]\n category_search_term = params[:category]\n\n if category_search_term \n ...
[ { "docid": "424cef8dd025b3cf5dd57b5347158995", "score": "0.8107277", "text": "def admin\n authenticate_admin!\n end", "title": "" }, { "docid": "da0adf19cffd97a439e35c34b0f79bf2", "score": "0.7921851", "text": "def authenticate_admin!\n # Some controllers are just for admins (...
797bb053ec6c415d1cfa6af0ed37e8ec
extract reservation id from url
[ { "docid": "42232c4e843b897ef62837854e6adb24", "score": "0.7671182", "text": "def get_reservation_id(link)\n uri = Addressable::URI.parse(link)\n uri.query_values['id']\n end", "title": "" } ]
[ { "docid": "9160703d7add6e5326390da1555bcfdf", "score": "0.7239075", "text": "def parse_id(url)\n url.to_s.split('/').last.to_i\n end", "title": "" }, { "docid": "69d2066cdea40e67671605ffc9e06ab5", "score": "0.713848", "text": "def extract_pid\n find_pid = params[:id]\...
b7e34fa09c3fe846d1103088f7542831
GET /resource/password/new def new super end POST /resource/password def create super end GET /resource/password/edit?reset_password_token=abcdef def edit super end PUT /resource/password
[ { "docid": "a8bbac5026f453bd8ba33f5355d68a6a", "score": "0.0", "text": "def update\n if current_customer.reset_password( params[:customer][:password], params[:customer][:password])\n flash[:password] = 'パスワードを変更しました。もう一度ログインしてください'\n redirect_to root_path\n else\n redirect_to edit_c...
[ { "docid": "55c9f71f5b551825c14bf76d315653ad", "score": "0.76751024", "text": "def edit\n @resource = resource_class.reset_password_by_token({\n reset_password_token: resource_params[:reset_password_token]\n })\n\n if @resource && @resource.id\n password = generate_reset_password\n\n ...
bdea0c0d32ef76736e868a29e5be3c1a
IMPORTANT If you use faster_csv you must now include the :environment like 'task :mytask => [:environment]' require 'faster_csv' < this does not work with RubyGems 1.3.6
[ { "docid": "0c10fecf04f33039b10580b4cacf0d2e", "score": "0.0", "text": "def get_csv(myfile, tabbed = false)\n\n raise \"Unable to read from file '#{myfile}'\" if !File.readable?(myfile) \n\n if tabbed\n recs = CSV::parse(File.open(myfile, 'r'){|f| f.read}, :col_sep => \"\\t\") # this doesn...
[ { "docid": "12c96bdbe40a4fb7fac813e94344030f", "score": "0.6180361", "text": "def action_perform_rake_csv(csv_file, config_file, command_file)\n payloads = action_payload.from_csv(csv_file, config_file, command_file)\n\n results = []\n payloads.each do |payload|\n r...
832312adc8eb99011250ab24d923e89e
========================================================================== METHOD TO CREATE A POLITICIAN/VOTER
[ { "docid": "fb07d7180dcbb145ef4adba347c00f3d", "score": "0.0", "text": "def create_politician #NEED TO CREATE ARRAYS FOR POLICITCIANS\n puts \"Please enter the first and last name of the new politician\"\n @politician = gets.chomp\n politician_affiliation\nend", "title": "" } ]
[ { "docid": "e23570b375cad188bdd0271daf70488e", "score": "0.6265502", "text": "def to_pol\n x = @valor * 0.3937;\n x = x.round(2)\n x.to_s + \"pol\"\n end", "title": "" }, { "docid": "9917b8c76298830c652be75c51ec1093", "score": "0.5664799", "text": "def create_perpendicular\...
1490d2ceacbfdc1461894f344592817f
GET method for the new post form
[ { "docid": "e68f46bfd8877386c908a622b4cb009b", "score": "0.0", "text": "def new\n @post = Post.new\n end", "title": "" } ]
[ { "docid": "8af430d6eaa0babd484b2a722e1e8203", "score": "0.7482664", "text": "def new\r\n\t\trender \"post\"\r\n\tend", "title": "" }, { "docid": "31087b4459415d460b01fa5bbda84406", "score": "0.7330369", "text": "def new\n respond_with @post\n end", "title": "" }, { "...
a33dc87e1a35fd63f27e2a94ef89ea3f
PUT /projects/1 PUT /projects/1.xml
[ { "docid": "af06eed321b86a0f610bd2bd3f58ea6c", "score": "0.65453315", "text": "def update\n @project = Project.find(params[:id])\n\n respond_to do |format|\n if @project.update_attributes(params[:project])\n format.html { redirect_to(@project, :notice => 'Project was successfully updat...
[ { "docid": "17cef175c9f11b48ca6b985da2df6bf8", "score": "0.7398724", "text": "def update_project\n @user = User.find_by_username(session['user'])\n @access_token = OAuth::AccessToken.new(UsersController.consumer, @user.token, @user.secret)\n @response = UsersController.consumer.request(:put, \"...
a0a50c086f5bb0f052627596d76511af
inserts Kcup into machine
[ { "docid": "8dc2dbcf74b552ee2305e1dcd1a27fca", "score": "0.67875934", "text": "def insert_kcup(kcup)\n end", "title": "" } ]
[ { "docid": "793176bc8777f649a761d1e1bfe880eb", "score": "0.58007497", "text": "def machine=(new_machine); end", "title": "" }, { "docid": "990f5a88fe7ad009b5a5c085a5d4fe84", "score": "0.55111575", "text": "def set_board\n\t\t(1..@disks).each do |disk|\n\t\t\t@pegs[0].unshift disk\n\t...
44f70f4124b7a9a25f454372f7e4b011
Used for setup purposes. Calls convenience methods to create sets in redis of users that both like and dislike this object.
[ { "docid": "a40c1f7cd2fdf22b324bf2a9b7b7b763", "score": "0.5917618", "text": "def create_recommendable_sets\n [create_liked_by_set, create_disliked_by_set]\n end", "title": "" } ]
[ { "docid": "2974a2a04ec955f7ec0b41b64bea5997", "score": "0.69758546", "text": "def create_liked_by_set\n set = \"#{redis_key}:liked_by\"\n liked_by.each { |rater| Recommendable.redis.sadd set, rater.id }\n return set\n end", "title": "" }, { "docid": "2974a2a04ec955...
6544d0639d16fa429d263ae41e5d02e4
GET /invoices GET /invoices.json
[ { "docid": "f65efd4ba64c1fb5d1e423ee2a73b5ce", "score": "0.6589932", "text": "def index\n @invoices = params[:sort] ? Invoice.order(params[:sort]) : Invoice.order(\" id DESC\")\n\t\n\t@columns = [\"id\",\"total\",\"status\",\"payment\",\"user_id\",\"created_at\"]\n\n respond_to do |format|\n ...
[ { "docid": "70c3a08e741dcc63a67a6e8a8ac10a85", "score": "0.82604194", "text": "def url\n '/api/invoices'\n end", "title": "" }, { "docid": "cfee3b2bec5c691b6dbe0961b07c847e", "score": "0.80761665", "text": "def index\n @invoices = @user.invoices.all\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b6ac68f927431e0ab142423e861407b3", "score": "0.0", "text": "def buildskill_params\n params.require(:buildskill).permit(:party_id, :name, :power, :eff)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981606", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6784227", "text": "def strong_params\n params.requi...
bf78f8dba9e330b705e6e570f0f78ecd
parser rule assignment_type (in lib/Entity.g) 100:1: assignment_type returns [value] : type= ( '=' | '+=' | '=' | '=' | '/=' ) ;
[ { "docid": "3465750d4facc99752862e3c0dd3a343", "score": "0.81939644", "text": "def assignment_type\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 15 )\n\n\n value = nil\n\n\n type = nil\n\n\n begin\n # at line 101:5: type= ( '=' | '...
[ { "docid": "d7bd1437fe229faf85d4cfa9e3e9fe77", "score": "0.778376", "text": "def assignment_type=(value)\n @assignment_type = value\n end", "title": "" }, { "docid": "5ba9b943797cba80487fb50eab81f309", "score": "0.6816713", "text": "def assignment_type\n ...
e3885d4105253cd58dd1b1d560da84fb
DELETE /notice_event_places/1 DELETE /notice_event_places/1.json
[ { "docid": "8c2f40330c748cff9176642e37503f37", "score": "0.77636135", "text": "def destroy\n @notice_event_place = NoticeEventPlace.find(params[:id])\n @notice_event_place.destroy\n\n respond_to do |format|\n format.html { redirect_to notice_event_places_url }\n format.json { head :no...
[ { "docid": "ca8002b7f734bce1f1a27f7ec6e59e9d", "score": "0.69222474", "text": "def destroy # DELETE /api/events/:id\n @event.destroy\n render :json => \"Event deleted\", :status => 201\n end", "title": "" }, { "docid": "e41e502ec0ee6c9902ad472667b4c142", "score": "0.6869...
e1428c7e67789123fcefeb2e15c0fb10
Iterate across the entire map. Usage: each_plate_point do |x, y, plate_id| do something with this information end
[ { "docid": "c493c7a0cbe0177243cc64088b2d0034", "score": "0.7874132", "text": "def each_plate_point\n (0...@size).each do |x|\n (0...@size).each do |y|\n yield x, y, @plate_ids[x][y]\n end\n end\n end", "title": "" } ]
[ { "docid": "156c57a2fd4ad70bd536aa0ada8cf266", "score": "0.6997092", "text": "def each_map_block\n (0...world.map.x_count_block).each { |xb|\n xl = world.map.block_index[xb]\n (0...world.map.y_count_block).each { |yb|\n yl = xl[yb]\n ...
193ff2fb125b7d5ff165c469f1f5d137
Dump an `or` message into a hash
[ { "docid": "57a3d5023cbb625752df49c5ec6e7d44", "score": "0.0", "text": "def to_h\n @to_h ||= _path.to_h(dump)\n end", "title": "" } ]
[ { "docid": "6015706bdd9e2fa5e432c2b2ee137cda", "score": "0.6668696", "text": "def dump\n to_a.map(&:dump).join(\" #{messages[:or][:text]} \")\n end", "title": "" }, { "docid": "b9251b2f158578d6a9d425c4ee9157e2", "score": "0.60829043", "text": "def dump\n @d...
a78496e2216aa8ed580c77b299c66e18
============================== Gus and Joe: Solved without using shuffle as above ^^
[ { "docid": "e9ace13ac0812b04e49a827792e0b77a", "score": "0.0", "text": "def random_select(array, length)\n shuff = []\n length.times {shuff.push(array.delete_at(rand(array.length)))}\n shuff\nend", "title": "" } ]
[ { "docid": "5c8f4b01f17a926407f0ae8dff1b6691", "score": "0.8322504", "text": "def shuffle()\n \n end", "title": "" }, { "docid": "93d1bcfb8d6d324b8dcdc50405b49caf", "score": "0.8175328", "text": "def shuffle\n end", "title": "" }, { "docid": "93d1bcfb8d6d324b8d...
d42546861263bb5b99cba98b562b824a
Hyphens are converted to subdirectories in the output folder. If a file has two extensions like Rails naming conventions, then the first extension is used as part of the output file. sitemap.xml.erb => sitemap.xml If the output file does not end with an .html extension, item[:layout] is set to 'none' bypassing the use ...
[ { "docid": "577591a68ad955c6af64dddc8f8b5417", "score": "0.5418729", "text": "def route_path(item)\n # in-memory items have not file\n return item.identifier + \"index.html\" if item[:content_filename].nil?\n \n url = item[:content_filename].gsub(/^content/, '')\n \n # determine output extension\n ...
[ { "docid": "056a53a76c73bf2a64265ead9b106496", "score": "0.62128407", "text": "def layouts\n folder.glob('*.yaml').map { |file| file.base.to_s }\n end", "title": "" }, { "docid": "2c7a9a4f977142fae53f9dc6b3c5dffe", "score": "0.61595327", "text": "def sitemap_www\n render :...
64aec466cde2cc2e8749c72c97093a62
Remove HTML from a string (helpful for truncated intros of preformatted HTML)
[ { "docid": "74bb438be1a75e0dd4bf1dd88d4dbd49", "score": "0.8120335", "text": "def strip_html(string=\"\")\n begin\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_safe\n rescue\n raw(\"<!-- err...
[ { "docid": "5e8224315de119fe0c3cfb579d84e76e", "score": "0.8113972", "text": "def strip_html(string=\"\")\n begin\n string = strip_tags(string)\n string = string.gsub(/<\\/?[^>]*>/, \"\")\n string = string.gsub(/\\&+\\w*\\;/, \" \") # replace &nbsp; with a space\n string.html_saf...
74fe7a3f99c9ee85cef803d143e43788
PATCH/PUT /tutorials/1 PATCH/PUT /tutorials/1.json
[ { "docid": "5b3a391324761fc5d87a9030456dcf01", "score": "0.6110436", "text": "def update\n process_tag_params\n respond_to do |format|\n if @tutorial.update(tutorial_params)\n add_new_tags\n format.html { redirect_to [:admin, @course, @tutorial], notice: 'Tutorial was successful...
[ { "docid": "32bdc56b950780c23a2da238a41b7ebb", "score": "0.6698879", "text": "def update\n respond_to do |format|\n if @tutorial.update(tutorial_params)\n format.html { redirect_to @tutorial, notice: 'Tutorial was successfully updated.' }\n format.json { head :no_content }\n e...
594d0b20594c497d91ca7e23392a6b14
TODO: search by available dates
[ { "docid": "9dd22a268a979ed5fa08fe076782b6e4", "score": "0.0", "text": "def filled?\n ATTRIBUTES.any? do |attr|\n public_send(attr).present?\n end\n end", "title": "" } ]
[ { "docid": "13a9ca1bf3fa982048cdc1c57fc85634", "score": "0.71685284", "text": "def available?(start_date, last_date=nil)\n last_date = start_date if last_date.nil?\n # we are also able to search for one day booking\n # dates we are taking as yyyy/mm/dd\n # example available(\"2016/10/9\")\n ...
df19a19149d01a5b00fff52cc390af47
POST /planes POST /planes.json
[ { "docid": "cffd294a47d3cd512948df17c71f661a", "score": "0.7160623", "text": "def create\n redirect_if_not_logged_in\n\n @plane = Plane.new(plane_params)\n\n respond_to do |format|\n if @plane.save\n # format.html { redirect_to @plane, notice: 'Plane was successfully created.' }\n ...
[ { "docid": "0e7bc03ed18e4f33b6a8e7f6aad58549", "score": "0.7097909", "text": "def index\n @planes = Plane.all\n render json: @planes\n end", "title": "" }, { "docid": "5fad080f01b22569a01cd320cb2ebf23", "score": "0.69917566", "text": "def create\n \t\n @plane = Plane.new(p...
1c858a755bea7db49ba8bf685170e78e
retrieve_image_id() If the id is not found then adds to the source's persistent error log Parameters: None Returns: a numeric id representing the image on Linode nil if not found
[ { "docid": "0048a75fc3fd51d6ed0b3ca23bdaf8dc", "score": "0.7526296", "text": "def retrieve_image_id\n name = config['image_name']\n\n img_data = connection.image_list.body[\"DATA\"].find { |i| i[\"LABEL\"] == name }\n if img_data.nil?\n names = connection.image_list.body[\"DATA\"]....
[ { "docid": "3d499982f82d76ba55f96c82840ed028", "score": "0.6853218", "text": "def image_uid\n @dicom_image_uid || @image_uid\n end", "title": "" }, { "docid": "db490daff040141d88cdcfa88208ce97", "score": "0.6767594", "text": "def image_id\n data[:image_id]\n end", "ti...
b7fba251875de44a6e511f96d6b43d76
PATCH/PUT /beefs/1 PATCH/PUT /beefs/1.json
[ { "docid": "abe521d9dd10e95a0cbf304ea9225df0", "score": "0.6072312", "text": "def update\n respond_to do |format|\n if @beef.update(beef_params)\n format.html { redirect_to @beef, notice: 'Beef was successfully updated.' }\n format.json { render :show, status: :ok, location: @beef ...
[ { "docid": "4e0e59715d19dce2a47fccc2c67326dd", "score": "0.65148425", "text": "def patch!\n request! :patch\n end", "title": "" }, { "docid": "576f27e4c99d0868b0454fedc7deba0c", "score": "0.6113826", "text": "def update # PATCH\n raise NotImplementedError\n end", "tit...
50bb1659b6ad5d325a5e15481bac6f03
GET /methodsteps/1 GET /methodsteps/1.xml
[ { "docid": "586599bf6116687954f71a4898046a47", "score": "0.6693262", "text": "def show\n @methodstep = Methodstep.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @methodstep }\n end\n end", "title...
[ { "docid": "607550c21ff91c9a5acbd7f0b77879dc", "score": "0.6540217", "text": "def show\n \t@step = Step.find(params[:id])\n \t\n \trespond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @step }\n end\n end", "title": "" }, { "docid": "b06940a4b90...
7671e854b08c8b6ed52a09f1ae2ba505
POST /tipo_enderecos POST /tipo_enderecos.json
[ { "docid": "26c82b4447f3908a71f23342e4b3d4a3", "score": "0.65699804", "text": "def create\n @tipo_endereco = TipoEndereco.new(tipo_endereco_params)\n\n respond_to do |format|\n if @tipo_endereco.save\n format.html { redirect_to @tipo_endereco, notice: 'Tipo endereco was successfully cr...
[ { "docid": "cc8ce2dae2be58e84c2447c033bd4668", "score": "0.70557547", "text": "def tipo_endereco_params\n params.require(:tipo_endereco).permit(:descricao, :status)\n end", "title": "" }, { "docid": "31769ce6ebccbd04c74643dbbcd6b1c8", "score": "0.66921514", "text": "def creat...
5735fe8c0b4484a07796390e8e39a4cf
Returns the path to sign in via the OAuth Provider.
[ { "docid": "9b550fc876a40a8428d34b17ac74da20", "score": "0.7994045", "text": "def oauth_sign_in_path(name)\n oauth_instance(name).sign_in_path\n end", "title": "" } ]
[ { "docid": "e28687b6c6a218a21740841ed25a23c5", "score": "0.7786185", "text": "def oauth_login_path name = nil\n oauth_instance(name).login_path\n end", "title": "" }, { "docid": "a94466ee94bc40d4a5049dc96b83b0ed", "score": "0.7725137", "text": "def oauth_login_path name = nil\n ...