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": "24984165b681a4be93bce327067d8596", "score": "0.0", "text": "def community_service_params\n params.require(:community_service).permit(:event_id, :total_hours)\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...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "fda2f32570648706e710c493038f5904", "score": "0.0", "text": "def set_goofball\n @goofball = Goofball.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;...
8ddbb6a2c71a3b1af661a5e69f7050ad
Difficulty: medium/hard This is a great question for interview prep, so lets not google it. Instead, try whiteboarding, and thinking of your approach before coding. There are multiple approaches to this question, so try to think of the most efficient one you can! Write a method that will take a string as an input. The ...
[ { "docid": "b2c5bed53727fe1f4b814daca88f0b12", "score": "0.673576", "text": "def exes_and_ohs(input)\n # Your code goes here\n arr = input.downcase.split('')\n\n if arr.uniq.count == 2 && arr.count <= 6\n puts true\n else\n puts false\n end\nend", "title": "" } ]
[ { "docid": "4750a096015af4b3531534fa5850c1bf", "score": "0.7735904", "text": "def ExOh(str)\n countZ = 0 \n countO = 0 \n # code goes here\n if str.each_char do |letter|\n if letter == \"x\"\n countZ += 1\n elsif letter == \"o\"\n countO += 1\n end\n end\n \n\t#return countZ ...
3fdcd192a58acb0de3536bd13c52f2aa
POST /membership_request_responses POST /membership_request_responses.json
[ { "docid": "8a63a1af225372865743f489d31898ce", "score": "0.67985487", "text": "def create\n @membership_request_response = MembershipRequestResponse.\n new(membership_request_response_params)\n\n authorize! :create, @membership_request_response\n if @membership_request_resp...
[ { "docid": "5defd5a94758bfa3b8e4b899a212b660", "score": "0.58581674", "text": "def create\n if @current_user.enrolled?(@question_set.class_group_id) && @current_user.student?(@question_set.class_group_id)\n @response = Response.new(response_params)\n @response.user_id = @current_user.id\n ...
278c3555f485768432380a04e37f23e5
Updates the hierarchy of resources and methods with the new base.
[ { "docid": "8e8f44b855d1f55364f09689da0afdea", "score": "0.636219", "text": "def method_base=(new_method_base)\n @method_base = Addressable::URI.parse(new_method_base)\n self.discovered_resources.each do |resource|\n resource.method_base = @method_base\n end\n self.d...
[ { "docid": "a6cb4e7b6447622a411e7a60b6d3a9bc", "score": "0.65089846", "text": "def inherited(base) #:nodoc:\n super(base)\n base.send :initialize_resources_class_accessors!\n base.send :create_resources_url_helpers!\n end", "title": "" }, { "docid": "26e7486f9d6e17c...
3929a4d0f5cbb790ec0fb5ef6b2a8fe8
POST /kidsbs POST /kidsbs.json
[ { "docid": "f510e512099f1de8b07c21506806312c", "score": "0.7362621", "text": "def create\n @kidsb = Kidsb.new(kidsb_params)\n\n respond_to do |format|\n if @kidsb.save\n format.html { redirect_to @kidsb, notice: 'Kidsb was successfully created.' }\n format.json { render :show, s...
[ { "docid": "794f580299cbe93ea29bebf40ddc4dca", "score": "0.6503742", "text": "def create\n @kid = Kid.new(kid_params)\n\n respond_to do |format|\n if @kid.save\n format.html { redirect_to kids_url, notice: \"Kid was successfully created.\" }\n format.json { render :show, status:...
e57ec1be3d9f2c1ed5cee8a825d1c3d6
Performs the actual template rendering.
[ { "docid": "e8ac970b4977973222df0e3483ed493c", "score": "0.0", "text": "def render_to_body(options = {})\n end", "title": "" } ]
[ { "docid": "233027c02931ba217831fd15adf13637", "score": "0.78799105", "text": "def render(template); end", "title": "" }, { "docid": "427d827ed562ffde44f0eebc4b43ab2c", "score": "0.7752171", "text": "def _render_template(options); end", "title": "" }, { "docid": "390a4ed9...
c64f9eb027570c485d4bcffec860c707
This uses the ID (name) as the param for routes etc
[ { "docid": "1bc7de4e75d58322a9d600a13a0c0297", "score": "0.0", "text": "def to_param\n self.id\n end", "title": "" } ]
[ { "docid": "e16f08b0c65e7fb0e46d046f1b59c4de", "score": "0.7347581", "text": "def id\n name\n end", "title": "" }, { "docid": "a2e5b16c8b3f57e09461c2706d0292b6", "score": "0.72745526", "text": "def id\n @name\n end", "title": "" }, { "docid": "ef8fdf41d3599e5b...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2ec5fea72c50367ff4937dd6cb2bd3dd", "score": "0.0", "text": "def set_earthquake\n @earthquake = Earthquake.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6163754", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6045816", "text": "def action_hook;...
5029e1ee8391b7152a1a086d910c1818
This is not referencing the true/false reserved words but strings which always evaluate to true. I removed the quotes so false would evaluate to false.
[ { "docid": "5de5f26808a8b252406e84c4625cea5f", "score": "0.0", "text": "def predict_weather\n sunshine = ['true', 'false'].sample\n if sunshine == 'true'\n puts \"Today's weather will be sunny!\"\n else\n puts \"Today's weather will be cloudy!\"\n end\nend", "title": "" } ]
[ { "docid": "4c3e2ec4fd622c15966e98d4a10920ae", "score": "0.82469684", "text": "def literal_false\n 'false'\n end", "title": "" }, { "docid": "8ff58ba14574f693d305f3a164bf4176", "score": "0.811053", "text": "def unquoted_false\n 'f'\n end", "title": "" }, {...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f7f6af6cc5bffd1f48c407112ba1f1ff", "score": "0.0", "text": "def file_record_params\n params.fetch(:file_record, {})\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...
a77b1274b8da3f6363d139eee87ca995
Get custom gradebook category for a course with GET /courses/:course_id/gradebook/customCategories/:custom_category_id using OAuth1 or OAuth2 as a student, teacher, teaching assistant or administrator.
[ { "docid": "8bbf2cb99ce655bc922f50b821f79c14", "score": "0.8827957", "text": "def get_custom_gradebook_category(course_id, custom_category_id)\r\n relative_url = Path::COURSES_GRADEBOOK_CUSTOMCATEGORIES_ % [course_id, custom_category_id]\r\n get(relative_url)\r\n end", "title": "" } ]
[ { "docid": "a47fc63072e07d3a5b21296f6d490659", "score": "0.78703046", "text": "def get_custom_gradebook_items(course_id, custom_category_id)\r\n get(Path::COURSES_GRADEBOOK_CUSTOMCATEGORIES_CUSTOMITEMS % [course_id, custom_category_id])\r\n end", "title": "" }, { "docid": "56b21794ac...
12d3e9b84f9fc65534a5d95f9149cb1d
Override block_html to support parsing nested markdown blocks.
[ { "docid": "4ac670dd9aeb0afdad7b50b94307e87d", "score": "0.69491965", "text": "def block_html(raw)\n raw = unindent(raw)\n\n if md = raw.match(/\\<(.+?)\\>(.*)\\<(\\/.+?)\\>/m)\n open_tag, content, close_tag = md.captures\n \"<#{open_tag}>\\n#{recursive_render(unindent(co...
[ { "docid": "d0878260a16371d903ffdd00cd7263e8", "score": "0.7864851", "text": "def block_html(html)\n html.gsub(/<markdown>([\\d\\D]+?)<\\/markdown>/) {|_|\n extensions = {fenced_code_blocks: true}\n renderer = Redcarpet::Markdown.new(WithHighlights, extensions)\n ...
2bb99df5beaff12853328268d283ff6b
Retrieves the current value _(is)_ of this property from the provider. This implementation performs this operation by calling a provider method with the same name as this property (i.e. if the property name is 'gid', a call to the 'provider.gid' is expected to return the current value.
[ { "docid": "a48a208e52d1a30759ef59331f33f2df", "score": "0.0", "text": "def retrieve\n provider.send(self.class.name)\n end", "title": "" } ]
[ { "docid": "f3684246047fa81eff279acf1047c7d6", "score": "0.5965243", "text": "def value\n return self.value_provider.value if self.value_provider and self.value_provider.respond_to?(:value)\n return self.custom_value\n end", "title": "" }, { "docid": "36e239230435d0335b2153a...
91d883d9efd55325b38c282ede92334b
gets questions within the north, south, east, west boundaries
[ { "docid": "587d3d8353a532dab03c4c6033b3227c", "score": "0.0", "text": "def search\n events_at_location = []\n valid_events = Event.where(is_location_set: true)\n for event in valid_events\n if event.lat.between?(params[:s].to_f, params[:n].to_f) and event.lng.between?(params[:w].to_f, par...
[ { "docid": "e5512b2cfc05a908a5808438d860f624", "score": "0.6309963", "text": "def parent_questions\n valid_questions[lbound...ubound]\n end", "title": "" }, { "docid": "a8b89a4645d7fb45f017c018baccc0c5", "score": "0.59765816", "text": "def correct_questions\n self.winning_...
d864b4479d0042ae46b7119610240307
Returns the actual records which this instance has rated.
[ { "docid": "8519227caf4ca044b1dac67c9afc0b83", "score": "0.65976846", "text": "def all_rated\n all_rates.collect{ |r| r.rateable }\n end", "title": "" } ]
[ { "docid": "2e16a705866b5d15cb1adc2ffbd849c1", "score": "0.70553184", "text": "def records\n @records ||= retrieve_records\n end", "title": "" }, { "docid": "d24d0aca12b9a853b22a90aa10fc8997", "score": "0.70344704", "text": "def records\n self\n end", "title": "" ...
57ebb78173bc823bb00e25b0c5200ed8
Return an array of twoelement arrays where the first element is the name to display in the breadcrumb trail, and the second is the URL. This function may be called for the 'admin_category_path' generator or 'products_path' generater.
[ { "docid": "77f24ebabc845258c0edae1d383e1d18", "score": "0.5247605", "text": "def make_trail(category, choices, search_string, root_label,\n path_generator, view_type = nil)\n trail = category.get_trail(root_label)\n result = []\n \n trail.each do |t|\n if path_generator == :products...
[ { "docid": "2147a5085be0d8415249ddc429767a24", "score": "0.72193253", "text": "def breadcrumbs() [] end", "title": "" }, { "docid": "ded9a2b53336019d6d7bccf839732224", "score": "0.71865773", "text": "def hardcoded_breadcrumbs\n [\n {\n title: \"Home\",\n url: \"...
9f0a0d92db332df444e637e8c228f0ac
Search by name and gender
[ { "docid": "95401518999aa1bfd21232945a62a0db", "score": "0.796632", "text": "def search_by_name_and_gender\n errors = ValidateParams.search_by_name_and_gender(params)\n if errors.blank?\n search_results = PersonService.search_by_name_and_gender(params)\n render json: search_results, stat...
[ { "docid": "128fe22051866091ca76c95d473ab43a", "score": "0.7777527", "text": "def call\n filter_by_gender(filter_by_birth(search_by_name))\n end", "title": "" }, { "docid": "a29678826dbb41b83601594650e04037", "score": "0.7720649", "text": "def glob_person_search(given_name, middl...
46fe0a1dc62e02bce6c7bb744be95f23
08142020 "7kyu Reverse Words"
[ { "docid": "c9302bc0901e0b680e9f3b1994c94405", "score": "0.0", "text": "def reverse_words(str)\n str.scan(/(\\s*)(\\S+)(\\s*)/).map { |space1, word, space2| space1 + word.reverse + space2}.join\nend", "title": "" } ]
[ { "docid": "abcc9086485fd7825649a4cf9786564c", "score": "0.7750944", "text": "def reverse_word_by_word_naive(s)\n words = s.split(\" \")\n my_reverse(words).join(\" \")\nend", "title": "" }, { "docid": "7c484b028cd8476dd0df475f47aa8fb7", "score": "0.77027535", "text": "def reverse_...
6991b8fe42b8a0d9faa402759b4cf830
POST /members POST /members.xml
[ { "docid": "0dd63581dbbafbdfc00d13ec7b3a6001", "score": "0.0", "text": "def create\n unless params[:dont_fill_this_in].blank?\n flash[:error] = \"You filled in a field that you shouldn't have, therefore I think you're a robot.\"\n flash.keep\n return redirect_to(new_member_path) \n ...
[ { "docid": "2cdf3962a4674c3153b0342ccb8b7a24", "score": "0.61671525", "text": "def create\n @member = @current_enterprise.members.build(member_params)\n\n respond_to do |format|\n if @member.save\n format.html { redirect_to @member, notice: 'Member was successfully created.' }\n ...
fec1888fe259677a82d26b27e4d332e8
GET /galleries GET /galleries.xml
[ { "docid": "ebd3bf6ae4ee73b452659c58f67fdd14", "score": "0.0", "text": "def index\n \t@galleries = Gallery.find(:all)\n \t@galleries.each do |gallery|\n \t\tgallery.updateRecValue\n \t\tgallery.save\n \tend\n @offset = params[:offset].to_i || 0\n @sort = params[:sort].to_s\n if @sort==\"\"...
[ { "docid": "6694330a3b8825be16bed3ca60ad03c3", "score": "0.8181449", "text": "def galleries\n get(FinerWorks::Gallery, \"/Galleries\")\n end", "title": "" }, { "docid": "2ad857673b102da3aa4bcd5faaebcf56", "score": "0.73518187", "text": "def show\n @gallery = @event.galleri...
2088c4140a37b13cdce0219100f2e8d1
change the status to :pending Return the status == Examples >>> device.pending! => "pending"
[ { "docid": "abb20d0aa873fda0abeade472f37029a", "score": "0.82308006", "text": "def pending!\n self.update_attribute(:status, PENDING)\n end", "title": "" } ]
[ { "docid": "20825183492b3770d1f4e340e657d60d", "score": "0.8182321", "text": "def set_status_to_pending\n self.status = :pending\n end", "title": "" }, { "docid": "4849025071e656e015547b107ef57321", "score": "0.79078853", "text": "def to_pending!\n self.status = 'pending'\n ...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "a2ab36450cd27437c0314ddbec0baea1", "score": "0.0", "text": "def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_token_type = args[:issued_token_type] if args.key...
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
d82ce2021e7491aae192a3f0acac752e
we can see that the 6th prime is 13. What is the 10 001st prime number?
[ { "docid": "90dc00be28020c6bd1be5f007e4d036a", "score": "0.0", "text": "def is_prime?(n)\n if n <= 1\n return false\n elsif n == 2\n return true\n else\n (2..(n-1)).each do |num|\n if n % num == 0\n return false\n end\n end\n end\n return true\nend", "title": "" }...
[ { "docid": "14f9d4dd8edf6b54bb798f5c6d8ab1b5", "score": "0.7431295", "text": "def p7\n\tprimes = [2]\n\t(1...10001).each do\n\t\tprime = next_prime(primes[-1])\n\t\tprimes << prime\n\tend\n\tprimes[-1]\nend", "title": "" }, { "docid": "84a726dd26c92a9b6b56424c99fd4348", "score": "0.72848...
d38a07c8f311004d525bf896777684a4
Override initializer to handle translating facets and for :f_inclusive facets.
[ { "docid": "804e35010b689bf6cb2b79d0095d2d8d", "score": "0.5404748", "text": "def initialize(options, info)\n\n @Queries = []\n @FacetFilters = []\n @Limiters = []\n\n filter_id = 0\n\n # Blacklight year range slider input.\n #\n # 'range' => { 'pub_year_tisim' => { 'begin'...
[ { "docid": "83dc166cdfcd5fd7ea43b8403f4c9187", "score": "0.60137296", "text": "def init_facet_pagination(opt = @raw_options)\n\n case (@facet_field = opt['facet.field'])\n when Array\n @facet_field_array = @facet_field\n @facet_field = nil\n when /^.*}([^}]+)$/\n ...
4f3d24d3290a170366629659585d91f2
Note: this method needs some work/ is not perfect. Takes a string, removes any file extension, splits it on nonalpha characters, throws out empty words words smaller than 5 characters that are not capitalized and all common words. Finally it converts each word to its metaphoned equivalents and returns an array of the o...
[ { "docid": "76738879980be657ec9ab84ecf67ec91", "score": "0.69576156", "text": "def morph(string)\n string.gsub!(/\\.[a-zA-Z]{1,4}$/,\"\")\n words = string.split(/[^a-zA-Z]/).reject{|q| q == \"\" || (q.length < 5 && q.capitalize != q)} - COMMON_WORDS \n morphed_words = wo...
[ { "docid": "e2a3197fba08c5dcd1f8c4a8e3c955b5", "score": "0.6753976", "text": "def word_array(sort_file)\n get_file(sort_file).downcase.gsub(/[^a-z0-9\\s\\--]/,'').split(' ')\nend", "title": "" }, { "docid": "444717c5b9ffabe579478fad85d2737d", "score": "0.6512442", "text": "def word_...
bfd3a81c490061034ec8c0ce62acda5a
GET /brain_candies GET /brain_candies.json
[ { "docid": "9d8eaf1129d12732e19f81cb3dec9ac4", "score": "0.7646885", "text": "def index\n @brain_candies = BrainCandy.includes(:difficulty_level).all\n\n respond_to do |format|\n format.html # index.html.erb.erb\n format.json { render json: @brain_candies }\n end\n end", "title":...
[ { "docid": "b2d08a47e3d6355a15d84cbca689fc25", "score": "0.7045491", "text": "def index\n @candies = Candy.all\n end", "title": "" }, { "docid": "b2d08a47e3d6355a15d84cbca689fc25", "score": "0.7045491", "text": "def index\n @candies = Candy.all\n end", "title": "" }, ...
170e85ec586e0a654614e13956ca835e
Sets the error message to the given value and sets the name to nil.
[ { "docid": "710ed1891cc328e477e8142dd7ce6b95", "score": "0.7150668", "text": "def error=(msg)\n @name = nil\n @error = msg\n end", "title": "" } ]
[ { "docid": "cbb0be26daf8ddd8cc2796694b22f09d", "score": "0.68408215", "text": "def message=(value)\n validate_string(:message, value)\n super(value)\n end", "title": "" }, { "docid": "505140afb55f764065188f272632d530", "score": "0.66514677", "text": "def error_mess...
a52fbd323e158cd5849c3ad88815f1f3
when there is a new game we get a new game object which is stock full of variables.
[ { "docid": "72cb048e99aaa9285802cff4d3036cc0", "score": "0.75652224", "text": "def new_game(game)\n @game = game\n\t@p1 = game.getP1\n\t@p2 = game.getP2\n\t@flag = game.getFlag\n\t@map = @game.get_map\n\tupdate_background\n\tdraw_all_objects\n end", "title": "" } ]
[ { "docid": "8697c327f9e33ca1bda432bcd78b9e23", "score": "0.75931495", "text": "def commandnewgame_gamedata\r\n # Reset frame count for measuring play time\r\n Graphics.frame_count = 0\r\n # Make each type of game object\r\n $game_temp = Game_Temp.new\r\n $game_system = Gam...
32d5455e8eae591fd41b3b057f748136
waits until a 200 response is received from the given url
[ { "docid": "d561844cc02e327261d4fcbd178a916c", "score": "0.8187163", "text": "def wait_for_HTTPOK url\n @logger.debug \"Waiting for server #{url} to start #{@count} attempts remaining\"\n\n begin\n response = RestClient.send('get', url)\n rescue\n @logger.debug 'In...
[ { "docid": "7a25a9a31097c1ede4570568f09a9a65", "score": "0.76641035", "text": "def await_response(url)\n HTTP.get(url).body\n end", "title": "" }, { "docid": "7a25a9a31097c1ede4570568f09a9a65", "score": "0.76641035", "text": "def await_response(url)\n HTTP.get(url).body\n end...
c3871d5222723b5d7f73ef24ab11e035
Add more helper methods to be used by all tests here...
[ { "docid": "b5878c1e7bffddb26b4eed7c0bae5889", "score": "0.0", "text": "def loadDcTest\n $dc = dcs(:two)\n $shirt_deadline = ($dc.start_time - 17.days).end_of_day\n $registration_deadline = ($dc.start_time - 4.days).end_of_day\n $registration_starts = true\n $report_deadline = ($dc.start_...
[ { "docid": "e708ad90e8ce43e3a3a3a99c57b26047", "score": "0.7330966", "text": "def test_legacy_helpers\n assert_equal @patron.primary_phone, @patron.primary_address_phone\n assert_equal @patron.secondary_phone, @patron.secondary_address_phone\n assert_nil @patron.primary_address_mobile_phone\n ...
858899585457d5ddcafac62b5e804834
Notify if game object is dead.
[ { "docid": "1b6aa84c28823297e42f961929c0f91d", "score": "0.62016255", "text": "def dead?; end", "title": "" } ]
[ { "docid": "a406f454ef8889d2a0dbfcb879667362", "score": "0.7800443", "text": "def dead\n @alive = false\n on_dead.call(self) if on_dead\n end", "title": "" }, { "docid": "4fedfb9581e88a6894c7135f984b67e9", "score": "0.7295893", "text": "def isDead\n self.dead\n e...
3cd70b672a3b6ed804e9ea357e848964
def translate(string) vowels = %w[a e i o u] string.split(' ').map do |word| if vowels.include?(word) string.join('ay') else string end end.join(' ') string end
[ { "docid": "71fc13c2208cacb3197bab58a7e11b7d", "score": "0.83166295", "text": "def translate str\n alpha = ('a'..'z').to_a\n vowels = %w[a e i o u]\n consonants = alpha - vowels\n\n if vowels.include?(str[0])\n str + 'ay'\n elsif consonants.include?(str[0]) && consonants.include?(str[1])\n st...
[ { "docid": "7c328d60a6fb82b539fb79614df23bf1", "score": "0.8752505", "text": "def translate(str)\n\tvowel=%w[a e i o u]\n\tcons=[*'a'..'z']-vowel\n\n\ta_str=str.split(\" \")\n\n\tfor i in 0..a_str.length-1\n\t\tif vowel.include?a_str[i][0]\n\t\t\tpig_l = a_str[i] + \"ay\"\n\t\t\treturn pig_l.split(\",\"...
1d3c35fb73ff6c4b23c6b3315e37bb0f
Detaches a disk from an instance.
[ { "docid": "dc9b8e67b45aad6ef9a2726651e746e8", "score": "0.6052873", "text": "def detach_disk request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/zones/#{request_pb.zone}/instances/#{request_pb.instance}/detachDisk\"\n\n query_string_params = {...
[ { "docid": "1f51b6ebfc45fce47e13dcda4ac75d59", "score": "0.7142609", "text": "def destroy\n File.delete(disk_path)\n end", "title": "" }, { "docid": "64e5391d2591c58c7f178d898868e8e0", "score": "0.69835484", "text": "def detach_from(instance, device, options = {})\n in...
5ff179412069b9879939f5b39aebc439
POST /messages POST /messages.json
[ { "docid": "272b244964d131d5184cc203b74f753a", "score": "0.0", "text": "def create\n \n content = params[:content]\n Message.create(content: content, user_id: current_user.id)\n return redirect_to controller: :home, action: :index \n\n # @message = Message.new(message_params)\n\n # res...
[ { "docid": "c31738c4d3e8abb88223bb78078be929", "score": "0.76782715", "text": "def post_messages(options={})\n post(\"1/messages\", options)\n end", "title": "" }, { "docid": "f0e30f164be0ab5b3abd6b7675410795", "score": "0.74923867", "text": "def message(message)\n p...
16b803b43fd0dee9ef28dfe32a45d09f
Hint: If you don't remember how a Ruby method works it's perfectly OK to look it up. That's what the Ruby documentation is for.
[ { "docid": "dadb3495147a7f01e25ea03d1806f994", "score": "0.0", "text": "def test_map_method\r\n array = %w(ruby map method)\r\n assert_equal([\"RUBY\", \"MAP\", \"METHOD\"] , array.map {|e| e.upcase}, \"Convert every string inside the given array to be uppercase\")\r\n end", "title": "" } ]
[ { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.74844235", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.74844235", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", ...
7ed91e0702d529b3838930b78d03ae11
Find the 404 records within all of the ReadLater To manage for split to processing group and process delay
[ { "docid": "2cf2eda89300d011ef4ddd017402c6c0", "score": "0.52846116", "text": "def perform\n job_grouping =\n JobGrouping.new(ReadLater.all.pluck(:id), group_delay_seconds: 30, process_group_chunk: 30)\n\n job_grouping.separate_to_groups.each do |delay, ids|\n ids.each { |id| Delete404Ur...
[ { "docid": "64985ebb8db012a2e12150dfa4bf1b21", "score": "0.6154403", "text": "def recover_failed_records!\n task_records.complete.no_timeout.each do |record|\n Hekenga::TaskSplitter.new(record, @executor_key).call.tap do |new_record|\n next if new_record.nil?\n\n Hekenga::P...
4ea27ebfb08417166532c714a5a5c8e1
Call the block of code passed to this matcher and see if our action has been removed from the cache. We determine the +fragment_cache_key+ here, taking the effort to pass in the controller to this class, because this method only works in the context of a request. Calling the block gives us that request.
[ { "docid": "0cd9b52041d08c374c4bd4b9a5ed045f", "score": "0.7139521", "text": "def matches?(block)\n ActionController::Base.cache_store.reset\n block.call\n @key = @name.is_a?(String) ? @name : @controller_context.controller.fragment_cache_key(@name)\n return ActionCon...
[ { "docid": "aa3e59c7a2c93175ca0c42d2003dcac5", "score": "0.6920046", "text": "def matches?(block)\n block.call\n @key = @name.is_a?(String) ? @name : @controller.fragment_cache_key(@name)\n return ActionController::Base.cache_store.expired?(@key)\n end", "title": ""...
bd8ee0d68603db220f92b90eefc3e673
DELETE /aim_progresses/1 DELETE /aim_progresses/1.json
[ { "docid": "559dffd5bd46f5ea5f6b58c5e811245e", "score": "0.6582215", "text": "def destroy\n @aim_progress = AimProgress.find(params[:id])\n @aim_progress.destroy\n\n respond_to do |format|\n format.html { redirect_to aim_progresses_url }\n format.json { head :no_content }\n end\n ...
[ { "docid": "8bd3dc4926f6bb4e122c3bb028f12936", "score": "0.67103505", "text": "def delete_guest_access_portal(args = {}) \n delete(\"/guestaccess.json/gap/#{args[:portalId]}\", args)\nend", "title": "" }, { "docid": "8bd3dc4926f6bb4e122c3bb028f12936", "score": "0.67103505", "text": "...
9312c0c2c46fef0ddad63711b89a161a
Returns the fully qulaified name of the target method. This is the standard interface used by Ruby Test.
[ { "docid": "d5d5767a674be6a28fc297ccfd7489c3", "score": "0.5910205", "text": "def unit\n \"#{context}##{target}\"\n end", "title": "" } ]
[ { "docid": "ceb3eafe7451afcfeb19604140e86d72", "score": "0.6935106", "text": "def method_name\n self.fullname[/\\A(.*)([\\.\\#])([^\\.\\#]+)\\z/, 3]\n end", "title": "" }, { "docid": "53f8fc6fec994490184b638a3cd12beb", "score": "0.68208927", "text": "def name\n if @interna...
6386d2ae8e16ed1d92fb78fc7ed62d1b
and returns a string in which the first and last letters of every word is swapped. You may assume that every word contains at least one letter, and that the string will always contain at least one word. You may also assume that each string contains nothing but words and spaces Understand the problem: Pass spaceseparate...
[ { "docid": "7af7bd7836326c1e976ac2e3095ecb3f", "score": "0.8131367", "text": "def swap_chars string # my version\n new_string = string.split.map do |word|\n first = word[0]\n word[0] = word[-1]\n word[-1] = first\n word\n ...
[ { "docid": "9ddffa16ee8b0bd6b3fa1f8ab45e73d1", "score": "0.8514832", "text": "def swap(string)\n results = []\n\n string.split.each do |word|\n results << word.chars\n end\n\n results.each do |word|\n word[0], word[-1] = word[-1], word[0]\n end\n\n results.map(&:join).join(\" \")\nend", ...
d7ae751b7d9d1e4d9d48ed45fee839dc
The default port for IMAPS connections, port 993 source://netimap//lib/net/imap.rb755
[ { "docid": "eea76bc9d947490524a1caabf0e68db1", "score": "0.0", "text": "def default_ssl_port; end", "title": "" } ]
[ { "docid": "c8d63493f309b75f14c68a489982885c", "score": "0.86823505", "text": "def default_imap_port; end", "title": "" }, { "docid": "c8d63493f309b75f14c68a489982885c", "score": "0.86823505", "text": "def default_imap_port; end", "title": "" }, { "docid": "f580feb9739844...
5e0f6c1993d64946e498f1c2d5013903
Runs code in the context of this app.
[ { "docid": "1ec22f3fe7b7051dc134769f00cc7f81", "score": "0.0", "text": "def in_app\n previous_app = Thread.current['volt_app']\n Thread.current['volt_app'] = self\n\n begin\n yield\n ensure\n Thread.current['volt_app'] = previous_app\n end\n end", "title": "...
[ { "docid": "20d92ec0e7b654b4bbfe598598b52793", "score": "0.7021249", "text": "def run(context)\n\t\t# nothing to do here\n\tend", "title": "" }, { "docid": "f908ec1d5c9e86f424b264d5787b2ab3", "score": "0.6845196", "text": "def run!\n before_run\n say 'Not implemented ye...
c050839e26c108c991d74b16c98382dc
DELETE /projects/1 DELETE /projects/1.json
[ { "docid": "8c0fed7fec2a25f0e2adce16d3cbf3ca", "score": "0.0", "text": "def destroy\n @project.destroy\n respond_to do |format|\n format.html { redirect_to projects_url, notice: 'project was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "ce10449f9ce0fd62fdc6ce11492b8372", "score": "0.7899063", "text": "def destroy\n @root = \"projects\"\n \n @project = Project.find(params[:id])\n @project.destroy\n\n respond_to do |format|\n format.html { redirect_to projects_url }\n format.json { head :no_content }\...
6a59dd0e60895168ff9a70c9b5125d8a
Determine if it is a nested P2WPKH from key_type.
[ { "docid": "d8400260c8a3024bcec78e0ce055966d", "score": "0.8513194", "text": "def nested_p2wpkh?\n key_type == TYPES[:p2wpkh_p2sh]\n end", "title": "" } ]
[ { "docid": "f425b425c51bd51a92df5262bf43f9bd", "score": "0.71630085", "text": "def p2wpkh?\n key_type == TYPES[:p2wpkh]\n end", "title": "" }, { "docid": "83ba39579a1fbf4085168f5beee8b11c", "score": "0.67740333", "text": "def p2pkh?\n [TYPES[:uncompressed], TYPES[:compre...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "3f163c4fc6ed8154b572857efb575191", "score": "0.0", "text": "def set_item\n @item = Item.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60310465", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.60152966", "text": "d...
8341dd33b36adf91a04aa10a24e8b14a
this can be used in other controller's before actions to authenticate craftee
[ { "docid": "8e12f52a882600e4587a719aea9aca48", "score": "0.66097504", "text": "def is_craftee_authenticated\n unless session[:user_type] == 'craftee'\n flash[:notice] = 'You need to switch to/be logged in as a craftee to continue.'\n redirect_to root_path\n end\n end", "title": "" ...
[ { "docid": "7084fe77c7c433c1759507f1cdb9dda8", "score": "0.77309734", "text": "def preauthenticate; end", "title": "" }, { "docid": "10d8448e7e187686b24c8149e322a5a9", "score": "0.7491025", "text": "def authenticate_user; end", "title": "" }, { "docid": "ff6bc7ad239869693...
3fe544cf0438c57f3a71ca3f0202a2ed
PATCH/PUT /tours/1 PATCH/PUT /tours/1.json
[ { "docid": "ee861203260a0ce7380a8ce08ca0f60d", "score": "0.0", "text": "def update\n if @tour.update(tour_params)\n redirect_to @tour, notice: 'Tour was successfully updated.'\n else\n render :edit\n end\n end", "title": "" } ]
[ { "docid": "9a2c2ad41d6eaacbea85b00ae37cc8cc", "score": "0.64515835", "text": "def update\n @tour = Tour.find(params[:id])\n\n respond_to do |format|\n if @tour.update_attributes(params[:tour])\n format.html { redirect_to @tour, notice: 'Tour was successfully updated.' }\n forma...
f7a386dc48586fa97eeb6414a0094238
Perform a search against the Twitter API
[ { "docid": "343a5f76adf934c8a8120db7911ae87c", "score": "0.63003784", "text": "def search(term)\n raise NoSearchTermException, \"No search term specified\" if term.nil?\n connection do\n client.search(term)\n end \n end", "title": "" } ]
[ { "docid": "235a0420eb95f92d7f85538e34238209", "score": "0.882167", "text": "def search_twitter()\n search_call = \"#{@api_endpoint_twitter}?ors=#{@search_term}&result_type=#{@result_type}&rpp=#{@results_per_page}\"\n @response = http_get search_call\n end", "title": "" }, { "docid": ...
f8e10959ad3c512dce978ccd644e2658
create and return the second computer within this method
[ { "docid": "c448df8d49fb4f970315e22f1096bc4d", "score": "0.6667255", "text": "def second_computer\n second_computer = Computer.new\n second_computer.brand = \"Apple\"\n second_computer.screen_size = 24.0\n second_computer.model_name = \"IMac\"\n second_computer.model_year = 2012\n second_computer\...
[ { "docid": "02f2289fde00a0f9cbefdb6287dd6b21", "score": "0.80267316", "text": "def second_computer\n Computer.new(\"Apple\", 24.0, \"iMac\", 2021)\nend", "title": "" }, { "docid": "19c95254b65c3d0b1e9d90bb3ccdb46b", "score": "0.7283514", "text": "def second_computer\n \nend", "...
daa0b45def0c97e3caec5ee9e46919ca
Allows only states contained in STATES.
[ { "docid": "345cbfece93b134fe45aa93dd229405d", "score": "0.5871532", "text": "def state=(value)\n if STATES.member?(value)\n @state = value\n else\n raise InvalidStateError\n end\n end", "title": "" } ]
[ { "docid": "2ac4bf7ea017315dd5bc55c5259b44cc", "score": "0.7199709", "text": "def valid_state?(state)\n STATES.include?(state)\n end", "title": "" }, { "docid": "b3e53661a6635531db04b26c553bcee1", "score": "0.6640924", "text": "def valid_states\n aasm.states.map(&:name).map(&:...
7910b2cf7abd9622e87c22a7868c8c0c
output all label string versions of objects according to options.
[ { "docid": "8e3957503d792ade361aead63097079d", "score": "0.5267424", "text": "def to_s\n @valids = []\n label_str = []\n (@labels/@options[:per_page]).each_with_index do |hunk,offset|\n hunk.each_with_index do |label,index|\n @valids << label.valid?\n label_str << label.forma...
[ { "docid": "516137a512617adb052ad94df358c4cd", "score": "0.6293287", "text": "def labeling(options={})\n label_options.update(options)\n end", "title": "" }, { "docid": "8e8184ca6c4b24c088e46c31b4e49e64", "score": "0.604672", "text": "def label_items(objects:, labels:)\n show_...
dc585b871afe759467930f4f2d7d9306
Read a &39;iam.ResourcePermission&39; resource.
[ { "docid": "4f80ff85c989f504bf2f158449c1a00b", "score": "0.0", "text": "def get_iam_resource_permission_by_moid_with_http_info(moid, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: IamApi.get_iam_resource_permission_by_moid ...'\n end\n ...
[ { "docid": "1041c24ff797324d5cf868d04db8e3f3", "score": "0.66522527", "text": "def get_permission(resource, permission)\n\t\t\t\tperm = resource_permission(resource)[permission.to_sym]\n\t\t\t\tperm.present? ? perm : false\n\t\t\tend", "title": "" }, { "docid": "78bbf3e799de7f89713ec587a445e...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "094416b5fafebd57feabc06dd860e6a4", "score": "0.0", "text": "def user_params\n params.permit(:name, :email, :password)\n end", "title": "" } ]
[ { "docid": "c1f317213d917a1e3cfa584197f82e6c", "score": "0.6949874", "text": "def allowed_params\n ALLOWED_PARAMS\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.68134874", "text": "def strong_params\n params.require(:listing_member).permi...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ec90b589bee063000ec51babe95929c3", "score": "0.0", "text": "def set_pacote\n @pacote = Pacote.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...
73a4f9035668fe5c49b8822df45a39dd
gives list of symbols based on popularity among users
[ { "docid": "198c2e539f00ec877bbc3ce317e37336", "score": "0.5816269", "text": "def popular_stocks\n #pluck to pull a column of values from a table\n @stocks = Stock.pluck(:symbol)\n # stock_counts is setting a new hash ready to accept new keys with default value 0\n @stock_counts = Hash.new 0...
[ { "docid": "c2438307f1bfcccfb65539f8b4f1d18d", "score": "0.6742991", "text": "def popularity_list\n averageRatingMoviesHash = {}\n @ratedMoviesHash.each {|movie, ratings| averageRatingMoviesHash[movie] = average(ratings) * (2 ** (@ratedMoviesHash[\"#{movie}\"].length / (@allUsersHash.keys.length)....
a1927106dac47cb19c0d659dc7e9ecaf
Creating first step or adding page number to correct step or dont do anything in case if page was refreshed
[ { "docid": "a21f51affc3448873a8925e1f765895a", "score": "0.0", "text": "def update_steps_history # rubocop:disable Metrics/AbcSize\n if history.nil?\n log_action('Creating first step into the back link history')\n session[:back_link_history] = { '1' => page }\n elsif last_step_pa...
[ { "docid": "ccccf7f485042eea5cd5d812c39412f7", "score": "0.6657607", "text": "def next_page!\n return unless next_page?\n @page += 1\n clear!\n end", "title": "" }, { "docid": "88f38ed53e3fdbf6ca153b669b2d4abf", "score": "0.66001856", "text": "def update_page\n i...
38e4f1dbd4f8b95b0258c6acd5937835
Draws Ranges this applies to target tiles as well type = 1: enemy move, attack,and spell field (check_area) 2: actor all (check_area) 3: battler move range only 4: actor moved, but not acted 5: spell target area only 7: weapon range only 8: item range
[ { "docid": "319aa45a5f94a2af022c3ea23e91d6ba", "score": "0.80750746", "text": "def draw_ranges(battler, type)\n \n @cursor.target_area.clear\n attack_spell_min = 0\n help_spell_min = 0\n #set move_range\n restrict_move = (type > 3)\n move_range = restrict_move ? 0 : battler.ba...
[ { "docid": "5e7a04d29ed2c1665d985c8216bda99f", "score": "0.6755549", "text": "def show_range_after_move?\n if GTBS::SHOW_MOVE_ATTACK and @drawn == false and @cursor.at?( @active_battler )\n clear_tr_sprites\n unless @active_battler.perfaction?\n if GTBS::MOVE_INCLUDE_SPELL\n ...
be177c6b8fdea9a26092237f30261293
POST /manager/access_logs POST /manager/access_logs.json
[ { "docid": "12de624b8728c344691f164fd8672a0a", "score": "0.7356186", "text": "def create\n @access_log = AccessLog.new(params[:access_log])\n\n respond_to do |format|\n if @access_log.save\n format.html { redirect_to manager_access_log_path(@access_log), notice: 'Access log was success...
[ { "docid": "16d79b25beb67faf1776f6fe3aebbb8c", "score": "0.7148787", "text": "def create\n @access_log = AccessLog.new(access_log_params)\n\n respond_to do |format|\n if @access_log.save\n format.html { redirect_to @access_log, notice: 'Access log was successfully created.' }\n ...
f1507c69f8dd7a647f35dd4f30f9f7e4
Create attaches a Node to a PeeringGroup
[ { "docid": "a3a7b474c2045aa8671651edd9ed145a", "score": "0.683565", "text": "def create(\n peering_group_node,\n deadline: nil\n )\n req = V1::PeeringGroupNodeCreateRequest.new()\n\n req.peering_group_node = Plumbing::convert_peering_group_node_to_plumbing(peering_group_node)\n ...
[ { "docid": "8fcc3ba16bda28e84673f0bee72413a2", "score": "0.684309", "text": "def add_node_group_node_assignment(node_id, node_group_id, login, password_callback=PasswordCallback)\n setdata = {:node_id => node_id, :node_group_id => node_group_id}\n puts \"Adding using the following setdata #{se...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "526c508dfc0f762008bbcb40d214992a", "score": "0.0", "text": "def set_recording_user\n \n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.61642385", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60448", "text": "def action_hook; ...
991122807f5d554745b433643023b723
Override the original call, to include updating line item's adjustments (specifically for gift packaging) update_order is called after a line item is saved, so this is a great spot to recalculate the adjustments for this line_item
[ { "docid": "ed86e0ed51d5a72cc3a57c89b67a7261", "score": "0.6602724", "text": "def update_order\n # If there is no adjustment for the current gift package, just create one here unless there already is one for the gift package\n if self.gift_package_id && self.gift_package_id > 0 && self.adjustments...
[ { "docid": "7af22ee42fa3e253528c9cc1c424ad72", "score": "0.72322017", "text": "def update_order_item\n \n end", "title": "" }, { "docid": "72e3f54704961429983e55982b034a53", "score": "0.69848496", "text": "def update\n @order.line_items.destroy_all\n @order.update...
4c1501a80951ebf4730d0dd5e52aa36e
Move Cursor Down wrap : Wraparound allowed
[ { "docid": "6b3af57b1fe647ffa217bd51d01f21e6", "score": "0.7879321", "text": "def cursor_down(wrap)\n if @index < 80 or wrap\n @index = (index + 10) % 90\n end\n end", "title": "" } ]
[ { "docid": "e046c150d8718889a7d0dfde66c3b612", "score": "0.794042", "text": "def cursor_down(wrap)\r\n if @index < 80 or wrap\r\n @index = (index + 10) % 90\r\n end\r\n end", "title": "" }, { "docid": "d17c0990991ee633fe6eab49992f877d", "score": "0.7573729", "text": "def ...
4cc14a33211bb03944226e92a981e867
DELETE /rewards/1 DELETE /rewards/1.json
[ { "docid": "8093538bb10214091b3c2dc7dba08f7e", "score": "0.7838806", "text": "def destroy\n @reward = Reward.find(params[:id])\n @reward.destroy\n\n respond_to do |format|\n format.html { redirect_to rewards_url }\n format.json { head :no_content }\n end\n end", "title": "" ...
[ { "docid": "2443db81a40172c30f3cf51e2a36b51b", "score": "0.7847896", "text": "def destroy\n @reward = Reward.find(params[:id])\n @reward.destroy\n\n respond_to do |format|\n format.html { redirect_to rewards_url }\n format.json { head :ok }\n end\n end", "title": "" }, { ...
5dc8f650309c868314985faaa051cc9f
Get the Top Ten High Scores
[ { "docid": "56a45dcee23c8314b942bc786f1aa603", "score": "0.6761053", "text": "def top_ten\n \t@high_scores_top = HighScore.find( :all, :limit=>10, :order=>\"score DESC\" )\n \t\n \t@high_scores_top.each do |score|\n \t\tputs score.score\n \tend\n \t\n #respond_to do |format|\n # format.html...
[ { "docid": "3b26af70bda1991e4845f16740ae6fb6", "score": "0.7965563", "text": "def top_score\n @scores[@top_score_key]\n end", "title": "" }, { "docid": "156a5b0a8175392fca7c1aef925c86a5", "score": "0.76425266", "text": "def top(n, scores)\n scores.sort {|a,b| a[1] <=> b[...
760434ec2af871aa81e0d8341589e7a9
always enter email as lowercase
[ { "docid": "67bcdd680ed10b52f9f652fddd0d6f1d", "score": "0.0", "text": "def email=( text )\n write_attribute( :email, text.downcase )\n end", "title": "" } ]
[ { "docid": "2b2c0688ba3acfcff4c2f18ffcd0d792", "score": "0.8159838", "text": "def normalize_email\n self.email.downcase!\n end", "title": "" }, { "docid": "0d07b11d1187cc435274a74ea1e9f944", "score": "0.809106", "text": "def downcase_email\n \tself.email = email.downcase\n ...
e1904c61dbbfccfa4dbfb74b5276f9e0
POST /ricedishes POST /ricedishes.json
[ { "docid": "17b59a35c118f3373bd2b2d6ab9a1f50", "score": "0.69108266", "text": "def create\n @ricedish = Ricedish.new(ricedish_params)\n\n respond_to do |format|\n if @ricedish.save\n format.html { redirect_to @ricedish, notice: 'Ricedish was successfully created.' }\n format.jso...
[ { "docid": "8d0f0e58afc6f36ddb8dcb07ef8ebd19", "score": "0.6169264", "text": "def index\n @ricedishes = Ricedish.all\n end", "title": "" }, { "docid": "25ff478f7d0a2188ca2f526ef01e2134", "score": "0.5910342", "text": "def destroy\n @ricedish.destroy\n respond_to do |format|...
e429c9c6f6bb81f2d35ab9537c843b12
Override this function to implement your own push promise logic. source://protocolhttp2//lib/protocol/http2/stream.rb425
[ { "docid": "7783b22df9bebe54de0b090136177d6d", "score": "0.74543655", "text": "def accept_push_promise_stream(stream_id, headers); end", "title": "" } ]
[ { "docid": "453b492122585cb8d23ecd0005cad72f", "score": "0.7661267", "text": "def create_push_promise_stream(headers); end", "title": "" }, { "docid": "1326908e97deea781e55f3538af72b1b", "score": "0.7316402", "text": "def send_push_promise(headers); end", "title": "" }, { ...
992f838e520423f6d6f8fe53aec39b91
Is the vehicle is considered active or not? This can be overridden with the active_override flag, but it defaults to detect motion within 3 minutes.
[ { "docid": "6606ecde23a2108817c258de50eb1ceb", "score": "0.6564843", "text": "def active?(threshold = ACTIVE_TIMEOUT)\n active_override? || (offline_for <= threshold)\n end", "title": "" } ]
[ { "docid": "340b01cd9a6abe9d123ff8822412cd57", "score": "0.69658786", "text": "def active?\n if is_active\n return true\n else\n return false\n end\n end", "title": "" }, { "docid": "06465b02cc50192fc5d6e1abe7438e7e", "score": "0.6940124", "text": "de...
94fb9b898a8d0ca67901396fccb4084c
POST /actions POST /actions.xml
[ { "docid": "89d3d5c421e4c6490637d4354f362426", "score": "0.0", "text": "def create\n \n saved = true;\n @claimids = params[:claimids].nil? ? [] : params[:claimids];\n @claimids.split(',').each{|c| \n \n @task = Task.new(\n {\n :claim_id => c, \n :expected_wri...
[ { "docid": "4180d858de91da8e62a829b4a5577430", "score": "0.65598965", "text": "def post(action, **args); end", "title": "" }, { "docid": "b00364108cdea9235d72d185a8b840d4", "score": "0.6495072", "text": "def create_action(body = {})\n post(actions_path, body)\n end", ...
6a671ecb85946db6ce05aa89c024dbc7
////////////////////////////////////////////////////////////////////////// Public Methods ////////////////////////////////////////////////////////////////////////// Start processing
[ { "docid": "c01c69d7895ac9116bcab35bc1182b4a", "score": "0.0", "text": "def start\n super\n create_menu_background()\n if MENU_CONFIG::IMAGE_BG != \"\"\n @bg = Sprite.new\n @bg.bitmap = Cache.picture(MENU_CONFIG::IMAGE_BG)\n @bg.opacity = MENU_CONFIG::IMAGE_BG_OPACITY\n end\n ...
[ { "docid": "88456496f83b2714da4d665630b4971d", "score": "0.736045", "text": "def start_processing\n\t\t@processing = true\n\t\twhile @processing\n\t\t\tevent = self.read_next_event or next\n\t\t\tself.log.debug \"Read event: %p\" % [ event ]\n\t\t\tself.store_event( event )\n\t\tend\n\tend", "title"...
d75bf55a6f40b837dca46a850a556c76
PUT /crossings/1 PUT /crossings/1.json
[ { "docid": "20a60a06690f17dbdddeb22141d3122f", "score": "0.7176993", "text": "def update\n @crossing = Crossing.find(params[:id])\n\n respond_to do |format|\n if @crossing.update_attributes(params[:crossing])\n format.html { redirect_to @crossing, notice: 'Crossing was successfully upd...
[ { "docid": "ea57929739afd32471e5232fe160a49b", "score": "0.691735", "text": "def set_crossing\n @crossing = Crossing.find(params[:id])\n end", "title": "" }, { "docid": "83bf2c92389322c704113a02a6122956", "score": "0.68256795", "text": "def update\n respond_to do |fo...
b26da2f59cd8520c35595f9fe77e4976
Add a callback for subscription updates, which will be called upon receiving a stanza with type: :subscribed :unsubscribe :unsubscribed The block receives two objects: the Jabber::Roster::Helper::RosterItem (or nil) the stanza
[ { "docid": "03a332033d6a6ada22a9cfb147eaf821", "score": "0.6115235", "text": "def add_subscription_callback(prio = 0, ref = nil, &block)\n @subscription_cbs.add(prio, ref, block)\n end", "title": "" } ]
[ { "docid": "eb3d36de93cbc09b09a228c15338a0b2", "score": "0.7231339", "text": "def on_subscribed(&block) @on_subscribed_callback = block end", "title": "" }, { "docid": "0ef11719143c8978689b0a3fc195e16b", "score": "0.6903466", "text": "def on_subscribed(&block)\n\t\t\t\t@_on_subscribe...
cffd978846d588012c7023339a4570a2
The main api endpoint, expects the latitude and longitude to be passed as query paremeters returns the address of the passed in coordinate as well as the address of the nearest gas station
[ { "docid": "646002e0c4c9ad610de162d6b7f175dd", "score": "0.72672427", "text": "def nearest_gas\n #if the lookup is cached we want to return the cached info\n if not Coordinate.cached?(params[:lat], params[:lng]) \n\n #retrieve the closest station using Google Places API\n closest_station...
[ { "docid": "1cee4cf3b55dc89224cf1a3e1b01ff0d", "score": "0.81210554", "text": "def address\n if params.has_key?(:latitude) && params.has_key?(:longitude)\n results = Geocoder.address(\"#{params[:latitude]}, #{params[:longitude]}\")\n if results.nil?\n api_error(404)\n else\n ...
3ade1f2829f64a78724eafc26e9624fc
Inputs id (string, required): the dxid of the app to run name (string, required): the name of the job inputs (hash, required): the inputs instance_type (string, optional): override of the default instance type Outputs id (string): the dxid of the resulting job
[ { "docid": "c3db1052692299c804fcba61cbee8258", "score": "0.69498456", "text": "def run_app\n # rubocop:disable Style/SignalException\n # Parameter 'id' should be of type String\n id = unsafe_params[:id]\n fail \"App ID is not a string\" unless id.is_a?(String) && id != \"\"\n\n # Name sho...
[ { "docid": "a5bb0124de01358852e326d158a7bcb8", "score": "0.71278954", "text": "def run_job_create_submission(params)\n # Parameter 'id' should be of type String\n # Get challenge\n challenge = Challenge.find_by(id: params[\"challenge_id\"])\n raise \"No associated challenge found\" unless ch...
f28db36dd6b26b5fa701bd9512c1d0d2
Initialize state with supplied parameters, and apps as the default apps
[ { "docid": "4d3152fc3fbec48b865bbd7bf6ac4fb3", "score": "0.0", "text": "def initialize(brand, os, version)\n @brand = brand\n @os = os\n @os_version = version\n @volume = 50\n @brightness = 50\n @charge = 50\n @charging = false\n reset_apps\n end", "title": "" } ]
[ { "docid": "9e1d19c5a934d0810fafa01aa5ff0d3d", "score": "0.7045128", "text": "def initialize(apps)\n @apps = apps\n setup_actions()\n end", "title": "" }, { "docid": "7d282e5dbcc860ba1fb217373b24baa7", "score": "0.67873174", "text": "def init!\n @app = APP_SLI...
f464905ba746a9c5dafe8155ed87c917
Financial Health Check Calculate a series of financial ratios to assess financial health
[ { "docid": "13178b407b3c780ad47940dd2208feb1", "score": "0.0", "text": "def financial_health_check_with_http_info(financial_health_check_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FinancialHealthApi.financial_health_check ...'\n ...
[ { "docid": "3ee6b7fb6a8b949931fac2cfed074b3a", "score": "0.6247513", "text": "def fundraising_ratio\n fundraising_ratio = {fundraising_fees: expense_data.fundraising_fees.to_i, funds_raised: Contribution.find(revenue_data.contribution_id).fundraising.to_i}\n end", "title": "" }, { "docid...
0a2c948216807424abc4a05871e859db
Adds an array of objects to the cache.
[ { "docid": "f180c62436262f489035fdf38d01d70d", "score": "0.71979994", "text": "def add(entries)\n entries = Array(entries) # If entries is an array, this is a no-op.\n old_size = @entries.size\n @entries |= entries\n logger.verbose(\"Added #{entries.size - old_size} new entries to ca...
[ { "docid": "49013774edc6455fab1be148110af490", "score": "0.6633977", "text": "def push(name, object)\n if @cache_list[name].length >= @cache_list[\"#{name}_size\"]\n @cache_list[name].shift\n end\n @cache_list[name] << object\n end", "title": "" }, { "docid": "6642cfa6177f03e6...
d70e449f265c3324bf3dc7c7820883b9
Caveat: We use the supersets Windows31J and CP1252 in place of Shift_JIS and ISO 88591 respectively to handle edge cases where latter will not support some characters. The supersets should be safe to use as dropin replacements.
[ { "docid": "cfa23fc620ed25dbc65d8cb223dd1857", "score": "0.6692368", "text": "def encoding\n if japanese?\n 'Windows-31J'\n elsif chinese?\n 'UTF-16'\n else\n 'CP1252'\n end\n end", "title": "" } ]
[ { "docid": "94aba0c73aecec37e7d00a7bc50bf48b", "score": "0.7149568", "text": "def fix_cp1252_utf8(text)\n text.force_encoding('windows-1252').encode('cp1252',\n :fallback => {\n \"\\u0081\" => \"\\x81\".force_encoding(\"cp1252\"),\n \"\\u008D\" => \"\\...
aca0051fb3d10dc20fbc3627c8ce5bf1
Make sure people can specify TLDs
[ { "docid": "5a1ef8df8d4ac626cc3be9ca671ebbd5", "score": "0.6045484", "text": "def test_match_tlds\n assert_nothing_raised {\n @decl.pattern = \"*.tld\"\n }\n\n assert_equal(%w{tld}, @decl.pattern, \"Failed to allow custom tld\")\n end", "title": "" } ]
[ { "docid": "57cddc106793088762688b3d59f7646c", "score": "0.720554", "text": "def canonical_tld?; end", "title": "" }, { "docid": "978a80269499af87a66639fc51edb874", "score": "0.6051899", "text": "def auth_cn_with_tld?(common_name)\n /\\w{2}\\.\\w+(\\.\\w{3,}+)?/.match(common_n...
7c62da3cba75834ac806bcbc9c352054
Checks that the record is not modified if the input_field is not found
[ { "docid": "60e443652b0d3ec7a9536257cc8a4ac0", "score": "0.0", "text": "def test_emit_nested_with_partial_output_structure\n d = create_driver(%[\n add_tag_prefix lookup.\n table_file #{@correct_file}\n field nested.key1\n output_field new.foo\n ])\n\n record = {\n 'foo...
[ { "docid": "1af16739c4b980820ee625a038a653fa", "score": "0.66775435", "text": "def update_only_input\n end", "title": "" }, { "docid": "a6da74aa0a0e21af03d3007b14e635a9", "score": "0.65921915", "text": "def verify_edit(object, raw_field, raw_change)\n if object.list_attributes_...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "a6bc4695270e4269c01f477201253479", "score": "0.0", "text": "def entity_params\n params.require(:entity).permit(:title, :note, :time, :date, :story_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...
e861d7b500d4490257ebc2fe81df3ffc
Method to update the quantity of an item input: item and new quanitity steps: call list item = new quantity p modified list output: modified hash
[ { "docid": "467731572f7162c1b5d54241c8a0746a", "score": "0.0", "text": "def update(list, item, quantity)\n\tlist[item] = quantity\n\tp list\nend", "title": "" } ]
[ { "docid": "221771ca658316b3a3948c1780d40253", "score": "0.83581656", "text": "def update_item_quantity(list, item, quantity)\n# steps: replace the old quantity with the new quantity given in the input\n\tlist[item] = quantity\n# output: hash with updated vlues for given item\n\tlist\nend", "title":...
bda57e7ee0531dca97f29a9a7d0cd7ef
enriches asn returns enrichment data for an ASN
[ { "docid": "ea63ec69bab96cdd547c2f9fa3e6ba49", "score": "0.6570281", "text": "def enrich_asn(query, opts = {})\n data, _status_code, _headers = enrich_asn_with_http_info(query, opts)\n data\n end", "title": "" } ]
[ { "docid": "3adf9e1243423af04a91f0506a0a5ff4", "score": "0.61193633", "text": "def enrich_asn_with_http_info(query, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: Api.enrich_asn ...'\n end\n # verify the required parameter 'query' is se...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f12db7073a83c413169804ce474c1109", "score": "0.0", "text": "def admission_application_params\n params.require(:admission_application).permit(:first_name, :middle_name, :last_name, :phone, :address, :city, :state, :zip_code,\n :legal_sta...
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6978086", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6780264", "text": "def strong_params\n params.requi...
0d80f48f2d1214c3b44e2c3ab467a6a4
Sets the attribute disable_caching
[ { "docid": "b1f4e1431481ae36d7cc6b3b13b0ab27", "score": "0.80452913", "text": "def disable_caching=(_arg0); end", "title": "" } ]
[ { "docid": "1c5c28322aba6c95fc8cc3674ed0bc16", "score": "0.82560617", "text": "def disable!\n @cache_enabled = false\n end", "title": "" }, { "docid": "1c5c28322aba6c95fc8cc3674ed0bc16", "score": "0.82560617", "text": "def disable!\n @cache_enabled = false\n e...
270cf22c9b7ae999f2148f9cd4141d52
GET /celebs GET /celebs.json
[ { "docid": "e248382c852364f824273bf7924f7a0a", "score": "0.65867984", "text": "def index\n @celebs = Celeb.all\n end", "title": "" } ]
[ { "docid": "f57c587fb52700586d523936a5e12b6f", "score": "0.6507874", "text": "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "title": "" }, { "docid": "daad5aeb976f49bf6d33dfaecbba6949", "score": "0.6215836", "text": "def show\n @cerc = Cerc.find(params[:...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "fa061d0bed069e0bbb34defb17a4d30f", "score": "0.0", "text": "def driver_params\n params.require(:driver).permit(:name, :email, :birth)\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...
a75ed15b2c90b081c33ee5d63caf3000
GMAKEPOD_TEST_SECURERANDOM=123456 xargs ruby ../enclosuresprint.rb < smoke.enclosures
[ { "docid": "9b2c80c4b3f730f8520a0559390ee10a", "score": "0.61897755", "text": "def test_enclosures_print_rb\n props, _ = Open3.capture3 \"xargs ruby #{$src}/enclosures-print.rb\", stdin_data: enclosures\n assert_equal props, files\n end", "title": "" } ]
[ { "docid": "37a0b093d0a257433cdcfda92307dae3", "score": "0.58033526", "text": "def gen_tests\n puts \"Generating tests from announcements at '#{Settings[:announces_file]}' and depositing them in '#{Settings[:test_dir]}'...\"\n announces = File.open(Settings[:announces_file],'r')\n servers = JSON.pars...
97471945490f016ced3773c2b3941e95
Returns true if the given Symbol, String or id has a member instance in the enumeration, false otherwise. Returns true if the argument is an enum instance, returns false if the argument is nil or any other value.
[ { "docid": "3af63125a9115f71447eed43bb54ae36", "score": "0.5866774", "text": "def contains?(arg)\n case arg\n when Symbol\n !!lookup_name(arg.id2name)\n when String\n !!lookup_name(arg)\n when Integer\n !!lookup_id(arg)\n when self\n ...
[ { "docid": "40d9f5eb96359acd6397d1d4eb945c1c", "score": "0.6513945", "text": "def in?(enum)\n enum.include? self\n end", "title": "" }, { "docid": "40d9f5eb96359acd6397d1d4eb945c1c", "score": "0.6513945", "text": "def in?(enum)\n enum.include? self\n end", "title": "" }...
9badc3297491decdbce36f3f3482132f
Ensure deleted users cannot sign in
[ { "docid": "a3a8e4790d1ab39fe0ee65932ee451fc", "score": "0.6302578", "text": "def active_for_authentication?\n\t\tsuper && !deleted_at\n\tend", "title": "" } ]
[ { "docid": "655b65c8fdb220d656a6882a98d8af38", "score": "0.7364158", "text": "def ensure_an_admin_remains\n if User.count.zero?\n raise \"Can't delete last user\"\n end\n end", "title": "" }, { "docid": "15019ff173e2d071ce22ec4eb81c93c9", "score": "0.73259485", "text": "d...
8560cdd42a56f6574a57dc34d1d7949b
GET /questions GET /questions.json
[ { "docid": "369e9691dbd08d6caa645deb58d49bac", "score": "0.0", "text": "def index\n @search_query = params[:s]\n @questions = Question.get_ordered_questions(params[:order], params[:page], @search_query)\n # @most_used_tags = ActsAsTaggableOn::Tag.most_used(10)\n end", "title": "" } ]
[ { "docid": "f21bdf5068d061850a35a8ce3e340eba", "score": "0.8136777", "text": "def questions\n self.class.get('/2.2/questions', @options)\n end", "title": "" }, { "docid": "6b4bc6123184f36d8ce205147c430cbc", "score": "0.79126763", "text": "def index\n render json: @questions\n ...
ebd2a55299277a59b210b99368eeddfc
Test video, with an ID that's not the first in a set (should be redirected to first)
[ { "docid": "33e3af371e2f5c7d9b03f91292ca30eb", "score": "0.7697028", "text": "def test_video_not_first_in_set \n get :video, :id => 4\n assert_redirected_to :id => 5\n end", "title": "" } ]
[ { "docid": "cb14c6a37e7b056c70e088e0a9a6959e", "score": "0.6627596", "text": "def test_extract_video_id\n CANDIDATE_URLS.each do |url|\n scheme = SCHEMES.sample\n id = random_id\n url = scheme + url.sub('XXXXXXXXXXX', id)\n\n # Replace placeholder URLs with one of the variants (in...
a624b201562a56c26a8bec09d870915d
we just need to detect it and upload it. then we can make it searchable. and we need the url. so we modify image load concern method in requirement to query for those names. if there is an image_url it will slow things down this idea. so we do something like that so that it loads only once. image_urls => [] we put that...
[ { "docid": "3c0352adf65e09e90dc4713755da2473", "score": "0.0", "text": "def permitted_params\n\t\tputs \"image permitted params are:\"\n\t\tputs Image.permitted_params\n\t\tparams.permit(Image.permitted_params)\n\tend", "title": "" } ]
[ { "docid": "3c79546efc04625a83086e1a345f8cce", "score": "0.6424038", "text": "def check_our_images!\n self.gsub!(/!image (\\w+\\/)?(\\d+)!/) do\n size, id = $1, $2\n size ||= 'thumb/'\n '\"!%s/%s%d.jpg!\":%s/image/show_image/%d' %\n [IMAGE_DOMAIN, size, id, HTTP_DOMAIN, id]\n ...
3692ec248d21c10e1189219ae9fc877e
GET /carousels GET /carousels.json
[ { "docid": "b22e2383a6a9c0aff022b386290dc150", "score": "0.78631276", "text": "def index\n @carousels = @carousel_animation.carousels.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @carousels }\n end\n end", "title": "" } ]
[ { "docid": "b38227cf551c13d00a7e11b939b1840c", "score": "0.7327045", "text": "def index\n @carousels = Carousel.all\n end", "title": "" }, { "docid": "1ce4f14567816a9aa664572a7d5911a4", "score": "0.7207998", "text": "def index\n @animation_carousels = AnimationCarousel.all\n\n...
ab652ef153adf38885b3daa10a958796
GET /email_receives/new GET /email_receives/new.xml
[ { "docid": "de1c6c8e8630bc4d9563aac6fc162cb1", "score": "0.79337454", "text": "def new\n @email_receive = EmailReceive.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @email_receive }\n end\n end", "title": "" } ]
[ { "docid": "b16f5bbda49c5191383afdd6c28e7367", "score": "0.72735983", "text": "def new\n @email_req = EmailReq.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @email_req }\n end\n end", "title": "" }, { "docid": "01fc2ff2fc98ea8e...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "be9dd52f15f06dc1c78e03281721497d", "score": "0.0", "text": "def transaction_params\n params.require(:report).permit(:user_id, :sdate, :edate, :trantype_id, :category_id, :range,:sign)\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...
2b1d2723269cf837551ed82f0cbc8809
skip_before_action :verify_authenticity_token before_filter :authenticate, only: [:client]
[ { "docid": "2af6f282a11b3ca78eb1ac065e47030c", "score": "0.0", "text": "def client\n end", "title": "" } ]
[ { "docid": "fd967d277f41398b80054b41b3b7a8b3", "score": "0.7015667", "text": "def authenticate_client\r\n client_id = request.headers['client-id']\r\n client_secret = request.headers['client-secret']\r\n\r\n unless client_id == Rails.application.secrets.api_key && client_secret == Rails.applica...
a440fc0d799064abd708b31c6370d0d6
PUT /minerals/1 PUT /minerals/1.json
[ { "docid": "f27038dcdd531cbda8774ba2381548c2", "score": "0.74933124", "text": "def update\n @mineral = Mineral.find(params[:id])\n\n respond_to do |format|\n if @mineral.update_attributes(params[:mineral])\n format.html { redirect_to @mineral, notice: 'Mineral was successfully updated....
[ { "docid": "aa79517bf8bd69fa2437c51cfd58fdc4", "score": "0.70577455", "text": "def set_mineral\n @mineral = Mineral.find(params[:id])\n end", "title": "" }, { "docid": "5f054232364b4b2792043767412517a5", "score": "0.67580885", "text": "def create\n @mineral = Mineral.new(param...
fc47e83c4e4b8ae2f98dc59e58b23892
DELETE /subtitle_tracks/1 DELETE /subtitle_tracks/1.json
[ { "docid": "6754094a86cd433be7165fe3cc2edff6", "score": "0.8246977", "text": "def destroy\n @subtitle_track = SubtitleTrack.find(params[:id])\n @subtitle_track.destroy\n\n respond_to do |format|\n format.html { redirect_to subtitle_tracks_url }\n format.json { head :ok }\n end\n e...
[ { "docid": "8e2546e64c25d9f308644c0432771635", "score": "0.80530643", "text": "def destroy\n @subtitle_track_set = SubtitleTrackSet.find(params[:id])\n @subtitle_track_set.destroy\n\n respond_to do |format|\n format.html { redirect_to subtitle_track_sets_url }\n format.json { head :ok...