query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
176289defc2586b7cb851643874660db
DELETE /products/1 DELETE /products/1.json
[ { "docid": "17b1b084808853ff73a25c2733bcab53", "score": "0.0", "text": "def destroy\n @product.destroy\n respond_to do |format|\n format.html { redirect_to products_url, notice: 'Product was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "2fa0a3656e86962ca1a10fa31aede189", "score": "0.7657799", "text": "def destroy\n @productos_json.destroy\n respond_to do |format|\n format.html { redirect_to productos_jsons_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "65950...
2899dc2502ce75ccd937db9c125145de
reduce 333 omitted reduce 334 omitted
[ { "docid": "0ee9f90f209560cab94f5c439d16be17", "score": "0.0", "text": "def _reduce_335(val, _values, result)\n result = [ @builder.arg_expr(val[0]) ]\n \n result\nend", "title": "" } ]
[ { "docid": "3944f56d0d810f8952a9fd577beb2161", "score": "0.760345", "text": "def reduce\n \n end", "title": "" }, { "docid": "bcc77ea412992f9c87aad138efd40a40", "score": "0.7564575", "text": "def _reduce_236(val, _values, result)\n result = nil\n ...
a1ecba07a88c7a1ce9966fb12ea9015a
if sender/receiver are valid AND sender balance > transfer amount AND status "pending" => then ==> remove amount from sender account / add to receiver account / change status "complete" => else ==> reject the transfer
[ { "docid": "47be4571da0d771fc83b3c032cf5fe17", "score": "0.8109854", "text": "def execute_transaction\n if valid? && sender.balance > amount && self.status == \"pending\"\n sender.balance -= amount\n receiver.balance += amount\n self.status = \"complete\"\n else\n reject_transf...
[ { "docid": "845c2c23e14dcdf7c31eb4e78ff17074", "score": "0.8225943", "text": "def execute_transaction\n if valid? && sender.balance > amount && self.status == \"pending\"\n sender.balance -= amount\n receiver.balance += amount\n self.status = \"complete\"\n else\n reject_transfer\n end\ne...
efabfb082fd39fe6e1c03c85c6f74e67
used to construct an appropriate error message based on the specific type of error and the error's attributes
[ { "docid": "6d65bf3e928e7c7a046da9d9ffa7ad16", "score": "0.6565473", "text": "def error_message(e = $!)\n case e\n when Error::UnwantedToken\n token_name = token_name(e.expecting)\n \"extraneous input #{token_error_display(e.unexpected_token)} expecting #{token_name}\"\n when Error::M...
[ { "docid": "4142737c160441fffec838adcfa62729", "score": "0.7100158", "text": "def build_error_message(attribute, error_code, detail)\n display = I18n.t(\n error_code,\n scope: [:errors, :validations],\n locale: :api,\n default: \"#{parameter(attribute).titlecas...
0e7a9a533461c15afff49963f29a18a6
PATCH/PUT /check_list_items/1 PATCH/PUT /check_list_items/1.json
[ { "docid": "1ba2642a63a26c138c6b2923fab0f30d", "score": "0.74379253", "text": "def update\n respond_to do |format|\n if @check_list_item.update(check_list_item_params)\n format.html { redirect_to @check_list_item, notice: 'Check list item was successfully updated.' }\n format.json ...
[ { "docid": "8da390ebf50cadf581ebe8a65e358c8b", "score": "0.7486639", "text": "def update\n respond_to do |format|\n if @api_v1_checklist_item.update(api_v1_checklist_item_params)\n format.html { redirect_to @api_v1_checklist_item, notice: 'Checklist item was successfully updated.' }\n ...
da37af5294c7a85d026de66b4d46c586
Returns the first word from a string
[ { "docid": "41f70bba06a8cf2369dddb2cffa8dee6", "score": "0.8208533", "text": "def first_word(words)\n\twords.split(\" \")[0]\nend", "title": "" } ]
[ { "docid": "47058bcc9a9ed92ad4d2a144541203ed", "score": "0.9254696", "text": "def first_word(str); str.split.first end", "title": "" }, { "docid": "79ddfa9148a451241da169432ae9b25d", "score": "0.9093187", "text": "def first_word(string)\n\tstring.split(\" \")[0]\nend", "title": "...
113f3961991d3e08cf3cfcb3e7853ff2
in mempory expense db
[ { "docid": "a52b5aab09ec69df72dd7227369cda7c", "score": "0.0", "text": "def add(id, description, users, paid_by, group_id, amount,split_strategy)\n expense = Expense.new(id, description, users, paid_by, group_id, amount,split_strategy)\n expense.split(equal)\n end", "title": "" } ]
[ { "docid": "ffb55cb6d7c67da3097bb556b290f126", "score": "0.6743751", "text": "def add_expense(database, expense_name, dollars_spent, expense_date, expense_category)\n database.execute(\"INSERT INTO moneys (expense_name, dollars_spent, expense_date, expense_category) VALUES (?, ?, ?, ?)\", [expense_name...
99e64f795e69070abbe79c76e3590552
returns a string that can be use to launch a calabashios console that is configured using the opts hash ios_console_cmd('neptune') => a command to launch an irb against neptune
[ { "docid": "cce8014610037e7186358098b12f6bfe", "score": "0.6615045", "text": "def ios_console_cmd(device, opts={})\n default_opts = default_console_opts()\n opts = default_opts.merge(opts)\n\n env = [\"SCREENSHOT_PATH=#{screenshot_path}\"]\n\n logging_level.each { |key,value|\n env << \"#{key}=#{...
[ { "docid": "ea6ce3fa7c144bd44424674d5d0bdb8c", "score": "0.6540903", "text": "def console(device, opts={})\n\n ### unexpected ###\n # do not be tempted to use IRB.start\n # this can cause some terrible problems at > exit\n ##################\n default_opts = default_console_opts()\n opts = default...
4b192a5b72c082e0eded0f9858b3411b
before_action :doorkeeper_authorize! requires access token for all actions GET /employees
[ { "docid": "469c5150223d3b1eaf8715d1319bea76", "score": "0.0", "text": "def index\n @employees = Employee.all\n\n render json: @employees\n end", "title": "" } ]
[ { "docid": "8b2bfc210672eb473f736ece2855f5a7", "score": "0.7146472", "text": "def authorize_request\n return true if doorkeeper_token.present?\n\n render_error(errors: 'token is invalid, expired or has been revoked', status: :unauthorized)\n end", "title": "" }, { "docid":...
d953bf148ee4b5e463dd74f43f82dd4f
Return a relation that is a restricted cartesian product
[ { "docid": "59a27198448f0aa50313a7e13a9bb4de", "score": "0.592387", "text": "def theta_join(other)\n product(other).restrict { |relation| yield relation }\n end", "title": "" } ]
[ { "docid": "8aaedc33301bd9f66ece872ef1ff1186", "score": "0.64525926", "text": "def dualRelation(relation)\n dualRel = Relation.new(relation.set, \"dual-\"+relation.definition)\n relation.r.each do |k, v|\n v.each do |val|\n dualRel.relateElements(val, k)\n end\n end\n dualRel\nend", "...
d3535ecad30b15ef2a86e436cd5a0ec5
gets number of charities in databse (returned by the get_array method) and counts number of each category each is set as a session
[ { "docid": "7c0124bf2d7895a7774c361f68a63aae", "score": "0.7705197", "text": "def set_count_category_total\n countA = 0\n countB = 0\n countC = 0\n countD = 0\n countE = 0\n\n User.get_array.each do |r|\n if User.find_category(r) == 'A'\n countA = countA + 1\n elsif User.find_category...
[ { "docid": "cd10d1edd4aea84def600396b0a56415", "score": "0.7515671", "text": "def num_charities\n session[:num_charities] = User.get_array.count()\nend", "title": "" }, { "docid": "b840bb6184ec563054a4386272ca5fa7", "score": "0.721138", "text": "def set_research_count_category\n co...
60d0906c6d63103a497a06caf2fac99b
GET /scripts/1 GET /scripts/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "f2c6107c26d768153ccf4fa74f75df16", "score": "0.72908175", "text": "def show\n script = Script.find(params[:id])\n render json: script\n end", "title": "" }, { "docid": "9b076b9d31771e9b11f27cfae204db76", "score": "0.6547081", "text": "def show\n @script = Script...
211111413a2395b05214f17b6f9f9d46
Moves roles to the specified role config group. The roles can be moved from any role config group belonging to the same service. The role type of the destination group must match the role type of the roles.
[ { "docid": "94aa8f002a66e555ca502df53a6c1286", "score": "0.6912355", "text": "def move_roles(service_name, name, role_names, cluster_name = 'default')\n call_resource(@_resource_root.method(:put), _get_role_config_group_path(cluster_name, service_name, name) + '/roles', ApiRole, true, role_names,...
[ { "docid": "9ee39946aa64110d71f2d01ce06c0311", "score": "0.6591493", "text": "def move_roles_to_base_role_config_group(service_name, role_names, cluster_name = 'default')\n call_resource(@_resource_root.method(:put), _get_role_config_groups_path(cluster_name, service_name) + '/roles', ApiRole, tr...
bfefb5084a676b4e084ae3e62225b4d9
Returns the passed ical frequency value as an IceCube Schedule instance
[ { "docid": "73ffe954c3aca182701a5a93dc57c1c7", "score": "0.80065215", "text": "def to_frequency(value)\n IceCube::Schedule.from_ical(value) if value.present?\n end", "title": "" } ]
[ { "docid": "7060b12e30411d572a2ecff91ade3fcb", "score": "0.70170647", "text": "def schedule\n \"#{frequency_quantity} #{frequency_type.name.pluralize} at #{execution_time}\"\n end", "title": "" }, { "docid": "bc089faa36c3c116d796b0b39fdec4db", "score": "0.5953933", "text": "def m...
bc6d7932971572e3f6823f143d07da65
POST /template_models POST /template_models.json
[ { "docid": "70e20f38b31c682f17d61ec13bd874f5", "score": "0.6529743", "text": "def create\n @template_model = TemplateModel.new(template_model_params)\n\n respond_to do |format|\n if @template_model.save\n format.html { redirect_to @template_model, notice: 'Template model was successful...
[ { "docid": "28fd88cac0ddc4b856310ce80d994640", "score": "0.6570762", "text": "def create(model)\n response = connection.post url_for(:all), model.to_json\n handle_and_unpack_response(response, 201)\n end", "title": "" }, { "docid": "ffe2de2ea939e29fe616c0ce90bfc108", "score"...
3b76b262f52fbe8bb2b87eae3b4561a5
Time Complexity: O(nlog(n)) Space Complexity: O(n)
[ { "docid": "72acef635bab81840dbbb8c30fa1acc1", "score": "0.5890716", "text": "def sorted_squared_array_n_nlogn(values)\n values.collect!{|val| val*val}\n merge_sort(values)\nend", "title": "" } ]
[ { "docid": "5944c445a0d5d1383cd670cc84d3fc3b", "score": "0.6908748", "text": "def find_dublicate(array)\n sum = 1000000*(1000000+1)/2 # (n*(n+1))/2\n array.each do |el| \n sum -= el\n end\n return sum\nend", "title": "" }, { "docid": "2481cbf165330db256eee896a32c82e4", "score": "0...
c5155adb92bb829c284dbd7d4848baef
GET /bids/new GET /bids/new.xml
[ { "docid": "35c6e10364fde9d64809993d20f55522", "score": "0.7173721", "text": "def new\n @bid = Bid.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end", "title": "" } ]
[ { "docid": "cb4367701293151c3e552d5710d2f4f7", "score": "0.76390904", "text": "def new\n @bid = @swarm_request.bids.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @bid }\n end\n end", "title": "" }, { "docid": "2255faa73974ccdb4...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "3f633d1a56b282f45bd322b8e8bd8678", "score": "0.0", "text": "def content_params\n params.require(:content).permit(:body, :content_type_id, :sort_order)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981606", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6784227", "text": "def strong_params\n params.requi...
c097fa806f660e4831f2ea5826eac068
POST /nextevaluationnotes POST /nextevaluationnotes.json
[ { "docid": "0818dbd93aeb4604a7cd54a71fe01dd1", "score": "0.742983", "text": "def create\n nextevaluationnote = Nextevaluationnote.new(nextevaluationnote_params)\n if nextevaluationnote.save\n render json: {'success': 'nextevaluationnote saved'}\n else\n render json: {error: 'unauthori...
[ { "docid": "47ef1834244c85bc4be624b274818c6a", "score": "0.68788934", "text": "def nextevaluationnote_params\n params.require(:nextevaluationnote).permit(:nnote, :nnote_date, :client_id)\n end", "title": "" }, { "docid": "f7e94fa546afc755bb51bcad7eadd2f0", "score": "0.6647232", ...
b823034c184eae2bbe7798fade96975d
Makes sure user isn't submitting a payment for someone that they don't owe anything.
[ { "docid": "64eace8de1f67204e9eda5979604be7b", "score": "0.0", "text": "def do_you_owe_checker (record)\n\t\tRegister.register_for_payment(record.receiver_id, record.user_id).first.nil?\n end", "title": "" } ]
[ { "docid": "e1f8b14177891f6989947de416f29ebd", "score": "0.71119016", "text": "def user_must_pay?\n !journal_will_pay? &&\n !institution_will_pay? &&\n (!submitter_affiliation.present? || !submitter_affiliation.fee_waivered?)\n end", "title": "" }, { "docid": "2b511c628...
b15f9dfe8c4cdef46f6c4f3e4612aeeb
DELETE /alien_numerals/1 DELETE /alien_numerals/1.json
[ { "docid": "3f576aa76ede2375e8afa44c0a86fd76", "score": "0.7364527", "text": "def destroy\n @alien_numeral.destroy\n respond_to do |format|\n format.html { redirect_to alien_numerals_url, notice: 'Alien numeral was successfully destroyed.' }\n format.json { head :no_content }\n end\n ...
[ { "docid": "09fc2820d9479cac0697e20c559268bf", "score": "0.74513596", "text": "def delete\n render json: Alien.delete(params[\"id\"])\n end", "title": "" }, { "docid": "179ff0053e8f4f967cb3d92206094cf0", "score": "0.6928277", "text": "def delete_aos_version(args = {}) \n delete(\...
47e730da5562374ad8db23659c38b86d
Create hash with a count for each element, verify they are all 1.
[ { "docid": "4b6e5ebfb19ce2d82a683ea3a762566a", "score": "0.0", "text": "def alternate_1(str)\n cnts =\n str.chars.inject(Hash.new(0)) { |hsh, c| hsh[c] += 1; hsh }.values.uniq\n\n cnts.length == 1 && cnts.first == 1\n end", "title": "" } ]
[ { "docid": "222b9ab52cbee367fb044f82762b2952", "score": "0.6929781", "text": "def check_repeating_values\n hand.each_with_object(Hash.new(0)) do |card, hash|\n hash[card.value] += 1\n end\n end", "title": "" }, { "docid": "b02741d223bb26adc4e5ee05d5040d96", "score": "0.675517...
04a7da6372eee9bb131fd47fb16bd0dd
DELETE /vehiculos/1 DELETE /vehiculos/1.json
[ { "docid": "d56653ce35496f10dc6c13366184c326", "score": "0.7274239", "text": "def destroy\n @vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to vehiculos_url, notice: 'Vehiculo eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "title":...
[ { "docid": "104e0ea41687c6db51cfccc9dc431cef", "score": "0.73705745", "text": "def destroy\n @vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to @client, notice: 'El vehículo fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "title...
2269e50f4b6f6ab0235bfef405f2616a
Command support via shell process in namespace
[ { "docid": "0188fcd9814efd2fad94f87b0bf32e18", "score": "0.5985155", "text": "def startShell(mnopts=nil)\n \"Start a shell process for running commands\"\n if @shell\n error(\"%s: shell is already running\\n\" % @name)\n return\n end \n\n # mnexec: (c)lose descriptors, (d)etach fr...
[ { "docid": "442b625bab18b53e27a6c1b80c8de063", "score": "0.71019644", "text": "def shell_commands(cmd, args); end", "title": "" }, { "docid": "0059c767f335bfa8831bb03957c65c8b", "score": "0.69723326", "text": "def shell(*) end", "title": "" }, { "docid": "d8720dd8afa2c043...
f86c92614279f4b86f94589bd0811266
to achieve the desired result. You should be able to run this file from your terminal with the command `ruby day_4/exercises/methods.rb` example: Write a method below that, when called will print your name
[ { "docid": "670eff5091bd56f2e14acec7b908f675", "score": "0.0", "text": "def print_name\n p \"Severus Snape\"\nend", "title": "" } ]
[ { "docid": "fae8dbd5a8ca7acd2d60dd0b4c56bbf4", "score": "0.79781985", "text": "def print_name(name)\n puts \"#{name}!\" # YOUR CODE HERE\nend", "title": "" }, { "docid": "40dffe906199df9d2778dbed62c27590", "score": "0.7972986", "text": "def print_name(name)\n # YOUR CODE HERE\n p ...
e3b936eb8c0f0dc8c943b535311416b7
Invoked when data is recieved from the channel. It simply accumulates all data until a +read+ is invoked.
[ { "docid": "ec0e8cabe114a39b2ede92f8739860ec", "score": "0.64838624", "text": "def do_data( channel, type, data )\n @data << data if type == 1\n end", "title": "" } ]
[ { "docid": "e388e30c36c437e4de6bee47b5cb1e4d", "score": "0.7637309", "text": "def receive_data(data)\n Logger.info '-- Received data from worker: '+ self.to_s\n reader.ingest data\n handler reader.read_and_clear!, self if reader.ingested?\n end", "title": "" }, { "docid": "50943c7...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "41a24340ce1782dd72fa253ea4447a96", "score": "0.0", "text": "def forecast_params\n params.require(:forecast).permit(:state, :location, :temp)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7943618", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69572574", "text": "def permitted_params\n params.permit!\n end", "title"...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b4eb347a5aa875126c0462e989952e44", "score": "0.0", "text": "def maintenance_params\r\n params.require(:maintenance).permit(:name,:value)\r\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...
ea55c0f34f18c4cffe1beda24e352a8b
A random string of lowercase alphanumeric characters (i.e. "base 36")
[ { "docid": "e8bf7e1a102fb69d7e0c6498824eb96f", "score": "0.0", "text": "def random_suffix\n length = 10\n SecureRandom.random_number(36 ** length).to_s(36).rjust(length, '0')\n end", "title": "" } ]
[ { "docid": "6dbd869b5a250d799dbc6afecd04b812", "score": "0.80891514", "text": "def random_string\n (0...100).map { (\"a\"..\"z\").to_a[rand(26)] }.join\n end", "title": "" }, { "docid": "6dbd869b5a250d799dbc6afecd04b812", "score": "0.80891514", "text": "def random_string\n ...
51b02782533166ed33a8a3b715064b51
build json for all nodes
[ { "docid": "2738d54e28c0b49ec615d00c69b86af2", "score": "0.5570575", "text": "def get_relationships(clear_cache = false)\n\n\tFile.delete(node_cache_file) if clear_cache && File.exist?(node_cache_file)\n\n\tif File.exist?(node_cache_file)\n\n\t\tcontent_type :json unless is_rake\n\t\tsend_file node_cach...
[ { "docid": "ad8fc68a5d901374b1093679ed8013e4", "score": "0.6977531", "text": "def to_json\n @nodes.map(&:to_json)\n end", "title": "" }, { "docid": "d54611479cd59d666bbe97989a845b74", "score": "0.6825319", "text": "def as_json(*)\n {\n JSON.create_id => self.class...
0cb745decf7d055b31ba343060409a0f
Calculates the actual should value given the current and new values. This is only used in should_to_s and change_to_s to fix the change notification issue reported in PUP6542.
[ { "docid": "6ead23951fb42e68791319716618d126", "score": "0.5529154", "text": "def actual_should(currentvalue, newvalue)\n currentvalue = munge_members_value(currentvalue)\n newvalue = munge_members_value(newvalue)\n\n if @resource[:auth_membership]\n newvalue.uniq.sort \n else...
[ { "docid": "215448774d5b9dca9f87eb35dd8ae16b", "score": "0.6482649", "text": "def actual_for_diff\n @actual\n end", "title": "" }, { "docid": "0377c06c8ea8c5c0c56c28e337056e26", "score": "0.61153895", "text": "def result\n if compared_attributes\n ...
038e2142c3a36f69a0caf78d47e8a943
Sets the certificate and generates a SHA2 hash in ASN.1/DER format, ready to send to remote servers.
[ { "docid": "5c957a4cacadb90e654c08c05ab8a4da", "score": "0.7674589", "text": "def certificate=(cert)\n\t\tcert = OpenSSL::X509::Certificate.new(cert) if cert.is_a? String\n\t\t@certificate = cert\n\t\t@certificate_hash = Digest::SHA2.digest \"0\\202\\003\\254#{@certificate.to_der}\"\n\tend", "title"...
[ { "docid": "5a322afe961af7d421a554b8bfbcdea0", "score": "0.6377183", "text": "def generate\n cert = OpenSSL::X509::Certificate.new\n configure(cert)\n add_extensions(cert)\n cert.sign(key, OpenSSL::Digest::SHA256.new)\n end", "title": "" }, { "docid": "0c4c290e0634ca61...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "3c3c48fa44db97400c12d49910183509", "score": "0.0", "text": "def situation_params\n params.require(:situation).permit(:status, :functional, :medical, :juridical, :special, :alienation, :disciplinary, :gun_license, :military_id)\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...
5a03e90f03af4e69cc5d4bcbd390ab01
GET /hackerspaces GET /hackerspaces.xml
[ { "docid": "0b4524c6bb021ffb4ca23102a34a8385", "score": "0.73026985", "text": "def index\n @hackerspaces = Hackerspace.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hackerspaces }\n end\n end", "title": "" } ]
[ { "docid": "e43f10c16cb465c3f308c45cb516cd91", "score": "0.7183129", "text": "def show\n @hackerspace = Hackerspace.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @hackerspace }\n end\n end", "title": "" }, { "doc...
7dd39a0c14432bd3ece3a8eae53f0ddd
GET /trip_reports/1 GET /trip_reports/1.json
[ { "docid": "c51349aeb7b6eff4e12093f1acf2fa59", "score": "0.64769626", "text": "def show\n @trip_report = TripReport.find(params[:id])\n @crossings = @trip_report.crossings\n @crossing = Crossing.new(trip_report_id: @trip_report.id)\n @gas_stops = @trip_report.gas_stops\n @gas_stop = GasSt...
[ { "docid": "3577eadb6a54a17f5c684c6bdcb07247", "score": "0.6784599", "text": "def new\n @trip_report = TripReport.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trip_report }\n end\n end", "title": "" }, { "docid": "9013c1e407a67...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bc13cfc73f0b5027c50a21c1f5884fac", "score": "0.0", "text": "def type_critique_params\n params.require(:type_critique).permit(:name)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
5823c75f7437cf9f59a185b6d2ebf8b8
GET /posts/1 GET /posts/1.json
[ { "docid": "5fd096cd4e34710c44ded8f2c8483ace", "score": "0.0", "text": "def show\n @photos = @post.photos\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @post }\n end\n end", "title": "" } ]
[ { "docid": "c884d3048f42b4b1b768c271940bbed7", "score": "0.7437435", "text": "def show\n post_id = params[:id]\n render json: V1::Post.get_a_post(post_id)\n end", "title": "" }, { "docid": "fb578f587fdfe1b0a8d3ac27001f9611", "score": "0.736332", "text": "def index\n ...
5207c6365a8918703545f2ba21a7bd86
Write a function called vowels(str) that returns an array of every vowel in the string. Use the Stringchars method, which returns an array of characters. Then use an each over the chars.
[ { "docid": "f69e51f43c3380e2abcb9e489ac89b5a", "score": "0.833855", "text": "def vowels(str)\n arr_of_characters = str.chars\n arr_of_vowels = [];\n arr_of_characters.each do |char|\n arr_of_vowels.push(char) if (char == \"a\" || char == \"e\" || char == \"i\" || char == \"o\" || char == \"u\" )\n...
[ { "docid": "92e2079b846a8874338e3132da30802b", "score": "0.84733826", "text": "def vowels (string)\r\n # Your code here\r\n # String to characters array\r\n string_arr = string.chars\r\n output_arr = []\r\n # Iterate through array, case statement for vowels, add to a vowels_arr\r\n string_arr.each...
b5d641cbdd782159a3bdefef404b7099
Runs the main loop
[ { "docid": "27ce2a11efa7a3cf6eee117ee9283770", "score": "0.0", "text": "def run\n init_logger\n init_dirs\n \n @log.unknown \"Running 4cat #{VERSION}\"\n \n init_stats if @opts.stats\n \n loop do\n delta = Time.now.to_i - @last_refresh_time\n if delta < @opts.refresh_de...
[ { "docid": "a8da3ea061d7417f43e1abb6186afc74", "score": "0.82551825", "text": "def mainloop\n Ricer::Thread.execute {\n loop {\n sleep 0.200\n PurpleRuby.main_loop_step\n }\n }\n end", "title": "" }, { "docid": "c689b8218aae143a65b92749441f455a", ...
a7a817661c0faa5c863dfc7d8fa829b2
Returns the string representation of the object
[ { "docid": "a408df9f3be79d7c20500741a990725c", "score": "0.0", "text": "def to_s\n to_hash.to_s\n end", "title": "" } ]
[ { "docid": "e0c61d22481a9b8a23b7a0620c2b5f87", "score": "0.901024", "text": "def to_s\n @object.to_s\n end", "title": "" }, { "docid": "fc45164ab937a7dc1e465646a36f565c", "score": "0.89506465", "text": "def to_s\n object.to_s\n end", "title": "" }, { "doci...
225d6cb0aa343bd8c35f8b8fb7188ab4
GET /sarkarreplies/1 GET /sarkarreplies/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "02ede1a5a395c27a052fca6d50e2d0c5", "score": "0.7559478", "text": "def index\n @sarkarreplies = Sarkarreply.all\n end", "title": "" }, { "docid": "5d8e1014fc382e78104e9b8aaf9a1828", "score": "0.73765177", "text": "def index\n @replies = Reply.all\n\n respond_to d...
c844c244b2c4974e6d925fca6959cefb
Removes whitespace from each of the exception message lines and reformats it
[ { "docid": "85139dda90199017798cfde76087e19c", "score": "0.51957506", "text": "def strip_message_from_whitespace msg\n msg.split(\"\\n\").map(&:strip).join(\"\\n#{add_spaces(10)}\")\n end", "title": "" } ]
[ { "docid": "c2ec45a43578838ada9c819abe876ae4", "score": "0.6169491", "text": "def formatted\n message = \"\\n#{@exception.class}: #{@exception.message}\\n \"\n message << @exception.backtrace.join(\"\\n \")\n message << \"\\n\\n\"\n end", "title": "" }, { "docid": "bce410...
53b9f8c7cfe20e3f5f5a2277157c3c4e
GET /image_tests/1 GET /image_tests/1.xml
[ { "docid": "c17a3b5e603caacf0039cc05314a814d", "score": "0.70642155", "text": "def show\n @image_test = ImageTest.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @image_test }\n end\n end", "title": "" } ]
[ { "docid": "4e1920a7972f2c512530be9b3d8b05e6", "score": "0.7412044", "text": "def index\n @image_tests = ImageTest.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @image_tests }\n end\n end", "title": "" }, { "docid": "6ae97045...
d2677e53a366353c4f84b2bb01d15b91
Take YAML front matter given by id.
[ { "docid": "7f6d318d9f582db186c2bedd686e347f", "score": "0.0", "text": "def attributes\n @attributes ||= yaml_front_matter.with_indifferent_access\n end", "title": "" } ]
[ { "docid": "fa5b8cd0b66c39d90992e957824708bd", "score": "0.57959735", "text": "def extract_frontmatter_as_yaml(file, markdown = nil)\n\n markdown ||= File.read(file)\n\n begin\n frontmatter = YAML.load(markdown.split(/#!!====+/, 2)[0]).symbolize_keys\n\n # Check the title, slug a...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7ddc6b467787050cb64e9ef522bc5d45", "score": "0.0", "text": "def assign_rhizomes_params\n params.require(:batch)\n .permit(rhizome_roles_attributes: [:id, :rhizome_id, :role_id])\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...
dc120d089855e22f1027ad88c7f10f76
id | action_audit_id | column_name | table_name | record_id | changed_from | changed_to | action | performed_at 736289 | 12839186 | passwordhash | admins | 563261 | 9bc34549d565d9505b287de0cd20ac77be1d3f2c | 86ba9a22970c2feb2d3095f889acf4c4e42473d5 | update | 20150814 20:45:5506
[ { "docid": "21f64e6231ea9e210b0a39eb1be1f571", "score": "0.55892974", "text": "def get_model_audits(action_audit_id)\n begin\n conn = PG::Connection.open(:host => @host, :port=> @port, :user => @db_user, :dbname => @db_name)\n sql = \"SELECT * from model_audits where action_audit_id = #{act...
[ { "docid": "2c4bf7a4ee756f365a36f5b9f7a0c161", "score": "0.6435868", "text": "def auditershelp_changes( record )\n type = record.auditable_type\n changes = record.changes\n model = type.constantize\n translate = model.respond_to?( :columns_for_translation )\n\n return apphelp_v...
2569b607dba8a83cfbdbcb189f62fc20
Completes (captures) a payment. By default, payments are set to complete immediately after they are created. You can use this endpoint to complete a payment with the APPROVED `status`.
[ { "docid": "c0328150354d6a9ac42f65fd8029086f", "score": "0.71349245", "text": "def complete_payment(payment_id:)\n # Prepare query url.\n _query_builder = config.get_base_uri\n _query_builder << '/v2/payments/{payment_id}/complete'\n _query_builder = APIHelper.append_url_with_templat...
[ { "docid": "941c455be65c8f3cda481afb150b9ddf", "score": "0.73466605", "text": "def complete_payment(payment_id:,\n body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/v2/payments/{payment_id}/compl...
46b3f7d4751982a8191591084930d356
this is where we receive a webhook, via a POST
[ { "docid": "593fe00f3db14f9e71f68de67e7dc8e4", "score": "0.0", "text": "def create\n # The only things we need to handle in here (for now at least) are entries.\n # If there's been an update or a deletion, we just remove the cached timestamp.\n # The updated_at method which is included in Conte...
[ { "docid": "cd4fea3a2ebdada22105fa934638743c", "score": "0.80013067", "text": "def webhook\n puts params\n\n status 200\n end", "title": "" }, { "docid": "b9a6a7e9fc228d728ad720528487ed39", "score": "0.7501003", "text": "def webhook\n webhook_data = params[:payload]\n\n ...
af4ea5d984a6f3115ad6b07f85921364
Calls the given method on the first ancestor that responds to the method
[ { "docid": "109f6bf3009b4e13568c96f8212b034c", "score": "0.71774936", "text": "def try_ancestor(method_name)\n ancestors_lookup(method_name).try(method_name)\n end", "title": "" } ]
[ { "docid": "7976e855e1473418ba60caadcaa22472", "score": "0.70219654", "text": "def find_child(method, *args); end", "title": "" }, { "docid": "3e861e17a66dc8924722fd2e674bbcf7", "score": "0.69734156", "text": "def first_ancestors(method)\n return nil if root?\n if value = p...
10827867c4af1a0e494f5339bdae37a2
We need to decode 2 times of body
[ { "docid": "0a3bbfb7dafdef401dfb02a1f3ed2309", "score": "0.6697066", "text": "def decode_body body\n URI.unescape (URI.unescape body)\n end", "title": "" } ]
[ { "docid": "62d70d3403c50b17909cf4d5a0fd28e0", "score": "0.7538112", "text": "def decode_body(str); end", "title": "" }, { "docid": "19dc30e90ef84914baeab63aa8ec8360", "score": "0.69828933", "text": "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "c185ed47a60d985c65611053ee48e075", "score": "0.0", "text": "def update!(**args)\n end", "title": "" } ]
[ { "docid": "150fa2bdc1fc43d28ac45e2278a1f797", "score": "0.7012263", "text": "def update_properties(hash)\n hash.each do |key, value|\n setter_method = \"#{key}=\"\n if self.respond_to?(setter_method)\n self.send(setter_method, value)\n end\n end\n end", "t...
b0b009e119047265fff290e2d88475b6
the time that the train should arrive accounting for lateness
[ { "docid": "d744acc95af2a908981e3bd2de56d108", "score": "0.69365996", "text": "def time\n (departure.scheduled_time + departure.lateness).strftime(TIME_FORMAT)\n end", "title": "" } ]
[ { "docid": "d05a5664e67859865b5323674ce64a2c", "score": "0.6918498", "text": "def estimate_trip_time (orbit)\n ( orbit.distance / self.update_speed(orbit).to_f + crater_delay(orbit) ).round 2\n end", "title": "" }, { "docid": "f5b451c4ebc3cfed952a1b6fa3a815fe", "score": "0.6864396", ...
0458bcf556b8318bab8d949310026391
PATCH/PUT /test_approvals/1 PATCH/PUT /test_approvals/1.json
[ { "docid": "5adb2142737550e56f6d5ed841fe90a5", "score": "0.6174986", "text": "def update\n @test = @test_approval.test\n respond_to do |format|\n if @test_approval.update(test_approval_params)\n\n #Sending E-mails\n if @test_approval.approved?\n TestMailer.test_approved...
[ { "docid": "c2fd6b2b457890c5fc01632683f195d4", "score": "0.62108797", "text": "def api_tests\n @testcase = \"apt_test\"\n empty_db_tests\n\n data = { \"id\" => \"test_p1\" }.to_json\n assertEqual(put_json(\"/proposals\", data), [\"{}\", 200], \"Failed to API create proposal: test_p1\", \"Success: cr...
d7468a428ebb23b7dc01a59ec725d407
PUT /games/1 PUT /games/1.xml
[ { "docid": "3cf414b8244fe8d86df7812d483da51c", "score": "0.0", "text": "def update\n @game = Game.find_by_permalink(params[:id])\n\n respond_to do |format|\n if @game.update_attributes(params[:game])\n flash[:notice] = 'Game was successfully updated.'\n format.html { redirect_to...
[ { "docid": "7dcf61d28367255f0ec9cea7ade341de", "score": "0.6579802", "text": "def update(id, name=\"Updated Name\", published=\"false\", genre=\"movie\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <timeline>\r\n <published type='string'>#{published}</published>\r\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6f9a8951a14c9c83063ef94964c274f6", "score": "0.0", "text": "def member_params\n params[:member]\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...
911bece77828bfb080d3262bcf3e701a
PATCH/PUT /meetings/1 PATCH/PUT /meetings/1.json
[ { "docid": "a4405e30cb1592889d46a788b0745921", "score": "0.6809634", "text": "def update\n respond_to do |format|\n if @meeting.update(meeting_params)\n format.html { redirect_to @meeting, notice: 'Meeting was successfully updated.' }\n format.json { render :show, status: :ok, loca...
[ { "docid": "238daeba0dfcb95c03de0f4d7fcf1bf7", "score": "0.7319996", "text": "def update\n @meeting = Meeting.find(params[:id])\n\n if @meeting.update(params[:meeting])\n head :no_content\n else\n render json: @meeting.errors, status: :unprocessable_entity\n end\n end", "title...
0296d32728234466a20ad46575f2ae09
Generates a random key. This key will be to create the encryption and authentication keys.
[ { "docid": "556a8e2538d8f466c074d8fca360bc81", "score": "0.7326613", "text": "def random_key_gen(key_len = 32, raw = false)\n @master_key = random_bytes key_len\n raw ? @master_key : Base64.strict_encode64(@master_key)\n end", "title": "" } ]
[ { "docid": "7287467fda540ef7bc2048acb9bd1c60", "score": "0.8495424", "text": "def generate_random_key\n SecureRandom.random_bytes(32)\n end", "title": "" }, { "docid": "f5d919fba2dca7531fe3bb54e8eb575a", "score": "0.7943092", "text": "def generate_key\n self.key = Secu...
7ada40ca9609e00d64975f9db033b1bc
DELETE /milestones/1 DELETE /milestones/1.xml
[ { "docid": "a41dfc31c3fb042ee2817bf120de1c7d", "score": "0.6933845", "text": "def destroy\n @milestone = @goal.milestones.find(params[:id])\n @milestone.destroy\n\n respond_to do |format|\n format.html { redirect_to(goal_milestones_url(@goal)) }\n format.js\n end\n end", "titl...
[ { "docid": "fd0e83c626e32d9f2836e7dc4b49e14c", "score": "0.7835941", "text": "def destroy\n @milestone = Milestone.find(params[:id])\n @milestone.destroy\n\n respond_to do |format|\n format.html { redirect_to(milestones_url) }\n format.xml { head :ok }\n end\n end", "title": ...
a6527a2ee7f77ed7a93a4b65ae76ef25
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
[ { "docid": "07c777d922e986db33e8e24982ac65e0", "score": "0.0", "text": "def new_input_set()\n return GetTimeSeriesByPeriodInputSet.new()\n end", "title": "" } ]
[ { "docid": "d8eb34cfc5a1e737977f7023d4849c46", "score": "0.6741255", "text": "def new_input_set()\n return CreateObjectInputSet.new()\n end", "title": "" }, { "docid": "7c0d7c433cd4eb8e36bdc3a383e9ec33", "score": "0.65807736", "text": "def new_input_set()\n return Ru...
9db5ead621cbd8a42042c2020de98b87
Asserts that one or more of the conditions defined in the enclosing scope are true.
[ { "docid": "d1617648a55664d4465068beb2f14a96", "score": "0.0", "text": "def any(&block)\n @validators <<\n if block_given?\n val = ValidatorBuilder.new(self, @options, &block)\n @keys << val.keys\n ->(obj) { val.validators.map { |v| v.call(obj) }.any? }\n el...
[ { "docid": "de9d4157d8bec8c3c5da09e1b90eeb54", "score": "0.6284365", "text": "def check_conditions(*args, &block)\n conditions.all? do |condition|\n condition.call(machine.target, *args, &block)\n end\n end", "title": "" }, { "docid": "3e463304ef594c1ed0906d3424abd26d", ...
fc738541b927b0ea9b39618afc08bcf5
DELETE /leads/1 DELETE /leads/1.json
[ { "docid": "bd1a55c5d011ecb713f8f95c480fa156", "score": "0.73317325", "text": "def destroy\n @lead = Lead.find(params[:id])\n @lead.destroy\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "f0b282e8944d406d3ea5e0dc164ce40e", "score": "0.7434222", "text": "def destroy\n @lead = Lead.find(params[:id])\n @lead.delete\n\n respond_to do |format|\n format.html { redirect_to leads_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
d23433e3ddeba5ab997ce2f463c48c85
Scrape page, look for 'next' link: if found, submit the page form
[ { "docid": "08431c359036aff77648cf36da5cd3ca", "score": "0.83964884", "text": "def scrape_and_look_for_next_link(page)\n scrape_speech_list(page.body)\n link = page.link_with(:text => 'Next >')\n if link\n page.form_with(:name => 'form1') do |f|\n f['__EVENTTARGET'] = 'ctl01$listing...
[ { "docid": "60c6d4762cfac5860cfc8c5a06b0d376", "score": "0.81897265", "text": "def scrape_and_look_for_next_link(page)\n scrape_speech_list(page.body)\n page.form_with(:name => 'DynamicListPage') do |f|\n # See if we've got a \"Next\" submit field\n submit_button = f.button_with(:value => /next/...
7be156bf16e4531e84e26743cba5719e
Taken from Rails Recipes, p13
[ { "docid": "af69494add6f9420fb55d01a9abc0cfe", "score": "0.0", "text": "def in_place_select_editor_field(object, method, tag_options={}, in_place_editor_options={})\n tag = ::ActionView::Helpers::InstanceTag.new(object, method, self)\n tag_options = {:tag => \"span\",\n :id ...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.64849085", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.61995107", "text": "def probers; end", "title": "" }, { "docid": "991b6f12a63ef51664b84eb729f67eed",...
42c0c54c6591c937816731ebd38e5a11
Method to delete a Topic
[ { "docid": "3ada6c98e9b919cd818542ddc3d6043b", "score": "0.0", "text": "def destroy\n # Making sure only signed in users can access\n # if user_signed_in?\n topic = Topic.find(params[:id])\n if topic.destroy\n render json: topic\n else\n ...
[ { "docid": "9f4b81d807e37d5f13e3a81e79131f9a", "score": "0.84103805", "text": "def delete_topic topic_name\n publisher.delete_topic topic: topic_path(topic_name)\n end", "title": "" }, { "docid": "c9bfed9f1c6d5669db3534f5cf3d801a", "score": "0.83989894", "text": "def ...
e0e918c3685ade0d8e5b106f52410c78
GET /members/new GET /members/new.json
[ { "docid": "2cffb19d275063e0716004d4a7c1266d", "score": "0.74466014", "text": "def new\n @title = \"New Member\"\n @member = Member.new\n @member.phone = \"+375\"\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @member }\n end\n end", "t...
[ { "docid": "6c4249a27e89d3b4c9eac2d440d08a70", "score": "0.7905133", "text": "def new\n @member = Member.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @member }\n end\n end", "title": "" }, { "docid": "8c9335a4c5e9ca01941...
c41329625f7cdd570c9b0ff82c265b22
gather internal bibitem references
[ { "docid": "44c5247ba745c4a438a3b81828812a14", "score": "0.7708129", "text": "def gather_internal_refs\n #@files.each.with_object({}) do |(_, x), refs|\n @files.keys.each_with_object({}) do |i, refs|\n #x[:attachment] and next\n @files.get(i,:attachment) and next\n #file, ...
[ { "docid": "959fd2d859273bc23b3a25f32b312348", "score": "0.6551699", "text": "def locate_internal_refs\n #require 'debug'; binding.b\n refs = gather_internal_refs\n #@files.keys.reject { |k| @files[k][:attachment] }.each do |identifier|\n @files.keys.reject { |k| @files.get(k,:attach...
0ab5e3b686bdca1bd7c37545a642303e
GET /weights/new GET /weights/new.json
[ { "docid": "bfab07ea9b098e153c8d5565bf3b9df0", "score": "0.7775669", "text": "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @weight }\n end\n end", "title": "" } ]
[ { "docid": "aa8e17e73db1477a109ab7a6391af0b9", "score": "0.77085793", "text": "def new\n @weight = Weight.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @weight }\n end\n end", "title": "" }, { "docid": "1a079b1f444bde6fd3704c8...
6ef9d2df269ae3dc7035b6c7565c9c5c
GET /page_templates/1 GET /page_templates/1.json
[ { "docid": "d8a5a371ccd854a736eb35233bf6088c", "score": "0.6908213", "text": "def show\n @page_template = PageTemplate.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @page_template }\n end\n end", "title": "" } ]
[ { "docid": "f5c604790d818b074fe3992b4a751a62", "score": "0.7119483", "text": "def index\n @admin_templates = Template.order('id desc').page(params[:page]).per(10)\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @admin_templates }\n end\n end...
71540f336ddd726be5333e3ea6d75344
p get_trip_string(:N, "8th", "Times Square")
[ { "docid": "9d9839d840f2fff4b4a92da4ff12214c", "score": "0.0", "text": "def plan_trip(start_line, start_stop, end_line, end_stop)\n # Travelling on the same line\n if (start_line === end_line)\n print \"You must travel on the following stops on the \"\n print start_line\n print \" line: \"...
[ { "docid": "74d22b2a38c2a85ac10d31346b8621fe", "score": "0.6755013", "text": "def trip_length\n \"The trip will take around #{156*3} seconds\"\nend", "title": "" }, { "docid": "608f76c7d30c0153bc98e58eebb091f8", "score": "0.64869636", "text": "def ninety_nine_bottles_of_beer\n\t# #{...
ac06df884bfc61b96a6651f6b408a617
Validate a RAR Archive file (RAR) Validate a RAR archive file (RAR)
[ { "docid": "94636d11b17e158ff021408c1928d89e", "score": "0.6661398", "text": "def validate_document_rar_validation(input_file, opts = {})\n data, _status_code, _headers = validate_document_rar_validation_with_http_info(input_file, opts)\n data\n end", "title": "" } ]
[ { "docid": "7c0460353758e592e69c6d5d148dfbbd", "score": "0.6355086", "text": "def israr?(file)\n head = File.read(file, 20)\n return (head[0 .. 5] == \"Rar!\\x1A\\a\")\nend", "title": "" }, { "docid": "b1edcd2382bf2f5795c9218d427148f0", "score": "0.6061844", "text": "def valid_arch...
5c426ad4da29e40c395da8c929deb5fd
Gets the competition rank and status of the team at the given event.
[ { "docid": "53063fd22b7bae37951cc4849f9973f9", "score": "0.6084771", "text": "def get_team_event_status(team_key, event_key, opts = {})\n data, _status_code, _headers = get_team_event_status_with_http_info(team_key, event_key, opts)\n data\n end", "title": "" } ]
[ { "docid": "4322579419819f7e7cd61c9457373106", "score": "0.5897305", "text": "def event_score(event)\n score = scores.select { |score| score.event_id == event.id }\n if score.present?\n return score.first.points\n end\n return nil\n end", "title": "" }, ...
e7180df55faa38c65ad9822146644242
GET /manufacturer_lines/new GET /manufacturer_lines/new.xml
[ { "docid": "56dfd11a094cd23fd56d801a6ac9c979", "score": "0.7747735", "text": "def new\n @manufacturer_line = ManufacturerLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @manufacturer_line }\n end\n end", "title": "" } ]
[ { "docid": "81ff765ee729e808526545c516a51359", "score": "0.6778016", "text": "def new\n @product_line = ProductLine.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @product_line }\n end\n end", "title": "" }, { "docid": "f95befcf...
53669d0b89d1a584f73434a1133c7922
Set the cost for each item (which is the negation of the profit)
[ { "docid": "ed52e6ea069c8e9944d7799b1eba8cf2", "score": "0.6945257", "text": "def transform_profit_to_cost\n items.map! do |item|\n if item[:c].nil? && item[:p].present?\n item.merge(c: -item[:p])\n else\n item\n end\n end\n end", "title": "" } ]
[ { "docid": "cd2c526465f9efff04187185a40e6ec0", "score": "0.69496423", "text": "def set_costs_for_item\n @costs_for_item = CostsForItem.find(params[:id])\n end", "title": "" }, { "docid": "6d3afda5dfff56566cd49b4296f34422", "score": "0.67795795", "text": "def total_cost=(value...
9a00fa048d8153842060091f3a24aa71
This is test when argument is float
[ { "docid": "af0bf04ae9b438135a61bd7818bc20ae", "score": "0.0", "text": "def test_plural_float\n assert_raises(StandardError) {@p.plural?(nil)}\n end", "title": "" } ]
[ { "docid": "e523794529435500c36fe2581cb15251", "score": "0.7816875", "text": "def is_float?(input)\n input.to_f.to_s == input\nend", "title": "" }, { "docid": "f36171cbd572016677c243102b57ab1c", "score": "0.7639962", "text": "def expect_float(value, field, subfield)\n return true...
f992f94c6b39b8286e89ba1e229012a5
The above approach fails when given an array of decreasing values and will not calculate a negative profit. This is because the lowest_price will always be the current_price in the case that they are decreasing. To remedy this situation you can move the calculation of the lowest_price to the bottom of the loop, thus pr...
[ { "docid": "6c6b92004d186fd35c602be08c803689", "score": "0.8264643", "text": "def get_max_profit(prices)\n max_profit = -1.0/0.0\n lowest_price = 1.0/0.0\n prices.each do |current_price|\n current_profit = current_price - lowest_price\n max_profit = [max_profit, current_profit].max\n low...
[ { "docid": "72df2bd34f1925cf4220337e5a674030", "score": "0.8346238", "text": "def max_profit(prices)\n max_profit = 0\n min = prices[0]\n\n i = 0\n\n while i < prices.length\n if prices[i] < min\n min = prices[i]\n else\n max_profit = prices[i] - min if prices[i] - min > max_profit\n...
d5f047c0250a20f2580ba4afb9b5de45
GET /responses/new GET /responses/new.json
[ { "docid": "421b235441b7ccbd329beacc08739431", "score": "0.0", "text": "def new\n @response = Response.new\n @questions = Question.all\n @answers = Answer.all\n @question_groups = QuestionGroup.all\n \n respond_to do |format|\n \n # detect for ajax get request, render all que...
[ { "docid": "25f04de35af6e9264762fc4002fada48", "score": "0.7530351", "text": "def new\n @response = Response.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @response }\n end\n end", "title": "" }, { "docid": "c8161651e037150410d64...
cbf3ba35995ffe47f8a0b798f2404da2
Return true if lead
[ { "docid": "ad4c91a4867912397e3e893850628356", "score": "0.66376406", "text": "def lead?\n access_level > 30\n end", "title": "" } ]
[ { "docid": "5c4fcf3789e407ca265a88320a944eab", "score": "0.7761304", "text": "def lead?\n group.lead?\n end", "title": "" }, { "docid": "3660942d51c8537ab6056aff145e49f0", "score": "0.71527874", "text": "def ahead?\n !ahead.empty?\n end", "title": "" }, { ...
a0ad6f348f61b0b1259667abfdc90f11
GET /fill_ups/new GET /fill_ups/new.json
[ { "docid": "78ed6480bde75653c1f347a91a3a52cb", "score": "0.6935353", "text": "def new\n @vehicle = Vehicle.find(params[:vehicle_id])\n odometer = @vehicle.get_last_odometer\n cost = @vehicle.get_last_cost_per_gallon\n @fill_up = @vehicle.fill_ups.build\n @fill_up.odometer = odometer\n ...
[ { "docid": "6b452061f8ad2c2a200d3b20e6babc57", "score": "0.8020112", "text": "def new\n @fillup = Fillup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fillup }\n end\n end", "title": "" }, { "docid": "2053838ac083a5e1c933288dbe2...
d409c30378109d99881e9ec8d250ec70
optimized pick implementations they do NOT support :filter, though
[ { "docid": "b4ee82707dbcc14c831d033d8376f3d0", "score": "0.0", "text": "def pick_standard(count, options = {})\n percentile_range = options[:percentile]\n length_range = options[:word_length]\n\n if percentile_range && percentile_range.begin == 0 && percentile_range.end == 100\n percen...
[ { "docid": "5a9617eaaf8e7bfac25bbc292a48a9d3", "score": "0.6287918", "text": "def pick(target)\n \n end", "title": "" }, { "docid": "8c165c1040ab5fd3b79ec41f0ae2f77f", "score": "0.6110817", "text": "def pick_from_pool(pool, attr, ref = nil)\n # puts \"Picking #{attr}\"...
40608a453bde2a050a3586469e97b481
Creates a new header object. Accepts raw text or nothing. If given raw text will attempt to parse it and split it into the various fields, instantiating each field as it goes. If it finds a field that should be a structured field (such as content type), but it fails to parse it, it will simply make it an unstructured f...
[ { "docid": "2142b11cfd008d1d3a1da08e520ee4ed", "score": "0.6607831", "text": "def initialize(header_text = nil, charset = nil)\n @charset = charset\n self.raw_source = header_text\n split_header if header_text\n end", "title": "" } ]
[ { "docid": "4f18f44355e57f7aa3856298d055ed88", "score": "0.7122219", "text": "def parse_header(raw)\n header = {}\n field = nil\n\n raw.each_line do |line|\n case line\n when /^([A-Za-z0-9!\\#$%&'*+\\-.^_`|~]+):\\s*(.*?)\\s*\\z/om\n field, value = $1, $2\n ...
49c4bd835ee86615a89824879cca650e
Insert a element before or after other element.
[ { "docid": "547906337fb4201321696c1c43cabad4", "score": "0.6529073", "text": "def insert(element, new_element, before)\n return unless Hatemile::Util::CommonFunctions.is_valid_element?(element)\n\n tag_name = element.get_tag_name\n append_tags = %w[BODY A FIGCAPTION LI DT DD LABEL O...
[ { "docid": "4083a5363b5c1976068d444791a055c4", "score": "0.74639785", "text": "def insert_after( child1, child2 )\n if child1.kind_of? String\n child1 = XPath.first( self, child1 )\n child1.parent.insert_after child1, child2\n else\n ind = index(child1)+1\n child2.p...
fb5791f688c06c3dae7259855fefbb43
allow input test sample
[ { "docid": "4c632ba78175eb527820f8e28c5ab69e", "score": "0.0", "text": "def has_new_sample_right? #(quote)\n #rfq = quote.rfq\n #return true if session[:user_id] == rfq.emc_eng_id && eng?\n #return true if session[:user_id] == rfq.safety_eng_id && eng?\n #return true if eng_dept_head...
[ { "docid": "d2aa12034407ae846541b081c93fdb01", "score": "0.72800356", "text": "def allow_sample?(sample)\n true\n end", "title": "" }, { "docid": "8956fc266688ce7a495ef774f5bc0766", "score": "0.65122414", "text": "def sample(value)\n end", "title": "" }, ...
6ecbf65feb4bb8bb680d551604404ca2
can be /dev/hda, /dev/sda or /dev/cciss/c0d0
[ { "docid": "948dd63fb1afdf1bf72ecb9c7e037208", "score": "0.61130154", "text": "def name\n File.join(\"/dev/\",@device.gsub(/!/, \"/\"))\n end", "title": "" } ]
[ { "docid": "2bf27ff86fe130efe99bd2ce09620f49", "score": "0.70679003", "text": "def find_free_volume_device_prefix\n # Specific to ubuntu 11./12.\n vol_dev = \"sdh\"\n\n begin\n vol_dev = vol_dev.next\n base_device = \"/dev/#{os_dev_path_for(vol_dev)}1\"\n Chef::Log.info(\"dev pre trim #{base...
8ba8bd87abc13e8f4895bcdab0673ed6
Gets the current environment. Returns current environment as string. If environment is not set returns 'development'
[ { "docid": "0fdab49ef79a3f08583c4da2f5cc905f", "score": "0.747723", "text": "def current_environment\n ENV['RUBY_ENV'] || ENV['RAILS_ENV'] || ENV['RACK_ENV'] || 'development'\n end", "title": "" } ]
[ { "docid": "7cf1164d87519c9e78e17cfdcd176120", "score": "0.8112112", "text": "def environment\n if defined?(Rails) && Rails.respond_to?(:env)\n Rails.env.to_s\n else\n ENV['RAILS_ENV'] || ENV['RACK_ENV'] || ENV['ENV'] || 'development'\n end\n end", "title": "" }, { "docid...
7d8b602ebb51ce6c9022e88fae636206
PATCH/PUT /challenges/1 PATCH/PUT /challenges/1.json
[ { "docid": "8458d165533318c0da81f53e5e4b88d9", "score": "0.65521634", "text": "def update\n if @challenge.update(challenge_params)\n render :show\n else\n render json: @challenge.errors.messages\n end\n end", "title": "" } ]
[ { "docid": "75ba14299614d5cd6f33fd908a6ecfa4", "score": "0.70417154", "text": "def update\n @challenge = Challenge.find(params[:id])\n\n respond_to do |format|\n if @challenge.update_attributes(params[:challenge])\n format.html { redirect_to @challenge, notice: 'Challenge was successfu...
6b279e1ff792b3158645e64364b8eff8
This mutates `diff_files` lines.
[ { "docid": "6661bdff2c06fe4a4f28a4bf4c93d6cd", "score": "0.53142846", "text": "def unfold_diff_files(positions)\n positions_grouped_by_path = positions.group_by { |position| position.file_path }\n\n diff_files.each do |diff_file|\n positions = positions_grouped_by_path.fetch...
[ { "docid": "6b43280093f714311b2f73bd7ca7b044", "score": "0.62799656", "text": "def index_diff_with_optimized_lines\n diff = index_diff(INDEX_DIFF_OPTIONS)\n diff.deltas.zip(diff.patches).each do |delta, patch|\n lines = organize_lines(delta, patch)\n lines.each do |line|\n ...
4bad1bdfff2ba3084b05a69a38da4fce
PATCH/PUT /remisiones/1 PATCH/PUT /remisiones/1.json
[ { "docid": "3c8d8e3c8bc8a36ed91d518cd51ae9ac", "score": "0.6676529", "text": "def update\n respond_to do |format|\n if @remision.update(remision_params)\n format.html { redirect_to @remision, notice: 'Remision was successfully updated.' }\n format.json { head :no_content }\n e...
[ { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6594391", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "b4cc3ee2207b39abaf779a6078bbaf3a", "score": "0.6594391", "text": "def patch\n PATCH\n end", "title": "" }, { "docid": "fa1620...
7ea143d86ff08e7ce4b38139d1dbc8f3
GET /classified_ads GET /classified_ads.json
[ { "docid": "a1d1addd27d1351305373c07672c6bf0", "score": "0.7324974", "text": "def index\n @classified_ads = ClassifiedAd.order(created_at: :desc)\n\n # respond_to do |format|\n # format.html { render :index }\n # format.json { render json: @classified_ads.as_json, status: :success }\...
[ { "docid": "bb1cd2690722b0e835e60a6e57502590", "score": "0.7387536", "text": "def show\n @classified_ad = ClassifiedAd.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @classified_ad }\n end\n end", "title": "" }, { "...
1282fafbc1d386befb70efb90b6c4c17
Loads all help files
[ { "docid": "d7bc48afc741e734d13bb9647bc41d25", "score": "0.797593", "text": "def load_helps\n log :debug, \"Load_helps: getting all help files.\"\n\n hfiles = File.join(\"data/help\", \"*.yml\")\n\n Dir.glob(hfiles).each do |a_file|\n help = Help.new()\n help.load_from_file(a_file) # loads each...
[ { "docid": "3743f7eea07194c6291e8e9e090f49da", "score": "0.6899846", "text": "def help_load\n if @api_info.key?('help')\n help_hash = @api_info['help']\n elsif @container_hash[:Labels]\n @config['description'] = @container_hash[:Labels]['description'] if @container_hash.dig(:Labels, 'des...
fab67e4c9660e65b591d1dcf46382fcb
GET /car_options/1 GET /car_options/1.json
[ { "docid": "5a60a4af77d6ccbc40b437b46aff4b0e", "score": "0.75136733", "text": "def show\n @car_option = CarOption.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: {car_option: @car_option} }\n end\n end", "title": "" } ]
[ { "docid": "282983c961395a816e2a5f64f5d137d4", "score": "0.682812", "text": "def car_options\n Array.new(rand(5...10)) { fetch('vehicle.car_options') }\n end", "title": "" }, { "docid": "35a55434f20ec2a5104dbcd349d36a7b", "score": "0.68213856", "text": "def new\n @car_...
a33435b774ce63151d993b55eebb3697
Follow multiple Feeds, optionally with a scrollback.
[ { "docid": "13aacc25a4e706638256177c0b754f09", "score": "0.76874423", "text": "def follow_many(targets, scrollback: 30)\n targets.map { |target| follow(target, scrollback: scrollback) }\n end", "title": "" } ]
[ { "docid": "54ddc13ec0fe385f81a8b9ba58b51bbf", "score": "0.6493335", "text": "def follow(target, scrollback: 100)\n target = target.write_target if target.respond_to?(:write_target)\n StreamLog.follow(read_target, target)\n read_feed.follow(*target, scrollback)\n end", "title": "" }, {...
821c3013168fda691816cb11ebebab3c
POST /newspappers POST /newspappers.xml
[ { "docid": "a9335f1f33337d6c6c86dfaa72556272", "score": "0.6187207", "text": "def create\n @newspapper = Newspapper.new(params[:newspapper])\n\n respond_to do |format|\n if @newspapper.save\n flash[:notice] = 'Newspapper was successfully created.'\n format.html { redirect_to(@ne...
[ { "docid": "39837f823eddab5b059da10be5423432", "score": "0.59809774", "text": "def create\n #puts item_mapping_params.to_yaml\n @item_mapping = ItemMapping.new(item_mapping_params)\n\n respond_to do |format|\n if @item_mapping.save\n format.html { redirect_to @item_mapping, notice: ...
7885609ad3c838396563d833409ce0f9
Double .credentials call here to convert instance into a Credentials object, which contains an access key ID and a secret access key. All the various credentials objects respond to this method, including SharedCredentials, InstanceProfileCredentials, etc. See:
[ { "docid": "e13417ada6a2c7a2dd61ad457977a28a", "score": "0.0", "text": "def hash_value\n parts = [\n region,\n cluster_name,\n credentials.credentials.secret_access_key,\n credentials.credentials.access_key_id,\n ]\n\n Digest::SHA256.hexdigest(par...
[ { "docid": "ddf106ef0f23a15bc6821ceb68bdf1c5", "score": "0.76079786", "text": "def credentials\n if valid_credentials?\n return load_credentials\n else\n return create_credentials\n end\n end", "title": "" }, { "docid": "ec599943513ee8e4f3068731dec145ac", "score": "0....
a4fb54476a5022233b599b91d84fe3c7
Sit down at the table (Only applicable to ring games) TODO: check for empty chairs (js:total players js:player count)
[ { "docid": "218450e7f8d070c13f4aec8f31385545", "score": "0.0", "text": "def sitdown(forced=nil)\n return if Game.tourney?\n if not sitdown_button_exists? and not forced\n log_warning(\"Tried to sit down, but there is no sitdown button. (Non-forced sitdown)\")\n log_info(\"There are #{Ga...
[ { "docid": "0fa0567998813965ef48ed23cc0a494d", "score": "0.6664682", "text": "def clean_up_table()\n @players.each { |player|\n if player.out_of_money()\n puts \"**** Player #{player.position} has run out of money and hence being removed from the table. ****\"\n end\n }\n @play...
2a3d2920854abba154046ee3e25b90f3
POST /items POST /items.json
[ { "docid": "35f86e313bfa95b8b92fd50da22d8a33", "score": "0.0", "text": "def create\n @item = Item.new(params[:item])\n @item.user = current_user # If current_user == nil, then this won't validate (not logged in)\n\n respond_to do |format|\n if @item.save\n format.html { redirect_to ...
[ { "docid": "1a87b6b1a8f3fc007c549688390eae3f", "score": "0.75517005", "text": "def create_item\n item = @list.items.create(:title => params[:title], :details => params[:details], :deadline => params[:deadline], :tags => params[:tags])\n render json: { item: item }\n end", "title": "" }, {...
838ea6e0d5357bed12c2fb77923831db
To be overridden by the child controllers
[ { "docid": "5c3cfcbb42097019c3ecd200acaf9e50", "score": "0.0", "text": "def before_action \n end", "title": "" } ]
[ { "docid": "c0cfab87dea9d66f72688e24dea02bd1", "score": "0.6779724", "text": "def controller_name() self.class.controller_name end", "title": "" }, { "docid": "40f7f9a8053cda5781e8cf27340a2d71", "score": "0.67175", "text": "def controller; end", "title": ""...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "f09a7a1db708db99614fb17e09c3b0f8", "score": "0.0", "text": "def dog_params\n params.require(:dog).permit(:name, :breed, :age, :neighbor_id)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.69497335", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6812623", "text": "def strong_params\n params.require(:listing_member).permi...
04266804eb4d84f5312b654219f912ed
PATCH/PUT /source_linksets/1 PATCH/PUT /source_linksets/1.json
[ { "docid": "29d0a0ad04e83b19f89d7c3d694ced05", "score": "0.7477108", "text": "def update\n respond_to do |format|\n if @source_linkset.update(source_linkset_params)\n format.html { redirect_to @source_linkset, notice: 'Source linkset was successfully updated.' }\n format.json { ren...
[ { "docid": "09c009b9d0c5c5bb65bf878869f74f65", "score": "0.6912317", "text": "def set_source_linkset\n @source_linkset = SourceLinkset.find(params[:id])\n end", "title": "" }, { "docid": "e4d332f2be28f6e8638b0274fba69902", "score": "0.6704013", "text": "def source_linkset_par...
64f453aa760a93f093944dad3a875500
Returns the base URI for batch calls to this service.
[ { "docid": "5c08a795545515144ddda458b3c0ea6b", "score": "0.69554174", "text": "def batch_path\n if @discovery_document['batchPath']\n return @batch_path ||= (\n self.document_base.join(Addressable::URI.parse('/' +\n @discovery_document['batchPath']))\n ...
[ { "docid": "59fd643f84b3898fa1f6c786811f57ae", "score": "0.6523558", "text": "def uri\n raise InterfaceError, 'Base url is require to generate full uri.' unless @base_url\n return @base_url if @uri_parameters.nil? || @uri_parameters.empty?\n params_with_values = []\n @uri_parameters....
e13188fca352865bf2d24143344d99cf
your code goes here
[ { "docid": "9885151aa0acaa895c5074163749bc49", "score": "0.0", "text": "def magic_bev(max_jump, hurdles)\n largest_hurdle = hurdles.max\n largest_hurdle > max_jump ? largest_hurdle - max_jump : 0\nend", "title": "" } ]
[ { "docid": "d509f8cefdd8fc87fefabff3705478b5", "score": "0.6777912", "text": "def custom\n \n end", "title": "" }, { "docid": "04e074efc99de627ea58633a58870ec3", "score": "0.6370035", "text": "def stpreason\n end", "title": "" }, { "docid": "1d80084ab79c11756e15065da...