query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
7427f698937531ca05e94442ae10601a
Returns and sets the preamble as a string (any text that is before the first MIME boundary) source://mail//lib/mail/body.rb219
[ { "docid": "83b464c863daa7dda2ebf221a70b6518", "score": "0.6057816", "text": "def preamble=(_arg0); end", "title": "" } ]
[ { "docid": "72e7917b91d6b998e0aeff0ff4426fec", "score": "0.72887534", "text": "def preamble\n @preamble\n end", "title": "" }, { "docid": "35e3b385f4e9385f3cf81ca57bb4a4f5", "score": "0.66401744", "text": "def preamble=( val )\n @preamble = val\n end", "title": ""...
fe66b95c50640b3cdfedf469e1625f20
Identify and describe the Ruby method(s) you implemented. We used is_a? which tests an object to determine whether it is a certain data type. We used << which pushes an element to an array or hash. We used if/else as a conditional to help sort the elements to the output array We used .each to iterate over the input arr...
[ { "docid": "c5e96fef21730fe44362d352c73d9cf8", "score": "0.7247627", "text": "def my_hash_splitting_method(source, age)\n all_pets_array = [[],[]]\n source.each do | name, pets_age |\n if pets_age < age\n all_pets_array[0] << [name, pets_age]\n else\n all_pets_array[1] << [name, pets_a...
[ { "docid": "bc47602cf743db10b20c7782d265b5e0", "score": "0.70485175", "text": "def my_hash_splitting_method(source, age)\n all_pets_array = []\n # all_pets_array << source.select{ |name, pets_age| pets_age < age }\n # all_pets_array << source.select{ |name, pets_age| pets_age >= age }\n all_pets...
a77ee6edb39f4ea9efdb28945ebb382d
requested item must be a VoyagerResponse::RequestedItem
[ { "docid": "7745a340fabb5f4a8f0d7d0b81a30624", "score": "0.5135493", "text": "def cancel_request_for(requested_item)\n url = @server.vxws_uri(\"CancelService\")\n request = Net::HTTP::Post.new(url.path)\n request.body = cancel_request_post_data(requested_item)\n response = Net::HTTP....
[ { "docid": "5da1417f7e8a0eb94f094caaf4e0ac84", "score": "0.6358465", "text": "def set_request_item\n @request_item = RequestItem.find(params[:id])\n end", "title": "" }, { "docid": "f4bb7ae846490ceb9735e5d03273332b", "score": "0.6090238", "text": "def add_item_request(item)\n...
25146a3b4100f6472e7f265838e77729
Can be empty, otherwise something like "Android6.3" or just "Android"
[ { "docid": "7187d04327aca7308e056fd393ca4660", "score": "0.611588", "text": "def os\n [\n device_detector.os_name,\n device_detector.os_full_version&.split(\".\")&.slice(0,2)&.join(\".\")\n ].compact.join(\"-\")\n end", "title": "" } ]
[ { "docid": "f195b01f910c7969dab1d880606068e2", "score": "0.68413305", "text": "def name\n 'Android'\n end", "title": "" }, { "docid": "0cbf74d77d2a3740dbf8754244ead4c2", "score": "0.6797195", "text": "def minos_string; end", "title": "" }, { "docid": "e54abdf32f5ad6c2...
dab0240ffb87b31c06423a908c967e31
Find any matching contributions by author and WOSUID; create a contribution for any existing publication without one for the author in question.
[ { "docid": "c6d81954ad0b2d93a9611617daad47c7", "score": "0.71576095", "text": "def author_contributions(author, uids)\n Publication.where(wos_uid: uids).find_each.map do |pub|\n author.assign_pub(pub)\n pub.wos_uid\n end\n end", "title": "" } ]
[ { "docid": "6766c8bec880c969c969ed79f738587f", "score": "0.71398145", "text": "def find_or_create_contribution(author, publication)\n publication.contributions.find_or_create_by!(author_id: author.id) do |contrib|\n contrib.assign_attributes(\n cap_profile_id: author.cap_profile_id,...
955d86427f144f089bfc609ad19066b7
PUT /private/members/johnsmith PUT /private/members/johnsmith.json
[ { "docid": "5a3d2a4dec53e5cdd9634bce00f88fdc", "score": "0.0", "text": "def update\n\t\t@member = Member.find(params[:id])\n\t\t\n\t\t# Update the member's section, if sent.\n\t\tif params[:member].has_key?(:section_id) and @member.section_id != params[:member][:section_id]\n\t\t\t# Don't allow unprivil...
[ { "docid": "a5af1e826e49676be947199804312c95", "score": "0.72302413", "text": "def putMember(memberId, fullName, initials, bio)\n\n\thash = Hash.new\n\thash[:fullName] = fullName\t\n\thash[:initials] = initials\t\n\thash[:bio] = bio\t\n\thash[:key] = $key\n\thash[:token] = $token\n\n\tresponse = RestCli...
593a3e20d09dcd9c439cc4541eed9584
DELETE /codes/1 DELETE /codes/1.json
[ { "docid": "2449382847c5d56e10214ff1dfdc5e6f", "score": "0.7503115", "text": "def destroy\n @code.destroy\n respond_to do |format|\n format.html { redirect_to codes_url, notice: 'Code was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ...
[ { "docid": "5dba3e5f402ac300726e6e6bbb7ea7df", "score": "0.7780049", "text": "def destroy\n @code = Code.find(params[:id])\n @code.destroy\n\n respond_to do |format|\n format.html { redirect_to codes_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "doci...
f53420caef3f18000ef3a94735642217
one line fibonacci number
[ { "docid": "d8b73cba3459bcccdb8bf8c92a668613", "score": "0.0", "text": "def fibs_rec_oneline(x)\n x <= 2 ? 1 : fibs_rec_oneline(x-1) + fibs_rec_oneline(x-2)\nend", "title": "" } ]
[ { "docid": "2ff7985c69fa00c51dc8862b925ea5cd", "score": "0.81532747", "text": "def fibonacci\n fib = [0, 1]\n num = 100\n\n while fib.count < num\n fib << fib[-1] + fib[-2]\n end\n fib\n p \"Total in sequence: #{fib.count}.\"\n end", "title": "" }, { "docid": "a55284d...
5a32835bc7566ff52e51599c7b8554c6
Called when we're connected. Register with NickServ, if required.
[ { "docid": "83d52789502094c7974e8b3542919134", "score": "0.83167696", "text": "def on_connect\n $log.puts \"Connection to '#{@name}' completed.\"\n if (ns = $config[\"servers/#{@name}/services/nickserv\"]) and (pw = ns['password'])\n name = ns['name'] || 'NickServ'\n $log.puts \"...
[ { "docid": "2486c94c0a2941cdefb9908cd2e1f5f5", "score": "0.6979249", "text": "def register(context, nick, login, realname)\n raise ClientError.new(\"Can't register connection. Not connected to a server.\") \n end", "title": "" }, { "docid": "d487c84882dff47824e1b...
41bb8b07db4a265fdfb2bbd1ac008774
open or create TAG_FILE
[ { "docid": "3f76fd27f41c7ec9bedcc2382406f954", "score": "0.55107677", "text": "def open_tags_config\n tag_file_path = File.join(SETTINGS_DIR, TAG_FILE)\n Dir.mkdir(SETTINGS_DIR) unless File.exists?(SETTINGS_DIR)\n FileUtils.touch(tag_file_path)\n YAML.load_file(tag_file_path) || {:tags => [\...
[ { "docid": "572b9b6acdc51ffdb1416fe568cce5e2", "score": "0.67359", "text": "def newFile (flag)\n\n if (flag == true)\n @current_final_path = getFinalPath\n @sizeCounter = 0\n end\n\n if (@tags.size != 0)\n @tempFile = File.new(@current_final_path+\".tag_\"+@tag_path+\"part\"+@sizeCount...
672583f4ed8feb58d58f73ade5034d3a
GET /admin/instruments GET /admin/instruments.json
[ { "docid": "1e5651d0559337b3e518ca20f7bf536b", "score": "0.5921887", "text": "def index\n @q = Instrument.search(params[:q])\n @instruments = @q.result(distinct: true) \n end", "title": "" } ]
[ { "docid": "71b060693f854b8125f1f99edfa9759d", "score": "0.7456831", "text": "def index\n \t@instruments = Instrument.all\n\n \trespond_to do |format|\n \t format.html # index.html.erb\n \t format.json { render :json => @instruments }\n \tend\n end", "title": "" }, { "docid...
3deaf4623788f72154be6219148b4748
fibonacci series: 0 1 1 2 3 5 8 13 21 ... e.g. 0th fibonacci number is 0 e.g. 1st fibonacci number is 1 .... e.g. 6th fibonacci number is 8
[ { "docid": "93b5f4ae19b18211c423f891ad7e019c", "score": "0.0", "text": "def fibonacci(n)\n raise ArgumentError if n.class != Integer\n raise ArgumentError if n < 0\n return n if n < 2\n\n i = 1\n n1 = 0\n n2 = 1\n\n while i < n\n fibonacci = n1 + n2\n n1 = n2\n n2 = fibonacci\n i +=1\...
[ { "docid": "f5829903a664494096cac8d9568680fc", "score": "0.8257663", "text": "def fibinacci(number)\n fibinacci_series = [1,1]\n index = 2\n while index <= (number-1)\n fibinacci_series[index] = fibinacci_series[index - 1] + fibinacci_series[index - 2]\n index = index + 1\n end\n return fibin...
6a560efc10050a49d0f6929a8497bba4
Define a function to print the option list to the console
[ { "docid": "e3f917969b7493ccce61e93e62e713f2", "score": "0.7621106", "text": "def printList(list)\n\tputs \"**** Options ****\"\n\t\tlist.each_with_index do |x, i|\n\t\t\tputs (i+1).to_s + \". \" + x\n\t\tend\n\tprint \"> \"\nend", "title": "" } ]
[ { "docid": "8b190e071e7da0f3a62b3bfc1df887df", "score": "0.8002944", "text": "def print_options; end", "title": "" }, { "docid": "8d67069064a30e3b58f60e95cd37b3b4", "score": "0.74881864", "text": "def print_options\n puts \"1.Lattes sell for $4,\"\n puts \"2.Scones sell for $5,\"...
afad453293f9f3099f5bf66a72e800c0
DELETE /consortia/1 DELETE /consortia/1.json DELETE /consortia/1.xml
[ { "docid": "a69949ab22b73f2cc0ce7e478b96ce5b", "score": "0.0", "text": "def destroy\n begin\n @consortium.destroy\n flash[:success] = \"successfully destroyed.\"\n rescue ActiveRecord::DeleteRestrictionError => e\n @consortium.errors.add(:base, e)\n flash[:error] = \"#{e}\"\n ...
[ { "docid": "822ddea2e45bf78350003645efcbdb54", "score": "0.6980486", "text": "def delete uri, args = {}; Request.new(DELETE, uri, args).execute; end", "title": "" }, { "docid": "ac051b7769e46d3cbab1d5fda84d7f00", "score": "0.6967528", "text": "def destroy\n @condominios = Condomin...
27415e5514475681c6ea22a7b2692889
DELETE /downloads/1 DELETE /downloads/1.json
[ { "docid": "c69cea6b12ee8e16108af72b6735f018", "score": "0.756834", "text": "def destroy\n @download.destroy\n respond_to do |format|\n format.html { redirect_to downloads_url, notice: 'Aggregate download was successfully destroyed.' }\n format.json { head :no_content }\n end\n end",...
[ { "docid": "fd2a1141e1026019ac5c04626c25fe9a", "score": "0.7762203", "text": "def destroy\n @download = Download.find(params[:id])\n @download.destroy\n\n respond_to do |format|\n format.html { redirect_to downloads_url }\n format.json { head :no_content }\n end\n end", "title...
3fc764faa5fdddf4d14adb6590659765
Ensure valid credentials, either by restoring from the saved credentials files or intitiating an OAuth2 authorization. If authorization is required, the user's default browser will be launched to approve the request.
[ { "docid": "768d7a54be8aedbed2a2c6272c1c770a", "score": "0.62978417", "text": "def authorize\n client_id = Google::Auth::ClientId.from_file(CREDENTIALS_PATH)\n token_store = Google::Auth::Stores::FileTokenStore.new(file: TOKEN_PATH)\n authorizer = Google::Auth::UserAuthorizer.new(client_id, SCOPE, to...
[ { "docid": "fdf03d140fe16dc072651520e61398ac", "score": "0.69318885", "text": "def authorize\r\n client_id = Google::Auth::ClientId.from_file CREDENTIALS_PATH\r\n token_store = Google::Auth::Stores::FileTokenStore.new file: TOKEN_PATH\r\n authorizer = Google::Auth::UserAuthorizer.new client_id, SCOPE...
41670aa8ce5514eba444badea48998d6
f = FlickrManager.new response = f.flickr.call_method "flickr.collections.getTree"
[ { "docid": "c438b181d76c9461ae0ae6b81f51021f", "score": "0.0", "text": "def get_collections xml\n collections = Array.new\n xml.root.elements.each(\"collection\") do |x|\n collections << parse_collection(x)\n end\n return collections\nend", "title": "" } ]
[ { "docid": "d07571b7daa8b4957062a94e3625d43b", "score": "0.6634057", "text": "def get_root token, get_children=false\n uri_str = \"https://#{get_hostname(token)}/sf/v3/Items\"\n if get_children\n uri_str += \"?$expand=Children\"\n end\n uri = URI.parse uri_str\n puts uri\n \n http = Net::HTTP....
6b64f50598bcfd7a6b2e511ccd046c1d
PUT /affiliates/1 PUT /affiliates/1.xml
[ { "docid": "848af50439b1866854675e44220e9259", "score": "0.6661035", "text": "def update\n @affiliate = Affiliate.find(params[:id])\n\n respond_to do |format|\n if @affiliate.update_attributes(params[:affiliate])\n format.html { redirect_to(@affiliate, :notice => 'Affiliate was success...
[ { "docid": "a96bc28f8ffa7cb0373cec4732a24c92", "score": "0.67252666", "text": "def update\n @affiliate = Affiliate.find(params[:id])\n respond_to do |format|\n if @affiliate.update_attributes(params[:affiliate])\n flash[:notice] = 'Affiliate was successfully updated.'\n format.h...
bb9e132c289b079e9131515082f9b0ba
Check on allowing to updating guardian information
[ { "docid": "4cbcb043f8e5b09afd08a6b0ff8fb770", "score": "0.713705", "text": "def allow_update_guardian?\r\n return true if guardian_updated_at.nil?\r\n\r\n guardian_updated_at.utc < (DateTime.now - 30.minutes).utc\r\n end", "title": "" } ]
[ { "docid": "a8bb8acd2d12de3a6b3dfa24fc354554", "score": "0.8253872", "text": "def guardian_update\r\n guardian_update! if allow_update_guardian?\r\n end", "title": "" }, { "docid": "df75545bc5e461d65bdb24ac5b687c2e", "score": "0.698843", "text": "def guardian_verify!\r\n ...
e5e193ba19ae0677a4d06f82db3c4fab
returns action as symbol
[ { "docid": "d63f4f3155fe6688355b5b1b849dbcdc", "score": "0.8072751", "text": "def action\n self[:action].to_sym if self[:action]\n end", "title": "" } ]
[ { "docid": "b4a6c6f100bdfa2369b94b342f4f2d7a", "score": "0.81268543", "text": "def action\n \treturn self[:action].to_sym\n \n end", "title": "" }, { "docid": "ff40e72dd237f424e8265e6423e4b2eb", "score": "0.8120674", "text": "def action_str(sym)\n\t\t\tact = InvertedActionMap[sym]...
0d87994ba71c3e2ecbdd597841b51a46
private API. Exposed for use by unit tests
[ { "docid": "225237210a2a7f8f8cde476e5d005cc7", "score": "0.0", "text": "def team_name_in_teams? (a_teams, a_team_name)\n a_teams.has_key?(a_team_name.to_sym)\n end", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.79383147", "text": "def private; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", "score": "0.65613467", "text": "def specie; end", "title": "" }, { "docid": "d8ae3e2b236950074c4632d180274b8a", ...
8c574926ba86b0d590f2b573d734c942
Reset all configurations to defaults.
[ { "docid": "086351c1bcf449e2a310705a33045e4f", "score": "0.0", "text": "def reset\n @registry = {}\n @logging = false\n @line_item_limit = 1000\n end", "title": "" } ]
[ { "docid": "1bfafcd5bfa8335843ef138ddd671aa0", "score": "0.846698", "text": "def reset_config\n config.reset_to_defaults\n end", "title": "" }, { "docid": "77fc777e88b45380dba0129c7739e285", "score": "0.8239483", "text": "def reset\n @config = empty_config\n end", ...
787cda9a48338d0a776817b0456a75bf
draw? determines if there is a draw a draw occurs when the board is full and there are no winners
[ { "docid": "05431893f2d1104d1d194d94b57f6377", "score": "0.82630926", "text": "def draw?(board)\n if full?(board) && !(won?(board))\n true\n else\n false\n end\nend", "title": "" } ]
[ { "docid": "7c26f0eed6b7b5edf7c25302774963d2", "score": "0.8570771", "text": "def draw?\n !board.include?(0) && winner.nil?\n end", "title": "" }, { "docid": "40868cb9f0e33f296d08319e107def7d", "score": "0.84652853", "text": "def draw?\n @board.full? && !won?\n end", "t...
09abe74dda9d3251d1acaf8f6f35ef18
Similar to Stringnothing?, except it joins all the elements first and does the same check. Example: [" ", " ", ""].nothing? => true Returns: True or false.
[ { "docid": "f5ff165fcac94320df5ea245b4beabca", "score": "0.8320959", "text": "def nothing?\n\t\tjoin('').strip.empty?\n\tend", "title": "" } ]
[ { "docid": "250cc0d0270fa04b46692c2321aca4d0", "score": "0.7179955", "text": "def effectively_empty( value )\n value.nil? || value.to_s.empty?\n end", "title": "" }, { "docid": "541399cc3f18a81204e38119c3fc4066", "score": "0.6976455", "text": "def empty?\n all? { |v| v.to_s....
33853b417091bf2a0d8d8da634ce89e9
PUT /question_groups/1 PUT /question_groups/1.json
[ { "docid": "69006f8ec1d14009ae1e8044a4b9f84a", "score": "0.6778192", "text": "def update\n @question_group = QuestionGroup.find(params[:id])\n \n # original list of questions, select question_id column where question_group_id = params[:id]\n # convert the results into an array ,convert the a...
[ { "docid": "f8fc63d3ad4cb437d3e5418a387b581f", "score": "0.72734946", "text": "def update\n @question_group = QuestionGroup.find(params[:id])\n\n respond_to do |format|\n if @question_group.update_attributes(params[:question_group])\n format.html { redirect_to @question_group, notice: ...
91e8e1002acc0629cfa230f9f341f80c
Given file path within src, return any subdirectory path needed to reach file, or the empty string. This is also src trailing '/' aware.
[ { "docid": "bf505a98007ac5c01d113a6c3073dcc1", "score": "0.84722024", "text": "def subpath( src, file ) # :doc:\n src = src.sub( %r{/[^/]*$}, '' ) #remove trail slash or last element\n File.dirname( file ).sub( /^#{src}\\/?/, '' )\n end", "title": "" } ]
[ { "docid": "ccad5e56e0319aad833da1b98ac69a75", "score": "0.68963677", "text": "def subpath(file)\n file.sub(/#{@directory}/, '').sub(/#{File::SEPARATOR}/, '')\n end", "title": "" }, { "docid": "a40a56a224f107836a18fc9d1b98298e", "score": "0.6720418", "text": "def construc...
3805dd7d663b7f2265f48c761665d732
GET /radios/new GET /radios/new.json
[ { "docid": "7a50b8dde89fe9290163ca8e27a336fe", "score": "0.0", "text": "def edit; end", "title": "" } ]
[ { "docid": "1d1ee25cd525c1f2d603c705eeddd4a3", "score": "0.6882535", "text": "def new\n @radio = Radio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @radio }\n end\n end", "title": "" }, { "docid": "1d1ee25cd525c1f2d603c705eedd...
1f7857311f55ff1dc1cbeb6c3b1b1f9f
Fake a bad RC
[ { "docid": "b2596607022d4465622efb1d02e55da2", "score": "0.60548013", "text": "def bad_rc(error_msg = '', args = {})\n @rc = 999\n @output = args[:output]\n @error_msg = error_msg\n self\n end", "title": "" } ]
[ { "docid": "33ad2cf3336fc5d05bfed0b38d105193", "score": "0.59200984", "text": "def rc?; end", "title": "" }, { "docid": "dff37ea0d68b9c86bab1ceb2dfb658a9", "score": "0.5796041", "text": "def rc; end", "title": "" }, { "docid": "af12fc44533fb1e35525618a695693ec", "scor...
5768858cb1aefbf632b2b9b2ee3ffed5
Puma doesn't use singletons (which is good) but this means we need to pass through whether the puma server is running in single mode or cluster mode
[ { "docid": "0481fe4559b5af9fa9765448cdf6a699", "score": "0.0", "text": "def set_puma_options(options)\n @puma_options = options\n end", "title": "" } ]
[ { "docid": "db2bd1dc7d1a5023e02c51ec3ba9bb39", "score": "0.6942442", "text": "def puma_server?\n $PROGRAM_NAME.include?('puma') && Puma.const_defined?('Server')\n end", "title": "" }, { "docid": "5c84f6616992126c76cb124fa75cad48", "score": "0.6792057", "text": "def server\n ...
8fb5536f27af5501f669666db4036965
alias :inspect :to_s two directives are equal if their string representations match
[ { "docid": "576922537c09b997d1a60b0febfc7782", "score": "0.0", "text": "def ==(other)\n other = other.to_s unless other.is_a?(String)\n to_s == other\n end", "title": "" } ]
[ { "docid": "cc4d3b4ada29c46326afe3a7cc42c6d3", "score": "0.6333914", "text": "def define_inspect\n define_method(:inspect) do\n klass = self.class\n name = klass.name || klass.inspect\n attrs = klass.comparison_attrs\n \"#<#{name}#{attrs.map { |attr| \" #{attr}=#{send(attr).inspe...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "d23a5ff6261fd3b337d631e8c4a68818", "score": "0.0", "text": "def task_params\n params.require(:task).permit(:name, :description, :start_date, :end_date, :completed_at, :completed)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whit...
2d7e7c34e4d5e3d6090a436e0a846c04
Get Invoice Email Templates
[ { "docid": "f8a5d11684968b37c40352b730772c82", "score": "0.6857376", "text": "def finance_invoice_email_templates_get(opts = {})\n data, _status_code, _headers = finance_invoice_email_templates_get_with_http_info(opts)\n return data\n end", "title": "" } ]
[ { "docid": "4dd1b854963123b58e4f579d4c079fc0", "score": "0.78701353", "text": "def retrieve_email_templates()\n start.uri('/api/email/template')\n .get()\n .go()\n end", "title": "" }, { "docid": "bbf5e1d03d93e331b782ac3429a90c95", "score": "0.78583574", "te...
2693a7ff3a2c58bba87ba92b579dd8fc
Removes the current key from the cache store
[ { "docid": "700569807ae246bd12cc3d5051f8724a", "score": "0.0", "text": "def delete(method, *args)\n self.method = method\n self.args = args\n MethodCacheable.store.delete(key, options)\n end", "title": "" } ]
[ { "docid": "052aa53d7254791a358b017c36b321cc", "score": "0.8169341", "text": "def remove(key)\n cache.delete(key)\n end", "title": "" }, { "docid": "8c67b6877f590151ba2961de05797838", "score": "0.8043955", "text": "def remove(key)\n decode(cache.remove(encode(key)))\n ...
3a4be52f01c25cf6c6d9721bed740d83
Operates on the game hash to return an array of the team names
[ { "docid": "2f6957a04d7236fc0a21feaa958d6712", "score": "0.0", "text": "def team_colors(color)\n game_hash.each do |location, data|\n if data[:team_name] == color\n return data[:colors]\n end\n end\nend", "title": "" } ]
[ { "docid": "91f9c02c7285e52b3663991d4336439a", "score": "0.887519", "text": "def team_names\n\tarray_of_team_names = []\n\tgame_hash.collect do |team, team_info|\n\t\tteam_info[:team_name]\n\tend\nend", "title": "" }, { "docid": "c7572ede3574155a844f467425121c9e", "score": "0.87192494", ...
e857809edf446cda2528191ca6276522
Loads the given environment from the config file or error if the environment doesn't exist. If the ConfigFile isn't environmentbased, the environment is ignored. If the config file was initialized with keys checks to see that all of the specified keys exist in the final configuration.
[ { "docid": "7aaf2438eba3a51076d7ed820754dc27", "score": "0.564434", "text": "def load(environment=nil)\n load_from_file(file, environment)\n end", "title": "" } ]
[ { "docid": "e5f0b9843f0a7807c2109382e34b90e5", "score": "0.708336", "text": "def load_from_file(filename, environment)\n if File.exist?( filename ) then\n @loaded_from = filename\n configuration = YAML.load_file(filename)\n if environment_based?\n configuration = confi...
48e58220f8f51e4a1743dacddb0ae248
Returns all duplicates, including the first instance of the duplicated elements.
[ { "docid": "255be5810735caa70ee771c3344e2f7a", "score": "0.74754757", "text": "def duplicates(collection)\n grouped_duplicates(collection).flatten\n end", "title": "" } ]
[ { "docid": "e1e75e3db6268ab7deadc7f808efa560", "score": "0.7317296", "text": "def grouped_duplicates(collection)\n collection.group_by { |item| item }.values.reject(&:one?)\n end", "title": "" }, { "docid": "d9eb96d42c29f0af0963919a413461a4", "score": "0.7310139", "text":...
358aad152b7e2375b4daa0e8642ec927
GET /items/:id GET /items/:id.json
[ { "docid": "32f9fae4a78bc92ecaa442f9ad8f4d4e", "score": "0.0", "text": "def show\n @item = Vger::Resources::Suitability::Item.find(params[:id])\n @options = Vger::Resources::Suitability::Option.where(\n query_options: {\n item_id: @item.id\n },\n methods: [:reference_option_b...
[ { "docid": "54748291efc0ecbbc050090a2600e1b8", "score": "0.81714857", "text": "def show\n @items = Item.find(params[:id])\n render json: @items\n end", "title": "" }, { "docid": "eb354ffc8205e277e16c339add996ccd", "score": "0.79644376", "text": "def show\n item = Item.find(...
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "89345f402106c25cde12e1484b175b2f", "score": "0.70863056", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = ByIDResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "c4ca32683e8ce75eb6a187d63df8fa77", "score": "0.76639634", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DoneResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "6f7a7d9be674ad4cf17d6743eb1f7836", "scor...
3e30f36bbe9bd0c4b19b4da58583b809
Public: Returns all projects that have been marked as changed. Returns an Array of Project subclasses, one for each project in the repository.
[ { "docid": "38f82368eb7034da53b09c5d16a09917", "score": "0.56278497", "text": "def changed\n select(&:changed?)\n end", "title": "" } ]
[ { "docid": "5bcd5c213015efd08df31de215323713", "score": "0.72591037", "text": "def projects\n pattern = /\\/(trunk|branches|tags)/\n dirs_changed.grep(pattern).map do |dir|\n dir.split(pattern, 2).first\n end.uniq\n end", "title": "" }, { "docid": "8c53340025758d961a...
5d15b8f5d870cbd9b86a869ab7e936a2
=== before_filter (redirect on failure) Unless the current_user is_admin this redirects to root path with a warning User.user_admin.level > 1 Users of this sort can create contributors and edit more low level data.
[ { "docid": "01d4581bfa5cd1f417ad1f7cf6fca409", "score": "0.68947166", "text": "def is_admin\n user = UserAdmin.find_by_user_id(current_user.id)\n unless user and user.level > 1\n redirect_to root_path, alert: \"You must be an adminstrator to access this page\"\n end\n end", "title": "...
[ { "docid": "ff599bf3fbf2f609624eba17eec5c63f", "score": "0.7458608", "text": "def admin_required \n\tunless current_user && (current_user.id < 1 || current_user.permission_level == 1) \n redirect_to '/' \n end \n end", "title": "" }, { "docid": "7f8dcfe51e85c8dd2fd30c1af0b983c5"...
67ef364a5d4b94fe5bf0fb61a7f58269
Creates a new reservation for a message.
[ { "docid": "ad0265a82754eaf93bf3597acc7887ce", "score": "0.0", "text": "def touch_message_by_id(project_id, queue_name, message_id, opts = {})\n \n # verify the required parameter 'project_id' is set\n raise \"Missing the required parameter 'project_id' when calling touch_message_by_id\" ...
[ { "docid": "9940fbd2eaa8627e2383417a4a367682", "score": "0.7395172", "text": "def create\n reservation = project.reservations.build(reservation_params)\n if reservation.save\n reservation.create_notification\n reservation.create_chat_room\n redirect_to active_reservation_path(curren...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b781c6cdefb9a25b80e3ea1b9ca8b10f", "score": "0.0", "text": "def training_params\r\n params.require(:training).permit(:id, :mistake_id, :question, :explanation, :answer)\r\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
912c0e0cf8816366872f1b29941d2de1
DELETE /events/1 DELETE /events/1.json
[ { "docid": "db4eac2f67ac44c0a3a805d4a0c9447d", "score": "0.0", "text": "def destroy\n @event.destroy\n respond_to do |format|\n format.html { redirect_to events_url, notice: 'Event was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "ca8002b7f734bce1f1a27f7ec6e59e9d", "score": "0.8086048", "text": "def destroy # DELETE /api/events/:id\n @event.destroy\n render :json => \"Event deleted\", :status => 201\n end", "title": "" }, { "docid": "3281a9c9361cdbd7e683034a763917de", "score": "0.78338...
ef91e7660efdd196d0b556b60207219c
DELETE /comments/1 DELETE /comments/1.xml
[ { "docid": "b4b1aac33f366cca92b51959bf93a339", "score": "0.6871911", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to comments_path }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "b44ce28afcd584c4b9966829c6ff230b", "score": "0.7070504", "text": "def delete_comments\n end", "title": "" }, { "docid": "34124a60af3035f72f2c565669a4e3a4", "score": "0.7065291", "text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n ...
6f21d4760a39b3491c4c842b573d0387
I don't need to include options, right? I want to save it here, but the array is an array of instances so I dont want to push this in as a string. an array of elements, of the instances of the class Recipe
[ { "docid": "0e2481b7531b15f3b99c43a9f906a495", "score": "0.0", "text": "def add_recipe(recipe)\n # which adds a new recipe to the cookbook\n @recipes << recipe\n save_recipes_to_csv\n end", "title": "" } ]
[ { "docid": "90276f1e4deb4f1f7f57ec97a2bf074a", "score": "0.6981449", "text": "def prepare_recipes\n self.options[:recipes].map!(&:to_hash)\n end", "title": "" }, { "docid": "14d43985d5a5070d3f827e2ee49fa282", "score": "0.6943144", "text": "def add_ingredients(array)\n ...
1b7031a38e2202b1f612b4d5c9c7b5e4
sends an array with individual average times and sends to view to display envia um array com as medias individuais de tempo para a view mostrar
[ { "docid": "80a89f262430757bbecc7932930ad614", "score": "0.694376", "text": "def show_avg_time\n avg_times = []\n RACER_RECORDS.each {|racer| avg_times << [ racer.piloto, racer.avg_time_lap ]}\n @view.display_avg_times(avg_times)\n end", "title": "" } ]
[ { "docid": "b73beba1e0afeea62c86b09b70c6a830", "score": "0.6742312", "text": "def display_avg_times(avg_times)\n puts(\"Tempo Médio De Voltas:\")\n puts(\"---------------\")\n avg_times.each do |array|\n puts \"#{array[0]} - Tempo Médio: #{array[1].round(2)} minutos\"\n end\n puts(\"--...
8aed6663777697a289291e53bdf6bea5
Form for editing a post
[ { "docid": "ec472c33666c69983401c6a806af5273", "score": "0.8163907", "text": "def edit\n\t\t@post = Post.find(params[:id])\n\tend", "title": "" } ]
[ { "docid": "7ab66614f674b28122c671c826f08e96", "score": "0.8734354", "text": "def edit # Show a specific post within an HTML form.\n # Empty, since the @post object is loaded by way of a before filter.\n end", "title": "" }, { "docid": "7ea4f759e0ab15a49817f46b73c31041", "score": "0....
833140a5350b86d29b043b6b5160018d
instance method that returns a Placing instance with its name set to name of the age group the racer will be compting in
[ { "docid": "71aa3bc36ed78c8287b2ec8c5337e56c", "score": "0.71928954", "text": "def get_group racer\n if racer && racer.birth_year && racer.gender\n #determin age as of Jan 1 on year of race; put racer in group rounded down to nearest 10 and up\n #to nearest9s; masters is 60+\n quotient=(date.y...
[ { "docid": "e75c77de4ca7f34cbdb42bb061a2fb38", "score": "0.7415583", "text": "def get_group racer\n if racer && racer.birth_year && racer.gender\n quotient = (date.year-racer.birth_year)/10\n min_age = quotient*10\n max_age = ((quotient+1)*10)-1\n gender = racer.gender\n name...
0b320c48aaaec72de3ee6015c7725ad0
here all actions on going to inactive plugin: plugin model
[ { "docid": "26a8f1e3775bd008af3961019cbcedae", "score": "0.7031107", "text": "def my_plugin_on_inactive(plugin)\n end", "title": "" } ]
[ { "docid": "ffad02d76659a694c99b9fe8020eec4a", "score": "0.6871397", "text": "def ecc_on_inactive(plugin)\n end", "title": "" }, { "docid": "858e2dc4adc53dfe29af2326c351109b", "score": "0.6713424", "text": "def my_plugin_on_active(plugin)\n end", "title": "" }, { "docid...
50237403552deb9d620278d2cc2a9a04
allow tests to overwrite this method so that we don't access the real api when running unit tests
[ { "docid": "8c0659d85c208266bcda704ce7e45945", "score": "0.0", "text": "def create_video\n Yt::Video.new(id:(@video_id))\n end", "title": "" } ]
[ { "docid": "e223b6498b42a8245c5e113225590b5b", "score": "0.69553053", "text": "def api; end", "title": "" }, { "docid": "e223b6498b42a8245c5e113225590b5b", "score": "0.69553053", "text": "def api; end", "title": "" }, { "docid": "10718d42cac5d82a7c1d9e2550ce2f06", "sc...
be51e291f9328059482f1faa97bd4fd7
Public: Determines the total amount of biocarrier CO2 emissions caused by the demand of this node. Returns a numeric in kg.
[ { "docid": "923d0aa495242299a8ccdd13a38bd5d4", "score": "0.5732716", "text": "def primary_co2_emission_of_bio_carriers\n fetch(:primary_co2_emission_of_bio_carriers) do\n (demand || 0.0) * recursive_factor(:bio_co2_per_mj_factor)\n end\n end", "title": "" } ]
[ { "docid": "763bdbe4d644476f4d3fad9458af6773", "score": "0.6374724", "text": "def free_co2_factor\n dataset_get(:free_co2_factor) || 0.0\n end", "title": "" }, { "docid": "85053d583ac2dd8001e795c1cbf61d5a", "score": "0.6347535", "text": "def cost \n return @extra_co...
0746fce065b8f1b4dcaa44370bb28477
PATCH/PUT /teacher_leave_applications/1 PATCH/PUT /teacher_leave_applications/1.json
[ { "docid": "a1bd4e5a35769c3fd4acb77390f65297", "score": "0.77537185", "text": "def update\n respond_to do |format|\n if @teacher_leave_application.update(teacher_leave_application_params)\n format.html { redirect_to @teacher_leave_application, notice: 'Teacher leave application was ...
[ { "docid": "d7989ce1dac7ecff7ef32c756e430b54", "score": "0.6830157", "text": "def set_teacher_leave_application\n @teacher_leave_application = TeacherLeaveApplication.find(params[:id])\n end", "title": "" }, { "docid": "10ee17ef017da5303b0227766ff87fea", "score": "0.67128444"...
9adf3e92ae3251a607ccf48b2700dee3
A convenience method to return the center x coordinate of this widget
[ { "docid": "36fe198548e5a008c6979b3d221d9fca", "score": "0.77814937", "text": "def center_x\n @x + ((right_edge - @x) / 2)\n end", "title": "" } ]
[ { "docid": "30a85364cba8cf7567e20b484ad2dc50", "score": "0.85798144", "text": "def center_x\n @center[0]\n end", "title": "" }, { "docid": "754c43f15e38bed4d09d5b307d78f576", "score": "0.83168864", "text": "def centre_x\n (width / 2) + x\n end", "title": "" ...
be29630feff4a59c519fdc3ffe7c7356
Get a value by its key
[ { "docid": "7a63ee0a9d1ba0c18a1944401b987233", "score": "0.0", "text": "def get key\n @key = key\n url = [\"/v1/kv/#{@key}\"]\n url += check_acl_token unless check_acl_token.nil?\n @raw = @conn.get concat_url url\n parse_body\n return_value\n end", "title": "" } ]
[ { "docid": "6e0764fd23cdcf8d6b190ff54cae7a57", "score": "0.82551694", "text": "def getValue(key)\n return @values[key]\n end", "title": "" }, { "docid": "a9068e3f0aaa5cdb7768a3e88142bf4d", "score": "0.8214528", "text": "def get(key)\n find_by_keys([key]).first\n end", ...
32cd9ee5d16d999a1627a600fa56fbd3
skip_before_action :authorized, only: [:new, :create] or whatever onlys we will need
[ { "docid": "858164c5cec46cd3b5f66a05b5598802", "score": "0.0", "text": "def new\n # Don't need to have form_for in Stylist show page\n # Maybe just need a form_tag\n\n # Coming from Barber show page\n if params[\"stylist_service\"]\n stylist_service_id = params[\"stylist_service\"][\"st...
[ { "docid": "defb5f2df80d2d9ee9b3196ab243bc97", "score": "0.7946808", "text": "def skip_authorization_check(*args)\n self.before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "title": "" }, { "docid": "76963bf10...
0e7543aa5712a98ab5df45cecbf60c17
Parses context and event info from JSON input
[ { "docid": "fec8435b32df203ece7cb512874285d4", "score": "0.75496304", "text": "def parse_json_body(json)\n logger.info(\"Received:\\n#{json.to_s}\")\n data = JSON.parse(json)\n #Create Context\n context = context_from_json(data)\n #Create events\n events = event...
[ { "docid": "7ea6fc8856f49c2effd786f7c8c31f2a", "score": "0.7298893", "text": "def parse_json_body(json)\n LOGGER.info(\"Parsing JSON:\")\n LOGGER.info(json.to_s)\n data = JSON.parse(json)\n #Create Context\n context = context_from_json(data)\n #Create events\n ...
de63c2f1dfd767927f9bbd5950e72995
Creates a Filter object indicating that the value of a particular attribute must begin with a particular string. The attribute value is escaped, so the "" character is interpreted literally.
[ { "docid": "01aab02b8ef8cbd1b529b4c7bd031a27", "score": "0.6412583", "text": "def begins(attribute, value)\n new(:eq, attribute, escape(value) + \"*\")\n end", "title": "" } ]
[ { "docid": "8d8e5dfd97d2c54dc535f8036c4f7513", "score": "0.6612641", "text": "def filter(value)\n !case_sensitive? && value ? /\\A#{Regexp.escape(value.to_s)}\\z/i : value\n end", "title": "" }, { "docid": "341724e133b9af184cfc4c91273ac7fa", "score": "0.62880296", "text":...
881e9de70c033540f88b2f555752e3e0
=begin after_filter :set_csrf_cookie_for_ng protected def verified_request? super || form_authenticity_token == request.headers['XXSRFTOKEN'] end private def set_csrf_cookie_for_ng cookies['XSRFTOKEN'] = form_authenticity_token if protect_against_forgery? end =end
[ { "docid": "647db06564fb7e78b9a19641623c12ba", "score": "0.0", "text": "def render *args\n gon.flash = flash.to_h\n super\n end", "title": "" } ]
[ { "docid": "1786b47aef4517b84cd05c23d02ccb29", "score": "0.90172845", "text": "def set_csrf_cookie_for_ng\n cookies['XSRF-TOKEN'] = form_authenticity_token if protect_against_forgery?\n end", "title": "" }, { "docid": "1786b47aef4517b84cd05c23d02ccb29", "score": "0.90172845", "te...
b6dbe2c3e782554de631d372042e711f
determines which of two consecutive elements will appear first in the results. def bubble_sort!(array) loop do swapped = false 1.upto(array.size 1) do |index| next if array[index 1] <= array[index] array[index 1], array[index] = array[index], array[index 1] swapped = true end break unless swapped end nil end method mod...
[ { "docid": "d702255bed02fc34d470830a75336bd9", "score": "0.0", "text": "def bubble_sort!(array)\r\n loop do\r\n swapped = false\r\n 1.upto(array.size - 1) do |index|\r\n if block_given?\r\n next if yield(array[index - 1], array[index])\r\n array[index - 1], array[index] = array...
[ { "docid": "daadacfbff964bcb227e5ebb583130cd", "score": "0.91047496", "text": "def bubble_sort!(array)\n loop do\n swapped = false\n 1.upto(array.size - 1) do |index|\n next if array[index - 1] <= array[index]\n array[index - 1], array[index] = array[index], array[index - 1]\n swap...
3b8910ab70920414755c849afd0bf6eb
Prepare a fragment that can be used in SQL statements that converts teh data value from integer, string, or UUID to valid UUID string as per Postgres guidelines
[ { "docid": "b6e796c7be1fcc69494760246b022212", "score": "0.66029143", "text": "def to_uuid_pg(column, seed)\n if seed\n \"uuid_generate_v5('#{seed}'::uuid, #{column}::text)\"\n else\n \"uuid(lpad(replace(text(#{column}),'-',''), 32, '0'))\"\n end\n end", "...
[ { "docid": "66a98e3193968db7dd4c3bbedb6c1c27", "score": "0.7051413", "text": "def quote_with_uuid(value, column = nil) #:nodoc:\n return quote_without_uuid(value, column) if column.nil? || column.type.to_s.match(/^uuid/).nil?\n return value.strip == 'uuid_generate_v4()' ? \"#{value}\" : \"'#{value...
4357a984b404bc9c37c95eb4c4587e09
List StaticRouteBfdPeers Paginated list of all StaticRouteBfdPeers.
[ { "docid": "8b1278114c421e949e1b9bb896ad8255", "score": "0.55595016", "text": "def list_static_route_bfd_peer_0(tier_0_id, opts = {})\n data, _status_code, _headers = list_static_route_bfd_peer_0_with_http_info(tier_0_id, opts)\n data\n end", "title": "" } ]
[ { "docid": "9a79a42545d70819ffb04c4c8ef78197", "score": "0.61804277", "text": "def list_static_hop_bfd_peers(logical_router_id, opts = {})\n data, _status_code, _headers = list_static_hop_bfd_peers_with_http_info(logical_router_id, opts)\n return data\n end", "title": "" }, { "d...
fc2b82a7c693a9745be49e6ed0307e53
GET /diver_reviews/1 GET /diver_reviews/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "e4c7c210ee719ddeb085ebb853ea226f", "score": "0.76640004", "text": "def get_reviews\n {\n \"reviews\" => Glassdoor.scrape(@name)\n }\n end", "title": "" }, { "docid": "c6f6d0ddb7e225970c84d349820d0ac1", "score": "0.7638905", "text": "def reviews_of_a_book\n ...
37935f224909ff4b193986637871700e
has_many :merchant_types, :dependent => :destroy serialize :merchant_type_ids, ActiveRecord::Coders::Hstore serialize :merchant_type_ids
[ { "docid": "60577710d77236215145822f7a86fa0e", "score": "0.62747806", "text": "def merchant_types\n MerchantType.find merchant_type_ids\n end", "title": "" } ]
[ { "docid": "99ff35264da9028ed3c834694f8c0cd8", "score": "0.5785172", "text": "def collection_serialization_options\n {:except => [:site_id, :email_address, :type], :methods => :variant}\n end", "title": "" }, { "docid": "1c47480a9f475d3105a4660e51130a5c", "score": "0.56416315", "...
3d1b4ef3f5293ef5fcc1e56ac3d1d26d
POST /api/messages/delete?id=:id Returns: JSON Requires authorization: yes
[ { "docid": "c542774c2fdbed1e693050a501a3506d", "score": "0.8501238", "text": "def delete\n msg = @user.messages.find(params[:id])\n if msg.nil?\n render json_status_response(404, \"Message not found\")\n return\n end\n\n msg.destroy\n render json_status_response(200, \"Message d...
[ { "docid": "3447d31144a498a496398f240bff8820", "score": "0.83081275", "text": "def destroy\n @message = authenticate!.messages.find_by(id: message_params[:id])\n if @message\n @message.destroy\n render json: success('Delete Success', 202), status: 202\n else\n render json: error(...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "435e1fb05fc516ea581d98f21d079ef4", "score": "0.0", "text": "def cryptos_tracker_params\n params.require(:cryptos_tracker).permit(:symbol, :user_id, :cost_per, :amount_owned)\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...
665df4869e4a54b6822e4c8b2eef9b6b
PUT /itinerarios/1 PUT /itinerarios/1.xml
[ { "docid": "e3ce8064b29b2ab8ed3e86897b81732a", "score": "0.6709361", "text": "def update\n @itinerario = Itinerario.find(params[:id])\n\n respond_to do |format|\n if @itinerario.update_attributes(params[:itinerario])\n format.html { redirect_to(@itinerario, :notice => 'Itinerario was s...
[ { "docid": "b44fcca808470030b0d4a8ca0e32b4b7", "score": "0.67482156", "text": "def update\n @estagiarios = Estagiario.find(params[:id])\n\n respond_to do |format|\n if @estagiarios.update_attributes(params[:estagiario])\n flash[:notice] = 'ESTAGIÁRIO SALVO COM SUCESSO.'\n format...
b7e6cd78214f670d49b35dbdc6fd2704
GET /stockroom_removals/1 GET /stockroom_removals/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "8a232b45f90a0da381f3afb9fc651bcc", "score": "0.67641926", "text": "def destroy\n @stockroom_removal.destroy\n respond_to do |format|\n format.html { redirect_to stockroom_removals_url, notice: 'Stockroom removal was successfully destroyed.' }\n format.json { head :no_content ...
e60e151fb544266a13f7a96a30dfbcc1
TIME_COMPLEXITY = n! space_complexity = n
[ { "docid": "5677c2b1ff8b3433e04918dfe14d9470", "score": "0.0", "text": "def second_anagram?(string1, string2)\n return false if string2.length < string1.length\n string1.chars.each do |letter|\n string2.each_char.with_index do |letter2, idx|\n if letter == letter2\n string2[idx] = \"\"\...
[ { "docid": "030234aef0ea3f2c4e2d26b18bf76b15", "score": "0.59061503", "text": "def bench n\n t = Time.now\n n.times{ yield }\n cost = Time.now - t\n\n t = Time.now\n n.times{}\n baseline = Time.now - t\n\n cost - baseline\nend", "title": "" }, { "docid": "ac6944a7d6c29e5efc89131ce2dc3...
4b31d1df48097ff63e39dbaa0ededdf3
Returns the righthand sibling
[ { "docid": "b6af940827dd7f75031bf6d34c892323", "score": "0.0", "text": "def right\n nested_set.first :conditions => { :lft => rgt + 1 }\n end", "title": "" } ]
[ { "docid": "f42ed38b8631d640badcf2b13aca83a9", "score": "0.7921706", "text": "def next_sibling()\n #This is a stub, used for indexing\n end", "title": "" }, { "docid": "f42ed38b8631d640badcf2b13aca83a9", "score": "0.7921706", "text": "def next_sibling()\n ...
e04aeab591d5d9c08b44d85da62dc0a9
Why does the following code...
[ { "docid": "555266b90d8f22685d7d597108d7aba2", "score": "0.0", "text": "def execute(block)\n block.call\nend", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.6447258", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.6268393", "text": "def probers; end", "title": "" }, { "docid": "8742865b78eb755e40bb1bff22199433", ...
043e78e25082b3e72ab62998d1080fae
could be better but this isn't horrible I guess
[ { "docid": "00b02dc988275170d2758d177be79e80", "score": "0.0", "text": "def winner(left, right)\n if (WINNERS[left] == right)\n left.to_s.capitalize\n else\n right.to_s.capitalize\n end\n end", "title": "" } ]
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.6113009", "text": "def desired; end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.6103497", "text": "def anchored; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", ...
5b9841c168efef0a4a3db25e55c644a6
Get the root path of the application, optionally passing in additional folders to be joined and expanded e.g. PathUtils.root 'db', 'migrate' => /path/to/loudmouth/db/migrate
[ { "docid": "574715e492d31f3aaf41df2e30169c12", "score": "0.726847", "text": "def root *folders\n File.expand_path(File.join(*([app_root, folders].flatten.uniq.tap{|path| path.delete(nil) })))\n end", "title": "" } ]
[ { "docid": "7ebd4375b07f6b3196d1d87fff6c00f2", "score": "0.76857024", "text": "def root_path(*args)\n relative = File.join(*args)\n return relative if relative.expand_path == relative\n root.expand_path / relative\n end", "title": "" }, { "docid": "7ebd4375b07f6b319...
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "9e74132e304cccb4e79ff5487a764e47", "score": "0.0", "text": "def destroy\n @user.destroy\n respond_to do |format|\n format.html { redirect_to root_path, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "be9d8ff5c0124f1d5efc98ec2baa3fc1", "score": "0.7590564", "text": "def test_delete_user\n delete '/users/2'\n data = JSON.parse last_response.body\n\n assert_equal 'Daniel', data['name'], 'Propiedad name incorrecta'\n assert_equal 'Arbelaez', data['last_name'], 'Propiedad last_nam...
23e95b7b2f204bff7d3eaa8a199ec544
short fat L rotate piece 180
[ { "docid": "1f26e2f3d1d811fb2179d5e036dfdd7b", "score": "0.70223504", "text": "def rotate_180\n # Ensures that the flip will always be a possible formation (as opposed \n # to nil) by altering the intended coordinates so that it stays \n # within the bounds of the rotation array\n moved = tr...
[ { "docid": "54ebfe6e239f23e37e6fefcb9686e1a8", "score": "0.7870637", "text": "def rotate_180!; end", "title": "" }, { "docid": "37ebc410b144baa8c4cf7fcfe6c55cdd", "score": "0.7748208", "text": "def rotate_180; end", "title": "" }, { "docid": "092053975b105f94ff08b7dd99637...
611d0625b60f6813fb8e7a150f49902c
Return a role details for a specific role type running on this host
[ { "docid": "b7dae5d074b7b592772250cc542d87bd", "score": "0.7241687", "text": "def role_of_role_type(cmhost, service_type, role_type)\n cmhost[:roles].find do |_, v|\n v[:serviceType] == service_type && v[:roleType] == role_type\n end\n end", "title": "" } ]
[ { "docid": "4f9b38b5c8de232d683b201cb8f2c36a", "score": "0.731373", "text": "def type\n self[:role]\n end", "title": "" }, { "docid": "4e101a1f09337f279f710556fa355e2f", "score": "0.72257555", "text": "def role(type)\n ENUM[:roles].each {|role| return role if role[:name].downc...
63682d64f80fcbfa0641691697dfda7f
initializes provided api_key headers and base uri should not change
[ { "docid": "abb746b491c6792e442444a88bc27cf3", "score": "0.74503994", "text": "def initialize(api_key)\n\t\t\t@api_key = api_key\n\t\t\t@headers = {\"Accept\" => \"application/JSON\", \"user-key\" => @api_key}\n\t\t\t@base_uri = \"https://developers.zomato.com/api/v2.1/\"\n\t\tend", "title": "" } ...
[ { "docid": "ea31a03739e368af3306a829f0679432", "score": "0.7988136", "text": "def initialize(api_key, base_url)\n @api_key = api_key\n @base_url = base_url\n @headers = {\n 'X-Cachet-Token' => @api_key,\n 'Content-Type' => 'application/json'\n }\n end", "title": "" }, { ...
0afb35cbad2b599affc466723ca7ef30
I just kind of arbitrarily picked this because all the empty images I saw were < 1000 bytes
[ { "docid": "ce35badb4c2a8212b6eb0856842bfc8a", "score": "0.5446044", "text": "def better?(new_image)\n image.size < MIN_GOOD_IMAGE_SIZE &&\n new_image.size > image.size\n end", "title": "" } ]
[ { "docid": "af59c69684d340a00149e10c19f5f447", "score": "0.6285769", "text": "def test_07b\r\n db = build\r\n db.fetch('image-1.jpg',:width => 102)\r\n assert_equal 6,db.images.size\r\n assert_equal 1,db.image('image-1.jpg')[:widths].size\r\n r = db.delete('image-1.jpg',:width => 102)\r\n...
09430eda00cb850f48ac0013ae059530
Check to see that the nick as provided during the registration process matches the authenticated campfire user. If the nicks don't match, send a nick change to the connected client.
[ { "docid": "db91d0befa1575864936fb7e35348017", "score": "0.8271298", "text": "def check_nick_matches_authenticated_user\n campfire.user(\"me\") do |user|\n name = irc_name user.name\n if name != nick\n user_reply :nick, name\n @nick = name\n end\n end\n ...
[ { "docid": "ae8b7706d50dff533aca256e3b805929", "score": "0.68145055", "text": "def nickserv?(botuser)\n if botuser.respond_to? :registered # this is not part of official rbot atm.\n botuser.registered\n else\n false\n end\n end", "title": "" }, { "docid": "3589bdd9056b3cd...
f809625b8598b0d3763ab12f2ca57149
Sleep In The parameter weekday is True if it is a weekday, and the parameter vacation is True if we are on vacation. We sleep in if it is not a weekday or we're on vacation. Return True if we sleep in. sleep_in(False, False) > True sleep_in(True, False) > False sleep_in(False, True) > True
[ { "docid": "ecd91a06a8547ca61a3c934cf308430f", "score": "0.7102728", "text": "def sleep_in(weekday, vacation)\n # Please write your code in here\nend", "title": "" } ]
[ { "docid": "9b3b537dd619479c145244d8fafcda35", "score": "0.76963085", "text": "def sleep_in?(weekday, vacation)\n\tif !weekday || vacation\n\t\treturn true\n\tend\n\treturn false\nend", "title": "" }, { "docid": "cef45244f2a7b42f5ccfd8df29b63697", "score": "0.72281677", "text": "def ...
32122ccdf285ad6761e58f203b725740
PATCH/PUT /forums/1 PATCH/PUT /forums/1.json
[ { "docid": "c4ce68167bc34bdd059a61bc9ab0efd3", "score": "0.68533546", "text": "def update\r\n @forum = Forum.find(params[:id])\r\n respond_to do |format|\r\n if @forum.update(forum_params)\r\n\r\n format.json { render :show, status: :ok, location: @forum }\r\n else\r\n\r\n ...
[ { "docid": "92cdb4c8c91d107fafe2a220eeb86220", "score": "0.6840303", "text": "def update\n respond_to do |format|\n if @forum.update(forum_params)\n format.html { redirect_to @forum, notice: I18n.t(\"forums.updated_success\") }\n format.json { render :show, status: :ok, location: @...
a90953de25b432e424f64119db4c097e
Called from current_user. Now, attempt to login by basic authentication information.
[ { "docid": "b9f97e3fcbc4f9acf6e544245c01b6b2", "score": "0.79081744", "text": "def login_from_basic_auth?\n username, passwd = get_auth_data\n if username && passwd\n set_session_user User.authenticate(username, passwd)\n end\n end", "title": "" } ]
[ { "docid": "eec7247d5f949c01aa0a492e245d1333", "score": "0.85675675", "text": "def login_from_basic_auth\n username, passwd = get_auth_data\n self.current_user = User.authenticate(username, passwd) if username && passwd\n end", "title": "" }, { "docid": "734f79e3e2ce85c229...
16e098d12fa2252e5384b3b45131e681
Has the job started?
[ { "docid": "58d6bfb2dd046d38ffacbc2208f80e5d", "score": "0.7183085", "text": "def started?\n return @actual_start_time != nil\n end", "title": "" } ]
[ { "docid": "8941ed4dbe82f020325e50fe17185512", "score": "0.77718776", "text": "def running?\n @started\n end", "title": "" }, { "docid": "8fda23e13f563b82860b0b1076372ada", "score": "0.7751229", "text": "def started?\r\n @started\r\n end", "title": "" }, { ...
60a26645ce4bc461e5b7cfb2c6975c19
This is commented out, so the minimize menu item is disabled def on_minimize(menu) end window/zoom
[ { "docid": "cde71cdeb53cdf21f50ca7b9577c2f7c", "score": "0.62851954", "text": "def on_zoom(menu)\n end", "title": "" } ]
[ { "docid": "39f5f9ce456cba522feabbc7372e67ae", "score": "0.8803367", "text": "def on_minimize(menu)\n end", "title": "" }, { "docid": "39f5f9ce456cba522feabbc7372e67ae", "score": "0.8803367", "text": "def on_minimize(menu)\n end", "title": "" }, { "docid": "7222ad74cd9f...
22100eccafb4716fe1fb18863a5ad786
Accept a membership request (instance method).
[ { "docid": "4a20ca9c4acf83b6b8cf11db0e72f650", "score": "0.63214767", "text": "def accept\n Membership.accept(dog_id, group_id)\n end", "title": "" } ]
[ { "docid": "abb601c646a8db876a92f2447a50296c", "score": "0.6846305", "text": "def accept\n Membership.accept(user_id, group_id)\n end", "title": "" }, { "docid": "c03934ebf5cedfc46b5c2e578dba6d6c", "score": "0.6297061", "text": "def accept_invite\n group = Group.find(params[:g...
5035354e31682d8ed0baf528ed344c56
Returns a string representing this marker Used by the Map when building url.
[ { "docid": "e50a603f7c432170afddf6d14dcd2117", "score": "0.0", "text": "def options_to_url_params # :nodoc:\n params = DEFAULT_OPTIONS.keys.map(&:to_s).sort.inject([]) do |params, attr|\n primary_getter = \"#{attr}_to_be_used_in_param\"\n secondary_getter = attr\n\n value = sen...
[ { "docid": "081ff5610f904f4b7e0c16d575ddac57", "score": "0.7030308", "text": "def gen_marker(marker)\n marker.lat object.latitude\n marker.lng object.longitude\n link = h.link_to object.title, object\n info = \"#{link}<br>#{short_details}\"\n marker.infowindow info\n end", "title": "...
e9a2a0a1a63a0202b8475f8c5d68c54c
POST /offsets POST /offsets.json
[ { "docid": "e96344f06a80544d59d61a9378de8d54", "score": "0.6449599", "text": "def create\n\t\turi = URI.parse(Counter::Application.config.simplyurl)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\t\n\t\trequest = Net::HTTP::Post.new('/offsets.json')\n\t\tputs params\n\t\tputs params.slice(*['custids'...
[ { "docid": "c0849fd23d6947c6a973cdd93609bb66", "score": "0.6329939", "text": "def commit_offsets!\n commit_offsets(async: false)\n end", "title": "" }, { "docid": "284a9f1b7e90c81340b83cf903a1baa8", "score": "0.6196934", "text": "def list_offsets(**options)\n request...
6cd65f4ed032cfea512930b1a7d6c11a
Loop to browse other users poem
[ { "docid": "2e479496c6c4a944a172584287db6963", "score": "0.0", "text": "def loop_zap(pplog)\n loop do\n p pplog.zapping\n sleep 12\n end\nend", "title": "" } ]
[ { "docid": "f4d295a6d6da4671ad4b8b56dbc8927e", "score": "0.5573189", "text": "def main()\n\tgroups = []\n\tputs '<openbox_pipe_menu>'\n\tget_pids().each do |pid|\n\t\tprocess = ProcessInfo.new(pid)\n\t\tadd_to_group(groups, process)\n\tend\n\t\n\tusers = []\n\tgroups.each do |group|\n\t\tusers << [group...
86abed7bc9cb3f069c7253fc00a955c4
Saves the footnote indicator of a payer Output : result : result of validation or updation error_message : cause for the error
[ { "docid": "9bfc05e95f75f86b6f99fd3e81290c89", "score": "0.66196567", "text": "def process_footnote_indicator\r\n footnote_indicator_successfully_updated = true\r\n footnote_indicator_to_be_assigned, tried_to_change_footnote_indicator = footnote_indicator_after_reasoncode_cleanup(params[:payer_foo...
[ { "docid": "2d927d327af67c4ebfe76b28025d90f3", "score": "0.62404627", "text": "def save_payer\r\n result = true\r\n error_message = nil\r\n old_payid = @payer.supply_payid\r\n old_footnote_indicator = @payer.footnote_indicator\r\n old_setname = @payer.reason_code_set_name.name unless @pay...
723fc37d33aecdb1fe1366588a01f1c1
Imprime encabezado de pagina web SIN cookie.
[ { "docid": "d1db88ac35017b7430946872b2861eda", "score": "0.0", "text": "def inicio\n cadena = 'Content-Type: text/html; charset=utf-8\\n\\n'\n cadena << '<!DOCTYPE html>'\n cadena << \"<html lang='es'>\"\n end", "title": "" } ]
[ { "docid": "f5ff28e95484fc8803f81eef5bbee76f", "score": "0.5907952", "text": "def sign_in_static_cookie\n cookies[:fulcrum_signed_in_static] = true\n end", "title": "" }, { "docid": "080c349b5d481393222beb3c681cd497", "score": "0.57700276", "text": "def sign_in identity\n ...
7cfa3107b74854130fe7fd6bd2ac237b
Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/chat.rb74
[ { "docid": "84c2aa104b8a70acbe3f11eca76559b3", "score": "0.0", "text": "def to_s; end", "title": "" } ]
[ { "docid": "689202b8c570aabcbfb5307dc09210f4", "score": "0.69484586", "text": "def to_s\n '<Twilio::REST::Chat::V3>';\n end", "title": "" }, { "docid": "2f1f121c481a49f24026198a9478fc9e", "score": "0.6588045", "text": "def to_s\n '<Twilio::R...
85734a845437f0dbeb21f3cfcd62c8d3
Establish connection to each of application's adapters
[ { "docid": "38f80575a785441dbbe0abd39a5e77e9", "score": "0.0", "text": "def connect\n false\n end", "title": "" } ]
[ { "docid": "f47c4473ccd58ae150bc17308602b0ba", "score": "0.7124214", "text": "def adapters\n setup\n @adapters\n end", "title": "" }, { "docid": "f3c85bd6d382023f07b5de0dc5c6eeb8", "score": "0.68407637", "text": "def connect_all\n self.class.addresses(@options[:host...
3d39ad73d1ef7adee96ed688882af8a1
to determine sheet ID in range
[ { "docid": "1bcbbe0be1d4b9fe39f8f152367a1bac", "score": "0.0", "text": "def get_day(timeslot)\n return timeslot.starttime.strftime(\"%d\").to_i\nend", "title": "" } ]
[ { "docid": "69d9dd839173b63f2242403e55d3c6a8", "score": "0.7514566", "text": "def worksheet_id(sheet_name)\n @spreadsheet.worksheets.tap { |sheets|\n @logger.debug(\"==== Worksheets ====\")\n @logger.debug([' [Sheet Name]', '[Sheet ID]'].join(\" \"))\n sheets.each { |x| @logger.debug(...
b2ff535b1b6f085c75af94ef6c8fa8af
List Item Transactions Retrieve an ordered and paginated list of Transactions associated with the Item using a given &x60;:id&x60;.
[ { "docid": "5d3d5253ea680a242dcad1c2ad656487", "score": "0.67653376", "text": "def list_item_transactions_with_http_info(id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ItemsApi.list_item_transactions ...'\n end\n # verify the requir...
[ { "docid": "35c0e22e18366386d5a0751f2bfd4fde", "score": "0.7663678", "text": "def list_item_transactions(id, opts = {})\n data, _status_code, _headers = list_item_transactions_with_http_info(id, opts)\n data\n end", "title": "" }, { "docid": "26aa0008c4dc963c853a97cf7be7bb1b", ...
74ccda4c7cd318c1c34cc7fef221053e
send notification in english to this address
[ { "docid": "4cda09ba1622de1c607882c13324120b", "score": "0.7066022", "text": "def notify_english(dest)\n mail(dest, ENGLISH_SUBJECT, mail_content(english_model_file))\n end", "title": "" } ]
[ { "docid": "ab1e2376238e8fe7d048c1aa2f3df4f2", "score": "0.64111954", "text": "def notify_french(dest)\n mail(dest, FRENCH_SUBJECT, mail_content(french_model_file))\n end", "title": "" }, { "docid": "bcafb994c1c51ad063607afeb76708f0", "score": "0.6263988", "text": "def te...
95c608c9827a4f98dfee59a9319a9a57
Returns true if the template with the given name is a template or not. In other words it cannot be a TemplatedPage.
[ { "docid": "0e8af7497c0a1565e991104f1ae9e826", "score": "0.90368193", "text": "def is_a_template?(name)\n if template_exists?(name)\n return @pages[name].is_a?(PageTemplate)\n else\n puts \"Warning: cannot check if the template #{name} is a page because \" \\\n + \"it doesn't exi...
[ { "docid": "a56d40775fa95d5390497b3e924e2762", "score": "0.8143779", "text": "def is_a_page?(name)\n if template_exists?(name)\n return @pages[name].is_a?(TemplatedPage)\n else\n puts \"Warning: cannot check if the page #{name} is a page because it \" \\\n + \"doesn't exist in th...
dc211ac48fa59735baac7955457be367
Linkable grab what will be used when organizing
[ { "docid": "efa8ceda3d271c66a0155fc29930d89b", "score": "0.57902014", "text": "def linkable\n\t\tself\n\tend", "title": "" } ]
[ { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.7137149", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "score": "0.7137149", "text": "def links; end", "title": "" }, { "docid": "e3c3425418f5bf8d50f24f776bab404b", "...
a91a78cabf28d1e294cae77267b69bca
Ask for a password Check password length for looping Check for letter 'z' edge case Loop through password using index, getting index in alphabet string corresponding to password letter if letter 'z' change letter at index to 'a' Change password by advancing each letter one letter forward using index Return encryped pas...
[ { "docid": "155de068151f52bee7e8b04ad1079850", "score": "0.7897026", "text": "def encrypt(password)\nalphabet = \"abcdefghijklmnopqrstuvwxyz\"\nindex = 0\nwhile index < password.length\n\t#get letter of password at index\n\tletter = password[index]\n\t#get index number of same letter in alphabet string....
[ { "docid": "fefd2ee4c35b568d575b2df49e3b4265", "score": "0.8017606", "text": "def encrypt(password)\nindex = 0\nwhile index < password.length\n str = \"zabcdefghijklmnopqrstuvwxyza\"\n current_letter = password[index]\n # For password \"hello\", expect first current2_letter to be \"h\"\n # Find the ...
0fc6a85722ea59061c6a2f0b15f7ea05
GET /post184s/new GET /post184s/new.xml
[ { "docid": "f5bd47aef312de0ecbacb3ae3b599086", "score": "0.74480474", "text": "def new\n @post184 = Post184.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post184 }\n end\n end", "title": "" } ]
[ { "docid": "3955ab2d0300694b27c7bd5052db9318", "score": "0.74024093", "text": "def new\n @post181 = Post181.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @post181 }\n end\n end", "title": "" }, { "docid": "76d96b42e1cda75c5cf72...
28f1881ed4e4182119bfa69804e2b850
DELETE /sp_resources/1 DELETE /sp_resources/1.json
[ { "docid": "dd28d3e1a88c9bb835fba6d92785ccca", "score": "0.7924454", "text": "def destroy\n @sp_resource = SpResource.find(params[:id])\n @sp_resource.destroy\n\n respond_to do |format|\n format.html { redirect_to sp_resources_url }\n format.json { head :no_content }\n end\n end",...
[ { "docid": "174b723f9e43bfa7501a9cdc389e4c1b", "score": "0.73459846", "text": "def delete\n @response = self.class.delete(\"#{@server_uri}/resource_name/#{@opts[:id]}.json\")\n end", "title": "" }, { "docid": "f0e82ff26734819737f904269816e3ca", "score": "0.72216505", "text": "def...
d3d80be1db8912fae8af69c29441fa23
native checked? only works with checkboxes/radio. sometimes we have input as checkbox
[ { "docid": "3c1c1c1d3413cba2b1ce67e0a995ed98", "score": "0.6604164", "text": "def checked?\n element_state = @driver.execute_script(\"return $('#{@locator[:css]}').is(':checked');\")\n if element_state\n true\n else\n false\n end\n end", "title": "" } ]
[ { "docid": "ec3eaa840cf48bd09ba34290ab2df5c9", "score": "0.8130945", "text": "def checked\n\n end", "title": "" }, { "docid": "a334f9bf38bee4f633402a6473e50ebe", "score": "0.7968479", "text": "def checked?\n `return #{self}.__element__.checked ? #{true} : #{false};`\n end", ...