query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "72fda91b57808b8ac196acb565649dc4", "score": "0.0", "text": "def assistive_technology_params\n params.require(:assistive_technology).permit(:title, :description, :link, :version, :platform_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...
a62dad16ad2f706ab34cbf18c24fca4c
Baseline implementation for the get_config REST call
[ { "docid": "bc7da1e00292c08b7181c7106d6449da", "score": "0.0", "text": "def get_config request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_get_config_request requ...
[ { "docid": "49b0e6ee1d434f7fdec5afd912a33549", "score": "0.7771415", "text": "def get_config\n\t\tend", "title": "" }, { "docid": "c95c53e41027b5a70f6fc2a802e51e41", "score": "0.76797634", "text": "def get_config\n # TODO\n end", "title": "" }, { "docid": "d76d2...
10973dabb7387d5883116a9aeabc458d
Determine whether cone angle limits are enabled.
[ { "docid": "f8f6d5bad2caeee4773461b1a0c1008d", "score": "0.7411205", "text": "def cone_limits_enabled?\n MSPhysics::Newton::BallAndSocket.cone_limits_enabled?(@address)\n end", "title": "" } ]
[ { "docid": "4d1b409339f18fbfbce277b0c949cd32", "score": "0.6962109", "text": "def acute?\n angles.max < 90.0\n end", "title": "" }, { "docid": "84c6fdd572758c09ea4df44ea0231605", "score": "0.6583908", "text": "def obtuse?\n angles.map(&:degrees).max > 90.0\n e...
6136f92857126ae4e7535198ea4b3af3
POST /comments or /comments.json
[ { "docid": "e19583af4db250d6b0f220455e98cdd0", "score": "0.65492755", "text": "def create\n @comment = Comment.new(comment_params)\n if @comment.save\n render json: @comment, status: :created\n else\n render json: @comment.errors.messages, status: :unprocessable_entity \n ...
[ { "docid": "1dc51da19a504ab678dfb46bd871a15f", "score": "0.7087207", "text": "def postComment(cardId, commentText)\n\tresponse = RestClient.post(\n\t\t'https://api.trello.com/1/cards/'+cardId+'/actions/comments',\n\t\t:text => commentText,\n\t\t:key =>$key,\n\t\t:token =>$token\n\t)\n\tresponse = JSON.p...
aa8ce9e53bd6e7e44f1232a2287f68f9
configures the connection for the Campfire lobby we are connecting to from a Yaml configuration file
[ { "docid": "e78b9fdfeda2899a51296a1640e05ec7", "score": "0.6115565", "text": "def initialize_connection_from_file(file_path)\n raise Errno::ENOENT unless File.exists?(file_path)\n file = File.open(file_path)\n config = symbolize_keys(YAML::load(file.read))\n self.initialize_c...
[ { "docid": "d1349522d1b3467d43c286bc04256bd0", "score": "0.65760213", "text": "def set_connection()\n ::Jenkins::Client.configure do |c|\n c.username = self[:username]\n c.password = self[:password]\n c.url = self[:url]\n end\n end", "title": "" }, {...
60adff949ef3394ae32c0e0e70d5753e
GET /questionary_results GET /questionary_results.json
[ { "docid": "0f0dc1d7a190cf832083759c00ae1013", "score": "0.6415661", "text": "def index\n\t\t@questionaries = Questionary.all\n\tend", "title": "" } ]
[ { "docid": "05b41fc23bf2ed20b300091132c12ab9", "score": "0.7260953", "text": "def index\n\t\tquestionId = params[:questionId];\n\n\t\tanswers = ParseManager.getAnswersForQuestion(questionId);\n\t\tresults_array = answers['results']\n\n\t\t# make the answers into integers if that is what they are\n\t\tbe...
35ef66e1eca40da6e57bed985d3bccd7
Second section of the label page, containing 5 blocks
[ { "docid": "e16a39d507d8026805fa03ef05869c91", "score": "0.7315702", "text": "def sec2\n label5\n label6\n label7\n label8\n # label9\n end", "title": "" } ]
[ { "docid": "5218b704067bbd2d39b3b22e6c7ef4fa", "score": "0.7190614", "text": "def sec1\n label1\n label2\n label3\n label4\n label5\n label6\n label7\n end", "title": "" }, { "docid": "1205eaa064103ce4136c38de341c0d44", "score": "0.7079353", "text": "def sec1\n ...
4567794aa1284e2a8f5d436ef4843060
Draw a triangular surface plot.
[ { "docid": "1a97639836da1be7e08488e73bdded19", "score": "0.66783357", "text": "def plot_trisurf; end", "title": "" } ]
[ { "docid": "5056938806c02c5b0a7e5d0011d79a00", "score": "0.64786583", "text": "def trisurf(*args)\n create_plot(:trisurf, *format_xyzc(*args))\n end", "title": "" }, { "docid": "a5c0011a71cef0bc690a02288fdf9cb0", "score": "0.64770144", "text": "def plot_surface; end", "ti...
7662cb9d444fc539feffe39b01f4ad1f
Match score count validation
[ { "docid": "23dd6d567111491e8ad27142dc65d609", "score": "0.73241407", "text": "def match_scores_are_at_match_count\n match_count = League.find(league_id).match_count\n\n # Make sure that scores can't be negative. \n if p1_score < 0 || p2_score < 0\n errors.add(:match_score, \" cannot be n...
[ { "docid": "98b2abcb9239fb5d66838b89b6907aea", "score": "0.7080858", "text": "def match_score(val); end", "title": "" }, { "docid": "98b2abcb9239fb5d66838b89b6907aea", "score": "0.7080858", "text": "def match_score(val); end", "title": "" }, { "docid": "a09a3eebf74e27cdde...
c65c87e3208a0174c29d859e263ca83c
Check if the provided IP is safe or unsafe?
[ { "docid": "47b8f5a33ab347c565081d110fcfeb93", "score": "0.7322728", "text": "def unsafe_ip?(item, options = {})\n return [:ip, item] if in_pool?(:ip, item)\n return unless options.fetch(:smarter, true)\n\n found = contained_in_network?(item)\n return [:in_network, found] if found\n ...
[ { "docid": "72ecebc02987360befd9e82886450184", "score": "0.7768043", "text": "def check_ip; end", "title": "" }, { "docid": "a8d08b700bb282a7c45bcdb3f1315c14", "score": "0.7563506", "text": "def okIP(addr)\nreturn addr != \"0.0.0.0\" &&\n addr != \"255.255.255.255\" &&\n ...
3baf6794acb75af8c0ffc77ba270ebe4
method to check page title and return message corresponding to the result if requested page is found then check title if requested term is a part of page title then add success message otherwise add error message otherwise add message that there is nothing to check.
[ { "docid": "a84e0bd6732eedf8405cd75bb2b810c6", "score": "0.7576456", "text": "def check_page(title)\n if @found\n if @driver.title.include? title\n @result = @result.to_s + ' Page verification: correct page!'\n else\n @result = @result.to_s + ' Page verification: wrong page!'\...
[ { "docid": "c7c21abd2a9662f9b1942608467064a3", "score": "0.66268176", "text": "def title_with_page_title_check\n return @page.title if @page && !@page.title.blank?\n title_without_page_title_check\n end", "title": "" }, { "docid": "c7c21abd2a9662f9b1942608467064a3", "s...
99c460fbef30a30c575b72ceabcd3176
a way to define configurations for keytar using a hash
[ { "docid": "a2854a0312aaac4c0131eb9af9d5822a", "score": "0.60674024", "text": "def key_config(options = {})\n # allow for loose naming of keys configuration symbols can use :key_prefix or just :prefix\n options.keys.each do |key|\n options[\"key_#{key}\".to_sym] = options[key] if key.to...
[ { "docid": "77f54e3fe68c3a5842497d0cddd00b3c", "score": "0.6817519", "text": "def create_config hash\r\n hash=transform_docker_hash hash\r\n \r\n create_config_for_port hash\r\n \r\n create_config_for_volumes hash\r\n \r\n hash\r\n end", "title": "" }, { ...
9628d660b00cd82c3bc316b55cafb8b2
DELETE /etiquetas/1 DELETE /etiquetas/1.xml
[ { "docid": "524c40cc3a29f86726000d44b7d6f829", "score": "0.71953785", "text": "def destroy\n @etiqueta = Etiqueta.find(params[:id])\n @etiqueta.destroy\n\n respond_to do |format|\n format.html { redirect_to(etiquetas_url) }\n format.xml { head :ok }\n end\n end", "title": "" ...
[ { "docid": "5ccc2947f5ee20031807fa3c14702c72", "score": "0.7110815", "text": "def destroy\n @etiquetum = Etiquetum.find(params[:id])\n @etiquetum.destroy\n\n respond_to do |format|\n format.html { redirect_to(etiqueta_url) }\n format.xml { head :ok }\n end\n end", "title": ""...
c3afad34f80662e1e50ffddbd17d3a2f
Highlevel Commands Myself (usually allowed by server)
[ { "docid": "09d510b1a1988a2820ca52d573b22195", "score": "0.0", "text": "def send_authenticate\n super @username\n end", "title": "" } ]
[ { "docid": "5d510b0db1979d7edc1c9bb339529cd6", "score": "0.7657347", "text": "def commands; end", "title": "" }, { "docid": "5d510b0db1979d7edc1c9bb339529cd6", "score": "0.7657347", "text": "def commands; end", "title": "" }, { "docid": "5d510b0db1979d7edc1c9bb339529cd6",...
3b9af901c804beea22cac742e979946d
Refactored on a Repl
[ { "docid": "8cee301c57abe86d127e1f07c4a4c512", "score": "0.0", "text": "def hash_approach(arr)\n hash = {}\n arr.map do |e|\n hash[e] = 0\n end\n hash.keys\nend", "title": "" } ]
[ { "docid": "3ae137b1a40ff3aae4f3cbb2b6082797", "score": "0.583255", "text": "def reaper; end", "title": "" }, { "docid": "87c5c892d37a18f377224184dcea9cfd", "score": "0.55844927", "text": "def rsv1; end", "title": "" }, { "docid": "87c5c892d37a18f377224184dcea9cfd", "...
87f34c42d70b31dcad376d17d8662563
DELETE /weather_stations/1 DELETE /weather_stations/1.xml
[ { "docid": "45af07664ee3a7736a2dd200e594f9eb", "score": "0.71599895", "text": "def destroy\n @weather_station = WeatherStation.find(params[:id])\n @weather_station.destroy\n\n respond_to do |format|\n format.html { redirect_to(weather_stations_url) }\n format.xml { head :ok }\n en...
[ { "docid": "a51409055cb08342afd721cbc217df3e", "score": "0.6823617", "text": "def destroy\n @weather = Weather.find(params[:id])\n @weather.destroy\n\n respond_to do |format|\n format.html { redirect_to(weathers_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, ...
bf9da2e55225c374e48d49d59b0d8911
PATCH/PUT /zombies/1 PATCH/PUT /zombies/1.json
[ { "docid": "69ac1f2418f7152409b454fa6c62f22e", "score": "0.63899404", "text": "def update\n respond_to do |format|\n if @zombie.update(zombie_params)\n format.html { redirect_to @zombie, notice: '¡El Zombie ha sido actualizado exitosamente!' }\n format.json { render :show, status: ...
[ { "docid": "339844c0592e2a406926ef63cd3b206e", "score": "0.6746741", "text": "def update\n @zombie = Zombie.find(params[:id])\n\n respond_to do |format|\n if @zombie.update_attributes(params[:zombie])\n format.html { redirect_to @zombie, notice: 'Zombie was successfully updated.' }\n ...
e3ca608684ccaa98fadcbec22b5f62da
TODO: refactor this with the list of recurring issues
[ { "docid": "9e2b792eacb2a5c867a527b03332bf07", "score": "0.0", "text": "def categorized_issues(issue_category)\n categories = User.current.projects.map do |project|\n project.issue_categories.find(:all,\n :conditions=>[\"name ilike ?\", \"#{issue_category}\"])\...
[ { "docid": "cc35b88d2a5bb34481acf5ed01623d79", "score": "0.70419294", "text": "def fetch_closed_issues_and_pr; end", "title": "" }, { "docid": "d0b5269db630dbb263088b4011ec5876", "score": "0.66627085", "text": "def process_issues()\n issues = @doc.xpath(\"//Issue[@project='#{@@jira_...
cdf2e7c51b83cd63ea07d7a9a91a769e
initialize method stores instance variable for the secret string, stores an initially empty array of past guesses
[ { "docid": "ab15674714fc80dbc3b156316ac0b57c", "score": "0.78477323", "text": "def initialize(secret = \"default\")\n @secret = secret\n @past_guesses = []\n end", "title": "" } ]
[ { "docid": "da7333f3fde26be67b022cfe40d06947", "score": "0.773085", "text": "def initialize(secret_word)\n @secret_word = secret_word\n @secret_array = secret_word.split(//) # \"\"\n @guess_count = (@secret_array.length)\n @is_over = false\n @guessed_array = Array.new(secret_word.length, ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "c6a24bc5d8fba80bf1a710b97aa16bbd", "score": "0.0", "text": "def customer_params\n params.require(:customer).permit(:name, :complete_name, :email, :address, :state, :country)\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...
b70647e3227f099021bcfd5242649d2d
Checks if the context field in the CSV matches any of our target clients names or alias' context [String]:: The context field as a string.
[ { "docid": "776435a3172e0432cc9a5f0baa3269f7", "score": "0.6424276", "text": "def is_target_context?(context)\n match = false\n @targets.each do |t|\n reg = [ t['alias'], t['name'] ]\n regex = Regexp.new( reg.join(\"|\"), Regexp::IGNORECASE )\n match = regex.match(context)...
[ { "docid": "91941818c98ef24e4e4118f66a008c37", "score": "0.6531942", "text": "def is_target_context?(context)\n match = false\n @targets.each do |t|\n reg = [ t['alias'], t['name'] ]\n if @include_own_expenses == true\n reg.concat [ @enterprise[\"alias\"], @enterprise[\"...
17b71fb338d1e7e11f4a17481cdde76b
this one takes no arguments
[ { "docid": "57a547736f50482d4d611a2f3c80df5e", "score": "0.0", "text": "def puts_none()\n puts \"I got nothing'.\"\nend", "title": "" } ]
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7036743", "text": "def private; end", "title": "" }, { "docid": "f312ff8380843a15eedf626c6645d5a7", "score": "0.6836285", "text": "def standalone=(_arg0); end", "title": "" }, { "docid": "22eca42bc8ffb4cb933fefb36...
358a1fb2c14e173307f782a535e0fbc2
Remove the head item from the queue and return it (Last In Last Out). Uses a Mutex to access the queue so it may block.
[ { "docid": "225e7a9bd63fd3d8006ae21ff4fc8e6e", "score": "0.6367635", "text": "def dequeue_first\n @queue.shift\n end", "title": "" } ]
[ { "docid": "f4b0162db4368b0d5eb3f0d72bccac1e", "score": "0.77494776", "text": "def dequeue\n @mutex.synchronize do\n @cond.wait(@mutex) while @queue.empty?\n\n item = @queue.shift\n @unique.delete(item)\n item\n end\n end", "title": "" }, { "docid": "...
55ed0e27040e6de0f08c7181e9bd777c
Just like filter_with, but only applies the filters if the given condition is true. Syntactic sugar so you can write: filter_with_if(Rails.env.production?, :jsmin) ...or whatever
[ { "docid": "f460d4e6ebfec345d0fe0bf216cf6d1e", "score": "0.67377454", "text": "def filter_with_if(condition, filter_name, *args, &proc)\n if condition\n filter_with(filter_name, *args, &proc)\n else\n proc.call\n end\n end", "title": "" } ]
[ { "docid": "f35603b3ade671d17bc02428208556e1", "score": "0.5817456", "text": "def if(filter, &block)\n @filter = block_given? ? block : filter\n @negate = false\n self\n end", "title": "" }, { "docid": "f8542af94a7f82e446246af7096b2fdc", "score": "0.56795555", "text...
318ee058e7a33b8f9fc1c889bf41529e
GET /meetings GET /meetings.json
[ { "docid": "bafc9c7aa0ba54d85e282c8d1fbb5d37", "score": "0.6920194", "text": "def index\n # # @meetings = Meeting.all\n # # Why check params for user_holder, but then using the root user one?\n # # I assume it is root user for now.\n # if params[:user_holder_id]\n # @cur_user_holder = ...
[ { "docid": "02df1852dd6db37e99132d09308ab5e6", "score": "0.81246734", "text": "def index\n @meetings = Meeting.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @meetings }\n end\n end", "title": "" }, { "docid": "e5e1f08e813bbd4dd...
23ad5cbba1050caf00e1c68f30648c2f
1 any higher up version. 2 the specific version. 3 the version from the parent's depmanagement section. TODO: read up on the ordering of 2 and 3.
[ { "docid": "e10a4add2329603a578a2b2611b1665c", "score": "0.5823065", "text": "def resolve_version(artifact, versions)\n version = versions[artifact.key]\n version ||= artifact.version\n version ||= parent && parent.dependency_management[artifact.key]\n end", "title": "" } ]
[ { "docid": "afb57566ec1524aefe79cbd4ede1d33e", "score": "0.6420099", "text": "def required_version; end", "title": "" }, { "docid": "afb57566ec1524aefe79cbd4ede1d33e", "score": "0.6420099", "text": "def required_version; end", "title": "" }, { "docid": "df8ed08bcb56b7ee80...
4923a9f8335c327475b1c569727922a8
Check whether user has invitation
[ { "docid": "28e37c4ca8da710fbd5e5e7461c28df9", "score": "0.8380533", "text": "def has_invitation?(user)\n invitations.any? do |u|\n u.user_id == user.id\n end\n end", "title": "" } ]
[ { "docid": "faaf92ea445ecb41a53b44b07acbc21e", "score": "0.83028597", "text": "def passes_invite_reqs\n return true if @user_exists\n\n invitation = check_user_invited(\"\", session[:invite_token], @user_domain)\n invitation[:present]\n end", "title": "" }, { "docid": "8901fe9e2bee...
3d6bc7c9b526e8314feecd121405f533
GET /yoga_sessions GET /yoga_sessions.json
[ { "docid": "a5c0f3d55fab29b3a6c20e8b169843e6", "score": "0.62460923", "text": "def index\n if params[:all]\n @today = Time.now.strftime(\"%A\")\n @yoga_sessions = YogaSession.all\n elsif params[:day]\n @today = params[:day].capitalize\n @yoga_sessions = YogaSession.on_day param...
[ { "docid": "26692fe41c87727ecc3dbfb4eaa78c96", "score": "0.72504765", "text": "def index\n sessions = request do\n api.request(\n :expects => 200,\n :headers => headers,\n :method => :get,\n :path => \"/oauth/sessions\"\n ).body\n end\n styled_header(\"...
4fc1c1955c3204f750dda7a81f7b767e
GET /datum_receipts GET /datum_receipts.json
[ { "docid": "edb92a76855574de9c5d29d1acf89c3b", "score": "0.71890223", "text": "def index\n @datum_receipts = DatumReceipt.all\n end", "title": "" } ]
[ { "docid": "8c771f6d7f234dbdd2154ca7146852b2", "score": "0.6891394", "text": "def showReceipt\n render json: Approved.findReceipt(params[\"id\"])\n end", "title": "" }, { "docid": "dbefb5bd98f2e596a787df46db669c4f", "score": "0.66563183", "text": "def\n\n# *********VENUE GE...
d657fbcdc8f740d009d9682b6878d0ae
real hours is the actual hours logged on completed cards plus the estimated hours on remaining cards in this iteration this allows us to see over estimates and under estimates
[ { "docid": "f1fcbe71372972493b6c78eb5b133ba5", "score": "0.74898446", "text": "def real_hours\n actual_hours + self.remaining_hours\n end", "title": "" } ]
[ { "docid": "1397a0102ed0a9d32a9552c777fe592b", "score": "0.7803671", "text": "def actual_hours\n sum_card_field( :actual, :complete )\n end", "title": "" }, { "docid": "b2c62870ca094aa73b0af7ac71024c0b", "score": "0.7532043", "text": "def card_hours\n\tif self.cards.size > 0\n\t\...
c1f38217202f14deb296065bd13aba97
!!!!!!!!!!! if it gets a match, needs to delete it from the known cards
[ { "docid": "150f7750ddf9332f19f6b73b530e2775", "score": "0.74437755", "text": "def receive_match(pos_one, pos_two)\n @matches.push(pos_one, pos_two)\n @known_cards.delete_if { |k,v| v.include?(pos_one) || v.include?(pos_two) } #it is deleting that k/v from known_c!!!\n end", "title": "" } ]
[ { "docid": "ca5b2124c88d3cc15d3009e0c8bf7e57", "score": "0.69263625", "text": "def remove remove_card\n @cards.each_with_index do |card, i|\n if card.to_string == remove_card.to_string\n @cards.delete_at(i)\n return true\n end\n end\n false\n end", "title": "" }, ...
43923a3cd0a5eebff9bad889a304cb5c
POST /dnk_memes POST /dnk_memes.json
[ { "docid": "dd0b926e66df263780ef479058f1c6b4", "score": "0.7517403", "text": "def create\n @dnk_meme = DnkMeme.new(dnk_meme_params)\n\n respond_to do |format|\n if @dnk_meme.save\n format.html { redirect_to @dnk_meme, notice: 'Dnk meme was successfully created.' }\n format.json ...
[ { "docid": "f4c50ea38fcbc69cc586b99b6d3fc290", "score": "0.7812138", "text": "def create\n\t\tpost = current_user.posts.find(params[:post_id])\n\t\tpost_meme = post.post_memes.create(post_meme_params[:memes])\n\t\trender json: post_meme, status: :ok\n\tend", "title": "" }, { "docid": "65f921...
59b6f2a4454970ce8cba81e9ac55552b
Object packing methods Examines each ivar and converts it to a hash, array, string combo
[ { "docid": "fd3afc427f1fb06e0db99a2f516b3859", "score": "0.6743071", "text": "def _pack_properties\n self.__pack[:data] = _pack_ivars( self )\n initializations = _pack_initializations( self )\n self.__pack[:initialization] = initializations unless initializations.empty? \n end"...
[ { "docid": "d5361c14949306e8d4642ca4079ae2cf", "score": "0.7606756", "text": "def _pack_ivars( obj )\n return_hash = {}\n vars = obj.aquatic? ? obj._storable_attributes : obj.instance_variables\n vars.each do |ivar_name|\n ivar = obj.instance_variable_get( ivar_name )\n ...
64c37b8e1de9b162f198012d274ecfb8
You are a professional robber planning to rob houses along a street. Each house has a certain amount of money stashed, the only constraint stopping you from robbing each of them is that adjacent houses have security system connected and it will automatically contact the police if two adjacent houses were broken into on...
[ { "docid": "c0ebd333e1d00835651bedc84b3fbf23", "score": "0.77265024", "text": "def house_robber(nums)\n length = nums.length\n return 0 if nums.empty?\n\n return nums.first if length == 1\n\n rob1, rob2 = 0,0\n\n nums.each do |n|\n temp = [n + rob1, rob2].max\n rob1 = rob2\n rob2 = temp\n ...
[ { "docid": "3c7139b8d10391a5088c65cd1d349e10", "score": "0.7460811", "text": "def house_robber(houses)\n raise \"Please enter an array with at least one house with the amount of money it contains.\" if houses.empty?\n\n return houses.first if houses.length < 2\n\n maximums_so_far = Array.new(houses.l...
74a913816763b8caaaf83b0c0f3fb76e
Test that global configuration can be set with yaml
[ { "docid": "7144be4514c9aefb49b0bd34ee01ab7e", "score": "0.6565582", "text": "def test_configure_with\n Moodle.configure_with('test/fixtures/config.yml')\n\n assert_equal 'test_username', Moodle.config[:username]\n assert_equal 'test_password', Moodle.config[:password]\n end", "title": "" ...
[ { "docid": "5edab38eb1790477e97613d0b333d9c8", "score": "0.6872287", "text": "def test_config\n load_config\n assert(@config.key?('user'))\n assert(@config.key?('pass'))\n assert(@config.key?('port'))\n assert(@config.key?('uri'))\n assert(@config.key?('callback_host'))\n assert(@co...
33a3c1596ebe37caad2cf2184c7bc1dd
PUT /companies/1 PUT /companies/1.xml
[ { "docid": "df50bcb68ab556d5d589183ece27b9bb", "score": "0.5869893", "text": "def update\n @company = Company.find(params[:id])\n\n if @company.update_attributes(params[:company])\n flash[:success] = @company.name + \" was successfully updated.\"\n redirect_to crm_path\n else\...
[ { "docid": "508636e38100a4d806e781ddfd411c9b", "score": "0.6664095", "text": "def update\n @company = Company.find(params[:id])\n\n respond_to do |format|\n if @company.update_attributes(params[:company])\n format.html { redirect_to(@company, :notice => 'Company was successfully update...
9f546849fadba42f958e4174d474f4ac
ok, here we do it the hard way. got to have a remainder for purposes of tabcompleting full email addresses
[ { "docid": "d6cdb64446ddb89ae3972187efc12d6c", "score": "0.0", "text": "def split_on_commas_with_remainder\n ret = []\n state = :outstring\n pos = 0\n region_start = 0\n while pos <= length\n newpos = case state\n when :escaped_instring, :escaped_outstring then pos\n el...
[ { "docid": "fe63684f1b3dc341f50407611c0d7ffc", "score": "0.6315843", "text": "def email_list\n end", "title": "" }, { "docid": "39f72fd66cc1a843ed670468d45e2361", "score": "0.62855124", "text": "def fix_email_address author\n email = author['email'].dup\n email = \"unspecified@exa...
52583d0c1ed2d0f053dbb42f9c7c5e54
fh can be a FileHandle or the filename (as a string)
[ { "docid": "59768549ee54771183ee294276a5f11f", "score": "0.7149039", "text": "def file_handle=(fh)\n @file_handle = fh.kind_of?(FileHandle) ? fh : FileHandle.new(fh)\n end", "title": "" } ]
[ { "docid": "2fbe02f75cbea33418154cb4d9a9ce89", "score": "0.6714637", "text": "def fh\n fetch('FH')\n end", "title": "" }, { "docid": "12bbee71ade09abb0b75eb6e56776ccd", "score": "0.6284852", "text": "def open_file(handle)\n (handle.respond_to?(:path) ? handle : File.open(handl...
2e9a5ac986defc96c63f6d7c06cdda9f
check if next_player is current_user
[ { "docid": "f901ded351ce98d84c02aac47c45a0f6", "score": "0.684279", "text": "def check_next_player(input)\n if input[:game].next_player_id == input[:user].id\n Success(input)\n else\n Failure(\"Unexpected move from #{input[:user].login}\")\n end\n end", "title": "" ...
[ { "docid": "53708c2c514d28e29e0430223d3f4fb8", "score": "0.8446241", "text": "def is_current_player(user) \n\t\treturn user.id == self.current_player\n\tend", "title": "" }, { "docid": "c4f672ecb3bd8d75b26f63806e476383", "score": "0.81904495", "text": "def is_current_players_turn?(cu...
0647919d3183561af44f3f2565b114a9
DELETE /soil_type_certainty_factors/1 DELETE /soil_type_certainty_factors/1.json
[ { "docid": "20e9f24ee11c10c219f27cf387721150", "score": "0.7669215", "text": "def destroy\n @soil_type_certainty_factor.destroy\n respond_to do |format|\n format.html { redirect_to soil_type_certainty_factors_url, notice: 'Soil type certainty factor was successfully destroyed.' }\n forma...
[ { "docid": "e7befa52024ff8f71a70025ef68f98f7", "score": "0.6944896", "text": "def destroy\n @ecology_certainty_factor.destroy\n respond_to do |format|\n format.html { redirect_to ecology_certainty_factors_url, notice: 'Ecology certainty factor was successfully destroyed.' }\n format.json...
f632fd79d3b27fb62c1ca37a4aec694c
return all CUDs that are not course_assistants, instructors, or dropped TODO: should probably exclude adminstrators, but the fact that admins are in the User model instead of CourseUserDatum makes that difficult
[ { "docid": "55eb43b37d49b2feeb3a7bf74692b728", "score": "0.5831283", "text": "def students\n course_user_data.where(course_assistant: false, instructor: false, dropped: [false, nil])\n end", "title": "" } ]
[ { "docid": "4bb3209fbc7fb8e1e273b1214ae95f3d", "score": "0.60421306", "text": "def index\n @users = User.where.not type: 'Admin'\n end", "title": "" }, { "docid": "742304ae18ac1745932d606602ef839f", "score": "0.59082407", "text": "def full_cohort_skipping_authorization\n retur...
d494f30381ee00a1382b703afd60e13b
Determine the direct costs for a visitbased service
[ { "docid": "971c9c94a0ef249fcb3936e54f071cb9", "score": "0.82290876", "text": "def direct_costs_for_visit_based_service\n total = 0\n self.line_items_visits.each do |line_items_visit|\n total += line_items_visit.subject_count * self.direct_costs_for_visit_based_service_single_subject(line_ite...
[ { "docid": "795f9a9efdeadf0ff2548b7a32834e87", "score": "0.82886654", "text": "def indirect_costs_for_visit_based_service\n if USE_INDIRECT_COST\n self.direct_costs_for_visit_based_service * self.indirect_cost_rate\n else\n return 0\n end\n end", "title": "" }, { "docid":...
6f5c786b63284718b0e360646484e2f7
Extracts the downloaded archive file into project_dir. On windows, this is a fuster cluck and we allow users to specify the preferred extractor to be used. The default is to use tar. User overrides can be set in source[:extract] as: :tar use tar.exe and fail on errors (default strategy). :seven_zip use 7zip for all tar...
[ { "docid": "510e7c4898bab6d9257d8f1f30794bbb", "score": "0.7265715", "text": "def extract\n # Only used by tar\n compression_switch = \"\"\n compression_switch = \"z\" if downloaded_file.end_with?(\"gz\")\n compression_switch = \"--lzma -\" if downloaded_file.end_with?(\"lzma\...
[ { "docid": "f3ea97844d266cccb6d3b254b0c6353b", "score": "0.6353439", "text": "def deploy\n if downloaded_file.end_with?(*ALL_EXTENSIONS)\n log.info(log_key) { \"Extracting `#{safe_downloaded_file}' to `#{safe_project_dir}'\" }\n extract\n else\n log.info(log_key) { \"`#{sa...
120c0704f4d05edafc89ed7a1f39410a
Unpretending trucial orthotypous theologically roscoelite antiphase Lyraway rucksack copulative immense underhint saccharometric Trihydroxy upways niceness farmost donn pelargomorph
[ { "docid": "9eec73b25e3559bb3f4c74be00e57eff", "score": "0.0", "text": "def asexually_rhizosphere_betrample(freewheeler, reomit)\n unadvocated_flybelt_confucianist(uplead)\n unlistening_unwill(penetral_exsect, disappearer_nondetention)\n aphthongia_pereirine_unwarrantedly(submicroscopic_f...
[ { "docid": "8ffdfeabbab52c9f676a378164348d63", "score": "0.6368826", "text": "def unmatrimonial(wholesome, screel, pyrrhotism_preaccommodate)\n end", "title": "" }, { "docid": "28e6c567b9b6b4338024f41f34c2140f", "score": "0.62133306", "text": "def traditious_grammatical_unblemishe...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "e38da754d0b9c074913082119912e47f", "score": "0.0", "text": "def set_space\n @space = Space.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
d4b8862673e768a29806caf4b31389e8
Readonly pseudoassociation for this user's roles. To modify, alter role assignments.
[ { "docid": "ddffa7fbec6fa5acdc3709f622560b10", "score": "0.0", "text": "def roles(reload = false)\n @roles = nil if reload\n @roles ||=\n Role.find_by_sql ['select * from roles where id in ' +\n self.class.role_assigned_cond(':id'),\n {:id => id...
[ { "docid": "10179a8ad942769ed2770e44d21c13f1", "score": "0.6839927", "text": "def user_roles=(value)\n roles[:user_roles]=value\n end", "title": "" }, { "docid": "f7c2ed963b1bbf2a9cd90641278e3176", "score": "0.6697141", "text": "def role=(value)\n @role = value\n ...
0c929c9bf90dbe827f1144aeb0f0a2ba
Internal: Do a POST to API and capture it into a response object.
[ { "docid": "12ecd878623119d21eed646281c70930", "score": "0.0", "text": "def post_with_auth(path, response_class, payload)\n response_class.new(client.post_with_auth(path, payload))\n end", "title": "" } ]
[ { "docid": "c840df2b574d7e45c9a87240d8f7c240", "score": "0.7683825", "text": "def post\n resource.post(request, response)\n end", "title": "" }, { "docid": "2ca7e387087b28eec31a72d7a23e02da", "score": "0.7659796", "text": "def post\n RestClient.post(url, @body, @header) ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "eabbd6e3725321f47813d0da3be0f245", "score": "0.0", "text": "def set_inspection_filter\n @inspection_filter = DefaultInspectionFilter.find_by!(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...
05f202835ffd1b56a8fca074ff5ddad9
PATCH/PUT /landing_pages/1 PATCH/PUT /landing_pages/1.json
[ { "docid": "258b9c0e60dcb95f916cae941c0714c2", "score": "0.6813798", "text": "def update\n respond_to do |format|\n if @landing_page.update(landing_page_params)\n format.html { redirect_to landing_pages_path, notice: 'Los datos se actualizaron correctamente.' }\n format.json { head...
[ { "docid": "213ba7b07f76f9bf24848c09305f2475", "score": "0.70933723", "text": "def update\n respond_to do |format|\n if @landing_page.update(landing_page_params)\n format.html { redirect_to @landing_page, notice: 'Landing page was successfully updated.' }\n format.json { head :no_c...
41eccf165639f3a12400148e625bbc99
Delete a campaign Permanently delete a campaign
[ { "docid": "88283f73dd2bd7ecc7e28b161ba75964", "score": "0.6561823", "text": "def delete_campaign_using_delete_with_http_info(campaign_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: MarketingApi.delete_campaign_using_delete ...'\n end\n ...
[ { "docid": "90b936eebc361824cbfe5e058bb27655", "score": "0.8377197", "text": "def delete_campaign(campaign_id)\n request :delete, \"api/1/campaigns/#{campaign_id}\"\n nil\n end", "title": "" }, { "docid": "95b8e4095ce89cda16e03f4f77b86bff", "score": "0.814113", "text": "...
3cd099c6d92b7301c41e43f98f765f52
Strips all nonnumberpad characters from a string => For example: "+45 (123) 023 1.1.1" > "+45123023111"
[ { "docid": "6d75fa1dcb473965050c1650ee3d764c", "score": "0.60790944", "text": "def normalize(string_with_number)\n string_with_number.gsub(/[^0-9+*#]/,'') unless string_with_number.nil?\n end", "title": "" } ]
[ { "docid": "b7964ffc8ad1e96d85b35d1722303573", "score": "0.7130732", "text": "def stripChars(text)\n return text.gsub(/[^0-9]/,'')\n end", "title": "" }, { "docid": "d628a725edaf32f5150abf926c2c54ed", "score": "0.71122", "text": "def stripChars(string)\n return string.gsub(/[^0-...
d37de0638760c5b0fecaa5661c453038
Calculates the time elapsed between points with little to no elevation change on a ride. Returns the elapsed time with no elevation change in seconds.
[ { "docid": "3bd8ef8efedbe1acc2741fb61705dca8", "score": "0.69340295", "text": "def flat_duration(ride)\n point_pairs(ride).inject(0) do |total, pair|\n if active_between?(*pair) && flat_between?(*pair)\n total + time_between(*pair)\n else\n total\...
[ { "docid": "f7bf3f5c6526dd9799bc9973940d9b99", "score": "0.6938146", "text": "def duration(ride)\n if ride.points.size < 2\n ride.points.each { |point| point.duration = 0 }\n return 0\n end\n\n point_pairs(ride).inject(0) do |total, pair|\n pai...
aa50afe9e0980162d8cae5019fa6b621
when tasks complete (or are aborted) reset form
[ { "docid": "1e513dc47ee2cae0c64e82b1ab5641d6", "score": "0.0", "text": "def status_update(_event)\n @submitted = false\n @filed = false\n end", "title": "" } ]
[ { "docid": "5c7e628a27c80527e46128b93228237f", "score": "0.68386364", "text": "def reset\n @tasks_have_failed = false\n @tasks_are_finished = false\n @tasks_are_successful = false\n end", "title": "" }, { "docid": "c2436334d6bf2a8a49e126f092ef340b", "score": "0.63598967...
3b8ec0accd26c692f60533ca3a7b69c2
Public: Given attributes for a document, creates and saves the document. An exception is raised if there are validation failures. attributes Attributes to be set on the document. Returns the document instance.
[ { "docid": "9777ddeffa155cb5fd520ac7907e26c6", "score": "0.59830946", "text": "def create!(attributes)\n new(attributes).tap(&:save!)\n end", "title": "" } ]
[ { "docid": "1a00fcb276d0af60abc31da03fa12485", "score": "0.6943086", "text": "def add_document(attributes)\n folder.documents.create(attributes)\n end", "title": "" }, { "docid": "1697d38acee5acd3f0b0e995bb29b2ca", "score": "0.67244077", "text": "def create(attrs = {}, &b...
5607ab58782416ea65b505ea9339dc61
Returns a set number of items for a given recipe
[ { "docid": "5b46148b0cecd9fe5622780edcbd4162", "score": "0.64289385", "text": "def items_for_recipe(recipe)\n\t\t# Everything will be stored in terms of ounces\n\t\tids = []\n\t\t# Loop through the structured ingredients\n\t\trecipe.each do |r|\n\t\t\t# Pull all items from database with matching length\...
[ { "docid": "d68724722cf4b948d2272d3bd5ada2f2", "score": "0.69101876", "text": "def number_ingredients(perfect_10_recipe)\n return perfect_10_recipe.size\nend", "title": "" }, { "docid": "0408b5096ad77c60f2662af8efc8c38e", "score": "0.6560648", "text": "def number_ingredients(perfect...
afbdc34ce9b559a2a06c94ba52760f9f
Check if the object is marked.
[ { "docid": "48954bde7b19b8090569da3814f64d1a", "score": "0.62998813", "text": "def is_marked?(id, ignore_errors = false)\n @flat_file.is_marked_by_id?(id)\n end", "title": "" } ]
[ { "docid": "b24b8f8b8962900970d98b2580eab0ff", "score": "0.7760145", "text": "def marked?\n !mark.nil?\n end", "title": "" }, { "docid": "ae6fbae7e48f6846286369fa643d39be", "score": "0.7731743", "text": "def marked?\n is_marked\n end", "title": "" }, { "docid": "2...
5e420222e5bfc17c4a9e0697c6efa37c
Function to add a new member to the household
[ { "docid": "1b1573d39bb575e348c1a87d6b49a5d9", "score": "0.76921827", "text": "def add_member\n household = Household.find_by(id: params[:household])\n added_member = User.find_by(email: params[:email])\n\n #Validate that the current user ownes the household they're adding a member to\n if h...
[ { "docid": "04c49a516b07995a55b283f0a8a60b2d", "score": "0.7777272", "text": "def addmember\n end", "title": "" }, { "docid": "c07b7389c5533c27eb0ece8ba0e4b560", "score": "0.7397819", "text": "def add_member(params = {})\n post(\"/members/add\", params)\n end", "titl...
dc9a170bd4b93fecd4afd9d6f7634216
Returns the value of the `url` attribute.
[ { "docid": "31221e129e6ce934a53954456223749b", "score": "0.74471265", "text": "def url\n @url\n end", "title": "" } ]
[ { "docid": "d04b852c15f0702c95a11b36b6bf9aa9", "score": "0.8642017", "text": "def url\n @attributes[:url]\n end", "title": "" }, { "docid": "d04b852c15f0702c95a11b36b6bf9aa9", "score": "0.8642017", "text": "def url\n @attributes[:url]\n end", "title": "" }, { ...
f412834f1b66d2a13519fa2b9b2ca1dd
Run it through the StreamRails::Enrich process
[ { "docid": "14aa1030feccf4561c3caad3c9892989", "score": "0.549789", "text": "def enrich(activities, includes)\n enricher = StreamRails::Enrich.new(includes)\n if activities.first&.key?('activities')\n enricher.enrich_aggregated_activities(activities)\n else\n enric...
[ { "docid": "1deebaac1fc19ec6e99de93a6e52961e", "score": "0.6624437", "text": "def run\n super\n require_enrichment\n end", "title": "" }, { "docid": "2a5d6a9c69e2596ddf7f544eeeb4434a", "score": "0.63457614", "text": "def stream!\n before_run\n\n #\n ...
9ea18a584209484463e78f0b07d9a5b7
Prepare the http connection options for HTTPClient. We try to maintain RestClient compatability in option names as this is what we used before.
[ { "docid": "6a7e411d80b3d6c6113fb239693215f9", "score": "0.7069326", "text": "def set_http_connection_options(conn, opts)\n # Authentication\n unless uri.user.to_s.empty?\n conn.force_basic_auth = true\n conn.set_auth(uri.to_s, uri.user, uri.password)\n end\n\n # SSL Ce...
[ { "docid": "ba825fd86287e76c01084a8bd152502d", "score": "0.6832501", "text": "def prepare_http_connection\n conn = @http\n if conn.nil? || !options[:persistent]\n conn = HTTPClient.new(options[:proxy] || self.class.proxy)\n set_http_connection_options(conn, options)\n @htt...
84e4fd5a84c0d9f667e1898d6e39edb7
POST /who_is POST /who_is.json
[ { "docid": "36f2c2872494d97d692f726c246a8f99", "score": "0.6273994", "text": "def create\n @who_i = WhoI.new(who_i_params)\n\n respond_to do |format|\n if @who_i.save\n format.html { redirect_to @who_i, notice: 'Who i was successfully created.' }\n format.json { render action: '...
[ { "docid": "0e27b0faddd30d93852c55ff8e73bbac", "score": "0.6224894", "text": "def create\n @who = Who.new(who_params)\n\n respond_to do |format|\n if @who.save\n format.html { redirect_to @who, notice: 'Who was successfully created.' }\n format.json { render :show, status: :crea...
a663248880164957a0ac47d558460b36
Provide a default URL as a default if there hasn't been a file uploaded: def default_url For Rails 3.1+ asset pipeline compatibility: ActionController::Base.helpers.asset_path("fallback/" + [version_name, "default.png"].compact.join('_')) "/images/fallback/" + [version_name, "default.png"].compact.join('_') end Add a w...
[ { "docid": "bb3ddec98a824d97bb8752bd94c3776b", "score": "0.0", "text": "def extension_white_list\n %w(jpg jpeg gif png)\n end", "title": "" } ]
[ { "docid": "dda9f3cd47d730e2bed75e4a9b997b2b", "score": "0.77707845", "text": "def default_url\n #\"/assets/fallback/\" + [version_name, \"default.jpg\"].compact.join('_')\n ActionController::Base.helpers.asset_path(\"fallback/\" + [version_name, \"default.jpg\"].compact.join('_'))\n #\"uploads...
0d3e23c0b9b028d0fed983e6244dbecf
Returns the value of attribute regenerator. source://jekyll4.2.2/lib/jekyll/site.rb:13
[ { "docid": "684ad11e084459d6e8cf3f62f7638190", "score": "0.0", "text": "def regenerator; end", "title": "" } ]
[ { "docid": "3d51b166413d33f3ebddd1ec743a36fc", "score": "0.6331921", "text": "def get_attribute(name); end", "title": "" }, { "docid": "3d51b166413d33f3ebddd1ec743a36fc", "score": "0.6331921", "text": "def get_attribute(name); end", "title": "" }, { "docid": "f6b24926965e...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f8d712d05f7f98c9ab15194cd7031eab", "score": "0.0", "text": "def developer_params\n params.fetch(:developer, {})\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...
242f885cb550284fd789aee8b9cf73fa
Helper methods for nested attribute forms Taken from Railscasts 197 (
[ { "docid": "6ac6a970e93f5009cf64f5b1209dbcff", "score": "0.0", "text": "def remove_child_link(name, f, options = {})\n f.hidden_field(:_delete) + link_to_function(name, \"remove_fields(this)\", options)\n end", "title": "" } ]
[ { "docid": "5982a8ee873e0577106d042e9d215a53", "score": "0.6373734", "text": "def check_for_hidden_nested_attributes(name, value)\n name_sym = name.to_sym\n\n reflection = self.class.reflect_on_association(name_sym)\n\n if reflection\n if reflection.has_many? && value.is_a?(Array)\...
5807ee2652fbf225ddc413b18d798ae6
For the following two: These are bubble sort solution. k is a optimization counter, so with each repeated iteration, 1 less index from the right is checked via the conditional in the block. eventually, I would like to make the two the same method, so it is called like: sort(array, :asc) or sort(array, :desc) and have t...
[ { "docid": "45126e70678b4a6d4695d76fbece43fe", "score": "0.0", "text": "def sort_asc items\n items.flatten!\n k = items.size - 1\n while k > 0\n items.map.with_index do |item, index|\n if index < k && item > items[index+1]\n items[index], items[index+1] = items[index+1], it...
[ { "docid": "8f7bf5ba92686945fe746912fee259d9", "score": "0.65786624", "text": "def bubble_sort(&prc)\n sorted = false\n prc ||= Proc.new { |a, b| a <=> b } #self[idx] <=> self[idx + 1]\n\n while sorted == false\n sorted = true\n \n (0...self.length-1).each do |i|\n\n ...
13648c3b661069ca215ef1bae7163b42
Returns the value of attribute test_steps. source://cucumbercore//lib/cucumber/core/test/case.rb10
[ { "docid": "428b5d1eaf9535043f41374ccd294f0d", "score": "0.6464884", "text": "def test_steps; end", "title": "" } ]
[ { "docid": "692c9993a08f619da7b6ac01cc8d1d8f", "score": "0.63660175", "text": "def getTestStep(parms, step)\n\n if step.nil?\n puts \"[getTestStep]: \\\"step\\\" is required.\"\n exit(1)\n end\n\n allSteps = getAllTestSteps(parms)\n\n if allSteps\n regEx = Regexp...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4da0eada2f361bfd1efdfb6ce727475f", "score": "0.0", "text": "def category_params\n params.require(:category).permit(:name, :picurl)\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...
0e104af3da34b3d2e81db7c96c84f5e1
POST /username_cookies POST /username_cookies.json
[ { "docid": "13ba801d2f25e90276167ad66a597451", "score": "0.7165247", "text": "def create\n @username_cookie = UsernameCookie.new(params[:username_cookie])\n\n respond_to do |format|\n if @username_cookie.save\n format.html { redirect_to @username_cookie, notice: 'Username cookie was su...
[ { "docid": "96eec3a0379f979f64269c227cad8d68", "score": "0.70282894", "text": "def create_cookies(username, password)\r\n\t\tcookies.signed[:username] = { \r\n\t \t\tvalue: username,\r\n\t \t\texpires: 1.weeks.from_now }\r\n\t \tcookies.signed[:pwd] = {\r\n\t \t\tvalue: password,\r\n\t \t\texpires: 1.we...
9ab46c6b8a39bc185cba2e1852e7366b
GET /details/new GET /details/new.json
[ { "docid": "8b9b7539bebfba8e46f775d4a49fe5be", "score": "0.8010718", "text": "def new\n @detail = Detail.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @detail }\n end\n end", "title": "" } ]
[ { "docid": "f8452f5bce3c09434f06d602091ff15c", "score": "0.74961615", "text": "def new\n @specific = Specific.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @specific }\n end\n end", "title": "" }, { "docid": "d89d88dcb488b2acf0e3...
0530ef625184cb33196c6b31236df0f7
DELETE /categories/1 DELETE /categories/1.json
[ { "docid": "46336b95d8c358d7316216a7ae6327c5", "score": "0.0", "text": "def destroy\n @category = Category.find(params[:id])\n if @category.destroy\n flash[:notice] = t('controllers.categories.destroy_success')\n else\n flash[:error] = t('controllers.categories.destroy_fail') + \": \"...
[ { "docid": "4142e7c3e1be82e432fdf951ae5785eb", "score": "0.75578415", "text": "def destroy\n @data = @category.delete(params[:id])\n render json: @data\n end", "title": "" }, { "docid": "8e82257a38ec7abcdd74a59519238e96", "score": "0.75373495", "text": "def destroy\n Catego...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "203d2a9250bf2d3c753df82ec199a462", "score": "0.0", "text": "def set_actor\n @actor = Actor.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163163", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045976", "text": "def action_hook;...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f7efb850c3a993babc0fddd5b943a4ea", "score": "0.0", "text": "def cadastral_office_params\n params.require(:cadastral_office).permit(:name)\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...
216b6d066ccd8f8f10f2b4de8ecc87e6
Settle a specific amount of a token for a given payment to the transferAddress and remaining balance (if any) will be refunded to the buyerAddress
[ { "docid": "8596eb441b60864b287d3f060bed7139", "score": "0.0", "text": "def settle_payment(id, payment_settle_request, opts = {})\n data, _status_code, _headers = settle_payment_with_http_info(id, payment_settle_request, opts)\n data\n end", "title": "" } ]
[ { "docid": "d1a3d98d764ef5abf76a860dba7ecdcf", "score": "0.6799707", "text": "def make_payment(amount)\n @balance -= amount\n end", "title": "" }, { "docid": "26db673e8fc5bfd35fd4f50f4d83f1b3", "score": "0.6558054", "text": "def payment(amount)\n @balance -= amount\n end", ...
a551172da6af8bf7df56f6f86ca22584
Creates the links show, edit, destroy
[ { "docid": "0c4d019f9a567a8129a84ec562262a6c", "score": "0.5940592", "text": "def bonsai_links(klass, options={})\n [\"edit\", \"destroy\"].inject([]) do |t, m|\n t << bonsai_method_path(m, klass)\n end.join(\" \").html_safe\n end", "title": "" } ]
[ { "docid": "66e09f00dd74f19dd20f8e2523fe403c", "score": "0.79828787", "text": "def create_links\n end", "title": "" }, { "docid": "66e09f00dd74f19dd20f8e2523fe403c", "score": "0.79828787", "text": "def create_links\n end", "title": "" }, { "docid": "b43a217aeda1eaa62a16...
923ddb90cd84ae3ae619f841d74a9a20
curl i X DELETE DELETE /campaigns/1.json
[ { "docid": "07728e3da57004ddd58ceba2d1c80b70", "score": "0.7417229", "text": "def destroy\n @campaign.destroy\n head :no_content\n end", "title": "" } ]
[ { "docid": "ed35429318833a71bc9e9ec902e83a4d", "score": "0.77541083", "text": "def campaigns_delete cID: \n call_adglare_api 'campaigns_delete', {cID: cID}\n end", "title": "" }, { "docid": "680268e2eacc781ab2f6d1616cb7051e", "score": "0.74553216", "text": "def destroy\n @camp...
e521c985847a686e57781f413d8931c7
Este servicio permite reintentar el cobro de un Invoice vencido.
[ { "docid": "7d646c125cc387dc21d208ca4c66d792", "score": "0.0", "text": "def retry_invoice(invoice_id:)\n path = '/api/invoice/retryToCollect'\n\n private_post(path, { invoiceId: invoice_id })\n end", "title": "" } ]
[ { "docid": "4b2c9f7a63332b28abeedd63ebf4b9d5", "score": "0.65164965", "text": "def cancel\n # call the service InvoiceCancel\n return InvoiceCancel.new(self).perform\n end", "title": "" }, { "docid": "6986c16ebd02c76b59de43b1d0e51313", "score": "0.6432885", "text": "def ...
830b1059e13ffee8af9164937ddcea00
GET /demands GET /demands.json
[ { "docid": "4efc39025094ae6b9d845a2c583d7e3f", "score": "0.68736774", "text": "def index\n\t\t@demands = Demand.all\n\tend", "title": "" } ]
[ { "docid": "369278bd4ffd7d86542c05e1955721d5", "score": "0.7515677", "text": "def demand\n get(:demand)\n end", "title": "" }, { "docid": "369278bd4ffd7d86542c05e1955721d5", "score": "0.7515677", "text": "def demand\n get(:demand)\n end", "title": "" }, { ...
51f884a2f578dbce21717f8ec44fd4df
Delete +line+ if block yields true.
[ { "docid": "c4dcb59808aa22f5152edfd6540e23be", "score": "0.65343785", "text": "def delete_if #:nodoc: :yield: line\n # Do in two steps to not mess up progress through the enumerator.\n rm = []\n\n each do |f|\n line = f2l(f)\n if line && yield(line)\n rm << f\n\n ...
[ { "docid": "310459ebb0419fe4e0386f6b4d475f6e", "score": "0.7443205", "text": "def delete_if #:yield: line\n begin\n @card.delete_if do |line|\n yield line\n end\n rescue NoMethodError\n # FIXME - this is a hideous hack, allowing a DirectoryInfo to\n ...
cb813b0242d4cc53aa25195f7f8e4435
GET /items_products/1 GET /items_products/1.json
[ { "docid": "e975cf72b32ffe84610d84c7f7eb2ea3", "score": "0.6469965", "text": "def show\n @items_products = ItemsProduct.find_by_sql [\"SELECT ip.id, ip.product_id, ip.order_item_id, ip.logistics_id, ip.created_at, ip.item_price, ip.updated_at, p.product_name, oi.order_id, lo.logistics_name FROM items...
[ { "docid": "2455ad052867f5f510656cfd27befc3b", "score": "0.7403771", "text": "def show\n \n @item = Item.find(params[:id])\n\t@product = @item.product\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @item }\n end\n end", "title": "" }, ...
a6f30db060599075200b97f9df458ab8
include all helpers, all the time Scrub sensitive parameters from your log filter_parameter_logging :password
[ { "docid": "a45f634f1959d805e7f7c6578966d484", "score": "0.0", "text": "def require_admin\n if !session[:admin]\n flash[:warning]=\"您得是管理员才行哥们!!!\";\n redirect_to '/member/login'\n end\n end", "title": "" } ]
[ { "docid": "3100f9d0b6167d98e0613f51a93259e6", "score": "0.67644083", "text": "def params_filters\n @params_filters ||= %w(password)\n end", "title": "" }, { "docid": "3100f9d0b6167d98e0613f51a93259e6", "score": "0.67644083", "text": "def params_filters\n @params_filters...
d7901f5c9f6bbf556407a269346b53f5
Extracts a Bill's documents from the Bill's documents page .i.e.
[ { "docid": "aa4bf0e939d98827df4181ab2928daf4", "score": "0.77120024", "text": "def extractor_bill_detail_documents\n [].tap do |result|\n if (doc_link = @doc.at_css('ul.tight a')) && (href = doc_link[:href])\n ImporterUtils.safe_fetcher(\"#{BASE_URL}#{href}\").css('table.bill-items ...
[ { "docid": "533e5942270ee03f5ae25056ea6380d1", "score": "0.65325856", "text": "def get_documents(page, word = nil)\n x = current_user.own_documents(page, DOCUMENTS_FOR_PAGE, SearchOrders::CREATED_AT, word, true)\n @documents = x[:records]\n @tot_pages = x[:pages_amount]\n end", "title": ""...
00d8a060e07bcf3e72f635d3a410e4e0
PATCH/PUT /admin/founders/1 PATCH/PUT /admin/founders/1.json
[ { "docid": "4dc598c8b7e00cbb5ef83b54cfa9db84", "score": "0.73015964", "text": "def update\n respond_to do |format|\n if @admin_founder.update(admin_founder_params)\n format.html { redirect_to @admin_founder, notice: 'Founder was successfully updated.' }\n format.json { render :show...
[ { "docid": "75d2d29044bb82a6d344fbd1b1031df4", "score": "0.694061", "text": "def update\n @founder = Founder.find(params[:id])\n\n respond_to do |format|\n if @founder.update_attributes(params[:founder])\n format.html { redirect_to @founder, notice: 'Founder was successfully updated.' ...
468cb45e82358118f9e4434940ac5d22
Iterate over the aliases If this instance has previously been joined with another one, the yielded aliases are to be used for renaming the right side relation of the relational join.
[ { "docid": "0de8bf6f69407cca4b81f25aee0b04b1", "score": "0.5309072", "text": "def each(&block)\n return to_enum unless block_given?\n @aliases.each(&block)\n self\n end", "title": "" } ]
[ { "docid": "97fd0e24adf119b826b722967b7b7c02", "score": "0.6313435", "text": "def aliases(other)\n common_names(other).each_with_object({}) { |name, aliases|\n left, right = fetch(name), other.fetch(name)\n aliases[name] = :\"#{name}_#{right}\" if left != right\n }\n ...
4d75f6145b60fc3cde094b59fc83c1a9
By default serve release, if canary is specified then the latest known release, otherwise the requested version.
[ { "docid": "d7eeda5cdcd2f8a686756ccf62786c6f", "score": "0.61778784", "text": "def deploy_key\n params[:version] ||= 'release'\n case params[:version]\n when 'release' then 'release'\n when 'canary' then redis.lindex('releases', 0)\n else\n params[:version]\n end\n end", "t...
[ { "docid": "723df4aec3154670d4177c9e4ae7d99b", "score": "0.7008024", "text": "def release\n configs = store(:get, 'configs').to_s.gsub(\"\\n\", \" \")\n \n # TODO: if error, user need to deploy code first (nothing to deploy) => use a special exit code \n # when code is not pushed or ...
22eaffdf8322b2f2431e0b8ebc495614
Give member whose ID or slug matches request, to be used by form.
[ { "docid": "13d9d82b05c59c1d7d22387e67a6f80a", "score": "0.0", "text": "def edit\n end", "title": "" } ]
[ { "docid": "9e32442a9b1b9791b7c96ac0815245e0", "score": "0.7342425", "text": "def set_member\n if params[:id].nil? and params[:member_id].nil?\n redirect_to members_url unless current_member\n @member = current_member\n else\n @member ||= Member.friendly.find(params[:id]) if params[...
daf2cb599f54bd46f0eef2877f3c7647
TODO need test not working wrong user error
[ { "docid": "15cf4eb91614538f5693e32e9589d244", "score": "0.0", "text": "def unshare_library(repo_id,share_type,user,group_id)\n delete_unshare_library(repo_id,share_type,user,group_id)\n end", "title": "" } ]
[ { "docid": "89fd7859ed037d333f3d1b39cc5c119b", "score": "0.6356318", "text": "def error; end", "title": "" }, { "docid": "89fd7859ed037d333f3d1b39cc5c119b", "score": "0.6356318", "text": "def error; end", "title": "" }, { "docid": "89fd7859ed037d333f3d1b39cc5c119b", "...
f8260d34a328955e3bf74e276a966a18
GET /enrollments/1 GET /enrollments/1.json
[ { "docid": "374f02a50bafdd39f369af40dad380b8", "score": "0.0", "text": "def show\n @family_year = FamilyYear.where(school_year: @enrollment.school_year).where(family_id: @family.id).first\n\n\tend", "title": "" } ]
[ { "docid": "4a2e3d6c65f81dcdfe8a29fb39f57507", "score": "0.75238585", "text": "def show\n @enroll = Enroll.find(params[:id])\n render json: JSON.parse(@enroll.to_json)\n end", "title": "" }, { "docid": "a1d1e47a1c631690c98d93e5ff10bc7e", "score": "0.7384381", "text": "def show...
d963e8f220ca1de6d9b150f86c6d7046
define tpye of phone number (home) through attribute name from data.csv
[ { "docid": "c75945cffbd60de3950efdda2588a954", "score": "0.60941774", "text": "def home_phone\n home_phone = @customers[0][4].to_s.split(\"\")\n i = 0\n @home_phone_type = \"\"\n while i < 4\n @home_phone_type << home_phone[i]\n i += 1\n end\n @home_phone_type\n end", "t...
[ { "docid": "4443dfbd09cb43fb0e9178e71eed542a", "score": "0.5975691", "text": "def csv_attributes\n [\n \"Nimi\" => \"name\",\n \"Järjestys\" => \"numbering_order\",\n \"Lyhenne\" => \"shorten\",\n \"Ehdokkaita\" => :candidate_count,\n \"Vaalirengas\" => :coaliti...
17e459b9176603a1f7cf9f7efd1ce0f1
Decrypted LSA key is passed into this function
[ { "docid": "5f84d9b33c9aae1dbfc6a40643971cc8", "score": "0.0", "text": "def get_secret(lkey)\n\t\tsec_str = \"\\n\"\n\t\tbegin\n\t\t\t#LSA Secret key location within the register\n\t\t\troot_key = \"HKEY_LOCAL_MACHINE\\\\Security\\\\Policy\\\\Secrets\\\\\"\n\t\t\tbegin\n\t\t\t\tkey_arr = meterpreter_reg...
[ { "docid": "54feaae99fbb9ed0753831b5b1f71548", "score": "0.7180094", "text": "def decrypt_lsa(pol, encryptedkey)\n\t\tsha256x = Digest::SHA256.new()\n\t\tsha256x << encryptedkey\n\t\t(1..1000).each do\n\t\t\tsha256x << pol[28,32]\n\t\tend\n\t\taes = OpenSSL::Cipher::Cipher.new(\"aes-256-cbc\")\n\t\taes....
9a5b46494587f74b7687ea844a5380f5
walks the connection for matching servers, return either the found server of nil
[ { "docid": "bf13e0c04286ba0ff334a31dcdbfbf10", "score": "0.5514059", "text": "def find_subject\n connection.servers.\n select { |s| s.state != 'terminated' }.\n find { |s| s.tags['UUID'] == uuid }\n end", "title": "" } ]
[ { "docid": "b27945e0078f4ce3f7f391a3ea5fc620", "score": "0.6821876", "text": "def try_servers(servers)\n servers.each { |s| break if connect(s) }\n end", "title": "" }, { "docid": "fa920a9dd01f9c8649ecb1c5c14a3a2b", "score": "0.6707863", "text": "def server_found!\n @p...
d78ccd44903b5e1c885f0d58931d0578
RetrieveInventoryCount Retrieves the current calculated stock count for a given [CatalogObject](typecatalogobject) at a given set of [Location](typelocation)s. Responses are paginated and unsorted. For more sophisticated queries, use a batch endpoint.
[ { "docid": "8125492b7778b41e99a14245627acbc4", "score": "0.6887394", "text": "def retrieve_inventory_count_with_http_info(catalog_object_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: InventoryApi.retrieve_inventory_count ...\"\n end\n ...
[ { "docid": "679a3d70169af9e9c94688fd3ddf1bdc", "score": "0.68442523", "text": "def retrieve_inventory_count(catalog_object_id, opts = {})\n data, _status_code, _headers = retrieve_inventory_count_with_http_info(catalog_object_id, opts)\n return data\n end", "title": "" }, { "doc...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a011ee1f9fd198b2f1dcdc27294ec698", "score": "0.0", "text": "def news_type_params\n params.require(:news_type).permit(:name)\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...
5df678e6da243602a996b7fdc76f8f24
Move the current directory out
[ { "docid": "24f1493851cdfa650333dd9f449dc98b", "score": "0.7510074", "text": "def move_out_of_directory\n Dir.chdir(@root_dir) unless @root_dir.nil?\nend", "title": "" } ]
[ { "docid": "77e57f32912b8964e652e36f56885a87", "score": "0.6738172", "text": "def move_to_output_location(output_location)\n FileUtils.mkdir_p(output_location) unless File.directory?(output_location)\n Dir.chdir output_location\nend", "title": "" }, { "docid": "11f51a74b415fe768730b3c62036...
fe38706eab90aac1692c0c63693c7a31
The inline scheme property for the cell this must be one of [:none, major, minor]
[ { "docid": "856ee7163961bd1e55cd8b74a67f6d47", "score": "0.0", "text": "def scheme; end", "title": "" } ]
[ { "docid": "e4eb2cd3698b8f99415e7b29d08aa9d4", "score": "0.5898605", "text": "def cellStyles; end", "title": "" }, { "docid": "db824c7d9c7540fead944caf7979e1e9", "score": "0.58894646", "text": "def inlineable?; false end", "title": "" }, { "docid": "f30bc202cbf3f2567f77b3...
bc57e022bbd9797dc7915cf14b194427
That means each row will have zeros at front and ones at the back. You need to find out the row which contains a maximum number of ones. [0 0 0 0 0 0 0 1 1 1 1 1] [0 0 0 0 1 1 1 1 1 1 1 1] [0 0 0 0 0 0 1 1 1 1 1 1] [0 0 0 0 0 0 0 0 0 1 1 1] [0 0 0 0 0 0 0 1 1 1 1 1] [0 0 0 0 1 1 1 1 1 1 1 1] Ans : second row and sixth ...
[ { "docid": "d0b270cb955c1a4b4db6cbbfb1a9aae9", "score": "0.6573311", "text": "def find_max(array)\n print_array(array)\n max = 0\n array_of_max_pairs = [] # to store row and max in the row\n\n (0...12).each do |i|\n if array[0][i] == 1\n array_of_max_pairs << [0, i]\n max = i\n ...
[ { "docid": "ac69bb3f61d64997f02c7e980646453f", "score": "0.75463134", "text": "def max_ones(matrix)\r\n\tarr = []\r\n\tmatrix.each_with_index do |row,index|\r\n\t\t arr.push(row.count(1))\r\n\tend\r\n\tarr.each_with_index do |n, index|\r\n\t\tif n==arr.max \r\n\t\t\treturn index \r\n\t\tend\r\n\tend\r\n...
d13348a1c2b55d6c4b5e6a506e6d5970
last 10 days average all countries section
[ { "docid": "cce1cdb4769d90b0cdb191011b08d0a3", "score": "0.0", "text": "def rounded_mean(arr)\n cant = arr.count\n total = arr.sum\n if cant != 0\n res = total / cant\n res = res.round\n else\n res = 0\n end\n res\nend", "title": "" } ]
[ { "docid": "4842dd93c7acdd91694ee90a2718f1fa", "score": "0.62842757", "text": "def average_pop\n sum_of_populations = 0\n num_countries = 0\n\n if(!@countries.empty?)\n @countries.each do |country|\n sum_of_populations += country.population\n num_countries+= 1\n end\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "da8b76210b8037d7730d3cbfb08e9593", "score": "0.0", "text": "def set_alternative_question\n @alternative_question = AlternativeQuestion.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...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "69734997fb8e5ab77faf367bef0bbdf6", "score": "0.0", "text": "def bicycle_shop_params\n params.require(:bicycle_shop).permit(:name, :description, :lat, :lng)\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...
497624d1be9c10e0e303dbdd19979f40
formats time into D/M/YYY format
[ { "docid": "257afc35cbfb98eaebbc7957b5f679ee", "score": "0.0", "text": "def time\n self.created_at.strftime(\"%-d/%-m/%Y\")\n end", "title": "" } ]
[ { "docid": "fd17c564064977c9b9f88be6a1802366", "score": "0.7811947", "text": "def format_date(time); end", "title": "" }, { "docid": "808fc0cf7d33feeb1f74995e59adc4c6", "score": "0.7798294", "text": "def format_time(time); end", "title": "" }, { "docid": "bbc2302505ab68f4...