query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
94dcd362ce0e7c96598c5614788c0c36
GET /users/new GET /users/new.xml HTML
[ { "docid": "25d580c9e2eb2d17310ba93446d3d654", "score": "0.0", "text": "def new\r\n if can_signup?\r\n @user = User.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.haml <-- signup form\r\n format.xml { render :xml => @user }\r\n end\r\n else\r\n red...
[ { "docid": "eb2f813d46891748e182b979d3bf5d7f", "score": "0.7836644", "text": "def new\n @user = @users.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "title": "" }, { "docid": "c3c1e4c44858c8bcffa549a69d707...
5a78b5b50d5bf4f44b6fdd1de37c67b8
This should get all the courses that match the search query
[ { "docid": "b7f80028c05f0a51deb23fbbc08227e6", "score": "0.7100484", "text": "def search\n query = \"%\" + params[:search] + \"%\"\n @course = Course.where(\"name LIKE ?\", query)\n # if params[:search]\n # @course = Course.where(params:[:search]).order(\"created_at DESC\")\n # else\...
[ { "docid": "6541d2e5df787499cb3ae761e47cc816", "score": "0.7679417", "text": "def index\r\n @search_term = params[:search]\r\n # Do search using scoped_search. If search term is empty then all records are returned.\r\n @courses = Course.available.full_search(@search_term).order(:title).page(par...
ac12af2f89e4d8a29604420f2d2f254a
Returns the address of this broker, i.e. the hostname plus the port to connect to.
[ { "docid": "90ef95a0c9d52819936e24f923ae54cf", "score": "0.727343", "text": "def addr\n \"#{host}:#{port}\"\n end", "title": "" } ]
[ { "docid": "85b5a7f340e8ed6e63bd4ba4a3626f47", "score": "0.7220718", "text": "def socket_address\n \"#{host}:#{port}\"\n end", "title": "" }, { "docid": "1808401fbaff68ab40313d9aaf9742c0", "score": "0.71294725", "text": "def client_address\n begin\n @session.peera...
e97faa6efa92858118afff0680366ac0
Returns the options for the given table. If table is +nil+, returns general options.
[ { "docid": "3b576849c2fbaa67ff6ed93c1040dc2d", "score": "0.8277127", "text": "def options(table = nil)\n if table\n session.configuration.options_for_table table\n else\n session.configuration.options\n end\n end", "title": "" } ]
[ { "docid": "8fc9b2e2c320b65f4bc8ca389d8ac360", "score": "0.7905768", "text": "def options_for_table(table)\n @options_for_table ||= {}\n unless @options_for_table.include? table\n @options_for_table[table] = session.configuration.options_for_table(table)\n end\n @options_for_t...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a54926c8b2f473e4fdf3b0397b6c811d", "score": "0.0", "text": "def refuge_params\n params.require(:refuge).permit(:name, :photo, :photo_cache, :day_price, :capacity, :address, :description, :lat, :lon, :altitude, :range, :department, :price_cents)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496205", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957069", "text": "def strong_params\n params.require(:request).permit(param_white...
b8cdf64f3b527111c543b4eea748dede
DELETE /diadelasemanas/1 DELETE /diadelasemanas/1.json
[ { "docid": "da136a192b276a680b6bb817276f9aff", "score": "0.7086548", "text": "def destroy\n @diadelasemana.destroy\n respond_to do |format|\n format.html { redirect_to diadelasemanas_url, notice: 'Diadelasemana was successfully destroyed.' }\n format.json { head :no_content }\n end\n ...
[ { "docid": "b1a17c1ee1af05c79fe156622df44818", "score": "0.7589726", "text": "def delete(path)\n begin\n response = client[path].delete :accept => 'application/json'\n rescue Exception => e\n puts e.inspect\n end\n end", "title": "" }, { "docid": "...
0cbed8aa672fb22151ad6e6eef1ad3b9
Outline the a set of areas (first center and zoom the map to suit the extent of all the areas)
[ { "docid": "8dcd5c965f066171ae6fb56adce5a6f6", "score": "0.8343428", "text": "def outline_areas(map, areas, request, draw = true)\n if !areas.blank? then\n set_center_and_zoom_for_areas(map, areas, request)\n for area in areas do\n map.record_init(GPolygon.from_georuby(area.geom,\"#3...
[ { "docid": "c456e4b6e1fa06f6443b882d7de773b1", "score": "0.6011002", "text": "def add_map_event_find_areas(map)\n func_str = \"bounds = map.getBounds();\"\n func_str += \"$.get('#{find_areas_path}', { \n min_x: bounds.getSouthWest().lat(),\n min_y: bounds.getSouthWest().lng(),\n max...
5b7a8224569f7dfc3e3130c861a188f1
GET /atms/new GET /atms/new.json
[ { "docid": "85a34c62ded9c585bf0327b1373aee29", "score": "0.70251995", "text": "def new\n @atm = Atm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.js { render layout: false }\n format.json { render json: @atm }\n end\n end", "title": "" } ]
[ { "docid": "f775c48e1b2eb008355bedd4353064de", "score": "0.750283", "text": "def new\n @atm = Atm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @atm }\n end\n end", "title": "" }, { "docid": "99420f83b016bb6a77c4e98f7aa6f964", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a9c5b3a4ccb42047de913fcc3b47ce46", "score": "0.0", "text": "def set_crime\n @crime= Crime.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;...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8f56a22c46b3447157490c6f2db17b84", "score": "0.0", "text": "def set_gameserverinfo\n @gameserverinfo = Gameserverinfo.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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "87dfb95bcdb3eacde44257d254e59ca1", "score": "0.0", "text": "def set_hello_message\n @hello_message = HelloMessage.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook;...
05893f812b264185a2e97cd7ab36abee
yes, i am a purchase order!
[ { "docid": "e46177d66e1fefa2239af006bfb2737c", "score": "0.7992925", "text": "def purchase_order?\n true\n end", "title": "" } ]
[ { "docid": "db102c2fcf67d79b4f0a6af704a0296e", "score": "0.8234686", "text": "def purchase_order?\n true \n end", "title": "" }, { "docid": "db102c2fcf67d79b4f0a6af704a0296e", "score": "0.8234686", "text": "def purchase_order?\n true \n end", "title": "" }, { "doc...
7a8c442aa0019617e68193e557bb52d2
There's just so many functions in Processing, Here's a convenient way to look for them.
[ { "docid": "aadbf40b1f4dd59310b3157a1d8685d6", "score": "0.0", "text": "def find_method(method_name)\n reg = Regexp.new(method_name.to_s, true)\n methods.sort.select { |meth| reg.match?(meth) }\n end", "title": "" } ]
[ { "docid": "ecb5be597cdc9e1c3458c3f004a459e2", "score": "0.57809985", "text": "def getFunctionName()\n return /in `([^']*)'/.match(caller[0].to_s)[1]\nend", "title": "" }, { "docid": "36edc91f68296a8275df20ee92d5970b", "score": "0.5741535", "text": "def functions(name = nil)\n ...
be8aa166c2caabfa6d3fa472bf923146
gets owner name in first last format
[ { "docid": "e95ea37591ef66f106c9d5ba390907dc", "score": "0.0", "text": "def proper_name\n first_name + \" \" + last_name\n end", "title": "" } ]
[ { "docid": "44de77a4720f0933dd8929ec4c76c021", "score": "0.8476653", "text": "def get_owner_name\n\n\t\t@owner = User.find(self.user_id)\n\t\t@owner_name = \"No last name\"\n\t\tif @owner.last_name\n\t\t\t@owner_name = @owner.name + \" \" + @owner.last_name\n\t\tend\n\n\t\treturn @owner_name\n\tend", ...
2ce0c90aad1cc2e29c0c11940b69750e
POSTs a new address to the vet360 API
[ { "docid": "a89baa505949c436435e03b7680465e9", "score": "0.0", "text": "def post_email(email)\n post_or_put_data(:post, email, 'emails', EmailTransactionResponse)\n end", "title": "" } ]
[ { "docid": "2b9b6d2049c06e36cd5f38663d99e68b", "score": "0.72002345", "text": "def address_createaddress(options = {})\r\n # Prepare query url.\r\n _query_builder = Configuration.base_uri.dup\r\n _query_builder << '/address/createaddress.json'\r\n _query_url = APIHelper.clean_url _qu...
fe6c6a43ee92a9e9985da78eece9a009
GET /web/v1/testmonials GET /web/v1/testmonials.json
[ { "docid": "3b4c92919b54ed10f3de355432d26f58", "score": "0.73542565", "text": "def get_all_testmonial\n @testmonials = Testmonial.order(\"created_at desc\")\n\n render json: @testmonials\n end", "title": "" } ]
[ { "docid": "dd9894340d4cf16757baca74371f9f43", "score": "0.71432513", "text": "def test\n get(\"/help/test.json\")\n end", "title": "" }, { "docid": "dd9894340d4cf16757baca74371f9f43", "score": "0.71432513", "text": "def test\n get(\"/help/test.json\")\n end", "ti...
ddae61cbf016d1426c6e3f6105ba6af4
GET LIST OF USERS WHO FOLLOW USER gets followers of user specified by user param, not by user logged in
[ { "docid": "ca6bbaebe5c0286fdd8106c6d05cf802", "score": "0.0", "text": "def test_get_users_who_follow_user\r\n get \"/users/1/follows.json?type=followers&api_key=testapikey\"\r\n assert_response :success\r\n follows = JSON.parse(response.body)\r\n assert follows.size == 3, 'Incorrect number ...
[ { "docid": "633e730eacb052c2cbd6a16cfe7b4136", "score": "0.78045297", "text": "def followings\n b=BeFollow.scoped_by_follower_id(self.id)\n user_ids=b.map do |a|\n a.user.id\n end\n User.find_all_by_id(user_ids)\n end", "title": "" }, { "docid": "5fb287bf22ca21d4b32e76d422e...
da4b15a3f2a5df23b1a1109d51b5553f
PATCH/PUT /videos/1 PATCH/PUT /videos/1.json
[ { "docid": "70beced5fed9bb59ef477e4f3fe1b0d5", "score": "0.6819483", "text": "def update\n respond_to do |format|\n if @video.update(video_params)\n format.html { redirect_to @video, notice: 'Video was successfully updated.' }\n format.json { head :no_content }\n else\n ...
[ { "docid": "1bafd82366d5d2fe3bf88d0867dca45a", "score": "0.7530184", "text": "def update\n @api_v1_video = Api::V1::Video.find(params[:id])\n\n if @api_v1_video.update(api_v1_video_params)\n head :no_content\n else\n render json: @api_v1_video.errors, status: :unprocessable_entity\n ...
67e82edd9f59732585aae94e751ff89e
export an array of Outline object as an OPML String
[ { "docid": "447a30ff57033ccc8ab0d60430200136", "score": "0.6326859", "text": "def test_export\n\t\tary = Array.new\n\t\tary << @outline\n\t\topml = OpmlParser::export(ary)\n\t\toutlines = OpmlParser::import(opml)\n\n\t\tassert_equal(outlines.length, 1)\n\t\tassert_equal(outlines[0].attributes[:text] ,...
[ { "docid": "c7d076d3766d3ff245320c6168a1e3d3", "score": "0.6307572", "text": "def getAboutOutput\n t = \"\"\n @@vertices.each do |name|\n personalReference = @@adjacencyMatrix.at(@@vertices.index(name.downcase))\n recHighly = ''\n recRec = ''\n recNo = ''\n personalReferen...
bea1218801c9ce2f97c0016924e8babe
navraci cestu k adresari, TODO sjednotit zdroj s ostatnimi moduly
[ { "docid": "fb3867b3e6195dde958bfdad50c42e6b", "score": "0.0", "text": "def userDir()\n storagePath = \"temp\"\n user = Account.current.surname unless Account.current.nil?\n user = user || \"global\"\n store = File.join(storagePath,user)\n logger.info store\n re...
[ { "docid": "ef9557994d92c292d62c7a3d9be97d15", "score": "0.6347029", "text": "def kontakt\n\n end", "title": "" }, { "docid": "ad97737456405029d682fcbb218f11bb", "score": "0.6276476", "text": "def atenciones_no_brindadas\n @title = \"Atenciones no brindadas al público\"\n @actio...
271cbb1faeaed5236f56a5244d47b1eb
Method to post giverboard
[ { "docid": "b14902ee9a208ee2b3bb90b9cfc3e867", "score": "0.76562995", "text": "def post_giverboard_message(\n data:\n )\n board = get_giverboard\n fields = []\n board.each do |hash|\n fields.push({ \"value\": \"<@#{hash.keys.join()}> : #{hash.values.join()}\" })\n end\n text ...
[ { "docid": "61912f487fc887fa61a1c609906ee5bd", "score": "0.67478013", "text": "def post\n end", "title": "" }, { "docid": "61912f487fc887fa61a1c609906ee5bd", "score": "0.67478013", "text": "def post\n end", "title": "" }, { "docid": "124492f02909c4635d113089d88c3999...
0e2ed0dd8ea26050926de2c32e656ca7
Check if the line match any option in the histignore [Pry.config.history_ignorelist]
[ { "docid": "7c5edfa9034a70e63cda720d8c12b13b", "score": "0.6909381", "text": "def should_ignore?(line); end", "title": "" } ]
[ { "docid": "c1c3b13c79dfb485d127f15829d3d193", "score": "0.61853975", "text": "def irrelevant_line?(source_line); end", "title": "" }, { "docid": "cbe210cdf697a5a4da48b8e78ef62042", "score": "0.59450424", "text": "def non_configuration_line?(line); end", "title": "" }, { ...
1c6ca4a1ec3306ab083b1b21d24ab00c
of def remove whitespace and other characters such as newline
[ { "docid": "306071e7e74711fb433cbe8497b8bf3f", "score": "0.7263274", "text": "def remove_whitespace(dirty_name)\n \n return dirty_name.split(' ').join(\" \") \n \n end", "title": "" } ]
[ { "docid": "6969789d93acac0cf3a98c70e5652601", "score": "0.8330047", "text": "def whitespace_fixup(text)\n text.andand.gsub(/\\r/, \"\")\n end", "title": "" }, { "docid": "55ce811d6288b89e959b40a8d56ef2ac", "score": "0.8282477", "text": "def whitespace_fixup(text)...
ad70f995595e1d636763d1211ca5c34b
Easy 1 Repeat Yourself
[ { "docid": "0910387f92bed23032f2cdcabf89af91", "score": "0.5301869", "text": "def repeat(phrase, num)\n num.times do\n puts phrase\n end\nend", "title": "" } ]
[ { "docid": "54f970ee5768d76a8818f20a25600939", "score": "0.720591", "text": "def looping", "title": "" }, { "docid": "6b12e40a012e0680ec1f399387bb80b2", "score": "0.65587085", "text": "def repeatable; end", "title": "" }, { "docid": "dd7c5977ab5afef159618a9ca941890e", ...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "5207acb5dc4d91283fd9357d95777565", "score": "0.0", "text": "def internal_params\n params.require(:internal).permit(:tgl_testing, :penguji, :id_rfc)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74768823", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "36956168ba2889cff7bf17d9f1db41b8", "score": "0.71700543", "text": "def set_param_whitelist(*param_list)\n self.param_whitelist...
ac304fab94ec0ea5de0e10192191dddf
Creates a new instance of PaypalClient::Client
[ { "docid": "db284411583fd5c895f8e810213288c9", "score": "0.0", "text": "def initialize(client_id:, client_secret:, cache:, sandbox: true, version:, logger: nil)\n @client_id = client_id\n @client_secret = client_secret\n @cache = cache\n @sandbox = sandbox\n @version = version\n...
[ { "docid": "c5c7095c3cb6835b6bb31a16c9355ed8", "score": "0.74544835", "text": "def client\n PayPal::PayPalHttpClient.new(environment)\n end", "title": "" }, { "docid": "7cf55b45f7be0917604528090650f43c", "score": "0.7266305", "text": "def client!\n Paypal.sandbox! unless...
28c15f4a18947625212a311dc5e9ca6d
Returns a new instance with +other+'s processors prepended
[ { "docid": "e3f9d26bad7c7228ac056d34d2f4670d", "score": "0.87357986", "text": "def prepend(other)\n duplicates = processors & other.processors\n raise_duplicate_processor_error(duplicates) if duplicates.any?\n self.class.new(name, other.processors | processors)\n end", "tit...
[ { "docid": "157753cdb7f2110f0c20582c2fe074d9", "score": "0.65619874", "text": "def merge(other)\n super other.map(&method(:instantiate))\n end", "title": "" }, { "docid": "1f36cf5fe3acdcc631e24a90805111b0", "score": "0.651545", "text": "def merge(other)\n Separ...
1c083894bc4712eae35935d35ce5c8be
DELETE /ad_zone_statuses/1 DELETE /ad_zone_statuses/1.xml
[ { "docid": "44f2fa410f3900103247e21ee3cccc8a", "score": "0.7662058", "text": "def destroy\n @ad_zone_status = AdZoneStatus.find(params[:id])\n @ad_zone_status.destroy\n\n respond_to do |format|\n format.html { redirect_to(ad_zone_statuses_url) }\n format.xml { head :ok }\n end\n ...
[ { "docid": "1047821a9db4dbc6002f7582296d5448", "score": "0.7016269", "text": "def destroy\n @ad_zone = AdZone.find(params[:id])\n @ad_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to(ad_zones_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, ...
80425373ab71284d4a0dedd465d8c6a3
Returns ordered tree node an object which maintains tree integrity. WARNING: THIS METHOD IS NOT THREAD SAFE! Though I'm not sure if it can cause any problems.
[ { "docid": "66eac2c889868f4237bd4b76502d5418", "score": "0.7870129", "text": "def ordered_tree_node\n @ordered_tree_node ||= ActsAsOrderedTree::Node.new(self)\n end", "title": "" } ]
[ { "docid": "ef7a9c8db0bdde813d9ad39e654f7e88", "score": "0.68743944", "text": "def get_tree\n n8 = Node.new(8)\n n9 = Node.new(9, n8, nil)\n n4 = Node.new(4)\n n7 = Node.new(7, n4, n9)\n n20 = Node.new(20)\n n11 = Node.new(11)\n n15 = Node.new(15, n11, n20)\n n10 = Node.new(1...
da285f822b18d3cac5a107bd96997f61
Called if we're already signed in and thus no registration is required. If we were trying to get to newsletter signup, go to contact preferences instead.
[ { "docid": "c849a4573d9b5d9d96cd81aa9bddc130", "score": "0.0", "text": "def require_no_authentication\n\t\tif params[:in_blog].present?\n\t\t\tflash[:after_sign_in_path_override] = in_blog_edit_subscriptions_path\n\t\telsif params[:nlsub].present?\n\t\t\tflash[:after_sign_in_path_override] = edit_subscr...
[ { "docid": "8579de4c3883c06bbc3940f5273ae029", "score": "0.6773794", "text": "def make_sure_logged_in\n\n\t\tif current_user.nil?\n\n\t\tflash[:error] = \"You need to be signed up\"\n\n\t\tredirect_to new_user_path\n\n\n\t\tend\n\n\n\n\n\tend", "title": "" }, { "docid": "bf21eef46165cd69ba19...
abd3072a5da53ce94930b349bf74baf9
DELETE /conductors/1 DELETE /conductors/1.xml
[ { "docid": "9890be1604a9e0e60f8b29d933a5ef97", "score": "0.6781471", "text": "def destroy\n @conductor = Conductor.find(params[:id])\n @conductor.destroy\n\n respond_to do |format|\n format.html { redirect_to(conductors_url) }\n format.xml { head :ok }\n end\n end", "title": ...
[ { "docid": "098d835754077e08c1c4c6a4360c674a", "score": "0.6447984", "text": "def destroy\n @paycond = Paycond.find(params[:id])\n @paycond.destroy\n\n respond_to do |format|\n format.html { redirect_to(payconds_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, ...
0e207772d0038900b765523c48b91f09
Return a Taxonifi::Model::Name representing the finest genus_group_parent. TODO: ICZN specific(?)
[ { "docid": "87a2e088d734e023a38ceee7f3e71e75", "score": "0.7798913", "text": "def genus_group_parent\n [ parent_at_rank('subgenus'), parent_at_rank('genus')].compact.first\n end", "title": "" } ]
[ { "docid": "53e30811d91999347683e8ecc25a83db", "score": "0.7070757", "text": "def parent_name\n @parent ? @parent.full_name : '(unknown)'\n end", "title": "" }, { "docid": "7a022914afbfee5b441db7f1e2ae6c17", "score": "0.673453", "text": "def full_name\n self.parent ? \"#{sel...
1d881833c48a2e2061c6d68f8227ef48
POST /projectdetails POST /projectdetails.xml
[ { "docid": "f0a0f4fc593c099fa173ba7bb5692c04", "score": "0.61598957", "text": "def create\n @projectdetail = Projectdetail.new(params[:projectdetail])\n unless session[:project_id].nil? or session[:project_id].empty?\n @projectdetail.projid = session[:project_id]\n end\n @currentyear = ...
[ { "docid": "1e2d0724e2981f82777f41548e5f861c", "score": "0.7121643", "text": "def test_should_create_project_via_API_XML\r\n get \"/logout\"\r\n post \"/projects.xml\", :api_key=>'testapikey',\r\n :project => {:user_id => 1,\r\n :url...
c4ef841443e1c48e95f59372903da573
DELETE /keywords/1 DELETE /keywords/1.json
[ { "docid": "451de441c5685b9fafa4c35b46e8e23d", "score": "0.73674995", "text": "def destroy\n @keyword.destroy\n respond_to do |format|\n format.html { redirect_to keywords_url, notice: 'Keyword was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title...
[ { "docid": "517704bec8b356573bf213d5505b1480", "score": "0.7645315", "text": "def destroy\n @keyword.destroy\n respond_to do |format|\n format.html { redirect_to keywords_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "97ee04338ebe09aabef...
e9eb68f9eadd6d649580e4a41b792e7f
POST /presupuestos or /presupuestos.json
[ { "docid": "ffb4b44d6745956541aa15800dc233a6", "score": "0.7100349", "text": "def create\r\n @presupuesto = Presupuesto.new(presupuesto_params)\r\n\r\n respond_to do |format|\r\n if @presupuesto.save\r\n format.html { redirect_to @presupuesto, notice: \"Presupuesto was successfully cre...
[ { "docid": "c635beec1369dbcb365766d5d50baeb1", "score": "0.7456759", "text": "def create\n @presupuesto = Presupuesto.new(presupuesto_params)\n\n respond_to do |format|\n if @presupuesto.save\n format.html { redirect_to presupuestos_path }\n format.json { render :show, status: :...
9808b2448c58ba01d1c4bd2386db8716
Name: middle Description: returns middle charaters of string. Everything but first and last characters. Arguments: string Response: string
[ { "docid": "1a693bc21eb2c061127249808d5013e9", "score": "0.7404878", "text": "def middle(word)\n length = word.length\n length > 2 ? word[1, length - 2] : ''\n end", "title": "" } ]
[ { "docid": "0544c822669b54dc2459dc74d3404c6a", "score": "0.792911", "text": "def middle_substring(str)\n\tif str.length % 2 != 0\n\t\treturn str[(str.length )/2]\n\telse\n\t\treturn str[(str.length/2) -1..(str.length)/2]\n\tend \nend", "title": "" }, { "docid": "0a99cb45c08071df3cf65e5995d79...
fe6cc4dc13036c776b827a2a50a0c297
PUT /vjs/1 PUT /vjs/1.json
[ { "docid": "d254e5cf37649e73cc3c5da517c29ec3", "score": "0.0", "text": "def update\n @vj = Vj.find(params[:id])\n\n respond_to do |format|\n if @vj.update_attributes(params[:vj])\n format.html { redirect_to @vj, notice: 'Vj was successfully updated.' }\n format.json { head :no_c...
[ { "docid": "1bafd82366d5d2fe3bf88d0867dca45a", "score": "0.7292183", "text": "def update\n @api_v1_video = Api::V1::Video.find(params[:id])\n\n if @api_v1_video.update(api_v1_video_params)\n head :no_content\n else\n render json: @api_v1_video.errors, status: :unprocessable_entity\n ...
9fd8652e107fa8bd9047a008e07c5443
GET /:id Show resource
[ { "docid": "141ee4a40cc2ca271552cc22c1b47d54", "score": "0.0", "text": "def show\n add_breadcrumb I18n.t('integral.navigation.list'), list_backend_resources_url\n add_breadcrumb I18n.t('integral.actions.view')\n end", "title": "" } ]
[ { "docid": "09337fdb35e2da2926dad0356d464090", "score": "0.8270355", "text": "def show(params = {})\n validate_id(params)\n submit(id_url(params.delete(:id)), :get)\n end", "title": "" }, { "docid": "38ff6611c0b8f8fc4c6d384dd1a2f49b", "score": "0.7858498", "text": ...
f38e4eb505c597c4969300945ac846da
GET /reclamations GET /reclamations.json
[ { "docid": "fcdb731a11fc2bcce02c8328be390bff", "score": "0.60885525", "text": "def index\n @reclamations = Reclamation.all\n end", "title": "" } ]
[ { "docid": "4377c1534db3f06ce27f99fa0e1e6f23", "score": "0.5933992", "text": "def index\n @constitution_mods = ConstitutionMod.all\n\n render json: @constitution_mods\n end", "title": "" }, { "docid": "26b685aa7a37cc2a05fc15c34f6826d8", "score": "0.59055465", "text": "def inde...
1b3a6298e9cb530234d8de33f56e437c
Plays a buzzer sound effect.
[ { "docid": "5bbaca33cf730f57473eb2a3c46b10ea", "score": "0.65580404", "text": "def pbPlayBuzzerSE()\n if $data_system && $data_system.respond_to?(\"buzzer_se\") &&\n $data_system.buzzer_se && $data_system.buzzer_se.name!=\"\"\n pbSEPlay($data_system.buzzer_se)\n elsif $data_system && $data_syst...
[ { "docid": "2426e08e19cfca43dd8c23fd330adfec", "score": "0.8534867", "text": "def buz; Sound.play_buzzer; end", "title": "" }, { "docid": "afbeefbecabbf926a1a0af6823d1ea7c", "score": "0.7084755", "text": "def blow\n\t\tif !@is_blown\n\t\t\t@is_blown = @has_changed = true\n\t\t\t@star...
54a7f69bf6b330020890122450ec0883
The `cannot?` methods works just like `can?`, but it's the opposite.
[ { "docid": "be2ee503e22b611ddbcdf45e77ea0e56", "score": "0.7625131", "text": "def cannot?(action, subject, *extra_args)\n !can?(action, subject, extra_args)\n end", "title": "" } ]
[ { "docid": "0ab85dfe57aaadcfd90c5e6b1561ce30", "score": "0.87154293", "text": "def cannot?(*args)\n !can?(*args)\n end", "title": "" }, { "docid": "0ab85dfe57aaadcfd90c5e6b1561ce30", "score": "0.87154293", "text": "def cannot?(*args)\n !can?(*args)\n end", "title": "" }...
71b31d1c3a7b8c219ae665cb67c4411b
Finds a column in the table_class. If there is no such column, nil will be returned.
[ { "docid": "ada134b35f216939be64da1d76ec6816", "score": "0.82822657", "text": "def find_column(name, options = {})\n options = normalize_options(options)\n return nil unless (table_class = options[:table_class])\n \n name =~ /(.*\\.)?(.*)/\n return nil if \n\t$1 != nil and \n\t$...
[ { "docid": "152d5a0fe841daceeea13543c1e1897a", "score": "0.75006086", "text": "def find_column(name)\n columns.detect { |column| column.name.to_sym == name.to_sym }\n end", "title": "" }, { "docid": "522607fd571fd5d8834d5bcb9b500d53", "score": "0.7377849", "text": "def find_colum...
ba128692e767c6f2109dac6db3d2f4cd
metodo que desordena el array s(el que contiene los numeros desde 0255 en binario)
[ { "docid": "5aae2b3b4247daa61e89deef39e4ca8d", "score": "0.5898572", "text": "def intercambio\n j=0\n for i in 0..255\n j = (j + @k[i % @k.length].to_i(2) + s[i].to_i(2)) % 256;\n @s[i],@s[j]=@s[j],@s[i] #realiza el intercambio\n end\n end", "title": "" ...
[ { "docid": "1ad5ef1cad6cbef3f8989b2f530f42f1", "score": "0.62692136", "text": "def binario()\n #crea el array de 0-255 en bytes\n\n @a.each do |i|\n @s << sprintf(\"%08b\", i)\n end\n #bucle para crear el vector de la clave hasta 255 posiciones\n\n while k.size < 256\n @clave.ea...
b99a659c4fd0651611484f6f186a3e55
Helper method to unmount a given NFS volume on ESX
[ { "docid": "bbd20148c066ae2b94bfb1440097f8f0", "score": "0.7414611", "text": "def unmount_nfs_share volume_name\n begin\n Puppet.debug(\"Unmounting volume name #{volume_name}\")\n host.esxcli.storage.nfs.remove({:volumename => volume_name})\n Puppet.info(\"Unmounted volume name #{volum...
[ { "docid": "52d961dbf41edc1770624622da5c39e1", "score": "0.767374", "text": "def unmount! volume\n return :unmounted if successful_remote_command?(\"umount #{volume.device}\")\n end", "title": "" }, { "docid": "a2cd3f2172fe0055909692dcbe35d89d", "score": "0.7455078", "text": ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c904e0086e6c189f0ab39573d84adb4f", "score": "0.0", "text": "def pip_params\n params.require(:pip).permit(:body)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981606", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6784227", "text": "def strong_params\n params.requi...
414bdd4a3f97f68d1eaa0fda0f154d1a
DELETE /collection_resources/1 DELETE /collection_resources/1.json
[ { "docid": "fbeda9828c4e764258cabef3e8e045f3", "score": "0.7303683", "text": "def destroy\n @collection_resource.destroy\n respond_to do |format|\n format.html do \n redirect_to collection_collection_resources_path(@collection),\n notice: I18n.t('meta.defaults.messag...
[ { "docid": "2f2f78cbc35cb551725ce4863ca4cc3e", "score": "0.7641487", "text": "def destroy\n @collection.destroy\n\n render json: @collection, status: :ok#, location: @collection\n end", "title": "" }, { "docid": "cd331171d642355898e9c7cf820b6630", "score": "0.74810815", "text"...
fe879d8c49aab52c9b703a09bf0a75f8
on NSome, :pop, :store_into => :my_var on NOther, :start => SOther on NAwesome, :add_to => :awesomes
[ { "docid": "0791153320065986f04346020cfbb1f0", "score": "0.0", "text": "def on child_class, *args\n options = args.last.is_a?(Hash) ? args.pop : {}\n if args.include? :pop\n stop_children << child_class\n end\n if options[:start]\n child_subscope_table[child...
[ { "docid": "dc13fbd84203665a0f29e0ea5c6861ff", "score": "0.53948593", "text": "def after=(_arg0); end", "title": "" }, { "docid": "c10a98f422056f0cb96ee6e57c710632", "score": "0.5362402", "text": "def test_push_operand_var\n @rpn.add_var(\"X\", 10)\n @rpn.push_operand(\"X\")\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8fc4adc1a69772a07d841daa530ed09f", "score": "0.0", "text": "def set_group\n @group = Group.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...
61b86a5d3814604a0da5999bc3adf68b
Write a method called convert that takes one argument which is a temperature in degrees Fahrenheit. This method should return the temperature in degrees Celsius. To format the output to say 2 decimal places, we can use the Kernel's format method. For example, if x = 45.5678 then format("%.2f", x) will return the string...
[ { "docid": "4a8d9c9a22d86515a4dff475bf3dcd97", "score": "0.0", "text": "def degToC(degF)\n (degF-32)*5/9\nend", "title": "" } ]
[ { "docid": "094d3be61b8e8830d547ac5a750b2146", "score": "0.8119", "text": "def convert (temp_f = 0)\n temp_c = (temp_f - 32.0) * 5/9\n temp_c = format(\"%.2f\", temp_c).to_s\n temp_f = format(\"%.2f\", temp_f).to_s\n puts \"#{temp_f} degrees Fahrenheit is #{temp_c} degrees Celsius\"\nend", "titl...
7a12e4e7802b8916f0eb1b26a355c88f
PUT /pacientes/1 PUT /pacientes/1.json
[ { "docid": "70b5a0d9e367fc62673653a1b1d018ca", "score": "0.710073", "text": "def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to \"/administrador/pacientes\" }\n format.jso...
[ { "docid": "0d1e0530b8b465332346ba3fea00ff6a", "score": "0.70631856", "text": "def update\n @paciente = Paciente.find(params[:id])\n\n respond_to do |format|\n if @paciente.update_attributes(params[:paciente])\n format.html { redirect_to @paciente, notice: 'Paciente atualizado com suce...
7bb55dce7ccf1b2f395c58461a3cced3
POST /amoebas POST /amoebas.json
[ { "docid": "1e8804ba3247c51c776454a9ebe2d9fb", "score": "0.59270763", "text": "def create\n @amoeba = Amoeba.new(amoeba_params)\n\n respond_to do |format|\n if @amoeba.save\n format.html { redirect_to @amoeba, notice: 'Amoeba was successfully created.' }\n format.json { render a...
[ { "docid": "369fabaf8b45d951c35bf2a7cae93de4", "score": "0.6213565", "text": "def create\n @mao = Mae.new(mao_params)\n\n respond_to do |format|\n if @mao.save\n format.html { redirect_to @mao, notice: 'Mae was successfully created.' }\n format.json { render :show, status: :crea...
fafe1bacb758cef6594b70bfed04ebaa
Disegna un'emoji x: posizione x della bitmap y: posizione y della bitmap xx: posizione x del paragrafo word: parola mh: massima altezza Restituisce la posizione y raggiunta
[ { "docid": "c8eff6679bc9a8e49d6fc6a443c824a7", "score": "0.7038739", "text": "def draw_emoji(x, y, xx, width, char, mh, test)\n @emojis = 0 unless @emojis\n bitmap = Cache.system('Emojiset')\n em_index = Emoji.get(char)\n rect = Rect.new(em_index % 16 * 24, em_index / 16 * 24, 24, 24)\n i...
[ { "docid": "1016ba93b0d28c9ba564bf2945ff9f38", "score": "0.6570156", "text": "def text_x(pos)\n unless @text_pos\n @text_pos = []\n 0.upto(13) do |i|\n @text_pos[i] = x + i * char_spacing * xdim + (i >= 7 ? 6 : (i >= 1 ? 2 : 0))*xdim\n end\n end\n @text_pos[p...
762f983a63920155b4a72af536787d41
Runs the loop for attacking monsters in the house
[ { "docid": "a4eee016b1906ff429006b260f204eb6", "score": "0.7234231", "text": "def attackLoop(home)\n\t\tattacking = true;\n\t\t\n\t\twhile attacking\n\t\t\tputs \"Choose a weapon\";\n\t\t\tfor i in 1..@player.inventory.length do\n\t\t\t\tif(@player.inventory[i-1].uses < 0)\n\t\t\t\t\tputs \"#{i} - #{@pl...
[ { "docid": "354f7dfb7dbcbc2671a601863da44b77", "score": "0.7134098", "text": "def enemies_attack\r\n puts \"Les ennemies vous attaquent\"\r\n @enemies.each{|player| player.attacks(@human_player)}\r\n end", "title": "" }, { "docid": "21b5e3bc8bdf8711bb54dcae57a927dd", "sc...
18d9decca3950b1977df178a2a2116ea
DELETE /users/1 DELETE /users/1.xml
[ { "docid": "470a5020b4e6836f8a5f62e72faa4112", "score": "0.0", "text": "def destroy\n if current_user.is_an_admin?\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n ...
[ { "docid": "f2aa64556d41c1306c893cf55febd02e", "score": "0.7177572", "text": "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", ...
718247e71915c8c073655d35489823b5
A field is a parser event that is always the child of an assignment. It accepts as arguments the left side of operation, the operator (. or ::), and the right side of the operation. For example: foo.x = 1
[ { "docid": "f703e1cc535ea401d6409fe91c665ffc", "score": "0.6454233", "text": "def on_field(left, oper, right)\n {\n type: :field,\n body: [left, oper, right],\n sl: left[:sl],\n sc: left[:sc],\n el: right[:el],\n ec: right[:ec]\n }\n end", "title": "" } ]
[ { "docid": "dd75bb51e964087cece1e71c9150a736", "score": "0.7679442", "text": "def visit_field(node)\n node.copy(\n operator: node.operator == :\"::\" ? :\"::\" : visit(node.operator),\n name: visit(node.name)\n )\n end", "title": "" }, { "docid": "d6ae43d...
be3c76e874f3e101e8193e7d9251457b
The number of rows (arrays in array) turn into the number of columns The number of columns (elements in array) turn into the number of rows create a blank array with the correct amount of nests
[ { "docid": "6e4e72fa14f1553320c9e7f68c8a7bdd", "score": "0.0", "text": "def transpose(matrix)\n new_matrix = []\n matrix[0].size.times { new_matrix << [] }\n \n (0...matrix[0].size).each do |row|\n (0...matrix.size).each do |col|\n new_matrix[row][col] = matrix[col][row]\n end\n end\n \...
[ { "docid": "579a19aae641984f014b0143bfc63649", "score": "0.653412", "text": "def nest_into_columns(ary, len)\n col_ary = []\n 1.upto(len) { col_ary << [] }\n ary.each_slice(len) do |slice|\n 0.upto(len) { |c| col_ary[c] << slice[c] if slice[c] != nil }\n end\n return col_ary\nend", "title": ...
eb847c26bf49c3aa8f6039865826c3fb
Fetch message as file from email account
[ { "docid": "8cafa336ea83c7ce22afcf538aa25713", "score": "0.0", "text": "def fetch_file(request)\n http_request = request.to_http_info(@api_invoker.api_client)\n @api_invoker.make_request(http_request, :GET, 'File')\n end", "title": "" } ]
[ { "docid": "d361772ebff0d21717b10d4ccbb6f1d1", "score": "0.66913867", "text": "def download_email(username, email, file_path, withdraw_amount)\n @username = username\n @withdraw_amount = withdraw_amount\n @email = email\n attachments[\"cc\" + withdraw_amount.to_s + \".stack\"] = File.read(fi...
a847d4fb91d41d28ffc3132725e0af76
Sets the quaternion for the homogeneous transformation. Params: +q+:: A UnitQuaternion object representing the orientation of this frame. +rel_to+:: A HomogeneousTransformation object relative to which the orientation is specified. If rel_to is nil, the orientation will be specified relative to the global reference fra...
[ { "docid": "71676690840f0ad1ae7148d41dc97605", "score": "0.7887477", "text": "def setQuaternion(q, rel_to = nil, local = true)\n if rel_to\n if local\n @q = rel_to.getQuaternion() * q\n else\n @q = q * rel_to.getQuaternion()\n end\n else\n @q = q\n end\n end",...
[ { "docid": "602a3c38ec1259d0511b2dd0bed4b35c", "score": "0.57869476", "text": "def setTranslation(t, rel_to = nil, local = true)\n if rel_to\n if local\n @t = rel_to.getTranslation() +\n rel_to.getQuaternion().transform(t)\n else\n @t = rel_to.getTranslation() + t\n ...
9be35c4556caf3e4e90a4c9d03c6d041
Para Borrar el articulo que he creado
[ { "docid": "6412985f656ce2b8dff3538785f5dbe7", "score": "0.0", "text": "def destroy\n #@article = Article.find(params[:id])\n #se sutituira por el uso de methodo set_article\n @article.destroy\n flash[:notice] = \"Article was successfully deleted\"\n redirect_to articles_path\n end", ...
[ { "docid": "41f01a43fcba1d7df25c2776f985f19c", "score": "0.6957242", "text": "def borrarItemCarrito(Id,Carrito)\n pos=-1\n for i in (0..carrito.size-1)\n if carrito[i][0].to_i==id\n pos=i\n end\n end\n if pos !=-1\n carrito.delete_at(pos) #delete_at lo borra y recorre\...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "25ae3561c6e7a0c5bcab795c5bed764f", "score": "0.0", "text": "def set_resume\n @resume = Resume.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...
37b146771ecfbae198a42b1a3e9720e2
Set the locale based on passed param, user's preferred locale, or default
[ { "docid": "183fae742d47e58ca8641a2a53b0d007", "score": "0.8188562", "text": "def set_locale\n @locale = Locale.find_by(name: params[:locale]).try(:name) || \n @traveler.try(:preferred_locale).try(:name) || \n I18n.default_locale.to_s\n end", "title": "" } ]
[ { "docid": "3d3f874766fb5116c81fbb6aa5803636", "score": "0.8516146", "text": "def set_locale\n set_locale_or_default(params[:locale])\n end", "title": "" }, { "docid": "ba8ec043e930a6b1e33b7f985701ff1f", "score": "0.84495413", "text": "def set_locale\n logger.debug \"Using #{p...
21791bfb3b7bf3b8aecc504f6a6e9e41
if listing with hidden upload id is already in db, then update the existing listing
[ { "docid": "3ddbd5e985894e57161a1143b80f4918", "score": "0.0", "text": "def updateListing(listing_data, current_user, current_community, relation, all_custom_fields, all_custom_field_option_titles)\n listing_attributes = {}\n listing_attributes_custom_fields = {}\n subscribers = []\n ...
[ { "docid": "62ac79f1a7fe7cca5664127993808485", "score": "0.7141842", "text": "def listingsToUpdate(current_user)\n # if there exists an attribut name \"hidden_upload_id\"\n if @valid_attributes.any? {|x| x[:name] == \"hidden_upload_id\"}\n # go through each line (listing)\n @list...
2d5cdba17c6b13decb5665828cf41bca
Returns the categories associated with the token in the set as a Hash
[ { "docid": "688d066c462fe617a8849f42ec8a3db3", "score": "0.851449", "text": "def categories\n set.token_categories[token]\n end", "title": "" } ]
[ { "docid": "0c7ee881e068efb2fead2aab93dc986b", "score": "0.7587525", "text": "def categories\n raw_categories.to_hashugar\n end", "title": "" }, { "docid": "0c7ee881e068efb2fead2aab93dc986b", "score": "0.7587525", "text": "def categories\n raw_categories.to_hashugar\n end", ...
93dbc54be0dc48030f7a1642b2848a20
Connect the bot, making it available to accept commands. You can specify a custom startup message with the ':startup_message' configuration setting.
[ { "docid": "6fa6bc4f31129d50e75629a2efa54d33", "score": "0.6339967", "text": "def connect\n jid = Jabber::JID.new(@config[:jabber_id])\n logger.info(\"Connecting as %s...\",jid)\n begin\n @jabber = Jabber::Framework::Bot.new(jid, @config[:password])\n if connected?\n ...
[ { "docid": "d4cf66f1dcb4bff5c8627464cfdb495c", "score": "0.6547587", "text": "def post_init\n puts \"Connected\"\n execute \"USER #@nick botz botz :Botz\"\n execute \"NICK #@nick\"\n execute \"JOIN #@channel\"\n end", "title": "" }, { "docid": "8ef4030293a3729193ce9f13...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ed625399fdb5e31d0e06d532d17475f5", "score": "0.0", "text": "def set_project\n @project = Project.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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "cea3931a967229d4d430c7a522d12a57", "score": "0.0", "text": "def set_body_garment\n @body_garment = BodyGarment.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "d...
f4db690857d99c71abce95232b44fb1b
Adds client credentials to hash of parameters Arguments: params: (Hash)
[ { "docid": "79050579c863ac49734b63ddb8d6f885", "score": "0.7649284", "text": "def add_credentials_to_params(params)\n return params unless params.is_a? Hash\n credentials = {\n 'PartnerID' => @partner_id,\n 'PartnerPW' => @partner_password,\n 'PartnerSource' => @partner_so...
[ { "docid": "a61ce9e09973cb813861a151c40dcd20", "score": "0.79200464", "text": "def apply_params_auth(params)\n {'client_id' => id, 'client_secret' => secret}.merge(params)\n end", "title": "" }, { "docid": "024064d761f63cfa68c14601bce5d02d", "score": "0.70822394", "text": "de...
67c5ea01c76bd54e67f9cde050afc99c
method to add new race car
[ { "docid": "9d71f53ae0b44fbb38deccc8ab90310b", "score": "0.80551755", "text": "def add_race_car(race_car_instance)\n race_cars << race_car_instance\n end", "title": "" } ]
[ { "docid": "c1eb0e3d012ede6710e95796a5bb4969", "score": "0.73508155", "text": "def addCar car\n\t\t@playground.settle_car(car)\n\t\t@cars.push(car)\n\tend", "title": "" }, { "docid": "9d0163e1fe19330a5fd28508da87f768", "score": "0.7019899", "text": "def add_car(car_to_add)\n @inve...
b51d602e9ae34ef4bb0db26b7829c84f
Actualiza los valores de las acciones para que sean true, false en ves de "0" o "1"
[ { "docid": "8da5fb673e1234d011a759b05ad8c4e1", "score": "0.81568885", "text": "def cambiar_valor_acciones!\n acciones.each{ |k, v|\n val = false\n val = true if v == \"1\" or v == true\n acciones[k] = val\n }\n end", "title": "" } ]
[ { "docid": "640fe964638cadced469d85e30803fcb", "score": "0.6349193", "text": "def set_boolean_value\n @values = [Value.new(@context, true)]\n end", "title": "" }, { "docid": "cb10e441477541d961cb8ae6186ba1a7", "score": "0.6242383", "text": "def set_default_values\n sel...
d132ef584ecf74e9ca4cbcd81e340c48
def total_revenue products = Product.where(merchant_id: self.id) total = 0.0 products.each do |product| product.orders.each do |order| total += order.total_price end end return total end
[ { "docid": "231b0332e6cfb980a6e1f66876a1ce0e", "score": "0.89630145", "text": "def total_revenue\n total = 0.00\n self.my_orders.each do |order|\n total += order.merchant_subtotal(self.id)\n end\n return total\n end", "title": "" } ]
[ { "docid": "e0e66e5067f614ab5cbe9fd8ea443a32", "score": "0.8727861", "text": "def revenue\n Product.joins(:store_products, :purchases).where(store_products: {store_id: self.id}).sum(:price)\n end", "title": "" }, { "docid": "5c5561d0001bb39568c6b8d7e9908679", "score": "0.82501", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "8c193a1d412bee274fe1ac12fef66ded", "score": "0.0", "text": "def set_mvdetail\n @mvdetail = Mvdetail.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...
80f415ac711e1f95b72cf091def150d6
Toggles the has_suggested boolean
[ { "docid": "6858d6a786d14992ce78026d42bd9e78", "score": "0.81678176", "text": "def suggest\n if self.has_suggested\n return false\n else\n return self.update(has_suggested: true)\n end\n end", "title": "" } ]
[ { "docid": "138d74b7aa2c6713f6b2f84ed27663e3", "score": "0.68469495", "text": "def suggest()\n merge(suggest: 'true')\n end", "title": "" }, { "docid": "6681d902216fdc4f3767a5a48611df30", "score": "0.66116554", "text": "def change_as_spellchecker_suggests?\n !@hunspe...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "0822f3acd11349a8f1f12962e1802653", "score": "0.0", "text": "def caddie_params\n params.require(:caddie).permit(:first_name, :last_name, :phone, :email, :comments, :golf, :rules, :course, :is_active)\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...
5a0be243350d8d8ef4c051845c1bb672
Brute force approach to finding all factors for an integer
[ { "docid": "4cddec31e8829fdaaa25639202bbd640", "score": "0.0", "text": "def find_all_factors(n,starting_with=n,tolerance=0)\n n = n.to_i\n factor = (n.eql? starting_with) ? (n - 1) : starting_with\n factors = []\n while factor > 1\n if ((n % factor) <= tolerance)\n f...
[ { "docid": "81caaa1d65d4252dca0a659ad4b71654", "score": "0.79506075", "text": "def find_factors!\n (1..number).each do |n|\n break if @factors.include?(n)\n if number % n == 0\n @factors << n << (number / n)\n end\n end\n # handle any perfect squares\n\n @factors.uniq!\...
69beaa3e957d1fc356539d0314d703e1
Custom attribute writer method checking allowed values (enum).
[ { "docid": "547fc858ae61d13ae1fc7ab13c53a1a4", "score": "0.0", "text": "def weight=(weight)\n validator = EnumAttributeValidator.new('String', [\"80#\"])\n unless validator.valid?(weight)\n fail ArgumentError, \"invalid value for \\\"weight\\\", must be one of #{validator.allowable_valu...
[ { "docid": "af6d0e33773bc681443214ce777b13e1", "score": "0.7088127", "text": "def write_attribute_with_enum(attr, value)\n write_attribute_without_enum attr, converted_enum(attr, value)\n end", "title": "" }, { "docid": "85eec95603dc239e3d18923b2c672b31", "score": "0.6482...
623053e6676ee7506ff9761bad7e4311
Detect if browser is running under PlayStation 4.
[ { "docid": "63bd6287b9c8258e8f929eead438e14f", "score": "0.8042503", "text": "def playstation4?\n !!(ua =~ /playstation 4/i)\n end", "title": "" } ]
[ { "docid": "bb938f6d03c0ca528f890f296796f5c0", "score": "0.72254527", "text": "def detect_sony_playstation()\r\n if (user_agent.include?(DEVICE_PLAYSTATION))\r\n return true\r\n end\r\n return false\r\n end", "title": "" }, { "docid": "bb938f6d03c0ca528f890f296796f5c...
70b3646141194c23e9f94ee622fa3aaf
I worked on this challenge [by myself, with: ]. Your Solution Below
[ { "docid": "d7fcfc865ae836d4f425463cdd8d586e", "score": "0.0", "text": "def get_grade(avg)\n if avg >= 90\n p \"A\"\n elsif avg >= 80 && avg < 90\n p \"B\"\n elsif avg >= 70 && avg < 80\n p \"C\"\n elsif avg >= 60 && avg < 70\n p \"D\"\n else\n p \"F\"\nend\nend", "title": "" ...
[ { "docid": "aa89b26c8848588848ff622b5d313173", "score": "0.64728683", "text": "def solution\n 31875000\nend", "title": "" }, { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.62877476", "text": "def solution4(input)\n end", "title": "" }, { "docid": "7a007b87...
7f5696098091caf88fb329af66d34179
Returns the name of the collection in which to save the object.
[ { "docid": "05e5acf420c4eaf64fdef47df79ba034", "score": "0.65086627", "text": "def collection_name_from_class_name(class_name)\n class_name.demodulize.underscore.pluralize.to_sym\n end", "title": "" } ]
[ { "docid": "77abd72cd0c79a44df3d368f8f9a2257", "score": "0.81340104", "text": "def collection_name\n self.class.collection_name_from_class_name(@object.class.to_s)\n end", "title": "" }, { "docid": "a52a226eb4f2712a6d5629fc6470b910", "score": "0.81332695", "text": "def co...
ae1ce9ec16ae86655d2acb01efd153a5
Write a method named include? that takes an Array and a search value as arguments. This method should return true if the search value is in the array, false if it is not. You may not use the Arrayinclude? method in your solution.
[ { "docid": "8838fc651316b2020bd980403e8af4d2", "score": "0.81355184", "text": "def include?(arr, value)\n included = false\n for el in arr\n included = true if el == value\n end\n included\nend", "title": "" } ]
[ { "docid": "8fca1fc43da7077f08b4f24ada4921d5", "score": "0.86028", "text": "def include?(arr, search_value)\n arr.each {|e| return true if e == search_value}\n false\nend", "title": "" }, { "docid": "bede028fbabcb554a80bbab3ab793097", "score": "0.86023086", "text": "def include?(ar...
329b1cee05283e2d52164c0534cac3db
returns an array of ETags
[ { "docid": "c5af21e09596b660042119fda5ee2694", "score": "0.6684082", "text": "def etags\n (@env['HTTP_IF_NONE_MATCH'] || '').split(/\\s*,\\s*/)\n end", "title": "" } ]
[ { "docid": "01efaa25fdb6a27bdf28ec6d99983b47", "score": "0.70554036", "text": "def tags\n entries = Entry.all\n # Create a list of all the tags, as a String\n tags_list = String.new\n entries.each do |entry|\n tags_list << entry.tags + \" \"\n end\n # Convert the String to a globa...
292f21163cb6db5c214ac2d68b3da72e
Sets up the combat phase.
[ { "docid": "1199cad49ffe19987d6c90ffcae4ded6", "score": "0.6968301", "text": "def setCombat\n\t\t@phase = \"combat\"\n\t\t@battleManager.setBattle\n\t\t@battleOptions.reset\n\t\t@map.redrawSection(0, 0, 11, 3)\n\t\tBATTLE_BACKGROUND.blit(@screen, [188, 106], nil)\n\t\t@menuStack = []\n\tend", "title...
[ { "docid": "67aa7f6a350eef07e980a06bbb7ffcd3", "score": "0.6998099", "text": "def combat\n\t\tif @battleManager.actionUnitsEmpty\n\t\t\tsetMenu\n\t\telse\n\t\t\tunitChange = !@battleManager.updateAction\n\t\t\tif unitChange\n\t\t\t\t@phase = @battleManager.checkChanges\n\t\t\t\tputs @phase\n\t\t\tend\n\...
499abc8c0dac147c595a0c4b7e585382
Is the passed feature present in the set? feature:Feature name, hopefully a symbol but no point forcing it Output:Boolean, feature is present?
[ { "docid": "9aae91c41dd65969155ea715546382a1", "score": "0.81334335", "text": "def hasFeature? feature\r\n\t\t@features.include? feature\r\n\tend", "title": "" } ]
[ { "docid": "7494739235bc6232c6fef2dda3d16a1b", "score": "0.8238095", "text": "def feature?(feature)\n (definition[:features] && definition[:features].include?(feature))\n end", "title": "" }, { "docid": "cf03a464d5486d2132f6bb69806e8768", "score": "0.8181644", "text": "def ha...
47a915f544cf3d925bb0a400d7a173ce
Signs in the given account or user
[ { "docid": "5988954b024d15ab31db50c007ae1789", "score": "0.7615766", "text": "def sign_in(user)\n current_user_manager.sign_in(user)\n end", "title": "" } ]
[ { "docid": "61aec16e108942a36d5c133b4d46b4eb", "score": "0.7763787", "text": "def sign_in user\n login_as user\n\n user\n end", "title": "" }, { "docid": "2296f71e1cd06b2c9b9f2a41386ab62c", "score": "0.7532695", "text": "def sign_in(user, opts = {})\n login_as(u...
6de00b0ccd077d8fbf0e4971127c9633
Allows regionspecific overrides of any of the settings on this configuration object. This allows the user to override things like Image and keypair name for regions. Example: brightbox.region_config "gb1" do |region| region.image_id = "imgumqoe" end
[ { "docid": "0f842e808c67b3527d164d73c5e4231d", "score": "0.66328436", "text": "def region_config(region, attributes=nil, &block)\n # Append the block to the list of region configs for that region.\n # We'll evaluate these upon finalization.\n @__region_config[region] ||= []\n\n ...
[ { "docid": "305888e871c3822476ddfb4cb3a6c4c8", "score": "0.6467017", "text": "def config()\n return {\n :region => region \n }\n end", "title": "" }, { "docid": "07cf431f282774b7471ba0a453aa52c1", "score": "0.63459706", "text": "def setting...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "458c3e9b2edd8df525c336a5a5f646fb", "score": "0.0", "text": "def set_s_skill\n @s_skill = SSkill.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165094", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60450804", "text": "def action_hook...
4f032ddea931ce718145a3ef23220f07
generate URLs based on options chosen
[ { "docid": "3f0a5054bc74a1f7d716965189725816", "score": "0.6682745", "text": "def generate_urls\n # strip trailing / from the base URL\n base_url = @options[:base_url].gsub /\\/$/, ''\n \n # set up a hash of URLs\n @urls = {\n :login => base_url.gsub(/^https?:\\/\\/\\w+\\.(.+)$/, 'h...
[ { "docid": "2f2712293b363aabdf2ac5600676cd28", "score": "0.66082513", "text": "def url_for(options)\n options.to_s\n end", "title": "" }, { "docid": "fd461d3cf3fdc70748322c78dc4fe372", "score": "0.6599758", "text": "def url\n self.class.url_for :country => country, :limit => l...
baeca850305babf49eeb58a992de6f00
Remove the given index from the table. Gives warning if index does not exist
[ { "docid": "c79ef6c351d74492e38610314fda32ff", "score": "0.7520103", "text": "def remove_index(table_name, column_name = nil, **options) # :nodoc:\n return if options[:if_exists] && !index_exists?(table_name, column_name, **options)\n\n index_name = index_name_for_remove(table_name, co...
[ { "docid": "d2a4a04b3a937cc969a0f26ca7237bc4", "score": "0.8080633", "text": "def remove_index(_, options)\n raise \"InternalError: remove_index called in a table definition\" unless options[:if_exists]\n end", "title": "" }, { "docid": "73850e6e5a8265b22f0d1a191894d2fe", "score"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0fbe27e2d362b05a6a89c316fcbc0a82", "score": "0.0", "text": "def set_guide\n @guide = current_user.guides.find_by_permalink(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...
2d8366acdf6ae788090299fa97e7d114
A "csrf" token retrieved from action=query&meta=tokens
[ { "docid": "b6982f5623e8e8dc9522348ac2fa05e7", "score": "0.0", "text": "def token(value)\n merge(token: value.to_s)\n end", "title": "" } ]
[ { "docid": "f6f815b7ae196bf22c3a9d0e1a5bcce3", "score": "0.8989551", "text": "def get_csrf_token\n (action :query, meta: 'tokens', type: 'csrf').data\n end", "title": "" }, { "docid": "af54cae2d7b31d48620408d8aaa0e09b", "score": "0.78511935", "text": "def csrf_token(request)\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "00a329ea4863095f28695e104db4ec18", "score": "0.0", "text": "def set_completion\n @completion = Completion.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.61642385", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60448", "text": "def action_hook; ...
db0eb62d8003af5f0a11cbbbbf4a0684
=begin Detects any iOS device: iPhone, iPod Touch, iPad.
[ { "docid": "14b73b3130f37a604528ef6a5b65f3dd", "score": "0.7365966", "text": "def detect_ios()\r\n if (detect_iphone_or_ipod() || detect_ipad())\r\n return true\r\n end\r\n return false\r\n end", "title": "" } ]
[ { "docid": "848edb9c229e77a8be02e78453f38a9b", "score": "0.7593618", "text": "def detect_iphone\n # The iPad and iPod touch say they're an iPhone! So let's disambiguate.\n !@user_agent.index(DEVICE_IPHONE).nil? && !detect_ipad && !detect_ipod\n end", "title": "" }, { "docid": "7...
a28a3e22dbf0affe3273cc94944f5a1d
POST /article_paragraph_types POST /article_paragraph_types.xml
[ { "docid": "98b8a7a39fc59952b5e81de1882cf316", "score": "0.6765452", "text": "def create\n @article_paragraph_type = ArticleParagraphType.new(params[:article_paragraph_type])\n\n respond_to do |format|\n if @article_paragraph_type.save\n format.html { redirect_to(@article_paragraph_typ...
[ { "docid": "f123aef8f3fe9eeab2056aba03f4fb1b", "score": "0.65082693", "text": "def create\n @paragraph = Paragraph.new(type_category_params)\n\n respond_to do |format|\n if @paragraph.save\n format.html { redirect_to admin_article_path(@paragraph.article_id), notice: 'Su Parrafo fue cr...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "55c6e51d551e50d348e8edd6a57961dc", "score": "0.0", "text": "def set_routes\n @user = User.find(params[:user_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...
8b659bbf1289af2ed19b5e012cd62645
PATCH/PUT /supervisor_volunteers/1 PATCH/PUT /supervisor_volunteers/1.json
[ { "docid": "e1d23ee0f5c8a0d3cdeb23adbf871678", "score": "0.7685365", "text": "def update\n respond_to do |format|\n if @supervisor_volunteer.update(supervisor_volunteer_params)\n format.html { redirect_to @supervisor_volunteer, notice: 'Supervisor volunteer was successfully updated.' }\n ...
[ { "docid": "8b5a396bee4688c615b5f89512d638e5", "score": "0.7238107", "text": "def update\n respond_to do |format|\n if @supervisor.update(supervisor_params)\n format.html { redirect_to @supervisor, notice: 'Supervisor was successfully updated.' }\n format.json { render :show, statu...
2f9d4a6f0c1c75e88b3d7a84ee80fe6a
validates :ecm_cms_page, :existence => true
[ { "docid": "8ac8bb1f28f42585996a1080a4a23ffb", "score": "0.0", "text": "def content_box_name\n ecm_cms_content_box.name\n end", "title": "" } ]
[ { "docid": "584df2d38b075f57eb5df05e52d7bcbe", "score": "0.6568441", "text": "def form_valid?(page)\n\t\t(page && page.errors.size == 0)\n end", "title": "" }, { "docid": "5f30b62226883643e367922f3f03f909", "score": "0.63235855", "text": "def check_page#:doc:\n # @page => current...
da944754cdb9f986fcace280d1ec5a11
Get the net force, in Newtons, applied on the body on the last world update.
[ { "docid": "91b64d89fa64b44007b9b84d523454ff", "score": "0.68722194", "text": "def get_force_acc\n MSPhysics::Newton::Body.get_force_acc(@address)\n end", "title": "" } ]
[ { "docid": "5e0b425d0a61b63c095865a8313b20a2", "score": "0.73547524", "text": "def net_contact_force\n MSPhysics::Newton::Body.get_net_contact_force(@address)\n end", "title": "" }, { "docid": "4342bfbc18499dad75ee80e800a852fd", "score": "0.722717", "text": "def get_magnet_fo...
a65110c87994d3f3ede5db176aeef72f
17: count letters in words for numbers in [1,1000] (21124)
[ { "docid": "1f58b9cc0169ba22bcd47b2a344cdeca", "score": "0.73909736", "text": "def problem17\n numbers = \"\"\n 1.upto(1000) { |x|\n numbers << toWords(x)\n }\n numbers.length\nend", "title": "" } ]
[ { "docid": "2716c81a3179a662daed830ae6f8c489", "score": "0.8247234", "text": "def p17\n require 'number_words'\n puts \"If all the numbers from 1 to 1000 were written out in words, \"\\\n \"#{ NumberWords.letter_count(1, 1000) } letters would be used.\"\n end", "title": "" }...
3b826b26e95f6641981684ee5ff65358
Provide a user friendly representation
[ { "docid": "bb91ac5891ea297ba5759ce4c1de9dbc", "score": "0.0", "text": "def to_s\n '#<Twilio.FlexApi.V1.InsightsQuestionnairesList>'\n end", "title": "" } ]
[ { "docid": "215f29191080c4bf1c51441e99ca812a", "score": "0.70430577", "text": "def to_display\n raise NotImplementedError\n end", "title": "" }, { "docid": "10e71201c7d33f56a89616b30aa39d6b", "score": "0.7025487", "text": "def to_s; description end", "title": "" }, { ...
c426f74e890337d3fa24ab9ebce6e788
PUT /oauth_tokens/1 PUT /oauth_tokens/1.xml
[ { "docid": "ee86f65146b41b11a0a2dfdf90acbbf6", "score": "0.64856654", "text": "def update\n @oauth_token = OauthToken.find(params[:id])\n\n respond_to do |format|\n if @oauth_token.update_attributes(params[:oauth_token])\n format.html { redirect_to([:scaffold, @oauth_token], :notice =>...
[ { "docid": "e73a888202140da3b6c6b06e3b33177f", "score": "0.65999633", "text": "def exchange_oauth_tokens\n end", "title": "" }, { "docid": "5967ee8b7f6e519959f36c42608a364b", "score": "0.6258865", "text": "def update_tokens(oauth_params)\n# binding.pry\n self.oauth_token...
9ed1f458376f77f84a64f9aacbae5a46
Output functions ================= Functions to format and display output Writes content out to the terminal Use Hirb to format tables. Can specify a color using one of the defined color constants Examples out 'some_text', :blue Prints out the text in blue
[ { "docid": "0df2ab7f566e74a3126d06019b6232c5", "score": "0.7432432", "text": "def out(text, text_color=nil, *opts)\n extend Hirb::Console\n #text = text.to_a if text.kind_of? ActiveRecord::Base\n\n if text.kind_of? Array\n STDOUT.puts start_color text_color if text_color\n t...
[ { "docid": "1ff3844c8f1bbdd6491fc032b8ed0c52", "score": "0.7161031", "text": "def hsay(output,color_scheme)\n @highline.say(\"<%= color(%Q{#{output}},'#{color_scheme}') %>\")\n end", "title": "" }, { "docid": "d156accb29d72f98a5aa0bd1ecdb9787", "score": "0.7132147", "text": "...