query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
9c4859af61a571684d1fa9ab20c02ba4
Not (!) part of the AbstractRepository API: A simple helper method to be used to add directories to this revision
[ { "docid": "50c7cbe063070935bcabc30ce24ee27b", "score": "0.61615604", "text": "def __add_directory(dir)\n __add_file(dir)\n end", "title": "" } ]
[ { "docid": "a8bebf37a99c32862f75e5e5a0e72723", "score": "0.6866397", "text": "def add_dir(path)\n return self if path.dot?\n add_entry(path) { Git::Object::Tree.new }\n end", "title": "" }, { "docid": "022ec5806459e73b82036af11282caf9", "score": "0.6802561", "text": "def add_d...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b6ec50a94465238bb425552e7978feea", "score": "0.0", "text": "def set_user_avatar\n @user_avatar = UserAvatar.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
c955cfc6b3c1ffcf278d2d6e0b35212d
POST /clients POST /clients.json
[ { "docid": "18a4dbe43ac0c5cd5fc91d1c20a7db59", "score": "0.0", "text": "def create\n @client = Client.new(client_params)\n\n respond_to do |format|\n if @client.save\n format.html { redirect_to new_transaction_path(client_document: @client.cedula, store_id: params[:store_id]), success:...
[ { "docid": "463c7897bc343b5c33ded0eb3d7c38a8", "score": "0.7867169", "text": "def create\n http_api.post(\"clients\", self)\n end", "title": "" }, { "docid": "84186d209e6b5dca2e0c8146b546a058", "score": "0.7761909", "text": "def create_client(params={})\n post('/clients', ...
ba8352ff05311af1d7905d0077c83b5f
use of the splat (params) is optionally it's recommended because it makes the method more flexible
[ { "docid": "04d46abf6e5700dbc947b9b2375a76b6", "score": "0.0", "text": "def in2(param1, param2, param3, param4)\n params = [param1, param2, param3, param4]\n out0 'average', params.inject(:+).to_f/params.length\nend", "title": "" } ]
[ { "docid": "9b972b7e4ec15b1bedfcdf009908e72c", "score": "0.8457713", "text": "def splatting *params\n params\nend", "title": "" }, { "docid": "0812ac0baec42937f68895fbbe182710", "score": "0.75672454", "text": "def params(*) end", "title": "" }, { "docid": "0812ac0baec4293...
80488e89ea488b4fafa498ecfec60f39
Set the value of the VaultFile input for this Choreo.
[ { "docid": "38449442b84f673e94760fce7b0f95eb", "score": "0.71839267", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" } ]
[ { "docid": "64a213edd940307e83538c2febb1e516", "score": "0.6915905", "text": "def set_VaultFile(value)\n set_alias(\"VaultFile\", value)\n end", "title": "" }, { "docid": "64a213edd940307e83538c2febb1e516", "score": "0.6915905", "text": "def set_VaultFile(value)\n ...
487404fbb7f305c8c4966411daf6ebc2
GET /reports/1 GET /reports/1.json
[ { "docid": "d1eaab4591b6da2cefc02e488b615e0f", "score": "0.0", "text": "def show\n @report = Report.find(params[:id])\n if !current_admin && current_user.country_id != @report.user.country_id\n redirect_to @report.user, :alert => \"You are not authorized to access that report\"\n else\n ...
[ { "docid": "ced6e6f1efc254443c13b63043bb5b52", "score": "0.78875566", "text": "def reports(params = {})\n JsonObject.new( api.json_response(\"reports/\", params) )\n end", "title": "" }, { "docid": "4b1bbf79725e0b23213cf21d2a96fdd9", "score": "0.75881416", "text": "def index\...
1e8436670b6225b3688f20a13d4bd955
12.2 VariableDeclaration : Identifier Initialiser[opt] return tuple of [name, initialiser]
[ { "docid": "5256ae81bdb42cb04d7134fe61b27252", "score": "0.6617604", "text": "def var_decl(var_env, options)\n a = identifier(var_env)\n if !a\n raise ParseError.new(\"bad identifier\", lex);\n else\n b = initialiser(var_env, options)\n [a, b]\n end\n end", ...
[ { "docid": "421a06efd06f5b3f4a08479ab68f359e", "score": "0.6974971", "text": "def vardeclaration\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 6 )\n __IDENTIFIER2__ = nil\n __IDENTIFIER3__ = nil\n __INTEGER4__ = nil\n t = nil\n\n ...
798edc98a35e16c1746f1ae7a57ae909
GET /api/v1/items/:id/merchant returns the associated merchant
[ { "docid": "a20c9338382c4907e3fdd70a8a59d4a1", "score": "0.80816096", "text": "def merchant\n respond_with Item.find(params[:id]).merchant\n end", "title": "" } ]
[ { "docid": "9975e23feca98114e7a5ecf2c561a90c", "score": "0.78353417", "text": "def get_merchant\n @merchant = Merchant.find(params[:id])\n end", "title": "" }, { "docid": "9400aaa87aa78a573e5a28377022a8ef", "score": "0.7769993", "text": "def merchant\n # TODO: modify for eag...
8f54beca5002655e22ea2578787407f9
PATCH/PUT /location_logs/1 PATCH/PUT /location_logs/1.json
[ { "docid": "d91515a629459c37a47390c30f8bb3c7", "score": "0.70769", "text": "def update\n respond_to do |format|\n if @location_log.update(location_log_params)\n format.html { redirect_to @location_log, notice: 'Location log was successfully updated.' }\n format.json { render :show,...
[ { "docid": "2fe2cd17422b7a9766bd044d6479bda7", "score": "0.6589649", "text": "def update\n respond_to do |format|\n if @request_log.update(request_log_params)\n format.html { redirect_to @request_log, notice: 'Request log was successfully updated.' }\n format.json { render :show, s...
b14fd8d1fc38816ba649118816314471
GET /items GET /items.json
[ { "docid": "5398d6d5d3bb9e861effc7c47efbdcbf", "score": "0.0", "text": "def index\n @items = Item.all\n end", "title": "" } ]
[ { "docid": "d57502db186679bf451e04276f7c18d6", "score": "0.8122018", "text": "def items\n get_request configure_payload('/items')\n end", "title": "" }, { "docid": "005225439f5ef107aba338963dfc8a47", "score": "0.7835984", "text": "def get_items\n render json: { items: @lis...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8d7986aa4d76ca2855b576d18e8dec72", "score": "0.0", "text": "def set_company\n @company = Company.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...
de3f05e26d8834bcc41a0c9d072b0d0b
GET /allbks GET /allbks.json
[ { "docid": "2855e91ab1e4bee4b6f52c32a581e752", "score": "0.7096073", "text": "def index\n @allbks = Allbk.all\n end", "title": "" } ]
[ { "docid": "d31f6ad0f04c739cc5dbf26f72235b84", "score": "0.7542024", "text": "def index\n @bks = Bk.all\n end", "title": "" }, { "docid": "f5daef5a5bfb54ff671c48d58242b316", "score": "0.67634934", "text": "def index\n @bhks = Bhk.all\n end", "title": "" }, { "doci...
25b3c8d9a27d9dd699c2c997d6583c5a
Compare results from two pages if there is error directives ON
[ { "docid": "b1947510df4c5d36f81939200d6fe5f8", "score": "0.5456544", "text": "def compare_results_error(after)\n return (after.include? \"Warning: mysql_\") || (after.include? \"Error: mysql_\") || (after.include? \"Fatal Error: mysql_\") || (after.include? \"error: mysql_\") || (after.include? \...
[ { "docid": "5c704dc4159aca4c317215d35d22a3cb", "score": "0.6439683", "text": "def check_for_page_errors\n errors = ErrorCheck.new()\n if errors.page_errors?(@current_url, @log_dir)\n @processing_messages = @current_url << \" Error page result found\"\n return true\n else\n @proce...
4827fdab82e6511743ce4f2082e05504
Return a string containing the serialized content of the receiver.
[ { "docid": "b90839c861920d23613e26125637cf02", "score": "0.0", "text": "def to_s\n Forme.transform(:serializer, @opts, @form.opts, self)\n end", "title": "" } ]
[ { "docid": "9d437a721c55b92a48f9776e5349abe3", "score": "0.7779051", "text": "def to_s()\n serialize.to_s()\n end", "title": "" }, { "docid": "9d437a721c55b92a48f9776e5349abe3", "score": "0.7779051", "text": "def to_s()\n serialize.to_s()\n end", "title": "" ...
f5d2929ecc63093bc5d74cd05a2e0c4d
Custom getter & setter to override standard devices password column name
[ { "docid": "da507cfc3ab63337e3d357fc72fa418b", "score": "0.62281954", "text": "def encrypted_password\n read_attribute(:password)\n end", "title": "" } ]
[ { "docid": "03613e11e38e53839f25fba2b179a5ff", "score": "0.6951722", "text": "def password\n \t\t return password_virtual_attr\n end", "title": "" }, { "docid": "1976dcc4951c5dd4539ecf13c079a2f3", "score": "0.68507576", "text": "def old_password=(string)\n end", "title": "" ...
6e8a50785a704bdf0f6849101fcc20e0
Returns a description of how to use this plugin
[ { "docid": "f85de2a3379aa85812d99dbc583fbcc5", "score": "0.0", "text": "def usage\n [\n \"#{at_nick} weather - returns the weather in the default location for today\",\n \"#{at_nick} weather tomorrow - returns the weather in the default location for tomorrow\",\n \"#{at_nick} weather <...
[ { "docid": "8b983ca82d1d73ef235245989c33209f", "score": "0.73201376", "text": "def description\n \"Derelict::Plugin::Manager for #{instance.description}\"\n end", "title": "" }, { "docid": "5ec7e42fbc76891a68a5b81af05c864f", "score": "0.72512347", "text": "def get_help\n ...
129eb30e66455ac6c8cb1be647bc5a0b
:name, :grade, :street, :building, :boro
[ { "docid": "ffa74723c95c93ab96fafc553967532c", "score": "0.0", "text": "def initialize (input)\n @input = input\n end", "title": "" } ]
[ { "docid": "fa953a6e1f6602a495e0c705615e527b", "score": "0.6237494", "text": "def attributes\n {\n :name => 'Zargon',\n :last_name => 'Zomg',\n :location => 'earth',\n :other => 'wow'\n }\n end", "title": "" }, { "docid": "0f7a6a70216b5aae30188ca83755ec28", "sc...
644f8d3333f207539aeb8061419756e1
The default [file, flags, mode] tuple for a given fd and filename. The default flags vary based on the what fd is being redirected. stdout and stderr default to write, while stdin and all other fds default to read. fd The file descriptor that is being redirected. This may be an IO object, integer fd number, or :in, :ou...
[ { "docid": "74d7f11a6bc1e432c4fd7f8385bf4887", "score": "0.6714348", "text": "def default_file_reopen_info(fd, file)\n case fd\n when :in, ::STDIN, $stdin, 0\n [file, OFLAGS[\"r\"], 0644]\n when :out, STDOUT, $stdout, 1\n [file, OFLAGS[\"w\"], 0644]\n ...
[ { "docid": "b9b51194663fd3159ab85377e9094559", "score": "0.68286353", "text": "def default_file_reopen_info(fd, file)\n case fd\n when :in, STDIN, $stdin, 0\n [file, \"r\", 0644]\n when :out, STDOUT, $stdout, 1\n [file, \"w\", 0644]\n when :err, STDERR, $stderr, 2\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "518b4fd6ab05bfdf31bf8932b6f7bb00", "score": "0.0", "text": "def set_user\n @user = User.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def ...
2608830e8912be11e778b6f2bcba3222
Read the direct read_temperature on the instance itself
[ { "docid": "01b4d6690335c0a62116980234f3166d", "score": "0.0", "text": "def has_temperature?(level,options={})\n level.to_s == has_temperature(options).to_s\n end", "title": "" } ]
[ { "docid": "34b708846748556a58386c78f0fd112b", "score": "0.7616264", "text": "def read_raw_temperature\n i2cset(BMP085_CONTROL, BMP085_READTEMPCMD)\n sleep 0.005\n return i2cget(BMP085_TEMPDATA, 2).unpack('s>')[0]\n end", "title": "" }, { "docid": "69d9460614bc461433b...
79e5ce234215190d44fccd9d5fe0b137
GET /price_lists GET /price_lists.xml
[ { "docid": "093a54205f0f17dfb00dba30df92ba6a", "score": "0.68370116", "text": "def index\n @search = current_company.price_lists.search(params[:search])\n @price_lists = @search.paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { ...
[ { "docid": "178d3575531bce169a5135d4c64e43b8", "score": "0.70041025", "text": "def show\n @price_list = PriceList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @price_list }\n end\n end", "title": "" }, { "docid"...
649dd214333f033b516a2255f459985d
PATCH/PUT /products/1 PATCH/PUT /products/1.json
[ { "docid": "181c97f11710a838dd4133fe4d95bdd7", "score": "0.64243215", "text": "def update\n respond_to do |format|\n if @product.update(product_params)\n format.html { redirect_to @product, notice: 'Your product was successfully updated.' }\n format.json { render :show, status: :ok...
[ { "docid": "fa2eeaa45445dd76141374dc13ffab6d", "score": "0.7269931", "text": "def update\n begin\n @api_v1_product.update!(api_v1_product_params)\n head :no_content\n rescue => ex\n json_response({error: ex.message}, :unprocessable_entity)\n end\n end", "title": "" }, { ...
0011f0e68a8421e1100dfe1f2cb4e886
To customize the behavior of this controller, you can overwrite any of the RESTful actions. For example: def index super
[ { "docid": "35b9b04c88018b6c19ea24d732bd0762", "score": "0.0", "text": "def valid_action?(name, resource = resource_class)\n if name.to_s == 'edit' or name.to_s == 'destroy' or name.to_s == 'new'\n return false\n end\n !!routes.detect do |controller, action|\n controller == ...
[ { "docid": "482b23013182c2a5d1680e0eeb79f9b3", "score": "0.8049583", "text": "def index\r\n super\r\n end", "title": "" }, { "docid": "e0140cdd45a860240e2f1a59b7217cc4", "score": "0.79925674", "text": "def index\n super\n end", "title": "" }, { "docid": "e0140cdd4...
175630ff2e6148f7e62126e1ed72a25e
Validation of the carts products Get all instances of a lineitem where it has a reference to this cart and product Get the length of the number of line items and check if its greater than the current product inventory if not than its valid for purchase
[ { "docid": "16e75a716ec87814d9d2b93db43d6cd2", "score": "0.80615646", "text": "def validate_cart(cart)\n for product in cart.products.uniq\n items = LineItem.where(\"cart_id=? AND product_id=?\", cart.id, product.id)\n itemQuantity = 0\n \n for item in items\n i...
[ { "docid": "cdd64aefd07d554a991d98003b9d24c2", "score": "0.7350779", "text": "def validate_stock\n self.delivery_challan_line_items.each do |line_item|\n product=line_item.product\n stock = Stock.find_by_product_id_and_warehouse_id(line_item.product_id, self.warehouse_id)\n if !line_item.quan...
8534dd04448b0356ff58b50fff852534
extracts the targetUrl from the SAML document this is referred to as "Application Destination URL" in the Federation Advanced Settings for your app
[ { "docid": "9ac6c818462f1662f21bf9f9c52e827f", "score": "0.78408283", "text": "def application_destination_url\n @application_destination_url = expected_saml_node_content( @saml_doc, '/samlp:Response/saml:Assertion/saml:AttributeStatement/saml:Attribute[@Name = \"targetUrl\"]/saml:AttributeValue' )...
[ { "docid": "d7f235bef854fb14bfd5860df3ad081e", "score": "0.7422131", "text": "def saml_provider_sso_target_url\n @attributes[:saml_provider_sso_target_url]\n end", "title": "" }, { "docid": "7201c95f2c37eebe86c269000f4268b0", "score": "0.69372314", "text": "def saml_provider_...
25e0a13fce88482cf1552c83227b51c2
POST /licenses POST /licenses.json
[ { "docid": "3916db009c4525b4a78bc2be73c44d43", "score": "0.69980985", "text": "def create\n @license = License.new(params[:license])\n\n respond_to do |format|\n if @license.save\n format.html { redirect_to @license, notice: 'License was successfully created.' }\n else\n fo...
[ { "docid": "dfe9f29dfcfd2c7472f6fa02a7db6056", "score": "0.76743066", "text": "def create\n @license = current_user.licenses.new(license_params)\n set_license_key\n \n respond_to do |format|\n if @license.save\n format.html { redirect_to @license, notice: 'License was successfull...
2a5ebc9e830e071edc92ff84769f564f
Returns an Array of all Resources currenty tracked
[ { "docid": "8e2e5eefdf63eaa3fd0b19db9aff1afd", "score": "0.0", "text": "def all\n results = query '*::*::*::*'\n (results.each {|r| yield r}) if block_given?\n results\n end", "title": "" } ]
[ { "docid": "e52407452328d438d5a2bd93a2b7bd52", "score": "0.69289494", "text": "def resources\n @resources.values\n end", "title": "" }, { "docid": "4ccbc9f01f863883962f6d50ee6ef9e5", "score": "0.67768615", "text": "def current_resources\n hash = {}\n resources.each ...
3c75bf9e48e750fa3a1538891c26dc29
Creates a new portfolio
[ { "docid": "5125483d99d0e1ed2b411be5b0fab697", "score": "0.7907234", "text": "def new_portfolio(new_portfolio)\n unless new_portfolio.blank? || new_portfolio[:name].blank?\n portfolio = Portfolio.new(new_portfolio)\n if portfolio.save\n @product.portfolios << portfolio\n ...
[ { "docid": "03ee81b40c9b3fa25bf60e1682794ee8", "score": "0.84484017", "text": "def create\n portfolio = Portfolio.new(portfolio_params)\n portfolio.save\n end", "title": "" }, { "docid": "181d61f868845fff2351bfcda4279fe5", "score": "0.79797053", "text": "def create\n...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "3fa9aced6e266a7042ce295ba62b74e2", "score": "0.0", "text": "def set_lesson\n lesson = Lesson.find(params[:id])\n @lesson = lesson if lesson.course_id == @course.id\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60328794", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6017492", "text": "de...
26392360525a8dfe5ee19702cb7b2874
GET /events GET /events.json
[ { "docid": "655c4f37a1cc45c7491e6e13ba2b5770", "score": "0.0", "text": "def index\n @exclude_events = Attendee.select('event_id').where(\"user_id = ?\",current_user.id)\n if(params.has_key?(:tag_id))\n @events = Event.includes(:location)\n .includes(:tag).where(\"date > ? ...
[ { "docid": "5febda362ddaf472b8c6c6319cecc36f", "score": "0.8337294", "text": "def events\n response = self.class.get('/v1/events.json')\n response.code == 200 ? JSON.parse(response.body) : nil\n end", "title": "" }, { "docid": "6dfa825090a0345739db26145778532e", "score": "0....
9d8654cd6f31130ba3830ebebd65328c
Returns a name for a constant.
[ { "docid": "057d68c4d45fec6d091efa33fc096978", "score": "0.6860424", "text": "def mangle_const_name(name)\n ('c_'+name.to_s).to_sym\n end", "title": "" } ]
[ { "docid": "5aecc160a636f05967dbc34a148e3445", "score": "0.80048317", "text": "def const_name\n components = name.gsub(/\\W/,' ').split.collect {|word| word.strip.upcase }\n components.join '_'\n end", "title": "" }, { "docid": "5aecc160a636f05967dbc34a148e3445", "score": "0...
351885fb3988894465328328b5e49370
With a value, sets the spot price to the given fraction of the instance's full price (as found in Ironfan::Cloud::Aws::FLAVOR_INFO) With no value, returns the spot price as a fraction of the full instance price.
[ { "docid": "7a160b3fb70dde44ec01c8aab6d5429b", "score": "0.759398", "text": "def spot_price_fraction(val=nil)\n if val\n spot_price( price.to_f * val )\n else\n spot_price / price rescue 0\n end\n end", "title": "" } ]
[ { "docid": "b582d8c59726ce18b7c79b00fa6c1be5", "score": "0.7606241", "text": "def spot_price_fraction val=nil\n if val\n spot_price( price.to_f * val )\n else\n spot_price / price rescue 0\n end\n end", "title": "" }, { "docid": "b582d8c59726ce18b7...
6590ba710cdaac26d675ad05f9fdbe36
A method to be overridden to process the data returned via the API
[ { "docid": "a723279e0beba9d48a5eafa2b25a9149", "score": "0.0", "text": "def process(response)\n end", "title": "" } ]
[ { "docid": "cc4694a032b32f4125140543e76a1b2c", "score": "0.72480494", "text": "def process_data; end", "title": "" }, { "docid": "b112303204d01ca41081873feadc3131", "score": "0.7113942", "text": "def get_data\n\t\tself.process\n\t\t@result \n\tend", "title": "" }, { "doci...
cc1b16601f808acd047e1414f76d322b
This method has no interface. We were asked to export accounts as CSV to do some analysis and I programmed it as an action for the same price.
[ { "docid": "bef1ce4eb288744376cbd9c761a182da", "score": "0.7083747", "text": "def export_accounts\n # TODO: THERE'S DUPLICATION FROM InvoicesController in CSV setup.\n\n # These charsets are expected to be common in our users.\n charset = (request_from_a_mac? ? \"MacRoman\" : \"ISO-8859-1\")\n ...
[ { "docid": "51fdab4195b5d7de4a9ccba736068fbc", "score": "0.66729474", "text": "def fee_reciepts_export_csv\n parameters={:search => params[:search] ,:filename => filename}\n csv_export('finance_transaction', 'fee_reciepts_export', parameters) \n end", "title": "" }, { "docid": "a12ec1...
514d2adf99a991519d606e953990c55b
Change the patron's name + selected_patron: a Patron object which was selected by the user + model: a string representing the object type as selected by the user Calls method
[ { "docid": "9dff3bafedf10698443a7facce1fdde9", "score": "0.7108999", "text": "def edit_patron_name(selected_patron, model)\n print \"New name: >>\"\n name = gets.chomp\n saved = selected_patron.update_attributes(name: name)\n record_save_result(saved, selected_patron, model)\nend", "title": "" ...
[ { "docid": "0d83efb3029d9c7a4cab299589096163", "score": "0.6223328", "text": "def set_patron\n @patron = Patron.find(params[:id])\n end", "title": "" }, { "docid": "85abe0ae5eceb195de85281f64ec7b20", "score": "0.62216765", "text": "def edit_patron_record(selected_patron, mode...
4108c58be92185526f86d290ad377077
returns a list of all primes up to limit using seive of eratothenes
[ { "docid": "1d4d89e8cf8a72b3ede3b1d6b55620b0", "score": "0.8012621", "text": "def prime_sieve(limit)\n numbers = (0..limit).to_a\n cancel = Array.new(numbers.size) { |i| i > 1 }\n numbers.each_with_index do |x, i|\n if cancel[i]\n (2..(limit / x)).each do |j|\n cancel[j * x] = false\n ...
[ { "docid": "5025517e0b71b9e2a1a161509964580e", "score": "0.8329645", "text": "def primes\n prime_generator.up_to(limit)\n end", "title": "" }, { "docid": "6743a0019aec43d2f2ec5d09dc0b2bca", "score": "0.8261902", "text": "def get_primes(limit)\n\tprimes = []\n\trange = (2..lim...
051fa73a026270e2f01615f11e6d7ac1
Perform an HTTP POST request
[ { "docid": "6c625272f8596f63d4b6a64a50938d9a", "score": "0.7196192", "text": "def post(options = {})\n request(:post, options)\n end", "title": "" } ]
[ { "docid": "5c1ec63530305c389abd6a59bdde167a", "score": "0.8160274", "text": "def submit_post_request(url, params = {}, https = false)\n HTTP.post(url, params, https).body\n end", "title": "" }, { "docid": "adbd4063f9795c23205a346f6dfd3f22", "score": "0.7844649", "text": "def pos...
abb75bb53e497d8297884e2c59a50846
GET /accounts/1 GET /accounts/1.json
[ { "docid": "de959a314fb449869b059cd3cc772d4b", "score": "0.0", "text": "def show\n @transactions = current_client.transactions\n if @account && @account.client == current_client\n render :show\n end\n end", "title": "" } ]
[ { "docid": "3d3ff04ef8494c8c36fbe48c94bdaeb2", "score": "0.7835325", "text": "def accounts\n get(ROBINHOOD_ACCOUNTS_ROUTE, return_as_json: true)\n end", "title": "" }, { "docid": "ca863cb0daac453cb713dbb5798fef5d", "score": "0.75859386", "text": "def index\n accounts = current...
986896a35987b555d9526894d22cd20c
click on twitter on toggle
[ { "docid": "718e0eede2ca8f89875eefc016ff5d88", "score": "0.7361004", "text": "def click_on_TW_ON_toggle\n\n find(TW_ON_TOGGLE).click\n\n end", "title": "" } ]
[ { "docid": "883705631df6261a84b897a315148f46", "score": "0.71461165", "text": "def click_on_join_with_twitter_button\n\n click_on JOIN_WITH_TWITTER_BUTTON\n sleep(2)\n\n end", "title": "" }, { "docid": "f4bf1024df847e1beb7fc6067ff0739b", "score": "0.7040415", "text": "def clic...
4cc0cd3ced6b56137fc250fbae5562c3
Extracts an 2 dimensional array of commands which are in the form of command path value. The input can be A string with one command A string with many commands per line An array of strings.
[ { "docid": "327fc3301d497d0c4aa17bc291a2bbf1", "score": "0.7102637", "text": "def parse_commands(data)\n commands = Array.new()\n if data.is_a?(String)\n data.each_line do |line|\n cmd_array = Array.new()\n single = line.index(\"'\")\n ...
[ { "docid": "5ba8f4baf3394d942dd581992a1aadad", "score": "0.6862328", "text": "def command_to_a(command)\n `#{command}`.split($/).map(&:strip)\n end", "title": "" }, { "docid": "5ba8f4baf3394d942dd581992a1aadad", "score": "0.6862328", "text": "def command_to_a(command)\n ...
c6710a858a436561933073caa8c78449
Public: Calls the base_url with the given path and parameters
[ { "docid": "d71fd0aa092228c2e1a616b597755b9d", "score": "0.0", "text": "def get(path, parameters = {})\n request(:get, path, parameters)\n end", "title": "" } ]
[ { "docid": "e5034055233ea3d6d3cb9b6d63b83226", "score": "0.73960656", "text": "def url(*args, &block)\n \"#{_base_url}#{path(*args, &block)}\"\n end", "title": "" }, { "docid": "f804f0221a145174b14fb3fe57d2fde2", "score": "0.7391782", "text": "def base_url_path=(_arg0...
d11b066592799a10998faa6cf820cf5c
Add methods with single parameter
[ { "docid": "afbccd0c4150e87a6c600a8b7ff901cb", "score": "0.639824", "text": "def test_add_method_with_single_parameter\n cbac do\n set :test_add_method_with_single_parameter, \"test_add_method_with_single_parameter\" do\n post :foo, :bar, :foobar\n get :foo, :bar, :foobar\n e...
[ { "docid": "f6a9b18f37c3d86bf137ee419c584db9", "score": "0.7562081", "text": "def add_methods(*method)\n @methods.push(*method)\n end", "title": "" }, { "docid": "f2bc116cfb8f6be34909f8b3153239be", "score": "0.7335395", "text": "def method_missing me...
6821c4e90a6b12aa463ee6c61159d41e
hide private images from students for all actions below
[ { "docid": "b690256c596cad9cc1b39fa6c9742766", "score": "0.0", "text": "def index\n store_location\n begin\n if params[:coursenum] and params[:sectionnum]\n course = Course.find_by_number(params[:coursenum])\n section = course.sections.find_by_number(params[:sectionnum])\n @image...
[ { "docid": "abeee63f7c6e2acf60746519007da0ae", "score": "0.6820499", "text": "def only_public_for_students\n unless site_user\n Image.only_public do\n yield\n end\n else\n yield\n end\n end", "title": "" }, { "docid": "467f0e0e143b14e2b7f0b2bd79e0c026", "s...
89fa24202da34dfb21ef8e762ab1a11e
Write a method that takes one argument, a string containing one or more words, and returns the given string with words that contain five or more characters reversed. Each string will consist of only letters and spaces. Spaces should only be included when more than one word is present. METHOD:
[ { "docid": "b138b370944554cd79bf15d1857d930d", "score": "0.8407074", "text": "def reverse_words(string)\n strings_array = string.split\n strings_array.each do |word|\n unless word.length < 5\n word.reverse!\n end\n end\n strings_array.join(\" \")\nend", "title": "" } ]
[ { "docid": "4351c97aef0c184cb4b3e89147c149e0", "score": "0.84637845", "text": "def reverse_words(string)\n string.split.each { |word| word.reverse! if word.length >= 5 }.join(' ')\nend", "title": "" }, { "docid": "a2ffd76cc4311b82d3e78bca3d8a398a", "score": "0.84568435", "text": "de...
a990f137936ae722ced84960261d8601
look up :external_id on the model, use :id in the JSON
[ { "docid": "22d2e23e9ab60b43aafb0d584518ad6a", "score": "0.69909817", "text": "def id\n object.external_id\n end", "title": "" } ]
[ { "docid": "c275c5d4793c0042716a7038ae74318b", "score": "0.6898379", "text": "def external_id; end", "title": "" }, { "docid": "8a25a0580a25eb6b80356deebb11e062", "score": "0.67664915", "text": "def id\n @json['id']\n end", "title": "" }, { "docid": "7cfa5...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "9e32616a528fd3fd4872d57d7b276ba5", "score": "0.0", "text": "def round_params\n params.require(:round).permit(:tee_id, :player_id, :course_id, :startHole, :endHole, :score)\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...
5babbc2d374b5611c7ec22d79f93fc40
Draws single data row.
[ { "docid": "067929ef29693931e9ac1cb6c2a7c814", "score": "0.6536761", "text": "def draw_row(pdf, row, y, index, footer)\n\n # Shade background if necessary.\n if footer\n pdf.rect(@x,\n y,\n @column_widths.sum,\n @row_height,\n ...
[ { "docid": "d25146b77a6f0ba5be23c88182231429", "score": "0.70576227", "text": "def draw_row(index)\n \" #{cells[index]} #{@final_row} #{cells[index + 1]} #{@final_row} #{cells[index + 2]}\"\n end", "title": "" }, { "docid": "58fe910c0927531f46beeacd4dce8abe", "score": "0.6952472", ...
628ecc595fba3c60b6a57ec7984c6c7f
Sync local to remote you can specify : +:local+ : the local directory (default = ".") +:remote+ : the remote directory (default = ".")
[ { "docid": "07fb3e33d17d46f0a6ddb79a72a0e6b7", "score": "0.7200097", "text": "def sync( options = {} )\n options = { :local => \".\", :remote => \".\" , :passive => false}.merge( options )\n local, remote , passive = options[:local], options[:remote], options[:passive]\n \n tmpname = tmpfile...
[ { "docid": "a7c06e2c9afee25660ac25b3f0d1c867", "score": "0.7217255", "text": "def push(remote_path, local_path, delete)\n\n # load our sync data\n sync_data = load_sync_data(local_path)\n \n Net::SFTP.start(@remote_host,\n @remote_username,\n :password => @r...
722d161693c1b80dd304a4c00ee7f33d
Returns images not attached to category
[ { "docid": "a97ed200e6fa59c7003d69a2d3627030", "score": "0.64294803", "text": "def available_images; Image.all - images; end", "title": "" } ]
[ { "docid": "d7d5754e74b8a302b6279373798e21dc", "score": "0.69431114", "text": "def images\n manifestation_attachments.reject{|a| a.attachment_type_id != 3}\n end", "title": "" }, { "docid": "40c653168902f29d8d855525361b5fc2", "score": "0.6558559", "text": "def get_images(tag)...
3e6ace73a8554ef65d954768e0ebf138
0, 1, 2, 3, 4. The times method iterates something 5 times. Correction, it is 0, 1, 2, 3, 4, 5.
[ { "docid": "4d612dc5299e18bafcec50703d8e5386", "score": "0.0", "text": "def count_sheep\n 5.times do |sheep|\n puts sheep\n end\nend", "title": "" } ]
[ { "docid": "7ba5406e7407ff56613efd5ee8b013e1", "score": "0.8055187", "text": "def times(&block); end", "title": "" }, { "docid": "0bdd35a3b6fd97c5795197176fa86ea4", "score": "0.77722615", "text": "def times(*args, &block); end", "title": "" }, { "docid": "a548b712a6e60ba6...
f6980ad0c229dd5efe6049b1be1ae8d9
Returns true if the connective set is empty.
[ { "docid": "f68554ce8dc054b4a2c2129f7e038c18", "score": "0.69090337", "text": "def empty?\n return true if @elements.empty?\n return true if @elements == Set.new([Feature.empty])\n return false unless @elements.size == 1\n return @elements.first.empty?\n end", "title...
[ { "docid": "2d9483fd384b939d104b8e6c86b6f79f", "score": "0.7783331", "text": "def empty_piece_set?\n @piece_sets.any? { |c, piece_set| piece_set.empty? }\n end", "title": "" }, { "docid": "82eda40a48091a987259c39f04190d93", "score": "0.7754742", "text": "def empty?\n c...
b8a03b27e0b87e2f4a0f734eccdaa0bb
Recursively find all possible ways to split the array of visemes into subarrays such that each subarray resembles a word.
[ { "docid": "37fb04f482fd5e1497226fc727d9120b", "score": "0.5740339", "text": "def find_possible_chunks(visemes, current=[])\n successes = []\n n = 0\n while n < visemes.length\n n = find_shortest_prefix(visemes, n)\n\n # no prefix looks like a word\n break if n.nil?\n\n # shortest prefix ...
[ { "docid": "865ea18905c9935c00beff28d25b0000", "score": "0.6384436", "text": "def split_word s\n indices = (0...s.length).to_a\n variations = indices.product(indices).reject{| i,j | i > j}.map{| i,j | s[i..j]}.uniq\n return variations\nend", "title": "" }, { "docid": "ff9bd571a5c50f771cb2...
40c1552e10698acb786c0dcf938bfbc2
Apply's the allowed ORDER BY to the end of the final union statement Note: This will only apply at the very end of the union statements. Not nested ones. (I guess you could double nest a union and apply it, but that would be dumb) Example: User.union(User.select(:id).where(id: 8)) .union(User.select(:id).where(id: 50))...
[ { "docid": "e50eb10be7de2e419bf6689d7d772513", "score": "0.6893554", "text": "def apply_union_ordering(union_nodes)\n return union_nodes unless union_ordering_values?\n\n UnionChain.new(self).inline_order_by(union_nodes, union_ordering_values)\n end", "title": "" } ]
[ { "docid": "f2c9db562ff6d02384b99b41fad8103f", "score": "0.6604451", "text": "def select_order_sql(sql)\n sql << \" ORDER BY #{expression_list(@opts[:order])}\" if @opts[:order]\n end", "title": "" }, { "docid": "59047f8b5b3b48e572646d51df40d1b9", "score": "0.6246135", "text"...
91ac735e679fd462e20313e1a7cef53d
require to remove XFrameOptions to load Rails app in iframe on Bigcommerce
[ { "docid": "d7fd97007354e0bc7666ad9a4ce6559d", "score": "0.6429922", "text": "def set_header_for_iframe\n response.headers.delete \"X-Frame-Options\"\n end", "title": "" } ]
[ { "docid": "6aa3ac4e5b185dd2a480a25ae91c8403", "score": "0.69436765", "text": "def allow_iframe\n response.headers.delete \"X-Frame-Options\"\n end", "title": "" }, { "docid": "a1fbc501fe8afd9a6209364a0c70907e", "score": "0.6901236", "text": "def allow_iframe_requests\n respon...
1b2e8c88f7086415ef6a886fd36edd8c
Store the passedin cancellation handler block for later reference.
[ { "docid": "c823b596a3450b5f28c277c236a8c6cc", "score": "0.77820766", "text": "def cancellation_handler(&block)\n @cancellation_task = lambda { |cause| block.call(@handle, cause) }\n end", "title": "" } ]
[ { "docid": "cdf8c614c16df798f9a8843a7616a676", "score": "0.6808342", "text": "def on_cancelled(&block)\n @handlers[:cancelled] = block\n self\n end", "title": "" }, { "docid": "6257c5e8159365aa24deac6695d00a93", "score": "0.6063847", "text": "def cancellation_handler\n ...
00f1d1d1af9645521d05eb1d59918b77
GET /request_accesses/new GET /request_accesses/new.json
[ { "docid": "5e44186719e1d67e2e1f42f4d74ce89b", "score": "0.72826064", "text": "def new\n @request_access = RequestAccess.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @request_access }\n end\n end", "title": "" } ]
[ { "docid": "b7c02a95e3fc4ea3c532451af8cc158f", "score": "0.6893119", "text": "def new\n @admin_access_request = Admin::AccessRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_access_request }\n end\n end", "title": "" }, {...
f2eeb0d5e63b23acc39ee2a1d716d945
fetches and renders hostel fee collection details for respective batch and one of first student with hostel fee under selected hostel fee collection
[ { "docid": "a14a5fbf17df919a9ee8d1557673fe67", "score": "0.72228545", "text": "def hostel_fee_collection_details\n flash[:notice] = nil\n flash[:warn_notice] = nil\n @target_action = 'hostel_fee_collection_details'\n fine = params[:fees].present? ? params[:fees][:fine_amount].to_f : nil\n ...
[ { "docid": "0c359d0216479fefe1d959e4944282a2", "score": "0.6940874", "text": "def fee_head_by_student\n if params[:student_id].present?\n @search_query = params[:query]\n unless @student.nil?\n @advance_fee_categories = AdvanceFeeCategory.all(:joins => [:advance_fee_category_batches]...
2332adecbbdec14dfa4ed6f412aea77a
GET /news GET /news.json
[ { "docid": "616f685c223d646151f90299fcbc0769", "score": "0.0", "text": "def index\n if params[:lan]\n lan = params[:lan] == \"es\" ? 1 : 2;\n @news = News.where(language: lan).order(created_at: :desc)\n else\n @news = News.all.order(created_at: :desc)\n end\n end", "title": ...
[ { "docid": "edd7ba9766c5a97dc99627879c5a83c9", "score": "0.7948295", "text": "def getNews\n request \"/Notification/getNews.json\"\n end", "title": "" }, { "docid": "7bd0d5b45b91ee7dd926adc55d50c1fd", "score": "0.7804192", "text": "def show\n @news = News.find(params[:id])...
6b5c54e91809a5d28d70303ab40578eb
get corresponding account/s instance for an owner
[ { "docid": "895fdb55b5694216475d427e2723decf", "score": "0.6155744", "text": "def get_account\n account_id_array = []\n account_id = nil\n accounts = Bank::Account.create_accounts(\"./support/accounts.csv\")\n CSV.foreach(\"./support/account_owners.csv\") do |line|\n if line[1...
[ { "docid": "004269cdae9d3afa47816c8857208032", "score": "0.7464479", "text": "def get_owner\n owner_id = nil\n owners = Bank::Owner.create_owners(\"./support/owners.csv\")\n CSV.foreach(\"./support/account_owners.csv\") do |line|\n if line[0].to_i == @id\n owner_id = line[...
95c181995e439580769fe108a57b7758
PATCH/PUT /proxy_votes/1 PATCH/PUT /proxy_votes/1.json
[ { "docid": "ebfb4426034587df6667c3d8c4006caa", "score": "0.7210808", "text": "def update\n respond_to do |format|\n if @proxy_vote.update(proxy_vote_params)\n format.html { redirect_to @proxy_vote, notice: 'Proxy vote was successfully updated.' }\n format.json { render :show, statu...
[ { "docid": "f2df519f5f3e4e97f5d15ef1cce8d418", "score": "0.6850573", "text": "def update\n vote_id = params.require(:id)\n vote_params = params.require(:vote).\n permit(vote_proposal_options_attributes: [:id, :_destroy])\n if vote_params.blank?\n vote_params = params.requi...
67e9d601c8bec80fd531445c2e124da7
True if required arguments were provided
[ { "docid": "3a4762caab2a36340e1fa83ad595dc4b", "score": "0.78337026", "text": "def arguments_valid?\n # TO DO - implement some real logic here\n true if @arguments.length == 1 \n end", "title": "" } ]
[ { "docid": "e26078c90ff81ae4a163beafc9445fbb", "score": "0.85331726", "text": "def has_missing_required_arg?\n !missing_required_arguments.empty?\n end", "title": "" }, { "docid": "c218bed274a82ac097c4e751b1da12fa", "score": "0.8464038", "text": "def include...
17a1d7e5fbe37890b7418ed379fda43a
Write out the LogItems in this LogReader to a rubywebstat cache file, so that they can be read faster in future
[ { "docid": "b2be83e562b65fff0fcf9cccc04c3d7f", "score": "0.0", "text": "def writeRWSData(file)\n\t\tf = File.open(file, \"w\")\n\t\t\n\t\t@items.each{|i|\n\t\t\tf.write(i.toFileString + \"\\n\")\n\t\t}\n\t\t\n\t\tf.close\n\tend", "title": "" } ]
[ { "docid": "3e760afe646da4231f024c5f89d713fe", "score": "0.6541406", "text": "def read_write_climber_logs(urls, profile_url, data_dir)\n climber_logs = read_climber_log_pages(urls, profile_url)\n\n puts 'Writing all climber logs to file'\n local_fname = \"#{data_dir}/climber_logs.txt\"\n File.delete...
ebf9f7c8dfe110620dba0f84f359cccf
Only print message if executed with verbose
[ { "docid": "b80988f749719da4bcd53db826ed5ace", "score": "0.7252531", "text": "def debug_log(message)\n puts message if OPTIONS[:verbose]\nend", "title": "" } ]
[ { "docid": "4b4c58f10fdb07900904cf7aa36b50c0", "score": "0.82562315", "text": "def verbose_msg(msg)\n if $verbose\n $stderr.puts(\"#{msg}\\n\")\n end\nend", "title": "" }, { "docid": "2d09642ea8426f480bd3a3196776afb7", "score": "0.823001", "text": "def say msg\n if @options[:...
a5a5811de13ed9edfb6876fa32cce344
GET /knowledge_bases/1 GET /knowledge_bases/1.json
[ { "docid": "76e90d3b34050ded0ac36e18b7b564ff", "score": "0.0", "text": "def show\r\n end", "title": "" } ]
[ { "docid": "ca9372747e2682148cf5e891560fb98f", "score": "0.6748834", "text": "def new_knowledge_base(options = {})\n query(Query::NEW_KB, options) do |xml|\n if (kb = xml.xpath(\"/xmlns:response/xmlns:kb\").first)\n kb_uuid = kb.attributes['uri'].to_s\n @knowledge_bases << ...
c63ef70196aac624dac2246a27153f26
takes in a bike and docks it
[ { "docid": "e124a0da19724163d1638a967e365328", "score": "0.6289886", "text": "def dock(bike, condition= 'working')\n\t\tfail 'Dock is full' if full?\n\t\tbike.report_condition(condition)\n\t\t@available_bikes.append(bike)\n\t\t@available_bikes[@available_bikes.length - 1]\n\tend", "title": "" } ]
[ { "docid": "fe5f26cefc2bf61839a3113d2bab20f9", "score": "0.7049883", "text": "def dock bike\n add_bike bike\n end", "title": "" }, { "docid": "c9812e9e79d155c4deee5ef5ed809034", "score": "0.6956503", "text": "def release_bike\n raise \"There is no bike\" if empty?\n raise \...
bad6947ad2d2be810d01b94f58ba9c6d
DELETE /referrals/1 DELETE /referrals/1.xml
[ { "docid": "01dfa3e6e90b422a417092f2a497cd67", "score": "0.69845164", "text": "def destroy\n @referral = Referral.find(params[:id])\n @referral.destroy\n\n respond_to do |format|\n format.html { redirect_to(referrals_url) }\n format.xml { head :ok }\n end\n end", "title": "" ...
[ { "docid": "2219f4e105992da00eaae8b4ec318aaf", "score": "0.6986516", "text": "def destroy\n @ref = Ref.find(params[:id])\n @ref.destroy\n\n respond_to do |format|\n format.html { redirect_to(refs_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid":...
ee66a493f793eca506c73a9b1a74fef6
Do the methods .get_child and .add_child work? We add a child. Then we ask if the added child really is the child of the object.
[ { "docid": "fe9f8598f46d7c651779f5e99aa36e22", "score": "0.0", "text": "def test_childhood\n assert_empty(@vw_beetle.get_child)\n @vw_beetle.add_child(@door1)\n refute_empty(@vw_beetle.get_child)\n assert_equal(@door1, @vw_beetle.get_child[0])\n \n assert_empty(@wiper.get_child)\n @...
[ { "docid": "d9ebbbe5574bf0f7800a679ae22c382a", "score": "0.75896573", "text": "def is_child()\n in_child\n end", "title": "" }, { "docid": "77207fbd9d6e67e36f2f8ede87287256", "score": "0.75396186", "text": "def has_child?(child)\n @children.include?(child)\n end", ...
f40c0c33193df47acfb734bfa5d97706
TODO: do we need this function
[ { "docid": "6a9547763d7bb5727846c58478c30ffa", "score": "0.0", "text": "def update_epicenter_fruitbag\n unless self.epicenter_id == nil\n fruitbag = self.epicenter.fruitbasket.fruitbags.first\n fruitbag.fruittype_id = self.id\n fruitbag.save\n end\n end", "title": "" } ]
[ { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6438592", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3", "score": "0.6438592", "text": "def bodystmt; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3",...
8fcf9e3900cc41968c7de34bb1c531f2
Toggle a single light (not the adjacent ones)
[ { "docid": "717be5a213890d2007ac2b2b03a818d0", "score": "0.69229865", "text": "def toggle_light(column, row)\n return if row < 0 || row >= ROWS || column < 0 || column >= COLUMNS\n i = (row * ROWS) + column\n @light_state[i] = !@light_state[i]\n end", "title": "" } ]
[ { "docid": "3d0147fdbab88ff0d239789450684001", "score": "0.79853535", "text": "def toggle_light(el)\r\n 1 - el\r\nend", "title": "" }, { "docid": "3ac4dadc80c117a1e1ad35cf45c7afb3", "score": "0.7833848", "text": "def toggle_lights\n if @lights == false\n @lights = true\n ...
6dce851d2e683cfa77f6f6b39764f738
This method is deprecated and private. It will return a rewritten URL if there's any value for url and a rewrite rule for that URL has been set
[ { "docid": "727249c45163528522b6ab9b942a9409", "score": "0.8002164", "text": "def deprecated_rewrite_url\n return nil unless url\n rewritten_url = Vanagon::Component::Source::Rewrite.parse_and_rewrite(url)\n url == rewritten_url ? nil : rewritten_url\n end", "title": "" } ]
[ { "docid": "72e05df1a18c31bc0476873873bc0aba", "score": "0.64263105", "text": "def generic_url_rewriter \n env = Request.env_for('http://localhost')\n UrlRewriter.new(ActionController::Request.new(env), {})\n end", "title": "" }, { "docid": "48a83527556cf679abf39f296...
83d69896944435ca0d48393ceccc8b8b
Return which line contains data for a given base pair
[ { "docid": "304e071b0ed7b7f034d50445e961055c", "score": "0.548661", "text": "def line_for_bp(bp)\n raise WigError, \"Contig does not contain data for base pair #{bp}\" if bp < start or bp > stop\n @line_start + (bp-@start)/@step\n end", "title": "" } ]
[ { "docid": "7df943f337c2d02a2995fb8b021a228d", "score": "0.58993155", "text": "def extract_pair(line); end", "title": "" }, { "docid": "8b8a96ae994703cfa9dc78b033a7a1df", "score": "0.58312476", "text": "def common_line_finder(x, y)\n common_line_array = lines_through_station(x).ke...
69e30333752d2ea713484d14418efe0b
DELETE /bank_accounts/1 DELETE /bank_accounts/1.xml
[ { "docid": "2c20f4404bb75807029932bc69d481e8", "score": "0.7298833", "text": "def destroy\n @bank_account = BankAccount.find(params[:id])\n @bank_account.destroy\n\n respond_to do |format|\n format.html { redirect_to(bank_accounts_url) }\n format.xml { head :ok }\n end\n end", ...
[ { "docid": "db578191fc8c27166d2d3af9d62f997d", "score": "0.71928585", "text": "def destroy\n @bank_account = current_user.bank_account\n @bank_account.destroy\n\n respond_to do |format|\n format.html { redirect_to(dashboard_path) }\n format.xml { head :ok }\n end\n end", "tit...
30a51f21f5e3fc31c60071da7aba793d
Execute the statement. If no block was given, this returns an array of rows returned by executing the statement. Otherwise, each row will be yielded to the block. Any parameters will be bound to the statement using bind_params. Example: stmt = db.prepare( "select from table" ) stmt.execute! do |row| ... end See also bi...
[ { "docid": "57bc97b7c608b5853f6ab3e94e7a08f2", "score": "0.6199055", "text": "def execute!(*bind_vars, &block); end", "title": "" } ]
[ { "docid": "41933369cbe6e3820a39e320c4138de8", "score": "0.8110941", "text": "def execute!( *bind_vars )\n result = execute( *bind_vars )\n rows = [] unless block_given?\n while row = result.next\n if block_given?\n yield row\n else\n rows << row\n e...
4fdd0a7e1d8e374607ac5f5290e4b574
You need to buy before you can sell Pay attention to edge cases like when the lowest day is the last day or the highest day is the first day.
[ { "docid": "afa56d9e36d2addbd09fb4d999367b7c", "score": "0.0", "text": "def stock_picker(prices)\n price_diff = 0\n count = 0\n best_days_array = []\n\n prices.each do |price1|\n count += 1\n prices.each do |price2|\n if count > prices.index(price2)\n next\n else\n if (...
[ { "docid": "e8273bcc466c1174748e62abd5368015", "score": "0.676045", "text": "def stock_picker(data) \n\tday1 = 0\n\twhile day1 < data.length - 1\n\t\tday2 = day1 + 1\t\n\t\twhile day2 < data.length\n\t\t\tprofit ||= 0 #initialize profit at 0\n\t\t\tif data[day2] - data[day1] > profit\n\t\t\t\tprofit = d...
463da1ab415bfa1d9630077a28a468d9
POST /logradouros POST /logradouros.json
[ { "docid": "bddff5eec92f1a8a3d30c81a3a9c0622", "score": "0.69034964", "text": "def create\n @logradouro = Logradouro.new(logradouro_params)\n\n respond_to do |format|\n if @logradouro.save\n format.html { redirect_to @logradouro, notice: 'Logradouro was successfully created.' }\n ...
[ { "docid": "27aa8fc3239f3f85f3606725b198bc68", "score": "0.64215994", "text": "def create\n @logro = Logro.new(logro_params)\n\n respond_to do |format|\n if @logro.save\n format.html { redirect_to logros_path, notice: 'El logro se creó con éxito.' }\n format.json { render :show,...
0d8f012aca53a9a2d7ebb092804411bd
Maximum number of polygons in a patch. If the patch tries to maintain quadfaces when possible the actual number of polygons might be less.
[ { "docid": "ab503e2b7e415da1c0f717cb9ed34fc9", "score": "0.61077625", "text": "def count_mesh_polygons( subdiv )\r\n fail_if_invalid()\r\n subdiv * subdiv * 2\r\n end", "title": "" } ]
[ { "docid": "9c4d1e90608b7a91ea8d6cc14249953b", "score": "0.6861416", "text": "def num_interior_rings\n raise Error::UnsupportedOperation, \"Method Polygon#num_interior_rings not defined.\"\n end", "title": "" }, { "docid": "ae860786fc110d727f402f589d3ff6c6", "score": "0.63820...
15b338edaf357e3d36d84d8439214b9c
Override the default enumeration to handle if the cursor can be cached or not.
[ { "docid": "7b0aad5584ae19b64c3776c7a9d00cca", "score": "0.5785685", "text": "def each\n if system_collection? || !QueryCache.enabled?\n super\n else\n unless cursor = cached_cursor\n server = read.select_server(cluster)\n cursor = CachedCursor.new(v...
[ { "docid": "2ee0f8212c695ff3ccab1e454d701c76", "score": "0.63305986", "text": "def cursor_with_cache\n CachedCursor.new(session, operation)\n end", "title": "" }, { "docid": "62647213025fb20ac3aaab6e2893d5d0", "score": "0.5938885", "text": "def needs_cursor?; true; end", ...
2bb5062944effb0843e8f3d034b51f9f
Common logic for processing the form steps.
[ { "docid": "a7afef77d235eba6b1f8b1f20a7593ba", "score": "0.6995054", "text": "def process_form( form )\n\n # Report errors whenever there are some in the currently finished step.\n\n @state = :report if form.incomplete_step?\n\n # That's all until the last steps are reached.\n\n return if fo...
[ { "docid": "1bb75ae7f6853a99f76e7f0932a0916f", "score": "0.6689313", "text": "def process_options\n\t\t# set the scope names\n\t\t@slot_scope = @options.delete(:slot_scope) || SLOT_SCOPE\n\t\t@parent_scope = @options.delete(:parent_scope)\n\n\t\t# this is a step if it says it is or the form is a wizard\...
aeaedd171f34fb1b13fef9d7f1506dd3
e.g. Change English, Germany and Time Zone "Hawaii"
[ { "docid": "10b3840ef8ec2c071fd530c5a4dd30d9", "score": "0.0", "text": "def switcher_i18n_label_title(user=@user)\n result = []\n result << (!user.language.blank? ? I18n.t(user.language, :scope => \"languages\") : User.human_attribute_name(:language))\n result << (!user.country.blank? ? I18n.t(...
[ { "docid": "7c972d2e4eae8e07b7cbebc583cd6e56", "score": "0.6718706", "text": "def time_zone=(_arg0); end", "title": "" }, { "docid": "7c972d2e4eae8e07b7cbebc583cd6e56", "score": "0.6718706", "text": "def time_zone=(_arg0); end", "title": "" }, { "docid": "7d33a0d452c3ea0b...
9dff455569e780c1499dcb05fad69e04
Custom destroy method for models using delete_softly
[ { "docid": "a6cbf1dd0dbfe2545f93a7d0a6207271", "score": "0.6720632", "text": "def destroy \n if persisted?\n with_transaction_returning_status do\n _run_destroy_callbacks do\n update_attribute :deleted_at, Time.now\n end\n end\n end\n \n @dest...
[ { "docid": "dc7978b571fa1af94fbce826dcf38dc1", "score": "0.7450815", "text": "def destroy; delete end", "title": "" }, { "docid": "4b725558377da82c84646ca4512e27a1", "score": "0.7250187", "text": "def soft_delete\n self.active = false\n save\n\n employees.each(&:soft_delete)...
7d40d8d4ebde7b8d54d02706e57c3e3b
GET /free_flowers/1 GET /free_flowers/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "a7d897b29df40395fbc29f7328d8af83", "score": "0.7051231", "text": "def index\n @free_flowers = FreeFlower.all\n end", "title": "" }, { "docid": "c5f1792d3829a6450b10d3696b743253", "score": "0.66692454", "text": "def index\n @flowers = Flowers.all\n\n end", "tit...
181766e477a2a698961b9a23f2e225cc
POST /incourses POST /incourses.json
[ { "docid": "1c8021256dcbcb8ea936a9c367f5526e", "score": "0.64001817", "text": "def create\n @incourse = Incourse.new(incourse_params)\n respond_to do |format|\n if @incourse.save\n flash[:alert] = \"Student successfully added to course.\"\n format.html { redirect_back(fallback_l...
[ { "docid": "fd874bca275389a13de045a439c0b2bc", "score": "0.7037784", "text": "def create\n @in_course = InCourse.new(params[:in_course])\n\n respond_to do |format|\n if @in_course.save\n format.html { redirect_to @in_course, :notice => 'In course was successfully created.' }\n f...
ac4c1a1f5a0fa6386e824f7cbce9a189
Output: [1,2,1,2] Approach 2: Use Ruby methods .insert() and .delete_at() Time Complexity: O(N)
[ { "docid": "d69984a54433feacc8ca9f1b0918d965", "score": "0.6071758", "text": "def shuffle(nums, n)\n current_index = 1\n (0..n - 1).each do |i|\n nums.insert(current_index, nums.delete_at(i + n))\n current_index += 2\n end\n nums\nend", "title": "" } ]
[ { "docid": "5db84a45281eb278f60d316212921f5e", "score": "0.6768476", "text": "def insert(x,a)\r\n c = a.dup\r\n c.push(x)\r\n c = c.sort\r\nend", "title": "" }, { "docid": "5e161b0b6376f9a90980f35af05f62b4", "score": "0.67472035", "text": "def swap_elements(array)\n array.i...
1b4d40fd09df1eb8a98f2fd412d10f41
POST /clientes POST /clientes.json
[ { "docid": "479003f734041f69e966bda4fa01b2e2", "score": "0.5972631", "text": "def create\n @cliente = Cliente.new(params[:cliente])\n\n respond_to do |format|\n if @cliente.save\n format.html { redirect_to admin_clientes_url, notice: 'Cliente was successfully created.' }\n forma...
[ { "docid": "463c7897bc343b5c33ded0eb3d7c38a8", "score": "0.6741709", "text": "def create\n http_api.post(\"clients\", self)\n end", "title": "" }, { "docid": "84186d209e6b5dca2e0c8146b546a058", "score": "0.6648603", "text": "def create_client(params={})\n post('/clients', ...
385e974e1d8341597aed334e840ec6fa
Run the given search and return the results, so obtained.
[ { "docid": "42c97ef074dd528dbf09239b2808078d", "score": "0.70105016", "text": "def run\n self.prominence!\n return self.send_results if @query.any?\n\n self.fuzzy_match\n self.apply_narrowing_filters\n self.apply_limit\n self.load_and_sort_by_matches\n self.send_results\n end", ...
[ { "docid": "8bba0c8669a16e14a9446189b9aca1ec", "score": "0.7041094", "text": "def search\n return Fast.debug(&method(:execute_search)) if debug_mode?\n\n execute_search do |file, results|\n results.each do |result|\n binding.pry if @pry # rubocop:disable Lint/Debugger\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "85fe3928d6188e85bb2bbfdd694e855a", "score": "0.0", "text": "def set_survey_item_category_template\n @survey_item_category_template = SurveyItemCategoryTemplate.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...
f4e49b8f400e37d039c7a2bf3b7513e1
Propagates errors from the generated records to the file.
[ { "docid": "86e2b8c41e4e2759d01a49ad55d60bcd", "score": "0.71108425", "text": "def propagate_errors_to_file\n errors = aggregate_errors\n current_course.errors.add(:invitations_file, errors.to_sentence) unless errors.empty?\n end", "title": "" } ]
[ { "docid": "b3e6c033c1e74e9730c6e941fd02484b", "score": "0.66381013", "text": "def propagate_errors\n propagate_errors_to_file if invite_by_file?\n end", "title": "" }, { "docid": "b3e6c033c1e74e9730c6e941fd02484b", "score": "0.66381013", "text": "def propagate_errors\n propag...
ce7eb72502e920440a55e9456e36dcab
set handler and drain all input packets that may be buffered by the time.
[ { "docid": "a92e7dc495c827c5391ea30a191ebcc3", "score": "0.6017298", "text": "def on_data_received= proc\n @on_data_received = proc\n drain\n end", "title": "" } ]
[ { "docid": "cc7be556dc14de7689eb59ecef189c84", "score": "0.57007545", "text": "def drain\n # while resp = self.read(0.05)\n\n while resp = self.read(0.005) # not sure how low I can go here, this really speeds things up.\n end\n end", "title": "" }, { "docid": "b476540f146323ef4...
5ee988185cac16be538a2aa114bce1be
GET /top_reviews/1 GET /top_reviews/1.json
[ { "docid": "9e58957dd3a561cf23687a0a869ada3a", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "40329f338e5bfdade15fc0928cb0a3d2", "score": "0.77659386", "text": "def index\n @top_reviews = TopReview.all\n end", "title": "" }, { "docid": "5476f72d517c456652aa8a19828f9319", "score": "0.70649517", "text": "def get_review(params)\n review_id = params[:id]\...
bc5037d42f81a58dcd243c91842fa3c3
POST /test_views POST /test_views.json
[ { "docid": "7b1524ce92b4c2e50050e8642f9d449d", "score": "0.7058224", "text": "def create\n @test_view = TestView.new(test_view_params)\n\n respond_to do |format|\n if @test_view.save\n format.html { redirect_to @test_view, notice: 'Test view was successfully created.' }\n format...
[ { "docid": "b583f50e822003fd750fa15de0fce850", "score": "0.6711683", "text": "def create\n @test_view_datum = TestViewDatum.new(test_view_datum_params)\n\n respond_to do |format|\n if @test_view_datum.save\n format.html { redirect_to @test_view_datum, notice: 'Test view datum was succe...
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "34f73ee5415fb9d9865d16f1ee5ec5eb", "score": "0.69738525", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = RecoveryResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "ea872306361fc864408e8279b0199bbe", "score": "0.7593366", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.7...
839f89ab5140630854fb8d27065b31b8
returns a car with the name of the customer who bought the car
[ { "docid": "5cd53a968df80940d00d035eb3211bc0", "score": "0.6490403", "text": "def buy_car(customer_instance)\n self.customer_id = customer_instance.id\n self\n end", "title": "" } ]
[ { "docid": "f39c18b8d57a0c2ca5d0046434120f5a", "score": "0.65237635", "text": "def customer_name\n customer.name\n end", "title": "" }, { "docid": "a1e2f67e5b8aeedb694df5d1eda3c8e2", "score": "0.64146024", "text": "def carowner_names\n CarOwner.all.select do |c|\n if c.mechan...
bca24cb6f27d5a2e6f1fc585d8b880ef
This only consolidates duplicates into the first holding. It doesn't, e.g., consolidate holdings 4 with 6, if they match. We can build that if we find we need to.
[ { "docid": "a73f747c02b2c734713d315dfccc306d", "score": "0.66597915", "text": "def consolidate_nypl_holdings(original_holdings)\n return [] unless original_holdings.present?\n\n # Below logic only for NYPL\n return original_holdings unless original_holdings.first[:location_name] =~ /NYPL/...
[ { "docid": "897f545bf8720c3de8cea993ab5eac96", "score": "0.72853076", "text": "def condense_holdings(holdings)\n # processing varies depending on complexity\n complexity = determine_complexity(holdings)\n\n entries = []\n\n # Look at each Holding in turn...\n holdings.each do |h...
c82b9159e86ec3e6ced647b9e55d3cb9
GET /tipo_convenios/new GET /tipo_convenios/new.json
[ { "docid": "a8ebe12c011d54191415a4f1cb8e8f0a", "score": "0.7872798", "text": "def new\n @tipo_convenio = TipoConvenio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_convenio }\n end\n end", "title": "" } ]
[ { "docid": "4a6d100fbca7b810114e340445fbbf4c", "score": "0.77312815", "text": "def new\n @tipo_negocio = TipoNegocio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @tipo_negocio }\n end\n end", "title": "" }, { "docid": "23e7d7e35...
25659ef90820ec2e6010f363382ecad7
Prefer lookup by bib over barcode def items_by_barcode(barcodes) response = scsb_conn.post do |req| req.url '/sharedCollection/itemAvailabilityStatus' req.headers['ContentType'] = 'application/json' req.headers['Accept'] = 'application/json' req.headers['api_key'] = scsb_auth_key req.body = scsb_barcode_request(barcode...
[ { "docid": "25381773ad5ed282e80cef1a583655d8", "score": "0.0", "text": "def scsb_request(request_params)\n response = scsb_conn.post do |req|\n req.url '/requestItem/requestItem'\n req.headers['Content-Type'] = 'application/json'\n req.headers['Accept'] = 'application/json'\n ...
[ { "docid": "204fbaf70b69f95d7b39105214f8e5a4", "score": "0.6667107", "text": "def retrieve(barcode)\n\n if barcode =~ /#{configuration.mme_code}\\.IN/\n get_inventory(f_global_id: barcode)\n return response['data'].first if response && response['total'] && response['total'] > 0\n ...
d19493f7a7dfa192210590acdd2727fb
o:: Object from Pipeline Applies filter to Object
[ { "docid": "82ce5baa7144d5eca38f01d0bb21932f", "score": "0.73148215", "text": "def filter(o)\n raise ArgumentError.new('Wrong type supplied to filter') unless Splib.type_of?(o, @type)\n do_filter(o)\n end", "title": "" } ]
[ { "docid": "16ba02e86f2c0c03b0155d2286aebbec", "score": "0.7030696", "text": "def do_filter(o)\n raise NoMethodError.new('This method has not been implemented')\n end", "title": "" }, { "docid": "69166ad1ee8bfdde51b30acc02b0621b", "score": "0.69045806", "text": "def filter_ob...
66d0bdd8a2be3216c270b57d5db20141
Initialize method, but we can't override initialize We also can't seem to store these as class variables since it appears we initialize per message
[ { "docid": "81ab00ba76418fb89fd3b234c9cfae5c", "score": "0.0", "text": "def init_order_bot\n reply \"Hi there, I'm #{connection.config.nick}! I am initializing for the first time, this may take a while...\"\n\n # Can't seem to store these as class variables - so we'll place them in our internal ha...
[ { "docid": "ae876a0df0030bb50e70a3a6e1ab2fda", "score": "0.7739372", "text": "def init_message\n\n end", "title": "" }, { "docid": "d6c918b9f732de396c63e3f0483d3c73", "score": "0.77020824", "text": "def initialize(msg = nil)\n #This is a stub, used for indexing\n end", ...
8ddbcc382327bb9d4073bf281f4dd801
returns Font Awesome css for icon
[ { "docid": "8b35ab6a48e09d5c7bde38a31406f479", "score": "0.68925244", "text": "def fa_icon( object)\n \"fa-\" << object.icon\n end", "title": "" } ]
[ { "docid": "a5b10eeb8dce9eea2a59124b4bcca695", "score": "0.75817627", "text": "def font_awesome_bootstrap_icon(icon)\n \"<i class='fa fa-#{icon}'></i>\"\n end", "title": "" }, { "docid": "8abf8e47ea2e1accb8be670b9e717513", "score": "0.75393176", "text": "def icon\n fa_icon...
12efd443d6d0cbfed43f7c56097a1670
Fetch Token Supply record list
[ { "docid": "02e55b72c2b5c12a489c955b8bc1b143", "score": "0.5741274", "text": "def get_token_supply_all_using_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokenSupplyApi.get_token_supply_all_using_get ...'\n end\n # ...
[ { "docid": "12e88d8bd29694dc05d32857533f775f", "score": "0.6715251", "text": "def fetch_token_supply_details\n\n r = FetchClientTokenSupplyDetails.new(\n client_id: @client_token[:client_id],\n client_token_id: @client_token_id,\n token_symbol: @client_token[:symbol]\n ...
d988feb6df3488c34d51045d2ef86669
Take a win if it's there, then block an opponent's win threat, then take the center, then take a corner unless the opponent has selected opposing corners (this can be disabled to allow it as a winning strategy), then take a random square.
[ { "docid": "85b5c55e2d8dc8fc664b506a5558101b", "score": "0.60808104", "text": "def best_move\n find_at_risk_square(mark) ||\n find_at_risk_square(@human.mark) ||\n center_square ||\n corner_play ||\n board.unmarked_keys.sample\n en...
[ { "docid": "478257fda0dffc6a97b090e39a41bcb8", "score": "0.7113728", "text": "def decide\n corners = [[0, 0], [0, 2], [2, 0], [2, 2]]\n\n available_corners = available_positions & corners\n middle = available_positions & [[1, 1]]\n\n find_winning_move_or_block ||\n find_position_with_po...