query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
7f28bca47fbc95bbb7bf833d3b0826c3
Return the result element corresponding to the input vector index index. FIXME We really need a better way of delaying with two index values, e.g. one for results and one for bar values. We need to unify them at some point or (gag) invent an offseted array class which tracks offsets and does the right thing.
[ { "docid": "18130d6a81ecfa382bebedc2f5ae1d27", "score": "0.6178532", "text": "def result_at(time_or_index, slot)\n begin\n case time_or_index\n when Time then result_hash[slot][time2index(time_or_index)-result_offset]\n when Numeric then result_hash[slot][time_or_index-result_offs...
[ { "docid": "06e1274e49578d76afbee0e9e932023c", "score": "0.6792804", "text": "def [](idx)\n process_results unless @processed\n @results[idx]\n end", "title": "" }, { "docid": "ac8516d6e03cc3f04cb43a1681067365", "score": "0.6555767", "text": "def [](index)\n ...
a77919ca4d14806440025299f9922dc4
this method checks if a users is signed in. If so it will redirect to the profile method by using the "/" convention. If the if statement is not executed, then we will just render the new.html.erb view in the users view foldercopy
[ { "docid": "137be7c48b7f0ccec652099907b16359", "score": "0.7092592", "text": "def new\n if signed_in?\n redirect_to \"/users/profile\"\n end\n end", "title": "" } ]
[ { "docid": "ca836afe96155ec5bfaefe19a7741980", "score": "0.72994983", "text": "def redirect_if_logged_in\n if logged_in?\n redirect \"/users/#{current_user.id}\"\n end\n end", "title": "" }, { "docid": "17a710b9daae70518078bfbc73186f01", "score": "0.72314024",...
be9e8281120594bf3c2775f1a1a3ed43
PUT /contents/1 PUT /contents/1.xml
[ { "docid": "dfe205105af0c0cc65366224abb7ae46", "score": "0.57890815", "text": "def update\n @content = Content.find(params[:id])\n\n respond_to do |format|\n if @content.update_attributes(params[:content])\n flash[:notice] = 'Content was successfully updated.'\n format.html { re...
[ { "docid": "23b5f5e4dacfb330cb1e0ffd4590ef63", "score": "0.6525524", "text": "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post opts.fetch(:path, update_path), opts\n end", "title": "" }, { "docid": "62262ba01616f5c24bd2593612f494f0...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "88323cc976b7e59ed09c7a6c51e1e497", "score": "0.0", "text": "def brand_params\n params.fetch(:brand, {})\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...
02b6616c03bf4717be4f5ae0cc56f772
Required for cancan abilities
[ { "docid": "f9f6b8819fc4ba68f59251aa38960058", "score": "0.0", "text": "def namespace\n # controller_name_segments = params[:controller].split('/')\n # controller_name_segments.pop\n # controller_name_segments.join('/').camelize\n params[:controller].split('/').first\n end", "title": ""...
[ { "docid": "ed744a6b5c669fa6384f3cb9f1a9c94a", "score": "0.7273065", "text": "def allowed?; true end", "title": "" }, { "docid": "dd6f7732e55269e16c663cb9d4171477", "score": "0.7021739", "text": "def permitted?; end", "title": "" }, { "docid": "a83e43b30464b276062cabf342d...
7ffbcb95d2b84262198502000de3672a
POST /emails POST /emails.json
[ { "docid": "091b3eee518b51f13e376c15f81b2180", "score": "0.552293", "text": "def create\n @email = Email.new(email_params)\n\n end", "title": "" } ]
[ { "docid": "03efbe43798a0b56127ea65c1d951a09", "score": "0.67616475", "text": "def create\n @email = @recipient.emails.new(params[:email])\n\n respond_to do |format|\n if @email.save\n format.html { redirect_to recipient_emails_path, notice: 'Email was successfully created.' }\n ...
b7c0ac27732670e989745593f9985c82
) Get Element Rate
[ { "docid": "7cbcf3fda3e5a9a7e1c9b4f374ea182d", "score": "0.6826357", "text": "def get_element_rate(id)\n @features.each do |feat|\n if feat.code == 11\n if id.is_a?(String)\n return feat.value if id.upcase == $data_system.elements[feat.data_id].upcase\n else\n ret...
[ { "docid": "e0b4ebb96c62a505940747d83295c3af", "score": "0.824276", "text": "def element_rate(element_id)\n return 100\n end", "title": "" }, { "docid": "d1a718bc69512057ffe79f518b9a7f8d", "score": "0.7485733", "text": "def rate\n return @rate\n end", "title...
073f3e7ddd4c783cdb7f7556920f911f
Recursively retrieve subcollection images
[ { "docid": "78fef3d035a54aa11835971b1d33bbe6", "score": "0.7591046", "text": "def image_dig( _collection, _images, _check )\n\n # No sequence just exit...\n images = _collection.images\n if images\n images.each do | image |\n _images.push( image )\n end\n end\n\n # Recu...
[ { "docid": "038692c30729fe1a1e88292bcaabe624", "score": "0.6898821", "text": "def subtree_preview_images\n subtree_images = preview_images\n if children.length > 0\n children.each do |child|\n subtree_images += child.subtree_preview_images\n end\n end\n subtree_images\n end...
065729b984053006f06cc1f40df64ad2
Creates a new AviGlitch::Frames object.
[ { "docid": "7811f3619f73d0a8c4937fc6513c3f0f", "score": "0.5020428", "text": "def initialize io\n io.rewind\n io.pos = 12 # /^RIFF[\\s\\S]{4}AVI $/\n while io.read(4) =~ /^(?:LIST|JUNK)$/ do\n s = io.read(4).unpack('V').first\n @pos_of_movi = io.pos - 4 if io.read(4) == 'mov...
[ { "docid": "9ded909e6e650b75e4331746f77159d1", "score": "0.67979556", "text": "def create_frames\n # @type [LiteRGSS::Sprite]\n @black_frame = Sprite.new(@viewport) # Get the Blackn ^^\n # Scene frame\n # @type [LiteRGSS::Sprite]\n @frame = Sprite.new(@viewport).set_bitmap($opt...
857c7738075758fcee765fabdbdd8918
option 2, view products
[ { "docid": "78d3cd74e5f372f867cfeb97e6b7393e", "score": "0.0", "text": "def view_product\n\tsystem \"clear\"\n\n\tif @categories.empty?\n\t\tputs \"********************\"\n\t\tputs \"No products created.\"\n\t\tputs \"********************\\n\\n\"\n\t\tputs \"Go back to the main menu by typing 000 and se...
[ { "docid": "1446314aa3ef08721ea3158f1576e1ff", "score": "0.78304315", "text": "def show_products\n\t\tself.products\n\tend", "title": "" }, { "docid": "2b68dd6da7b311294977affe17a2cae6", "score": "0.7702236", "text": "def show\n @products = @product_bundle.products\n end", "t...
901ded2527c7ed43f9dfd42151808d78
PUT /related_works/1 PUT /related_works/1.xml
[ { "docid": "d2773ce2d89f2a914759f9b623dd2f58", "score": "0.0", "text": "def update\n @related_work.reciprocal = !@related_work.reciprocal?\n if @related_work.update_attribute(:reciprocal, @related_work.reciprocal)\n notice = @related_work.reciprocal? ? t('link_approved', :default => \"Link w...
[ { "docid": "033bf52839063d327724d0140f4af1c0", "score": "0.64151245", "text": "def update\n @work = Work.find(params[:id])\n\n @work.attributes = params[:work]\n @work.owner = @current_user\n\n respond_to do |format|\n if @work.save\n flash[:notice] = 'Work was successfully updat...
2ed936b8706e107bc848d5b33623d2f7
set field functions get the player session load based on current survey's rpe and duration practiced
[ { "docid": "72cc891609c007baa2876f1be76a9a5f", "score": "0.7338747", "text": "def set_player_session_load\n player_session_load = @player_rpe_rating * @participated_in_full_practice\n return player_session_load\n end", "title": "" } ]
[ { "docid": "7cc698af24fa5aa311f5c5fda8566c25", "score": "0.6420628", "text": "def set_expected_session_load\n expected_session_load = @practice.duration * @practice.difficulty\n return expected_session_load\n end", "title": "" }, { "docid": "327ea328a533d89ff8e4034068c8970f", "sco...
e7545ce7ed6d58fb606e0d5d072a229e
guess method takes letter parameter and stores it in guess arr checks word for match, returns true if there is a match
[ { "docid": "6555bcf64010a8c3db5c6a2b3e2787d2", "score": "0.8572724", "text": "def guess(letter)\n @guesses << letter\n correct = false\n @word.each_char do |index|\n if index == letter\n correct = true\n end\n end\n correct\n end", "title": "" } ]
[ { "docid": "621f8b2164c3a6d40b914e61a8dc01c1", "score": "0.85636175", "text": "def guess(letter_guess)\n existed=false\n correct=false\n #check if valid\n \n if (letter_guess=='') || (letter_guess==nil) || (/[a-zA-Z]/.match(letter_guess)==nil)\n raise ArgumentError.new(\"invalid inpu...
11a4d65512e19ef250d7d130c87d634b
Singleton_dump _dump(depth=1) default marshalling strategy
[ { "docid": "def794d0b45c39f0633fb3b265006085", "score": "0.6888722", "text": "def _dump\n end", "title": "" } ]
[ { "docid": "7134d43e48536f97c17ac9a43cc91ad5", "score": "0.7519361", "text": "def marshal_dump\n h = to_h.dup\n h.default = nil\n\n [nested_class, h]\n end", "title": "" }, { "docid": "eddfff8a271ab5d6ea67cd1c1231508f", "score": "0.7315641", "text": "def marshal_dum...
9821bdbe7a72553ea39776a02a011d47
Returns hash of body, with types as keys No it doesn't, yet
[ { "docid": "8d7278ae50a056d277894337ef6e3371", "score": "0.0", "text": "def parse_body content_type, body\n body.lstrip! rescue nil\n case content_type\n when \"multipart/alternative\" then parse_multipart_alternative(body)\n when \"text/plain\" then parse_text_plain(body)\n wh...
[ { "docid": "9e46506da67228e2ffac7ef9ad813417", "score": "0.70834637", "text": "def to_hash\n body.to_hash\n end", "title": "" }, { "docid": "dcb7464682266f162e70dea027ae41bd", "score": "0.67862517", "text": "def types\n result = {}\n headers.each do |h|\n res...
5b0eff3a488657c8091cde775f038172
Push Blog Post draft edits live Take any changes from the draft version of the Blog Post and apply them to the live version.
[ { "docid": "3791a15d66c45f2727c119e35adfeda2", "score": "0.0", "text": "def push_live(object_id, opts = {})\n push_live_with_http_info(object_id, opts)\n nil\n end", "title": "" } ]
[ { "docid": "1ee59712dc3a6fefa662b2de9046ce9b", "score": "0.61935693", "text": "def publish\n @options['date'] ||= read_draft_date || Time.now.iso8601\n\n post_options = {\n 'title' => read_draft_title,\n 'date' => @options['date'],\n 'slug' => publish_slug,\n ...
eaa384be9f6c26d4706b9238c1615a74
Create a repository project
[ { "docid": "386fa24c8b021aad6da2185aa35956f6", "score": "0.78146535", "text": "def create_repository_project(repo, name, options = {})\n opts = options.dup\n opts[:name] = name\n opts[:accept] = 'application/vnd.github.inertia-preview+json' if opts[:accept].nil?\n\n post \"#{...
[ { "docid": "e35885374861fc9e08e0c97491f775a7", "score": "0.7876955", "text": "def create_project(repo, name, options = T.unsafe(nil)); end", "title": "" }, { "docid": "204ede9eeeb4917b849c172aa9535a11", "score": "0.78537494", "text": "def test_1_0_create_repo\n $repo = PlanR::Proj...
74133109c003234fa2beb6c9c661dd77
No importa si el array esta desordenado
[ { "docid": "528a8dbdb832e3979199af4c8dea568b", "score": "0.0", "text": "def binary_search(from=0, to=nil)\n #Creacion del rango\n array = (1..100).to_a\n puts \"Piensa en un número entre el 1 y el 100\"\n #Obtener el numero del usuario\n num = gets.chomp.to_i\n #saber hasta que numero contar\n if...
[ { "docid": "0b2288a6853298e34b429f6b82caaa1f", "score": "0.68183523", "text": "def check_array(data)\n return true # still to be done\n end", "title": "" }, { "docid": "0c3041902b7f17402964d59e55933537", "score": "0.6408245", "text": "def normal?\n !array.empty?\n ...
c88c3f7000735d52cd59338aba32a77f
sort_column and sort_direction are helper methods defined in this controller t.name is tag name When listing by tags, I want to sort by i_follow_nbr
[ { "docid": "8fe8743a987bdf2ee23f6d449fa5e2b7", "score": "0.0", "text": "def list_pif\n if params[:chosen_letter]\n @users = User.pifs_alpha_nav(\n params[:chosen_letter]\n )\n else\n per_page = 50\n @sort = sort_column\n @direction = sort_direction\n if @sort =...
[ { "docid": "f56989d641ce9314eb796581600bfd63", "score": "0.81220657", "text": "def sort_column\n if !params[:sort]\n \"i_follow_nbr\"\n elsif params[:sort] == 'tag'\n \"LOWER(t.name)\"\n else\n params[:sort]\n end\n end", "title": "" }, { "docid": "2bc1a300c6f4b81...
ca89a93e3115755d186584b67fc06052
If we get an Unauthorized error, we assume the token expired, reauth and try again
[ { "docid": "e3fe79147ed441fa57c0f1f69593edee", "score": "0.0", "text": "def request(params)\n unless @cookie\n do_logon\n end\n begin\n do_request(params)\n rescue Fog::Compute::CenturyLink::AuthenticationFailed\n do_logon\n ...
[ { "docid": "86ec321a503c5bbf7c3853ac93bbd7ed", "score": "0.78946483", "text": "def perform_oauth_token_expired!\n if tries == 1 && refresh_session_access_token!\n perform!\n else\n raise oauth_token_expired_error\n end\n end", "title": "" }, { "doc...
91e12d4e1426ab6341303613638c919b
The specific quarter this week falls in
[ { "docid": "07344a328f05bc581bf4aa41a8e774a8", "score": "0.73033047", "text": "def quarter\n case merch_month\n when 7,8,9\n return 1\n when 10,11,12\n return 2\n when 1,2,3\n return 3\n else\n return 4\n end\n end", "title": "" } ]
[ { "docid": "85055ec2b82ebf2f0506014bd2e13646", "score": "0.7587076", "text": "def current_quarter\n \n case self.month\n \n when 1..3 then 1\n when 4..6 then 2\n when 7..9 then 3\n else 4\n end\n \n end", "title": "" }, { "docid": "8773ecbd44...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bceac24d7e022e53c3ea3bc7a6c3d7dc", "score": "0.0", "text": "def game_params\n params.require(:game).permit(:game_title)\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...
4054a3dcb4c47672ebd9623e333b369c
Lookup objects in hash.
[ { "docid": "a108d551cd7d8d9fa42c9788a76a9451", "score": "0.0", "text": "def lookup(one_object, other_object)\n if ELUCIDATABLE_CLASSES.include?(one_object.class)\n if other_object.kind_of?(one_object.class)\n return METHOD_FOR_CLASS.fetch(one_object.class)\n end\n end\n ...
[ { "docid": "6331dea1859030127764463dc417fca7", "score": "0.6625857", "text": "def find_by(hash)\n # firebase does not have complex querying\n # so we have to grab all objects satisfying\n # first key/value\n init_key, init_value = hash.shift\n firebase_response = firebase_reques...
a0f08241aefcd9342c73a5fb0cdb0c2f
Get class abutton issuccess isfullwidth
[ { "docid": "9530f12a38a90eefd900b8046ea64157", "score": "0.0", "text": "def request (url, tiktokURL)\n uri = URI.parse(url)\n\n # Shortcut\n response = Net::HTTP.post_form(uri, {\"url\" => tiktokURL, \"per_page\" => \"50\"})\n\n return response.body\n\nend", "title": "" } ]
[ { "docid": "38bcac6ee9db0fb96d16a6c537b0765b", "score": "0.59878755", "text": "def button_by_class(button_class)\n #if @browser.button(:class, cuke_class(button_class)).exist?\n # puts @browser.button(:class, cuke_class(button_class)).exist?\n # puts @browser.button(:class, button_class).exist?\n re...
f09dfec882ec4d240998fdd1ca082952
will render 401 if users creds dont authenticate
[ { "docid": "5c46c6e03bf87b957628a0bcd67da42d", "score": "0.0", "text": "def create \n user = User.authenticate(params[:user][:email], params[:user][:password])\n if user\n session[:user_id] = user.id\n render :json => user.as_json(:current_user => user)\n else\n render :json =...
[ { "docid": "338dc1131407ea6ffd309804ad2ae181", "score": "0.8245373", "text": "def unauthorised\n render_error 401, :unauthorized\n end", "title": "" }, { "docid": "b596570b888d654b35160b2a8c5e0341", "score": "0.81418604", "text": "def render_unauthorized\n render json: {errors...
a8220a42209ec24fc230e4b012c1c633
Handle params: appraisal company form
[ { "docid": "36b84f654857bf65b8d6ddf829359bfd", "score": "0.0", "text": "def save\n if params[:ac].has_key? :id\n begin\n ac = AppraisalCompany.find params[:ac][:id]\n rescue\n return render json: { status: 1 }\n end\n else\n ac = AppraisalCompany.new\n end\n\n ...
[ { "docid": "4bde5edf64926b0a1e5a3d79129cd824", "score": "0.7178176", "text": "def company_params\n params[:company].permit(:name, :description, :url, :contact_id, :address, :joined, :logo)\n end", "title": "" }, { "docid": "b6d999aaa92b9f498039fffdf53f00a9", "score": "0.7174688",...
693a1f10ed4182f342e4ec89d99e0078
Call this after evaluation. Returns a newlyevolved population.
[ { "docid": "bb37341a5a2d41f2cf7c7b86033d76b8", "score": "0.5536258", "text": "def evolve\n @controller.evolver.evolve self\n end", "title": "" } ]
[ { "docid": "06ac6789ca7e857d55696f5e266a77bf", "score": "0.7048242", "text": "def evolve\n @population = selection(@population)\n new_gen = @population.map { |chromosome| chromosome.dup }\n @population += recombination(new_gen) + mutation(new_gen)\n end", "title": "" }, { "docid": ...
236d9f37e5a9a89427cd89e5e01a88ca
Show subsubcategory of a product
[ { "docid": "a852ce2a7625d7d4b836d14a009dd901", "score": "0.6893968", "text": "def show_sub_category\n @product_category = Category.find(:all, :conditions=>[\"category_name=?\", params[:cat_value]])\n respond_to do |format|\n format.js\n end\n end", "title": "" } ]
[ { "docid": "08020f2be989ba824572c2f5f238997b", "score": "0.77299696", "text": "def show_subsubcategories\n\t\t@subsubcategories = ProductSubsubcategory.where(:product_subcategory_id => params[:id].to_i).order('name ASC')\n\t\t@subcateory = ProductSubcategory.find(params[:id].to_i)\n\t\t@category = Produ...
1b0af81a1bf2126d6acf98276e8a7233
Fetch an entry. retStr = restFetchData('uniprot:wap_rat', 'default', 'default')
[ { "docid": "6ea04c95dbdeb835dec98ea3ba5e6197", "score": "0.0", "text": "def restFetchData(query, formatName='default', styleName='default')\n printDebugMessage('restFetchData', 'Begin', 1)\n partList = query.split(':')\n retVal = restFetchBatch(partList[0], partList[1], formatName, styleName)\n...
[ { "docid": "e85b4207d56d291b1cb75346ac806c05", "score": "0.55202293", "text": "def retrieval\n shipping_manifest = shipping_manifest = {\"whale bone corsets\" => 5,\"porcelain vases\" => 2,\"oil paintings\" => 3}\n return shipping_manifest[\"oil paintings\"]\nend", "title": "" }, { "docid"...
c050839e26c108c991d74b16c98382dc
DELETE /projects/1 DELETE /projects/1.json
[ { "docid": "aefbafae6d2dbcadb00be1af8dac3eaf", "score": "0.7611191", "text": "def destroy\n @project = current_user.projects.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "ce10449f9ce0fd62fdc6ce11492b8372", "score": "0.7899063", "text": "def destroy\n @root = \"projects\"\n \n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\...
753a6c4ad646648313f93ff9777f544d
GET /orders/1 GET /orders/1.json
[ { "docid": "15cbc5c72f6b68df88373c69af86e182", "score": "0.0", "text": "def show\n @cart = current_cart\n @user = current_user\n\n end", "title": "" } ]
[ { "docid": "23052f52af86f70778b67e0afeeea3d4", "score": "0.7554187", "text": "def getorders(args={})\n {\n :method=> \"GetOrders\"\n }.to_json\n end", "title": "" }, { "docid": "45d40d4eb7c605b195ee60f1fcb2b6ab", "score": "0.7488565", "text": "def index\n @orde...
15e0b68ec5e506d35cfb96d0c0f565c0
adds the contents of an_a to this array, removing duplicates (inline version of merge)
[ { "docid": "5c572cce34c70016eec81e3590871dfb", "score": "0.7324111", "text": "def merge!(an_a)\n self.class.merge(self, an_a)\n end", "title": "" } ]
[ { "docid": "ca130d4507c0dfd42167275caccf3503", "score": "0.74974537", "text": "def merge(an_a)\n self.class.merge(self.dup, an_a)\n end", "title": "" }, { "docid": "386157a95491ee10b24800df341d0e64", "score": "0.67649406", "text": "def merge_array(a1,a2)\r\n\tarray = a1 + a2\r\n\...
54f532dde6dfc9472041ff15de74d4ba
Impala only support IS NULL, not IS TRUE or IS FALSE.
[ { "docid": "fce0862745a160ee51ad90c93a8211e1", "score": "0.0", "text": "def supports_is_true?\n false\n end", "title": "" } ]
[ { "docid": "48246b863670b1e5f1dc9b1f5aa9225f", "score": "0.6850938", "text": "def null?\n Mao::Filter::Binary.new(:op => 'IS', :lhs => self, :rhs => nil)\n end", "title": "" }, { "docid": "64b4e2cc6fd6ff37ba2dfa2c7f21af87", "score": "0.67839336", "text": "def not_null; end", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "85b8c7ebd9a9860602a6a3ee236a9b1a", "score": "0.0", "text": "def cargapp_integration_params\n params.require(:cargapp_integration).permit(:name, :description, :provider, :code, :url, :url_provider, :url_production, :url_develop, :email, :username, :password, :phone, :pin, :token, :app_id, ...
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981269", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6783559", "text": "def strong_params\n params.requi...
1465962ec2c3fe4917e15510e1ab798b
Writes out the configuration to a given output stream.
[ { "docid": "0f501319c43987a48956998f857c1a41", "score": "0.70826334", "text": "def write(conf, output_stream=STDOUT)\n raise ArgumentError, 'configuration not a hash' unless conf.is_a? Hash\n\n begin\n output_stream.write(JSON.pretty_generate(conf))\n Dumon::logger.debug \"Config...
[ { "docid": "1b108915fc65f5d6310254e31964b81d", "score": "0.65162", "text": "def write\n require 'yaml'\n open config_file_name, 'w' do |io|\n io.write to_yaml\n end\n end", "title": "" }, { "docid": "6fe3638fb6583c23b89a7f6291305a50", "score": "0.6462097", "t...
8cae99013f13155bb0484d0ad7356f5a
get the potential target paths
[ { "docid": "57e59072a39edfe191d87808cc3af220", "score": "0.0", "text": "def get_potential_resolutions filename\n\t\t\tpaths = Yay::Paths.new\n\t\t\tdirs = paths.yay_paths\n\t\t\t\n\t\t\tresult = []\n\t\t\tdirs.each { |path| \n\t\t\t\tresult.push(\"#{path}/#{filename}.yay\")\n\t\t\t}\n\n\t\t\treturn res...
[ { "docid": "aafec31b51c47664e529e4a3929222a0", "score": "0.71988267", "text": "def get_target_paths source_path\n relative_path = source_path[@source_directory.length, source_path.length-1]\n relative_path = relative_path.chomp(File.extname(relative_path)) + \"*\"\n Dir[@target_directory ...
5b6c215426f7cfb21342ebeaf75ffd4b
move the ball every 10 miliseconds
[ { "docid": "ef11bb33a825e0132d0b7b98211d3901", "score": "0.63728726", "text": "def timer(canvas,data)\n moveBall(canvas,data)\n Tk.after 10, proc{timer(canvas,data)}\nend", "title": "" } ]
[ { "docid": "5f0263a9415ee873b58e71d77d8f7b34", "score": "0.70513314", "text": "def move\n #Apply decrease in speed due to friction \n @x_speed -= SLOWDOWN * STEP * @x_speed\n @y_speed -= SLOWDOWN * STEP * @y_speed\n\n #move the ball into its new postion\n @x_pos += @x_speed * STEP \n ...
9b67721a2e45fa7a6cb48d30714d4634
Use callbacks to share common setup or constraints between actions. retreives the member by requested parameter IF it is owned by the current Grad AND it exists
[ { "docid": "3857a26d0c8653139edf91ebc985156b", "score": "0.0", "text": "def set_member\n pid = params[:id]\n if Member.exists?(pid)\n @member = Member.find_by_id(pid)\n if current_role(Member)\n if @member.id != current_user.role_id || !@member\n redirect_to l...
[ { "docid": "2a9810ab0832605d37cb576f3f4020a6", "score": "0.58878875", "text": "def member\n self.group_loan_membership.member \n end", "title": "" }, { "docid": "c83ef4525e1fdfbe77276d030a435834", "score": "0.5807914", "text": "def find_member\n @member = Member.find params[:m...
3067ec92dac5fc103dfe17e164c3aaa6
returns hello name, returns buddy if no name
[ { "docid": "6639d4d2901627d0b7f3bd68ff5b47e4", "score": "0.0", "text": "def hello(name=\"buddy\")\n puts \"Hey #{name}!!\"\nend", "title": "" } ]
[ { "docid": "94918d63b147541f0803f0bcd3156de4", "score": "0.7412608", "text": "def hello(name)\n\tif name == \"John\"\n\t\t\"Hello #{name}!\"\n\telsif name == \"Kevin\"\n\t\t\"Hey there #{name}!\"\n\telse\n\t\t\"I don't know you!\"\n\tend\nend", "title": "" }, { "docid": "c3012e19f8ee760a34f9...
b6ad3d00ab18a50cf64bf3c44d78bd27
POST /users POST /users.json
[ { "docid": "33e09670273ab7fe7b55fa6ad6d87a5e", "score": "0.0", "text": "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n session[:current_user_id] = @user.id\n current_user\n flash[:notice] = \"Your account, #{@user.username}, was ...
[ { "docid": "4794c3e6e2db462f4d8769453efddedd", "score": "0.77179813", "text": "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "title": "" }, { "docid": "a3973850c21e121410e2101...
ca97d62c4aa4fc0ab9ec221fed847f1e
DELETE /bwimages/1 DELETE /bwimages/1.json
[ { "docid": "3dd3ed8ecb9b13cc9496ec074b8bff5b", "score": "0.7743777", "text": "def destroy\n @bwimage = Bwimage.find(params[:id])\n @bwimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bwimages_url }\n format.json { head :no_content }\n end\n end", "title": "...
[ { "docid": "b7d5eb1a724375152577a8c7a7fc793e", "score": "0.72465926", "text": "def destroy\n @bgimage = Bgimage.find(params[:id])\n @bgimage.destroy\n\n respond_to do |format|\n format.html { redirect_to bgimages_url }\n format.json { head :no_content }\n end\n end", "title": ...
7f8dbc12fc44f46e7700414b4817a04c
product updation and handling failure
[ { "docid": "15b2e100e1dd67f4aa2c7aea1ace8217", "score": "0.6582546", "text": "def update\n if @product.update(product_params)\n redirect_to admin_products_path\n flash[:success] = \"Woohoo! product updated successfully.\"\n else\n render 'edit'\n flash[:error] = \"Oops! Somethi...
[ { "docid": "8e432894ea961ee8e852a4786d78a768", "score": "0.73491806", "text": "def update\n @product.update_attributes!(product_params)\n render_success_format('Entrada actualizada',@product,true)\n rescue Exception => e\n render_default_error e, 401\n\n end", "title": "" }, ...
594a922011a59b75eb3a8909a94110cc
GET /send_bulk_messages GET /send_bulk_messages.json
[ { "docid": "2267316c6cf47a195e9429c2a054096c", "score": "0.7752607", "text": "def index\n @send_bulk_messages = SendBulkMessage.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @send_bulk_messages }\n end\n end", "title": "" } ]
[ { "docid": "1141f4fe5d503a52fffe7ad4bf66f654", "score": "0.7110912", "text": "def send_messages(options)\n data = @api.do_request(\"POST\", get_base_api_path() + \"/messages/send_batch\", options)\n return data\n end", "title": "" }, { "docid": "1141f4fe5d503a52fffe7ad4bf66f...
460679ca8b40cb79758ad922cd6a4afb
Returns a job to process, if any is available
[ { "docid": "1e7409dbf4e3b8f96915072a62eb9d82", "score": "0.7297208", "text": "def request_job_to_process\n \n response = HTTParty.get(\"#{@host}/api/process/request_job/#{@process_code}.json\", query: {\n api_key: @api_key\n })\n\n job = response[\"job\"]\n #If there is no job ...
[ { "docid": "e57df806ea0227bf4fa78881f6c9f773", "score": "0.7589804", "text": "def get_job\n begin\n s, sproc, clazz = selector\n # Take the job from TS using the job selector\n job = take s, 0, false\n\n # Remove job from envelope\n sproc_meth = sproc.respond_to?(:process) ? ...
57d87b86a147ccf11b31a0b902832ff7
LIB template for resource
[ { "docid": "522c3a723685cb65109ccd9d305b565e", "score": "0.0", "text": "def base_namespace_file\n <<-FILE.strip_heredoc\n # frozen_string_literal: true\n\n module #{@naming.klass_name}\n VERSION = '0.1.0'\n end\n FILE\n end", "title": "" } ]
[ { "docid": "363d7c011b4d0cf743103a07fb695aad", "score": "0.715443", "text": "def resource; end", "title": "" }, { "docid": "368f76df0db2a836ccb2aa0c3fab315b", "score": "0.6843928", "text": "def resource(opts = {})\n @raw.resource(opts)\n end", "title": "" }, {...
86900ce5ea2fc1a3bb3fb6047bb426f6
returns module refs array or raises error
[ { "docid": "0940148d98ea70e4e63eee1c9b3ecfa3", "score": "0.6733965", "text": "def get_children_module_refs\n @cache.lookup_dependencies?(@module_ref) || get_children_module_refs_aux\n end", "title": "" } ]
[ { "docid": "127c9b43ac1b9f10ade082dc21fa6419", "score": "0.6800419", "text": "def get_unref_symbols\n unref = []\n @modules.each do |mod|\n mod.symbols.values.each do |s|\n unless s.referenced?\n unref << s.name\n end\n end\n end\n unref\n end", "title":...
06a17dc537dccae91e915392f4bfe7a7
PATCH/PUT /billing_data/1 PATCH/PUT /billing_data/1.json
[ { "docid": "3bcc259d4c30484661ade3d89b3a4750", "score": "0.63485944", "text": "def update\n respond_to do |format|\n if @billing_datum.update(billing_datum_params)\n format.html { redirect_to @billing_datum, notice: 'Billing datum was successfully updated.' }\n format.json { render...
[ { "docid": "2cd83e0fbf66ca3a2da3c855f234c05f", "score": "0.6824921", "text": "def update\n respond_to do |format|\n if @billing.update(billing_params)\n format.html { redirect_to @billing, notice: 'Billing was successfully updated.' }\n format.json { render :show, status: :ok, loca...
e2aad330fcbc52302edc86c67b3a36d3
Opens a json document in vortex. Example: with_json_doc(path) do |dav_item, json_data| puts json_data["resourcetype"] dav_item.content = dav_item.content.sub('Oxford','UiO') end
[ { "docid": "0f9c4ede7b6696f34aa3ffcc48dadf08", "score": "0.65732133", "text": "def with_json_doc(url)\n vortex = Vortex::Connection.new(url,:use_osx_keychain => true)\n if(not(vortex.exists?(url)))then\n puts \"Warning: Can't find \" + url\n return -1\n end\n vortex.find(url) do |item|\n be...
[ { "docid": "5dd7bb8f15c542510bcd20c4e1c98705", "score": "0.5610668", "text": "def create_doc_from_json(id, fq_filename)\n json_doc = JSON.parse(File.read(fq_filename))\n json_doc[\"_id\"] = id\n json_doc[:content_hash] = generateCheckSum(json_doc.to_s)\n json_doc[:updated] = Time.now.to_date...
b3b89bfc09d890c50db0c26399aadb3b
GET /resource/edit def edit super end PUT /resource
[ { "docid": "84993c7d6d025412525a93df881f89b0", "score": "0.0", "text": "def update\n params = devise_parameter_sanitizer.sanitize(:account_update)\n\n @user = User.find(current_user.id)\n if need_password?\n successfully_updated = @user.update_with_password(params)\n else\n params....
[ { "docid": "da8f9ab6f67466b608158cce61743bd8", "score": "0.82021475", "text": "def edit\r\n @r = Resource.find(params[:id])\r\n end", "title": "" }, { "docid": "3ee6901d0c71c8ab825d9c59699a4d8e", "score": "0.819061", "text": "def edit\n\tputs \"edit\"\n @resource = Resource.fi...
573733d1fc49220f13dc90b39b858af4
Android only. Get the name of the active IME engine.
[ { "docid": "cfafc2a1e0a3de59cfa8410c79893b6a", "score": "0.7204082", "text": "def ime_active_engine\n @bridge.ime_active_engine\n end", "title": "" } ]
[ { "docid": "6ee7ec8a20d51dd9c91ebc8660642ae2", "score": "0.7398855", "text": "def ime_active_engine\n ime.active_engine\n end", "title": "" }, { "docid": "db0015ffc38013c7a5536df4ab492218", "score": "0.6569442", "text": "def engine_name\n data[:engine_name]\n ...
d67b622303025c738e3baa172c7a5347
GET /variants/1 GET /variants/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "d432a2862f4d09d6fbb0f3f40e01e084", "score": "0.7698987", "text": "def index\n @variants = Variant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @variants }\n end\n end", "title": "" }, { "docid": "34b2ee5c83e7565ea2...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "779535e7f95b2d12b3241ee25859c6e2", "score": "0.0", "text": "def set_source_string\n @source_string = SourceString.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...
62e481c04c0f2333e666ede17fcff3ba
Format the title of a custom section
[ { "docid": "273dd92076122457e775f0dcd0f774bf", "score": "0.7595", "text": "def section(title)\n bold \"\\n#{title}\"\n end", "title": "" } ]
[ { "docid": "ad242515a0e0e90e8372107ac309cfe4", "score": "0.82643986", "text": "def section_title(title)\n self.separator \n puts title.colorize(:green) + \"\\n\\n\"\n end", "title": "" }, { "docid": "35cfbb39c9ad7c5f9e7a5f3be5071577", "score": "0.7437167", "text": "def section...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8e0d972c59a7ab1b6309e6dec3117a0d", "score": "0.0", "text": "def set_db_repl_type\n @db_repl_type = DbReplType.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60328794", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6017492", "text": "de...
91976820ad31fc316a0ffc06bd0e31f5
scrapes the most recent 50 listings
[ { "docid": "11c069723c47d089cf60a0f71f8d4851", "score": "0.5871911", "text": "def scrape_recent_jobs\n scrape_data_from_url(@base_url)\n end", "title": "" } ]
[ { "docid": "8366d28021f45a080f8191cf3254b362", "score": "0.69720465", "text": "def recent_Listings #for homepage\n UserBook.all(limit: 5)\n end", "title": "" }, { "docid": "a2adfb8ff0ac37a15170feade2c275f8", "score": "0.6885015", "text": "def getListings(count)\n rcount ...
4bec79283b54934eec70ff708adb2f63
returns the fiscal year epoch the first allowable fiscal year for the application
[ { "docid": "8512a0766ee0258394af17ceabb10a5c", "score": "0.8647087", "text": "def fiscal_year_epoch_year\n fiscal_year_year_on_date(SystemConfig.instance.epoch)\n end", "title": "" } ]
[ { "docid": "edbeaf459565dca599918cb08a39d19b", "score": "0.77542317", "text": "def last_fiscal_year_year\n current_fiscal_year_year + SystemConfig.instance.num_forecasting_years\n end", "title": "" }, { "docid": "c5485c124fce868f3a8375e6dc91aa0f", "score": "0.7658026", "text": "d...
e0708ef619f1a0fe549ea847d9f7353b
Beans are defined as follows: name: a jmx find string, such as java.lang:type=Memory it may also include wildcards such as java.lang:type=MemoryPool,name= in this usage, it will process the path for each item found path: an array of elements to walk down the jmx tree. if an element is an array, the elements within that...
[ { "docid": "19953309b647ef25116dbbfeeb88600d", "score": "0.5927026", "text": "def initialize(bean)\n @name=bean[\"name\"]\n @path=bean[\"path\"]\n @results = {}\n begin\n @state = JMX::MBean.find_all_by_name @name\n rescue Exception => e\n end\n end", "title":...
[ { "docid": "a090304e3404d8acf732ddf87e6b58da", "score": "0.4669873", "text": "def [] name\n name = name.to_s\n node = @node.find(nil, name) rescue nil\n return nil unless node\n begin\n type = _typemap()[name]\n rescue\n raise \"Property #{name} of #{self.class} ha...
64f430e09d2f83b35fe408bfa4305fe9
Deserializes a value of this type as returned by the server.
[ { "docid": "11b3b62d7ddc0a1a4dfd24fa8dd403df", "score": "0.0", "text": "def deserialize(bytes)\n return nil if bytes.nil?\n deserializer.call(bytes)\n end", "title": "" } ]
[ { "docid": "118f3949a4f1c1e8e15c591924a8b6a9", "score": "0.82730633", "text": "def deserialize(value)\n cast(value)\n end", "title": "" }, { "docid": "6c72d7a49830a02cd8df411fc5290e68", "score": "0.7819937", "text": "def deserialize(value); end", "title": "" }, { ...
037e450b4d48f75749d20abe2d90b3fa
cleaner solution using basic array and string functions
[ { "docid": "a927442ae4a9c2c29047a254664bcb2a", "score": "0.0", "text": "def Fizz2\r\n\t\t(1..100).each do |x|\r\n\t\t\tstr = [(\"Fizz\" if x % 3 == 0),(\"Buzz\" if x % 5 == 0)].compact.join\r\n\t\t\tif str == \"\" then str << x.to_s end\r\n\t\t\tputs str\t\t\r\n\t\tend\r\n\tend", "title": "" } ]
[ { "docid": "eeef17da5813f86f4fcf8625c650e59f", "score": "0.6502763", "text": "def return_string_array(array)\n count = 0\n # create new array to store converted elements\n new_array = []\n # iterate over a provided array\n while count < array.length do\n # add each converted element to the end o...
843fa1db967171bd3520ef1e3ed48c45
Returns the maximum result
[ { "docid": "88fefb75146e01c0a09ee4ae5e2a8088", "score": "0.77112234", "text": "def max_result\n x = attributes.size\n sort_by { |result| result[x] }.last[x]\n end", "title": "" } ]
[ { "docid": "89092bf829572274bbf07679bc9dadec", "score": "0.8021928", "text": "def max()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "a103989d00ccb90a682e35a9dc70a87b", "score": "0.8013019", "text": "def max()\n @max\n end", "title": ""...
b8737c8429d80b89e4359c3460a323c3
Public: Turn the piezo off. Returns nothing.
[ { "docid": "2b7e1b7098a6cb51237a9592b9a533d7", "score": "0.61958396", "text": "def off\n @is_on = false\n @pin.analog_write(0)\n end", "title": "" } ]
[ { "docid": "3efa246ed55c3d7527c5d82b56eb480a", "score": "0.69996804", "text": "def off\n set_power(\"off\", \"smooth\",1000)\n end", "title": "" }, { "docid": "b8d44e581429918a95d9e83ed1fc58c8", "score": "0.6718495", "text": "def turn_off\n set_power(:off)\n end",...
c0b9377aa1c9ca745bd453ad49d91136
GET /interventions/1 GET /interventions/1.json
[ { "docid": "64afe09c133b9460353c4183891be80a", "score": "0.0", "text": "def show\n @page = Page.new\n end", "title": "" } ]
[ { "docid": "b234784c4191f9b2ac571d4c9197e48e", "score": "0.70164526", "text": "def show\n @intervention = Intervention.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @intervention }\n end\n end", "title": "" }, { "d...
a462ccc57356a283c4ec96dc785a0bcd
Returns whether the given PropertyDescriptor pd corresponds to a transient field in this class, or nil if there is no such field.
[ { "docid": "9a656558a55273d6dadec8e88d4d9196", "score": "0.82484126", "text": "def transient?(pd)\n begin\n field = java_class.declared_field(pd.name)\n rescue Exception\n # should occur only if a property is not a field; not an error\n return\n end\n Java::JavaLangReflect::Mo...
[ { "docid": "b845de63632ce84089805f9d3f0a7a4b", "score": "0.5986083", "text": "def transient?\n @transient\n end", "title": "" }, { "docid": "59eede5a72889fbd91bfdb1fdbe62fd9", "score": "0.5899811", "text": "def transient?(_level = nil)\n return false if info.nil?\n info...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "e05fa5f54e8b8af79c27c60932b58c92", "score": "0.0", "text": "def reviewer_params\n params.require(:reviewer).permit(:name, :location)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496205", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957069", "text": "def strong_params\n params.require(:request).permit(param_white...
4302d8fa3d951b90e08f79a73fd25054
Comment on a given video
[ { "docid": "2d7f578ff287ed8688487cdc01826728", "score": "0.77194303", "text": "def comment (video, str, user)\r\n self.connect(user) unless user.token?\r\n uri = URI(HOST + 'feeds/api/videos/' + video.id.to_s + '/comments')\r\n post = Net::HTTP::Post.new uri.path\r\n post.content_typ...
[ { "docid": "01fa7591defc7c30e6787023f5774d9a", "score": "0.727657", "text": "def show\n #2nd you retrieve the comment thanks to params[:id]\n @video = Video.find(params[:id])\n end", "title": "" }, { "docid": "f403638245fabd249eeb72269eff9c76", "score": "0.7218685", "text": "d...
84e9a0f48e14cd755e8fbe658abe88f3
Faker::Lorem.word generates random word from standard wordlist
[ { "docid": "7a3afb4dd42250099ff90e10ae4ea879", "score": "0.6753845", "text": "def test_word\n @standard_wordlist = I18n.translate('faker.lorem.words')\n\n 100.times { assert_includes @standard_wordlist, @tester.word }\n end", "title": "" } ]
[ { "docid": "aea9678605df6299a39cc0a9609ebc81", "score": "0.7715688", "text": "def words(number = 3)\n Faker::Lorem.words(number).join(' ')\n end", "title": "" }, { "docid": "83a00c830b6f6562879621e742f2f93c", "score": "0.76609224", "text": "def words(number = 3)\n Faker:...
cb2cf2b93aced23fcefc3a0ee0b45e53
Indicate whether the user can recommend an item for purchase.
[ { "docid": "217fc3c3db8a1ce8bef7f235ac7a1a03", "score": "0.63130325", "text": "def can_request_purchase?\n true # TODO: Should this be !virginia_borrower? ?\n end", "title": "" } ]
[ { "docid": "e65d7a7672ddeb7483a2b90382616dc0", "score": "0.7157503", "text": "def can_buy?(item)\r\n item.buyable_by?(self)\r\n end", "title": "" }, { "docid": "eb73746ca54e2556c4dcaf21b3accf5f", "score": "0.7148289", "text": "def recommendable?() false end", "title": "" ...
7735bbcf914dac6dc4ebe97ffadc5cc7
POST /distbutors POST /distbutors.json
[ { "docid": "bcb0a96605ef11c3221d97d7d8a2b372", "score": "0.5391399", "text": "def create\n permision_ok = true\n distbutor_save = false\n @distbutor = Distbutor.new(distbutor_params)\n unless params[:distbutor][:primary_dist_id].nil?\n params[:distbutor][:included_cities].each do |city_...
[ { "docid": "c319c463a212c0eb6bc6f409cb1269f9", "score": "0.61072874", "text": "def create\n @distraction = Distraction.new(params[:distraction])\n\n respond_to do |format|\n if @distraction.save\n format.html { redirect_to @distraction, notice: 'Distraction was successfully created.' }...
94f1bd7dfc792b6291c8572ebf3711e2
PUT /when_customs/1 PUT /when_customs/1.xml
[ { "docid": "20b32d87fb13ad87eb366ac9927700bf", "score": "0.6847393", "text": "def update\n @when_custom = WhenCustom.find(params[:id])\n\n respond_to do |format|\n if @when_custom.update_attributes(params[:when_custom])\n format.html { redirect_to(@when_custom, :notice => 'WhenCustom w...
[ { "docid": "d97aa146e297bf37931b504af91b246b", "score": "0.59091234", "text": "def update\n @custom_event = CustomEvent.find(params[:id])\n\n respond_to do |format|\n if @custom_event.update_attributes(params[:custom_event])\n format.html { redirect_to(@custom_event, :notice => 'Custom...
1304bd6dee3dfe69de92a9cd212f7919
Methods to convert absolute URLs in links into relative URLs. This is necessary because the URLs in emails sent during testing have host: localhost and port: 3000, but port 3000 in localhost is not really made available by Capybara. We need to use a relative URL when trying to access these URLs during testing. Given a ...
[ { "docid": "9c38907df05f35252ac5782a3bf4aaca", "score": "0.6805437", "text": "def get_confirm_address_link_from_email(email_link)\n uri = URI email_link\n confirm_uri = URI confirmation_path\n confirm_uri.query = uri.query\n confirm_link = confirm_uri.to_s\n return confirm_link\nend", "title": ...
[ { "docid": "b86eece44f07ef3758f71470795881f0", "score": "0.6428945", "text": "def fix_link_relative_path(link, domain_uri)\n fixed = URI.parse(link)\n return link if fixed.host && fixed.scheme\n\n original_domain = URI.parse(domain_uri)\n fixed.host = original_domain.host unless fixed.host\n...
eec9e0d256bd6b7523115228153747e1
Currently unused, this was an experiment in how to get the width of a successful tb.render.
[ { "docid": "26cc7eeab5c2b1a2561992589497cc71", "score": "0.0", "text": "def accumulated_width\n # puts \"In PrawnPDFFormattedWrap.accumulated_width, value is #{@line_wrap.accumulated_width}\"\n @line_wrap.accumulated_width\n end", "title": "" } ]
[ { "docid": "8342563c5f84b78808a7dc47865b9921", "score": "0.6987743", "text": "def width\n unless self.display_length.nil?\n self.display_length\n else\n if self.text.length > 23\n 3\n elsif self.text.length > 10\n 2\n else\n 1\n end\n end\n end", ...
00f8a4c3998d35d4972cadcac12bbae3
Method to return exponify
[ { "docid": "d4a6cecb8f72bacfbcf638804293067b", "score": "0.5204379", "text": "def exponify a, b\n return \"a ^ b = #{display_exponify a, b}#{a**b}\"\nend", "title": "" } ]
[ { "docid": "e1f022fc12a904e9a5119db430343d54", "score": "0.6375202", "text": "def to_s\n return @exp\n end", "title": "" }, { "docid": "3a31747752211bdf32ad571f3be8e2f1", "score": "0.6249908", "text": "def exp_text\n @exp.to_s\n end", "title": "" }, { "docid":...
825ccec54f3dcbc9dbca2484f4ad6f8c
creates pad and sets repaint_all so populate happens FIXME earlier used to create and populate, but now i have decoupled populate since that was forcing create to happen.
[ { "docid": "e6c622a46c04f3a9c4347bab122ff645", "score": "0.74653804", "text": "def populate_pad\n @_populate_needed = false\n\n create_pad\n\n # clearstring is the string required to clear the pad to background color\n @clearstring = nil\n $log.debug \" populate pad color = #{@...
[ { "docid": "1c4dd432b080142e97997a3a0503f590", "score": "0.67523223", "text": "def populate_pad\n @_populate_needed = false\n # how can we make this more sensible ? FIXME\n @renderer ||= DefaultRubyRenderer.new if \".rb\" == @filetype\n @content_rows = @content.count\n @content_...
fb1bb47d10b1b2494c909c3d1ef2af78
Returns a logger like interface to log errors and warnings to.
[ { "docid": "dc141122cc43edc8ce291b964574a481", "score": "0.0", "text": "def log\n return @logger if @logger\n @logger = Logger.new(LogFile)\n @logger.level = Logger::INFO\n @logger\n end", "title": "" } ]
[ { "docid": "b2c923ba3d26331cae88116a1b67451e", "score": "0.6861398", "text": "def logger\n raise NotImplementedError\n end", "title": "" }, { "docid": "2527d08d953a5d4bf968d5bb078adb97", "score": "0.6726743", "text": "def logger\n return @logger if @logger\n\n s...
040bb104526f80a82ea202464171415f
will simplify the type passed if it a numeric type, otherwise returns the type passed will first check against integer, if it is not it checks numeric. Returns first matched type
[ { "docid": "be522ef7d90b756204fbc0ad64843aa2", "score": "0.7727501", "text": "def simplify_numerics(type)\n # begin\n # return \"Integer\" if Object.const_get(type) <= Integer\n # return \"Numeric\" if Object.const_get(type) <= Numeric\n # return type\n # rescue TypeError,ArgumentError...
[ { "docid": "c1c0e2572ae79f5a9bb174ac202ac4dd", "score": "0.6083222", "text": "def simplified_type(field_type)\n case field_type\n # Numeric and monetary types\n when /^(?:real|double precision)$/\n :float\n # Monetary types\n when /^money...
531d6b89386fc504b7186fadc4df9e01
added by RMC on June 13, 2011
[ { "docid": "7ac8e101f6402aa1e371e555527ac0f9", "score": "0.0", "text": "def display_question_text question_id, question_text\n display = question_text\n @WebInsertion = QuestionInsert.find(:all, :conditions => ['question_id = ?', question_id], :order => 'insert_number')\n if @WebIns...
[ { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6263589", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6263589", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "dd3d99063432234d2150f054be35e77d", "score": "0.0", "text": "def set_store\n @store = Store.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60320485", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6013371", "text": "de...
fd69ecacac27bae42cfdf368ea24736b
Exceptionraising version of `authenticate`. Raise if not authenticated.
[ { "docid": "5fcd71d4e0e21e7874441d51fd99d91d", "score": "0.0", "text": "def authenticate!\n raise Zilch::Authorisation::NotAuthorisedException unless adapter.authenticate!\n adapter.current_user\n end", "title": "" } ]
[ { "docid": "0640d6150011370d228164729f12238f", "score": "0.7718017", "text": "def authenticate(*args)\n authenticate!(*args)\n rescue\n nil\n end", "title": "" }, { "docid": "0640d6150011370d228164729f12238f", "score": "0.7718017", "text": "def authenticate(*a...
1eccb9f11785b4063a46ba1f9781fa2b
PUT /contact_groups/1 PUT /contact_groups/1.xml
[ { "docid": "970f7ef90746d803769c2391dc9fafac", "score": "0.7069712", "text": "def update\n @contact_group = ContactGroup.find(params[:id])\n\n respond_to do |format|\n if @contact_group.update_attributes(params[:contact_group])\n format.html { redirect_to(@contact_group, :notice => 'Co...
[ { "docid": "410e2336d9ccebf32a84602a5f47425f", "score": "0.6951636", "text": "def update\n \n \n @contact_group = ContactGroup.find(params[:id])\n contacts = params[:contacts]\n @contact_group.contact_lists.clear\n respond_to do |format|\n if @contact_group.update_attributes(param...
fbc883f1288501a417ee99085f3b93fb
Update game state from input
[ { "docid": "9c89f2f4b0e612b17b30af1c14b5734a", "score": "0.6805901", "text": "def update_game_state(action)\n case action\n when \"UP\"\n @game = rotate_clockwise(@game)\n merge_numbers\n push_numbers\n @game = rotate_counter_clockwise(@game)\n when \"DOWN\"\n @game = r...
[ { "docid": "10d6837fb88199a8b4f6cd8dbb19b4c5", "score": "0.7539301", "text": "def update\n case @state\n when MENU\n menu\n when GAME\n game_logic\n when SCORE\n score\n when SCOREBOARD\n scoreboard\n end\n end", "title": "" }, { "docid": "e7461193d765c...
d71ec1e2b205a56008eb351bc3529dd1
Returns a PathSet containing all libraries in this module (this subtree, plus any subtrees it's dependent upon) that should be included if the given variant_name is set equal to the given variant_value.
[ { "docid": "61206906ca09c9ce5afba5284b391956", "score": "0.8361424", "text": "def module_only_variant_libraries(variant_name, variant_value)\n out = PathSet.new\n out << subtree_only_variant_libraries(variant_name, variant_value)\n @internal_dependencies.each do |internal_dependency...
[ { "docid": "cb584af734c582d254d6931a51c44bc3", "score": "0.8342641", "text": "def full_variant_libraries(variant_name, variant_value)\n out = PathSet.new\n out << module_only_variant_libraries(variant_name, variant_value)\n dependent_subtrees do |the_subtree|\n out << the...
5ac8bc534b59e0d2a07f22b524258870
DELETE /wishlists/1 DELETE /wishlists/1.json
[ { "docid": "5194da928added89840a07297a41a43a", "score": "0.72616506", "text": "def destroy\n @wishlist.destroy\n respond_to do |format|\n format.html { redirect_to wishlists_url, notice: 'Záznam vo wishliste bol úspešne zmazaný.' }\n format.json { head :no_content }\n end\n end", ...
[ { "docid": "4d02c2afb51ac4b2eb081702b80aea11", "score": "0.7833978", "text": "def destroy\n @wish_list = WishList.find(params[:id])\n @wish_list.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_wish_lists_url) }\n format.xml { head :ok }\n end\n end", "tit...
5aba93bc385da9a273e0198bffbbe79d
numberical form of the fiven number
[ { "docid": "e675d0dc00fe176cc52354889db3b2be", "score": "0.0", "text": "def numerize word\n numberized_array = word.split('').map{|alpha| NUMBER[alpha.to_sym]}\n numberized_array.join(',').gsub(',', '')\n end", "title": "" } ]
[ { "docid": "e37d4f45904a91c41272e3dea88507f9", "score": "0.7089375", "text": "def f_number\n return @f_number\n end", "title": "" }, { "docid": "e6ecfc8466e4d5d0bd95d58cb6d67710", "score": "0.70877635", "text": "def fnd(n, number)\n\t\t\"%0#{n}d\" % number\n...
9a42e5f33c42f61a14d7f2ce4d24ea0f
DELETE /pack_items/1 DELETE /pack_items/1.xml
[ { "docid": "2813759801a33180a2d1fd052a5233c7", "score": "0.7459959", "text": "def destroy\n @pack_item = PackItem.find(params[:id])\n @pack_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(pack_items_url) }\n format.xml { head :ok }\n end\n end", "title": "...
[ { "docid": "80fd17e13e72300c2dbe99380d651497", "score": "0.72381145", "text": "def destroy\n @pack_item_subitem = PackItemSubitem.find(params[:id])\n @pack_item_subitem.destroy\n\n respond_to do |format|\n format.html { redirect_to(pack_item_subitems_url) }\n format.xml { head :ok }\...
5cedfbf380b4ddc994b12f8ba6bf8129
Action is called by the Graphing main panel method initFormComponent. Method returns a set of option values that are used to build the drop down boxes in the Graphing main panel. POST /rollcall/query_options
[ { "docid": "259e7af3703ed9b1334ee03bbea4faca", "score": "0.533099", "text": "def get_options\n default_options = get_default_options\n zipcodes = current_user.rollcall_zip_codes\n\n school_types = current_user\n .schools\n .select(\"rollcall_schools.school_type\")\n .where(\"roll...
[ { "docid": "82e05eeb64f26068f3e319dde51446c8", "score": "0.6347852", "text": "def set_options\n\n\t\tchoices = params[:choices_str].split(\"\")\n\t\tchoices.each_with_index do |choice, index|\n\t\t\tif not choice.in?([\"A\",\"B\",\"C\",\"D\"])\n\t\t\t\tchoices[index] = choice.to_i\n\t\t\telse\n\t\t\t\tc...
80a79da7b6083cf4738ce905b112e5a7
Methods for conditional serialization.
[ { "docid": "9a9836ec3e66731938dcb41379b723e9", "score": "0.0", "text": "def has_history?\n !object.history.nil?\n end", "title": "" } ]
[ { "docid": "19a2797f5ec2cbc6bde04faf10dba814", "score": "0.7652727", "text": "def serialized?; end", "title": "" }, { "docid": "19a2797f5ec2cbc6bde04faf10dba814", "score": "0.7652727", "text": "def serialized?; end", "title": "" }, { "docid": "19a2797f5ec2cbc6bde04faf10db...
98546e5aadaccbb055cc4d52aa95ab3e
method to use in cook gives ingredients' display_options the condiments parameter
[ { "docid": "6a94893c2c4d748855eaf1dcd76932af", "score": "0.6621381", "text": "def show_condiments\n display_options(condiments)\n end", "title": "" } ]
[ { "docid": "f358e464ec91209916de4824e86068c9", "score": "0.5781093", "text": "def display_all_recipes\n array_of_choices = $default_recipe.all_recipes.keys << 'Previous Page'\n recipe_selection = display_choices('Raid my Kitchen! Recipes : ',array_of_choices)\n if recipe_selection == 'Previous Page'\...
6435ef7cc14c21e1176d338814670a10
Introducimos los atributos al bloque Get y Set para cada atributo de la Bibilioteca Bib
[ { "docid": "c25c727f7b0881397f01384f23902e32", "score": "0.0", "text": "def authors(*args)\n\t\t args.length == 1 ? self.autores = args[0].split(\", \") : self.autores \n\t\t end", "title": "" } ]
[ { "docid": "e4922bd182779dd1fc0ffa1438f1d4b3", "score": "0.5909936", "text": "def set_atributo\n @atributo = Atributo.find(params[:id])\n end", "title": "" }, { "docid": "ee204e15f49529dad43afcfb274a7b0d", "score": "0.5662042", "text": "def inicializar_atributos\n self.cla...
98670975f7a51c5d5063f72310e696d8
dias de retraso segun progreso actual
[ { "docid": "84d7eab816bc29d76d1de66bcf6aeebf", "score": "0.0", "text": "def delayed_or_advanced_days(in_resources)\n\t\t# El indicador que posee un avance real más cercano al actual\n\t\taux_progress = real_progress_function(Date.today, in_resources)\n\n\t\tif !in_resources\n\t\t\ti = indicators.min_by ...
[ { "docid": "ae0599c8d64cc4c7702b1034d37bb021", "score": "0.65476745", "text": "def extraer_detras\n if(@tam == 0)\n puts \"La Lista está vacía\"\n else\n aux = @cola\n @cola = @cola[:prev]\n @cola[:Next_] = nil\n ...
bbbd01361bd748e0df839fdeed7dbd37
usage new :file=>'my file.rb', :with_contents=>'some stuff'
[ { "docid": "c61e0090c7a0b07524954b4fe86160a6", "score": "0.0", "text": "def new(options)\n if options.has_key? :directory\n dir = self[options.delete(:directory)]\n FileUtils.mkdir_p dir.path\n else\n file = self[options.delete(:file)]\n if (binary_content = options...
[ { "docid": "3f5672f34414af087d5704069fd3e0e5", "score": "0.6673925", "text": "def newWith( stuff )\n @rawContents = stuff\n end", "title": "" }, { "docid": "efc1ed444b4c798e1fb3b5aa69cb2353", "score": "0.65882677", "text": "def initialize(contents = nil)\n self.contents = cont...
63bdfe9bc8e4d7e85f42c28b8aa56beb
the resource should have otp turned on, but it isn't
[ { "docid": "273e2ed2eed77c98cd5f1f0acd88bbf0", "score": "0.746029", "text": "def otp_mandatory_on?(resource)\n return true if resource.class.otp_mandatory && !resource.otp_enabled\n return false unless resource.respond_to?(:otp_mandatory)\n\n resource.otp_mandatory && !resource.otp_enable...
[ { "docid": "919c2c8badf59647a65aec93e6834fbd", "score": "0.70638806", "text": "def otp_challenge_required_on?(resource)\n return false unless resource.respond_to?(:otp_enabled) && resource.respond_to?(:otp_auth_secret)\n\n resource.otp_enabled && !is_otp_trusted_browser_for?(resource)\n end...
93c6a0f2273cd072412da56261fbe675
Use ERB to render templates
[ { "docid": "e5a3cb773190b799a8e86b28aa2a0218", "score": "0.7234634", "text": "def render(data)\n ERB.new(data, trim_mode: '-').result(binding)\n end", "title": "" } ]
[ { "docid": "27fd9ace277ebb6df907282a5ae77a9b", "score": "0.820768", "text": "def render() ERB.new(@template, nil, '-').result( binding ) end", "title": "" }, { "docid": "190ecaeac44dba134807d07937bc4d3b", "score": "0.79941493", "text": "def render(template)\n ERB.new(template).res...
1606a2e87a43b62f8a9505896e920dd3
def scrape_student_tag_line(scrape_result) "This is a tag line" end
[ { "docid": "ec746ecaa5cc06789f116dd57380f7b1", "score": "0.6382751", "text": "def scrape_student_quote(scrape_result)\n scrape_result.css(\"div.textwidget h3\").children.to_s.strip.gsub(/\\s+/, \" \")\n end", "title": "" } ]
[ { "docid": "255e712036e0b2074fd0371db680f63e", "score": "0.6300728", "text": "def tagline\n document.xpath(\"//h4[text()='Taglines:']\").first.next_sibling.text.imdb_unescape_html rescue nil\n end", "title": "" }, { "docid": "ab14e6233a9e912a427b0d6105dd1a1a", "score": "0.6236407...
5e72f1dd3f2ef8cdb71617d2a3b2b13a
generates instructions to control FPGA to hash the given data
[ { "docid": "2c55ae0822d1a222b7fdafa3fa8bfb89", "score": "0.5606612", "text": "def hash_block(data)\n chunk_num = data.length>>6\n frame_num = ( chunk_num.to_f / @max_chunk_per_frame ).ceil \n byte_per_frame = @bytes_per_chunk*@max_chunk_per_frame\n padding_chunks = [0].pack('C')*@bytes_pe...
[ { "docid": "6fa25b4f00e6a6bb426b3643f5d98f44", "score": "0.6410089", "text": "def hash(data)\n @cipher.update Digest::SHA2.digest(data)\n end", "title": "" }, { "docid": "818dfb991535496155f05f3aaf2ee71f", "score": "0.638648", "text": "def hashes(data)\n m = @ba.size\n h = ...
5583bd49927411b31b095682ac5d0287
Get the total play count of all the songs added up for this artist
[ { "docid": "fa88178fd77d06b8d808e8bc9bde6fbe", "score": "0.68658715", "text": "def playcount\n\t\t\tsearch_xml(\"//artist/stats/playcount\").inner_html rescue \"\"\n\t\tend", "title": "" } ]
[ { "docid": "d4d1e1e770ffaaa27019859221497781", "score": "0.7620478", "text": "def song_count\n songs.size\n end", "title": "" }, { "docid": "7139f9d1653edd29bcaa930341ca499c", "score": "0.7560905", "text": "def total_songs\n \tself.songs.size\n end", "title": "" }, ...
744872987d0f2d3190bf866b69017a89
we used strong parameters for the validation of params
[ { "docid": "5fae70f5388e3b7720703c5d03c7df84", "score": "0.0", "text": "def shift \n params.require(:shift).permit(:user_id, :start, :finish, :break_length) \n end", "title": "" } ]
[ { "docid": "8fa507ebc4288c14857ace21acf54c26", "score": "0.8067315", "text": "def strong_params\n # to dooo\n end", "title": "" }, { "docid": "84bd386d5b2a0d586dca327046a81a63", "score": "0.7677371", "text": "def good_params\n permit_params\n end", "title": "" }, ...
52bff149c43daee1be07ea4edbfca514
Get posts by tags === Returns Array:: Hashes of found posts
[ { "docid": "718604023a28b8cc477aabe833a31dbe", "score": "0.69080496", "text": "def posts_by_tags(tags, page = 1, limit = options[:limits][:per_page])\n tags = clean_tags(tags)\n posts_url = self.class::OLD_API ? 'post.json' : 'posts.json'\n do_request(posts_url, tags: tags, page: page, limit: l...
[ { "docid": "5caf6ca47905bf18f1bbb5a15fca4db2", "score": "0.7551293", "text": "def posts\n Post.filter(:tag_id => self.tag_id)\n end", "title": "" }, { "docid": "f991e4fcd0971c59a5622dce4f60e1aa", "score": "0.73028696", "text": "def tags(params)\n if validate_tags(params)\n...
620931acfd1a89a00e1482378541e55f
Outputs nonarray value in the form of hash For object, use to_hash. Otherwise, just return the value
[ { "docid": "f0ff79d474b4d3d5b9687d897ed56ca8", "score": "0.0", "text": "def _to_hash(value)\n if value.is_a?(Array)\n value.compact.map{ |v| _to_hash(v) }\n elsif value.is_a?(Hash)\n {}.tap do |hash|\n value.each { |k, v| hash[k] = _to_hash(v) }\n end\n elsif...
[ { "docid": "a34f3dad821ba9744bc8d807b65489ad", "score": "0.6719518", "text": "def hash\n [value].hash\n end", "title": "" }, { "docid": "a34f3dad821ba9744bc8d807b65489ad", "score": "0.6719518", "text": "def hash\n [value].hash\n end", "title": "" }, { "doc...
eb6c7360af184897f4c59ea7115bef24
Joins the given channels.
[ { "docid": "cd08883ee4f8f365dc612b777017c372", "score": "0.6790032", "text": "def join(context, channels)\n raise ClientError.new(\"Can't join any channel. Not connected to a server.\") \n end", "title": "" } ]
[ { "docid": "35c8c30df206057216735ae8159fa927", "score": "0.79928374", "text": "def join *channels\n send \"JOIN #{channels.join(',')}\"\n end", "title": "" }, { "docid": "d5464fb7ed192276d5087c82fed37b44", "score": "0.7827094", "text": "def join(*channels)\n channels.eac...
0700e5fddc4a0ee9a2ecbf79aac80c46
GET /atms/1 GET /atms/1.json
[ { "docid": "84edddbdded0dfb446185ea1555f3def", "score": "0.5881038", "text": "def show\n @atm = Atm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.js { render layout: false } # show.html.erb\n format.json { render json: @atm }\n end\n end", ...
[ { "docid": "34ca8b59802c0ed0b43aa5dc51b19a87", "score": "0.6908876", "text": "def show\n @atm = Atm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @atm }\n end\n end", "title": "" }, { "docid": "86cb5eb9e469b35ca111...