query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
37e3c2f09a7bd4d62f0e2c5ae642f00f
double value of each even index
[ { "docid": "3792e44789933ea24f243fc0ba4337c1", "score": "0.0", "text": "def double_digits\r\n doubled = []\r\n\r\n string_to_array.each_with_index do |val, index|\r\n if index % 2 == 0\r\n doubled << val * 2\r\n else\r\n doubled << val\r\n end\r\n en...
[ { "docid": "d36b0781a6b5ee75a91a1101288d461c", "score": "0.65886235", "text": "def index_multiplier_method\n #@multiplied_integer_array = []\n @reversed_array.each_with_index do |value, index|\n if index.odd? == true\n value = value * 2\n @multiplied_integer_array << value\n ...
60c5716c64bd78ab024170a6c84a6d42
+app+ must be a valid Rack app (or proc). +blacklist+ should be a Regexp or something that plays nice with this: if env['PATH_INFO'] =~ blacklist ... end Set options[:logger] to whatever logging facility you're using; it should respond to warn(String).
[ { "docid": "5323145ede724fd93c9361a1ab4b6408", "score": "0.738942", "text": "def initialize(app, blacklist, options = {})\n @app = app\n @blacklist = blacklist\n @logger = (options[:logger] || options['logger']) || (Rails.logger if defined? Rails)\n end", "title": "" } ]
[ { "docid": "3378aa163f0acc6fa1ae4f536d64d150", "score": "0.5805325", "text": "def filter_log?(env)\n !@logging_blacklist.include?(env['PATH_INFO'])\n end", "title": "" }, { "docid": "7ee6c2b4bfde9cc5674b32e10adb1354", "score": "0.5740494", "text": "def filter_log(env)\n !LOG...
ca8181aaa44e7c8cfecf9d1389d74a34
Construct a Sass Color from a hex color string.
[ { "docid": "d6bd6f02af145f98d5af6ff830b798e0", "score": "0.6017764", "text": "def hex_color(value, alpha = nil)\n Color.from_hex(value, alpha)\n end", "title": "" } ]
[ { "docid": "4f1884cda0f35914a363332a2276890d", "score": "0.8308673", "text": "def from_hex(str)\n ColorFactory.from_hex(str)\n end", "title": "" }, { "docid": "2abae4c18c295eb4ee58d0abd5479393", "score": "0.74443805", "text": "def from_hex(colorstring)\n string = color...
03520e6bed829d93811e71268296e3ab
Receives HTTP responses for +in_flight+ requests and adds them to +responses+
[ { "docid": "43a071a689dc2b4a2117cede2fda58c2", "score": "0.66017807", "text": "def pipeline_receive in_flight, responses\n while req = in_flight.shift do\n begin\n begin\n res = Net::HTTPResponse.read_new @socket\n end while res.kind_of? Net::HTTPContinue\n\n res.re...
[ { "docid": "b91b8dde04af144eae8625c21b025de7", "score": "0.6135829", "text": "def fetch\n @requests.each { |request| @runner.queue request }\n @runner.run\n @requests.map { |request| request.response }\n end", "title": "" }, { "docid": "4432bf20f7af32b10ce39302b0e1cf1a", ...
28dd82f8df190c5251f21f1ae69c5c3b
Creates a Faraday connection with parsing json and breakers functionality.
[ { "docid": "f192c990f9483dc1354b437b7bd27223", "score": "0.76782477", "text": "def connection\n @conn ||= Faraday.new(base_api_path, headers: base_request_headers, request: request_options) do |faraday|\n faraday.use :breakers\n faraday.use Faraday::Response::RaiseError\n\n far...
[ { "docid": "37d6d574cdae396d37a4081f50e04ad0", "score": "0.7954217", "text": "def faraday\n ::Faraday.new do |builder|\n builder.response :json, content_type: /\\bjson$/\n builder.adapter :test, faraday_stubs\n end\n end", "title": "" }, { "docid": "1504a1d81b248c7...
25a1e5ee2b49588376bb48f89ab3f573
Generate human friendly error message for import result.
[ { "docid": "2a5728dec0a82df26f20c8e2cdddb3b2", "score": "0.7558454", "text": "def generate_import_errors(import_result)\n return nil if import_result.blank?\n html = \"\"\n imported_num = import_result[:imported_num].to_i\n if imported_num == 1\n html << \"<p>#{I18n.t(\"curric...
[ { "docid": "3fe50f880148c306e5d41da1648d430e", "score": "0.78219485", "text": "def import_error_message(error)\n case error['class']\n when InvalidDataError.name\n t('course.assessment.question.programming.form.import_result.errors.invalid_package')\n when Timeout::Error.name\n t('cou...
b3ab1aa3640eb6155ef3244f0a7661a8
Generates a markov table based on the given tweets
[ { "docid": "7078adeaccd7981081964687b2226ea5", "score": "0.7834213", "text": "def markov_table(tweets)\n table = {}\n\n tweets.each do |string|\n prefix = [nil] * @prefix_length\n\n string.split.each do |word|\n next if @bad_words.include? word\n\n # Record ment...
[ { "docid": "b7fa18a0b4801c03617115f9c794a6c2", "score": "0.7216885", "text": "def make_tweet(tweets)\n table = markov_table(tweets)\n tweet = ''\n prefix = [nil] * @prefix_length\n\n word = pick_word(table[prefix.dup])\n\n until word.nil?\n tweet << \"#{word} \"\n ...
f10204cf8f603981dc644c263f420c79
GET /periods GET /periods.json
[ { "docid": "c0d719e8e9ee6dad6d0b3fb8f9b911b6", "score": "0.66798896", "text": "def index\n unless current_user.admin\n @periods = Period.where(user: current_user)\n else\n @periods = Period.all\n end\n end", "title": "" } ]
[ { "docid": "a300719b628c9f9a325bd848999aa577", "score": "0.780969", "text": "def index\r\n @periods = Period.all\r\n\r\n render json: @periods\r\n\r\n end", "title": "" }, { "docid": "bd34e0b40c751d3fa87446290f4fd2e7", "score": "0.7588146", "text": "def list_earning_periods(pa...
5afc13214d5166d6397a72fad68daab8
POST /users POST /users.xml
[ { "docid": "8140ba6b9809c82298feb933e8f75c0e", "score": "0.0", "text": "def create\n @user = User.new(params[:user])\n @cart = current_cart\n\n respond_to do |format|\n if @user.save\n Cart.create(:user_id => @user.id)\n if session[:user_id] && User.find_by_id(session[:user_i...
[ { "docid": "4794c3e6e2db462f4d8769453efddedd", "score": "0.71678036", "text": "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "title": "" }, { "docid": "df2e8c709ee6535536069a3...
2e4b79f49f22faed29068f8b85743850
Sets the destinantion Mauve instance
[ { "docid": "becce6718453493f54e44f5baece2aad", "score": "0.0", "text": "def destination=(d)\n raise ArgumentError, \"destination must be a string\" unless d.is_a?(String)\n @destination = d\n end", "title": "" } ]
[ { "docid": "c012fac206329fcf1d2cd22a55c3c134", "score": "0.5813678", "text": "def set_novedad_mecanica\n @novedad_mecanica = NovedadMecanica.find(params[:id])\n end", "title": "" }, { "docid": "39b412e7f2e847e5f7052bf70b58572b", "score": "0.57188433", "text": "def set_victim\...
44761f0e27de8609fdc7a11878f86754
Visits the function calls for system
[ { "docid": "6da485571ed8845816f86df3274e36f0", "score": "0.6032815", "text": "def visitFCallNode(node)\n if node.name == \"system\"\n add_finding(node) if red_flag?(node)\n end\n end", "title": "" } ]
[ { "docid": "ca848521315d82fdc8f1928b9e0c5f67", "score": "0.6635923", "text": "def system; end", "title": "" }, { "docid": "62302995af611c90145908ddd6dad2c6", "score": "0.60803676", "text": "def visit_command_call(node); end", "title": "" }, { "docid": "71c096a76b2516d3e8f...
f17c454ee7eda8ae8db37c5aeb91bc8a
Parses URL into default components
[ { "docid": "5917e48e01022428187f38fbd9355c7f", "score": "0.60034186", "text": "def parse_url(url)\n Addressable::URI.parse(url)\n end", "title": "" } ]
[ { "docid": "be494245a13119e0c1d10d3ae88380d4", "score": "0.6884703", "text": "def parsed_uri; end", "title": "" }, { "docid": "4353a72b346902e8a800908996433853", "score": "0.68370867", "text": "def uri_parser; end", "title": "" }, { "docid": "a5e3b96b913d1d6910ac03f9323f5...
b95ef17a5d8b719446c55dc01481a007
Attribute Getters / Setters
[ { "docid": "f2ea2aa8e889baad90f5524029fd448d", "score": "0.0", "text": "def mass=(mass)\n @mass = mass\n set_i_mass(@mass)\n end", "title": "" } ]
[ { "docid": "2dc9c5d731b1a45848546ec81f8a4299", "score": "0.7635967", "text": "def attr; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31", "score": "0.762599", "text": "def attribute; end", "title": "" }, { "docid": "639512c2ab926defd80a9c8f2f8c5d31", ...
2301997f789b99f755217d6325752fb4
Extract the specified field
[ { "docid": "e66d89e82d42bfd76b6058d0e1f5edef", "score": "0.0", "text": "def get_ipmi_field(channel, match)\n ouput = %x{ipmitool lan print #{channel}}.split(\"\\n\")\n line = ouput.detect{ |x| x.start_with?(match) }\n value = line.split(':', 2)[1].strip\n value.empty? && nil || value\n end"...
[ { "docid": "86057ab9287848d56ce8b8348e64348c", "score": "0.71860486", "text": "def get_field(field_name)\n fields = @data_source['fields']\n \n fields.each do | f |\n if f['name'] == filed_name\n return f\n end\n end \n return nil\n end", "title": "" }, { ...
e561e11bcf379ef5dc139c210017366b
Only allow a list of trusted parameters through.
[ { "docid": "58a595a25ba206b6fb2aef2e3f98254f", "score": "0.0", "text": "def board_game_params\n params.require(:board_game).permit(:name, :players)\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...
06569cd0e0372090906bc5736404e20b
POST /add_impressions_count_to_products POST /add_impressions_count_to_products.json
[ { "docid": "953063d666741b387ba08f45ceb05fb8", "score": "0.7553439", "text": "def create\n @add_impressions_count_to_product = AddImpressionsCountToProduct.new(add_impressions_count_to_product_params)\n\n respond_to do |format|\n if @add_impressions_count_to_product.save\n format.html ...
[ { "docid": "75b9eee76d4fa41cc02aeea8dd69214f", "score": "0.8040666", "text": "def set_add_impressions_count_to_product\n @add_impressions_count_to_product = AddImpressionsCountToProduct.find(params[:id])\n end", "title": "" }, { "docid": "aa87f2ddf953f8aa72f15f91c7582ab0", "score...
366ea52a14702751b893200edd6fad5d
Defines a class attribute getter stored in Thread.current. Options: :initialize String: expression to initialize the variable is undefined. :default String: expression to return if the variable value if undefined. :transform String: expression to transform the __val variable before returning. Also defines clear_NAME me...
[ { "docid": "235dc6a357a14bdfaeddef709e32c702", "score": "0.7698265", "text": "def cattr_getter_thread *names\n opts = Hash === names[-1] ? names.pop : EMPTY_HASH\n \n initialize = opts[:initialize]\n initialize = \"||= [ #{initialize} ]\" if initialize\n\n default = opts[:defaul...
[ { "docid": "c32369d7307584e2d41bf8e2cc361ffd", "score": "0.6013886", "text": "def cattr_setter_thread *names\n opts = Hash === names[-1] ? names.pop : EMPTY_HASH\n\n transform = opts[:setter_transform]\n transform = \"__val = (#{transform})\" if transform\n\n names.each do | name |\n...
d1bfc74e3056beb4ea0b62d727e3ac49
Queue up a write to be committed later.
[ { "docid": "200abc4e38eaad219a7be51209c9fff9", "score": "0.0", "text": "def enqueue(record)\n @queue << record\n end", "title": "" } ]
[ { "docid": "3dbb16804956109868e40e861150684e", "score": "0.73219496", "text": "def write\n write_pending\n end", "title": "" }, { "docid": "fb38f7d8c4a3683fb6e1c8d59918541f", "score": "0.6946991", "text": "def write(data)\n @write_queue.push(data)\n end", "title": "" ...
98308a6e8472209108d69ee2ae92ddc7
Blends +color+ into this color returning a new blended color.
[ { "docid": "f5f90d8209e4f8fe49a5d4137f586887", "score": "0.73433524", "text": "def blend color\n Color.new(((r + color.r) / 2), ((g + color.g) / 2),\n ((b + color.b) / 2), ((a + color.a) / 2))\n end", "title": "" } ]
[ { "docid": "f4f1f185071954110386edc2b3d71d8a", "score": "0.7174188", "text": "def blend(color, opacity)\n self.class.new(\n self.r * (1 - opacity) + color.r * opacity,\n self.g * (1 - opacity) + color.g * opacity,\n self.b * (1 - opacity) + color.b * opacity\n )\n end",...
fb099d0b5116f174068eb54e9f32c3bf
when an archive record is created it
[ { "docid": "e5f9bd5434fc9dc1a398a0430437bb48", "score": "0.0", "text": "def create\n name = Archive::file_name\n @archive = Archive.new(:filename => \"#{name}.tgz\")\n\n respond_to do |format|\n if @archive.save\n format.html { redirect_to archives_path, notice: 'Archive was success...
[ { "docid": "8e586b9a3eb40ce29688b6f599ca4c0f", "score": "0.65339214", "text": "def attachment_added(obj)\n if @current_journal && !obj.new_record?\n @current_journal.details << JournalDetail.new(:property => 'attachment', :prop_key => obj.id, :value => obj.filename)\n end\n end", "title"...
96ff85a7ed0b15ae74efa2ab9c1f5e86
DELETE /maps/1 DELETE /maps/1.json
[ { "docid": "50333f0f9a2d874b7d24fb20220b44f7", "score": "0.7846998", "text": "def destroy\n @map.destroy\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "77e932f2d232c34f4ffa12e7d486bcb9", "score": "0.7881946", "text": "def destroy\n @map = Map.find(params[:id])\n @map.destroy\n\n respond_to do |format|\n format.html { redirect_to maps_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "...
2f9ad9ae31dadfca4e2594897582af19
ruby is a garbagecollected language, which means that we don't have to manually free up the mmeory O(1) memory
[ { "docid": "0142a81395ed1de99c48d2552a782d8a", "score": "0.0", "text": "def delete_node(node)\n\t##if there is no next node\n\tif node.next\n\t\tneighbor = node.next\n\t\tnode.value = neighbor.value\n\t\tnode.next = neighbor.next\n\telse\n\t\tnode = nil\n\tend\nend", "title": "" } ]
[ { "docid": "aed041e4c4ead52930fb72e57047ae17", "score": "0.74775267", "text": "def garbage_collect\n end", "title": "" }, { "docid": "724e5c07b8ee8f6d9112e89994add844", "score": "0.7418567", "text": "def free() end", "title": "" }, { "docid": "732dd065db565c315eb53f008...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "4752e7ae166a16ffe082c4f24edcb498", "score": "0.0", "text": "def set_society\n @society = Society.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...
2e6374861046adc570bdf5b7edb97a0f
POST /places POST /places.xml
[ { "docid": "6ace7a8e4ef2ca0768de695a904d5b4c", "score": "0.5130742", "text": "def create\n # expire_page :action => :index\n @place = Place.new(params[:place])\n @place.save\n respond_with(@place)\n end", "title": "" } ]
[ { "docid": "f861f5eb827a96dbcb73832288b361af", "score": "0.6196169", "text": "def create\n @place = Place.new(params[:place])\n\n respond_to do |format|\n if @place.save\n format.html { redirect_to(@place, :notice => 'Place was successfully created.') }\n format.xml { render :x...
ea74db35e1af4aac7f3f3cf4f95dd997
GET /city_global_locations GET /city_global_locations.xml
[ { "docid": "9d47a462f3ea0d99c867e1a3c8b72ac5", "score": "0.0", "text": "def index\n # I want pagination... So Replaced following line with CityGlobalLocation.paginate ...\n #@city_global_locations = CityGlobalLocation.find(:all)\n # ...\n # So used http://github.com/mislav/will_paginate/wiki...
[ { "docid": "805e5b54273bb44407911c3295be9010", "score": "0.7520267", "text": "def list_locations\n headers = default_headers\n headers['Accept'] = 'text/xml'\t# JSON locations not supported\n Nokogiri.XML(get('/locations', headers))\n end", "title": "" }, { "docid": "15a3985d45fcfa...
2db18c35e64f0a062573cfe83a16cb3a
////////////////////////////////////////////////////////////////////////// Private Methods ////////////////////////////////////////////////////////////////////////// Draw the icons
[ { "docid": "077da6ec725247f864d3a59f1f2384d1", "score": "0.8453327", "text": "def draw_icons()\n for i in 0 .. @ucIcons.size-1\n @ucIcons[i].cIcon.rect = Rect.new(@rectIcons.x + i*24, @rectIcons.y, 24, 24)\n @ucIcons[i].draw()\n end\n end", "title": "" } ]
[ { "docid": "552de18c1cff7b06230866f50ccb9061", "score": "0.7716722", "text": "def draw()\n if self.iconIndex != nil\n bitmap = Cache.system(\"IconSet\")\n @cIcon.img_bitmap = bitmap\n @cIcon.src_rect = Rect.new(self.iconIndex % 16 * 24, self.iconIndex / 16 * 24, \n ...
89c3e3a6c3c6d1c831c232d632fc1caa
Returns a new Wgit::Url containing just the query string of this URL e.g. Given '?q=ruby' is returned.
[ { "docid": "591f86dcfbd3b5e1b60579c288155830", "score": "0.80677426", "text": "def to_query_string\n query = @uri.query\n query ? Wgit::Url.new(\"?#{query}\") : nil\n end", "title": "" } ]
[ { "docid": "5e1bd785e37a99bf2342f461a1433623", "score": "0.810429", "text": "def without_query_string\n query = to_query_string\n without_query_string = query ? gsub(query, '') : self\n\n Wgit::Url.new(without_query_string)\n end", "title": "" }, { "docid": "332f42d07d7b888...
b86358d8c495420b7aae5396552e1394
The amount of trust a validator puts into another validator is 1 / threshold for the level it is in (this is a trust maximum) if the validator is in an inner set, the inverse thresholds are multiplied. Note that because it is a maximum amount of trust, it is actually possible for the nodes total trust to be higher than...
[ { "docid": "536e940b5d38555901009622fdee776a", "score": "0.5260928", "text": "def trust_from(validator, other_validator)\n trust_table(validator)[other_validator[\"peer_id\"]] || 0\nend", "title": "" } ]
[ { "docid": "8b41d7bbef08e76e813c241f2f6283b5", "score": "0.57434416", "text": "def trust_potential\n (1..[((trust || 0) / 100).round, MAX_TRUST_POTENTIAL].min).to_a\n end", "title": "" }, { "docid": "5052007e94caefd5eef2b72da32c793f", "score": "0.5678468", "text": "def evaluate r...
0adb49740cf229b6617ee8c5aca93ce6
Sugaring to count created collaborations across created classrooms
[ { "docid": "05eaea818d765b9c615e500f30c55cae", "score": "0.8377131", "text": "def created_classrooms_collaborations_count\n created_classrooms.map(&:collaborations_count).reduce(:+).to_i\n end", "title": "" } ]
[ { "docid": "76156342c928c05bcd7880d35ae2fb56", "score": "0.64275205", "text": "def people_in_community_count\n (HumanNetwork.person_entities(self).collect{|h| h.person_id} + self.human_networks.collect{|h| h.person_id} - [self.id]).uniq.count\n end", "title": "" }, { "docid": "e23a7b254f...
25db37af6242865358c69052da5f2a70
returns the number of people that the counter has seen boarding.
[ { "docid": "6f5830de1a210039f5b3f67bdee13f64", "score": "0.0", "text": "def counter_boarded\n @counter_events[current_stop][:boarding]\n end", "title": "" } ]
[ { "docid": "e3f1a58334dc10d030a753d8c051cc31", "score": "0.7571371", "text": "def countNumOnBoard()\n count = 0 ;\n @onBoardList.each{|demand|\n count += demand.numPassenger ;\n }\n return count ;\n end", "title": "" }, { "docid": "dc15baa7fbe7cdedb21ed79208ab95...
5682cc16b88f11d99420d59b4775382c
Read shape paragraph info.
[ { "docid": "87a1d75f045b6f49fa65213460e5372b", "score": "0.5245818", "text": "def get_special_slide_paragraph(name, slide_index, slide_type, shape_index, paragraph_index, password = nil, folder = nil, storage = nil, sub_shape = nil)\n data, _status_code, _headers = get_special_slide_paragraph_with_...
[ { "docid": "5dd18d9f7c2d8555b2b9ce02a6611f45", "score": "0.5930655", "text": "def get_paragraph(name, slide_index, shape_index, paragraph_index, password = nil, folder = nil, storage = nil, sub_shape = nil)\n data, _status_code, _headers = get_paragraph_with_http_info(name, slide_index, shape_index...
8f3e22712a3b4a1b93c06aeb971121ca
Helper method to return errors or desired response data as appropriate. Added just for convenience to avoid having to traverse farther down the response just to get to returned data.
[ { "docid": "e52aa611a198121f3441251a712f3558", "score": "0.63857603", "text": "def return_error_or_body(response, response_body)\n if response.status == 200\n response_body\n else\n raise Getty::APIError.new(response.status, response.body)\n end\n end", "title": "" ...
[ { "docid": "5f93050652e8f712a872909e386dcf93", "score": "0.7081281", "text": "def check_response_and_return_data(resp)\n status = resp.parsed_response['message']['header']['response']['result']\n return resp.parsed_response['message']['body']['bodyContent'] if\n status == 'SUCCESS'\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2910aa03f3e73409e13445292376c53d", "score": "0.0", "text": "def set_fave_img\n @fave_img = FaveImg.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...
5ed4d5477872a89df653102e0b7a6652
Returns the Base64decoded version of +str+. require 'base64' str = 'VGhpcyBpcyBsaW5lIG9uZQpUaGlzIG' + 'lzIGxpbmUgdHdvClRoaXMgaXMgbGlu' + 'ZSB0aHJlZQpBbmQgc28gb24uLi4K' puts Base64.decode64(str) Generates: This is line one This is line two This is line three And so on...
[ { "docid": "45fb7d865994d16a53c6952efeb0d8da", "score": "0.6839895", "text": "def decode64(str)\n str.unpack(\"m\")[0]\n end", "title": "" } ]
[ { "docid": "bcaacd74ca4f1f0b3cb67d48ca396de3", "score": "0.7816812", "text": "def strict_decode64(str)\n return Base64.strict_decode64(str) if Base64.respond_to? :strict_decode64\n\n unless str.include?(\"\\n\")\n Base64.decode64(str)\n else\n raise(ArgumentError,\...
f12423adad8296c3d0c90ece487053aa
syntactic predicate synpred441_Plsql (in plsql.ruby.g) 1030:20: synpred441_Plsql : 'OR' condition_and ; This is an imaginary rule inserted by ANTLR to implement a syntactic predicate decision
[ { "docid": "34b1472b3f469179258b8093fcb7eca6", "score": "0.7961862", "text": "def synpred441_Plsql\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 808 )\n\n # at line 1030:20: 'OR' condition_and\n match( T__51, TOKENS_FOLLOWING_T__51_IN_synpre...
[ { "docid": "2bc08908fb64d4c49a0c203b5933bb25", "score": "0.7775713", "text": "def condition_or\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 196 )\n return_value = ConditionOrReturnValue.new\n\n # $rule.start = the first token seen before ma...
63c1821d0e48230b8f0c16fddff3b7a0
method to reorganize the heap when elements are removed
[ { "docid": "6ca02375d41f0ba94c592c34916bf354", "score": "0.69940186", "text": "def restructure\n heapArray = [@root]\n heapArray.each do |i|\n heapArray.push(i.left) if i.left != nil\n heapArray.push(i.right) if i.right != nil\n end\n if @length == 1\n @root.value = 1\n r...
[ { "docid": "0aaa47c96014e97fd216554e60c8c80f", "score": "0.75826484", "text": "def heap_up\n\t\tsorted = false\n\t\tchild_position = @values.length - 1\n\t\t\n\t\tuntil sorted || child_position == 0\n\t\t\tsorted = true\n\t\t\tparent_position = child_position.odd? ? child_position/2 : child_position/2 -...
68f892d41f47d4691bcc2a2abc2e8c49
GET /toukeis/move_page GET /toukeis/move_page.json
[ { "docid": "fac8841de1e0ec47f9c292edf59c75ee", "score": "0.67337525", "text": "def move_page\n\n logger.debug(\"move_page: \" + params.to_yaml)\n\n # 検索結果をSessionから取得\n @toukeis = session[:toukeis].clone\n\n # # 集計単位のリストを作成する\n # cndKeys = []\n # @toukeis.each {|row|\n # cndKeys <...
[ { "docid": "c2f7869874302ecedb2f8afe3864689c", "score": "0.6593916", "text": "def move\n#\t\treturn render :text => \"Jestem w move #{params.to_yaml}:)\"\n\t @soon=Soon.find(params[:id])\n case params[:move]\n\t\t when \"up\" then @soon.move_higher\n\t \t when \"down\" then @soon.move_lower...
2763f67419fb0186a8086b9da39f0588
Makes sure that a required argument is in the args hash.
[ { "docid": "30ddaab96029e81490b967dc3df244b9", "score": "0.76497453", "text": "def require_arg(args, name)\r\n unless args.key?(name) then\r\n raise ArgumentError.new(\"Missing argument #{name}.\")\r\n end\r\n end", "title": "" } ]
[ { "docid": "6ca8dd68a786e0d46b75fbff476440f1", "score": "0.76332617", "text": "def arg_required(*args)\n args.each{|obj| raise ArgumentError, \"Argument cannot be nil\" if obj.nil? }\n end", "title": "" }, { "docid": "c8d537be7940865bf190c6d045f1c15a", "score": "0.7344448", ...
2b75b1f2637b92a7e298b196e503e0e3
a short string used as a placeholder for the associated descriptionstring
[ { "docid": "8a0cdbcae5bebebd877e9873701feddd", "score": "0.0", "text": "def code\n @data['code']\n end", "title": "" } ]
[ { "docid": "9298e8e74411b4d7ad043901ba249db5", "score": "0.8151145", "text": "def short_description\n description\n end", "title": "" }, { "docid": "7b9990fc1f3f26776926d315ea4ac905", "score": "0.8102762", "text": "def descr_short\n descr = self[:descr].to_s.gsub(\"\\n\", ...
8b6e8311de0ba49e4cd31ec71ce6162a
used to transition from one screen to another return an instance of the screen the app transitions to
[ { "docid": "769bb8afdf0296a2faaa828c87f5df15", "score": "0.6137757", "text": "def transition(transition_options={})\n # uiquery = transition_options[:tap]\n action = transition_options[:action]\n screen_arg = transition_options[:screen]\n should_await = transition_options.has_key?(:await) ? ...
[ { "docid": "9b0f6883bbd09afb89ddfcfea7202394", "score": "0.6415698", "text": "def controller\n rotate_device to: :portrait, button: :bottom\n @screen ||= MainScreen.new\n @screen.will_appear\n @screen.navigation_controller\n end", "title": "" }, { "docid": "c16ecbba252b6983175b9...
03e3aaf17b58d3f6dc2471b44e41a64e
Return datetime of last modifying
[ { "docid": "d16379da1216bcf2c9ccd5315d51bb49", "score": "0.0", "text": "def last_modified\n url = make_uri\n http = Net::HTTP.new(url.host, url.port)\n request = Net::HTTP::Head.new(url)\n request['if-modified-since'] = ''\n response = http.request(request)\n response['last-modified']\...
[ { "docid": "8ede3d6257eabd8757fe046e355d0df5", "score": "0.78510594", "text": "def last_edited\n\t\tself.latest_update.to_date\n\tend", "title": "" }, { "docid": "0125ee765c63acff32412b9e2e3fe52b", "score": "0.7815817", "text": "def last_modified_date_time\n return @la...
ed07626347bc93ac6e2f28d4a8fa136a
Read a &39;niatelemetry.ApicSnmpTrapDetails&39; resource.
[ { "docid": "924c540326bb8d2fd8581ef8000a4f57", "score": "0.56933707", "text": "def get_niatelemetry_apic_snmp_trap_details_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: NiatelemetryApi.get_niatelemetry_apic_snmp_trap_details_...
[ { "docid": "f3b0a09235e627f83108106d7a1bd7c8", "score": "0.6033593", "text": "def get_niatelemetry_apic_snmp_trap_details_list(opts = {})\n data, _status_code, _headers = get_niatelemetry_apic_snmp_trap_details_list_with_http_info(opts)\n data\n end", "title": "" }, { "docid": "...
848e40c4b4a3c7b4202989f1c8e45408
GET /download_registration/1/reset_and_resend Resends the download notice for this registration
[ { "docid": "299204cae256cccae5d8503d381d463b", "score": "0.79462296", "text": "def reset_and_resend\n @download_registration.update(download_count: 0)\n @download_registration.deliver_download_code\n @msg = \"Message to #{@download_registration.first_name} is on its way.\"\n respond_to do |f...
[ { "docid": "48232f7a0b59f52a7c4181221d8ba0f3", "score": "0.6377727", "text": "def forgot_password\n user = UserRequestsPasswordReset.new(:email => registration_params[:email]).call\n UserMailer.password_reset_email(user).deliver if user\n head 204\n end", "title": "" }, { "docid": ...
cc27c0c67af0109338d36cd0e7fc14f4
Create a VM template with onetemplate by passing in a temporary template definition file.
[ { "docid": "dfc54ac67e444b9f908ff01e8a0bcafe", "score": "0.65123093", "text": "def create\n file = Tempfile.new(\"onetemplate-#{resource[:name]}\")\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.TEMPLATE do\n xml.NAME resource[:name]\n xml.MEMORY resource[:memor...
[ { "docid": "e4aaf05efe487addb0118556b5ed62af", "score": "0.71408075", "text": "def create_template(erb, dest)\n template(erb, File.join(target_dir, dest), config)\n end", "title": "" }, { "docid": "2ecf451ffa94ce578dbed75667e5b2bd", "score": "0.70357263", "text": "def cre...
b0b4a1369730f6f1ae5d3958bbc0d556
Step 1 Capture boundary from raw
[ { "docid": "5d2caa4ca12fbddeeb5d7430fca9e2f5", "score": "0.68928605", "text": "def boundary\n @raw.split(\"boundary=\")[1].split(\"\\n\")[0]\n end", "title": "" } ]
[ { "docid": "a3bd02bdd361ea5bf3b80d17686d4de5", "score": "0.6052442", "text": "def frame\n @cap >> @raw\n\n # We'll only use B&W for map detection\n bw = @raw.convert(ColorSpace[:RGB => :Gray])\n\n # We only wanna get hold of the black (dark) map boundary, so we trow\n # away all...
dde14a3081a3a253804a1892ab4cb182
cards est un tableau d'index sur tapis
[ { "docid": "205325a130879c381895bdc4ffa4e736", "score": "0.0", "text": "def try_set(cards)\n try_time = Time.now\n if (is_a_set = is_a_set?(cards.map{|c|self.talon[self.tapis[c]]}))[0]\n if self.etendu == 0 and self.courante < NB_CARTE\n cards.each do |card|\n self.tapis[card]...
[ { "docid": "4360d20adda0eec43160f349bd9e85b9", "score": "0.65944475", "text": "def index\n @cards = @tarot.cards.order(number: :asc)\n end", "title": "" }, { "docid": "b24deb568534736bd337166e40cdd51f", "score": "0.6549855", "text": "def index_of_card(id)\n cards.find_index(fi...
39ec4366c591e6a1ba551c0736ecb584
1 is not a prime number
[ { "docid": "b502bda56f771b39add140881f4f01bd", "score": "0.0", "text": "def prime_number(n)\n if n < 2\n return false\n end\n i = 2\n while i < n\n if n % i == 0\n return false\n end\n i += 1\n end \n return true\nend", "title": "" } ]
[ { "docid": "dd98a79a09f7c9c7079408bb1078c648", "score": "0.8117076", "text": "def is_prime?(num)\n ('1' * num) !~ /^1?$|^(11+?)\\1+$/\n end", "title": "" }, { "docid": "61b4533595a63a66f84de0e15f75bfb5", "score": "0.8033274", "text": "def is_prime?(num)\n if !num.is_a?(Integer) ...
4da7a59346c0f1b244f6a34a4782003f
POST /todos POST /todos.xml
[ { "docid": "189d84867bb9f874d06becde9c2fc44c", "score": "0.63482904", "text": "def create\n\n @todo = current_user.todos.build(params[:todo])\n\n respond_to do |format|\n if @todo.save\n format.html { redirect_to(:todos, :notice => 'Todo was successfully created.') }\n format.xm...
[ { "docid": "1ed3cd966621588f699833da687459ed", "score": "0.70576596", "text": "def create_todo(todo)\n post_vals={:todo => {:project_id => nil, :context_id => todo.context_id, :description => todo.description}}\n options={:basic_auth => @auth, :body => post_vals}\n Rails.logger.debug \"Options ...
df759342cb996564801202afb21b497b
PUT /punch_types/1 PUT /punch_types/1.json
[ { "docid": "0461860efdb66c6e4719ea59a0c5bdea", "score": "0.72707427", "text": "def update\n @punch_type = PunchType.find(params[:id])\n\n respond_to do |format|\n if @punch_type.update_attributes(params[:punch_type])\n format.html { redirect_to @punch_type, notice: 'Punch type was succ...
[ { "docid": "d7326874fccc5b091144ed3a1d489d2d", "score": "0.648516", "text": "def update\n respond_to do |format|\n if @pit_type.update(pit_type_params)\n format.html { redirect_to @pit_type, notice: 'Pit type was successfully updated.' }\n format.json { head :no_content }\n el...
65911e617d1c3df75ab69348141675f7
Sets the password reset attributes.
[ { "docid": "1bd18669844cd6fde749256a6c3f5566", "score": "0.0", "text": "def create_reset_digest\n self.reset_token = User.new_token\n update_attribute(:reset_digest, User.digest(reset_token))\n update_attribute(:reset_sent_at, Time.zone.now)\n end", "title": "" } ]
[ { "docid": "58e818e594c709af66259ea48fb80ae5", "score": "0.7047396", "text": "def send_reset_password_instructions(attributes={})\n send_instructions_for(:reset_password, attributes)\n end", "title": "" }, { "docid": "25ee2d2b1be7272b7d99d5efaf63119a", "score": "0.6689904...
cfef78c6e983be9103231fdd8e580180
Override to specify attributes to initialize a definition with
[ { "docid": "bd3edb6e845304b0251530ba30211286", "score": "0.0", "text": "def init_new_with_attrs\n {\n options: <<~END_CONFIG\n _configurations:\n use_current_version: true\n END_CONFIG\n }\n end", "title": "" } ]
[ { "docid": "c11d27d0c8ac64652d37d731dac755d1", "score": "0.7461617", "text": "def initialize(attribute, *definition)\n self.attribute = attribute.to_sym\n self.values = {}\n self.symbols = {}\n self.options = {}\n self.attr_options = {}\n self.define(*definition)\n end",...
1a5cb1b6519f0a4e7d6cc8a8a5f29e54
main loop for the program
[ { "docid": "0530f02d4a26cb073d4c4f07951c41a5", "score": "0.0", "text": "def call\n IoManager.greeting\n input = format_input\n until input == \"quit\"\n input = @layer == 1 ? layer_input(input) : \"Not Found!\"\n end\n IoManager.goodbye\n end", "title": "" } ]
[ { "docid": "8f1fedb59614b97b331429de521e787b", "score": "0.75860494", "text": "def loop\n end", "title": "" }, { "docid": "7159c9db646621dbb1826b11de83877c", "score": "0.7561641", "text": "def loop\n end", "title": "" }, { "docid": "7159c9db646621dbb1826b11de83877c", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2d80c977010178f081c724eaab3a4a62", "score": "0.0", "text": "def set_property\n @property = Property.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;...
9843ddfbf498aff6f72be46944cd9c4e
I worked on this challenge by myself. Your Solution Below
[ { "docid": "2a6dcd69cab3ad9f6661083bd42b67b9", "score": "0.0", "text": "def do_something (a,b,c)\n a ** b #bet you didn't expect that!\nend", "title": "" } ]
[ { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.66699874", "text": "def solution4(input)\n end", "title": "" }, { "docid": "f712d49ec6c615538b2e2aa846391fda", "score": "0.65802413", "text": "def challenge; end", "title": "" }, { "docid": "eabdd32fa3a69c5639179...
47d1158e7fb484f88629d53a73a41258
POST /navigation_entries POST /navigation_entries.xml
[ { "docid": "277b379d54de3af36e08654e2f5cf6cf", "score": "0.64855915", "text": "def create\n @navigation_entry = NavigationEntry.new(params[:navigation_entry])\n\n respond_to do |format|\n if @navigation_entry.save\n format.html { redirect_to(@navigation_entry, :notice => 'Navigation en...
[ { "docid": "6ee3977e04d433d3671b27626741df46", "score": "0.5658883", "text": "def new\n @navigation_entry = NavigationEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @navigation_entry }\n end\n end", "title": "" }, { "docid...
007c7badf4a7d52d0af18d1f05db8cb9
Returns the database interface object
[ { "docid": "ba383c2fb6bb36b88752d140269fa11d", "score": "0.87229985", "text": "def db_interface\n self.class.database_interface\n end", "title": "" } ]
[ { "docid": "ffc1e0bc34c0be6a7ec4055fba50184c", "score": "0.7376591", "text": "def database\n @database ||= self.class.database\n end", "title": "" }, { "docid": "1af0173b436acae5df6b728c344c2dad", "score": "0.73345596", "text": "def db\n return self.class.db\n end", "...
64d7e7a4d5d5d6b576f524433daf1d31
there is no named parameters, but u cane use hashes
[ { "docid": "aadfeb3fef2f339198ffdd2d67ab4c0f", "score": "0.0", "text": "def tell_the_truth(options={})\n if options[:profession] == :lawyer\n 'i cant'\n else\n true\n end\nend", "title": "" } ]
[ { "docid": "fbb9f3d380a0c5c808032a4b81e39d3f", "score": "0.75555944", "text": "def params=(hash); end", "title": "" }, { "docid": "fbb9f3d380a0c5c808032a4b81e39d3f", "score": "0.75555944", "text": "def params=(hash); end", "title": "" }, { "docid": "7402112b5e653d343b91b6...
ca5ce06bbc21096b07e9cad21de531d2
Play to a random station
[ { "docid": "a455649dffd2f828e5734b6b5c73bc36", "score": "0.58239895", "text": "def play_random(routes)\n routes.sample\n end", "title": "" } ]
[ { "docid": "3e9f4d1403a4327bcf18720a2cd8c0ff", "score": "0.6793578", "text": "def play_song\n\t\tno = rand(10)\n\t\tno.times {print \"#{@name} do be do...\"}\n\t\tputs \"\\n\"\n\tend", "title": "" }, { "docid": "8721c6882d670ca0c53877582990ed1d", "score": "0.6609817", "text": "def pl...
3e7acc17483f6a5d7e9f547574343f99
CSV Aux methods for CSV
[ { "docid": "c465032830749f3a737078b9fd139783", "score": "0.0", "text": "def raw_number(_number, _d)\n formatted_number_without_delimiter(_number, _d)\n end", "title": "" } ]
[ { "docid": "a8cbeda40ecafae56e9239168cc516a1", "score": "0.69694245", "text": "def import_csv_smart\n \n end", "title": "" }, { "docid": "37be4dada7397219816165a92922f06d", "score": "0.68425196", "text": "def csv_row\n #empty by default\n []\n end", "title": "" }, { ...
c97d970e1783d5a55d5ae2a071a7f02e
SMS include equipment name checkbox
[ { "docid": "293c3f64a50b6837a580666ae0735d06", "score": "0.81648797", "text": "def sms_name; det.checkbox(:id, 'enableSMSName'); end", "title": "" } ]
[ { "docid": "39965ffb6448781c56d40df24864a2e6", "score": "0.753414", "text": "def sms_msg; det.checkbox(:id, 'enableSmtpSms'); end", "title": "" }, { "docid": "a3f493a962692513cbc9b04a0dd0f06d", "score": "0.75040317", "text": "def sms_desc; det.checkbox(:id, 'enableSMSDesc'); end", ...
aa10ea4396722aba0433c2706e8cf7a5
input: string of items separated by spaces (example: "carrots apples cereal pizza") steps: Initalize new list with items and respective quantities set default quantity as 0 for each item print the list to the console [can you use one of your other methods here?] call print a list method that we will create output: [wha...
[ { "docid": "a8d1d0da776bf83fc181091c04476905", "score": "0.7246478", "text": "def create_list(items)\r\n item_array = items.split\r\n grocery_hash = Hash.new\r\n item_array.each do |i|\r\n grocery_hash[i] = 1\r\n end\r\n p grocery_hash\r\nend", "title": "" } ]
[ { "docid": "9573415d49d381500b173f75bfb4da56", "score": "0.85677624", "text": "def create_grocery_list(shopping_items)\n # steps:\n # create an empty hash\n grocery_list = {}\n # add items\n # convert input into separate items\n shopping_items = shopping_items.split\n # add items to hash and ...
5895013bae736b595b08b47ff0051d9f
define private accessor methods
[ { "docid": "dc4597b1509b0760ccce3095b813aea9", "score": "0.0", "text": "def getWidth\n @width\n end", "title": "" } ]
[ { "docid": "7701df30c201961ce38c6a9df66e5c23", "score": "0.79395664", "text": "def accessor; end", "title": "" }, { "docid": "7701df30c201961ce38c6a9df66e5c23", "score": "0.79395664", "text": "def accessor; end", "title": "" }, { "docid": "9033a4004eb88fe2a1f0a7e5671e3d95...
a9d830ee897bd6119df705dfd79b81b9
Returns true if the script is in form " ... OP_CHECKMULTISIG"
[ { "docid": "f3dca83b6e3e93c2dd8a997f0ea5fd18", "score": "0.6178987", "text": "def multisig_script?\n detect_multisig_if_needed\n @is_multisig\n end", "title": "" } ]
[ { "docid": "91db4434b934e621ca7dc6ae4571a850", "score": "0.7644813", "text": "def standard_multisig_script?\n return false if !multisig_script?\n\n # Check chunks directly so we make sure OP_<N> are used, not pushdata.\n # Bitcoin allows encoding multisig N and M parameters as pushdata\n ...
b24b4269de03d119f5e7edfe03070f8a
list of museums actually visited by current user
[ { "docid": "fb892d400e41cac6edf88faf42db4901", "score": "0.75292665", "text": "def visited_museums\n visited = self.visits.select { |visit| visit.visited == true }\n visited.map { |visit| visit.museum }\n end", "title": "" } ]
[ { "docid": "c6cddca0cbb06cfaf0e1be8bd030a184", "score": "0.71328175", "text": "def list\n #TODO set visits to an array of visits that are associated with the current user\n end", "title": "" }, { "docid": "4b8c5ff170bbb2ff9f366956b7123ba4", "score": "0.6904916", "text": "def visi...
145d8b2089280400272ddc7ba94cafaf
Create a password reset token
[ { "docid": "94773d2e5a23069c61d14dcd900af149", "score": "0.831077", "text": "def generate_password_reset_token\n token = generate_token\n update(reset_password_token: BCrypt::Password.create(token))\n update(reset_password_sent_at: Time.now.utc)\n token\n end", "title"...
[ { "docid": "49e7b26bb869b4ece0f75ac367250bc0", "score": "0.817299", "text": "def create_reset_token\n reset_digest = User.new_token\n update_attribute(:reset_token, reset_digest)\n update_attribute(:reset_sent_at, Time.zone.now)\n end", "title": "" }, { "docid": "346b7d845e9882f197...
677a428494de472ed39b661668a2c79b
options takes the hash which will allow user to set the custom quality parameter for eg quality paramter q 1..20, audio rate ab 44100, 22050 etc
[ { "docid": "4831dfa0b90136750fc79788acfbd3be", "score": "0.0", "text": "def convert(convert_options = {})\n self.options = convert_options\n\n #symbolize the hash keys\n self.options.symbolize_keys!\n \n #delete the input/output filename if exists in the options hash\n self.in_filename...
[ { "docid": "7f13ca0bb25563e8e72ef7f95961f34f", "score": "0.72984064", "text": "def quality\n @options[:quality] || '100%'\n end", "title": "" }, { "docid": "2c24481e6db04b4bf257e96d9525f787", "score": "0.66322905", "text": "def quality; end", "title": "" }, { "doc...
6937131558e065f32fbaf73e1b6ff081
=begin rdoc This lacks a ! suffix, because it duplicates the argument, and returns the changes made to that duplicate, rather than overwriting. =end
[ { "docid": "c2c5a2d5141ac24992648b649d29e8fd", "score": "0.0", "text": "def perform_replacements_on_contents(contents)\n output = contents.dup\n replacement_of = declare_regexes_and_replacements()\n replacement_of.keys.sort_by { |r| r.to_s }.each do |regex|\n replace = replacement_of[regex]\n o...
[ { "docid": "583cb48e262a81e727a976de188f7f60", "score": "0.66793656", "text": "def original=(_arg0); end", "title": "" }, { "docid": "583cb48e262a81e727a976de188f7f60", "score": "0.66793656", "text": "def original=(_arg0); end", "title": "" }, { "docid": "55a640a4963a4252...
f8f1799f16c913d91e0bdd63a35ed4a8
Applies a _p function returns _op(_p0(_p1(p2(...))))
[ { "docid": "fbbc8cff0d20215714736d63f39320ea", "score": "0.6833523", "text": "def pp(_op, *_p)\n sk!\n send _op\n if _p.length > 1\n pp _p.shift, *_p\n else\n send _p.first unless _p.nil?\n end\nend", "title": "" } ]
[ { "docid": "ff32d36b5f7a5e39078b20dc5777fc67", "score": "0.61636263", "text": "def precedence_of(op); end", "title": "" }, { "docid": "d887c8d2932965836aae9d21608cc355", "score": "0.61424387", "text": "def blpop(*args); end", "title": "" }, { "docid": "d887c8d2932965836aa...
d8b3513b307ade6e48df29abe0bfcc7c
before_filter :admin_auth, :except => [:index]
[ { "docid": "56c09b9f79d9e5de418a39263ffaec47", "score": "0.0", "text": "def new\n @usuario_lugar = UsuarioLugar.new\n @usuario_lugar.lugar = Lugar.new\n @usuario_lugar.usuario = usuario_logged\n end", "title": "" } ]
[ { "docid": "b12e502128bdb6da82c2009dd53a7178", "score": "0.755759", "text": "def authorized\n redirect_to '/admin_login' unless admin_logged_in?\n end", "title": "" }, { "docid": "f5e5f9547137124263a1775148fbcb5f", "score": "0.7541549", "text": "def authorize_admin\n redirect_...
7a36b6a6cc104de43845b564e63f6e47
The methods below are not relevant for the controller. However, for completeness, we override them all to return false.
[ { "docid": "83973b7abeeea32db51e7fdb10a8a3a9", "score": "0.0", "text": "def show?\n false\n end", "title": "" } ]
[ { "docid": "0d718138f2690fe76a07371d5dc96429", "score": "0.68648636", "text": "def should_respond?\n false\n end", "title": "" }, { "docid": "be97f835a8d0620ebe93e4b37d925b84", "score": "0.680586", "text": "def request?\n false\n end", "title": "" }, { "do...
a5f4b7049cc0c4674dd938c754616047
Compares two Query objects according to their query string
[ { "docid": "0ccb65a101582ddaf2beeee5ac8327a1", "score": "0.67785627", "text": "def ==(query)\n query.querystring == self.querystring\n end", "title": "" } ]
[ { "docid": "a1e9cff7f39d71c0e5259cffc26c1553", "score": "0.64629847", "text": "def compare(query, params)\n return (query.to_s == params.value.to_s)\n end", "title": "" }, { "docid": "943f1b845cccc31a4bf4245faccd394c", "score": "0.63446337", "text": "def ==(other)\n as...
ae68ddce2bb1aeba423b742923e29abd
DELETE /likes/1 or /likes/1.json
[ { "docid": "ad66777467eca5f29c7eedf5e5123c86", "score": "0.69008094", "text": "def destroy\n @like.destroy\n respond_to do |format|\n if params[:parent_post_id].present?\n format.html { redirect_to \"/posts/#{params[:parent_post_id]}\", notice: \"Post has been successfully unliked\" ...
[ { "docid": "40edec9f9e4bfa6c359ec51136f6ad3a", "score": "0.7757266", "text": "def delete_likes\n end", "title": "" }, { "docid": "40edec9f9e4bfa6c359ec51136f6ad3a", "score": "0.7757266", "text": "def delete_likes\n end", "title": "" }, { "docid": "40edec9f9e4bfa6c359ec5...
1ac956b4f7f886a84625524ad49e92cf
tile utility methods. calculates the bounding box for a given TMS tile. Based on GDAL2Tiles, Google Summer of Code 2007 & 2008 by Klokan Petr Pridal
[ { "docid": "65ff75637f886710b65525edd457f8de", "score": "0.7392084", "text": "def get_tile_bbox(x,y,z)\n min_x, min_y = get_merc_coords(x * 256, y * 256, z)\n max_x, max_y = get_merc_coords( (x + 1) * 256, (y + 1) * 256, z )\n return \"#{min_x},#{min_y},#{max_x},#{max_y}\"\n end", "title":...
[ { "docid": "2dc2b35d4ba5cccce614eff74a17edec", "score": "0.69788253", "text": "def tile_bounds(tx, ty, zoom)\n res = 180 / 256.0 / 2**zoom\n [\n tx * 256 * res - 180,\n ty * 256 * res - 90,\n (tx + 1) * 256 * res - 180,\n (ty + 1) * 256 * res - 90\n ]\n end"...
a27549ef5b57e501efc5957b6e678f1e
Retrieves attachment with given id from task with given id that belongs to given container
[ { "docid": "25c83f67b6bad8a9deb85a83482008d5", "score": "0.64412767", "text": "def get_attachment_by_id_with_http_info(id, t_instance_id, attachment_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: UserTaskOperationsAndQueriesBPMApi.get_attach...
[ { "docid": "fb5fa73443ca72b4c2128f269b3e73cc", "score": "0.6588824", "text": "def find_by_task(client, task: required(\"task\"), per_page: 20, options: {})\n params = { limit: per_page }.reject { |_,v| v.nil? || Array(v).empty? }\n Collection.new(parse(client.get(\"/tasks/#{task}/attac...
b5caec31f426880e132b8c795ccbade7
DELETE /cost_types/1 DELETE /cost_types/1.xml
[ { "docid": "ac73aa22c389ad77c8032a2588eaa6f4", "score": "0.67668676", "text": "def destroy\n @cost_type = CostType.find(params[:id])\n notice = @cost_type.destroy ? \"Cost Type destroyed\" : \"Unable to destroy Cost Type as it has existing costs\"\n\n respond_to do |format|\n format.html ...
[ { "docid": "3d31539fd902e325ee400a9dfd28ad39", "score": "0.68438804", "text": "def destroy\n @costtype = Costtype.find(params[:id])\n @costtype.destroy\n\n respond_to do |format|\n format.html { redirect_to costtypes_url }\n format.json { head :no_content }\n end\n end", "titl...
52d5f62ed1be59730197006a8f03aaf1
Checks if current host is main_host of Domain, redirect otherwise first domain should have main_host
[ { "docid": "9f3c3599711826520cfd49dadf7450be", "score": "0.72590375", "text": "def check_current_domain\n # cd=current_domain\n # redirect_to [request.protocol,Domain.first.main_host.name,request.port_string].join, :status=>:moved_permanently and return false if cd.nil? #на главный домен\n # re...
[ { "docid": "a85a9365199737b94d2482768efda08d", "score": "0.77582633", "text": "def redirect_to_main_host\n # In production, IDEALS has several domains:\n #\n # * scholarship.illinois.edu (global landing page, still under development,\n # redirects to www.ideals.illinois.edu until it's read...
e8a49f9c41f9130ae642bf1fae186c95
initialize class pokemon with given arguments
[ { "docid": "09cd16979fb8a8000d57e8e6bb8144d8", "score": "0.7919708", "text": "def initialize(given_pokemon_name,given_nickname,given_level,given_moveset)\r\n\t\t@pokemon_name= given_pokemon_name\r\n\t\t@nickname= given_nickname\r\n\t\t@level= given_level\r\n\t\t@moveset= given_moveset\r\n\tend", "ti...
[ { "docid": "53ce99bc798def4a6a364adfa21a8c2e", "score": "0.80909485", "text": "def initialize(id:,name:,type:,db:) \n #step 2:making sure it needs to be initilized and needs a pokemon class\n @id = id \n @name = name \n @type = type \n @db = db\n end", "title": "" }, { "docid...
800126da2478a9bba98c3233ebc81469
Creates a relationship instance between this and the other node. Returns the relationship object
[ { "docid": "bfe7cd37f8ea8537069dcf71eda46a04", "score": "0.82000154", "text": "def new(other)\n @dsl.create_relationship_to(@node, other)\n end", "title": "" } ]
[ { "docid": "6e0ae2ba8e4210954058e769b6a248c0", "score": "0.7772561", "text": "def <<(other)\n @dsl.create_relationship_to(@node, other)\n self\n end", "title": "" }, { "docid": "6e0ae2ba8e4210954058e769b6a248c0", "score": "0.7772561", "text": "def <<(other)\n ...
8ee1f6fee3f5e4ae150862ac2ba9ccec
Filters an array of objects against an expression input the object array variable the variable to assign each item to in the expression expression a Liquid comparison expression passed in as a string Returns the filtered array of objects
[ { "docid": "4b8fe9a7070454b4099ce5e1ab35d3ad", "score": "0.5059999", "text": "def where_exp(input, variable, expression)\n return input unless input.respond_to?(:select)\n\n input = input.values if input.is_a?(Hash) # FIXME\n\n condition = parse_condition(expression)\n @context.stack...
[ { "docid": "dc05266c72be2a423b7c7d176d2ea49e", "score": "0.62694347", "text": "def filter(object_array, args)\n\t\t\tobject_array.reject { |s| args.collect { |k, v| not resolve_to_ids([ *s.send(k) ]).include? resolve_to_ids(v) }.reduce(:|) }\n\t\tend", "title": "" }, { "docid": "28c6a3509785...
22d364765bc929f4ad09f38aaaacabf6
GET /cfos GET /cfos.json
[ { "docid": "0304e27d76f34cdab30d139f6f30eb01", "score": "0.7271917", "text": "def index\n @cfos = Cfo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cfos }\n end\n end", "title": "" } ]
[ { "docid": "96bb9a1ea4ba410091d870f47be05afe", "score": "0.67167777", "text": "def index\n @cofis = Cofi.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @cofis }\n end\n end", "title": "" }, { "docid": "c45e623948c126839a92162439...
d3f09715119d9c6f1cf885cfb8d037d8
method to find user by id
[ { "docid": "8e2ea3abc4eb3673573fba84d9f6cd4c", "score": "0.87001336", "text": "def find_user_by_id(id)\n return unless id\n USERS.find{ |user| user[:id]==id }\n end", "title": "" } ]
[ { "docid": "f28ec13f8b191a15732d1018851ec22c", "score": "0.8825507", "text": "def find_user_by_id(id)\n User.find_by_id(id)\n end", "title": "" }, { "docid": "4b8ef905a4bf077c137243c8ed4d3b58", "score": "0.8735708", "text": "def search_user(id:)\n User.find(id)\n end", ...
ceff084fd9c0ee897e890c1e6f7d2f5c
Set simulation update timestep in seconds.
[ { "docid": "0b2b8a63fbe71750a667e85a0ac9ed73", "score": "0.7583831", "text": "def update_timestep=(timestep)\n timestep = AMS.clamp(timestep.to_f, 1/1200.0, 1/30.0)\n Sketchup.active_model.set_attribute('MSPhysics', 'Update Timestep', timestep)\n sim = MSPhysics::Simulation.instance\n ...
[ { "docid": "8a7a43c35c13d25b2027fe40023a3952", "score": "0.7463439", "text": "def set_update_timestep(time_step)\n @update_timestep = AMS.clamp(time_step, 1/1200.0, 1/30.0)\n end", "title": "" }, { "docid": "dd57816c5be2b88ffc2da713c33f9a4e", "score": "0.73349994", "text": "d...
02e0aa015efdb4d78cb732e85c19a81f
Gets a param from the HTTP post data. Parameter is returned as a list of values. :param name: The param from the HTTP post data. :type name: str :param default: The optional default value. :type default: list :returns: The HTTP param values as a list. :rtype: list
[ { "docid": "d7a5ac784abbd7f2f8be0fb014e51e9f", "score": "0.7544392", "text": "def get_post_param_array(name, default=nil)\n return @post_data[name] || default || []\n end", "title": "" } ]
[ { "docid": "b7ed6f480741f365fe7d54998afc77a5", "score": "0.74778515", "text": "def get_post_param(name, default=\"\")\n return !@post_data[name].nil? ? @post_data[name][0] : default\n end", "title": "" }, { "docid": "516ef92990adf5ccbb12d2e09cf8c772", "score": "0.70060873", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "e256ef2bb9fcec31bbd3cfb1aeb62d40", "score": "0.0", "text": "def framework_params\n params.require(:framework).permit(:name)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7496024", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69581187", "text": "def strong_params\n params.require(:request).permit(param_whit...
b510537e30e44bd41f64a8fabde1f9a3
True if this object references a local object
[ { "docid": "ba0cf33f41ff6fa642669bb9563d63c4", "score": "0.0", "text": "def local?; DRb.here?(uri) end", "title": "" } ]
[ { "docid": "2104e11b112b7d2e26b35ddc4f8cd307", "score": "0.7371843", "text": "def local?\n @local\n end", "title": "" }, { "docid": "77dde9f729f8e20dee85bdd514e43293", "score": "0.7339397", "text": "def local?\n if @local\n true\n else\n false\n end\n end"...
3a793fc09a0b05015df8ab7e543e9311
get all the messages to the public number in the last 10 minutes, and forward them to yourself.
[ { "docid": "b5f1f16e1e15995381b28bc3a1a08b1e", "score": "0.6400182", "text": "def forward\n\tget_messages.each {|msg| @client.account.messages.create(to: params[:From], from: ENV['PRIVATE_SMS_NUMBER'], body: msg.body) }\n\t#If your account is rate limited, this will probably time out and cause an error....
[ { "docid": "574e8d3148abf5b38b0f4ab3796108ea", "score": "0.6693929", "text": "def index\n# if request.post?\n Message.delay(run_at: 1.minute.from_now).create_message\n# end\n\n # Retrieve the last 10 msgs\n @bottom = Message.order(\"id desc\")#.limit(10)\n end", "title": "" }, ...
2e182220c11ca6544c730b94c1e5dfbf
Returns the backtrace (array of strings) with all paths converted to relative paths (where possible).
[ { "docid": "37551c8d871317dd2cd9ceeb69a90d86", "score": "0.6946305", "text": "def backtrace\n make_relative(@backtrace)\n end", "title": "" } ]
[ { "docid": "8db71d7cdd6eb549efd89dacea2f6c41", "score": "0.71350974", "text": "def make_relative(backtrace)\n backtrace.map { |path| Output.relative_path(path) }\n end", "title": "" }, { "docid": "c381e2e01512288f2660f5efd0f07a2b", "score": "0.712901", "text": "def relati...
6320e0638a61262bf0b345cdac14f9d3
The purpose of 'number % dividend == 0' is to determine if number is divisible by dividend. The purpose of the second to last line is to ensure that the factors method returns an array that contains all the divisors of nuber.
[ { "docid": "41cd9ea2fce3b2fcdfad72a765f46c38", "score": "0.8381822", "text": "def factors(number)\n dividend = number\n divisors = []\n while dividend > 0\n divisors << number / dividend if number % dividend == 0\n dividend -= 1\n end\n divisors\nend", "title": "" } ]
[ { "docid": "3323d28aef96c27f6eda972cc26d4d1f", "score": "0.8651044", "text": "def factors(number)\n dividend = number\n divisors = []\n while divisors > 0 do # this is the alternative to a begin loop\n divisors << number / dividend if number % dividend == 0 #number % dividend == 0 checks if the nu...
176289defc2586b7cb851643874660db
DELETE /products/1 DELETE /products/1.json
[ { "docid": "c52c01d26b308b3fa9b8430b0edf8410", "score": "0.73356533", "text": "def destroy\n @product = Product.find(params[:id])\n @product.destroy\n\n respond_to do |format|\n format.html { redirect_to products_url }\n format.json { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "2fa0a3656e86962ca1a10fa31aede189", "score": "0.7658028", "text": "def destroy\n @productos_json.destroy\n respond_to do |format|\n format.html { redirect_to productos_jsons_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "65950...
35cddfa2e608f01e00b1fa75fc25bd17
5 ships per user
[ { "docid": "9234be956dca2cc882172ad8f4f5bc80", "score": "0.58207387", "text": "def build_ships\n 5.times do\n ship = self.ships.build\n ship.populate\n end\n end", "title": "" } ]
[ { "docid": "559f74701bf775f3176933b2c788687b", "score": "0.58765703", "text": "def index\n @ship_users = User.pays.where.not(avatar:nil).order(\"RANDOM()\").limit(4)\n end", "title": "" }, { "docid": "0901615a9db28ac8a2c3fd9e1fb9ec17", "score": "0.57556045", "text": "def amount_o...
86c9b41dfb86238d9768dd498b45a90e
shortcut for setting the HTTP_REFERER variable set_redirect_back '/users'
[ { "docid": "40a527f6a4671c754567a20dc5513445", "score": "0.8451368", "text": "def set_redirect_back(path=\"/back/to/path\")\n @request.env[\"HTTP_REFERER\"] = path\n end", "title": "" } ]
[ { "docid": "59e25ca32fa38a20e8c4732377f149ea", "score": "0.7805424", "text": "def redirect_to_back(options={}, response_status={})\n if !request.env[\"HTTP_REFERER\"].blank? &&\n request.env[\"HTTP_REFERER\"] != request.env[\"REQUEST_URI\"]\n redirect_to :back, response_s...
70f25210171a1767111e8eae0451ce71
Returns true if the desired move is legal. To be considered legal the figure must be able to move to the desired square, the current player must be the owner of the figure on the current square, and the desired square must NOT be populated by the same owner as the figure on the current square.
[ { "docid": "62416bc661f6744cdf660fe54a473ce1", "score": "0.79499835", "text": "def valid_move?(current, goal, current_player)\n if figure_on_square(current).nil?\n puts 'That move is not legal'\n false\n elsif figure_on_square(current).owner != current_player\n puts 'You are not the...
[ { "docid": "d258f6ae7168718c212ed218d3e7a744", "score": "0.7954713", "text": "def is_this_move_legal\n\t\tcurrent_piece = @squares[@from]\n\t\tpossible_target_squares = identify_legal_moves(@from, @squares[@from].owner)\n\t\tunless possible_target_squares.include?(@to)\n\t\t\treturn false\n\t\telse\n\t\...
3089fbd9c3a6fb1e9c45d74066cd4781
Output: array containing every other element from input array
[ { "docid": "34261c6fe7ab9ba4006a473ca6f8107d", "score": "0.6969622", "text": "def oddities(array)\n odd_array = []\n array.each_with_index do |num, idx|\n odd_array << num if idx.even?\n end\n odd_array\nend", "title": "" } ]
[ { "docid": "a53283f89e47362a6d454f352f1d688c", "score": "0.8012194", "text": "def every_other(array) \n new_array = []\n array.each_with_index do |element, index|\n new_array << element if index.even?\n end \n return new_array\nend", "title": "" }, { "docid": "51f2326bb172...
9db59fbed2042b55d16ac6e87722ee96
GET /delivery_methods GET /delivery_methods.json
[ { "docid": "962c7824583f08303a456880cd3ce82d", "score": "0.7634237", "text": "def index\n @title = \"Delivery Methods\"\n \n @delivery_methods = DeliveryMethod.all\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @delivery_methods }\n en...
[ { "docid": "f7a840efa8d4a445092979816c288f52", "score": "0.6468469", "text": "def shipping_methods\n [\"Next Day Shipping\", \"2 Day Shipping\",\"Ground Service\"]\n end", "title": "" }, { "docid": "72f8263a7d7a890c31b5f1a16364535c", "score": "0.6311498", "text": "def shipping\n ...
f2a871487a389dc6aee64d537899ffe3
Each fetch is performed from the time of the most recently caught event or 1 minute back for the first poll. This gives us some slack if hawkular events are timestamped behind the miq server time. Note: This assumes all Hawkular events at maxtime T are fetched in one call. It is unlikely that there would be more than o...
[ { "docid": "53850ccaed3027c69aef6e26b2dc9072", "score": "0.63779664", "text": "def fetch_events\n @start_time ||= (Time.current - 1.minute).to_i * 1000\n $mw_log.debug \"#{log_prefix} Catching Events since [#{@start_time}]\"\n\n new_events = @alerts_client.list_events(\"startTime\" => @start_ti...
[ { "docid": "1a8e63f72c0bbe1973b7ba2ec448ba0d", "score": "0.5988424", "text": "def last_event\n each_event.map(&:last).compact.max_by(&:time)\n end", "title": "" }, { "docid": "db9d6acc529edb08451cdae9535ffff9", "score": "0.5955847", "text": "def pull_hourly_earthqua...
5882686002f474d324958ec0bc64c615
POST /discount_types POST /discount_types.json
[ { "docid": "fa645aaa0e739efcb4521faaeb140bc3", "score": "0.72918105", "text": "def create\n @discount_type = DiscountType.new(discount_type_params)\n\n respond_to do |format|\n if @discount_type.save\n format.html { redirect_to @discount_type, notice: 'Discount type was successfully cr...
[ { "docid": "c606230124e37651d26247b8adda965d", "score": "0.6807122", "text": "def discount_type_params\n params.require(:discount_type).permit(:name, :percentage, :amount)\n end", "title": "" }, { "docid": "2aa45f40dc51a2034de2db9af170b50f", "score": "0.6629799", "text": "def...
bdc11e4e6362c4c5fd58c789ab3e7d9f
Returns the child object if it exists.
[ { "docid": "8563279d5ff6b48b4bd14369ee347146", "score": "0.0", "text": "def nested_object_id\n is_nested && object.respond_to?(:new_record?) && !object.new_record? && object.id\n end", "title": "" } ]
[ { "docid": "280a027239debfbbd31a939040f7aa35", "score": "0.7418472", "text": "def object\n object? ? children[2] : nil\n end", "title": "" }, { "docid": "2d2c30a5866e5c2a7f51f33b243327dc", "score": "0.7119523", "text": "def child(name)\n children.select { |chil...
1d6e14d5a166d708c49814bd5094bbe8
++ Returns the number of edited rows.
[ { "docid": "36ba3170a8126e59ac54c0827ed56c6e", "score": "0.8557518", "text": "def edited_rows_count\n @edited_rows_codes.count\n end", "title": "" } ]
[ { "docid": "6664a0ecc0154ab5ef957b8c70efb3f1", "score": "0.78478944", "text": "def processed_rows\n edited_rows_count + created_rows_count\n end", "title": "" }, { "docid": "b0cc576d183e6d1dc238b0e8650c4a20", "score": "0.7166176", "text": "def row_count\n row_index.length - ...
d7a19a9811a35f110f3a974fd13f6e0d
Returns an array of all AudioAssets as singles It recursively flattens AudioAssets that are not singles.
[ { "docid": "3449cdaaafe34584236a641d671a4801", "score": "0.83018607", "text": "def flatten\n self.audio_assets.collect { |a| a.single? ? a : a.flatten }\n end", "title": "" } ]
[ { "docid": "a92d5c0c9ada1a08aed9ad6b37727450", "score": "0.6114211", "text": "def audio_assets(authored_only = false)\n assets = segments.collect { |e| e.audio_asset }\n authored_only ? assets.select { |a| a.authored? } : assets\n end", "title": "" }, { "docid": "b356bc3cd7f3faba6d378...
4a59f417668157e8989bb6d5ee24abd9
I worked on this challenge with Karen Ball I spent 2 hours on this challenge. Complete each step below according to the challenge directions and include it in this file. Also make sure everything that isn't code is commented in the file. 0. Pseudocode What is the input? an array, a minimum size (integer), and an option...
[ { "docid": "3f5e820a6b169b437915954806871d72", "score": "0.0", "text": "def pad!(array,min_size,value = nil)\n\t\tarray.fill(value,array.length,(min_size - array.length))\nend", "title": "" } ]
[ { "docid": "e04e36ed7563a2412a77f8470793c7e7", "score": "0.8766388", "text": "def pad!(array, min_size, value = nil) #destructive\n if min_size <= array.length\n return array\n elsif min_size > array.length\n solution_array = array\n times_to_pad = min_size - array.length\n times_to_pad.ti...