query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "b8955f5bc4b32a294716bbd04a18ccea", "score": "0.0", "text": "def transaction_account_params\n params.require(:transaction_account).permit(:name, :description, :color, :namespace)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.71213365", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "b32229655ba2c32ebe754084ef912a1a", "score": "0.70527846", "text": "def expected_permitted_parameter_names; end", "title": ...
7ea1b5e5c02001a3e57436b9279c6371
Provides shipment tracking information for an order.
[ { "docid": "05d07b875c0d7737b7080956e8ab4061", "score": "0.59965944", "text": "def track\n if @order.token != params[:t]\n flash[:alert] = \"That link is invalid.\"\n redirect_to root_path\n return\n end\n\n @shipments = @order.shipments.where.not(shipped_at: nil)\n end", "t...
[ { "docid": "0c4e3807d26d3aaa48ec0701acefe46f", "score": "0.72517043", "text": "def track_shipment\n self.class.shipment_tracker_class.new.track(self)\n end", "title": "" }, { "docid": "a71ea171f597bc583e44382fbe78cf6a", "score": "0.6625858", "text": "def feature_order_tracking\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "b4cd0fc6287024b6347741d8d0d4901e", "score": "0.0", "text": "def missed_coupon_params\n params.require(:missed_coupon).permit(:coupon_value, :coupon_validity, :coupon_for, :Identified_at, :current_status, :updated_customer, :customer_id, :coupoun_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...
736db9c5be154284cc92c00385192642
Execute the provided block inside a binding.
[ { "docid": "a50bf2e8fa3ba5998ae27c5041cf6708", "score": "0.0", "text": "def binding\n unless _binding?\n _binding do\n yield(self) if block_given?\n end\n end\n end", "title": "" } ]
[ { "docid": "9f0f28809ec939a977416d80574e6049", "score": "0.75872916", "text": "def bind(&block)\n instance_eval(&block) if block_given?\n end", "title": "" }, { "docid": "1d8b66bb5405aee311220e9dfd32e995", "score": "0.74108195", "text": "def bind(&block); end", "title": "...
32351775d62858716dab9caaee212d69
Copy data from self to the given buffer
[ { "docid": "1f0c8e24d5f4b7f73b84ee0bf24e8262", "score": "0.74530184", "text": "def copy_to(buffer)\n if buffer.size != size\n raise RangeError, \"buffer sizes do not match\"\n end\n\n buffer.backing_buffer[buffer.offset, size] =\n backing_bu...
[ { "docid": "1ddc87511b44441b20bacc1201dc2bd9", "score": "0.7519137", "text": "def copy\n Buffer.new(@buffer.copy())\n end", "title": "" }, { "docid": "97eb242124552ecf48fbb5533140a6e0", "score": "0.7109556", "text": "def buffer_data(data)\n @data << data\n end", "titl...
080d1cef519177e7f8bbd6e52296c528
Returns the file path to override test data maintained outside the code
[ { "docid": "c1311bc777ccc05a323d90e9eaa7419e", "score": "0.7956727", "text": "def override_test_data(deployment, file_name)\n File.join(Config.override_settings_dir, \"#{deployment.code}/#{file_name}\")\n end", "title": "" } ]
[ { "docid": "8e4a399d16ab40e1651196480e1ce9aa", "score": "0.77111596", "text": "def default_test_data(deployment, file_name)\n File.join(File.dirname(File.absolute_path(__FILE__)), \"/test-data/#{deployment.code}/#{file_name}\")\n end", "title": "" }, { "docid": "8e4a399d16ab40e1651196480...
0dfb070a44634b00e5ca164e9311b3ec
Admin page for category
[ { "docid": "35968c7d3dd44959ba775017b706a70e", "score": "0.0", "text": "def category_index\n @categories = Category.all.paginate(page: params[:page], per_page: 10)\n respond_to do |format|\n format.js\n end\n end", "title": "" } ]
[ { "docid": "39b56a615c9ec04df99843486e114093", "score": "0.74841404", "text": "def index\n @page_title = \"Toutes les catégories\"\n @categories = Category.all\n render layout: \"admin\"\n end", "title": "" }, { "docid": "3a2c61e87ecc67a32ec8155f33d9e62e", "score": "0.7402659",...
d605973e014a439d52bd6bfb519fd08c
This function is used to provide the list of clients when a company id is provided and also for providing the list of companies
[ { "docid": "0004c852eaab6b86cd8ca011d4beab74", "score": "0.76098645", "text": "def clients\n !params[:id].blank?? session[:company_id] = params[:id] : params[:id] = session[:company_id]\n @companies = Company.company(current_user.company_id)\n if params[:id]\n @company = Company.find(param...
[ { "docid": "4e732cbd991a23eced3e83ea9b1b4f00", "score": "0.7125848", "text": "def clients\n handle_response(User_GetClients()) do |response|\n response[\"Client\"].collect{|c| Client.new({\"ClientID\" => c[\"ClientID\"], \"CompanyName\" => c[\"Name\"]})}\n end\n end", "title": "" }, ...
d714b84b04e9b3a142602ee85fe370e1
GET /scools GET /scools.json
[ { "docid": "c1253a87a7abac5976f125014c9e72c2", "score": "0.6209543", "text": "def index\n @scools = Scool.order(\"id DESC\").page(params[:page])\n end", "title": "" } ]
[ { "docid": "0ef79a2fba5af1ecbba5b9008e1c2f59", "score": "0.6103052", "text": "def index\n @socioeconomic_studies = SocioeconomicStudy.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @socioeconomic_studies }\n end\n end", "title": "" },...
ff202bb7c7a02bf7adcf89cb24830042
Sets the attribute openid_client_id
[ { "docid": "7c09008136cf2e0792cbe752020cfabc", "score": "0.80046695", "text": "def openid_client_id=(_arg0); end", "title": "" } ]
[ { "docid": "42a8c54017154d5faaae27dac103596c", "score": "0.7983129", "text": "def client_id=(value)\n @client_id = value\n end", "title": "" }, { "docid": "6d746d97e86437b9c027a18dc1a0debc", "score": "0.79391146", "text": "def client_id=(client_id); end", ...
1e7bf682a47df377adfdffb5c0709165
POST /appointments POST /appointments.json
[ { "docid": "1a92c6e25217f29f7a0a3af06756731d", "score": "0.6796582", "text": "def create\n @appointment = Appointment.new(appointment_params)\n if @appointment.starts_at != nil\n @appointment.ends_at = @appointment.starts_at + 30.minutes\n end\n respond_to do |format|\n if @appoint...
[ { "docid": "0da77372d165085abb28cd8a3b7ba383", "score": "0.7684941", "text": "def create\n @appointment = Appointment.new(appointment_params)\n if @appointment.save\n render json: @appointment, status: :created, location: @appointment\n else\n render json: @appointment.errors, status:...
9eb8674cb06e1ec18bcc72a1578158be
introduce prints out a welcome and how to message
[ { "docid": "c09b269ea3e97bb309ff7db8a5ccfffb", "score": "0.0", "text": "def introduce\n\tputs \"\\n Welcome to REPL Checkers!\"\n\tputs \" ---------------------------\"\nend", "title": "" } ]
[ { "docid": "913faa729ae1d97989ca98c2990df177", "score": "0.79239815", "text": "def give_welcome_msg\n puts \"Welcome to parcel system\"\n puts \"------------------------\"\n end", "title": "" }, { "docid": "7c2e05936d81ea4230a362610ce37646", "score": "0.7799232", "...
65b3bccf62a3eacaf2b7979be788b241
Public: Retrieve the known state of the user, ie notifcation count username The String identifying the user Returns UserState object describing the state
[ { "docid": "80f815a2e6cce0d79c19ea9aff70b4ec", "score": "0.77152014", "text": "def get_user_state(username)\n raise ArgumentError.new(\"username must be a String\") unless username.is_a? String\n\n user_state_store.get(username)\n end", "title": "" } ]
[ { "docid": "ad82fd47992654b1d5b84fff864eb40b", "score": "0.6691505", "text": "def getCurrentUserState()\n usersState = Brewery.getCurrentUserState(params[:lat],params[:long])\n # reverse geolocate lat long and get users state\n render json:{state: usersState}, status: 200\n end", "title": ...
0a7f64ea96bb1cb5bfe3e06ff67eb6b3
Submission hash describing how to submit this attribute
[ { "docid": "84dc3beb0714a585a622172850ce816f", "score": "0.0", "text": "def submit(fmt: nil)\n { script: { queue_name: value.blank? ? nil : value.strip } }\n end", "title": "" } ]
[ { "docid": "95ed967547f1ab19a41a714a9972a2c5", "score": "0.63399726", "text": "def hash\n strs = FIELDS.collect {|f| \"#{f}:#{send(f).inspect}\"}\n Digest::SHA256.hexdigest(strs.join(' '))\n end", "title": "" }, { "docid": "706cbdb4c78e6b67e29589df0a4b1b5c", "score": "...
31d67286198f3c78b9b1effe57771680
Calculate the average deviation from timing of one period to the next
[ { "docid": "e9b3ed39ec2e90a48b3e2cee23d81b4d", "score": "0.0", "text": "def calculate_average_abberation\n if abberations.empty?\n 0.0\n else\n abberations.inject(&:+).to_f / abberations.count\n end\n end", "title": "" } ]
[ { "docid": "816110e63bb324a33a74e5c6e80fcde3", "score": "0.7153481", "text": "def average_period\n @average_period ||= @periods.inject(&:+).to_f / num_pulses\n end", "title": "" }, { "docid": "86df08993e599945bb248e9572868f70", "score": "0.7003376", "text": "def average( num_...
685f6ce9bffb57a51d0f100876da743d
See ActiveRecord::Generators::Migration Only generating a migration to each second is a problem.. because we generate everything in the same second So we have to add further "pretend" seconds. This WILL cause problems. TODO: Patch ActiveRecord to end this nonsense.
[ { "docid": "531858cc9434cbc847d2b45f0d199a34", "score": "0.50299007", "text": "def next_migration_number #:nodoc:\n highest = Dir.glob(migrations_path.to_s+\"/[0-9]*_*.rb\").collect do |file|\n File.basename(file).split(\"_\").first.to_i\n end.max\n\n if ActiveRecord::Base.timestam...
[ { "docid": "6abc244765095673c7bb7fecadd39b61", "score": "0.6021804", "text": "def next_migration_number\n # Lifted directly from ActiveRecord::Generators::Migration\n # Unfortunately, no API is provided by Rails at this time.\n next_migration_number = current_migration_number + 1\n i...
76965c0e76c7d360cc2a9a94266d4057
I worked on this challenge [by myself]. Your Solution Below
[ { "docid": "779f4ec1f978f8e73aa3ef18ba0f8b3a", "score": "0.0", "text": "def array_concat(array_1, array_2)\n combined_array = array_1 + array_2\n return combined_array\nend", "title": "" } ]
[ { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.652172", "text": "def solution4(input)\n end", "title": "" }, { "docid": "f712d49ec6c615538b2e2aa846391fda", "score": "0.62849104", "text": "def challenge; end", "title": "" }, { "docid": "bca12d2414c241325b8beea...
69b5bea708a36dbb2a9857ad8a00a169
comparison slugs are for compare pages to be able to compare values for different indicators
[ { "docid": "90419ded505ea6b36a9dc8cb01b81161", "score": "0.62427294", "text": "def import_comparison_slugs\n @comparison_indicators.each do |ind|\n slugs = [ind[:pledges_slug], ind[:ndc_slug], ind[:lts_slug], ind[:lse_slug]]\n Indc::Indicator.where(slug: slugs).update_all(normalized_label: ...
[ { "docid": "53855840edb3acd7ab26fe0695f4d825", "score": "0.59826225", "text": "def compare_page_url(before_version, after_version)\n \"#{RUBOCOP_REPO_URL}/compare/v#{before_version}...v#{after_version}\"\n end", "title": "" }, { "docid": "403b44e110102ad5173135e427b3308b", "score...
aced5c3ff09d78eac6b945152387ed73
define addition operation, for interpolation
[ { "docid": "44ad0a382a2e37ff4c6ea3b4b49c4835", "score": "0.0", "text": "def +( other )\n return Color[ self.r + other.r,\n self.g + other.g,\n self.b + other.b,\n self.a + other.a ]\n end", "title": "" } ]
[ { "docid": "17e91f362ef3b8e10dcc2299079355fe", "score": "0.6987759", "text": "def add(val1, val2) val1 + val2 end", "title": "" }, { "docid": "44c6ab27de7828b487bc70fbfd60448f", "score": "0.6929116", "text": "def plus(iva,ivb)\n return sum([iva,ivb]) \n end", "title": "" },...
c742507650eb7d0523668100401eebc5
Returns integer relecting vampirosity 1 = not a vampire, 5 = definitely a vampire Returns 0 if unable to tell methods
[ { "docid": "a0dae28fcb54e733003923c6024e712d", "score": "0.0", "text": "def check_age(age, year)\r\n\tdiff = 2016 - year - age\r\n\tif diff == 1 or diff == 0\r\n\t\treturn true\r\n\telse\r\n\t\treturn false\r\n\tend\r\nend", "title": "" } ]
[ { "docid": "29a9a7794669bc03cd847f2e85ad1626", "score": "0.71544725", "text": "def virality\n 0\n end", "title": "" }, { "docid": "0deda5a9a575b28d29d071796715f990", "score": "0.66019285", "text": "def impacto_energetico\n if vct < 670 then\n return 1\n elsif vct < 8...
adc0d5ac4bbbba841873ff44ba695bac
Method deletes row in truck_parts table corresponding to the id of the TruckParts instance it is called on. Returns nil.
[ { "docid": "2f075bef94e57794636a97d552aaca00", "score": "0.81523645", "text": "def delete\n CONNECTION.execute(\"DELETE FROM truck_parts WHERE id = #{@id};\")\n end", "title": "" } ]
[ { "docid": "962b002af8c2b306680172ec328d561d", "score": "0.59903467", "text": "def destroy\n authorize! :destroy, @part\n if @part.destroy\n redirect_to parts_path, notice: 'Part deleted'\n else\n redirect_to part_path(@part), alert: \"Part cannot be deleted because it's used by a wor...
bc5e047c8689b613b4bfe0f22577c647
To delete an account Intuit requires we provide Id and SyncToken fields
[ { "docid": "f648bfab3d4d26182e6a39f8ed4494cd", "score": "0.0", "text": "def valid_for_deletion?\n return false if(id.nil? || sync_token.nil?)\n id.to_i > 0 && !sync_token.to_s.empty? && sync_token.to_i >= 0\n end", "title": "" } ]
[ { "docid": "f2de31bc04d5b30b6cae9df19a45c772", "score": "0.662809", "text": "def delete!\n resource = RESOURCE % { account_id: account.id, id: id }\n response = Request.new(account.client, :delete, resource).perform\n from_response(response.body[:data])\n end", "title": "" }, {...
7bf9d91b71d07cc06581c270fd1a59f2
ACTIVITY STREAM INTERFACE ELEMENTS
[ { "docid": "f98104057854b48b1bf50fff47866cfd", "score": "0.0", "text": "def primary_photo_path(which=:thumb)\n chat.primary_photo_path(which)\n end", "title": "" } ]
[ { "docid": "cebe1c0e708dde8419358cb222cf4af4", "score": "0.7065304", "text": "def activity\n raise NotImplementedError\n end", "title": "" }, { "docid": "52cf04c1ac242485c5b84ee6d594bcdd", "score": "0.6881663", "text": "def activities\n raise NotImplementedError\n ...
2e4adfc5ea52414b9075cfac8b27ad08
Creates a board with the initial preset pieces.
[ { "docid": "46cbed6bc66f957fcbb450fa139d1cec", "score": "0.6323315", "text": "def initialize ()\n\t\t@board = [\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \", \" . \",\n\t\t\n\t\t\t\t\t\" . \", \" . \", \" . \", \" . \", \" . \", \" . \" ,\" . \", \" . \",\n\t\t\t\t\t\n\t\t\t\t\t\" . \"...
[ { "docid": "588fe3e3861265e94749398afbf2cb98", "score": "0.7904847", "text": "def make_board\n make_blank_board\n populate_board\n end", "title": "" }, { "docid": "e82612e347525be0054c15a94fc1f63f", "score": "0.778875", "text": "def create_board\n\t\t8.times{|x| @board.push([n...
fe9377717558cce2caaa555cb382cf10
Set the value of the PageToken input for this Choreo.
[ { "docid": "04437f4e6e9f497ec4a1eb906d56a5d4", "score": "0.5384719", "text": "def set_PageToken(value)\n set_input(\"PageToken\", value)\n end", "title": "" } ]
[ { "docid": "1d9c4ea3273840d63bfcd75a4d3c917d", "score": "0.6342995", "text": "def set_token=(token)\n @token = token\n end", "title": "" }, { "docid": "fbc7f3ad5f8eb51f40ffb198dc31e88d", "score": "0.62881094", "text": "def set_token(token)\n @token = token\n end", "title"...
21293f9607754c3b5bbe62c722f4671a
this is shortest path problem with unweighted graph, BFS is best solution
[ { "docid": "85f7fd0576ab7ec4ad03f59709522459", "score": "0.6254321", "text": "def bradth_first_search(start_vertex, stop_vertex)\n queue = Array.new()\n queue << search_vertex(start_vertex)\n until queue.empty?\n temp_vertex = queue.shift()\n break if temp_vertex.value == stop_vertex\...
[ { "docid": "a00454e2f049229c3f5958cb515a3249", "score": "0.74276274", "text": "def dijkstras(start=@vertices.keys.sort[0],goal=nil)\n\t\t# Set of visited nodes\n\t\tvisited = []\n\n\t\t# Step 1 \n\t\t# - Start node weighs 0\n\t\t# - Set all other to infinity its done in constructor already\n\t\t@vertice...
5beb4e704564a66a3cc3f4f6ff958a4b
if you want to do the interview questions you change the ordering of this to make that it does post and pre order
[ { "docid": "4bacd79778456cc5537a6cd924e3b8ae", "score": "0.0", "text": "def in_order_traversal(tree_node = @root, arr = [])\n # left children, itself, right children\n if tree_node.left\n in_order_traversal(tree_node.left, arr)\n end\n\n arr.push(tree_node.value)\n\n if t...
[ { "docid": "66627177646d1ceb9f70d9440a719501", "score": "0.62068623", "text": "def order; end", "title": "" }, { "docid": "66627177646d1ceb9f70d9440a719501", "score": "0.62068623", "text": "def order; end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac86390", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f101d19c2b6b1fbeccd1e1e1431f43cb", "score": "0.0", "text": "def seat_params\n params.fetch(:seat, {}).permit(:name)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whit...
ab401517d0a10a568c57266e9417bd7c
Prevent the current user from editing his/herself
[ { "docid": "d24b7e4208eb19460c3b6d95044f964f", "score": "0.0", "text": "def filter_self\n if @user && !current_user.can_edit?(@user)\n respond_to do |format|\n format.html {\n render :nothing => true, :status => 403\n }\n format.json {\n render :json => {:s...
[ { "docid": "7e0f79d940049617ee0e754996466a84", "score": "0.81947464", "text": "def prevent_edit\n !can_edit?\n end", "title": "" }, { "docid": "7d7157213799ebb243d23574f4a7cb41", "score": "0.8111495", "text": "def correct_user_to_edit\n not_allow if (@job.user.id != current_...
250adabc247b481fcc8e90030dd78515
GET /albums/1 GET /albums/1.xml
[ { "docid": "59411ff8364e18354efddf53364b203a", "score": "0.70218146", "text": "def show\n @album = Album.find(params[:id])\n @photos = @album.photos\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @album.to_xml }\n end\n end", "title": "" }...
[ { "docid": "6d694206211b3e653a872a98df8d32e1", "score": "0.758241", "text": "def index\n @albums = @page.albums.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @albums }\n end\n end", "title": "" }, { "docid": "bf5dd2255...
13b336c5618adca8316a5a58098aa08b
PATCH/PUT /admin/media_vehicles/1 PATCH/PUT /admin/media_vehicles/1.json
[ { "docid": "5117d0c9dfee2bae465100af8631d4b8", "score": "0.74982977", "text": "def update\n respond_to do |format|\n if @admin_media_vehicle.update(admin_media_vehicle_params)\n format.html { redirect_to @admin_media_vehicle, notice: 'Media vehicle was successfully updated.' }\n fo...
[ { "docid": "1966a5c6f74935953d81611828d84e12", "score": "0.67976296", "text": "def update\n update_resource @vehicle, vehicle_params\n end", "title": "" }, { "docid": "c439900a450d440aacf36254733bf336", "score": "0.6781945", "text": "def set_admin_media_vehicle\n @admin_medi...
842251410b5d2ee4d63035ce36090784
char the character that will check str Example ends_with(Walla, a) => true Returns true or false depending on if str ends with char
[ { "docid": "3a34f01ed21aa75dd6b3f8ec345c815d", "score": "0.8412413", "text": "def ends_with(str, char)\n if str[str.length - 1] == char\n return true\n else\n return false\n end\nend", "title": "" } ]
[ { "docid": "1faa96547215095126c19621bd8b3a48", "score": "0.832634", "text": "def ends_with(str, char)\n return str[-1] == char\nend", "title": "" }, { "docid": "52d9bf303f20cad46bfc725d0b3963d3", "score": "0.74783593", "text": "def ends_with(srt, letter)\n if srt[-1] == letter\...
5f7ce84d37851e287349e40c0648be05
compare software versions and return one of the following: if s1 > s2 => 1 if s1 = s2 => 0 if s1 1
[ { "docid": "b5f8dbcc67becdefb6c6bcbfd03b6e2c", "score": "0.0", "text": "def compare(num1, num2)\n return 0 if num1.to_i == num2.to_i\n return 1 if num1.to_i > num2.to_i\n return -1\nend", "title": "" } ]
[ { "docid": "b649876782b9671c4ee284b6d97eade3", "score": "0.7785764", "text": "def version_compare(v1, v2)\n if !shell_out(\"dpkg\", \"--compare-versions\", v1.to_s, \"gt\", v2.to_s).error?\n 1\n elsif !shell_out(\"dpkg\", \"--compare-versions\", v1.to_s, \"eq\", v2.to_s).err...
bff35c4ec668e933d5936de32a5ff0ba
Whether or not the Status Code is unknown. According to RFC 2616, the only defined Status Code ranges are from 100 to 599, inclusive. Anything outside that range is an unknown Status Code.
[ { "docid": "f313eb10acc5c5881fc8638d319f9f83", "score": "0.8567404", "text": "def unknown?\n !(100...600).include?(@status_code)\n end", "title": "" } ]
[ { "docid": "8c0c65902e98184377ecab5d87c3cda8", "score": "0.75775546", "text": "def ok_status_code\n _undefined\n end", "title": "" }, { "docid": "89183dea1357f1138b0bbe30af80df10", "score": "0.7488563", "text": "def unknown; status[:unknown]; end", "title": "" }, { "d...
3987b51c03aa9a7ce55fff5d6531e8b3
will work to try an create an ajx request to reload suggestion off of previous selections def suggestion
[ { "docid": "2317339ef6e08d643477c5e6b57084fc", "score": "0.0", "text": "def search\n @q = Beer.ransack(params[:q])\n @beers = @q.result(distinct: true).page params[:page]\n render @beers, layout: false\n end", "title": "" } ]
[ { "docid": "2dc89d8533623da9d005e2e771305128", "score": "0.6759929", "text": "def set_suggestion\n @suggesiton = Suggestion.find(params[:id])\n end", "title": "" }, { "docid": "2aab1ae7b3481f5ad504f6173984aef2", "score": "0.66500765", "text": "def retire_suggestion(suggestion, pa...
7599f19dc675836060b1aa9911faae58
def direction_to(other_pos) x, y = pos x2, y2 = other_pos [x2 x, y2 y] end
[ { "docid": "a45ccf879d55807a98b31b9f2fab34e6", "score": "0.0", "text": "def possible_moves\n moves_hash = { slides: Set.new, jumps: Set.new }\n\n possible_slides.each { |move| moves_hash[:slides] << move }\n possible_jumps.each { |move| moves_hash[:jumps] << move }\n\n moves_hash\n end", ...
[ { "docid": "f1005e870f7db5eb063db4c22c5c6091", "score": "0.74483836", "text": "def direction_to(other_x, other_y)\n vector_to_angle(*drop_diagonal(other_x - @x, other_y - @y))\n end", "title": "" }, { "docid": "f1005e870f7db5eb063db4c22c5c6091", "score": "0.74483836", "text": "de...
eeb47c296e3a18eef0293a5bc34bce4c
GET /hub_lists/1 GET /hub_lists/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "82c53c3bf2cd07f37e6321370b8bb6a6", "score": "0.761242", "text": "def index\n @hub_lists = HubList.all\n end", "title": "" }, { "docid": "c2c6c7fb0c49180e9474b8eff2409fd5", "score": "0.73702335", "text": "def lists\n\tget('/lists.json')\nend", "title": "" }, { ...
feba3e5b8a4eace8bcc17dff00181aaa
GET /pages/1 GET /pages/1.xml
[ { "docid": "14a53e749a349e8409ffcaf891a0972f", "score": "0.0", "text": "def show\n @section = Section.find(params[:section_id])\n @page = @section.pages.find(params[:id])\n \n @section_root = @section.set_root\n \n @seo_profile = @page.seo_profile || @section.seo_profile || @section_ro...
[ { "docid": "343ecaae5f333ae724bf4a4693caeab1", "score": "0.7175242", "text": "def index\n @pages = Page.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @pages }\n end\n end", "title": "" }, { "docid": "c08150218d2652631914646e2d...
1972334ac05fab877bc866b633cc1572
construct message base string, example: Yummy! The best bubble tea ever! DEPRECATED THIS ISN"T NEEDED ANYMORE"
[ { "docid": "950bcd405a57bd67aaf4380fe6abdc40", "score": "0.71656984", "text": "def message_base\n base = \"\"\n base << \"@#{self.user.username}: \" if service == \"sms\"\n base << \"#{self.message} - \" unless self.message.blank?\n\n base << \"\" if deal.for_sale_on_paypal\n base << \"Qw...
[ { "docid": "623f75eeab24562259f029d57c5f2e15", "score": "0.7178326", "text": "def build_message(*args)\n args[1].gsub(/\\?/, '%s') % args[2..-1]\n end", "title": "" }, { "docid": "0f4797a12ed611ee5ae8c9e2bcb4705f", "score": "0.66180015", "text": "def format_string(message, max_ch...
762d7ece5298c4fa49d92bb1204885bf
This method will only be called if `get_devise_mapping` cannot find the mapping in `omniauth.params`. One example usecase here is for IDPinitiated SAML login. In that case, there will have been no initial request in which to save the devise mapping. If you are in a situation like that, and your app allows for you to de...
[ { "docid": "5032d506ecc0a14068fc2ba6eacbb13e", "score": "0.689558", "text": "def default_devise_mapping\n raise NotImplementedError, 'no default_devise_mapping set'\n end", "title": "" } ]
[ { "docid": "251169b67f593d8e4fdcc9cf3bf0cbab", "score": "0.68012965", "text": "def devise_mapping\n mapping = super\n mapping = Devise.mappings[:candidate] if mapping.nil?\n mapping\n end", "title": "" }, { "docid": "ebb5d2830893bbede9994753791ef08f", "score": "0.67620355", ...
e934cd13be30b570d7e31f046ca9b360
Process switch is called by snmpwalk to run a single SNMP query to retrieve the OID or OIDS passed in.
[ { "docid": "4461cbd81350dc7c0f06bcd1a3759b4f", "score": "0.67250586", "text": "def process_switch(ifTable_columns)\n begin\n SNMP::Manager.open(:Host => @hostname, :Community => \"#{@snmp_community}\", :Version => :SNMPv2c) do |manager|\n manager.walk(ifTable_columns) do |row|\n ...
[ { "docid": "2d873bf41103b428e1a5f7a9e0ed3f60", "score": "0.70316803", "text": "def query\n process_switch([OID]) do |k,v| #Port numbers\n if @results[k[-1]] == nil\n @results[k[-1]] = Brocade_SNMP_Hardware_Status_Result.new\n end\n case k[-2]\n when 1; @results[k[-1]].index...
707b52ff5b7d2b14905a92b138388063
DELETE /redirects/1 DELETE /redirects/1.json
[ { "docid": "412e1570def540b21cd6d250a4af3b89", "score": "0.69079155", "text": "def destroy\n @redirect.destroy\n respond_to do |format|\n format.html { redirect_to redirects_url, notice: 'Redirect was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "ti...
[ { "docid": "3247690391863e9996a90face7c9e5e1", "score": "0.7332134", "text": "def destroy\n @redirect = Redirect.find(params[:id])\n @redirect.destroy\n\n respond_to do |format|\n format.html { redirect_to redirects_url }\n format.json { head :no_content }\n end\n end", "title...
70f22d4d2b266d8a137f6daa04d6a484
Stringsqueeze! squeeze!(del=nil) (no description...)
[ { "docid": "b64d055aacc8df26b0d08f08b0ea75cf", "score": "0.61615014", "text": "def squeeze!(arg0, arg1, *rest)\n end", "title": "" } ]
[ { "docid": "e4a75ec845cf3b6dd0761c2b359ba92e", "score": "0.7742535", "text": "def squeeze!([str]) \n end", "title": "" }, { "docid": "3ca4fe140a5c380ed1722385260a81f5", "score": "0.7632284", "text": "def squeeze\n \"Elementary, my dear Watson!\".squeeze\nend", "ti...
b6b9cd199dfaed08c4c534812e0ac109
Check to see if the all the properties in the model are valid
[ { "docid": "2fe24188d656c7676c9428b2db77e6cc", "score": "0.0", "text": "def valid?\n return false if @class_id.nil?\n class_id_validator = EnumAttributeValidator.new('String', [\"bios.Policy\"])\n return false unless class_id_validator.valid?(@class_id)\n return false if @object_type...
[ { "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": "" ...
1302beec82940a7c3a6b94f10400dbe4
PUT /legs/1 PUT /legs/1.json
[ { "docid": "7b74ce510551707db35328c186644945", "score": "0.5817818", "text": "def update\n @leg = Leg.find(params[:id])\n\n respond_to do |format|\n if @leg.update_attributes(params[:leg])\n format.html { redirect_to @leg, :notice => 'Leg was successfully updated.' }\n format.js...
[ { "docid": "82625c859fd9b71daa32e7b60461d30e", "score": "0.6528647", "text": "def update\n respond_to do |format|\n if @legs1.update(legs1_params)\n format.html { redirect_to \"/legs1s\"}\n format.json { render :show, status: :ok, location: @legs1 }\n else\n format.htm...
7db85d038a91b62c1985a7750a574db9
Return true if board is full and hasn't been won; false if board is neighter won nor full
[ { "docid": "6550bfc89f9436d5c9e6c8e8febd72de", "score": "0.0", "text": "def draw?\n full? && !won?\n end", "title": "" } ]
[ { "docid": "9dd2d3f115cf03b7109e61b46d4752ec", "score": "0.8876316", "text": "def full?\n if won? == false && @board.all? {|element| element != \" \"}\n return true\n else\n false\n end\n end", "title": "" }, { "docid": "73f3ba8e4970525610df5749ee001369", "score": "0....
38937089e33366f236300487235f1051
given a hash of orders, adds each to order array
[ { "docid": "73d63944cd5e0bec428aa3d8612d258e", "score": "0.63713", "text": "def add_orders params\n @orders_hash = JSON.parse(params)\n\n @orders_hash['orders'].each do |order|\n add_order(order[\"origin\"],order[\"destination\"],order[\"size\"])\n end\n true\n end", "title": "" ...
[ { "docid": "1fdf3a224118fc9c3128e8af675baf7c", "score": "0.6233694", "text": "def c(memo)\n each do |order|\n unless memo.keys.include?(order[0])\n memo << order\n end\n end\n end", "title": "" }, { "docid": "a9a300083520aa68f4b309daaf3498b2", "score":...
2c696600c0b5837ef81bf3751b906458
DELETE /campo_documentos/1 DELETE /campo_documentos/1.xml
[ { "docid": "3404dbc57971e1abbb2700d3d59953da", "score": "0.7228105", "text": "def destroy\n @campo_documento = CampoDocumento.find(params[:id])\n @campo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(@campo_documento.tipo_documento) }\n format.xml { head :ok...
[ { "docid": "34787bcb2485a4fbf717d19cbd8e9bdf", "score": "0.73103714", "text": "def destroy\n @arquivo_documento = Arquivo::Documento.find(params[:id])\n @arquivo_documento.destroy\n\n respond_to do |format|\n format.html { redirect_to(arquivo_documentos_url) }\n format.xml { head :ok...
add7bbeec90c0193ebf34588d9a62e0d
== Instance Methods =====================================================
[ { "docid": "03ce5729f80219dba55eb6c01bfe4251", "score": "0.0", "text": "def initialize(target, context = nil)\n @target = target\n @context = context || target.context\n end", "title": "" } ]
[ { "docid": "18250542a2b1999be90588db1d071d92", "score": "0.73226625", "text": "def initialize\n\t\t\n\tend", "title": "" }, { "docid": "170e7cc6f3b91fc8d88704f0d36db709", "score": "0.73170996", "text": "def initialize; super; end", "title": "" }, { "docid": "cdd58dace22c1...
1b980fe2482848b3544ed72992818b55
GET /mensetus GET /mensetus.json
[ { "docid": "9ecc1fd7719a0faa652d8091d96b3537", "score": "0.0", "text": "def index\n @mensetus = Mensetu.where(user_id: current_user.id).order(created_at: :desc)\n @mensetus_ok_teacher = Mensetu.where(status: 0).order(created_at: :desc)\n @mensetus_kakunin_teacher = Mensetu.where(status: 1).orde...
[ { "docid": "a1f69b0cf34290856a33a9e5e6de3f90", "score": "0.7380928", "text": "def get_menu()\n res = get(\"menu/get\")\n return MultiJson.load(res.body)\n end", "title": "" }, { "docid": "c8bcff8176e90f78aea0f16d606f01c0", "score": "0.71670914", "text": "def index\n @...
fca5d4813ebd32d88bad6fe8d8258656
Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/sync/v1/service/sync_list.rb165
[ { "docid": "84c2aa104b8a70acbe3f11eca76559b3", "score": "0.0", "text": "def to_s; end", "title": "" } ]
[ { "docid": "65f653a53816c293efc96699a9d68271", "score": "0.63155603", "text": "def index\n @syncs = Sync.all\n end", "title": "" }, { "docid": "ebb84cdc4ef18c3a2a03f91775af2a12", "score": "0.6051945", "text": "def index\n @sync_operations = SyncOperation.all\n end", "titl...
c9cf54711ca27d59b08cef578ba282e1
May be overridden by model policies
[ { "docid": "c04e1fd469fb63dc2da29b80c8c61981", "score": "0.0", "text": "def authorized_to_edit_records\n scope.none\n end", "title": "" } ]
[ { "docid": "ee1e04a5dfc4f69cc08792c48aa924e3", "score": "0.74182516", "text": "def policy; end", "title": "" }, { "docid": "b5ab36b915d8e4191cc5e2703f227c29", "score": "0.70803165", "text": "def policies; end", "title": "" }, { "docid": "2f4c5e0c7d2cb165bc02acb83ec9378d",...
0180d22bc9b146ab2b71bec4c15fa9c2
set user input into array index
[ { "docid": "7a46e2847d160fa4ac885dc3bfc84b47", "score": "0.6383261", "text": "def input_to_index(user_input)\n index = user_input.to_i - 1\n end", "title": "" } ]
[ { "docid": "f306836ca756992b1c6ef3e38fcf9ff0", "score": "0.72567666", "text": "def input_to_index(user_input)\n user_input = user_input.to_i # converts string into integer\n index = user_input - 1 # Change user input to array index.\nend", "title": "" }, { "docid": "1a74b...
27509d60de23bee37ecaba1f26934175
Create a Query object or subclass. Alter this method if you'd like to return an adapter specific Query subclass.
[ { "docid": "a25868ff15bd62d290959284c9283ec4", "score": "0.7118847", "text": "def new_query(repository, model, options = {})\n Query.new(repository, model, options)\n end", "title": "" } ]
[ { "docid": "223f83953d502de01206a70a072e1dfe", "score": "0.74075943", "text": "def build_query want\n Query.new want\n end", "title": "" }, { "docid": "6bf238e017e17aaf0b6455f026a04ee7", "score": "0.72927064", "text": "def find_query_new(attrs={})\n find_query_class\n @...
20a59b3be683e31d32dd196887b137cf
DELETE /airways/1 or /airways/1.json
[ { "docid": "8389a7a0b2bf3317e2f8024f900bb8db", "score": "0.73546773", "text": "def destroy\n @airway.destroy\n respond_to do |format|\n format.html { redirect_to airways_url, notice: \"Airway was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "title"...
[ { "docid": "3bb0f57e851426155ab267a2a57f6a06", "score": "0.7262785", "text": "def destroy\n @airline = Airline.find(params[:id])\n @airline.destroy\n\n respond_to do |format|\n format.html { redirect_to airlines_url }\n format.json { head :no_content }\n end\n end", "title": "...
5627f0032093d33dd74cdb561454b14a
POST /ip_assets POST /ip_assets.json
[ { "docid": "b8f031be225c836715d3d746b118d8c6", "score": "0.7275672", "text": "def create\n @ip_asset = IpAsset.new(ip_asset_params)\n\n respond_to do |format|\n if @ip_asset.save\n format.html { redirect_to @ip_asset, notice: 'Ip asset was successfully created.' }\n format.json ...
[ { "docid": "080c9cd865792963556f7326b7f882e9", "score": "0.68395764", "text": "def create\n @ip_asset = IpAsset.new(ip_asset_params)\n # @ip_asset = current_user.ip_assets.build(ip_asset_params)\n respond_to do |format|\n if @ip_asset.save\n format.html { redirect_to @ip_asset,...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "235ee1a46a24c6b79748964d2e313dbf", "score": "0.0", "text": "def proposal_params\n params.require(:proposal).permit(:admin_id, :homework_id, :cost, :notes, :status, :deadline)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
553d4ab5f9413e85bde77c73f5171ede
Finds user Friend via friend_email. If valid, delete Friend.id in self.friend_list.
[ { "docid": "abbf652e0a5619228d6dd6d2dbf4628f", "score": "0.8218225", "text": "def remove_friend(friend_email)\n\t\tfriend = self.class.find_by(email: friend_email.downcase)\n\t\tif friend != nil\n\t\t\tself.friend_list.delete(friend.id)\n\t\t\tself.update_attribute(:friend_list, self.friend_list)\n\t\te...
[ { "docid": "caf4fa6961d84e3119152f88de041542", "score": "0.67279434", "text": "def find_friend_by_email\n begin\n @friend_id = User.find_by(email: params[:email]).id\n rescue\n render json: {error: \"Friend not found\"}, status: 404\n end\n end", "title": "" }, { "docid":...
8f2bdbc660c7d927b4e32fb4f95b300a
Returns the winner if there is one, +nil+ otherwise
[ { "docid": "8cf45ce764aa21320099c9ab5764dd2a", "score": "0.75851625", "text": "def winner\n if finished?\n if @player_1[@length] = \"x\"\n return @players[0]\n elsif @player_2[@length] = \"x\"\n return @players[1]\n end\n end\n\n end", "title": "" } ]
[ { "docid": "1d02290a84956f3194f7e53591459b07", "score": "0.85865", "text": "def winner\n triplet = won?\n if !!triplet\n return @board[triplet[0]]\n end\n return nil\n end", "title": "" }, { "docid": "dcac56b12cd7b4984cc8b8797e3c80e9", "score": "0.85793227", "text":...
ba04df1806e630b891a698542c5cf374
Extracts the id and name of the bvfs_lsfiles command
[ { "docid": "006f7e3738e74a3f3a6fd3ad67d4df71", "score": "0.534987", "text": "def extract_file_id_and_name\n files.\n split(\"\\n\").\n select { |x| x[/^(\\d+\\W){4}.*[^.]/] }.\n map {|x| s = x.split(\"\\t\"); [s.third, s.last] }.\n select { |x| !['.', '..'].include?(x.last) }.\n ...
[ { "docid": "d56f53b8d294cc00cee5ea38e5b201f1", "score": "0.70409167", "text": "def fetch_files(pathid=nil)\n path = pathid.nil? ? 'path=\\\"\\\"':\"pathid=#{pathid}\"\n command = pipe_to_bconsole(\".bvfs_lsfiles jobid=#{jobids} #{path}\")\n @files = exec_command(command)\n end", "title": "...
8a35816880c108fc9074100af0d35c5d
Constant Dance! Now that the octopus is warmed up, let's help her dance faster. Use a different data structure and write a new function so that you can access the tentacle number in O(1) time. fast_dance("up", new_tiles_data_structure) > 0 fast_dance("rightdown", new_tiles_data_structure) > 3
[ { "docid": "e174617890b565909340d36c505cf29c", "score": "0.7467746", "text": "def fast_dance(direction, tiles_hash)\n tiles_hash[direction]\nend", "title": "" } ]
[ { "docid": "19dca5c02963944e1c0e1f6dcbfaa330", "score": "0.7542448", "text": "def fast_dance(tile_direction, tiles_hash)\n tiles_hash[tile_direction]\nend", "title": "" }, { "docid": "237a9bd47d31f55390829e7e4626725e", "score": "0.7508087", "text": "def fast_dance(direction, tiles)\...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a19bb9fc249cdbd63f7b17b1df034cae", "score": "0.0", "text": "def volunteer_params\n params.require(:volunteer).permit(:openid, :name, :tel, :commun, :neighborhood)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.69792545", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6781151", "text": "def strong_params\n params.requ...
dffe0ed0ce7b2f755ba2d3754309077d
def select_category_from_projects "SELECT category FROM projects;" end Make sure each ruby method returns a string containing a valid SQL statement.
[ { "docid": "3d12b9a2b126d3571d839ae43ade8e85", "score": "0.0", "text": "def selects_the_titles_of_all_projects_and_their_pledge_amounts\n\"SELECT title, SUM(pledges.amount) AS total_pledges\n FROM projects JOIN pledges ON projects.id = pledges.project_id\n GROUP BY projects.title;\"\nend", "title": ...
[ { "docid": "03c5c84d5a69ee78a061f3374b5d0ed1", "score": "0.7242144", "text": "def selects_the_category_names_and_pledge_amounts_of_all_pledges_in_the_music_category\nsql = <<-SQL\nSELECT projects.category, pledges.amount \nFROM projects \nINNER JOIN pledges\non projects.id = pledges.project_id\nWHERE pr...
48b32c725d179acaeac226479a4b5211
Executes a command based on flags or arguements
[ { "docid": "901cb80c821b42e6c4fa04a045d4df96", "score": "0.0", "text": "def do_terminal_output\n if (@all_output || @specify_index || @edit_flag || @count_flag || @headers_flag || @entries_flag) && (@file_name != nil)\n # Set exit status to true to prevent main program loading\n ...
[ { "docid": "a71012e052ac544468ff4bb5eba6d039", "score": "0.7155935", "text": "def run(command_string, *args); end", "title": "" }, { "docid": "a71012e052ac544468ff4bb5eba6d039", "score": "0.7155935", "text": "def run(command_string, *args); end", "title": "" }, { "docid":...
4640b8265028610719bcc4f936bcac34
==== Description Return the status of any current uploads, along with recent history, any pending uploads and detail the automated upload time.
[ { "docid": "1a14344dd664e33c743e30e3f4d2ae2a", "score": "0.80832493", "text": "def status\n { history: @history.recent(5),\n uploading: @uploader.status,\n host: @uploader.host,\n pending: pending_status_to_hash,\n upload_at: 'See Cron' }\n en...
[ { "docid": "17d0d59333eef94c4ae3b83c30f50f3b", "score": "0.63973695", "text": "def get_status\n\n #Create status file if needed...\n begin\n status_hash = YAML::load_file(status_file)\n rescue\n save_status\n status_hash = YAML::load_file(status_file...
c39de4914dd6d6a154e75f1538223aee
Creates SSH keys that are shared between hosts
[ { "docid": "55393747a0dd5488a52f86894a689079", "score": "0.73525226", "text": "def create_ssh_keys(config)\n system(\"ssh-keygen -t rsa -N '' -f id_rsa\") unless File.exist?('id_rsa')\n\n config.vm.provision 'ssh', type: 'shell', inline: <<-SHELL\n mkdir -m 0700 -p /root/.ssh\n cp /vagrant/id_rs...
[ { "docid": "3d3a1adb81a9d1a09399d1649adf5903", "score": "0.7920686", "text": "def create_ssh_setup\n command = \"echo 'y\\\\\\n' \\| ssh-keygen -f /tmp/#{@name_args[0]}.key -N \\\"\\\" -P \\\"\\\"\"\n result = run_remote_command(command)\n\n if config[:username].eql? \"root\"\n ...
f2ba68e908d8de8583d85eedb7ace9fe
Populated with the `receiver` for defining singleton methods. In the method source, this would be something that looks like `def self.foo` where `foo` is the method name, and `self` is the receiver. Since we're copying with source, the presence of this determines _where_ to define the new method on the target.
[ { "docid": "49d9b7fce852c604b9f2a55d7385db81", "score": "0.5936463", "text": "def singleton_receiver\n @_singleton_receiver ||= singleton? ? ( method_source[receiver_rgx, 2] || '' ) : ''\n end", "title": "" } ]
[ { "docid": "bd55a0e564af7584c1e8b964134979b5", "score": "0.6677908", "text": "def copy!\n location, line = definition.source_location\n\n target.module_eval corrected_source, location, line\n\n attach_helper_module!\n\n remove_from_origin! if remove?\n\n return method_name\n ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "8255b2df4d4eb96519a8f2898011ed8a", "score": "0.0", "text": "def bottle_reading_params\n params.require(:bottle_reading).permit(:photo)\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...
5823c75f7437cf9f59a185b6d2ebf8b8
GET /posts/1 GET /posts/1.json
[ { "docid": "bb4540fe91a2c2558ee49b7366b60ee2", "score": "0.0", "text": "def show\n \n end", "title": "" } ]
[ { "docid": "c884d3048f42b4b1b768c271940bbed7", "score": "0.7437435", "text": "def show\n post_id = params[:id]\n render json: V1::Post.get_a_post(post_id)\n end", "title": "" }, { "docid": "fb578f587fdfe1b0a8d3ac27001f9611", "score": "0.736332", "text": "def index\n ...
636fba7ec7790e5ecb371408d5201500
Retrieve an array of all available hooks
[ { "docid": "765eaf3771d1036dc77addc858496e0b", "score": "0.0", "text": "def index()\n method_url = @resource\n return self.get(method_url)\n end", "title": "" } ]
[ { "docid": "7ab38c200aca6d86a74902b03784e7b4", "score": "0.8259271", "text": "def hooks\n []\n end", "title": "" }, { "docid": "09f77aa7ad84554354c2d86db6c402ef", "score": "0.8186221", "text": "def hooks\n @hooks ||= []\n end", "title": "" }, { "docid": "0...
ec2dc1af8896f326bf1bf8927b5896f2
Checks piece shown on board and returns a class
[ { "docid": "8e9a7f1393ca8172a880ae09b9dde7f2", "score": "0.0", "text": "def piece_shown(lib,index)\n lib[index]\n end", "title": "" } ]
[ { "docid": "6398d80297244efc8f3dbc0165cc1697", "score": "0.74872166", "text": "def your_piece(sq)\n piece = @board.get_piece(sq)\n piece.color == self.color\n end", "title": "" }, { "docid": "b9c7a7accd35ad02f214c92766b3c97f", "score": "0.7136828", "text": "def pieces(color)\n...
88bbf4301f2a537e69ce053318b78caf
Returned when trying to change your nickname to a nickname that someone else is using.
[ { "docid": "9d9abc82e0152ea262632482a83083a4", "score": "0.67976034", "text": "def say_nickname_is_already_in_use\n reply cmd: '433', params: ['Nickname is already in use.']\n end", "title": "" } ]
[ { "docid": "d911f30105e67f3ec0b66ad5af74dc09", "score": "0.7672287", "text": "def change_nick(context, nick)\n raise ClientError.new(\"Can't change nick name. The connection is not yet registered.\")\n end", "title": "" }, { "docid": "cc5964c611891df897dfb8ee7269f3c4", "score...
5626ca77096c74a22b09dea0c8268d6f
DELETE /exercise_log_entries/1 DELETE /exercise_log_entries/1.xml
[ { "docid": "6902ca2826393583d3a566a9e1a09c93", "score": "0.7423084", "text": "def destroy\n @exercise_log_entry = ExerciseLogEntry.find(params[:id])\n @exercise_log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(exercise_log_entries_url) }\n format.xml { head :o...
[ { "docid": "01cb3d843f0feb3447ccb9a995dd6990", "score": "0.6703327", "text": "def destroy\n @log_entry = LogEntry.find(params[:id])\n @log_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to(log_entries_url) }\n format.xml { head :ok }\n end\n end", "title": ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "df9f52c37ed62c74493eda2a87220103", "score": "0.0", "text": "def set_has_answers_set\n @has_answers_set = HasAnswersSet.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...
79e84ed2970022eb00b41b0a5ee1514d
Stores the given block as a constructor for a new renderer. When MarkdownRails.renderer.call(text) is called this block is executed and passed +text+.
[ { "docid": "938139e7e15c245e062fa18bb6760c51", "score": "0.6355079", "text": "def render(&block)\n self.renderer = block\n end", "title": "" } ]
[ { "docid": "d5a27336a01a46437abfa8296bc6ed9c", "score": "0.62405384", "text": "def block(name, &block)\n klass = SuperbTextConstructor.block(name, &block)\n @blocks << klass\n klass\n end", "title": "" }, { "docid": "161441f4c9661a024b822e2a59b422d8", "score": "0.579082...
b288281ca36d30f4917bdc9e9d90b0f0
GET /replacements GET /replacements.json
[ { "docid": "a2ecaabe4feee114658a3cd01e3d4917", "score": "0.69184935", "text": "def index\n @replacements = Replacement.all\n end", "title": "" } ]
[ { "docid": "39dd83b7b731e3da710c0505f31e672d", "score": "0.66512835", "text": "def create\n @replacements = replacements_params.map do |replacement_params|\n Replacement.create(replacement_params)\n end\n\n respond_to do |format|\n if @replacements.all?(&:persisted?)\n format.j...
21bb5a5cac4ffa1387c11f99dafe553b
GET /api/v2/cashier/orders GET /api/v2/cashier/orders.json
[ { "docid": "ee6346dc03d066fe369d88f617ba9b9c", "score": "0.0", "text": "def index\n @orders = if current_employee\n Order.where(shop_id: current_employee.shop_id).newest_first.per_page(params[:page])\n elsif current_manager\n Order.where(organization_id: cur...
[ { "docid": "4519c4984f3d701c2f52f2db172695b3", "score": "0.8026243", "text": "def orders\n get_request 'orders'\n end", "title": "" }, { "docid": "a047be95b02ef7f42120c754057fc92e", "score": "0.7959717", "text": "def my_orders\n response = request_get(\"/api/v1/orders/my\"...
f9258d92ff669fa2c5a990ab57674e36
The number published by a curator that day (status change from 'curation' to 'published' by a curator and not the system)
[ { "docid": "65766410e38be57a810fa14187e1b1cc", "score": "0.0", "text": "def populate_datasets_to_published\n update(datasets_to_published: datasets_transitioned(from_status: 'curation', to_status: 'published'))\n end", "title": "" } ]
[ { "docid": "04ea94c6dddeeaf07c5412651c9a5f1d", "score": "0.6045013", "text": "def publication_status\n if published? \n \"Published at #{published_at}\" \n else \n \"Unpublished\" \n end\n end", "title": "" }, { "docid": "a1b17d1bc6a3d9dc58ea30ba5b738b4e", "score": "0....
7e8caaedd758c812d097852614e86c1b
BEFORE MAKING A MOVE, WE NEED TO SEE IF THE GAME HAS ENDED Check for a full board
[ { "docid": "739ecb08c562632787615c564e74bad5", "score": "0.0", "text": "def board_full?\n for row in 0..2\n for col in 0..2\n # Board_full = false when there are empty positions\n if @board[row][col] == EMPTY_CELL\n return false\n end\n end\n end \n #Return true when th...
[ { "docid": "6d3bea210100dc815e441f315c2b49b4", "score": "0.8160609", "text": "def full? #check if the board is full\n @board.each_with_index do |position, index|\n if position_taken?(index) == false \n return false\n end\n end\n return true\n end", "title": "" }, { ...
1e0c80cebed8783b6ea8eef1596c1bff
Public: Convert this object to a hash with string keys
[ { "docid": "3db1a67b820f37991410def7f79fe36d", "score": "0.79655445", "text": "def to_h_with_string_keys\n result = {}\n to_h.each { |key, val| result[key.to_s] = val }\n result\n end", "title": "" } ]
[ { "docid": "daedbd385d602c5d0b00bf604e3cbe54", "score": "0.73192626", "text": "def to_hash; end", "title": "" }, { "docid": "daedbd385d602c5d0b00bf604e3cbe54", "score": "0.73192626", "text": "def to_hash; end", "title": "" }, { "docid": "daedbd385d602c5d0b00bf604e3cbe54",...
65d1728656e0e44eac57def0bffd6f4c
This user's leaderboard, returned as a UserLeaderboard object
[ { "docid": "ae1e534382807a6537e5ea6798c53e3d", "score": "0.8141898", "text": "def leaderboard\n HQTrivia::User::Leaderboard.new(@data['leaderboard'])\n end", "title": "" } ]
[ { "docid": "b6d25a703d4c9401cfef4578ab3551ce", "score": "0.78736115", "text": "def leaderboard(neighbors = nil)\n get('users/leaderboard').leaderboard\n end", "title": "" }, { "docid": "54e3dd607a913f9a33e79a5cbc57e4fa", "score": "0.76381975", "text": "def leaderboard opt...
c3871d5222723b5d7f73ef24ab11e035
Add more helper methods to be used by all tests here...
[ { "docid": "fad531dd6e1e00b2c20afbb60fca8a07", "score": "0.0", "text": "def login_as(user)\n User.create(username: 'user', password: 'test', password_confirmation: 'test')\n post sessions_url, params: {username: 'user', password: 'test'}\n end", "title": "" } ]
[ { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", "score": "0.701972", "text": "def helpers; end", "title": "" }, { "docid": "62158baafece84b452b305badc5dd98c", ...
1fe51f14bc440f48b94cb3c5e48c897a
Move a piece to new destination
[ { "docid": "5ef75c6ff56d49c78c81011fcc2c5ae8", "score": "0.0", "text": "def move_piece(destination) # remember to check on_board here\n slide_pos_list = self.move_vector_slide.map { |dir| add_vector(self.pos, dir) }\n jump_pos_list = self.move_vector_jump.map { |dir| add_vector(self.pos, dir) }\n ...
[ { "docid": "238f574d707aa6ca71824f4062f909a3", "score": "0.8022983", "text": "def move_piece!(current_pos, destination_pos)\n piece = self[ current_pos ]\n self[ current_pos ] = null_piece\n self[ destination_pos ] = piece\n piece.position = destination_pos\n end", "ti...
a3020d9bd95089032b7e33a09545dc2f
def get_random_principal_id_for_role(name_space, role_name) principal_ids ||= role_service.getRoleMemberPrincipalIds(name_space, role_name, StringMapEntryListType.new) principal_ids.sample end
[ { "docid": "28d10fc165db94c63d136717e756cb6e", "score": "0.0", "text": "def get_principal_name_for_principal_id(principal_name)\n identity_service.getEntityByPrincipalId(principal_name).getPrincipals().getPrincipal().get(0).getPrincipalName()\n end", "title": "" } ]
[ { "docid": "64f3d390e59db6fcfd3f54e9a1e42907", "score": "0.64833045", "text": "def pick_role\n @roles.shuffle.first\n end", "title": "" }, { "docid": "2883d3d82e48b08fe807d51ef5382166", "score": "0.59520864", "text": "def get_role(service_id, role_name)\n response = requ...
7e02d242e9865c9ad80f736893754f49
Tries to enter the barrier. It will block if it is not open or just return otherwise.
[ { "docid": "c2c3fc0988a74464b60faf68812dec9a", "score": "0.0", "text": "def wait_for(name)\n @mutex.synchronize do\n while @notified[name] == false do\n @cond.wait(@mutex)\n end\n end\n end", "title": "" } ]
[ { "docid": "6feeae931ac2d60217a4c785c34ee0f3", "score": "0.63771737", "text": "def open_and_wait\r\n open\r\n Fiber.yield until open?\r\n end", "title": "" }, { "docid": "1e995d3d65ed2b3448418bf30a856080", "score": "0.60032344", "text": "def try_lock\n return false if @ho...
c1b53f71b64f744cf64b3fb7c9613ed5
GET /allergen_warnings/1 GET /allergen_warnings/1.json
[ { "docid": "807d73ef726c59d20491251fb560ba57", "score": "0.7105071", "text": "def show\n @allergen_warning = AllergenWarning.find(params[:id])\n\n render json: @allergen_warning\n end", "title": "" } ]
[ { "docid": "a1aedf3993d2251b2c6b7bd4bd2e8e64", "score": "0.765964", "text": "def index\n @allergen_warnings = AllergenWarning.all\n\n render json: @allergen_warnings\n end", "title": "" }, { "docid": "91bfa2932c7731601a30034e90d926fd", "score": "0.677979", "text": "def handle_...
480f6fea1c0c162432127d28629327de
remove the lowestpriority item from the cache
[ { "docid": "141770cde2db6f56a7726fe0844a639f", "score": "0.0", "text": "def evict\n node=tail.pnode\n @eviction_bytes+=node.value.memory_size\n @eviction_count+=1\n delete tail.pnode.key\n end", "title": "" } ]
[ { "docid": "7d6100d0792eb3b05ca0858dcc72ca62", "score": "0.7524348", "text": "def delete_min_return_key\n return nil if empty?\n\n min_value = @heap.remove!.value\n @priority_map.delete(min_value)\n min_value\n end", "title": "" }, { "docid": "d594e3a5982c3b026513cde4a52f0e0f", ...
c4ca57998f68d74561ef5213b47a35f3
Attaches this disk image and mounts all its volumes at the default mount point (+/Volumes+) or at the mount point specified with :mountpoint, unless :nomount is set to true. Options: readonly, nomount, mountpoint
[ { "docid": "30f188c502cf52fe8f70ae8f24bff855", "score": "0.7386357", "text": "def attach options = {}\n opts = {\n :readonly => false,\n :nomount => false\n }.merge!(options)\n args = [@image_path, '-mount']\n args << (opts[:nomount] ? 'suppressed' : 'required')\n ...
[ { "docid": "8fd4c5b1bebe34e7edac2318fc69af9b", "score": "0.7303152", "text": "def mount options = {}\n opts = {\n :force_readonly => false\n }.merge!(options)\n args = []\n args << 'readOnly' if opts[:force_readonly]\n args << opts[:mountpoint] if opts.has_key?(:mo...
ff9169e130db6d899cfd0833301fcd47
return true or false for the caller
[ { "docid": "bf8ca92cd0fb415453ca7781bab04623", "score": "0.0", "text": "def update_and_send_to_terminal(expired_timestamp: expired_timestamp, duration: duration, status: status, account_id: account_id)\n transaction do\n account_id ||= self.account_id\n\n #因为要发送给终端 duration(用户上网时间), 所以要先upd...
[ { "docid": "e5057d31cb8f89f8f859c18a516afcda", "score": "0.79516417", "text": "def ret?\n false\n end", "title": "" }, { "docid": "0c72714438f7a631e75ffb43f79a850b", "score": "0.78986603", "text": "def ret?\n true\n end", "title": "" }, { "docid": "f1738b6ed3a32d0...
61c89fe86fa279e1cc341a74a40b358d
Deserializes the data based on type
[ { "docid": "03862ead1ea00c038215c579c55497f9", "score": "0.0", "text": "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n value.to_i...
[ { "docid": "8310779c7783e884ba8c96184c4c100f", "score": "0.73318094", "text": "def _deserialize(type, value)\n case type.to_sym\n when :DateTime\n DateTime.parse(value)\n when :Date\n Date.parse(value)\n when :String\n value.to_s\n when :Integer\n val...
10b8a8b19b6b8abad457de299e4ab8a2
Init params based on existing location.
[ { "docid": "daa98f647b1388e2bdf88e11ff6417c9", "score": "0.6691535", "text": "def update_params_from_loc(loc)\n { id: loc.id,\n location: {\n display_name: loc.display_name,\n north: loc.north,\n west: loc.west,\n east: loc.east,\n south: loc.south,\n hi...
[ { "docid": "8fb4989df0b1b036ce4942da036d195e", "score": "0.72179455", "text": "def init_params(params)\n super\n end", "title": "" }, { "docid": "8fb4989df0b1b036ce4942da036d195e", "score": "0.72179455", "text": "def init_params(params)\n super\n end", "title": ""...
3cb5eac78ae875f6a872d6c227a1a957
GET /maps GET /maps.json
[ { "docid": "fc3da3279974309ce1acc4887491c335", "score": "0.743072", "text": "def index\n @maps = Map.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @maps }\n end\n end", "title": "" } ]
[ { "docid": "d78555050a1a8ba202fd23daf703dec7", "score": "0.7463426", "text": "def map\n url = \"https://maps.googleapis.com/maps/api/js?key=#{ENV['GOOGLE_MAPS_API_KEY']}&libraries=geometry\"\n render plain: https_get(url, verify: false).body, content_type: 'text/javascript'\n\n rescue StandardErr...
d8123c0400032d7a4faf6350c802e1c0
snake case (all lower cases + underscores in place) all lower case
[ { "docid": "5ebfd72d5530585b447107422d8e1b4a", "score": "0.0", "text": "def multiply(a, b)\n a * b\nend", "title": "" } ]
[ { "docid": "b200c0ea96c3b4230d3feae5e64ba0b5", "score": "0.8735863", "text": "def snake_case\n gsub(/([A-Z]+)([A-Z][a-z])/, '\\1_\\2')\n .gsub(/([a-z\\d])([A-Z])/, '\\1_\\2')\n .tr('-', '_')\n .gsub(/\\s/, '_')\n .gsub(/__+/, '_')\n .downcase\n end", "title...
8a185f0d852be6a786a9afa605a838ec
You probably just ended up rewriting some of the same code. Move this repeated code into a method that accepts a direction and a list of trains as arguments, and returns a list of just the trains that go in that direction. Call this method once for north and once for east in order to DRY up your code.
[ { "docid": "e1a937d06209d2646b8db3a9b0046753", "score": "0.560753", "text": "def train_direction(direction, list)\n# need to re-use the previous array iteration using .select but pass in the input variables of the list and direction which is string\n which_way = list.select {|train| train[:direction] =...
[ { "docid": "e584448bfb7864f3a72c406b781204e5", "score": "0.7024359", "text": "def get_north_trains(array)\n trains_north = []\n array.each do |item|\n if item[:direction] == \"north\"\n trains_north.push item[:train]\n end\n end\n return trains_north\nend", "title": "" }, { "d...
0ddc0b45708ab151e11d85775d64c8c3
Fetches remote app version from metadata
[ { "docid": "8d89459c9d71ff551484ff8c7d1ecaa8", "score": "0.7841525", "text": "def fetch_app_version(options)\n metadata = AppRepo::Uploader.new(options).download_manifest_only\n FastlaneCore::UI.command_output('TODO: Parse version out from metadata')\n puts JSON.pretty_generate(metadata) ...
[ { "docid": "0a6bf164427953bc93363e9e9d8efa51", "score": "0.7232519", "text": "def get_rem_ver(app_name)\n app_url = get_app_url(app_name)\n if $verbose == 1\n puts \"Getting version (or date) of latest release from #{app_url}\"\n end\n rem_ver = eval(\"get_#{app_name.downcase.gsub(/ |-/,'_')}_rem...
1bba5f0bd1a46ad064c3d82cad476e4a
Public: processes a collection against a schema schmea the hashrepresentation of a schema file Opens each file in the collection's expected directory and checks the file's frontmatter for the expected keys and the expected format of the values. Returns true or false depending on the success of the check.
[ { "docid": "d32e095fd1c62c446998ed3d950700b6", "score": "0.6139568", "text": "def process(schema)\n \tdir = File.join(schema['config']['path'])\n \tpassfail = Array.new\n \tDir.open(dir).each do |f|\n \t\tfile = File.open(File.join(dir, f))\n \t\tunless schema['config']['ignore'].include?...
[ { "docid": "640d8e99e796aa97e036f7b9d23daa47", "score": "0.6047762", "text": "def process(options)\n # Adjust verbosity for logging quickly\n Jekyll.logger.adjust_verbosity(options)\n\n @processed = true\n config = Jekyll.configuration\n unless conf...
d95cc0120c0a31f33c2d3c732e47efa5
===quickSort! Destructive version of quickSort. Modifies list inplace.
[ { "docid": "a7069a66a4a715693026f7dab8cfa480", "score": "0.68767995", "text": "def quickSort!(time=false,verbose=false,visual=false,randomize=false)\n\t\tstartTime = Time.now if time\n\t\ttarget = self\n\t\tif randomize\n\t\t\ttarget.length.times do |i|\n swapPos = rand((target.length) -i...
[ { "docid": "579c1efc5752437103984b1998f8b091", "score": "0.7515107", "text": "def quickSort(list)\n\nend", "title": "" }, { "docid": "11bc893b8569d36cd31bcda41f39fa80", "score": "0.7075705", "text": "def quicksort\n ->(xs) {\n if empty?.(xs)\n empty\n ...
a280f1ea363acf8553590e5e41d9f572
Axis size = length of the longest point value , formatted as a string to
[ { "docid": "5a0561847c0a65b0e250ad8dbcd0a2ca", "score": "0.6606906", "text": "def calculate_axis_size\n return if dataset.empty?\n border_right = dataset.map { |n| n.round(decimals).to_s.length }.max\n border_right += 3\n\n # Clamp border_right at cols - 3 to prevent the rend...
[ { "docid": "f3625fc51eb9fa480ce4a892908d75c1", "score": "0.6285356", "text": "def to_s; \"#{@len}.#{@scale}\" end", "title": "" }, { "docid": "46070e2948c08c5c1d8a43d5192e30dc", "score": "0.6233579", "text": "def max_y_label_width_px\n return font_size if rotate_y_labels\n ...
3e47eb2ad6c4ec071896be75252fc55d
Retourne la portion d'explication d'une section
[ { "docid": "c070cc6e2778af6daf0de12bdf81a557", "score": "0.5703279", "text": "def explication_section(section_name)\n path = template(\"textes_types/explication_#{section_name}.md\")\n div(kramdown(path),'explication-section')\nend", "title": "" } ]
[ { "docid": "fd1c1abf2b4b028e463ad7ac38d59907", "score": "0.66863906", "text": "def section(p0) end", "title": "" }, { "docid": "47e6ed301484eed11cbee81206b1e095", "score": "0.6041815", "text": "def portion? = unit == 'portion'", "title": "" }, { "docid": "ca5be946baab14c3...
94283448af4349c3dcd81836ef312c6c
Creates a volume according to specifications and blocks until done (or times out)
[ { "docid": "f0f1323c067692a6c4520eeb66011bb1", "score": "0.7481217", "text": "def create_volume(snapshot_id, size, availability_zone, timeout, volume_type, piops, throughput, encrypted, kms_key_id)\n availability_zone ||= node['ec2']['placement_availability_zone']\n\n # Sanity checks so we don't s...
[ { "docid": "9188b52977ccc5ae79eba2cc4f2db6ab", "score": "0.81088275", "text": "def create_volume(name, size, wait_for = true)\n volu = volume_connection(new_resource.connection)\n v = volu.create_volume(new_resource.name, new_resource.name, new_resource.size.to_s)\n vol_id = v.body['volume']['id']\n ...