query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
f6b73eaa552bde1e5ffb128f03174ea7
Returns the last part of the controller's name, underscored, without the ending Controller. For instance, PostsController returns posts. Namespaces are left out, so Admin::PostsController returns posts as well. ==== Returns string source://actionpack//lib/action_controller/metal.rb126
[ { "docid": "6b43d893e237e16627dc8d5f95cd5512", "score": "0.0", "text": "def controller_name; end", "title": "" } ]
[ { "docid": "9583c872a26614199144da463e2e842d", "score": "0.82180434", "text": "def controller_name\n klass = self.class\n \"#{klass.to_s.gsub(/Controller$/, '').downcase}s\"\n end", "title": "" }, { "docid": "803d6dfc475e2651b5875db5df8c4217", "score": "0.8208326", "text...
9112217a80c3787bf3e0be2952be190b
Use this method to return a valid hash and save it for later
[ { "docid": "c808b540dac401825ea2654641d12aa1", "score": "0.0", "text": "def build(user)\n @template[:recipient][:id] = user.id\n @template\n end", "title": "" } ]
[ { "docid": "8b0ca2a51aca6890de8b5f0c476b3125", "score": "0.7037225", "text": "def get_hash\n return(uniquehash) if (uniquehash and uniquehash.length > 0)\n uniquehash = ApplicationController::random_password(10)\n self.save\n return uniquehash\n end", "title": "" }, { "docid": "...
558ab64fdb56d01ed466214879fa8d88
GET /orders GET /orders.json
[ { "docid": "a5c33877fc6236d1db26e5def947c849", "score": "0.0", "text": "def index\n\n if params[:employee][:username] != 'perry' || params[:employee][:password] != '1234' \n\n raise ActionController::RoutingError.new('Not Found')\n end\n @orders = Order.all\n end", "title": "" } ]
[ { "docid": "0018a9a547b20cd7a770a6e2cd109f33", "score": "0.84540683", "text": "def orders\n get(\"orders\")\n end", "title": "" }, { "docid": "8fe2d6ec8a1d47ca8c318cf923eb35b7", "score": "0.84051657", "text": "def orders\n client.get \"orders\"\n end", "title": "" }, ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c12bb8fdb77ba14280fb9c762451cf03", "score": "0.0", "text": "def set_wishlist\n @wishlist = Wishlist.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;...
452b91e1181bf0e6c7ea29399a6cf73d
Returns a new Time representing the end of the minute, x:xx:59.999999
[ { "docid": "d88c843070a09d5bf3921c6e72a9311c", "score": "0.79453915", "text": "def end_of_minute\n change(\n :sec => 59,\n :usec => Rational(999999999, 1000)\n )\n end", "title": "" } ]
[ { "docid": "e47ed8363724f89a6558f4ab5fefb816", "score": "0.79954433", "text": "def end_of_minute\n change(sec: 59, usec: Rational(999999999, 1000))\n end", "title": "" }, { "docid": "399176203950fe57b3d61168a7f68332", "score": "0.7772445", "text": "def end_of_minute\n change...
518682a060c44e1abe2072b8dcd903e6
input params opts Hash Create XML Request Returns Nokogiri::XML::Builder
[ { "docid": "342260a345b167d93c9cecf9963bca96", "score": "0.79816663", "text": "def request_xml(opts)\n envelope_ns_key = \"#{namespace_key(:envelope)}\"\n builder = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do |xml|\n xml[envelope_ns_key].Envelope(namespace_hash) {\n xml = ...
[ { "docid": "1f04ce84f46f2ef31fd3d010ac978f4d", "score": "0.7675224", "text": "def xml_builder(opts=OPTS)\n if opts[:builder]\n opts[:builder]\n else\n builder_opts = if opts[:builder_opts]\n Hash[opts[:builder_opts]]\n else\n {...
8ebe203fe0a2ceb8f0bc46eb20c20b54
GET /accounts GET /accounts.json
[ { "docid": "549a7e182a08c9b23191ce7f6f2236c9", "score": "0.0", "text": "def index\n @user_accounts = @group.accounts.includes(:owner).users.to_a.sort_by!(&:display_name)\n @store_accounts = @group.accounts.includes(:owner).stores.to_a.sort_by!(&:display_name)\n\n respond_to do |format|\n f...
[ { "docid": "e7d5770316fcf0c9dfe4c64e4a22d339", "score": "0.853379", "text": "def accounts\n get('/accounts')['accounts']\n end", "title": "" }, { "docid": "1c1a4b30252257377313131349240c9d", "score": "0.831886", "text": "def get_accounts()\n http_get(accounts_url)\n e...
175bf06b779465efa4de785d39acd23d
Retrieves the data hash for the ID.
[ { "docid": "66c97441392243df7179d6eef4495f17", "score": "0.0", "text": "def get(id)\n @redis.hgetall \"#{@prefix}:#{id}\"\n end", "title": "" } ]
[ { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.7463751", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "85601ac2416d5d39c2217744dd640d72", "score": "0.7463751", "text": "def hash\n id.hash\n end", "title": "" }, { "docid": "8560...
2bdd3e412f643c43a903c93901df43cd
Pagination helper; collection optional as will_paginate will guess based on controller name
[ { "docid": "c10df1756a550699c66526addcaa37af", "score": "0.76763064", "text": "def pagination(collection = nil)\n collection.nil? ? will_paginate : will_paginate(collection)\n end", "title": "" } ]
[ { "docid": "6092d25b6435a6e9c566c43dfcd464f6", "score": "0.754072", "text": "def paginated_collection\n collection_paginator.new(collection, params).call\n end", "title": "" }, { "docid": "507d1960727ab7ec7d0fca89f81a983c", "score": "0.75355124", "text": "def pagi...
a84511f3b77935a9b44130ebad1cd55d
Income & cash flow details calculation for the month
[ { "docid": "1210adb6a9c694cb68f11678bd389bf9", "score": "0.7265225", "text": "def store_income_and_cash_flow_statement_for_month(month_val=nil,year=nil)\n @operating_statement={}\n @cash_flow_statement={}\n calc_for_financial_data_display\n year_to_date= !month_val.nil? ? month_val : @financ...
[ { "docid": "188e1c13225a190dbb9fe59df079ce4f", "score": "0.7532698", "text": "def cash_flow_month\n months_loyers.each_with_index.map do |loyer, index|\n loyer - months_depenses[index]\n end\n end", "title": "" }, { "docid": "56cd4b46345b08fb8c795be807e266c8", "score": "0.741...
8df2d5ce653783c890417a5304c5e19e
Type condition only applies if it's STI, otherwise it's done for free by querying the inherited table in MTI
[ { "docid": "ed37c2e3c91f66a8548845b9b7be2136", "score": "0.6889617", "text": "def type_condition(table = arel_table)\n super unless mti_table\n end", "title": "" } ]
[ { "docid": "268235a87a7c3de0b1243f7ebc200673", "score": "0.8284504", "text": "def type_condition(table = arel_table)\n if using_multi_table_inheritance?\n nil\n else\n sti_column = table[inheritance_column]\n sti_names = ([self] + descendants).map { |m...
4d33f8be1037ce92d15e0b2877059384
creates the foreign key RefManyAccount becomes :account_id
[ { "docid": "53ad943a0ad81ed6395860cd74df54f9", "score": "0.0", "text": "def foreign_key cls_name\n model = get_class(cls_name)\n name = model.to_s.underscore.split('_').last.singularize\n :\"#{name}_id\"\n end", "title": "" } ]
[ { "docid": "f37545faa2991fcf2ef4bc70fb7804d3", "score": "0.59228057", "text": "def add_foreign_key(from_table, to_table, **options); end", "title": "" }, { "docid": "7d51f005271acc2bb7d21191a5c65cba", "score": "0.5894763", "text": "def foreign_key\n self[:foreign_key] || :\"...
d5164dd9bd8485d156fd2433026c668e
for code_paths and controller_paths select those paths that actually exist in the plugin's directory
[ { "docid": "c980b4ef0cdab7aabe3800149d6ba196", "score": "0.5944452", "text": "def select_existing_paths(name)\n Engines.select_existing_paths(self.send(name).map { |p| File.join(directory, p) })\n end", "title": "" } ]
[ { "docid": "179b441d28d1664f81cbc730684257a8", "score": "0.82476366", "text": "def load_paths\n report_nonexistant_or_empty_plugin! unless valid?\n select_existing_paths :code_paths\n end", "title": "" }, { "docid": "e28fe5b596f3199813ecfef7c2f74acb", "score": "0.70476294", ...
472d4bff5366d1f2a58238b0336747ec
Private: retrieve the current list of subscriber names Returns an array of subscriber queue names
[ { "docid": "d0d4077f5058df68a63cb13919758f1f", "score": "0.7786369", "text": "def subscriber_names\n @client.smembers @name\n end", "title": "" } ]
[ { "docid": "124e003700302d3d51d8f62efdb46308", "score": "0.7841043", "text": "def names_list\n backend.queue_names\n end", "title": "" }, { "docid": "79e80fa8f1c7a814f1220eafcc29ae3e", "score": "0.7009411", "text": "def get_subscribers\n @subscriptions = subscribers(@noden...
f5d004d1f7ec52eadeaaabd771829632
Internal: Constructor, creates new message. url The String url of the backend endpoint. event The String event name. data The Hash message payload.
[ { "docid": "a23573cb78b565ff1c1c320a96144bdb", "score": "0.72418827", "text": "def initialize(url, event, data={})\n @event = event\n @client = Client.new(url)\n super(data)\n end", "title": "" } ]
[ { "docid": "ecc8306968f5474e37922dbe9beeb87f", "score": "0.6664553", "text": "def create_message(data); end", "title": "" }, { "docid": "ecc8306968f5474e37922dbe9beeb87f", "score": "0.6664553", "text": "def create_message(data); end", "title": "" }, { "docid": "b7114a6a37...
45881323bc9591654397b3226a105371
PATCH/PUT /stdoctorregists/1 PATCH/PUT /stdoctorregists/1.json
[ { "docid": "de3cd6c4092a12ff48da1ec3c298a878", "score": "0.6868336", "text": "def update\n respond_to do |format|\n if @stdoctorregist.update(stdoctorregist_params)\n format.html { redirect_to @stdoctorregist, notice: 'Stdoctorregist was successfully updated.' }\n format.json { ren...
[ { "docid": "ad95665324538c58fc4fe5ddb84bcb01", "score": "0.62101763", "text": "def update\n head :forbidden\n return false\n\n #@resident = Resident.find(params[:id])\n #\n #\n # if @resident.update_attributes(params[:resident])\n # head :no_content\n # else\n # render ...
b42d8871213ff4e84297c64a487d2ed2
Giving and taking methods
[ { "docid": "c901dca094d448b363525b956d79d9da", "score": "0.0", "text": "def max_take\n if $game_party.multi_storage[$game_variables[Storage::BOX_VAR]][@item] > $game_party.max_item_number(@item) - $game_party.item_number(@item)\n $game_party.max_item_number(@item) - $game_party.item_number(@item...
[ { "docid": "1e5e53c4b9e93d9482caa25c8f435412", "score": "0.71113324", "text": "def methods; end", "title": "" }, { "docid": "b327a885692d528cdbf7b43ff9735d01", "score": "0.6981929", "text": "def methods\n\t\tend", "title": "" }, { "docid": "ae6ae7b9991fb7bd204dbdc750ebcd1...
c54f5d4b93fde28c338c4f6354b350ce
Time Complexity: O(n) where n is equal to the number of TreeNodes in the tree Space Complexity: O(n) where n is equal to the number of TreeNodes in the tree
[ { "docid": "f80dc13dac1913bba89726e7205b9ff0", "score": "0.0", "text": "def preorder(current = @root, array = [])\n if current\n array << { key: current.key, value: current.value }\n preorder(current.left, array)\n preorder(current.right, array)\n else\n return array\n end\n...
[ { "docid": "98397e3da81726f6947ebfede268f9e5", "score": "0.6870334", "text": "def size_tree (node)\n\t\t\tif node.left == nil && node.right == nil\n\t\t\t\treturn 1\n\t\t\telse\n\t\t\t\treturn 1 + size_tree(node.left) + size_tree(node.right)\n\t\t\tend\n\t\tend", "title": "" }, { "docid": "9...
954ef853ecfb4224fce223b645485394
collect data for students array
[ { "docid": "c7503e6c4e63aa9b7518df9ca0c6d63c", "score": "0.0", "text": "def user_input\n\t#set variables\nname, cohort, city, hobby = placeholder\n\t#prompt the user for input\n\tputs \"Please enter the name of the student you'd like to add to the database \\n\".center(50).green\n name = gets.chomp\n...
[ { "docid": "7644bc102d9aab427fac86ab4ccf6244", "score": "0.7149103", "text": "def student_array\n @students1 = []\n @selected_students = User.only_students\n @students1 << @selected_students\n end", "title": "" }, { "docid": "2ff8ce0293443646d52ff9a9d9b9131b", "score": "0.69856...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "d88c16dd8320a6759a61e14e86821910", "score": "0.0", "text": "def template_params\n params.require(:template).permit(:file, :description, :name, :html_content)\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...
09756d4baee4fbef7f154312e082a249
Do the tokenization. The string text will be processed into the stream of Tokens. The resultant value is the Array of Mapper::Token structures.
[ { "docid": "5adf50e417146b85592caf4b58641ffe", "score": "0.70520765", "text": "def tokenize( txt )\n tokens = tokenize_internal( txt, @rex )\n tokens.push Mapper::Token.new( :eof ) \n end", "title": "" } ]
[ { "docid": "6f28088c2308ccdb02f716878940b39b", "score": "0.72621715", "text": "def tokenize\n tokens = []\n ss = StringScanner.new(@input)\n\n until ss.eos?\n tok = next_token(tokens, ss)\n\n if tokens.any? && tok.type == :text && tokens.last.type == :text\n tokens....
73a7443a54094c3631b0dc22bc206b3c
Renders the specified template with the given context
[ { "docid": "54bac3aada202e4995dcfab0de7d52f7", "score": "0.0", "text": "def render(template, context = nil)\r\n template_path = File.expand_path(\r\n \"#{File.dirname(__FILE__)}/#{template}.xml.erb\"\r\n )\r\n template = File.read(template_path)\r\n Erubis:...
[ { "docid": "b807a65548febb8a08a3eb2e909e88fa", "score": "0.8489358", "text": "def render_template(context, options) #:nodoc:\n\t ::ActionView::TemplateRenderer.new(lookup_context).render(context, options)\n\t end", "title": "" }, { "docid": "de68e9fa3efc51b20e80b20aff83b5a9", "sc...
74b7299073456213c7121f7ebdcf2b8b
trims the string to the nearest word boundary ensuring that the resulting length is less than max_length
[ { "docid": "80d7ca12cced584b2ec1f8164cd64632", "score": "0.85384154", "text": "def trim_to_word( max_length )\n string = self\n if string.length > max_length\n string = string[0..max_length-4]\n while string[-1,1] =~ /[\\w]/ && string.length > 1\n string = string[0..string.length-...
[ { "docid": "083d8b5e167ecc670fbc80c63e3c3bc2", "score": "0.74455816", "text": "def truncate_on_word_boundary(string, options = {})\n StringHelpers.truncate_on_word_boundary(string, options[:min_chars] || 0, options[:max_chars] || 140) || \"\"\n end", "title": "" }, { "docid": "4860697110...
6bc1ab321a61a8c2dd8357cb0b5c8332
PATCH/PUT /starships/1 or /starships/1.json
[ { "docid": "afe66039f5f8a8d2616430c403c8e199", "score": "0.7516195", "text": "def update\n respond_to do |format|\n if @starship.update(starship_params)\n format.html { redirect_to @starship, notice: \"Starship was successfully updated.\" }\n format.json { render :show, status: :ok...
[ { "docid": "634740a8eb4157c6093e12f7c8a9bac8", "score": "0.70818055", "text": "def set_starship\n @starship = Starship.find(params[:id])\n end", "title": "" }, { "docid": "634740a8eb4157c6093e12f7c8a9bac8", "score": "0.70818055", "text": "def set_starship\n @starship = S...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8898aeca2c88f9c6b774cd72408a8706", "score": "0.0", "text": "def post_params\n params.require(:post).permit(:title, :content, :tag, :user_id, :image)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7497801", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6957249", "text": "def strong_params\n params.require(:request).permit(param_white...
8473f9d0ef72190fff922a0f5a64334e
Reset the stratgies to nil, used after cloning.
[ { "docid": "c3faecf7aa26a2164a8a4a5d225cd26d", "score": "0.0", "text": "def reset_strategies!\n self.strategy, self.negating = nil, nil\n end", "title": "" } ]
[ { "docid": "19123593e4faf153dd24dce025b71877", "score": "0.72018033", "text": "def reset\n @state = nil\n @name = []\n end", "title": "" }, { "docid": "20676e4d19574b326b72e8649ddd5bb4", "score": "0.71855855", "text": "def reset!\n objects.each { |object| eval(\"@...
43e358449318dafb8103f0eada7f5463
POST /custom_messages POST /custom_messages.json
[ { "docid": "ec045510b5ddf6c9047baf8d0d31809c", "score": "0.0", "text": "def create\n current_id = current_user.id\n token = current_user.fb_authentication.token\n @is_today_birthday = false\n get_graph_api_object(token)\n @friend_uid = params[:custom_message][\"friend_uid\"]\n birthday...
[ { "docid": "1f79f097aaea01dde7af685b4a7fa6f4", "score": "0.74496484", "text": "def create\n @custom_message = CustomMessage.new(params[:custom_message])\n\n respond_to do |format|\n if @custom_message.save\n format.html { redirect_to @custom_message, notice: 'Custom message was success...
4393f727f19b7e006a77c33cf3cf7445
Set the yrange of the plot
[ { "docid": "823aa34e83df3894e8eb529acafcb29b", "score": "0.77385414", "text": "def yrange(min, max)\n set_string(\"yrange\", \"[#{min}:#{max}]\")\n end", "title": "" } ]
[ { "docid": "41cd6842aaaba145b04530bcf48544eb", "score": "0.7000827", "text": "def set_y_axis(params = {})\n @y_axis = convert_axis_args(@y_axis, params)\n end", "title": "" }, { "docid": "e0f156477e6c28a1118b8fa3a7321c3d", "score": "0.672946", "text": "def yaxis\n end", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "04968291e33b8455c8bd89a22bb03eb1", "score": "0.0", "text": "def article_params\n params.require(:article).permit(:name, :category_id, :images, :enable)\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...
eaa1264638685f51c760df657c686eb0
Changes the size of the directive to the given size. It is possible for the given value to the a directive; if it is, it just uses the name of the directive.
[ { "docid": "59f8bc47428c3c4e7213fbb275d6b71e", "score": "0.70205605", "text": "def [](new_size)\n if new_size.is_a? Directive\n tags.merge! new_size.tags_for_sized_directive\n else\n tags[:size] = new_size\n end\n\n self\n end", "title": "" } ]
[ { "docid": "c6c7d94b3a66756b3370d8ecfefa3cf2", "score": "0.7538192", "text": "def set_Size(value)\n set_input(\"Size\", value)\n end", "title": "" }, { "docid": "7561e8e1abdfb98789600e6c75aa86ff", "score": "0.7426374", "text": "def set_Size(value)\n set_input(\"S...
7655e117a682ed7b296ea1a9e2c730fa
GET /admin/posts/1 GET /admin/posts/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "5f1975bbfcb1244fb5fa774ccab5f818", "score": "0.75225854", "text": "def show\n @adminpost = Adminpost.find(params[:id])\n render json: @adminpost\n end", "title": "" }, { "docid": "0b8b3d73717bc062487c4cf1a98ab04b", "score": "0.74030906", "text": "def index\n if ...
4bf0e72cff71c4f95916d1ba9f0c4827
PUT /pdf_reports/1 PUT /pdf_reports/1.json
[ { "docid": "82fa0c418f39e0225a9406ccd85497fd", "score": "0.71902126", "text": "def update\n @authenticated = authenticated?\n @me = me if authenticated?\n @pdf_report = PdfReport.find(params[:id])\n\n respond_to do |format|\n if @pdf_report.update_attributes(params[:pdf_report])\n ...
[ { "docid": "557433a564fd552c4087980d029f3114", "score": "0.6924382", "text": "def update\n @pdf = Pdf.find(params[:id])\n\n respond_to do |format|\n if @pdf.update_attributes(params[:pdf])\n format.html { redirect_to @pdf, notice: 'Pdf was successfully updated.' }\n format.json ...
60397c56992624e47d8c812c902d149e
Wakes up all threads waiting for this lock.
[ { "docid": "db92ee785a672424546c1085656a6e2d", "score": "0.6198169", "text": "def broadcast\n @waiters.each do |mutex, green|\n _wakeup(mutex, green)\n end\n @waiters.clear\n self\n end", "title": "" } ]
[ { "docid": "68358fb0e2f090c5a580554cd9a96d04", "score": "0.72835934", "text": "def notify_waiting_threads\n return unless @waiting_threads\n @waiting_threads.each { |t| t.wakeup }\n @waiting_threads.clear\n end", "title": "" }, { "docid": "68358fb0e2f090c5a580554cd9a96d04",...
36d0dbb8131d89ca388d29847394f3fd
before_action :authorize_admin, only: [:new, :edit]
[ { "docid": "b1f555deaacb948a023105fb1a4c53a7", "score": "0.0", "text": "def index\n @comic = Comic.all\n end", "title": "" } ]
[ { "docid": "e1407f3450d9928b3d5795ae764709c8", "score": "0.8006401", "text": "def edit\n authorize! :admin_edit, @user\n end", "title": "" }, { "docid": "f5e5f9547137124263a1775148fbcb5f", "score": "0.7857109", "text": "def authorize_admin\n redirect_to '/login_admin' unless c...
8c72b7fed1587c192e5ac55367149d55
PATCH/PUT /applicant_reports/1 PATCH/PUT /applicant_reports/1.json
[ { "docid": "6a0a400e1c786d875a9701e294022aca", "score": "0.70661217", "text": "def update\n respond_to do |format|\n if @applicant_report.update(applicant_report_params)\n format.html { redirect_to @applicant_report, notice: 'Reporte de becario actualizado correctamente.' }\n forma...
[ { "docid": "af334144e0a24c0e0471cebd6c807f3d", "score": "0.66169506", "text": "def update\n respond_to do |format|\n if @applicant.update(applicant_params)\n format.html { redirect_to @applicant, notice: 'Applicant was successfully updated.' }\n format.json { head :no_content }\n ...
a5f294616547d8555f44ee8a661812c3
complete field with lable and error message, and wrap whole bundle in a paragraph unless asked not to do so
[ { "docid": "dec8619b9b71900f51e215fbf74d35f8", "score": "0.6531955", "text": "def bundleize(field, method, options = {})\n bundle = [ build_label(method, options), field, build_error_message(method) ].join\n wrap(bundle) unless options[:dont_wrap]\n end", "title": "" } ]
[ { "docid": "585474e2aa6ca219f2e849518cf56d74", "score": "0.6400666", "text": "def hint(field)\n field = i18n_text(:hints, field) unless field.is_a?(String)\n field.gsub!(/(\\r\\n|\\r|\\n)/, '<br />')\n @template.content_tag(:p, field.html_safe, :class => :'help-block')\n end", "tit...
6399fd8060bb27f4e95ae27f6fe9ffe2
Resets the moderation state of a content submission to a feed. Must be affialiated with a moderator. Duration resets on default to the duration specified by the uploader.
[ { "docid": "478f8a81b5fa2c621a3426c97372e24d", "score": "0.6638779", "text": "def unmoderate(moderator, duration = self.content.duration)\n update_attributes({:moderation_flag => nil, :duration => duration, :moderator => moderator})\n end", "title": "" } ]
[ { "docid": "7afca1e8be5ba3d807702f087c487ff7", "score": "0.5280945", "text": "def unmake_moderator; JSON[Api::post_unmake_moderator(self)]; end", "title": "" }, { "docid": "02b6037859a136c6a4ca066f5a693c72", "score": "0.5243812", "text": "def reset_post_allowed_interval!\n user_se...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "573f0f45abb2e951b924e444c32f3e27", "score": "0.0", "text": "def set_registro_carrera\n @registro_carrera = RegistroCarrera.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...
f64bd32c9e880731b146de415fd09c9b
Returns a randomized initial population.
[ { "docid": "091920f3ed1fc467fe722ddc4c2d38da", "score": "0.70841557", "text": "def create_initial_pop\n population = []\n\n until population.size == @popsize\n population << scramble_tree(@src, @src.size)\n end\n\n population\n end", "title": "" } ]
[ { "docid": "a978208c412a3fabdcf8b2d69a6f8c04", "score": "0.8224771", "text": "def seed_initial_population\n puts \"Building initial population of size: #{@population_size} ...\"\n @curr_population = []\n @population_size.times.each { @curr_population << @chromosome_klass.random }\n end", "...
595fb1036ef1b18c2078f26b5f357cc3
Deletes an item from the collection. Entities from different namespaces may have the same name, so if you are connected to Splunk using a namespace with wildcards in it, there may be multiple entities in the collection with the same name. In this case you must specify a namespace as well, or the +delete+ method will ra...
[ { "docid": "83d2b86a2c1dc23eb615245bf44f07dc", "score": "0.62194586", "text": "def delete(name, namespace=nil)\n if namespace.nil?\n namespace = @service.namespace\n end\n\n # We don't want to handle any cases about deleting ambiguously named\n # entities.\n if !namespace...
[ { "docid": "d1d98dc751abce1c0595a4490bf17bdf", "score": "0.6660114", "text": "def delete(collection, entity)\n command(\n _find(collection, entity.id)\n ).delete\n end", "title": "" }, { "docid": "d1d98dc751abce1c0595a4490bf17bdf", "score": "0.6660114"...
8fa73f96f9f64e942399fe7841b7cf4e
remove the tag associated between tables == Example assuming we remove the post tag by a post id 1 data_rm_tag(:posts, 1, :ruby) or data_rm_tag(:posts, 1, 'ruby, python') or data_rm_tag(:posts, 1, [:ruby, :python])
[ { "docid": "2acce2ad6f9194613777ea13e899f4f7", "score": "0.7727074", "text": "def data_rm_tag table_name, index_id, tag\n\t\ttids = _tag2 tag\n\t\tunless tids.empty?\n\t\t\ttids.each do | tid |\n\t\t\t\tSdb[:data_tag_assoc].filter(\n\t\t\t\t\t:table_id \t=> _tag(table_name),\n\t\t\t\t\t:index_id \t=> in...
[ { "docid": "2460dedf455eba1976b0e07add9dfc51", "score": "0.7646931", "text": "def _tag_rm assoc_table, assoc_id, tag\n\t\ttids = _tag2 tag\n\t\tunless tids.empty?\n\t\t\ttids.each do | tid |\n\t\t\t\tSdb[:_taga].filter(\n\t\t\t\t\t:assoc_table \t=> _tag(assoc_table),\n\t\t\t\t\t:assoc_id \t\t=> assoc_id...
517d9b8b0db78175c0cf72f58abe0bb6
a bit of a silly method to help the code in lib/changeable.rb so it doesn't have to specialcase findingthe owner of a user object
[ { "docid": "3c9b0d7c4a3e9841204e2b1ff4f348a7", "score": "0.0", "text": "def user\n self\n end", "title": "" } ]
[ { "docid": "0e6366ec80d47555216b3caac536fb43", "score": "0.7769792", "text": "def get_object_owner(object)\n User.find_by_id(object.user_id)\n end", "title": "" }, { "docid": "ed4b3f9cdf64a84b9980ecaa8803b989", "score": "0.76693326", "text": "def owner?(user)\n user_id == user....
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "5826c84067bfea623f4662df2875aee5", "score": "0.0", "text": "def vendor_date_params\n params.require(:vendor_date).permit(:vendor_id, :date, :service_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
a7f76511a9b4679924c6a59f19c1c2b3
Input: Single positive integer Output: An array of all integers in sequence between 1 and the argument ALGORITHM: Generate array with a range from 1 to the given argument, returns
[ { "docid": "b2da041a776ccd6d8473ade55b4cb483", "score": "0.66961485", "text": "def sequence(num)\n num > 0 ? Array(1..num) : Array(num..1).reverse\nend", "title": "" } ]
[ { "docid": "01ed89d2888d8dc5d5f0a506579ff478", "score": "0.76118714", "text": "def sequence(number)\n Array (1..number)\nend", "title": "" }, { "docid": "9a46fee969df59a25db063d9fe54ae8e", "score": "0.7462866", "text": "def sequence(int)\n (1..int).to_a\nend", "title": "" }, ...
bfbcddcc918ef40f76e5014276919dbc
Preview this email at
[ { "docid": "b6c9a5cfd10761f893c5744f210ad7ba", "score": "0.0", "text": "def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end", "title": "" } ]
[ { "docid": "947d18f31928dcf9761bdcbda7f18565", "score": "0.71475905", "text": "def preview\n @email = Email.find(params[:id])\n render :text => @email.body\n end", "title": "" }, { "docid": "f9cb02c07e98bbf5e69bcea1540cfe24", "score": "0.71186084", "text": "def preview\n @e...
9d517ee1f5b467e7d603d33c876caaff
this method returns the natural number of the prime number at position. for example, for the prime number at 100, it returns 541. for the prime number at 1000, it returns 7919. for the prime number at 5000, it returns 48611.
[ { "docid": "515755f08828fa0d3c25c61c57e1026c", "score": "0.0", "text": "def index(position)\n # index to the entire bool array\n i = 1\n # index by prime numbers\n j = 0\n while (j < position)\n i += 1\n if @field[i]\n j += 1\n end\n end\n i\n end", "title...
[ { "docid": "7b5d897fec236e9435cb2cc881e8fff1", "score": "0.73348325", "text": "def GetPrimeNumber\r\n @num = 0\r\n @index = 1\r\n \r\n #puts \"index #{@primeIndex}\"\r\n \r\n while @index <= @primeIndex do\r\n @num += 1\r\n if IsPrime(@num)\r\n @index += 1\r\n end...
3aea6e5c95f8435775c84f0cce8a1542
returns all announcements for a particular ticker
[ { "docid": "68089a186f4e4f0722c857395d90074b", "score": "0.69775695", "text": "def get_announcements(arr, ticker) # for now ticker must be a 5 char string\n\tfiltered = []\n\tfor i in 0...arr.length\n\t\tif arr[i][2] == ticker\n\t\t\tfiltered << arr[i]\n\t\tend\n\t\ti += 1\n\tend\n\tfiltered\nend", ...
[ { "docid": "059ef0d768325dd868e1dc3571c29e4f", "score": "0.6254165", "text": "def all_book_tickers\n request :public, :get, :bookTicker\n end", "title": "" }, { "docid": "65f5430a8f7be8ac486423f4b4c56429", "score": "0.59285206", "text": "def index\n @announcement...
15a2ff581b5a37135a2eb37323f531ca
Prompts the user on what they want to do after logging a cocktail
[ { "docid": "3877035a740efdc09a7fc8b6f3cf4e64", "score": "0.767667", "text": "def cocktail_next_steps_after_logging_prompt(user, cocktail_info)\n\n prompt = TTY::Prompt.new\n\n result = prompt.select('What would you like to do now?') do |menu|\n menu.choice \"Make another cocktail\"\n ...
[ { "docid": "69b67fbb4dc6777134294badfdacaeff", "score": "0.70483667", "text": "def cocktail_next_steps_action(user, user_input, cocktail_info)\n if user_input == \"Make another cocktail\"\n make_a_cocktail(user)\n elsif user_input == \"Return to Today's Drinks\"\n homescreen(user.rel...
b6b9cd199dfaed08c4c534812e0ac109
Check to see if the all the properties in the model are valid
[ { "docid": "df4fe77870ee56024e4eb8c9a9e73d40", "score": "0.0", "text": "def valid?\n return false if @remit_name.nil?\n return false if @remit_name.to_s.length > 50\n return false if @location.nil?\n return false if !@address_one.nil? && @address_one.to_s.length > 50\n return fa...
[ { "docid": "162d0e63d65b0cd6795543bab63498f2", "score": "0.78992486", "text": "def validate_properties\n true\n end", "title": "" }, { "docid": "162d0e63d65b0cd6795543bab63498f2", "score": "0.78992486", "text": "def validate_properties\n true\n end", "title": "" ...
eec869baa71f6c602164e787c58080fc
Hooks into credentials so that you can pass :facebook_uid and :facebook_session keys.
[ { "docid": "3375193fc18dc184b9aae1d53126fec0", "score": "0.7007642", "text": "def credentials=(value)\n super\n values = value.is_a?(Array) ? value : [value]\n if values.first.is_a?(Hash)\n hash = values.first.with_indifferent_access\n self.facebook_uid = hash[:fac...
[ { "docid": "f0de7cd1b814c03401fb5c75db83709a", "score": "0.7394851", "text": "def credentials\n if self.authenticating_with_facebook?\n details = {\n :facebook_uid => self.send(self.facebook_uid_field),\n :facebook_session => self.send(self.facebook_session_field)\n...
a98bac47b37d0cb745d658ec055f29d9
for each course, pass the ucas url and parsed page to add_courses
[ { "docid": "2bc5ed042a8338e48950ed0a70fa80d3", "score": "0.7533565", "text": "def scrape_course_info\n counter = 1\n @all_providers.each do |provider|\n\n provider[:courses].each do |url|\n unparsed_page = HTTParty.get(url)\n parsed_page = Nokogiri::HTML(unparsed_page)\n\n ...
[ { "docid": "dc6ad5c7ffa26df866cae53501b2524e", "score": "0.7620617", "text": "def add_courses(url, counter, parsed_page)\n all_paragraphs = parsed_page.xpath '//p' # all <p> on the page\n paragraph_number = 8 # The description paragraph for most pages\n\n # get the course's description\n cou...
9155cb2541cfbb2abcaf0b7f266c43bf
POST /ouves POST /ouves.xml
[ { "docid": "535d4a80908697e0a21c1cab4bb039c5", "score": "0.60721445", "text": "def create\n @ouve = Ouve.new(params[:ouve])\n\n respond_to do |format|\n if @ouve.save\n format.html { redirect_to(@ouve, :notice => 'Ouve was successfully created.') }\n format.xml { render :xml =>...
[ { "docid": "adbd4063f9795c23205a346f6dfd3f22", "score": "0.5883829", "text": "def post uri, args = {}; Request.new(POST, uri, args).execute; end", "title": "" }, { "docid": "3199172d4065b6003041cf7a5b6aad91", "score": "0.575977", "text": "def post_expense_xml(xml)\n #request header...
33a74462bf5710a2207c1511cbb90abf
Defines a new experiment, given the experiment's name, type and definition block.
[ { "docid": "d0b2c8c924d36a63cbdfaa599b7a26bf", "score": "0.6227099", "text": "def define(name, type, options = nil, &block)\n options ||= {}\n Vanity.playground.define(name, type, options, &block)\n end", "title": "" } ]
[ { "docid": "8c4d389b52be944297859904af5f7d2f", "score": "0.8150271", "text": "def define(name, type, options = nil, &block)\n raise \"Experiment #{@experiment_id} already defined in playground\" if playground.experiments[@experiment_id]\n\n klass = Experiment.const_get(type.to_s.gsub(/\\/(...
0c01b67bc98fcf290adf3acf65339ce1
Traces "find_inverse_references_by" operations delegated to the QueryService
[ { "docid": "f1c13261174e796907019a59e7cc604d", "score": "0.6967586", "text": "def find_inverse_references_by(resource: nil, id: nil, property:)\n trace(\"valkyrie.find_inverse_references_by\") do |span|\n span.set_tag(\"param.resource\", resource.id.to_s) if resource\n span.set_tag(\"...
[ { "docid": "0163e1d813b60a456c88fc410c01ea39", "score": "0.6643927", "text": "def find_inverse_references_by(resource: nil, id: nil, property:)\n raise ArgumentError, \"Provide resource or id\" unless resource || id\n ensure_persisted(resource) if resource\n id ||= resource.id\n inte...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "e63393bfbd87c30cdca88f1dc50dca35", "score": "0.0", "text": "def set_permission\n @permission = Permission.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;...
08745ca97098cf5c7d3c0f65876d32da
GET method is allowed for cloud behaviour without JS
[ { "docid": "69f39af14cf99384eab4d46f9d766096", "score": "0.0", "text": "def create_remote\n img = {}\n data = {}\n if params[:data].present?\n data = JSON.parse(params[:data]).symbolize_keys\n img = data[:image].symbolize_keys\n else\n img = params[:image]\n end\n model ...
[ { "docid": "9d4a27a7b2ed4d844162111f1a1729a5", "score": "0.72178864", "text": "def get; end", "title": "" }, { "docid": "902adf030359d9e7acaa73878730d2fa", "score": "0.71730965", "text": "def http_method\n :get\n end", "title": "" }, { "docid": "cf06302bfac61e5b1a66df...
e4c6600a4cbe4fdf77116e2125205e31
just a random zone, unlikely to be local, and not UTC
[ { "docid": "074cdd66f263210d9456ca1b80c4d51a", "score": "0.0", "text": "def setup\n super\n\n Time.zone = @@set_time_zone_name if Time.respond_to?(:zone)\n end", "title": "" } ]
[ { "docid": "49c085e48b0957ad523032b642abfda9", "score": "0.7122054", "text": "def zone_default; end", "title": "" }, { "docid": "49c085e48b0957ad523032b642abfda9", "score": "0.7122054", "text": "def zone_default; end", "title": "" }, { "docid": "c87586a9d423db07bd0a5e7b0e...
6821adb44438ac87781a9bdef163419b
Clear the current playlist. Returns an Array of Strings.
[ { "docid": "7f0cc4b41587fb01afbf66c511f650c0", "score": "0.52886784", "text": "def clear\n native :clear\n end", "title": "" } ]
[ { "docid": "f6948d3a59d96d8df638b71c83bd65d8", "score": "0.70779204", "text": "def clear\n EnqueuedTrack.delete_all\n\n render :text => \"Playlist cleared.\", :content_type => 'text/plain'\n end", "title": "" }, { "docid": "b43417d85e8ad3f6d05659b280c7a094", "score": "0.66839546",...
13567753eeb144557c4ceae97dc62077
If this is a preflight OPTIONS request, then shortcircuit the request, return only the necessary headers and return an empty text/plain.
[ { "docid": "eddab6fe16024781f0fc4af924c209d0", "score": "0.7212929", "text": "def cors_preflight_check\n if request.method == :options\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'POST, GET, OPTIONS'\n headers['Access-Control-Allow-Headers...
[ { "docid": "c01beb23714dd89b52bf69d8ac226e17", "score": "0.7614249", "text": "def handle_options\n head(:ok) if request.request_method == \"OPTIONS\"\n end", "title": "" }, { "docid": "a1551a2cb6679b07269ec79c28d2ee03", "score": "0.7467578", "text": "def cors_preflight_check\n ...
2588acab8df4711d4a7649f629b7a383
Take the http result of a transmit and raise an error, or return the body of the result when valid.
[ { "docid": "27fe85e9d5d5ea42db874833eac97d54", "score": "0.63077796", "text": "def process_result(code, body)\n\t\traise Rush::NotAuthorized if code == \"401\"\n\n\t\tif code == \"400\"\t\n\t\t\tklass, message = parse_exception(body)\n\t\t\traise klass, \"#{host}:#{message}\"\n\t\tend\n\n\t\traise Rush:...
[ { "docid": "fff117f4963981254096a9b95b1d778e", "score": "0.6335895", "text": "def process\n\n if malformed?\n @result = :malformed\n return\n end\n\n if finished?\n @result = :already_finished\n return\n end\n\n @submission_response = $stellard.get(\"tx\", blob: tx_env...
0e7720dada40612dfa3917e4a1202942
Access the mailer instance. source://actionmailer//lib/action_mailer/mail_helper.rb33
[ { "docid": "bc327b0c8051a8d65726a88aacb7c83a", "score": "0.6774731", "text": "def mailer; end", "title": "" } ]
[ { "docid": "153413e1389736d67aa61ab151b6041b", "score": "0.7392172", "text": "def mailer\n @_controller\n end", "title": "" }, { "docid": "cbcadedf86a454b0f2c0063cd08611c0", "score": "0.7184816", "text": "def mailer\n if @notification.instance_of? ::Notification\n ...
594b5a3d8e46c408026a05afe3c32505
POST /people POST /people.xml
[ { "docid": "b3212d8ed4aeb5cc53c8ad72bc095280", "score": "0.5703384", "text": "def create\n @person = Person.new(params[:person])\n\n respond_to do |format|\n if @person.save\n PersonMailer.deliver_registration_confirmation(@person)\n flash[:notice] = 'Registration Successful.'\n...
[ { "docid": "5752b1fac9a71a418a2c4f4a2317862b", "score": "0.6141427", "text": "def create\n #rg = RestGraph.new( :app_id => APP_ID, :secret => APP_SECRET)\n #parsed_request = rg.parse_signed_request!(params[\"signed_request\"])\n @person = Person.new(params[:person])\n\n respond_to do |format...
0f97885afb7e598c4e74d4123f2f6f7b
Revokes language privileges. You can specify multiple languages, roles and privileges all at once using Arrays for each of the desired parameters. See PostgreSQLRevokePrivilege for usage.
[ { "docid": "2dcb2e241ece8fee5a48bf440300f047", "score": "0.8532778", "text": "def revoke_language_privileges(languages, privileges, roles, options = {})\n execute PostgreSQLRevokePrivilege.new(self, :language, languages, privileges, roles, options).to_sql\n end", "title": "" } ]
[ { "docid": "e27d748f5e052b24865d562516ea4415", "score": "0.7192522", "text": "def revoke_privileges(username=false, database=false, *privileges)\n grant_or_revoke_privileges('REVOKE', username, database, privileges)\n end", "title": "" }, { "docid": "e27d748f5e052b24865d562516ea4415"...
09ae38fe20875b247f5b28f655e912ae
Get Hash containing translation between user event's name and CopyPeste command's names.
[ { "docid": "636be389646c7b4f2e8909690c3c9e71", "score": "0.0", "text": "def get_events\n {}\n end", "title": "" } ]
[ { "docid": "5ab24a052ad6c18905f9a385ae5611d6", "score": "0.57522374", "text": "def to_translation_hash()\n path = []\n path += self.scope.split(\".\") unless self.scope.nil?\n path << self.key\n return path.reverse.inject(self) {|before, step| { step => before}}\n end", "title": "" }, {...
90743f2beaed355856afa1febc06e420
DELETE /stations/1 DELETE /stations/1.json
[ { "docid": "5ed386c2f8f92594f0fa5817896cfa7f", "score": "0.7398002", "text": "def destroy\n @station.destroy\n respond_to do |format|\n format.html { redirect_to stations_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "4202b2b5efa2195fa37ed3189b81c281", "score": "0.7533339", "text": "def destroy\n @station = Station.find(params[:id])\n @station.destroy\n\n respond_to do |format|\n format.html { redirect_to stations_url }\n format.json { head :no_content }\n end\n end", "title": "...
25a54cd363936c1eca5164e3442c8552
Initializes the attributes as optional; sets default values in the options hash and merges the hash with inputs (if given). Uses those defaults as initialized attributes. Calls methods below with args as an argument.
[ { "docid": "c1d01a3e79e7a123bbdb4d3153e487c4", "score": "0.0", "text": "def initialize(args = {})\n options = {total_cost: 20, tip_percentage: 0.15, people: 2}\n @args = options.merge(args)\n @total_cost = args[:total_cost]\n tip_percent(@args)\n people_count(@args)\n neg_tip(@args)\n ...
[ { "docid": "1e251a6869f6fe12c450f7461308e7e7", "score": "0.75513494", "text": "def initialize(args = {})\n update_attributes(self.class::DEFAULTS.merge(args))\n end", "title": "" }, { "docid": "1e251a6869f6fe12c450f7461308e7e7", "score": "0.75513494", "text": "def initial...
72b9db1325c3633ecf2f6048970b8fa9
Your Solution Below def factorial(number) satisfy condition where 0! = 1 if number == 0 1 satisfy condition where number > 0 else make an array to store all numbers from 1 > number array = (1..number) start = 0 while start < number do start = start + 1 array.push(start) end make a new array to store products initialize...
[ { "docid": "433770c182590022a806a5be92e332d7", "score": "0.8213765", "text": "def factorial(number)\n#Return 1 for any number that is 0\nreturn 1 if number == 0 \n# This is where the new number will be store\ntotal = 1\n# Create a range and iterate through each number and then assign that number to tota...
[ { "docid": "412405cb337cd23f817368c764f6aff7", "score": "0.8678641", "text": "def factorial(number)\n if number >= 1000\n return final = 0\n elsif\n number >=1\n array = Array.new\n (number + 1).times do |i|\n array.push(i)\n end\n array.shift\n final = 1.0\n array.each { |i| final *= i }\n return ...
4436b8e5082115e48988466230d912b7
GET /functional_units/new GET /functional_units/new.xml
[ { "docid": "3984a3392fc6aa70ea1f4bc2b222f53e", "score": "0.8009145", "text": "def new\n @functional_unit = FunctionalUnit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @functional_unit }\n end\n end", "title": "" } ]
[ { "docid": "576b88a54f5c1a38f0a4ded66b8b25d3", "score": "0.77458364", "text": "def new\n @unit = Unit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @unit }\n end\n end", "title": "" }, { "docid": "6cb44d173fcaa91551aaae846ff843...
e8f614c0cad99066b46170b4664e0b56
Returns true if the given token matches the digest of attribute
[ { "docid": "b1dfbe2203b864eae60ec5a94da60f6e", "score": "0.7379837", "text": "def authenticated?(attribute, token)\n digest = send(\"#{attribute}_digest\")\n\n return false if digest.blank?\n\n BCrypt::Password.new(digest).is_password?(token)\n end", "title": "" } ]
[ { "docid": "66f10cbc54a80e5fdddad3e8c3e9f113", "score": "0.7859868", "text": "def authenticated?(attribute,token)# to convert string to varaiable and access as class instance var use self.send(string)\n att = self.send(\"#{attribute}_digest\")\n return false if att.nil?\n att == tok...
b78e32d5203c57256411d1c65f80d547
TODO full? calls get_empty_positions without caching is ineficient
[ { "docid": "f668f8e7836434450be154d9e37a9856", "score": "0.0", "text": "def add element\n return false if full?\n self[*get_empty_positions.sample] = element\n end", "title": "" } ]
[ { "docid": "46ef6cc39f40001f9cce7f99242ce30f", "score": "0.72152317", "text": "def empty_pos\n empty_pos = []\n board.grid.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n empty_pos << [row_i, col_i] if board[[row_i, col_i]].nil?\n end\n end\n empty_po...
d7951e095bcd3a98cda32350ec76dfb3
GET /teams GET /teams.json
[ { "docid": "2cc884a6c06cc9e10ea57eb3c43e2896", "score": "0.0", "text": "def index\n respond_to do |format|\n format.html { render 'shared/index'}\n format.js { render @filter.errors.empty? ? 'shared/index' : 'filter' }\n format.json { render json: @teams }\n end\n end", "title"...
[ { "docid": "162c5dfc6ecd3ee4a8ee6e08712576d9", "score": "0.81231946", "text": "def get_team_list ( page = 1 )\n get_api_resource \"#{@@api_base_url}teams/#{page}\"\n end", "title": "" }, { "docid": "e779ef9a2c033109dfb54a7612a3674c", "score": "0.8093222", "text": "def teams\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "18132ebd9cdda6ac4c442b4bac2bc98d", "score": "0.0", "text": "def member_params\n params.require(:member).permit(:numero, :nombre, :email, :fechaNacimiento, :presidente, :fiat_supernumerario, :fiat_notario_titular, :asamblea_aceptacion, :inicio_ejercicio, :revocacion_fiat, :motivo_revocac...
[ { "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...
430e63a4163e57e6c6a412d7e569f538
The rotation of the RectangleParticle in radians. For drawing methods you may want to use the angle property which gives the rotation in degrees from 0 to 360. Note that while the RectangleParticle can be rotated, it does not have angular velocity. In otherwords, during collisions, the rotation is not altered, and the ...
[ { "docid": "d63e2f81b4c77e1fe5fd90562e17980b", "score": "0.0", "text": "def radian=(rad)\n @radian = rad\n set_axes(rad)\n end", "title": "" } ]
[ { "docid": "33c25a486402ed0714b84569725fa6ef", "score": "0.69716316", "text": "def rotation\n\t\t\tquat = @chassis.body.rotation\n\t\t\treturn \"R: %0.1f P: %0.1f Y: %0.1f\" %\n\t\t\t\t[ quat.roll * RadToDeg, quat.pitch * RadToDeg, quat.yaw * RadToDeg ]\n\t\tend", "title": "" }, { "docid":...
a236424996016094e05f222b42f6fb3f
Make a simple ruby struct object from hash hierarchically, considering nested hash(es) (if applicable)
[ { "docid": "ae80b8cef26ee462c3d8a0cf9ec67c99", "score": "0.5861372", "text": "def to_struct(hsh)\n OpenStruct.new(\n hsh.transform_values { |v| v.is_a?(Hash) ? to_struct(v) : v }\n )\n end", "title": "" } ]
[ { "docid": "bb2177fde691074797456bd4f8e75336", "score": "0.7095018", "text": "def to_struct\n # Convert Hash to OpenStruct with recursive application to nested hashes\n JSON.parse(to_h.to_json, object_class: OpenStruct)\n end", "title": "" }, { "docid": "9d9f65cb7a17fbbee676124d...
831b69b5fe025782f0ce9c07ff31beb1
8 problem incorrect index values possibly something to do with the math
[ { "docid": "56d9f36f7ec8ac0f6fe81b2ceceeb09f", "score": "0.0", "text": "def nthterm(first, n, c)\n #first is an array\n # first = first num in array\n # n = index value we want\n # c = constant add between terms\n sequence = [] \n sequence.push(first)\n #puts \"#{sequence}\"\n next_number = 0\...
[ { "docid": "2ccd5b354a3fe566927c5d5c97adc45d", "score": "0.6194447", "text": "def test_007_indexing()\n TestVals.each do |sVal|\n lVal = sVal.length\n iVal_a_r = sVal.reverse.split(//).map { |bit| bit.to_i }\n bs = BitString.new(sVal)\n #\n # Let's try fetching ea...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "7ba4710429f036cc49c53ca1617f5006", "score": "0.0", "text": "def set_dimage\n @dimage = Dimage.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;...
b072c44d342a55672fab2ad90110f11b
DELETE /estados_civiles/1 DELETE /estados_civiles/1.xml
[ { "docid": "945e349f5bf74eee9a2e90af86f4a4be", "score": "0.7339474", "text": "def destroy\n @estados_civil = EstadosCivil.find(params[:id])\n @estados_civil.destroy\n\n respond_to do |format|\n format.html { redirect_to(estados_civiles_url) }\n format.xml { head :ok }\n end\n end...
[ { "docid": "8004cf86ba7c9db19ca15190b67e3a1a", "score": "0.6751016", "text": "def destroy\n @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end", "title": "" ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "279b0dae91647ee45f560e5aafd1de71", "score": "0.0", "text": "def set_vertical\n @vertical = Vertical.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...
a85ac25d5be3bb059091351d8c63a14d
POST /staffs POST /staffs.json
[ { "docid": "60e96f9c42902d10de3095dee3b5fec2", "score": "0.68538684", "text": "def create\r\n @staff = Staff.new(params[:staff])\r\n @staff.society_id = current_user.society_id\r\n\r\n respond_to do |format|\r\n if @staff.save\r\n track_activity @staff\r\n format.html { redirec...
[ { "docid": "1e53631b085ecfb277551479792dac63", "score": "0.75574535", "text": "def create\n @staff = Staff.new(staff_params)\n\n respond_to do |format|\n if @staff.save\n format.html { redirect_to staffs_path, notice: 'Staff was successfully created.' }\n format.json { render :i...
6ab8c6adfcf8150a68c4a81792746eac
Specifies that the fobjcarc flag should be added to the `OTHER_LD_FLAGS`. This is used as a workaround for a compiler bug with nonARC projects (see 142). This was originally done automatically but libtool as of Xcode 4.3.2 no longer seems to support the `fobjcarc` flag. Therefore it now has to be enabled explicitly usi...
[ { "docid": "36481c1a401c57f5bbff6ca35643565c", "score": "0.47560742", "text": "def set_arc_compatibility_flag!\n set_hash_value('set_arc_compatibility_flag', true)\n end", "title": "" } ]
[ { "docid": "4053aaf4e7602548affb3f4006770183", "score": "0.6380542", "text": "def ld_flags(app)\n flags = []\n flags << '-ObjC'\n flags += app.frameworks.collect{|f| \"-framework #{f}\"}\n flags.join(\" \")\n end", "title": "" }, { "docid": "621ae86e400106549c50b06d539...
bc1dfd4466383d0a951021cddc5357fb
Yields itself for use in the configuration block
[ { "docid": "3c8b90d8a6171a78b1a49c934e77ed8a", "score": "0.0", "text": "def configure\n yield self\n @client = Lexile::API::Client.new( self )\n end", "title": "" } ]
[ { "docid": "58eca46f06402e74116e9d8fecb48a13", "score": "0.7728512", "text": "def configure(*) # :yield: config\n yield config\n config\n end", "title": "" }, { "docid": "ad48cfbc5687603cda62d1d0a33d8b8e", "score": "0.7667587", "text": "def configure\n yield...
70278fec21210f097139a6bd9220bc2d
Sets the value of the flag. The new_value argument can be a String or the appropriate type for the flag (i.e. a Float for FloatFlag). If it's a String, an attempt will be made to convert to the correct type.
[ { "docid": "a65173b49f5f0cc4c97b096b975300cd", "score": "0.6878701", "text": "def value=(new_value)\n new_value = value_from_string(new_value) if new_value.is_a?(String)\n validate!(new_value)\n @is_explicit = true\n @value = new_value\n end", "title": "" } ]
[ { "docid": "4085c07ed370d40511809f52a6bf6334", "score": "0.6698483", "text": "def value=(new_value)\n ffi_delegate.set_value('%s', :string, new_value.to_s)\n end", "title": "" }, { "docid": "fc841fabfd6e839be2b8e1b80812ee02", "score": "0.65205854", "text": "def value=(new_val...
b5c9b7d5778503b8e3be132c18faa360
Upgrades the package, using yum upgrade [pkg].
[ { "docid": "1efb1db12178cee8a2abe8cfb37322af", "score": "0.7016156", "text": "def upgrade\n output = current_shell.exec \"yum upgrade -y #{@package_name}\"\n success = current_shell.last_exit_status.zero?\n\n return false if output.match(/#{@package_name} available, but not in...
[ { "docid": "0c06983f252a2b403d4c8d268a2e0b44", "score": "0.7534776", "text": "def update_rpm(pkg,yum_conf,verbose=false)\n updated_pkg = nil\n\n begin\n new_pkg_source = download_rpm(pkg, yum_conf)\n new_pkg = new_pkg_source.split('/').last\n\n ...
4e6dd35626bc31df13e752eb5bc40f56
GET /fg_bookings/1 GET /fg_bookings/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "ac8355d07e1353ac36659b08db8f2002", "score": "0.74110377", "text": "def index\n @bookings = Booking.all\n\n render json: @bookings\n end", "title": "" }, { "docid": "b5050fec6bce05bf345e907c218e23af", "score": "0.7274147", "text": "def index\n @bookings = Booking...
8c32a2b0d0d50edacac6290a423c17d8
returns in which Hitme step the current course is. Effectively returns the lowest step in any of the associated pics
[ { "docid": "8f5fa3b594a999b0118fec019335d047", "score": "0.7895535", "text": "def get_hitme_step\n a = c_pics.map { |p| p.step }.compact.min\n b = tutors.map { |t| t.pics.map { |p| p.step } }.flatten.compact.min\n [a, b].compact.min || 0\n end", "title": "" } ]
[ { "docid": "d91d386782e01a339f1cb2eab8331ce5", "score": "0.6932044", "text": "def current_step\n return (workflow - chosen_categories.collect(&:workflow_id) - session[:skipped_steps].to_a).first\n end", "title": "" }, { "docid": "e4e5d448d498f17acc868ca8807e1c0c", "score": "0.6474439...
0d0837a2636f5002f8189388bc725188
Public: Sets the value of the variable named by the argument for each data set that is part of the DataSetAccessor. key Variable name. value Value to set. Returns nothing.
[ { "docid": "9be1a8d4e4765e488395bff61c7185af", "score": "0.7191329", "text": "def []=(key, value)\n @data_sets.each do |ds|\n ds[key] = value if conjoined_keys_by_data_set[ds][key]\n end\n end", "title": "" } ]
[ { "docid": "99c4fe5585aa238809965f4e403898e3", "score": "0.6700236", "text": "def data_set_var key, val\n \t\tSdb[:data_var].filter(:dkey => key.to_s).update(:dval => val.to_s, :changed => Time.now)\n# \t\tdata_submit(:data_var, :fkv => argv, :opt => :update) unless argv.empty?\n\tend", "title": ""...
41d3b1b6574bf080749f2a59867e1e2f
if you have AAPL you could have mulitpls shares
[ { "docid": "98ef9cc3ba97205a3c924f2677630bad", "score": "0.0", "text": "def initialize portfolio_name\n @portfolio_name = portfolio_name\n @stocks = {}\n end", "title": "" } ]
[ { "docid": "c4d76da9a7c4112b349d1e0cde889183", "score": "0.7241272", "text": "def share_value(price, shares)\n\t\tprice * shares\n\tend", "title": "" }, { "docid": "8102ef0477c5aa9d4b31299059f07889", "score": "0.67606294", "text": "def national_issue_shares!\n return unless ...
a81bb3854f0f8b40e19742a20d95a0c3
POST /sip_users POST /sip_users.json
[ { "docid": "da9966caa9579a4d100fb7a89c4208a1", "score": "0.7232392", "text": "def create\n @sip_user = SipUser.new(params[:sip_user])\n\n respond_to do |format|\n if @sip_user.save\n format.html { redirect_to @sip_user, notice: 'Sip user was successfully created.' }\n format.jso...
[ { "docid": "16e20010e409d03d413e08e7de5bf4b3", "score": "0.71815664", "text": "def create\n @sip_user = SipUser.new(sip_user_params)\n\n respond_to do |format|\n if @sip_user.save\n format.html { redirect_to @sip_user, notice: 'Sip user was successfully created.' }\n format.json...
50fbb5c7b02f1e3589e90d68d551fb92
1. Grab keys 2. Convert to strings 3. Sort by length
[ { "docid": "43d936a71e8d677a20ee5fe6b9ec11c3", "score": "0.80865586", "text": "def key_sorter(hash)\n hash.keys.map(&:to_s).sort_by do |item|\n item.length\n end\nend", "title": "" } ]
[ { "docid": "5ab9d654d9410219765dea6d8f1fe66a", "score": "0.81579876", "text": "def key_sorter collection\n destination = Array.new\n collection.each_key {|key| destination << key.to_s }\n p destination.sort_by {|x| x.length}\nend", "title": "" }, { "docid": "ca18d2258758bdcaec20c744e8a7a3...
525f0fd91bfc0934e7e344ec48957a0b
list of all items
[ { "docid": "00a33922cb3baeb2274096777c7c68a6", "score": "0.0", "text": "def items\n @entries = Item.includes(:outlet, :item_group, :item_sub_group, :item_groups_kot_print, :bill_group).where(\"location_id=? #{@outlet_query}\", params[:location_id].to_i).paginate(:page => params[:page]) if request.xhr...
[ { "docid": "649605fe18a3a2f52b00a7a40857cfd2", "score": "0.85674804", "text": "def all\n @items\n end", "title": "" }, { "docid": "e021d186cff68857602e0c35869db98e", "score": "0.84667593", "text": "def all_items\r\n list = Array.new\r\n items.each{ |item| list.push(...
3ce0b70042e17a6540b82236b1a1f588
get the width of progress bar
[ { "docid": "88a65fd5308a7177b64e849f02209329", "score": "0.6803826", "text": "def width_of_progress(score)\n\n\t\tcase score\n\t\twhen 0\n\t\t\tper = '0'\n\t\twhen 1\n\t\t\tper = '20%'\n\t\twhen 2\n\t\t\tper = '40%'\n\t\twhen 3\n\t\t\tper = '60%'\n\t\twhen 4\n\t\t\tper = '80%'\n\t\twhen 5\n\t\t\tper = '...
[ { "docid": "91578255381aa83732bdb3f4ea1e7154", "score": "0.72098917", "text": "def mp_width\n max_width = bar_max_width\n width = [actor.mmp * mp_divisor(max_width), max_width].min\n width = [width, bar_max_width - (10 + anger_width)].min if actor.charge_gauge?\n width\n end", "title": ...
7c114037cd62819090f6bcd38ef0b142
GET /otg_clients GET /otg_clients.json
[ { "docid": "f793648355eb728a85e67ee94e8feb67", "score": "0.73905903", "text": "def index\n @otg_clients = OtgClient.all\n end", "title": "" } ]
[ { "docid": "11367d36e4c90c8a0de89176b3b870a4", "score": "0.74873054", "text": "def index\n @clients = current_user.clients\n render json: @clients\n end", "title": "" }, { "docid": "4b4a0e2bbce752b46efd315cc60731f8", "score": "0.73241895", "text": "def list_clients(json_payloa...
ef30f7b469fb841210944b1b5e13280b
PATCH/PUT /event_dates/1 PATCH/PUT /event_dates/1.json
[ { "docid": "6de6b6f5da3845ff03833c7f750b322f", "score": "0.69403017", "text": "def update\n respond_to do |format|\n if @event_date.update(event_date_params)\n format.html { redirect_to @event_date, notice: 'Event date was successfully updated.' }\n format.json { render :show, stat...
[ { "docid": "9892279268b5c31ca353369aa8b8550d", "score": "0.7512703", "text": "def update\n if !params[:event][\"s_date\"].nil?\n dd = params[:event][\"s_date\"].split(\"/\")[0]\n mm = params[:event][\"s_date\"].split(\"/\")[1]\n yy = params[:event][\"s_date\"].split(\"/\")[2]\n p...
c9ca950c31ff55634530c7309b953a24
returns total possible penalty
[ { "docid": "41757df631c2a2b03398dff2537db737", "score": "0.6513783", "text": "def total_penalty(start_date = nil, end_date = nil)\n #count children penalty\n count = 0\n self.children.each do |child|\n count = count + child.total_penalty(start_date, end_date)\n end\n\n # if no range ...
[ { "docid": "50d69776e07ff0b8a855db2f7e9683f5", "score": "0.79145736", "text": "def penalty_total\n self.added_penalties.each{|added_penalty| self.calculate_penalties if added_penalty.count_generated_at < MyDate::today}\n if self.added_penalties == []\n return\n elsif self.added_penalties[0...
f787df07d6df210b7147d537ad0b47c7
Check if a node contains a supported embedded element
[ { "docid": "568a3c60f9b34e712cecbfcb9dd6ae14", "score": "0.6993437", "text": "def supported?(node)\n !find_parser(node.inner_text).nil?\n end", "title": "" } ]
[ { "docid": "646dba301c8d94f453b0226be1d2d329", "score": "0.7321467", "text": "def embed_node?\n (node_name == 'param' && parent_name == 'object') ||\n %w(embed iframe).include?(node_name)\n end", "title": "" }, { "docid": "bd7de842e30a4836247d61ec304af707", "sc...
c067487cf5b5d4bd68c409d2bf78aaa1
Returns the directory to be used when reading yml files
[ { "docid": "ed8ea2d119e50fc4a1d447008bfe5163", "score": "0.78072363", "text": "def yml_directory\n return @yml_directory if @yml_directory\n return default_directory if self.respond_to? :default_directory\n nil\n end", "title": "" } ]
[ { "docid": "c4caf3748462406405728443a6e125f5", "score": "0.82010967", "text": "def yml_directory\n @data_magic_yml_directory ||= 'config'\n end", "title": "" }, { "docid": "77ad859e91a54ae2846a4012d10ed483", "score": "0.7429634", "text": "def yaml_path\n \"#{user_d...
7d1411574a0705371f1cc613584dced4
GET /hotels/1 GET /hotels/1.json
[ { "docid": "31ae08a76455768d17c48f6546709499", "score": "0.0", "text": "def show\n @favorite = @hotel.users.where(id: current_user.id).exists?\n end", "title": "" } ]
[ { "docid": "c95d715ccd95d8394ab0f6f5fc380290", "score": "0.7580548", "text": "def show\n @hotel = Hotel.find(params[:id])\n\n render json: @hotel\n end", "title": "" }, { "docid": "0b663d2aedcc77dd0f88646e31ff9d0b", "score": "0.7388729", "text": "def index\n @hotels = Hotel...
1b98d3515686f8f39628952eefc94967
Returns true if the scheduler is stopped, false otherwise.
[ { "docid": "1d0880050df48e31038b88ba6710b8c8", "score": "0.79755694", "text": "def stopped?\n @state == :stopped\n end", "title": "" } ]
[ { "docid": "a66b9ed47957518d45b242f7c0241e51", "score": "0.81965554", "text": "def stopped?\n\t\treturn ! self.running?\n\tend", "title": "" }, { "docid": "26aaa14e78a3d97b73e8fa2e261b1ee7", "score": "0.7997365", "text": "def stopped?\n @stopped\n end", "title": "...
7cc1824a244712ff03a5cc97233c3f43
Not DEBUG and not INFO. Just printed to the output.
[ { "docid": "946e0df3d0a0875e812ce040f0feac48", "score": "0.0", "text": "def high_level_msg(message, *p)\n print(format(message, *p)) if log_object.level > 1\n nil\n end", "title": "" } ]
[ { "docid": "f806f8c423fb12347a81fa630b0bdf51", "score": "0.7690677", "text": "def debug_output; end", "title": "" }, { "docid": "f806f8c423fb12347a81fa630b0bdf51", "score": "0.7690677", "text": "def debug_output; end", "title": "" }, { "docid": "f806f8c423fb12347a81fa630b...
19f79653213b4105e27026959cb0db27
GET /body_mass_percentiles/new GET /body_mass_percentiles/new.xml
[ { "docid": "3f4995044a27637a36f856fae38af740", "score": "0.77810365", "text": "def new\n @body_mass_percentile = BodyMassPercentile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @body_mass_percentile }\n end\n end", "title": "" } ]
[ { "docid": "b9b1e59b18bb99c0a2aee59183eada62", "score": "0.69487846", "text": "def new\n @height_percentile = HeightPercentile.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @height_percentile }\n end\n end", "title": "" }, { "d...