query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
d7bc52e41259e1ca2a8ae70cc8dbf175
this methods seems implied, but it is not ... why?
[ { "docid": "24ec558971d447fbd62f9cb8ccfe576a", "score": "0.0", "text": "def per_page\n @per_page \n end", "title": "" } ]
[ { "docid": "003f93545faf95741b6daf49b5599d9c", "score": "0.7099773", "text": "def _self; end", "title": "" }, { "docid": "c3285b979f713395f60cf13edce8a310", "score": "0.68309796", "text": "def methodmissing; end", "title": "" }, { "docid": "ed46df5c17a3916ba8db7656712f8e8...
e2b223fb6cb03d9f19cfc325c97fb6f8
Generates a numeric value within `lo`..`hi`
[ { "docid": "0de3326b1d7daf4719e7cd92e4a89d0b", "score": "0.68980783", "text": "def between(lo, hi)\n rand(hi + 1 - lo) + lo\n end", "title": "" } ]
[ { "docid": "c22497c8eb2806432e261f9cbeb3adac", "score": "0.6481663", "text": "def between(lo, hi = nil)\n case lo\n when Numeric\n rand(hi + 1 - lo) + lo\n when Range\n # @todo: #to_a is wasteful for large Ranges\n lo.to_a.bind{|a| a[between(0, a.length - 1)] }\n end\n end", ...
776d3e27e81476093ba46248b00064c5
Creates a remote authorized keys file for the given public key === Parameters +host+:: SSH host to connect to +password+:: SSH password +key+:: Public key hash. Have a look at +Railshoster::Utilities.select_public_ssh_key+ for more details about the key structure. +remote_dot_ssh_path+:: Remote path to the user's .ssh ...
[ { "docid": "8e40b0699daa23b47484bc6e4a7767a2", "score": "0.80847985", "text": "def create_remote_authorized_key_file(host, ssh_username, password, key, remote_dot_ssh_path = \".ssh\", target_username = nil)\n\n remote_authorized_keys_path = remote_dot_ssh_path + \"/authorized_keys\"\n \n ...
[ { "docid": "ed3b02ab2faa27960154326265253302", "score": "0.67008495", "text": "def _apply_key_to_remote key, remote, source=nil\n temp_auth = Tempfile.new('auth')\n\n # bring auth_key to local directory\n Net::SFTP.start(remote['hostname'], remote['username'], :auth_methods => ['publickey', 'password...
db860ab9f64e9a209a5adb906c4af054
Presses the key, with optional modifiers, and waits for loaded event
[ { "docid": "b8119a50b547de8cf3ea88180b041954", "score": "0.8046023", "text": "def load_page_with_key_press(key, *modifiers)\n wait_start\n key_press_direct(key, *modifiers)\n wait_for_window_loaded(\"\")\n end", "title": "" } ]
[ { "docid": "64154f2ba1dd2a51e08a327b049b88e5", "score": "0.673381", "text": "def press(key_sequence)\n end", "title": "" }, { "docid": "3888017148ad80c458b38bac41638a1b", "score": "0.6698327", "text": "def keypress(key = nil, name = nil)\n Vedeu.trigger(:key, key)\n\n ...
fcfd7b34d635409070531451f920e097
Reformat dimensions for IMD Files
[ { "docid": "749228430feb8be28985d55216327336", "score": "0.6253393", "text": "def imdSize(value)\n\t\twholeNum = value[0,3] #Pulls the whole number portion of the eVS dimension/size convention\n\t\tdecimal = value[3, 2] #Pulls the decimal portion\n\t\treturn \"#{wholeNum}.#{decimal}\".ljust(7, '0')\n\te...
[ { "docid": "7d3662ea0f1e7d52f0916dea61d19c97", "score": "0.6606173", "text": "def intrinsic_image_dimensions path, format\n if format == 'svg'\n # NOTE: prawn-svg automatically converts intrinsic width and height to pt\n img_obj = ::Prawn::SVG::Interface.new (::File.read path, m...
804874c58b9e6abf2ea38da87b83fef5
Tests the 'get_recipe' method of FoodDB
[ { "docid": "92eb1959de161d0bf58dbe80e0bff373", "score": "0.7583039", "text": "def test_get_recipe\r\n bread = BasicFood.new(\"Bread Slice\", 80)\r\n chicken = BasicFood.new(\"Chicken\", 245)\r\n rec = Recipe.new(\"Chicken Sandwich\", [bread, bread, chicken])\r\n assert_equal rec.name, @fdb.g...
[ { "docid": "82e1d978aed8224d922bff615ab084d7", "score": "0.79851615", "text": "def test_get_recipe\n\n end", "title": "" }, { "docid": "95c8d139462f4d2b23466c079f8c6bf9", "score": "0.76440394", "text": "def test_get_recipe\n assert(@fdb.get_recipe(\"Chicken Sandwich\")!=nil,\"Can...
fa6b53bf19a291965a14320e7162b09c
Send SMS Required parameters :from Either the one of the allocated numbers or arbitrary alphanumeric string of at most 11 characters :to Any phone number capable of receiving SMS :message Any UTF8 text Splitting and joining multipart SMS messages are automatically handled by the API
[ { "docid": "a52fc742812c579ee48dcff59af0455d", "score": "0.79022795", "text": "def send(parameters)\n verify_parameters(parameters, [:from, :message, :to])\n\n # Warn if the from string will be capped by the sms gateway\n if parameters[:from] && parameters[:from].match(/^(\\w{11,})$...
[ { "docid": "40e2d0dba7449d56ea5e350b7a103d78", "score": "0.7937394", "text": "def send_sms(params)\n from = params[:From]\n body = params.key?(:URL) ? params[:Body] + params[:URL] : params[:Body]\n to = params[:To]\n # returns a twilio API message object\n # refer to docs: https://www.twi...
59221659f4976e3f08d814de1ccb3648
Run the lsof diagnostic command. This command runs the lsof utility to\nlist a role&39;s open files.\n\nAvailable since API v8.
[ { "docid": "ccf208d91e1cb548c44a709287b2afbf", "score": "0.0", "text": "def api_v11_clusters_cluster_name_services_service_name_role_commands_lsof_post_with_http_info(service_name, cluster_name, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: Def...
[ { "docid": "ddc63342976e1af2961bde61cf9f6e37", "score": "0.6822419", "text": "def lsof\n Dir.new(\"/proc/#{Process.pid}/fd/\").entries\n end", "title": "" }, { "docid": "4ae951dc604dba9054035e0be415f84d", "score": "0.60711044", "text": "def open_files\n `lsof -p #{Process.p...
3e8bd5535631e28b6a6653ea57cc5389
Function that handles the reset code and resetting the password
[ { "docid": "d0037d5f41e394063abdfee17db6735e", "score": "0.772257", "text": "def reset\n\t\t# find user using the reset code specified\n @user = User.find_by_reset_code(params[:reset_code]) unless params[:reset_code].nil?\n if request.post?\n\t\t\t\t# update user's password\n \tif @user.upd...
[ { "docid": "42b6fe65f1bd2ca39497b1b292726835", "score": "0.7903035", "text": "def set_password_reset\n self.make_password_reset_code\n end", "title": "" }, { "docid": "f1c523eff4ed0c2b0049cbc969491c6b", "score": "0.75090593", "text": "def password_reset_request\n end", "titl...
4b05784398ddaad3e0c81ec192b04f8d
given an price_for_a_day, return that's the minimum price that can be offered. (to deny very large discounts, which could make insurance inviable).
[ { "docid": "fb2a035423edb9efb96c43892dce01ff", "score": "0.0", "text": "def apply_max_discount amount\n if self.day? && self.effective_from >= 2\n # map through the max_discount array of [<min_value_for_discount_to_be_applicable,max_discount_pct>]\n # and result in [<discounted_value_if_pos...
[ { "docid": "b780dd81f591f54b74598bb5e5bfcd42", "score": "0.6837364", "text": "def minimum_price\n price = production_cost + ah_deposit\n margin = recipe_group.profit_margin.blank? || recipe_group.profit_margin == 0 ? DEFAULT_PROFIT_MARGIN : recipe_group.profit_margin\n (price / 100) * margin\n ...
e8867e29c15fe31eb425844beb9bc943
Write and compile a +generate+ method for this Route.
[ { "docid": "38922a0c159b793437968d468533e5d5", "score": "0.6604494", "text": "def write_generation!\n # Build the main body of the generation\n body = \"expired = false\\n#{generation_extraction}\\n#{generation_structure}\"\n\n # If we have conditions that must be tested first...
[ { "docid": "3bc54aeeab588ffce02ef1327e66e92d", "score": "0.73251414", "text": "def write_generation!\n # Build the main body of the generation\n body = \"expired = false\\n#{generation_extraction}\\n#{generation_structure}\"\n\n # If we have conditions that must be tested first, nes...
fa9e45d62221ffe9a4cd23b9e178d672
GET /urgency_levels/1 GET /urgency_levels/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1ff15c89a7fa8a3d692c068765af24da", "score": "0.7727668", "text": "def index\n @urgency_levels = UrgencyLevel.all\n end", "title": "" }, { "docid": "f0e89a3ebdfae8d774bef41e4341e189", "score": "0.68505144", "text": "def set_urgency_level\n @urgency_level = Urgency...
f78f182fbe2e2dd074761a1d63513150
Gets the MAC masquerade addresses for this VLANs.
[ { "docid": "3c4e69e3634fd952d1df6b91af9f1b4a", "score": "0.5900664", "text": "def mac_masquerade_address\n super\n end", "title": "" } ]
[ { "docid": "91efbe3fc73295655ac4cc89b1d56c5f", "score": "0.6329531", "text": "def mac_addresses\n network_response = network_info\n return network_response unless network_response.successful?\n\n response = Response.new :code => 0\n response.data = network_response.data.values.collec...
d2623ac5c5986a370d59d26753557d8e
GET /dimgeoms/1 GET /dimgeoms/1.json
[ { "docid": "0dee2838f574e50bffce9f00a1d45595", "score": "0.77498966", "text": "def show\n @dimgeom = Dimgeom.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @dimgeom }\n end\n end", "title": "" } ]
[ { "docid": "f1a4b3cb53bfcfffc37e9e09f9b4379f", "score": "0.69778347", "text": "def new\n @dimgeom = Dimgeom.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @dimgeom }\n end\n end", "title": "" }, { "docid": "d07f15da7a07dcabc042121...
59d5a9b311dbb4595c6a8c386c037d9d
needed to setup avg goals per game
[ { "docid": "0ec1556e06ee8583195bd5aa5d5f2a54", "score": "0.7497882", "text": "def total_goals_per_game\n total_goals = 0.00\n @games.each do |game|\n total_goals += (game[1].away_goals.to_f + game[1].home_goals.to_f)\n end\n total_goals\n end", "title": "" } ]
[ { "docid": "22a5f0b4d80f4c2560340e87cfe673f8", "score": "0.7986893", "text": "def average_goals_per_game\n total_game = 0.0\n away_goals = 0.0\n home_goals = 0.0\n @game_data.each do |game|\n total_game += 1\n away_goals += (game[\"away_goals\"]).to_f\n home_goals += (game[\"h...
29407fab7a0b7d05fefdebcdc85645b3
Used to seed example data for hospital
[ { "docid": "9eb783c377909ae19efda66f43ecfaae", "score": "0.5877615", "text": "def seed_data\n\n target_isolates = rand(20) + 5\n shipment = shipments.new({:target_isolates => target_isolates})\n\n base_objective = BaseObjective.parent_objectives.to_a.sample\n if base_objective.first == \"obj...
[ { "docid": "baa45f9e705586c29b206ad31374eccc", "score": "0.7008907", "text": "def seed_data_for_holistic(prof, student)\n course = Course.create!(name: \"Intro to Computer (Holistic)\",\n pin: Faker::Number.number(digits: 6),\n professor_id: prof.id,\n ...
ff3eed9b93e9e6bbe1546d58957724c3
Check if any filter rules were defined
[ { "docid": "ff39561404ead22fb0fff937c5fac5eb", "score": "0.6723132", "text": "def filter_rules?\n if instance_variable_defined?(\"@filter_schema_dsl\") && !filter_schema_dsl.macros.empty?\n return true\n end\n\n parents.any?(&:filter_rules?)\n end", "title": "" }...
[ { "docid": "3ebbbdc11bf0e663984b5c3685961255", "score": "0.74032325", "text": "def validate_filterrific_available_filters; end", "title": "" }, { "docid": "fe4e422199491121509df32e454146db", "score": "0.7328438", "text": "def has_filter?\n return !(filter.empty? and pattern.empt...
141975cf0d8c45a9966e72731d1b41b2
Make sure saving for later works
[ { "docid": "eb2347b618bdae935de36fc4375123c9", "score": "0.0", "text": "def test_save_for_later \n post :add_set, :id => 1\n assert_redirected_to :controller => :cart, :action => ''\n post :move, :id => 4\n cart = get_anonymous_cart\n assert_equal(2, cart.cart_items.s...
[ { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.7761724", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "score": "0.7761724", "text": "def save; end", "title": "" }, { "docid": "e8af8e216821b936b27fe4e3e2d106ff", "sc...
49ca9b96779b9636d93d4ed97b43bf62
Lists all services related to the account matching search results [API] Method: GET /api/v1/servicevalues?name=:name Documentation:
[ { "docid": "8f486d73144377c1f938f1fc75ece314", "score": "0.67835104", "text": "def search(params)\n http.get(\"/service-values\", { params: params }) do |response|\n respond_with_collection(response)\n end\n end", "title": "" } ]
[ { "docid": "8f10107da7ac2bc11cda557a21e8fecc", "score": "0.6492603", "text": "def list\n http.get(\"/service-values\") do |response|\n respond_with_collection(response)\n end\n end", "title": "" }, { "docid": "c154959679eee42b2efafbca25f0f336", "score": "0.634...
fc5e449111efd03132424e6f9d1e9808
Read the file one byte at a time
[ { "docid": "635af5b69a94ace23802d270186a3e43", "score": "0.0", "text": "def read_body(&block)\n while byte = @body.read(1)\n yield byte\n end\n end", "title": "" } ]
[ { "docid": "17ad159da107726612f009ac9b38a680", "score": "0.68593466", "text": "def read()\n @file.seek(@address)\n @file.getc\n end", "title": "" }, { "docid": "a1f096ee9723a64bd286f423ef05aef9", "score": "0.6827926", "text": "def read(bytes)\n read_...
7bd5e15dd97c16ccf069d140521e64fa
Given path, look for a file called index. If found: create and return a Page object from that file else: create an index file at the given path, constructing a Page object from it.
[ { "docid": "c2a2202778f46533de3c9eb043c9a961", "score": "0.7667896", "text": "def index_file(path,depth)\n index = nil\n Dir[path].each do |item|\n next if File.directory?(item)\n if item =~ INDEX_PATTERN\n return index = create_page(item, depth)\n end\n end\n index = c...
[ { "docid": "4c1f64f9c44b360741860e7f8a522228", "score": "0.6999687", "text": "def create_index_file(path,depth)\n content = \"/ #{path}\\n/ #{depth}\\n/The navigation_helper requires that each directory contains a file called index.haml. This file was automatically generated, so be sure to replace th...
9162b383d1816e6d4cb0b7d4c29da4ba
DELETE /empresas/1 DELETE /empresas/1.json
[ { "docid": "353ffdf2fe0d3e9881599baac3a1f178", "score": "0.72996545", "text": "def destroy\n @empresa = Empresa.find(params[:id])\n @empresa.destroy\n\n respond_to do |format|\n format.html { redirect_to empresas_url }\n format.json { head :no_content }\n end\n end", "title": ...
[ { "docid": "48d46ec9b1304913b24e340713b5279f", "score": "0.7386035", "text": "def destroy\n @emprestimo = Emprestimo.find(params[:id])\n @emprestimo.destroy\n\n respond_to do |format|\n format.html { redirect_to emprestimos_url }\n format.json { head :no_content }\n end\n end", ...
dd2553e32f8b2fbcf76ec86a6eb32750
POST /paragrafs POST /paragrafs.json
[ { "docid": "f2d10362a561dfadbf42b6bfdde9f2bf", "score": "0.0", "text": "def create\n @staff = Staff.find(params[:staff_id])\n if @staff\n @paragraf = @staff.comments.new(comment_params)\n respond_to do |format|\n if @paragraf.save\n format.html { redirect_to @staff, notic...
[ { "docid": "bd6744fb2a79258238cf62ccd65039f6", "score": "0.6287576", "text": "def create\n @parish = Parish.new(parish_params)\n\n if @parish.save\n render json: @parish, status: :created, location: @parish\n else\n render json: @parish.errors, status: :unprocessable_entity\n end\n...
70c682fbd16684ec24b574b329e58dce
PATCH/PUT /adresses/1 PATCH/PUT /adresses/1.json
[ { "docid": "2a7caa949e5ccee090633d429a2bc903", "score": "0.5929138", "text": "def update\n respond_to do |format|\n if @adress.update(adress_params)\n format.html { redirect_to @adress, notice: 'Adress was successfully updated.' }\n format.json { render :show, status: :ok, location...
[ { "docid": "8dac5fca5170bbb2cf0ed50083bd5ff9", "score": "0.69077057", "text": "def update\n \n if @api_v1_address.update(api_v1_address_params)\n render json: @api_v1_address\n else\n render json: @api_v1_address.errors, status: 400\n end\n \n end", "title": "" ...
a295afd1d2a2aa82aac97c01ff8452d6
N^2 loop through all combinations of pairs, checking if the difference between each pair is == k
[ { "docid": "f7bc0c2032e93a50e614ff6b79ebda8f", "score": "0.62254876", "text": "def brute_force(k, nums)\n count = 0\n while num1 = nums.shift\n nums.each do |num2|\n count += 1 if difference(num1, num2) == k\n end\n end\n puts count\nend", "title": "" } ]
[ { "docid": "ce1d9d6b33400c5f7b2698b9760c8a18", "score": "0.7566866", "text": "def find_pairs_com(array, k)\n # array.combination(2).reject {|pair| pair.sum !=k }\n # array.combination(2).select {|pair| pair.sum ==k }\n array.combination(2).reduce([]){|result, pair| result << pair if pair.sum == k; re...
4023e67920aece2366b3e6546d726a1b
tests equality of two edges
[ { "docid": "e333a4ef227528652bf8b1b114b5fc0b", "score": "0.77086645", "text": "def ==(e)\n self.edge == e.edge\n end", "title": "" } ]
[ { "docid": "5814972d4bc5e7d84ec4018b966691e8", "score": "0.8205138", "text": "def edges_eql?(edge1, edge2)\n edge1 == edge2\n end", "title": "" }, { "docid": "387750b218ed8c944a874a312e203be2", "score": "0.80270004", "text": "def ==(another_edge)\n self.equal? anot...
787dc52e229b8f5e0e43bb4e1abfd263
The activity of the package in reverse chronological order. Each element represents a stop on the package's journey. Returns an array of OmniShip::Landmark::Track::Activity objects.
[ { "docid": "16f82dcea2bef1ea33c85c9d6bd46110", "score": "0.4965937", "text": "def activity\n @root.xpath('Events/Event').map do |act|\n Activity.new(act)\n end\n end", "title": "" } ]
[ { "docid": "329a8d412abe41b39ea65877646040c4", "score": "0.64738977", "text": "def activities\n @grouped_activities.flatten\n end", "title": "" }, { "docid": "f1c20a8caebbbd9f5ae29c46c3b39d36", "score": "0.602871", "text": "def activities\n retu...
7f92f2b57e48b14229d1051a975462f0
Constructs the base resource to send requests to.
[ { "docid": "12c0d90c3d88b1e6a0ee62effd09a1b0", "score": "0.6867927", "text": "def base_resource\n conn = Faraday.new(:url => client.node) do |builder|\n builder.use Faraday::Response::Logger, client.logger\n builder.use GetHackMiddleware\n\n builder.adapter :net_http_pe...
[ { "docid": "a73a0c27106ac9bb2a7a705039c889d1", "score": "0.699819", "text": "def build_resource(hash=nil)\n super\n end", "title": "" }, { "docid": "787bbab45efa0863e9fb966e197aa670", "score": "0.68046606", "text": "def resource_base_uri\n @resource ||= \"#{Hyperloop::Resour...
80752dbb3d965c5936e9f697aa3cd9f0
Recursively tests the given book and its children
[ { "docid": "a128f64b1b8de2de801735255d96b64f", "score": "0.7752274", "text": "def test_book(book)\n expect(book).to be_persisted\n expect(book.title).not_to be_blank\n expect(book.child_books.to_a + book.pages.to_a).not_to be_empty\n\n book.child_books.each do |cb|\n next if cb == book\...
[ { "docid": "c12cccb8fefb12f649836555334ec024", "score": "0.58663654", "text": "def test_more_chapters\n Republic::DirBinder.write(Republic::Book.new { |b|\n b << Republic::HtmlChapter.new { |c| \n c.text = \"<p>This is chapter 1</p>\"\n }\n b << Rep...
828e04dcf3398b713e011bbde018d763
helper for turning email to lowcase
[ { "docid": "64b8223df2bc21e46b3ce0937b3de69f", "score": "0.76855075", "text": "def downcase_email\n self.email.downcase!\n end", "title": "" } ]
[ { "docid": "c3a6cb6035653f9aaf1731cb82637152", "score": "0.81962776", "text": "def downcase_email\n \t email.downcase!\n \t end", "title": "" }, { "docid": "434a53dadeb1628ebc04d7cf7c8251af", "score": "0.80955535", "text": "def downcase_email\n\t email.downcase!\n\t ...
45decc26ab243a3fd5fd7e72902872af
Key to be used in the registration email
[ { "docid": "01e204704bf5fe0f5e0ce9af6ac9a363", "score": "0.68777", "text": "def optin_key\n require 'digest/md5'\n Digest::MD5.hexdigest(\"#{id}#{email}\")\n end", "title": "" } ]
[ { "docid": "ea77f968da051047e682ed9d9a392d8c", "score": "0.81617796", "text": "def email_key\n \"zDMSATq0W3hmA5p3rKTgD\"\n end", "title": "" }, { "docid": "fa0a5053cdfeab417d32158138caf3b4", "score": "0.7670039", "text": "def generate_registration_key\n self.registration_k...
013e9bc0b1a3c64284b2e9f8fadd6de5
rubocop:enable Metrics/AbcSize, Metrics/MethodLength rubocop:enable Metrics/PerceivedComplexity PUT /plans/1 rubocop:disable Metrics/AbcSize, Metrics/MethodLength
[ { "docid": "c14cbb3734f3da06b7ef8dee561c9928", "score": "0.6293336", "text": "def update\n @plan = Plan.find(params[:id])\n authorize @plan\n attrs = plan_params\n # rubocop:disable Metrics/BlockLength\n respond_to do |format|\n # TODO: See notes below on the pan_params definition. W...
[ { "docid": "468319d294c8832c42a52628f535bed3", "score": "0.6687917", "text": "def update\n @plan = Plan.find(params[:id])\n\n if @plan.update(plan_params)\n head :no_content\n else\n render json: @plan.errors, status: :unprocessable_entity\n end\n end", "title": "" }, { ...
09410948afd9c7ba302711c0b278f1d7
alows us to upload csv file to be processed into data this requires that a datastream has already been created to parse this file
[ { "docid": "265dcde54c83d978ccc71b287cfdcea4", "score": "0.647556", "text": "def upload\n logger.info{\"AT THE BEGINNING OF UPLOAD\"}\n first_row = Array.new\n flash_error = Hash.new\n name = Time.now.to_s + params[:datafile].original_filename \n directory = \"d...
[ { "docid": "48f2e6db5fc09bdb38f916244858e9a8", "score": "0.7438463", "text": "def upload\n if request.post?\n array_of_arrays, @message = parseCSV(params[:csvfile])\n if @message == 0\n uploadCSV(array_of_arrays)\n end\n end\n end", "title": "" }, { "docid": "a0b...
c8e3bf56d6f708760ed70a60326eba7b
=> "John Bonham" We can combine variables with methods :)
[ { "docid": "40eef4d3bf00432766f4d393a3f8a75e", "score": "0.0", "text": "def max(x, y)\n if x > y\n return x\n else\n return y\n end\nend", "title": "" } ]
[ { "docid": "b204be3889e86ba578c10c6856777905", "score": "0.77035695", "text": "def full_name(first_name, last_name)\n # When declaring a variable inside a method,\n # it exists only inside the method itself!\n name = \"#{first_name} #{last_name}\"\n return name\nend", "title": "" }, { "d...
6059eefcd4abfb186341fd97d92ff598
Reports what completion mission and possible completions would happen for a given input. Helpful for debugging your completion missions. ==== Example: >> Bond.spy "shoot oct" Matches completion mission for method matching "shoot". Possible completions: ["octopussy"]
[ { "docid": "7a16d58597acf532c224951b11bc4473", "score": "0.47464687", "text": "def spy(input)\n agent.spy(input)\n end", "title": "" } ]
[ { "docid": "32a3a6f65091df24ab8c4c8210aa2204", "score": "0.7251803", "text": "def spy(input)\n if (mission = find_mission(input))\n puts mission.match_message, \"Possible completions: #{mission.execute.inspect}\",\n \"Matches for #{mission.condition.inspect} are #{mission.matched.to...
57798831356772a02154cb5592ed9886
Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/oauth/v1/oauth.rb147
[ { "docid": "84c2aa104b8a70acbe3f11eca76559b3", "score": "0.0", "text": "def to_s; end", "title": "" } ]
[ { "docid": "f7ecc1a9dcd7606189d917d1528c6e3b", "score": "0.6916839", "text": "def authorization\n \"OAuth #{normalized_protocol_params_string}\"\n end", "title": "" }, { "docid": "3769b7021c9ad261703927c54516dae7", "score": "0.6905371", "text": "def oauth; end", "title": ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "91896057b1101182263c93d355181944", "score": "0.0", "text": "def set_match\n @match = Match.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60326946", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015941", "text": "de...
0777433ca309004d7d43b73f8fc1eb99
def self.prepended 1/ EXTENDED Nested Set extended, RM 4.0.0 OK Smile specific 323420 Optimization issues/index Smile specific : override of method in redmine/nested_set/traversing.rb that does not use association cache cached
[ { "docid": "315e63dbe66ce845719ca26c1ac48d8f", "score": "0.0", "text": "def root\n return @root if defined?(@root)\n\n @root = super\n end", "title": "" } ]
[ { "docid": "edbb4ca38ce7da1a70abf3855ca6bad2", "score": "0.6085571", "text": "def cached_association; end", "title": "" }, { "docid": "edbb4ca38ce7da1a70abf3855ca6bad2", "score": "0.6085571", "text": "def cached_association; end", "title": "" }, { "docid": "0595d7053d9a7d...
e7d4a94f289fb52ef525da93f89f7d5b
automode or specify TIME_RANGE and TIME_UNIT in shell to run
[ { "docid": "6a98baa6e441144f1dca36481a624637", "score": "0.50961787", "text": "def time_range\n return TimeSeries.parse(ENV['TIME_RANGE'], :unit => (ENV['TIME_UNIT'] || 'day'), :zone => cron.time_zone) if ENV['TIME_RANGE']\n # 选择开始时间。取出统计表的最后时间,和数据表的最先时间对比,哪个在后就选择哪个\n begin_day = DateTime...
[ { "docid": "6a7ec2bc7f9e09f820c9c96cf0ed23f0", "score": "0.67066884", "text": "def setupTimeRange()\n @timeOrigin = Time.parse(@demandConf[:timeOrigin]) ;\n @timeUntil = Time.parse(@demandConf[:timeUntil]) ;\n end", "title": "" }, { "docid": "bdb271fa3582ac6e53ca93b8bd88f76a", ...
7ccda348030903bc976cffba4ec554d9
Title:index Description:Show competition grid
[ { "docid": "da4ad6bc9e92444d075ec100f8543fb2", "score": "0.0", "text": "def index\n\t\tuser_id = 0\n\t\tuser_id = @user.id if (!@user.nil?)\n\t\t\n\t\t@racedata = []\n\t\traces = Race.where({:status=>STATUS[:ACTIVE]}).order('id DESC')\n\t\t\n\t\traces.each do |race|\n\t\t\t#Next stage info\n\t\t\tnext_s...
[ { "docid": "e575af9b3316bd940a60d0ba26237a87", "score": "0.7055785", "text": "def index\n @competitions = Competition.all\n end", "title": "" }, { "docid": "e575af9b3316bd940a60d0ba26237a87", "score": "0.7055785", "text": "def index\n @competitions = Competition.all\n end", ...
fec1888fe259677a82d26b27e4d332e8
GET /galleries GET /galleries.xml
[ { "docid": "e0c16f7a0df4a12300731871cc9159e0", "score": "0.6742076", "text": "def index\n respond_with(@galleries = Gallery.all.paginate(:page => params[:page] || 1, :per_page => params[:per_page] || 10))\n end", "title": "" } ]
[ { "docid": "1b766cad15be29bf6f397a891d1b974d", "score": "0.7454129", "text": "def index\n @galleries = Gallery.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @galleries }\n end\n end", "title": "" }, { "docid": "634fcc3...
40bbc20af56d0be52a00731d6ae76fa5
Gives the Pokemon an item to hold.
[ { "docid": "e1b0de0a2f60be3e0b7ca1849eb8b33f", "score": "0.0", "text": "def item=(value)\n validate value => [Symbol, Item, NilClass]\n @item = value\n end", "title": "" } ]
[ { "docid": "a6ccc07edd47acc27f557b1ab34d6326", "score": "0.74545985", "text": "def take_item\n @base_ui.hide_win_text\n # @type [PFM::Pokemon]\n pokemon = @party[@index]\n item = pokemon.item_holding\n $bag.add_item(item, 1)\n pokemon.item_holding = 0\n @team_buttons[@...
7462c9e4d784edec4fca23ee8a4833c2
Misc code to automate sprite animation and placement
[ { "docid": "865a85e7e9226eb4362d0bb282eae117", "score": "0.0", "text": "def animateScene(align = false, smanim = false, &block)\n # special intro animations\n @smTrainerSequence.update if @smTrainerSequence && @smTrainerSequence.started\n @smSpeciesSequence.update if @smSpeciesSequence && @smSp...
[ { "docid": "61d2f7025dff290eced41641dd6c9bbe", "score": "0.7423465", "text": "def animation_set_sprites(sprites, cell_data, position, animation, anim_pos = nil, anim_mirror = false)\n for i in 0..15\n sprite = sprites[i]\n pattern = cell_data[i, 0]\n if sprite == nil or pattern == nil ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a7511de64d331d7af895537d4d375eac", "score": "0.0", "text": "def regex_params\n params.require(:regex).permit(:expression, :title, :user_id, :text_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ec771f1098434a502ff120fded78310a", "score": "0.0", "text": "def set_scan\n @scan = Scan.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
65948e9abcd32292957352308f35b031
Check the format of input file is OpenAPI v3 specificaion or not.
[ { "docid": "c2ddbdfe002927a85d2cca2eaa1f0b1d", "score": "0.7097907", "text": "def v3?\n @data['openapi'] =~ /^3/\n end", "title": "" } ]
[ { "docid": "c8b6d3d1e411c0211d0e24a6b083e5e4", "score": "0.6455687", "text": "def validate_format\n return unless content\n return validate_format_json if format == 'json'\n validate_format_yaml\n end", "title": "" }, { "docid": "c8b6d3d1e411c0211d0e24a6b083e5e4", "score": "0.6...
88560f685115ef84e7bec34bfa0c353c
GET /posts/1 GET /posts/1.xml
[ { "docid": "149791c88c08c2a02a1df5df94309dee", "score": "0.0", "text": "def show\n @post = Post.find_by_permalink(params[:id], :include => :comments) || Post.find(params[:id])\n redirect_to admin_posts_path and return unless @post.type.match(/Article|Snippet/)\n @comment = flash[:comment] || @p...
[ { "docid": "96353a9632432f29bdb1830a6be90489", "score": "0.71852463", "text": "def index\n @posts = Post.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @posts }\n end\n end", "title": "" }, { "docid": "e75a5ac4832589b22...
453c2fdc15abd8c228df64af6f5039da
DELETE /season_standings/1 DELETE /season_standings/1.json
[ { "docid": "e163d1b34c80acfafcb837a902fe620e", "score": "0.7982011", "text": "def destroy\n @season_standing.destroy\n respond_to do |format|\n format.html { redirect_to season_standings_url, notice: 'Season standing was successfully destroyed.' }\n format.json { head :no_content }\n ...
[ { "docid": "cdd3c73c240e037b654eb98621ada173", "score": "0.7808049", "text": "def destroy\n @api_season.destroy\n respond_to do |format|\n format.html { redirect_to api_stadia_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "23599508129997...
256fcbfde939935c2857a04dd039a630
Method to expose all unfinished matches to NodeJS to update them regularly
[ { "docid": "d56aaf6dfca5ca9602a256ccf04df89d", "score": "0.552148", "text": "def recent_matches\n @matches = Match.where(status: nil);\n render json: { matches: @matches }, status: :ok\n end", "title": "" } ]
[ { "docid": "7201883ced72590fd0e757a5fb8ef514", "score": "0.71907896", "text": "def queue_matches\n\n end", "title": "" }, { "docid": "0154e4eac0894d762d49a3871eaab883", "score": "0.6652356", "text": "def matches\n process_events! unless @matches\n @matches\n end", "...
189a55b04a36d3e47745fe9803386691
POST update facility basic info step 1 / submit
[ { "docid": "93feafc0576d5507e06f248836fde9b5", "score": "0.7394004", "text": "def update_basic_info\n is_draft = params[:commit] == 'draft'\n @wizard_form = FacilityWizardForm::BasicInfoForm.new(selected_facility_id)\n if @wizard_form.submit(facility_basic_info_params, current_user)\n if p...
[ { "docid": "d149c18d98850b6e2f69393569abb18c", "score": "0.7055221", "text": "def update\n\n respond_to do |format|\n if @facility.update_attributes(params[:facility])\n format.html { redirect_to(@facility, :notice => 'Facility was successfully updated.') }\n format.xml { head :ok...
36faf465967c30038a7062f757796e79
GET /estado_academicos GET /estado_academicos.json
[ { "docid": "626bc9b793281b6700b39cc2d3e5029e", "score": "0.64577234", "text": "def index\n\t\tauthorize! :index, EstadoAcademico\n @estado_academicos = EstadoAcademico.where(usuario_id: params[:usuario_id])\n respond_to do |format|\n format.js {render partial: 'index', content_type: 'text/htm...
[ { "docid": "19795a7d70307b6082d903431a18cb44", "score": "0.74690425", "text": "def index\n @cursoacademicos = Cursoacademico.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cursoacademicos }\n end\n end", "title": "" }, { "docid...
b6ad3d00ab18a50cf64bf3c44d78bd27
POST /users POST /users.json
[ { "docid": "ed4567e94c3a093d5408f56d8666a222", "score": "0.0", "text": "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :crea...
[ { "docid": "4794c3e6e2db462f4d8769453efddedd", "score": "0.77179813", "text": "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "title": "" }, { "docid": "a3973850c21e121410e2101...
e4a1e47f54bb4d3077454bc727be8800
Put the current instance into the Rack environment
[ { "docid": "19aedaf3a3a6c8616b34affa93e68a08", "score": "0.608761", "text": "def finish\n super\n @_env[ENV_KEY] = self\n end", "title": "" } ]
[ { "docid": "e276c02dbd55aae39bbed964eb86a4b8", "score": "0.67368484", "text": "def put_on_a_hat\n\n # set all instance variables we have in the sinatra request object\n self.instance_variables.each { |v| @sinatra.instance_variable_set(v, self.instance_variable_get(v)) }\n\n end", "...
682bc739293a7b13f88aceca12fc2755
Return canned article representation
[ { "docid": "302e34386c09fb7ecc16ca0ab91aeda1", "score": "0.56720746", "text": "def article_representation article\n \n # Get the attributes of the article as an array of strings\n arr = article.attributes.values.map(&:to_s)\n temp_arr =[]\n \n # Iterate attributes \n arr.each do |e...
[ { "docid": "cb2c569b80108195b10033dbc6dd12b9", "score": "0.61496836", "text": "def interpret(i)\n article = Article.new\n article.title = !i.title.nil? ? i.title : 'n/a'\n article.source = @source\n article.pub_date = !i.pubDate.nil? ? i.pubDate : nil\n\n name = !i.source.nil? ? i.source....
d0ad057f6ae28e5b38f04019fd75217a
Declares that this class is a singleton class; that is, only one instance will be published over QMF
[ { "docid": "8a9319354038c322b4431dcd89f14ee0", "score": "0.62751734", "text": "def is_singleton\n def self.instances\n @instances ||= [self.new]\n end\n\n def self.find_all\n instances\n end\n\n def self.find_by_id(id)\n instances[0]\n end\n end", ...
[ { "docid": "a3860511f4560931f84dc7532c454e34", "score": "0.7591888", "text": "def singleton_instance; end", "title": "" }, { "docid": "b31ef8fa133fad41ca008d03fcb42b31", "score": "0.7066998", "text": "def singleton_class\n class << self\n self\n end\n end", "t...
d4a1edaae4d92d004632cf64501ce2e7
DELETE /users/1 DELETE /users/1.json
[ { "docid": "23ce4ec5a613101eac02244d591e8b34", "score": "0.0", "text": "def destroy\n User.find(params[:id]).destroy\n respond_to do |format|\n flash[:success] = 'User successfully deleted.'\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end",...
[ { "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...
2471d9afd5231fe7cb1ec74f2cf40fa5
GET /metabolites/1 GET /metabolites/1.xml
[ { "docid": "c9ba7d69559177d5d7370eedde1110a7", "score": "0.66233134", "text": "def show\n @metabolite = Metabolite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @metabolite }\n end\n end", "title": "" } ]
[ { "docid": "882726ea5ad42930ee9a3ab3034a7f1b", "score": "0.59826833", "text": "def metar(id)\n perform_get(\"/metars/#{id}.xml\")\n end", "title": "" }, { "docid": "0e24e23b2ebdbd12cb15dc5a8b4337b9", "score": "0.5699481", "text": "def show\n @dataset = Dataset.find(params[...
4ac4585bbfe9959eb49a664a3176f40a
DELETE /categorie_endroits/1 DELETE /categorie_endroits/1.json
[ { "docid": "acaf6a2c0fba00944227e55486e76416", "score": "0.77639765", "text": "def destroy\n @categorie_endroit = CategorieEndroit.find(params[:id])\n @categorie_endroit.destroy\n\n respond_to do |format|\n format.html { redirect_to categorie_endroits_url }\n format.json { head :no_co...
[ { "docid": "a7159c3198f969533187322dcf4a852e", "score": "0.7531653", "text": "def destroy\n @categorie_droit.destroy\n respond_to do |format|\n format.html { redirect_to categorie_droits_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "076...
0935d93c734e6a7e7c2c3c750aeeca6a
Suggests a gem based on the supplied +gem_name+. Returns a string of the gem name if an approximate match can be found or nil otherwise. NOTE: for performance reasons only gems which exactly match the first character of +gem_name+ are considered.
[ { "docid": "8ba25d0a2123d90f9466cd5da2db7f9c", "score": "0.757935", "text": "def suggest_gems_from_name gem_name\n gem_name = gem_name.downcase\n max = gem_name.size / 2\n specs = available_specs(:complete).values.flatten 1\n\n matches = specs.map { |name, versio...
[ { "docid": "c5e0410ebff90356845d694eab2fe988", "score": "0.73270303", "text": "def gem_name\n # XXX need to explicitly run regex here to get $1\n !!(str =~ RPM::Spec::SPEC_GEM_REQ_MATCHER) ? $1 : nil\n end", "title": "" }, { "docid": "67d8cffeeb431525a21c4aaf6c5f1a48", ...
4042722393e15f235f1edeff8967ea1e
DELETE /billing_entries/1 DELETE /billing_entries/1.xml
[ { "docid": "f209ed00f05093390b88c2f03f791adb", "score": "0.7568216", "text": "def destroy\n @billing_entry = BillingEntry.find(params[:id])\n @billing_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(billing_entries_url) }\n format.xml { head :ok }\n end\n end...
[ { "docid": "f023d58fe8a2bde26a7fee303f645eea", "score": "0.6684002", "text": "def destroy\n @payable_billing = PayableBilling.find(params[:id])\n @payable_billing.destroy\n\n respond_to do |format|\n format.html { redirect_to(payable_billings_url) }\n format.xml { head :ok }\n end...
8d33598131105334736bc5d369c0d3ff
Draw Item index : item number
[ { "docid": "b5d265385589741d83e3d059f4d0cd74", "score": "0.75843567", "text": "def draw_item(index)\n item = @data[index]\n case item\n when RPG::Item\n number = $game_party.item_number(item.id)\n when RPG::Weapon\n number = $game_party.weapon_number(item.id)\n when RPG::Armor\n...
[ { "docid": "d2566c62642471098939f4452f400a95", "score": "0.84374243", "text": "def draw_item(index)\n end", "title": "" }, { "docid": "4b2edfd253f390ffb1e20ee9f33ce36c", "score": "0.80428684", "text": "def draw_item(index)\n item = @data[index]\n rect = item_rect(index)\n e...
18f29a09ae387954226a6f9d7cdd3260
ideally BGS would fix the WSDL for this service to conform with how their own WSDLs work. override what's in the wsdl
[ { "docid": "c652d0aa0d0b13cccb011d8a39419592", "score": "0.0", "text": "def namespace_identifier\n \"v1\"\n end", "title": "" } ]
[ { "docid": "2e777c7065866488698d85e4dea2c599", "score": "0.6843631", "text": "def fix_wsdl!(wsdl)\n ['type', 'base'].each do |name|\n ['long', 'string', 'date', 'int', 'boolean'].each do |type|\n # Fix this attribute over the entire document\n wsdl.gsub!(Regexp.new(\"#{name}=\\\"#{type}\\\...
d60fc4d72bf496dbffdd9e0bf94ef90c
Gets the subscriptions property value. The set of subscriptions on the list.
[ { "docid": "7f6be295fd960d8dd90cb759d0f114de", "score": "0.80017143", "text": "def subscriptions\n return @subscriptions\n end", "title": "" } ]
[ { "docid": "4a397961e1d68c6de8d962f8032a3e96", "score": "0.7901944", "text": "def subscriptions=(value)\n @subscriptions = value\n end", "title": "" }, { "docid": "4a397961e1d68c6de8d962f8032a3e96", "score": "0.7901944", "text": "def subscriptions=(value)\n ...
4573ca4a7638651656c04f8b39af20c3
Bypasses a specified number of elements at the end of an observable sequence.
[ { "docid": "61e0bdb0aed8a5310202666bba5c6448", "score": "0.68132764", "text": "def skip_last(count)\n raise ArgumentError.new 'Count cannot be less than zero' if count < 0\n AnonymousObservable.new do |observer|\n q = []\n new_obs = Observer.configure do |o|\n\n o.on_nex...
[ { "docid": "e36006bee46c56a06858397d3408ea88", "score": "0.6234877", "text": "def test_skips_all_elements_count_gt_size\n stream = FromArray.new([1, 2, 3])\n collected = stream.skip(4).collect\n assert(\n collected == [],\n 'Expected ' + [].to_s + ' but got ' + collected.to_...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "34bccf10b0643fe0312b71a4203db30b", "score": "0.0", "text": "def set_lint_item\n @lint_item = LintItem.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165422", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60457647", "text": "def action_hook...
46d8d02c19337f84754e307dc1497cee
PATCH/PUT /user_tickets/1 PATCH/PUT /user_tickets/1.json
[ { "docid": "dc564d3d2a3c3f098e909825ea324015", "score": "0.69993395", "text": "def update\n respond_to do |format|\n if @user_ticket.update(user_ticket_params)\n format.html { redirect_to @user_ticket, notice: 'User ticket was successfully updated.' }\n format.json { render :show, ...
[ { "docid": "c688d28de0f35ba118f552139e42f273", "score": "0.7240718", "text": "def update\n if !@ticket.user.nil? && (@ticket.user != current_user)\n raise 'Access Denied'\n end\n\n update_params = ticket_params\n if @ticket.user.nil?\n update_params[:user_id] = nil\n end\n\n ...
0d437b7e9ff5cc2440310f86ca3fb327
Assert that two versions are equal. Handles strings or FoobarMod::Version instances.
[ { "docid": "908a60a4c21b72365aa539ceb5bd21a6", "score": "0.7873554", "text": "def assert_version_equal(expected, actual)\n assert_equal v(expected), v(actual)\n assert_equal v(expected).hash, v(actual).hash, \"since #{actual} == #{expected}, they must have the same hash\"\n end", "title": "" ...
[ { "docid": "bbc1d31e09b2cc84af73876c4f741c67", "score": "0.78578496", "text": "def assert_version_eql(first, second)\n first, second = v(first), v(second)\n assert first.eql?(second), \"#{first} is eql? #{second}\"\n assert second.eql?(first), \"#{second} is eql? #{first}\"\n end", "title"...
d478f54b01e80069d8af386d56ce457a
Returns the column of the given range. For single line ranges, this is simple. For ranges with line breaks, we look a the last code line.
[ { "docid": "c91038392220642cb9bdf916e56f2e3a", "score": "0.72902906", "text": "def column_of(range); end", "title": "" } ]
[ { "docid": "3f75520ce2147aa3bc8025a744db3cdc", "score": "0.6733518", "text": "def col\r\n @lines[@line_num].cursor\r\n end", "title": "" }, { "docid": "4be49365eef86d6416f87be1f2b779e0", "score": "0.64593625", "text": "def column\n\t return -1 if @inputStack.empty? # only if i...
1865140c696f06e3e5304bc1376c4779
further exploration array and string
[ { "docid": "ea727dbe988157f7e13589d131c9ab0b", "score": "0.0", "text": "def palindrome?(argument)\n argumen.reverse == argument\nend", "title": "" } ]
[ { "docid": "c31b281e193584204e632119075c14f6", "score": "0.61309433", "text": "def look_and_say(array)\n\nend", "title": "" }, { "docid": "37c8f4599a5776eed399ca402014485f", "score": "0.60690194", "text": "def saved_for_special_occasion(array)\n puts array[2]\nend", "title": "" ...
9185a546a6b741d727fad8efe07bc19a
find the current user's pet.
[ { "docid": "f854e9e4ac467a88b0a16216d64e8ef3", "score": "0.77955025", "text": "def pet\n current_user.registers.find_by name: @event.pet_name\n end", "title": "" } ]
[ { "docid": "092ad0bd1e17d2970ac3280cb96db8f8", "score": "0.7257758", "text": "def set_pet\n @pet = current_user.pets.find(params[:id])\n end", "title": "" }, { "docid": "e91a4081dda07ebdc2e4aa8092b639d8", "score": "0.69890344", "text": "def current_poet\n Poet.find_by(id: se...
13768b4f9910b80690cee345a4bdc328
Get issues of version. Include descendants project.require inputted start date and due date.
[ { "docid": "3d0db908802bf62d7a42bb688973fdcc", "score": "0.7256886", "text": "def version_issues(proj_id, version_id)\n proj = Project.find(proj_id)\n Issue.cross_project_scope(proj, 'descendants')\n .where(\"#{SQL_COM} AND fixed_version_id = ? \", version_id)\n end", "title": "" } ]
[ { "docid": "d58878b3fb2593d856da83d021ae79ba", "score": "0.67025363", "text": "def find_all_issues\n version_id_sql = \"project_id =\\\"#{@project.id}\\\" \" + \\\n \"AND name = \\\"#{@version}\\\"\"\n # obtaining the unique ID from the chosen project version\n version = Ver...
fc931a9b2b806a5b7ea60d97c87795d1
GET /space_scene1s GET /space_scene1s.json
[ { "docid": "e2a860642c8e4163af3711317e163b8a", "score": "0.8211387", "text": "def index\n @space_scene1s = SpaceScene1.all\n end", "title": "" } ]
[ { "docid": "df1596823eed667ee761ba087d5f068a", "score": "0.7658347", "text": "def index\n @scene1s = Scene1.all\n end", "title": "" }, { "docid": "4417aad8628ec7db74f9a8a14d111e95", "score": "0.73514414", "text": "def index\n @space_scene2s = SpaceScene2.all\n end", "titl...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "75691f27d2268b6c1750af7349a1ee70", "score": "0.0", "text": "def preorder_params\n params.require(:preorder).permit(:user, :mobile, :id_num, :gender,\n :remarks, :used)\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...
ba7c355353d56828d31bf848016ca1b9
If fail on first attempt, sleep and try again using acquire_lock
[ { "docid": "69ec584bc09b99761e2278011cf8a63b", "score": "0.7249212", "text": "def acquire_lock\n if @lock < 1\n return 1\n else\n c_ts = Time.new\n curr_ts = c_ts.to_i\n if (@ts - curr_ts > 10)\n @ts = curr_ts # Time out lock if another client waiting too long\n ...
[ { "docid": "36964160577cd6fc641fe5f0dd6f2523", "score": "0.7490875", "text": "def try_lock() end", "title": "" }, { "docid": "d0d96b095201c8942b5a078b0cfe38ea", "score": "0.7242307", "text": "def lock!\n until key[:_lock].setnx(Time.now.to_f + 0.5)\n next unless timestamp...
01206043cb28c43c044f00d919a2eca5
Difference between solution sets, from SPARQL 1.1. The `minus` operation on solutions returns those solutions which either have no compatible solution in `other`, or the solution domains are disjoint.
[ { "docid": "4d1be4ba8092162792be517001c3ef4b", "score": "0.78420246", "text": "def minus(other)\n self.dup.filter! do |soln|\n !other.any? {|soln2| soln.compatible?(soln2) && !soln.disjoint?(soln2)}\n end\n end", "title": "" } ]
[ { "docid": "2b89c07014334bcc574a838d372bf8de", "score": "0.68830806", "text": "def -(other) difference(other) end", "title": "" }, { "docid": "fb83f1add43599d02ede4e7b2f85fd43", "score": "0.6678909", "text": "def difference(other)\n Rangops::Set.difference(self, other)\n end"...
e76f7eb36c310feb25f308e0e12d2259
Map table columns of the table to the mapping
[ { "docid": "961b7fd87dbb10c56c58e6851db614f2", "score": "0.76248217", "text": "def map_columns(table)\n counter = 0\n table.search(\"//tr\").first.search(\"//td\").each {|td|\n for key in self.mapping.keys\n puts \"Processing #{key} with value #{self.mapping[key]}\" if $debug\n...
[ { "docid": "074d8e1a68b42eceb05d1b21e28eacd1", "score": "0.7625712", "text": "def column_mappings\n mappings\n end", "title": "" }, { "docid": "8d15e1f4774134213eb6e958852896b5", "score": "0.72842795", "text": "def mapped_columns\n @columns.map do |column|\n @...
b30ca5f43b059d0269ef2dc25cd8e90e
Eventmachine callback asking for more to write Send input and close stream in
[ { "docid": "dd84788cd2bc2541ee7a08decfd9be5b", "score": "0.6064617", "text": "def post_init\n if @input\n send_data(@input)\n close_connection_after_writing\n @input = nil\n else\n close_connection\n end\n end", "title": "" } ]
[ { "docid": "43cda7b1da07dab946cca0149fd250c5", "score": "0.6671497", "text": "def eventable_write\n 40.times {\n break if @outbound_q.empty?\n begin\n data,target = @outbound_q.first\n io.send data.to_s, 0, target\n @outbound_q.shift\n rescue Errno::E...
53c131a5d29e0ea57153d41c099af467
Acces +FutureArray+ value by index.
[ { "docid": "991ba494c74933c259d60bd449d4c1aa", "score": "0.6067694", "text": "def [](index)\n raise_or_value @arry[index]\n end", "title": "" } ]
[ { "docid": "f453a9d615c5cdf48267f30adb8044fb", "score": "0.6805551", "text": "def get(index)\n return @arr[index]\n end", "title": "" }, { "docid": "8218284b8417ec23f63220e49425c95f", "score": "0.6646061", "text": "def get(index)\n @array_list.get(index)\n end", "titl...
1368269ca710b9c00da3ad01386de52b
Unsubscribe from events that publish to the specified +callback+.
[ { "docid": "ed2830a2a2badee2e0a09108f40d04d2", "score": "0.80979186", "text": "def unsubscribe( callback )\n\t\t@subscriptions.values.each {|cbset| cbset.delete(callback) }\n\tend", "title": "" } ]
[ { "docid": "e3c6827e5a881516574dac64ef393dc3", "score": "0.7906181", "text": "def unsubscribe( callback )\n\t\tself.subscriptions.keys.each do |pattern|\n\t\t\tcbset = self.subscriptions[ pattern ]\n\t\t\tcbset.delete( callback )\n\t\t\tself.subscriptions.delete( pattern ) if cbset.empty?\n\t\tend\n\ten...
24db9bf5a5dcad908f1a022a89791e5e
DELETE /api/clients/1 DELETE /api/clients/1.json
[ { "docid": "41c9da8872bd2e1c62d18470a067293b", "score": "0.0", "text": "def destroy\n @user = current_user\n @client = @user.company.clients.find(params[:id])\n valid_client!\n @client.destroy\n head 200, :content_type => 'text/html'\nrescue Exceptions::StdError => e\n puts e.message\n...
[ { "docid": "7a0e69d4b1958684e5ebe80d49ead9e9", "score": "0.83733803", "text": "def destroy\n http_api.delete(\"clients/#{@name}\")\n end", "title": "" }, { "docid": "8a67da3c0a80239b790a14b51d559de9", "score": "0.81564546", "text": "def destroy\n render json: @api_v1_clien...
852e30d2b43a86aef0c38361a0cd1885
GET /intentions/new GET /intentions/new.json
[ { "docid": "92cad7f49ae1ab3b8ed4e5dff67b1e24", "score": "0.71608484", "text": "def new\n @intention = Intention.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @intention }\n end\n end", "title": "" } ]
[ { "docid": "24f744f52d49f2e713d9cb48bcab5c71", "score": "0.68821365", "text": "def new\n @opinion = Opinion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @opinion }\n end\n end", "title": "" }, { "docid": "24f744f52d49f2e713d9cb4...
2b3fd2b3917cab89eb2ce4af6923a0fe
Returns the collection of cars by model
[ { "docid": "4fa7a05348386a31932808a43f5880d9", "score": "0.0", "text": "def check_collection_by_class\n @collection.map { |e| e.check_vehicle_class }\n end", "title": "" } ]
[ { "docid": "98ab05a6549be06e9d080d13dda33cb4", "score": "0.68281937", "text": "def index\n @car_models = CarModel.includes(:make).order(\"makes.name,car_models.name\").page(params[:page]).per_page(30)\n end", "title": "" }, { "docid": "a92176fff1c5763c03da73e9a46a464d", "score": "0.6...
918f25545a2fcbeed3743a98674a20eb
RegularExpressionBackslashSequence = RS !LineTerminator SourceCharacter
[ { "docid": "11da3b3b2f06ef7c1017b9d21d178bff", "score": "0.7901647", "text": "def _RegularExpressionBackslashSequence\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_RS)\n unless _tmp\n self.pos = _save\n break\n end\n _save1 = self.pos\n _tmp =...
[ { "docid": "76c479d37d71a52467b0322ad29dc21c", "score": "0.6874945", "text": "def _RegularExpressionChar\n\n _save = self.pos\n while true # choice\n\n _save1 = self.pos\n while true # sequence\n _save2 = self.pos\n\n _save3 = self.pos\n while true # choice\n ...
784103e418649e29b0304fc1a3b2af03
the userdefined actions that this instance should take when its host list is updated, as read from the ec2 userdata Returns: array of strings
[ { "docid": "962748c3ee56739c157a40a0abf6638a", "score": "0.54117495", "text": "def action_strs\n @action_strs ||= user_data_as_array('action')\n @action_strs\n end", "title": "" } ]
[ { "docid": "423c5b0aaec6485a2105abbff480cdd1", "score": "0.6256419", "text": "def action_list\n case\n when no_servers_or_positive_balance? then clear_notifications\n when before_shutdown_warnings? then before_shutdown_actions\n when perform_shutdown? then shutdown_servers_ac...
f163475ca96073ecb32cef83da050730
get plugins associated with the requested item type
[ { "docid": "c03acd9757e64985d01998161b3a62f5", "score": "0.8814738", "text": "def get_applicable_plugins(type)\n PluginManager.get_plugins_by('items', type)\n end", "title": "" } ]
[ { "docid": "eb4bdfdcbcdceccc1b46297f398fe6a9", "score": "0.7394429", "text": "def get_general_plugins\n PluginManager.get_plugins_by('items', 'all')\n end", "title": "" }, { "docid": "14a5c00774abf91286499ed31b4a6f2f", "score": "0.7002956", "text": "def available_plugins(type: :...
b70f1ffc70d3088f8436f4e1d4ff0fb4
convert json date format to WCF date format
[ { "docid": "0790e92c09c004e7cce11d69d02d2c11", "score": "0.553132", "text": "def json_time_records_to_wcf(records)\n records.map do |record|\n record[:RecordDate] = Lohnmanger::DateTimeTranslator.to_wcf(record[:RecordDate])\n record[:Shift1_Start] = Lohnmanger::DateTimeTranslato...
[ { "docid": "74afd15f741b925836adeb19b686e4ad", "score": "0.6949725", "text": "def format_date date\n \"Date.UTC(#{date.year}, #{date.month - 1}, #{date.day})\".to_json\n end", "title": "" }, { "docid": "899efb46c739fee9b7ee4e8034aec7ea", "score": "0.66986626", "text": "def solriz...
6e4f2d729bfdb2bf57681cbaf13e6c2a
Coerce an event to a hash
[ { "docid": "6f437a22a38c06b3dbfa2c53264f0291", "score": "0.0", "text": "def to_h\n @payload\n end", "title": "" } ]
[ { "docid": "cf9b2834583852ad3219ab8aadb530b7", "score": "0.6950017", "text": "def event_to_hash(event)\n {\n when_raw: {\n start: event.dtstart,\n end: event.dtend,\n },\n when_human: {\n start_time: event.dtstart.strftime('%H:%M'),\n end_time: event.dtend.strftime('%H:%M')...
cdb4d8da386ee3cb08b1f7772d99d63a
Wrap the author name in HTML tag, with or without break (for styling taxonomic names legibly)
[ { "docid": "255ba2014112b46975fe0002a28e2f2e", "score": "0.65220535", "text": "def small_author\n possibles = [\"<br/>\", \"</i></b>\", \"</i>\"]\n tag = possibles.each do |x|\n break x if include?(x)\n end\n return self unless tag.is_a?(String)\n\n offset = tag.length\n ind = rin...
[ { "docid": "9a4592c5aaf28f9d1b8a950cd0384bdb", "score": "0.7100674", "text": "def pretty_author(user, options = {})\n content_tag :span, :class => \"author vcard\" do\n content_tag :span, :class => \"fn\" do\n user.name rescue \"Admin\"\n end\n end\n end", "title"...
fb872e533ed1b1c7ad09281c4d4a28f3
GET /work_points GET /work_points.json
[ { "docid": "558d7968aa10e097887f4c6215ef4587", "score": "0.76085776", "text": "def index\n @work_points = WorkPoint.all\n end", "title": "" } ]
[ { "docid": "21608d4927dd2e8fcf67ed662d3bb4d5", "score": "0.7541824", "text": "def index\n if params[:workflow_id]\n @workpoints = Workflow.find(params[:workflow_id]).workpoints\n elsif params[:user_id]\n @workpoints = User.find(params[:user_id]).workpoints\n else\n @workpoints = ...
513abd885262d77c28f2648494933b9d
changes current working directory for a block to the git working directory example
[ { "docid": "dae80ae095be92d8c5e7b55e876ad1a0", "score": "0.6073217", "text": "def chdir # :yields: the Git::Path\n Dir.chdir(dir.path) do\n yield dir.path\n end\n end", "title": "" } ]
[ { "docid": "750877dcdd00c49b94dda9e3b62858ba", "score": "0.7312817", "text": "def exec_in_git_dir(&block)\n Dir.chdir(top_level, &block)\n end", "title": "" }, { "docid": "adbb90f6a0943f560ef7142abc9b6685", "score": "0.72575414", "text": "def exec_in_git_dir(&block)\n ...
5ffd5cd97d74cc2a3123cf4254015a60
Relativizes all paths in the given content, which can be either HTML or CSS. This filter is quite useful if a site needs to be hosted in a subdirectory instead of a subdomain. In HTML, all `href` and `src` attributes will be relativized. In CSS, all `url()` references will be relativized.
[ { "docid": "a5f144ebfa188f2777e6b7593bb59cc3", "score": "0.64166176", "text": "def run(content, params={})\n # Set assigns so helper function can be used\n @item_rep = assigns[:item_rep] if @item_rep.nil?\n\n # Filter\n # FIXME use nokogiri or csspool instead of regular expressions\n...
[ { "docid": "192248287b6957c13d9787c83aeffaad", "score": "0.7037794", "text": "def rewrite_content_urls!(file_path, content)\n content.gsub!(IMAGE_URL_PATTERN) do |s|\n\t\t\t\turl = WebResourceBundler::CssUrlRewriter.rewrite_relative_path(file_path, $1)\n\t\t\t\thost = host_for_image(url)\n\t\t\t\ts...
962915dab1635a594faed6da59488385
=begin Define method that loops through string, replace all vowels and consonants, and store result in new variable Conditionally test if letter in loop is a vowel or consonant Define method that converts string to array, swap and reverse its order, and capitalize Define methods that advance the current letter of vowel...
[ { "docid": "9b8a13b656ce424e757cfc2b86a3f033", "score": "0.0", "text": "def swap_case(name) # converts string to array, capitalize each index, and return reversed string\n array_name = name.split(' ')\n array_name.each do |idx|\n idx.capitalize!\n end\n array_name.reverse.join(' ')\nend", "ti...
[ { "docid": "55a29d54808790437d70d629e8de8acb", "score": "0.78193235", "text": "def name_changer(name)\n \n #consonants is string of alphabet without vowels\n consonants = \"bcdfghjklmnpqrstvwxyz\"\n #vowels is a string of vowels\n vowels = \"aeiou\"\n #new name is blank string\n #new_name = \...
6e1f37a3716c63e226edc248769d8ff6
SlideDown & SlideUp called consecutively
[ { "docid": "7741fa6df544c9760b57825b045a4cb2", "score": "0.72649777", "text": "def test_slideDownUp\n @w_slideToggle = Window_Base.new(0, 250, 100, 50)\n @w_slideToggle.animationSpeed = 2000\n @w_slideToggle.visible = false\n slideToggle()\n return true\n end", "title": "" } ]
[ { "docid": "06df7b5db8a880b49777bd5a569781e0", "score": "0.7362705", "text": "def slideUp\n if self.height > 0\n @duration = self.animationSpeed\n @orig_height = self.height\n @closing = true\n @opening = false\n @animationType = SLIDE\n end\n end", "title": "" }, ...
b269fa548519e6fd374ab26305bbb605
dx and dy should be either +1, 0 or 1. This will be used to grow in all four directions for both diagonal and horizontal movement. Ex. dx = 1, dy = 1 > grow diagonally toward top left, or dx = 0, dy = 1 => grow horizontally toward the right.
[ { "docid": "8f09e83c4cd4474c2a5154f21867b0e5", "score": "0.5778182", "text": "def grow_unblocked_moves_in_dir(dx, dy)\n sx, sy = self.pos[0], self.pos[1]\n ally_color = self.color\n enemy_color = self.color == :white ? :black : :white\n moves = []\n\n until (sx < 0 || ...
[ { "docid": "42d1eb1f3762324530263f0e7f1e0874", "score": "0.6395582", "text": "def expand!(dx, dy)\n min = Point.new(@min.x - dx, @min.y - dy)\n max = Point.new(@max.x + dx, @max.y + dy)\n initialize(min, max)\n return self\n end", "title": "" }, ...
64080874083930156d19275bf110cd96
Invoke export task Invoke export task. There can be only one export task run at any point of time. Hence invocation of another export task will be discarded, when there exist an already running export task. Exported configuration will be in a CSV format. This CSV file will be zipped into a ZIP file, that can be downloa...
[ { "docid": "8f28433bccbeb1735b8293bed94422bd", "score": "0.60015184", "text": "def invoke_export_task_0_with_http_info(export_request_parameter, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyTaskApi.invoke_export_task_0 ...'\n end\n ...
[ { "docid": "e4f581498948eef1e3d5f201b34b1641", "score": "0.69595855", "text": "def perform\n SiteConfig.set_pairwise_credentials(photocracy)\n earl = Earl.find(earl_id)\n\n # make HTTP request to pairwise to get export data\n url = URI.parse(\"#{APP_CONFIG[:API_HOST]}/exports/#{export_key}\"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "d291d9ed6491c8374a12dc68423fa901", "score": "0.0", "text": "def set_doctor\n @doctor = Doctor.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60339177", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60135007", "text": "d...
fbeab2b2c7c1eb9c5f9626d918b4886f
Get an enum member by string, symbol, or integer value
[ { "docid": "ca5668237142fe1c9978dca8f5493d94", "score": "0.54992384", "text": "def get(value)\n case value\n when Symbol\n @values[value]\n when String\n @values[value.to_sym]\n when Integer\n @values[value]\n end\n end", "title": "" } ]
[ { "docid": "eeebbce860bb2bdf5b6464c570383574", "score": "0.6228843", "text": "def const_missing (name)\n _, f, k = /(.+?)_(.+)$/.match(name.to_s).to_a\n if _ and instance_methods(false).include? \"enum_field_for_#{f.downcase}\"\n if key_value = send(\"#{f.downcase}_values\")...
9013229add8ae7a7a7066f039d353884
bastard? : > Boolean Was this entry a bastard? (Posted right after the poster's last late entry)
[ { "docid": "10fcca293bc0260e121f81cb105a0231", "score": "0.766904", "text": "def bastard?\n end", "title": "" } ]
[ { "docid": "7d1cda155a519868085da1ea4ca3af03", "score": "0.6269203", "text": "def drink_blood?\n @drank_blood_today\n end", "title": "" }, { "docid": "e3bcf4c9d9c263619992afeeac814fc4", "score": "0.6233106", "text": "def busted?(hand)\n if hand.busted?\n puts \"Busted!\"\...
b899a07d949e31ea057aea19f6fe5c65
ONIX ProductAvailability code (PR.24.22, List 65) inferred by product format status
[ { "docid": "d503a5c6c62ea7a5d329175ad6c67bf7", "score": "0.618332", "text": "def availability\n STATUS_TO_AVAILABILITY[self.status]\n end", "title": "" } ]
[ { "docid": "027693439037e152c8ba366823b60673", "score": "0.6257587", "text": "def furnished_status_lookup(code)\n case code.to_i\n when 0 then 'Furnished'\n when 1 then 'Part Furnished'\n when 2 then 'Un-Furnished'\n when 3 then 'Not Specified'\n when 4 then 'Furn...
960af96cff93b38a5210dedd8210fe6f
Checks the value is within the terminal's confines.
[ { "docid": "5f1831556e71266d115ed982f810b28a", "score": "0.686655", "text": "def x_out_of_bounds?(value)\n value < 1 || value > Terminal.width\n end", "title": "" } ]
[ { "docid": "dc2a4d8958e6ab59962b0f8c5eab94c4", "score": "0.71352196", "text": "def y_out_of_bounds?(value)\n value < 1 || value > Terminal.height\n end", "title": "" }, { "docid": "8977c54a1ac0a637476bd49d81bf1578", "score": "0.6359889", "text": "def check_bounds(val)\n ...