query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
11e60aef271f7544f41fd4e2432165ae
message for last error for server, "" if all is ok
[ { "docid": "1d8631d1b768f04566258d67234cc96d", "score": "0.79778737", "text": "def error_message\n @@state[@server] ? @@state[@server][:message] : \"\"\n end", "title": "" } ]
[ { "docid": "d7d7e09486914f7cbeb6bce92c023d56", "score": "0.7381839", "text": "def error_message\n \"after #{@message_count} requests on #{@connection.object_id}\"\n end", "title": "" }, { "docid": "c29117ceeddb5609474ab27a11afc09d", "score": "0.73419684", "text": "def error m...
0b23f6aedad7a2983bec19df7ec8d24e
instance method new_song(name, genre) creates a new song song belongs to the artist
[ { "docid": "a6ac7eea86e1e23e767a787314b932e2", "score": "0.85600895", "text": "def new_song(name, genre)\n song = Song.new(name, self, genre)\n end", "title": "" } ]
[ { "docid": "e30763ba27ec51276171c8cce88519f1", "score": "0.89630747", "text": "def new_song(name, genre)\n #creating a new song whose artist is the current instance of artist\n Song.new(name, self, genre)\n end", "title": "" }, { "docid": "bb405fc5de627bf26c3cc00311ba5ccc", ...
151692cf33805796c1a04ec8c60d4cdc
Store basic information about collegs to YAML. TODO: Try optimizing. It's probably not necessary to write to disk after each iteration over the loop.
[ { "docid": "8a24e9612ad2f7b80f206abd91c56825", "score": "0.0", "text": "def update_colleges_cache(response)\n log 'Cache expired. Storing index of colleges...'\n\n collected_colleges = JSON.parse(response.body).each_with_object({}) do |college_data, colleges|\n colleges[college_data[0]] = {\n...
[ { "docid": "958f040caa3496890961f5e5e653e532", "score": "0.5904953", "text": "def store_data()\n\t\tFile.open(@location, 'w') do |f|\n\t\t\tf.write(@bugs.to_yaml)\n\t\tend\n\tend", "title": "" }, { "docid": "2761b9b596d2ba8edd8edac00f9bd69b", "score": "0.5740503", "text": "def genera...
d15b3f31b1ebbe26cee5c6c42b0ca381
Go to the repo's root block must be given
[ { "docid": "ea6ecc8fbae739998a27dc674eebddd8", "score": "0.5202582", "text": "def cdroot(&blk)\n return unless blk\n cdroot! &blk\n end", "title": "" } ]
[ { "docid": "3d96f796ba6a38628037340e59f4cc23", "score": "0.6561638", "text": "def go_to_repository identifier\n Dir.chdir repository_path identifier\nend", "title": "" }, { "docid": "a0c334c6b7f1491d57b2ab31759ec68b", "score": "0.61434644", "text": "def cd(repo)\n end", "title"...
c5b9c8ad94f7fef87943fb88f8fd44c3
Info about the given item for the given customer. Merges the plan item info with the subscription item info. item_code must be provided if the customer is on a plan with more than one item. code must be provided if this response contains more than one customer.
[ { "docid": "b1ff791fbc5716da99ac5ae63de76892", "score": "0.75352705", "text": "def customer_item(item_code = nil, code = nil)\n sub_item = retrieve_item(customer_subscription(code), :items, item_code)\n plan_item = retrieve_item(customer_plan(code), :items, item_code)\n return ni...
[ { "docid": "4b1a33b0bffbfcec59bc6b79f5794cf7", "score": "0.6467776", "text": "def plan_item(item_code = nil, code = nil)\n retrieve_item(plan(code), :items, item_code)\n end", "title": "" }, { "docid": "67080ca6d4278e33d01dc660b3f604ad", "score": "0.5790488", "text": "def upd...
6da6ee5b9db90ccc697650ce6793bfe5
generate Elements::Containers::Paragraph from paragraph XML node
[ { "docid": "7abbaf75f45cad5e858c36e95e9ca852", "score": "0.8204968", "text": "def parse_paragraph_from(p_node)\n Elements::Containers::Paragraph.new(p_node, document_properties)\n end", "title": "" } ]
[ { "docid": "8efc00d75e1018ad8ab09653bd033509", "score": "0.83047056", "text": "def parse_paragraph_from(p_node)\r\n Elements::Containers::Paragraph.new(p_node)\r\n end", "title": "" }, { "docid": "a45c7e16d68a8dfb9a4ea9126f88b44d", "score": "0.74304134", "text": "def new_para...
52b700ff339fc702391d960f71105ee5
POST /reach_out_to_customers POST /reach_out_to_customers.json
[ { "docid": "da697c8ad9a22057b4c5f102513d2483", "score": "0.52425885", "text": "def create\n @reach_out_to_customer = ReachOutToCustomer.new(reach_out_to_customer_params)\n\n if @reach_out_to_customer.save\n\t\tMarketingEmail.send_marketing_email(@reach_out_to_customer).deliver\n redirect_to...
[ { "docid": "d69f26f13eb0d3491bc26f7073dd6af8", "score": "0.7201744", "text": "def destroy\n @reach_out_to_customer.destroy\n respond_to do |format|\n format.html { redirect_to reach_out_to_customers_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "...
603a868b07c93dba57f0de53d1b2211b
Base name for the index. Uses the default value inferred from the class name unless redefined.
[ { "docid": "39fa48a502e2ef0957675e1ca3cba65e", "score": "0.8550393", "text": "def base_name\n @base_name ||= name.sub(/Index\\z/, '').demodulize.underscore if name\n raise UndefinedIndex if @base_name.blank?\n\n @base_name\n end", "title": "" } ]
[ { "docid": "9ce600ca11652d9419f0bb1407cb5997", "score": "0.8552334", "text": "def index_base_name\n self.class.const_get :INDEX_BASE_NAME\n #INDEX_BASE_NAME\n end", "title": "" }, { "docid": "5a66963373f3d744e6b1de887a7fce77", "score": "0.7667918", "text": "def ind...
782f0a83ac31ab0a21c8f4b3c3bbc24c
Push out the Android notification
[ { "docid": "be0f17520a73832308e66b009cacf731", "score": "0.6359028", "text": "def push_android(notification, sandbox = false)\n build_push(notification, \"android\", sandbox)\n end", "title": "" } ]
[ { "docid": "68d78d715563d18274e1ddeae989de7f", "score": "0.7471185", "text": "def publish\n if token.present?\n n = Rpush::Gcm::Notification.new\n n.app = Rpush::Gcm::App.find_by_name('Taiwan')\n n.registration_ids = [token]\n n.data = { command_type: 'reset',\n ap...
b241aa22ad4d60a4dcccbae0862fe271
FIXME: Omitting the host should work, thanks to the host_and_port_ rules, but currently returns a bogus ':host=>[]' node.
[ { "docid": "2008b5affb5258f673b37bf699942a2b", "score": "0.0", "text": "def test_mysql_blank_host\n\t assert_equal(\n\t\t {:dbtype=>\"mysql\", :database=>\"redradish_confluence\"},\n\t\t AtlConfig::JDBCURL.parse(\"jdbc:mysql:///redradish_confluence\"),\n\t )\n end", "title": "" } ]
[ { "docid": "9f74565cc18a71fc3b972514ed8f46b6", "score": "0.6812876", "text": "def get_hostnames\n\tnodeshost = @parsed[\"nodes\"]\n\treturn nodeshost\nend", "title": "" }, { "docid": "c401add7bab19d8bc166f4545cee7ab9", "score": "0.6723615", "text": "def host\n @host ||= @node['h...
a997c907d1c33ba3bebfed84ea9f22a9
Actions Read Actions Returns contacts associated with the account (params[:from_account]) case watcher.
[ { "docid": "0421d4bdb347f89aca1f6e868cc731de", "score": "0.6250903", "text": "def account\n # find the account we are grabing contacts from\n if id = params[:from_account]\n @selected_account = Sfaccount.find(id)\n end\n # super users can only add themselves.\n if current_contact.por...
[ { "docid": "c028655029580be3e132d45fccf1f558", "score": "0.6719312", "text": "def contacts(id, limit:, offset: 0, account: nil)\n path = \"filter/#{id}/contacts\"\n get account, path, limit: limit, offset: offset\n end", "title": "" }, { "docid": "311bc2ff46fb228819f0e3d38...
89c3aac58232ea564251dd76e79b28bc
Public: Calculates a month withdraws quantity for an asset. asset the asset name year the year to check month the month to check Returns a double.
[ { "docid": "f542573c0d0ad51cc3a872c7e7287962", "score": "0.69980365", "text": "def asset_month_output_quantity(asset, year, month)\n start_date = Date.civil(year, month, 1)\n end_date = Date.civil(year, month, -1)\n\n db.execute(\n \"SELECT SUM(quantity/100.0) FROM events WHERE ass...
[ { "docid": "7943f9a3fd33a6ac5eee92a9302ccfb1", "score": "0.7439668", "text": "def asset_month_purchase_balance(asset, year, month)\n date = Date.civil(year, month, -1)\n\n return unless date <= self.class.current_month_last_day\n\n sum = db.execute(\n \"SELECT SUM(quantity/100.0) F...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6bec2a90c8e82db8b91a452566073278", "score": "0.0", "text": "def civilschedulesubject_params\n params.require(:civilschedulesubject).permit(:civil_subject_id, :lecture1_id, :lecture2_id, :lecture3_id, :day, :classtime_id, :studiyear_id, :classroom_id, :count)\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...
4f7deb1cbab4ad45d78c023de7a49d77
Returns the HTML text for the current object. Indentation and end tag options are optional, based on the settings of the classes themselves. If +formatting+ is false, then formatting and whitespace is not applied and you will get a single, very long string. Note that case is still honored.
[ { "docid": "61f425901f9470512e1896f952cd29a1", "score": "0.7087183", "text": "def html(formatting = true)\n if HTML::Table.html_case == 'upper'\n @html_begin.upcase!\n @html_end.upcase!\n end\n\n ilevel = 0\n\n if formatting && self.class.respond_to?(:indent...
[ { "docid": "7bcd3e0ac2029154fda7cbb8794a599c", "score": "0.61964935", "text": "def format_text\n \"<#{tag}>#{text}</#{tag}>\"\n end", "title": "" }, { "docid": "7a6b39b26119dad7638f93643ba697a5", "score": "0.61613506", "text": "def format\n @text\n end", ...
0ee2ec9b9c240115304b526012a90ec9
Process text with Markdown.
[ { "docid": "389029a1273db9c087ce5da07b2c483a", "score": "0.6877126", "text": "def markdown(text)\n BlueCloth::new(text).to_html.html_safe\n end", "title": "" } ]
[ { "docid": "cd5b1c71573b9b944471fd30e37ba7d6", "score": "0.8547698", "text": "def process_markdown(text)\n Markdown.new(text, :smart, :tables).to_html\n end", "title": "" }, { "docid": "3f8e88edfff839883d23cba0d9ab2270", "score": "0.81755084", "text": "def parse_text_as_markdown(...
008d1b4bcdcb5a66d6f3759b3d21cbee
Sets the version property value. The version number of the taskDefinition. New records are pushed when we add support for new parameters.Supports $filter(ge, gt, le, lt, eq, ne) and $orderby.
[ { "docid": "be66a75eb49c2712f2221c0f3fc27028", "score": "0.712668", "text": "def version=(value)\n @version = value\n end", "title": "" } ]
[ { "docid": "ce63b532d3c9a0ee99aa6c226439a5d1", "score": "0.70846325", "text": "def version=(v)\n @version = v\n end", "title": "" }, { "docid": "1996f1bdc6169b484a989783d4af11b2", "score": "0.6983347", "text": "def version=(version)\n @version = version\n end", "title...
8ad255b204ddd291f32b8b009ed40615
PATCH/PUT /featured_images/1 PATCH/PUT /featured_images/1.json
[ { "docid": "9a9b657ad84778770e4cc3020884a3e9", "score": "0.7329461", "text": "def update\n respond_to do |format|\n if @featured_image.update(featured_image_params)\n format.html { redirect_to @featured_image, notice: 'Featured image was successfully updated.' }\n format.json { ren...
[ { "docid": "fb1c7f5e61132665ea7ea3ddb0990057", "score": "0.6816391", "text": "def update\n respond_to do |format|\n if @featured.update(featured_params)\n format.html { redirect_to @featured, notice: 'Featured was successfully updated.' }\n format.json { render :show, status: :ok, ...
c09c1dafbb13291907a0d42b22588de9
Quite simple, just walk the edges checking to see any of the angles are 90 degrees. A bit of a grunt at 2.3sec, I could probably improve things by caching hits and checking The correct way to do it relates to the fact that point P, if it has a right angle, will have a particular slope, relative to 0,0 P. We check for t...
[ { "docid": "c94001c6df35ee52f3c6fed2d5949804", "score": "0.51722085", "text": "def problem_91\n size = 50\n hits = 0\n hit = Hash.new\n (1..size).each do |x|\n x2 = x**2\n (1..size).each do |y|\n y2 = y**2\n (0..x).each do |xd|\n xd2 = xd**2\n x_xd2 = (x - xd)**2\n ...
[ { "docid": "b91a03a9f11cf081a9d4af92083d1e44", "score": "0.5769239", "text": "def check_orthogonally(x, y)\n won = false\n # up\n index = 1\n while index < 4 && (y + index).between?(1, @ROWS) && !check_slot(x,y + index).nil?\n index += 1\n won = true if index == 4\n end\n\n #...
6060a019e1c77ffbc1f4182758a4f509
Check for Staff Role Type
[ { "docid": "c176ce9bd4d8165c068b62c423718040", "score": "0.79009897", "text": "def staff?\n self.role.role_type == \"staff\"\n end", "title": "" } ]
[ { "docid": "4ebfe877cbbddc8f3bb9402409b6f4d0", "score": "0.7342099", "text": "def is_admin_or_staff?\n [\"staff_admin\", \"staff_user\"].include?(role_id)\n end", "title": "" }, { "docid": "4ebfe877cbbddc8f3bb9402409b6f4d0", "score": "0.7342099", "text": "def is_admin_or_staff?\n...
ba53586262bf69dd0489a052003be09b
find and return the corresponding checkout, which is on the same day as checkin and occurs after checkin_time assuming that only at most one checkin and one checkout each day
[ { "docid": "4db4bbbd6eb39b3731d68cec0a4a4f98", "score": "0.74230593", "text": "def correspond_checkout\n\t\tcheckin_time = self.checkin_time\n\t\tcheckout = Checkout.where(\"mentor_id = :mentor_id and school_id = :school_id\n and checkout_time > :checkin_time\n and checkout...
[ { "docid": "0c636275275d1fe496d6cceb588f4dd3", "score": "0.7327179", "text": "def correspond_checkin\n\t\tcheckout_time = self.checkout_time\n\t\tcheckin = Checkin.where(\"mentor_id = :mentor_id and school_id = :school_id\n and checkin_time <= :checkout_time\n and checkin_t...
9126677e191ee63ead22ae4ed1ccf56a
Make sure that we cleaning up before exiting...
[ { "docid": "fb61ce8b75af845a39583e259bf5308b", "score": "0.6743487", "text": "def cleanUp\n if @running != nil\n info(\"Cleaning: Disconnect from the PubSub server\")\n RMCommunicator.instance.stop\n # info(\"Cleaning: Kill all previously started Applications\")\n # ExecApp.killAl...
[ { "docid": "1072735002f428f2e5a73b0247935609", "score": "0.8333766", "text": "def cleanup!; end", "title": "" }, { "docid": "1072735002f428f2e5a73b0247935609", "score": "0.8333766", "text": "def cleanup!; end", "title": "" }, { "docid": "aeb9c5682d24b55b73bb73877a593c19",...
be7f4e167bc60886fced2cf87ae80346
Generates a hash value for this object.
[ { "docid": "140d500ef6087bd356252b75df49324b", "score": "0.0", "text": "def hash\n super +\n @from.hash +\n @to.hash\n end", "title": "" } ]
[ { "docid": "39b15da071a5d18e77c7674f9a946414", "score": "0.7402406", "text": "def hash\n @hash || calculate_hash!\n end", "title": "" }, { "docid": "dcd2d2a7b8b5351f882af58dc9101795", "score": "0.73919034", "text": "def hash\n @hash ||= _calculate_hash\n end", "title"...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "5bd6de31cd2f7d5084e6698273fc9591", "score": "0.0", "text": "def set_alarma\n @alarma = Alarma.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...
ef3cb44d7bac97c6b80443f9b57834fa
DELETE /post_books/1 DELETE /post_books/1.xml
[ { "docid": "4514659b5ae7da667795ac384fe448cc", "score": "0.0", "text": "def destroy\n @post_book = PostBook.find(params[:id])\n @post_book.post.favorites.destroy_all\n del_post_wall(@post_book)\n @post_book.destroy\n \n redirect_to my_post_user_url(current_user)\n end", "title": "...
[ { "docid": "d4408600141e3d2496df086a60bd9f4f", "score": "0.7046362", "text": "def destroy\n @book.destroy\n\n respond_to do |format|\n format.html { redirect_to(books_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, { "docid": "d4408600141e3d2496df086a60bd9f...
666f8aa45427ad3e3f094458f43a1ced
Dump each table (that is not partitioned) as a separate file.
[ { "docid": "93b199dfe0ca8720b76363dba354016c", "score": "0.73129046", "text": "def dump_non_partitioned_tables(db_name:)\n #Do a full dump of the tables which aren't partitioned.\n @tables.each do |table, partitions|\n if partitions.length == 0 #i.e. is a table that isn't partitioned.\n comman...
[ { "docid": "9a9efe83f2eca468bf341e5155dd6b7d", "score": "0.7653649", "text": "def tables_to_dump\n only_tables.map do |table|\n \"--table='#{table}'\"\n end.join(\"\\s\")\n end", "title": "" }, { "docid": "60d8ceaa2ce4b8ee21856801ecebaeff", "score": "0.7624875...
d6bd88e74525f61cd511201e54a0b4ee
sum_from_file Write a method that reads in a file of integers, one per line, and sums them. Skip the line if it begins with a "".
[ { "docid": "714bf8d21a048b7b84093e8be87ce446", "score": "0.8430754", "text": "def sum_from_file(file)\n nums = File.readlines(file)\n .reject {|n| n[0] = \"#\"}\n .map(&:to_i)\n nums.reduce(:+)\nend", "title": "" } ]
[ { "docid": "a1a1c0008c025d5229f4f566bfe1fb32", "score": "0.7446791", "text": "def sum_nums_app\n\tputs \"ERROR: Please give a valid filename as an argument.\" if ARGV[0] == nil\n\tFile.readlines(ARGV[0]).each do |line|\n\t\tline.gsub!(\"\\n\", \"\") if line.include? \"\\n\"\n\t\tputs reduce_nums(line.sp...
0495ebe52fb064006f039bd713b88ee4
Updates the specified attributes associated with the given storage account. This operation requires the storage/set/update permission.
[ { "docid": "a2fa58ac42d234284a0e892729ef7a94", "score": "0.6009577", "text": "def update_storage_account_with_http_info(storage_account_name, parameters, api_version, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: StorageApi.update_storage_accoun...
[ { "docid": "0ea5c6e5251f0a5c674236f371ac93fa", "score": "0.69175684", "text": "def update(options = {})\n update_attributes_from_hash options\n options[:storage_name] = options.delete :name if options[:name]\n Profitbricks.request :update_storage, options.merge(:storage_id => self.id)\n ...
2d1160400867d3a13fc5a4e3c39b2e10
Below Page for trash Complaints and sorting logic for it.
[ { "docid": "0c0316f50c5445bdabfec1794525dccc", "score": "0.72241384", "text": "def trash\n if params[:sort_by] == \"score\"\n @complaints = @city.complaints.trash.sort_by { |c| c.score }\n @complaints.reverse!\n render action: :index\n elsif params[:sort_by] == \"date\"\n ...
[ { "docid": "fde0459139c27278241db0dfab9c9072", "score": "0.59137875", "text": "def displaytrash\n @convs = current_user.mailbox.trash(:include => { :receipts => :notification })\n # @trashconvs = @convs.sort_by! {|c| (c.receipts(current_user).where('mailbox_type = ? and receiver_id = ?','trash',cu...
7bf91ac497773a08b91af61b64e855d0
Creates a new Wiki object from database connection _wikidb_. For description of _options_ see Wiki.open
[ { "docid": "3c016cfa76a2dbfa11ddd73e7c7b0b61", "score": "0.67927843", "text": "def initialize(wikidb, options={})\n @version = options[:version] || 1.8\n @dburl = wikidb.to_s\n @name = options[:name] || 'wiki'\n @language = options[:language] || 'en'\n @ips = options[:ips]\n ...
[ { "docid": "ccf8ac455e2a2779b80897a4d261c962", "score": "0.5896055", "text": "def new\n @wiki = Wiki.new\n end", "title": "" }, { "docid": "1f64a14c37b6b81c5bf12ee3f086e1b2", "score": "0.5620886", "text": "def predefined_wiki\n\n # For connection to a WikkaWiki-Database use this...
8d73ed0189a72aa9e6ab0042823de05c
series is an instance of Series and also gives it a relationship
[ { "docid": "1d536f317d52b68f0f50d6fb8e3e3902", "score": "0.0", "text": "def initialize(series, season_number)\n raise \"season must be an integer\" unless season_number.is_a? Integer\n raise \"series must be a Series instance\" unless series.is_a? StarTrekCLI::Series\n @series = series\n @se...
[ { "docid": "4c91e0df37a1292fb855442a15b1a5f4", "score": "0.7376187", "text": "def series\n Series.find_by id: self.series_id\n end", "title": "" }, { "docid": "c51efea3c1bcc40cfa6d6c05769b871b", "score": "0.6542273", "text": "def with_series(series)\n all_with_series.find_...
ede7774f6fc0aff92e30c244a695bcf0
Solves the equation with the variable's given value.
[ { "docid": "775ef0ead90ec64939c5917a2042f9a0", "score": "0.7670032", "text": "def solve(value)\n if working_equation.present? && machine_name.present?\n eval(working_equation, Struct.new(machine_name.to_sym).new(Float(value)).instance_eval{binding})\n end\n end", "title": "" } ...
[ { "docid": "3425f1653049e2b6f2146388bae851d5", "score": "0.6150148", "text": "def solve_for_y(x)\n field.square_roots equation_right_hand_side x\n end", "title": "" }, { "docid": "968ece7a148286c0f8d21afa938bf79d", "score": "0.61277026", "text": "def solve(vector)\n @b = v...
ff19651faf54df891360c76649a55d5f
Returns the value of attribute iseq. source://syntax_tree//lib/syntax_tree/yarv/instruction_sequence.rb483
[ { "docid": "f632a9c6e64727b407efb053eb05218b", "score": "0.6344771", "text": "def iseq; end", "title": "" } ]
[ { "docid": "a2b5d6ec07ed1b4de05d041427a2d0e5", "score": "0.67036927", "text": "def iseq\n ::ObjectSpace.each_object(::RubyVM::InstructionSequence).find {|iseq|\n iseq.inspect =~ /^<RubyVM::InstructionSequence:#{self.name}@/ }\n end", "title": "" }, { "docid": "c8e16d4e4ab596a2...
07d88068f9d25ecfde3200f133f10417
equal index date AND age date
[ { "docid": "bb81078b3ce0feb321376be768042ce9", "score": "0.5324595", "text": "def too_old?(date, age)\n return false unless age && date\n DateTime.parse(date).to_time.to_i <= age.to_i ? true : false\n end", "title": "" } ]
[ { "docid": "741e99100dc8be883e737b21d68cdf26", "score": "0.65810835", "text": "def status_age_index\n Date.today - self.status_date.to_date\n end", "title": "" }, { "docid": "7552473f10ee96f8ee413d8b48fa85cb", "score": "0.6216204", "text": "def index_date_info(solr_doc)\n da...
f0c8ebc080c48c2f260ffb43b1834e56
GET /products/1 GET /products/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "b4b28cd3d622f32a8398a02f689e4baf", "score": "0.7935576", "text": "def get_product\n product = Product.find(params[:product_id])\n json_response(product)\n end", "title": "" }, { "docid": "a06eb43eff1d37c3950104b8608b37f8", "score": "0.7777575", "text": "def show\n ...
534645043ef2ee962a354c22b45f88db
PATCH/PUT /cat_gifs/1 PATCH/PUT /cat_gifs/1.json
[ { "docid": "a3185a419a2bf4d052fc1e38555e38db", "score": "0.77024573", "text": "def update\n respond_to do |format|\n if @cat_gif.update(cat_gif_params)\n format.html { redirect_to @cat_gif, notice: 'Cat gif was successfully updated.' }\n format.json { render :show, status: :ok, loc...
[ { "docid": "204051d8bfec42e5f722fb1b6cad4787", "score": "0.709665", "text": "def update\n @gif = Gif.find(params[:id])\n\n respond_to do |format|\n if @gif.update_attributes(params[:gif])\n format.html { redirect_to @gif, :notice => 'Gif was successfully updated.' }\n format.jso...
f3acd12de2c1dcb629bac4fdd68cdceb
Internal: Returns the finder proc, or the default finder strategy.
[ { "docid": "048ade296c0b51d379ce1070b9b81803", "score": "0.76170903", "text": "def finder\n options[:finder] ||= default_finder\n end", "title": "" } ]
[ { "docid": "77e773efefa1d4219cbcc2e373292861", "score": "0.7064872", "text": "def default_finder\n options[:finder_attribute] ||= :name\n ->(name) { model.find_by(finder_attribute => name) }\n end", "title": "" }, { "docid": "83b319b476d8164fa0e719ef27ce8c7a", "score": "0.67...
b9a80b3f7520d295920a83f6e44e4e08
newspaper is one of: eluniversal, excelsior, lajornada, milenio, reforma
[ { "docid": "8ccd309d22d11416aab5fd182cee8985", "score": "0.4803617", "text": "def get_image_url(newspaper, date)\n date_path = get_date_path(date)\n\n return \"https://tar.mx/periodicos-mexico/dl/#{date_path}/#{newspaper}_t.jpg\"\nend", "title": "" } ]
[ { "docid": "de7932eb9d7a652899d628f0d13b51c2", "score": "0.72404546", "text": "def newspaper\n 'Newspaper' if record.leader[7] == 's' && record['008'] && record['008'].value[21] == 'n'\n end", "title": "" }, { "docid": "31fa7dcb88f49ad832a30988fd806f0f", "score": "0.6458842",...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "f0508db31068074ff6adec6f712f8d99", "score": "0.0", "text": "def set_comic\n @comic = Comic.includes(:chapters).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...
4d7730b7890463d609e478df16752bb0
Use for create short alias for namespace.method m1 [String] method for alias m2 [String] namespace.method class SomeClass include Namespace extend Namespace namespace :some_namespace do def some_method .... 'hi' end end nalias 'my_method', 'some_namespace.some_method' end Then SomeClass.new.my_method => 'hi'
[ { "docid": "7accf265fa07818e1f14babf86c1d3ee", "score": "0.8169045", "text": "def nalias(m1, m2)\n %w(define_method define_singleton_method).each do |method|\n send(method, m1) do\n namespace, method = m2.split('.')\n self.send(namespace).send(method)\n end\n end\n end", ...
[ { "docid": "ae829b32b559b12d81acb2a51c06b8b3", "score": "0.7177384", "text": "def alias_method(sym1,sym2) end", "title": "" }, { "docid": "343f4c6abedb532a4cc52ccb14c379ca", "score": "0.70855665", "text": "def define_alias_methods(member_name, options); end", "title": "" }, {...
2ef40b3a0716334c9da474d71e08e574
Update custom field in account
[ { "docid": "9d73d6170a35618279427929f2bc61de", "score": "0.6107529", "text": "def update_field(id, options = {})\n connection.put(\"fields/#{id}\", options)\n end", "title": "" } ]
[ { "docid": "72aa0e79cc7c5b7c9d63ebbbff0de21b", "score": "0.718218", "text": "def update\n # find and update the account\n end", "title": "" }, { "docid": "c973b77554bee4c1e0a6f99b14b11594", "score": "0.7044544", "text": "def update\n @custom_field = CustomField.find(params...
fac5181b14c98d94cc9d208c4c319102
Available options: accessory accessoryType. Valid values: :none, :disclosure, :disclosureindicator, :detail, :detaildisclosurebutton, :checkmark or any UITableViewCellAccessory constant text textLabel.text content detail detailTextLabel.text content selection selectionStyle
[ { "docid": "6f45255c228f33eff85246f763c90d36", "score": "0.44029975", "text": "def sugarcube_cell_factory(cell_identifier, cell_style, options)\n cell_style = cell_style.uitablecellstyle if cell_style.respond_to?(:uitablecellstyle)\n cell = UITableViewCell.alloc.initWithStyle(cell_style, reuse...
[ { "docid": "091dca79a14f4031836c7563e077a2ae", "score": "0.56957626", "text": "def tableView(table_view, cellForRowAtIndexPath: index_path)\n cell = table_view.dequeueReusableCellWithIdentifier(CELL_IDENTIFIER)\n cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator\n cell.textLabel....
3272e4ab80dde924b9fb2f4831832f53
PATCH Change users position by changig their lots value
[ { "docid": "f0f3ad749ed520ee696b80037fd1a4da", "score": "0.5124572", "text": "def change_users\n user_1 = User.find(params[:user_id])\n user_2 = User.where(email: params[:user_2_email]).first\n\n if user_1.change_position_with user_2\n redirect_to :back, notice: \"Usuários alternados com s...
[ { "docid": "0cf6b07d0e1f72ea310fa034f3ab7338", "score": "0.626309", "text": "def updatePosition\n if params[:pos]\n \t@user = FacebookAccount.find_by_fb_id( current_user.identifier ).user\n @user.positionInGame = params[:pos]\n respond_to do |format|\n if @user.save\n\t\t\t for...
5aad5969e4de1486f46824bac2ffe479
Returns a string, eg. 'Bath and North East Somerset'.
[ { "docid": "de0a63eea9fe292dec29f8d551838553", "score": "0.0", "text": "def operator_name\n compliance_data[:operator_name]\n end", "title": "" } ]
[ { "docid": "be0d8470ec2db3af7e5907ed6c7d3681", "score": "0.6517825", "text": "def to_s\n spoonerize.join(\" \")\n end", "title": "" }, { "docid": "9025c920873164bdae71aa4553ff3735", "score": "0.63545746", "text": "def to_s\n text = 'Once upon a time ' + @sentences[0].to_s\...
812a55868a554d5d6b038dfdc8ad2f5a
Test for image tags
[ { "docid": "4fd6a5cf453283c352c9975a3b8b16cc", "score": "0.0", "text": "def test_image\n assert(line('![](img/royal-baby)').image?)\n assert(line('![Royal Baby](img/royal-baby)').image?)\n assert(line('![Royal Baby](img/royal-baby \"The Royal Baby\")').image?)\n\n assert(!line('![]()').image...
[ { "docid": "e8dbad4f9d97d375431262088673622f", "score": "0.74815136", "text": "def scrape_tag_image tag\n pics = @data.css(tag)\n if @data.css('img/@src').count > 0 && pics != nil\n pics.each do |i|\n puts pics.css('img/@src')\n end\n else\n puts 'no ' + tag ...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "65b64a99f28660a203ab724d52114fda", "score": "0.0", "text": "def snack_params\n params.require(:snacks).permit(:name, :user_id, :brand, :category, :origin, :price, :img_url)\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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "40da15d65e82240d008d36741d376131", "score": "0.0", "text": "def set_canal\n @canal = Canal.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.6031952", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015048", "text": "def...
abe4f9490de612db3f0b53f6b1b39144
This method generates an array of all moves that can be made after the current move.
[ { "docid": "f9454792622ac467eb2d87f2315ef99f", "score": "0.0", "text": "def children\n childs = []\n (0..2).each do |x|\n (0..2).each do |y|\n position = [x, y]\n next unless board.empty?(position)\n temp_board = board.dup\n temp_board[position] = self.next_mover_m...
[ { "docid": "ab6b87d439d2ac15bdfbf3aebcff6da0", "score": "0.7375318", "text": "def generate_moves\n @delta.each do |step|\n (1..7).each do |i|\n new_pos = [@pos[0] + step[0] * i, @pos[1] + step[1] * i]\n if valid_coord?(new_pos)\n @move_list << new_pos\n break if @...
2a895ed390ee1f0557ca9725ded42d63
Roll back a transaction.
[ { "docid": "e5122239b9eea692d1e5d864d8440791", "score": "0.7695435", "text": "def rollback transaction\n rb_req = Google::Datastore::V1::RollbackRequest.new(\n project_id: project,\n transaction: transaction\n )\n\n execute { datastore.rollback rb_req }\n...
[ { "docid": "995799e0a1ce06076d940be02658f63f", "score": "0.8181903", "text": "def rollback_db_transaction\n hdl = execute(\"ROLLBACK\")\n end", "title": "" }, { "docid": "464acfe0639caf60c71a02147d5f9a7d", "score": "0.786907", "text": "def rollback_db_transaction\n ...
7a749f5bda42926e6f0d55f58e3ec556
=begin Creates and returns the access token hash. =end
[ { "docid": "4292be41b5bfcadbe0ac464ccb515bba", "score": "0.70297825", "text": "def generate_access_token\n self.access_token ||= self.create_access_token\n save && access_token\n end", "title": "" } ]
[ { "docid": "f12192bb73bdba30fe6e68845d77cfad", "score": "0.8001376", "text": "def create_access_token\n hash = nil\n Songkick::OAuth2.generate_id do |token|\n hash = Songkick::OAuth2.hashify(token) \n end\n return hash\n end", "title": "" }, { "docid": "8efffd154933...
a6871d1aebb98f799d42bbbd7a5f0e4f
Disconnect all the connections identified by +identifiers+ on this server or any others via RemoteConnections. source://actioncable//lib/action_cable/server/base.rb37
[ { "docid": "1a08f476d98f8d57d42f2eaa4cc28313", "score": "0.7848264", "text": "def disconnect(identifiers); end", "title": "" } ]
[ { "docid": "cf73174b5a7a4cbf127ba35c02538a95", "score": "0.8887781", "text": "def disconnect(identifiers)\n remote_connections.where(identifiers).disconnect\n end", "title": "" }, { "docid": "967440537119956b548d8f2965390272", "score": "0.688834", "text": "def disconnect!...
b719a876a42f74d9b0aae133da383ea8
Gets event info Returns a Hash of the event's info (or an error).
[ { "docid": "7fd6b1efeb12610e8822438e1f70820f", "score": "0.7266812", "text": "def info\n if @info.nil?\n filter = \"id = '#{@id}'\"\n @info = $database.all_with_filter(\"events\", filter)[0].to_h\n else\n @info\n end\n end", "title": "" } ]
[ { "docid": "f989eebf9c270470a5679298ffc53de1", "score": "0.74584967", "text": "def event_info(event_id)\n @graph.get_object(event_id, fields: Event_fields)\n end", "title": "" }, { "docid": "9cd9dcef205a3c843761f84cd68d94a6", "score": "0.73446137", "text": "def info(event)\n ...
523f54fe30b9cc8d89bd6d229618da71
Create layout for tactic cursor
[ { "docid": "d1e021baf8f9793145d3072d928be3b6", "score": "0.5866775", "text": "def create_tactic_cursor(instance)\n @tactic_cursor = Sprite_TacticCursor.new(@viewport1, instance)\n end", "title": "" } ]
[ { "docid": "d044984778dc6f7a2f2925d7e40d364c", "score": "0.5731895", "text": "def cursor_reposition\n\tb_row = @t_row\n\tc_col = @t_col\n\tt_row, t_col = term_pos(@controller.c_row, @controller.c_col)\n\tdh = t_row - @t_row\n \tdw = t_col - @t_col\n \t@t_row = t_row\n \t@t_col = t_col\n\tif @t_row < @OF...
acdb357c4fcd6cb49ac8a3fb6c6a0901
Returns a user's status feed.
[ { "docid": "f4e2186a1d83f78d850b0d4ba3dc2592", "score": "0.0", "text": "def feed\n\t\tfollowing_ids = \"SELECT followed_id FROM relationships\n\t\tWHERE follower_id = :user_id\"\n\t\tPost.where(\"user_id IN (#{following_ids})\n\t\t\tOR user_id = :user_id\", user_id: id)\n\tend", "title": "" } ]
[ { "docid": "c00991c110ff912a526f3a64b94921ae", "score": "0.6737085", "text": "def feed\n get '/users/self/feed', auth_params\n end", "title": "" }, { "docid": "80ddaf16d37f9f9b6de2c0e5dfd0e9ca", "score": "0.66459346", "text": "def user_live_feed(user_id, params = {})\n ...
5e1f1dc399b71eafc0160d94508468da
update instance table row (ajax call)
[ { "docid": "c0dbe04801567eaa565ac95f812fb50f", "score": "0.0", "text": "def update_item\n begin\n @l7policy = services.loadbalancing.find_l7policy(params[:id])\n respond_to do |format|\n format.js do\n @l7policy if @l7policy\n end\n...
[ { "docid": "8a96f2ef56ad87369d8a0b1445325603", "score": "0.7132806", "text": "def row_update\n __debug_route\n render_json editing_update(**current_params)\n rescue => error\n post_response(error)\n end", "title": "" }, { "docid": "c36f3ac6cb87038bfd855d5e2082c2bb", "score": "...
712a41a51ccba3c170742f94f5ffcd3c
may be better to prepopulate database so can do enroll.attendances instead of having to manually checking the existence of each week..... but that is that more work? have to seed the database everytime someone creates an enroll, destroy taken care of mentor_show.html.erb very awkward careuse when manually assigning sta...
[ { "docid": "4f24b374cc1b75b41c6d8ffb890e7796", "score": "0.0", "text": "def mentor_index \n end", "title": "" } ]
[ { "docid": "6465be1bb28ee7926c44899c22f267af", "score": "0.6540348", "text": "def deem_as_absent(absence_type)\n person = self.person\n absence = person.absences.find_by_absence_date(self.presence_date)\n absence_type_id = AbsenceType.find_by_type_id_and_company_id(absence_type, person.company_...
9cd606ff24f747b726e1d0d0cfbe49b5
Avoids writing to datastore['METHOD'] directly
[ { "docid": "5e4e1191395ace669d9a81abc561b892", "score": "0.6461023", "text": "def http_method\n @http_method || datastore['METHOD']\n end", "title": "" } ]
[ { "docid": "e63939c30d3db5ea0f0399d694539cbf", "score": "0.63499427", "text": "def update\n params[:method] = __method__\n create\n end", "title": "" }, { "docid": "f33f2659d33767c819895c40e7cf5aa3", "score": "0.6222337", "text": "def method=(meth)\n meth = meth.to_s\n ...
9fee9c142599fe40ad6654de94912d73
Deletes a previously created Resource Record Sets resource
[ { "docid": "82a06d44ece3e3f297183b9fd4c24b0a", "score": "0.0", "text": "def destroy(async = true)\n requires :name, :type, :ttl, :rrdatas\n\n data = service.create_change(zone.id, [], [resource_record_set_format])\n change = Fog::DNS::Google::Changes\n .new(:...
[ { "docid": "d546cde85f43565884ccba0916d3b5f3", "score": "0.7253747", "text": "def destroy\n @resourceset = Resourceset.find(params[:id])\n @resourceset.destroy\n\n respond_to do |format|\n format.html { redirect_to resourcesets_url }\n format.json { head :no_content }\n end\n end"...
bbf9bd3b8a71cef1f89332e62c9a7cab
Find the active code host for the provider_credential/user combination or instantiate one if none are available
[ { "docid": "c57882c2b82bc2f1cfe14566598ee220", "score": "0.62935853", "text": "def code_hosting_service(provider_credential: nil)\n code_hosting_service_key = active_code_hosting_service_key(provider_credential: provider_credential)\n code_hosting_service = active_code_hosting_services[code_ho...
[ { "docid": "177fb527b7763b07a250805097ec3b49", "score": "0.636861", "text": "def code_hosting_service(provider_credential: nil)\n code_hosting_service_key = active_code_hosting_service_key(provider_credential: provider_credential)\n code_hosting_service = self.active_code_hosting_services[code...
a692c266c8390bb11325b30e43398a08
A plus sign used as crosshairs to help the player with aiming
[ { "docid": "32a7ca04211a518efd8d570f577532b2", "score": "0.0", "text": "def initCrossHairs\n guiNode.detachAllChildren()\n guiFont = assetManager.loadFont('Interface/Fonts/Default.fnt')\n ch = BitmapText.new(guiFont, false)\n ch.setSize(guiFont.getCharSet().getRenderedSize() * 2)\n ch.set...
[ { "docid": "b6c142435d89fc140cfb4d085a803b49", "score": "0.58457685", "text": "def place_sign(player_turn, button)\n case player_turn\n when \"O\"\n @game_board.board[button] = \"O\"\n when \"X\"\n @game_board.board[button] = \"X\"\n end\n end", "title": "" }, { "docid...
ba38fb517c9535e80abc465e718dfa55
Initializes a new sphere with the given parameters.
[ { "docid": "8139c91cf425fc7068c53397c7277263", "score": "0.49596074", "text": "def initialize(center: Point3.origin,\n radius: 1.0,\n color: Color.new(rand, rand, rand))\n fail ArgumentError, \"Not a valid radius (#{r} for 0+)\" if radius < 0\n\n @c = center...
[ { "docid": "97eeab382a0eb62ca3a80f9440b1998e", "score": "0.70452446", "text": "def set_sphere\n @sphere = Sphere.find(params[:id])\n end", "title": "" }, { "docid": "f65ed0c344feca6193aadc6a629bee0b", "score": "0.6675876", "text": "def sphere_params\n params.require(:sph...
c22cd7cc1ad06a4e1033230f6b308af5
Returns true if d is a Date
[ { "docid": "bb5f40460f31d6e84747f69aa539bf89", "score": "0.9293149", "text": "def is_date d\r\n return false unless d.instance_of? Date\r\n return true\r\n end", "title": "" } ]
[ { "docid": "812a1ea86b7563f422baf09d9e3717e1", "score": "0.7747414", "text": "def is_date?\n begin\n Date.parse(self)\n\n return true\n rescue\n return false\n end\n end", "title": "" }, { "docid": "8e0f2a49dc2c953426031c778afa22fb", "score": "0.76358074", "t...
f309fce98f3621ce5a9c824c63d0d9bf
GET /template_sublayouts/1 GET /template_sublayouts/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "65ab54365ea8c817150e66fe9aaee2ce", "score": "0.7861846", "text": "def index\n @template_sublayouts = TemplateSublayout.all\n end", "title": "" }, { "docid": "0ed4edd7b43c92e1a011ffbd9f2a34a5", "score": "0.7143003", "text": "def set_template_sublayout\n @template_...
ddeb177fbf5e1ad29c4e067243501717
Empties the event Queue, then the thread sleeps. Gets woken up by the Manager.
[ { "docid": "1dea285aa60044b2acc6962e3cf6da79", "score": "0.5973422", "text": "def run\n return unless @mutex.try_lock\n until @event_queue.empty? or not @running\n if @event_queue.length > 1\n log \"#{@event_queue} commands in queue\", Logger::Medium\n end\n handle_event(@eve...
[ { "docid": "e7b8731961a9de8a2624f0e0fa69d73a", "score": "0.65002996", "text": "def flush()\n return if @loop.nil?\n @waiting_thread = Thread.current\n begin\n @loop.wakeup()\n rescue\n # ignore\n end\n while busy?\n sleep(2.0)\n end\n @waiting...
fa482cac69b6192b2f5456246b67058b
before_filter :check_if_already_made_guaranteed_bid, :only => [:bid]
[ { "docid": "4a334241fbc426e2cdaa830ef7e790fe", "score": "0.6331255", "text": "def bid\n @auction = Auction.find(params[:auction_id])\n @reward = Reward.find(params[:reward_id])\n @hours_already_bid = @reward.hours_already_bid_by(current_user)\n @hours_entry = HoursEntry.new\n @bid = Bid.n...
[ { "docid": "78b43d48d4dc3cec9fd25e7fa283acd4", "score": "0.65182626", "text": "def set_bid\n @bid = @item.bids.find_by(id: params[:id])\n render json: { errors: { detail: \"Bid not found\" } }, status: :unauthorized and return unless @bid\n end", "title": "" }, { "docid": "8d820...
efdf0cf181e0f9c8b9375aa7517645fc
Return a list of the model files to annotate. If we have command line arguments, they're assumed to the path of model files from root dir. Otherwise we take all the model files in the model_dir directory. source://annotate//lib/annotate/annotate_models.rb530
[ { "docid": "bc9a950dea6a9e85bc148011de69beef", "score": "0.62218434", "text": "def get_model_files(options); end", "title": "" } ]
[ { "docid": "d57c97de3947b9c44af25bc07b952b47", "score": "0.6160934", "text": "def model_files\n @model_files ||= Dir[\"#{RAILS_ROOT}/app/models/*.rb\"]\n end", "title": "" }, { "docid": "df7c91fb170ce394aac094112565da07", "score": "0.6117472", "text": "def model_files\n ...
247217c156a4e2e48736f89a71d34be2
Wikipedia uses relative links for everything we care about and has lots of other links we don't care about. Return only the subset of desired wiki pages
[ { "docid": "927af70888fba0d81d764bf6d80c555e", "score": "0.68644404", "text": "def extract_desired_links(links)\n links.reduce([]) do |subset, page| \n subset << page if whitelisted_page? page\n subset\n end\n end", "title": "" } ]
[ { "docid": "4f81a9efbfbc4ad673b15baf5f3ee3b7", "score": "0.7097097", "text": "def extractLinks(page)\n\tbase_wiki_url = \"https://en.wikipedia.org\"\n\tlinks = page.search(\"//a\")\n\tlinks = links.map{|item| item[\"href\"]}\n\n\t#Appending with base_wiki_page to make it full fledged page.\n\tlinks = li...
2e830bacb1cad801dc405ee6cc4a78f3
DELETE /hubs/1 DELETE /hubs/1.xml
[ { "docid": "932615932bc7a00f96f6aa996cf21790", "score": "0.79478776", "text": "def destroy\n @hub = Hub.find(params[:id])\n @hub.destroy\n\n respond_to do |format|\n format.html { redirect_to(hubs_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "0d41372b26c639e8f41ba08b40fd548b", "score": "0.7254671", "text": "def destroy\n @hub.destroy\n respond_to do |format|\n format.html { redirect_to hubs_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "b403125449e7a8961f051701602...
8d6cac96ef1638571691eb46cf46b36f
Sets the attribute permitted_html_tags
[ { "docid": "0cc959888d0a5f5360fdba7d2c1687ea", "score": "0.81545043", "text": "def permitted_html_tags=(_arg0); end", "title": "" } ]
[ { "docid": "d1b1639aceae672fb87f32d22470f3e3", "score": "0.7744256", "text": "def permitted_html_tags; end", "title": "" }, { "docid": "a561bcad15854dba0654ff9106bc1f87", "score": "0.66451573", "text": "def sanitized_allowed_tags=(tags); end", "title": "" }, { "docid": "a...
9f15759fe42bc6fa9688b89968841a41
Returns true if pile can move onto another pile. Solitaire pattern must be maintained.
[ { "docid": "e82efe0fdeee39f1eb90a5e990d97bd1", "score": "0.7411507", "text": "def valid_move_onto?(pile)\n if self.foundation? && !self.empty? && !pile.empty? &&\n (self.bottom_rank == pile.top_rank - 1) && (self.bottom_color != pile.top_color)\n return true\n elsif self.foundation? ...
[ { "docid": "cdb9d604ef7367ce752ad5f87fbcfd2b", "score": "0.7146286", "text": "def can_move_to\n\t\tmoves = [[2,1],[2,-1],[1,2],[1,-2],[-1,2],[-1,-2],[-2,1],[-2,-1]]\n\t\tmoves.each do |x,y|\n\t\t\tmove_x = @position[0] + x\n\t\t\tmove_y = @position[1] + y\n\t\t\tif valid_move(move_x) and valid_move(move...
4698abe561c70d232111f2159d98c5fc
UNIT TESTS FOR METHOD mine(pros) the only test needed is to assert this function runs for 5 iterations
[ { "docid": "176d5e65ece096e187526ad7984c01e3", "score": "0.6356677", "text": "def test_mine_iterations\r\n sim = GoldRushSim.new(1, 1)\r\n fakeRand = Minitest::Mock.new (\"fake prng\")\r\n \tdef fakeRand.rand(range); 1; end\r\n \tmap = Map.new\r\n\r\n \tfakePros = Minitest::Mock.new(\"fake pros...
[ { "docid": "c3083a401d03bb211ecc97a3b74a220b", "score": "0.651076", "text": "def _test_pages_available\n #execute this code x number of times\n @custom_number_of_users.times do |i|\n puts 'Running tests for user #'+i.to_s\n # assert_section nil\n end\n end", "title": "...
6e19160b6120e051de7e83353bbf1c06
POST /alunos POST /alunos.xml
[ { "docid": "eb226bcfcee70fa52ed1cac73624da29", "score": "0.55595183", "text": "def create\n @aluno = Aluno.new(params[:aluno])\n\n respond_to do |format|\n if @aluno.save\n format.html { redirect_to(@aluno, :notice => 'Aluno was successfully created.') }\n format.xml { render :...
[ { "docid": "c11b16b2f0e61872732a94f5ce2d6d88", "score": "0.64205384", "text": "def add_new_aluno(aluno)\n\tpost_response = eval(@agent.post(ALUNOS_URL))\nend", "title": "" }, { "docid": "adbd4063f9795c23205a346f6dfd3f22", "score": "0.60666096", "text": "def post uri, args = {}; Requ...
5d010788952d79eae0514e3487b36d4b
all the helper methods below written for homework2 added helper methods (aka secret police/gods of all that is rails)
[ { "docid": "468adfd0c309879cdf7f107060c6e999", "score": "0.0", "text": "def was_highlighted?(column)\n \tif @ordered_by==column\n 'hilite'\n else\n ''\n end\n end", "title": "" } ]
[ { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.7821249", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.7821249", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", ...
371c718287eb0675d53b68ca3f95e354
the application controller deals with all of our other contollers like a boss lets make a shortcut called current user
[ { "docid": "a707d2aacb4c6cf65765f45b1dbb2584", "score": "0.58561873", "text": "def current_user\n\tif session[:user_id].present?\n\t\tUser.find(session[:user_id])\t\n\tend\nend", "title": "" } ]
[ { "docid": "12ee5a306fa94d6c08708388e886012d", "score": "0.6520752", "text": "def user; end", "title": "" }, { "docid": "12ee5a306fa94d6c08708388e886012d", "score": "0.6520752", "text": "def user; end", "title": "" }, { "docid": "aa040efd8235b4dbf4b5eccffbcffd19", "sc...
b15a85d06535798d41c38c4f4456811b
Transfer reverse_transfercan reverse a transfer between two accounts AND it can only reverse executed transfers
[ { "docid": "4d6374cd0039e5271bd8f6d5deebb800", "score": "0.6814616", "text": "def reverse_transfer\n if valid? && receiver.balance > amount && self.status == \"complete\" \n receiver.balance -= amount\n sender.balance += amount\n self.status = \"reversed\"\n else\n reject_tran...
[ { "docid": "37f35b12519883da73a45549a903666a", "score": "0.67728513", "text": "def reverse_transfer\n if valid? && sender.balance > amount && self.status == \"complete\"\n receiver.balance -= amount\n sender.balance += amount\n self.status = \"reversed\"\n else\n reject_transfer\n end\nen...
0a9f5385d948758ab2fab13d96707a45
Gets number of months to borrow a book.
[ { "docid": "b897cd2771a2d575315286a306c4a79b", "score": "0.59890646", "text": "def get_num_months(param)\n if param == '3m'\n 3\n elsif param == '6m'\n 6\n elsif param == '1y'\n 12\n else\n 1\n end\n end", "title": "" } ]
[ { "docid": "5f47d7470fa965443085723aa6d2ea6d", "score": "0.6722765", "text": "def get_number_of_month(m)\n (1..is_leap?[adjust_set_month(m)]).to_a\n end", "title": "" }, { "docid": "42e707e925aa72ea0906eaf1ba9508e1", "score": "0.668649", "text": "def get_number_of_month\n (1.....
29328f97275e11f4a6a923766fe5718e
Generates a layout of given `title`.
[ { "docid": "701df51e1b50475a67f4c361cfbd01ee", "score": "0.6658588", "text": "def generate_layout(title, theme_root)\n layout_config_loc = theme_root + '/layouts/layouts.json'\n title_naming = LiveEditor::CLI::naming_for(title)\n\n say \"Creating a new Live E...
[ { "docid": "3e9024b186553496a369de74f09debb9", "score": "0.6360343", "text": "def layout_part_title node, title, opts = {}\n puts 'Processing node.id:' + node.id\n puts 'Processing title:' + title\n num_part, title = title.split ':', 2\n move_down 150\n typeset_text num_part + \"\\n\" + t...
cfe19eff5ed89adb8cc0daeacf3fc4ab
Returns javascript which applies current filters. The parameter is a WiceGrid instance. Use it with +button_to_function+ to create your Submit button.
[ { "docid": "7428431c4dcbc93f4154d6d290780be3", "score": "0.62203145", "text": "def submit_grid_javascript(grid)\n unless grid.kind_of? WiceGrid\n raise WiceGridArgumentError.new(\"submit_grid_javascript: the parameter must be a WiceGrid instance.\")\n end \n \"#{grid.name}.pro...
[ { "docid": "a0be9c98c5e15987e61c99018d4b82f2", "score": "0.6636938", "text": "def leet_filter_button(s)\n button_tag(s, onclick: \"alert('this abandoned code needs to be refactored to pull out the name of the filter frmo this and pass it to the new function I made...');leetFilter.filterAllBut(this);\...
12f5259014effe60ab08387e18297afe
Return node in cache corresponding to key
[ { "docid": "49bad88e9b5f06993f483cde3a1f8d4f", "score": "0.78339064", "text": "def get_cache(key)\n treecache.fetch(key)\n end", "title": "" } ]
[ { "docid": "492318411ddf332a55ef46028c1a9f46", "score": "0.79480654", "text": "def fetch_node_nt(key)\n res = get_cache(key)\n return res if res\n canonicalize(key, fetch_node_from_db(key))\n end", "title": "" }, { "docid": "31f96c42781f861a54a6b3aa604a1674", "score": "...
9dd4e871b3c790837aa9670fc18d9a6a
DELETE /recordings/1 DELETE /recordings/1.json
[ { "docid": "9329c9cff49b43df193976690cd34c53", "score": "0.73349464", "text": "def destroy\n @recording = Recording.find(params[:id])\n @recording.destroy\n\n respond_to do |format|\n format.html { redirect_to recordings_url }\n end\n end", "title": "" } ]
[ { "docid": "80c6b784facabb45da76b5a18bdfda89", "score": "0.7272935", "text": "def delete_recording(record_id)\n bbb_server.delete_recordings(record_id)\n end", "title": "" }, { "docid": "03c954ccb7ff9318d4d87c733f596737", "score": "0.71881944", "text": "def destroy\n @recordin...
44915634ee8c74e19a9f9951e9435c65
commented out now that we're disabling 'grade_new' completely =begin def test_grader_cant_be_assigned_to_report_already_assigned_to_another_grader login_as :sean post :grade_new, :id => reports(:bobby_report_graded_by_sean).id assert_response :success assert_tag :content => /.That report already has a grader assigned t...
[ { "docid": "0e47eac824d7c391304b9b3349a6e4dc", "score": "0.71544456", "text": "def test_grader_that_has_active_report_cant_take_on_another_report\n login_as :sean\n post :auto_assign\n assert_redirected_to :controller => :home, :action=>:index\n end", "title": "" } ]
[ { "docid": "8a8a08df370c91ad52385e154a538a57", "score": "0.683306", "text": "def test_ensure_mail_wasnt_sent_when_grader_takes_on_report\n login_as :donna\n post :auto_assign\n assert_equal(0, @emails.size)\n\n=begin\n\n email = @emails.first\n assert_match(/A grader has picked up your re...
ccd872508d584f569600d27bbe6261ce
load and set whm API key from local file
[ { "docid": "ec8688e4db482bef8281dad1c06a82d4", "score": "0.73193353", "text": "def load_api_key(file_path = '/root/.accesshash')\n begin\n config.access_hash = File.open(file_path).read.gsub!(/[\\n\\s\\t]+/s, '')\n rescue SystemCallError => e\n error \"Tried to load API K...
[ { "docid": "d3610a9821b4ce49c0d0913b28be8fc1", "score": "0.6924768", "text": "def load_api_key\n _get_setting('api_key') || ''\n end", "title": "" }, { "docid": "0ec7cb9d8f761f43bff2287f6acd11ce", "score": "0.66971195", "text": "def api_key; \"055a1100-a84d-4064-84d7-bce46f7b80c8...
49926a0e51059022b19af2b300651c21
POST /posts POST /posts.json
[ { "docid": "51f2a203857a028dbae014f6f7870bdb", "score": "0.0", "text": "def create\n upload_ret = JSON.parse(Base64.urlsafe_decode64(params[:upload_ret]))\n @post = Post.new(\n title: upload_ret['title'],\n filename: upload_ret['fname'],\n qiniu_hash: upload_ret['hash'],\n crea...
[ { "docid": "92c50133f120b4421970b36c5df90a46", "score": "0.739982", "text": "def create\n @post = Post.new(post_params)\n @post.save\n render json: @post\n end", "title": "" }, { "docid": "abed7ddc94f10bcd0f62efa65c40c143", "score": "0.7250132", "text": "def create\n pos...
0afecfd71b574669c86871b872f37c9d
scala i turni di tutte le skill dell'eroe
[ { "docid": "e7c96b662aeaa3cc8f04f3918aac3873", "score": "0.0", "text": "def scale_all\n $game_party.members.each { |member| member.scale_turn }\n end", "title": "" } ]
[ { "docid": "f92943f6e338bcd52765d6307fd4429b", "score": "0.66540575", "text": "def pick_skill; end", "title": "" }, { "docid": "dd20131e38ec32df83bd19a952412c52", "score": "0.6528161", "text": "def practise(skill, sec,c =nil)\n # skill = query_skill(skillname)\n skillna...
e6d254294a00fd738e28029996c855d9
POST /hospitals POST /hospitals.json
[ { "docid": "6fb8e0699f848e8ae254d0088421087a", "score": "0.55963844", "text": "def create\nauthorize! :creat, Ward\n @hospital = Hospital.new(hospital_params)\n\n respond_to do |format|\n if @hospital.save\n format.html { redirect_to @hospital, notice: 'Hospital was successfully create...
[ { "docid": "ae01e27582dd07b38342b637fca501f7", "score": "0.70361704", "text": "def create\n @hospital = Hospital.new(hospital_params)\n\n respond_to do |format|\n if @hospital.save\n format.html { redirect_to @hospital, notice: 'Hospital added.' }\n format.json { render :show, s...
d8d71e80512cda79b0311ef582343ebc
GET /spents GET /spents.json
[ { "docid": "8f612049da6b0c93470eb0a8e0b4b1fa", "score": "0.5679899", "text": "def index\n @spents = Spent.all.order(date: :desc, expense_id: :asc).paginate(page: params[:page], per_page: 10)\n end", "title": "" } ]
[ { "docid": "fb447590913cc6d4a8e285b4c9c6e815", "score": "0.6541271", "text": "def index\n @spots = Spot.all\n render json: @spots\n end", "title": "" }, { "docid": "bab7585929c61033062190bc016a03fc", "score": "0.6312942", "text": "def spots\n @spots = Spot.find_all_by_disci...
e52fb63321fb698d79ba556993b8b9c6
the wireless card supports injection
[ { "docid": "bfaad67e75fa41abc39e8d8788083e60", "score": "0.62685436", "text": "def supports_injection?\n\n\tinj_works = false\n\t\n\tif !system(\"aireplay-ng -9 mon0 > inj_test.txt\")\n\t\tsystem(\"clear\")\n\t\tputs \"Sorry, either your wireless is disabled or\"\n\t\tputs \"your wireless card does not ...
[ { "docid": "4c66bb16c2e0e85ec1f4a91d7f7d507b", "score": "0.6224509", "text": "def card_detection\n end", "title": "" }, { "docid": "86b5a261d4d802e6386d9b0d16a4a49b", "score": "0.6184163", "text": "def disabled_feature\n\tatm = AtmMachine.new(100, PinValidator)\n\tcard = CreditCard....
013a431179656b710a52483d01106640
UNIT TEST FOR METHOD pop Removes and returns the first value in the stack Value removed from stack and returned, stack cut down
[ { "docid": "d38cfe2e17268f121d379dbda23dea47", "score": "0.85265714", "text": "def test_pop_value\n @stack.push(7)\n @stack.push(8)\n assert_equal 7, @stack.pop\n assert_equal 8, @stack.peek\n end", "title": "" } ]
[ { "docid": "940e88722b20d42bfd8aad227b291766", "score": "0.85096765", "text": "def pop()\n evaluate_min_pop()\n stack.pop\n end", "title": "" }, { "docid": "e658a1677872f90afd58ef1dc4146e46", "score": "0.8495272", "text": "def pop()\n stack.shift\n end", ...
07222c606014266d8b646ff1bca15d6c
will return all color information for the current controller, built into a quick hash
[ { "docid": "2250ed66442214e9cda635e002b734d1", "score": "0.7148149", "text": "def get_colors\n\t\t@colors = {}\n\t\tif not ActiveRecord::Base.connection.table_exists? 'colors'\n\t\t\treturn\n\t\tend\n colors = Color.where(:inki_model_name => model_class.to_s)\n\t\tcolors.each do |color|\n\t\t\t@color...
[ { "docid": "ec93c732903251a170a05668ea59b885", "score": "0.74419886", "text": "def colors\n color_codes.keys\n end", "title": "" }, { "docid": "ec93c732903251a170a05668ea59b885", "score": "0.74419886", "text": "def colors\n color_codes.keys\n end", "title": "" }...
7fe9914170f968d4fdb23984b42f6904
reduce 127 omitted reduce 128 omitted
[ { "docid": "11d10c983a3641877869e954df55afbc", "score": "0.0", "text": "def _reduce_129(val, _values, result)\n id, = val\n result = s(:lit, id.to_sym).line lexer.lineno\n\n result\nend", "title": "" } ]
[ { "docid": "c4e9dce3d490a41b6c4bd1ad602336c9", "score": "0.7182728", "text": "def _reduce_127(val, _values, result); end", "title": "" }, { "docid": "c4e9dce3d490a41b6c4bd1ad602336c9", "score": "0.7182728", "text": "def _reduce_127(val, _values, result); end", "title": "" }, ...
b695463f7169f8b314737672d3d13fe3
Set the value of the Collaborator input for this Choreo.
[ { "docid": "52a63328f8cdd5295cbe6e0b92f5021d", "score": "0.79202706", "text": "def set_Collaborator(value)\n set_input(\"Collaborator\", value)\n end", "title": "" } ]
[ { "docid": "f7758f74d47c4da4f8ec99135000debb", "score": "0.7331406", "text": "def set_collaborator\n @collaborator = Collaborator.find(params[:id])\n end", "title": "" }, { "docid": "f7758f74d47c4da4f8ec99135000debb", "score": "0.7331406", "text": "def set_collaborator\n ...
fec3a12b63caa4f14a8988668ff5e57b
attr_accessible :acknowledged, :acknowledged_at, :level, :message, :source, :user_id
[ { "docid": "5864841a4c8c8e74762c64ae7788f862", "score": "0.0", "text": "def acknowledge\n attrs = {\n :acknowledged => true,\n :acknowledged_at => Time.now()\n }\n self.update_attributes(attrs)\n end", "title": "" } ]
[ { "docid": "683a3f8da846979d588b0570210773df", "score": "0.61248124", "text": "def message_params\n params.require(:message).permit(:title, :body, :email, :sender_id, :recipient_id, :read_status, :read_at)\n end", "title": "" }, { "docid": "238cb017e5baacd59cc46297f643402a", "score":...
e836fb00f155a0fb73adf031f8850e23
Use `file s` to identify volume type: ohai doesn't seem to want to do so.
[ { "docid": "2fa5c3c3b96303234bf14ad718a56268", "score": "0.6509045", "text": "def fstype\n return self['fstype'] if has_key?('fstype')\n Chef::Log.info([\n self['fstype'], current[:fstype],\n File.exists?(device) && `file -s '#{device}'`.chomp,\n self,\n ].ins...
[ { "docid": "b7c1a77669782031b6199895dc3d4e60", "score": "0.6626402", "text": "def file_type\n case raw_file_type\n when 'f'\n :file\n when 'd'\n :directory\n when 'L'\n :symlink\n when 'D'\n :device\n when 'S'\n :specia...
3c481a2e422ada6a0ea4772f90cd9a4e
Setup the voter record.
[ { "docid": "cfaaaf7925f4960cdfdcf084cbf1424c", "score": "0.71162367", "text": "def set_voter_record\n beta = params[:beta].to_i\n\n # Use the beta to find to find whether the voter exists and whether they have voted or not.\n @voter_record = nil\n @vote_cast = nil\n\n if beta\n # ...
[ { "docid": "6a50907ebc62cfd040e2f42006e9ac2d", "score": "0.7350756", "text": "def set_voter\n @voter = Voter.find(params[:id])\n end", "title": "" }, { "docid": "6a50907ebc62cfd040e2f42006e9ac2d", "score": "0.7350756", "text": "def set_voter\n @voter = Voter.find(params[...
21bf94ab3a34fb38c21ee025e92b2946
String representation of the category.
[ { "docid": "67112f42f319fb4f8fac5d0a1e14ee7c", "score": "0.62482214", "text": "def to_s\n self.name\n end", "title": "" } ]
[ { "docid": "6390c60c9587f27f286c608b137ad146", "score": "0.8379765", "text": "def to_s\n \"Grammatical category: #{self.tag} - '#{self.name}'\"\n end", "title": "" }, { "docid": "6f83b68e54843bd0bb14177a5cee31ec", "score": "0.7741898", "text": "def category_string\n ...
8da17d2b989f55d7e0b054d567594c57
Generate random filename for copy instead of using expected names (sys, sec, sam, hw) Make backup copies of the main registry hives
[ { "docid": "add0ed3d971fe1c94f2687dc76e9a80c", "score": "0.62907034", "text": "def make_reg_backups\n\t\tcommandz = { 'SYSTEM' => \"%COMSPEC% /C reg.exe save HKLM\\\\SYSTEM #{datastore['TMPPATH']}\\\\sys\", 'SECURITY' => \"%COMSPEC% /C reg.exe save HKLM\\\\SECURITY #{datastore['TMPPATH']}\\\\sec\", 'SAM...
[ { "docid": "6a3081ff60c0d8e610e1da7d40836155", "score": "0.7264103", "text": "def gen_filename_for_copy\n # Try to preserve the file extension, if found. \n if filename =~ /(.*)\\.([^.]+)/\n base, ext = $1, $2\n else\n base, ext = filename, nil\n end\n\n num = 1\n while true\...
e371ca70a3eb7faceafafd41a544b8b3
Create or patch Site Create or patch Site under Infra.
[ { "docid": "09b7ec62dae002883ff3f376657b27df", "score": "0.55888", "text": "def patch_infra_site_with_http_info(site_id, site, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyInfraSitesApi.patch_infra_site ...'\n end\n # verify the...
[ { "docid": "223a390369a81ca6239fbc3296d31104", "score": "0.6577811", "text": "def update_project_site\n @site = \"\"\n begin\n if !params['id'].empty?\n parent.managed_repository do\n @site = Voeis::Site.get(params['id'].to_i)\n Voeis::Site.properties.each do |prop|\n...
ffe758721cb629adec49e5776183eaaf
Formats arguments into a String suitable for use as an email subject extra Extra Strings to be inserted into the subject Examples >> subject('Lorem ipsum') => "GitLab | Lorem ipsum"
[ { "docid": "02108d6139b419feb1726991505fbf30", "score": "0.70363855", "text": "def subject(*extra)\n subject = \"GitLab\"\n subject << (@project ? \" | #{@project.name_with_namespace}\" : \"\")\n subject << \" | \" + extra.join(' | ') if extra.present?\n subject\n end", "title": "" } ...
[ { "docid": "8c68be4e52f12f1924772619d38e620c", "score": "0.7614165", "text": "def subject(*extra)\n subject = \"\"\n subject << \"#{@project.name} | \" if @project\n subject << extra.join(' | ') if extra.present?\n subject\n end", "title": "" }, { "docid": "4baa1469a43a2abd914b8...
2825e9682fc88733c400ff8b6a1c0c90
new can be removed because new calls create in the application policy def new? return true anyone can create a new tester end
[ { "docid": "0352de608fa7f536f0af0219e6cd8728", "score": "0.6859856", "text": "def create?\n return true\n end", "title": "" } ]
[ { "docid": "4bc868bc4b11485c6f8e5c0b87666cc3", "score": "0.7936961", "text": "def new?\n create?\n end", "title": "" }, { "docid": "4bc868bc4b11485c6f8e5c0b87666cc3", "score": "0.7936961", "text": "def new?\n create?\n end", "title": "" }, { "docid": "80ac...
47b52c9b554d25225b01a1633381af17
Determines if the +self+ is empty (no subtrees).
[ { "docid": "b73950df2886763c0792cedf5ca87aa8", "score": "0.76516587", "text": "def empty?\n @root.nil?\n end", "title": "" } ]
[ { "docid": "f84df2f3b72f123afeebe8d9abb66e26", "score": "0.8209951", "text": "def empty?\n return @tree_iterator.empty?\n end", "title": "" }, { "docid": "3cec3b1525d9dc6af31badec9067275c", "score": "0.8028182", "text": "def empty?\n @children.empty?\n end", "titl...
facf1343dc4c61ef9d0857f9d6dfcd3a
Shows form to complete the order
[ { "docid": "dce6cc28d8459995d3735557dd89b398", "score": "0.0", "text": "def order\n end", "title": "" } ]
[ { "docid": "a0c9169634012f03df99d749aa587c2d", "score": "0.71664095", "text": "def finish_order\n data = show do\n title \"Finish order\"\n\n check \"Review the shopping cart to double check that you entered correctly. There should be #{operations.running.size} fragments in the cart.\"\n ...