query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
bdde3000359a4f7710fd62b8b1912b50
GET /clauses GET /clauses.json
[ { "docid": "3feaa978aa883ee209f7e79f72d6e5b4", "score": "0.7080064", "text": "def index\n @clauses = Clause.all\n end", "title": "" } ]
[ { "docid": "53c5e9ee5cf2d7b3d954dfd43406c450", "score": "0.6190568", "text": "def index\n @has_documents = HasDocument.all\n @clauses = Clause.all\n end", "title": "" }, { "docid": "b16379a7c59754816b79e9150b57efbc", "score": "0.54679525", "text": "def index\n render json: ...
727b3da8f0e5f8e5dcd8afff7e070e70
Determines the context to be used for this criteria. If the class is an embedded document, then the context will be the array in the has_many association it is in. If the class is a root, then the database itself will be the context.
[ { "docid": "e43221ca48d7ee874da5ed63f2aed4e0", "score": "0.64046746", "text": "def context_for(criteria, embedded = false)\n embedded ? Enumerable.new(criteria) : Mongo.new(criteria)\n end", "title": "" } ]
[ { "docid": "275c4247117bc895c0dec806fdee124d", "score": "0.65136516", "text": "def context\n @context ||= Contexts.context_for(self, embedded)\n end", "title": "" }, { "docid": "f6a454930ddb6ac3b5c002e36a4c2e8b", "score": "0.54672796", "text": "def context\n @context || ...
a0fb521f71b788ac5119f7dfe591d98f
I return an array formed by a sub array of val where there is no more winning hands and by the score oh the player for the line
[ { "docid": "7f2b17738a53f6985b3df7ce3d5fbf67", "score": "0.0", "text": "def score\n if g = royal_flush?\n r = 5000\n elsif g = straight_flush?\n r = 4000 + g.last.rank\n elsif g = four_of_a_kind?\n r = 3500 + g.first.rank\n elsif g = full?\n high1 = three_of_a_kind?.first...
[ { "docid": "e9ed714d18a201007a8478d54ed09c84", "score": "0.70241207", "text": "def osu_score_array win_condition\n score_array = @game_objects.map{|game| game_meets_win_cond?(win_condition, game) ? game.score_osu.to_i : -1}\n score_array.delete(-1)\n score_array\n end", "title": "" }, ...
a0d0167ab8ac4dadcadd6d02b649d96d
Insert value to insert at the correct index into the array assuming the array is sorted in ascending manner. Restricted arrays cannot be resized. Insert only if there is space in the array. (Hint: if there are no elements with 'SPECIAL_VALUE', there is no room to insert) All subsequent elements will need to be moved fo...
[ { "docid": "cfe945d1c938001064280b5515a47ed5", "score": "0.69526327", "text": "def insert_ascending(array, length, value_to_insert)\r\n if array[length - 1] != SPECIAL_VALUE\r\n return \"No room :(\"\r\n end\r\n\r\n insert_index_found = false\r\n length.times do |i|\r\n if insert_index_found =...
[ { "docid": "12aa1b32b1bdda81ffa2cc3c29694a58", "score": "0.75543135", "text": "def sorted_insert(arr, val)\n\tidx = find_idx(arr) { |e| yield val,e }\n\tidx = arr.length if idx == nil\n\tarr.insert(idx, val)\nend", "title": "" }, { "docid": "538e31aa6d0f2b552bc07a0c90163598", "score": "0...
392785286ed1235d0ee19b13f0ac96b5
Deletes the previous attachment that was replaced, typically called after the model instance is saved with the new attachment.
[ { "docid": "3716ac5cf5c8bbd06a1d231cdc2bd2e6", "score": "0.5820956", "text": "def replace\n _delete(@old, action: :replace) if @old && !cache.uploaded?(@old)\n end", "title": "" } ]
[ { "docid": "7f8d835e83188d430592707c2e45f107", "score": "0.70725", "text": "def attachment_destroy\n\t\t# destroy the particular attachment\n\t\t@case_media_attachment.destroy\n\t\t# after delete that is navigating to the case media page\n\t\tcase_case_media_path(@surgery_case)\n\tend", "title": "" ...
d330d33252ac5d224bafc3c97b8edef0
DELETE /accident_assignee_expenses/1 DELETE /accident_assignee_expenses/1.xml
[ { "docid": "5807d3d3a395a47e95e15ad0c819f2cf", "score": "0.7671043", "text": "def destroy\n @accident_assignee_expense = AccidentAssigneeExpense.find(params[:id])\n @accident_assignee_expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(accident_assignee_expenses_url) }\n...
[ { "docid": "ebcb9406ef8eb58373edbcf11a370458", "score": "0.6924782", "text": "def destroy\n @expense = Expense.find(params[:id])\n @expense.destroy\n\n respond_to do |format|\n format.html { redirect_to(expenses_url) }\n format.xml { head :ok }\n end\n end", "title": "" }, ...
f1d4757dbc3378fa3634157ec5dfa366
Internal: construct the event path to be used by the client paging the URL key for previous/next set of results Returns a String of the partial URI
[ { "docid": "cab71a67e9ccec17f3d6dbe0be974bea", "score": "0.70661795", "text": "def construct_url(paging = nil)\n return \"#{@domain}/events/#{paging}\" if paging\n \"#{@domain}/events\"\n end", "title": "" } ]
[ { "docid": "ebfdd0f0afbd6eb619c355ee39349e7e", "score": "0.6080087", "text": "def epath\n @path\n end", "title": "" }, { "docid": "2cc644386d65ad1a558eec5d54c526e8", "score": "0.6055728", "text": "def event_sub_url\n File.join service_path, 'event_sub'\n end", "title": ""...
fdeb0473ae499fd80af30ced429a0291
NEED TO CREATE A METHOD TO PRINT A SPECIFIC GOAL
[ { "docid": "dfde33c0e31ab8a2a167b23db5449a17", "score": "0.0", "text": "def goal_as_string(specified_goal)\n # some logic\n end", "title": "" } ]
[ { "docid": "2dddbc3397aac81400716f9dd479d683", "score": "0.7178733", "text": "def print\r\n\t\tputs name + className + \" says \" + call\r\n\tend", "title": "" }, { "docid": "efbf2f1c181d496b441236604d854e7f", "score": "0.71604156", "text": "def print(*)\n end", "title": "" ...
f440e0cb7d8b1700d8bc803c7ee2e1e4
Check that one specific unit is fine, i.e. numbers 19 exist exactly once, so that they add up to 45
[ { "docid": "7f0b48a967b3772187c3e89ebc1ad766", "score": "0.694847", "text": "def unit_fine(unit)\n unit.reduce(:+) == 45\n end", "title": "" } ]
[ { "docid": "ccaee75865a4cf2924d065c3e47777f5", "score": "0.6431562", "text": "def is_valid?\n sum_all_doubled_numbers % 10 == 0\n end", "title": "" }, { "docid": "7eec5e5ded123ff24fe229829a47f1b3", "score": "0.63522303", "text": "def is_unit?(unit); end", "title": "" }, {...
51766b8afed93aa5d84bb540c09e866d
TODO better name is this a binding unique to a specific instance (not bound to a class)?
[ { "docid": "6ce2cbb1539010efef3c1c83db9e7603", "score": "0.0", "text": "def singleton?\n options[:singleton]\n end", "title": "" } ]
[ { "docid": "af0873c6f6096fe6e6f182c8086bb8ad", "score": "0.7480102", "text": "def instance_binding\n binding\n end", "title": "" }, { "docid": "cc3745b2b9d280cc511ecd0e62c933a6", "score": "0.7263089", "text": "def binding_for(target); end", "title": "" }, { "docid": "...
6caf17df9c4df34c8f90aceeb7d96b23
that contain every vowel. Vowels are the letters a, e, i, o, u. A pair should have its two words in the same order as the original array. Example: all_vowel_pairs(["goat", "action", "tear", "impromptu", "tired", "europe"]) => ["action europe", "tear impromptu"]
[ { "docid": "7198aef2aaf5ca15a618b7c2f08bfb99", "score": "0.7453316", "text": "def all_vowel_pairs(words)\n vowels = %w(a e i o u)\n best_pairs = []\n\n words.each_with_index do |word1, idx1|\n words.each_with_index do |word2, idx2|\n next if idx2 < idx1 || idx1 > words.length ...
[ { "docid": "1811a4bfa3e437da50a91939ec4b67f1", "score": "0.8143777", "text": "def all_vowel_pairs(words)\n all_pairs = []\n words.each_with_index do | word_1, ind_1 |\n words.each_with_index do | word_2, ind_2 |\n if ind_2 > ind_1\n all_pairs << [ word_1, word_2 ]\...
cac3e41604d8e3dffc02d86e057b67e3
Method gets single could details
[ { "docid": "0606be0f0c804ae37ed1ae0f64351bba", "score": "0.0", "text": "def get_cloud(cloud_id)\n http_get_request(Scalarium.clouds_url+\"/#{cloud_id}\") \n end", "title": "" } ]
[ { "docid": "95678bb3926d17fe4e2db38efeec4c11", "score": "0.76821506", "text": "def get_infos\n #detail = Info.find_by_status(true).detail\n #if detail \n # return detail\n #else\n # return \"wating for updatting.....\"\n #end\n info = Info.random_to_show_info\n return info.deta...
8190a6e6ba1a98ebaae690d48b020289
Sets the \variant for template.
[ { "docid": "5c29c679427eb327707d35d2303420a4", "score": "0.51710516", "text": "def variant=(variant)\n variant = Array(variant)\n\n if variant.all?(Symbol)\n @variant = ActiveSupport::ArrayInquirer.new(variant)\n else\n raise ArgumentError, \"request.variant must b...
[ { "docid": "d8f37916af667c1d7ff2c803d945e6a1", "score": "0.74601746", "text": "def variant=(variant); end", "title": "" }, { "docid": "097c0d64859ae046e530b05c54217f4e", "score": "0.6884572", "text": "def assign_default_template\n self.variant ||= Variant.default.first\n end"...
2a898f6bb8533bc98a69738fecbdb87d
POST /store_types POST /store_types.json
[ { "docid": "853021c40a024313d1c878b5e8ed52f8", "score": "0.6965535", "text": "def create\n @store_type = StoreType.new(params[:store_type])\n\n respond_to do |format|\n if @store_type.save\n format.html { redirect_to @store_type, notice: 'Store type was successfully created.' }\n ...
[ { "docid": "5efd850e6c8d282f69c63873ec7fcbfa", "score": "0.7047944", "text": "def create\n @store = Store.new(store_params)\n\n respond_to do |format|\n if @store.save\n format.html { redirect_to @store, notice: 'La tienda se ha creado correctamente.' }\n format.json { render :s...
210988d342f8cabaafbeee0aaf14dbed
Returns a cache key for the collection of all pages.
[ { "docid": "8319239192c07c374a9c8af268d43a6c", "score": "0.7636949", "text": "def pages_cache_key\n [\n Page.count,\n Page.order(\"updated_at DESC\").first\n ]\n end", "title": "" } ]
[ { "docid": "d9c4a75b55989997690ffbc751fefb82", "score": "0.68066376", "text": "def cache_key_without_timestamp\n \"#{model_name.cache_key}/all/#{count}\"\n end", "title": "" }, { "docid": "bd9bfd3793d4c67a751e92af94dc7439", "score": "0.67843574", "text": "def cache_key\n ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "0f4e5778ebc80b6a844bec8a33fa122e", "score": "0.0", "text": "def set_url\n @url = Url.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...
34595ec2ce97d0be6588504d512ec118
updated the of dates
[ { "docid": "4e73139db4bdafe9e0ee1a9dd5a6508a", "score": "0.0", "text": "def update\n @exam = Exam.find(params[:id])\n\n if @exam.update!(exam_params)\n render json: @exam, status: :ok\n else\n render json: @exam.errors, status: :unprocessable_entity\n end\n end", "title": "" ...
[ { "docid": "d9d0c68fb2d426cdaed0bea7156a6a38", "score": "0.7954521", "text": "def update_date\n end", "title": "" }, { "docid": "301b76e5a9419df40f3b87393643f219", "score": "0.76006603", "text": "def update_date; end", "title": "" }, { "docid": "e16be4cd3690b2ec40635...
7894dac605df3abb625256385ac80e31
PUT /groups/1 PUT /groups/1.json
[ { "docid": "e4e41766d2c601b5ad23c7e5eae451bf", "score": "0.7030311", "text": "def update\n @group = Group.find(params[:id])\n\n respond_to do |format|\n if @group.update_attributes(params[:group])\n format.html { redirect_to @group, notice: 'Group was successfully updated.' }\n ...
[ { "docid": "ec36e491aa5e69bc0da0412d4ac49ae8", "score": "0.7593614", "text": "def update_group(group_id, request)\n start.uri('/api/group')\n .url_segment(group_id)\n .body_handler(FusionAuth::JSONBodyHandler.new(request))\n .put()\n .go()\n end", "tit...
6e14bc2c72cb20bd40a14fd23e5f3d65
GET /mostsmallitems/new GET /mostsmallitems/new.json
[ { "docid": "d0a7ac6d02516cc84b084a87e08846c3", "score": "0.8060493", "text": "def new\n @mostsmallitem = Mostsmallitem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mostsmallitem }\n end\n end", "title": "" } ]
[ { "docid": "a9de83f0e823806544d9255efd05d132", "score": "0.75705403", "text": "def new\n @new_item = NewItem.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_item }\n end\n end", "title": "" }, { "docid": "929a5684d13d100bdc839...
8af53de09977bcc6d32c3fef91da7b84
PATCH/PUT /grading_levels/1 PATCH/PUT /grading_levels/1.json
[ { "docid": "efef830948abb44c5a643b929e4bd2b9", "score": "0.75985634", "text": "def update\n respond_to do |format|\n if @grading_level.update(grading_level_params)\n format.html { redirect_to @grading_level, notice: 'Grading level was successfully updated.' }\n format.json { render...
[ { "docid": "ea782de4f224e6b34a98563e51dbdf98", "score": "0.77510613", "text": "def update\n @grading_levels ||= @batch.grading_levels\n @grading_level1.update(params_grade)\n flash[:notice] = t('grade_update')\n end", "title": "" }, { "docid": "15013567c55317bc5b979fce2e7cfd77", ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "c2484b47b78a0e64da2bce383997d4f3", "score": "0.0", "text": "def set_collectible_attribute_list\n @collectible_attribute_list = CollectibleAttributeList.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;...
87fcbca07a828f3ea07d600554c3f134
When passed a block, yields ConnectAppInstance records from the API. This operation lazily loads records as efficiently as possible until the limit is reached. source://twilioruby//lib/twilioruby/rest/api/v2010/account/connect_app.rb68
[ { "docid": "abc7181aaa3fa40e9807e1a6e9021314", "score": "0.0", "text": "def each; end", "title": "" } ]
[ { "docid": "8510b02019c3ea6c88ddc9179865acc5", "score": "0.54555136", "text": "def each(&block)\n @apps.each(&block) if @apps\n end", "title": "" }, { "docid": "c476e981570518dcbe3483f59b2385aa", "score": "0.53259856", "text": "def get_app_list\n page = params[:page].b...
a6527a2ee7f77ed7a93a4b65ae76ef25
Obtain an InputSet object, used to define inputs for an execution of this Choreo.
[ { "docid": "220cd9d5cd80745547c7913475401533", "score": "0.0", "text": "def new_input_set()\n return FindStoriesByNeighborhoodInputSet.new()\n end", "title": "" } ]
[ { "docid": "d8eb34cfc5a1e737977f7023d4849c46", "score": "0.6740161", "text": "def new_input_set()\n return CreateObjectInputSet.new()\n end", "title": "" }, { "docid": "7c0d7c433cd4eb8e36bdc3a383e9ec33", "score": "0.65792465", "text": "def new_input_set()\n return Ru...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "ef78fa5c641daa35a4bceb02cbdea87b", "score": "0.0", "text": "def set_ro_r_list\n @ro_r_list = RoRList.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;...
e0971f57a2c773e61a2e3492734c38d0
Lists keys starting with +prefix+ follwing +after+ up to +limit+. If +after+ is nil the list starts at the beginning.
[ { "docid": "b1123b67a3e431b78a71463540ad3a09", "score": "0.74777406", "text": "def _list_keys(domain, prefix = '', after = '', limit = 1000, &block)\n # this code is based on server/lib/MogileFS/Worker/Query.pm\n dmid = get_dmid(domain)\n\n # don't modify passed arguments\n limit ||= 1000\n ...
[ { "docid": "ec87ee36f52d4edf5406a26e662ba8c9", "score": "0.79034305", "text": "def list_keys(prefix, after = nil, limit = 1000, &block)\n if @backend.respond_to?(:_list_keys)\n return @backend._list_keys(domain, prefix, after, limit, &block)\n end\n\n res = begin\n @backend.list_keys(...
c57b6ac4d57edd4862a46f43343b1bd8
Set the value of the LenderName input for this Choreo.
[ { "docid": "b50b9681854871884d96b33da91c7e1e", "score": "0.7518698", "text": "def set_LenderName(value)\n set_input(\"LenderName\", value)\n end", "title": "" } ]
[ { "docid": "e1c1c2c64deabd5d96e94583f691b12a", "score": "0.6204595", "text": "def set_lender\n @lender = Lender.find(params[:id])\n end", "title": "" }, { "docid": "85aa213456ae541d6cc003580b0a57da", "score": "0.52941936", "text": "def name=(new_name=\"\")\n (raise Cloud...
0e0df32124b9f4734b93ebd009f47cc0
DELETE /posts/1 DELETE /posts/1.json
[ { "docid": "2c9864d3343606b18c52d3ef0991552a", "score": "0.0", "text": "def destroy\n @post = Post.find(params[:id])\n @comments = Comment.find(:all, :conditions=>{:post_id=>@post.id})\n @comments.each do |comment|\n\t comment.destroy\n\t end\n @post.destroy\n\n respond_to do |forma...
[ { "docid": "d2967b0b04aeff2fcebfecba1d4cd0a1", "score": "0.7746168", "text": "def destroy\r\n @post.destroy\r\n\r\n render json: {}, status: :ok\r\n end", "title": "" }, { "docid": "0bb7e18bf412742726aadde12b6d1174", "score": "0.7729559", "text": "def destroy\n @post.destro...
bf1f3fd32d045d0df9bf5b74becc91fa
Attempt to figure out the date of the post. The date should be present in the source path, but users may also provide a date in the frontmatter in order to provide a time of day for sorting reasons.
[ { "docid": "f10d9f7b3657dfe43d9270337c5c003c", "score": "0.8357406", "text": "def date\n return @_date if @_date\n\n frontmatter_date = data[\"date\"]\n\n # First get the date from frontmatter\n if frontmatter_date.is_a? Time\n @_date = frontmatter_date.in_time_zone\...
[ { "docid": "ec66ec0a4d4e81fa4f32c67589d03e84", "score": "0.74694365", "text": "def post_date(post)\n post_link = post.xpath(\"h2/a\").first.attribute(\"href\").to_s\n\n if post_link =~ /lizards\\.opensuse\\.org\\/([0-9]{4}\\/[0-9]{2}\\/[0-9]{2})\\//\n return Date.parse(Regexp.last_match[1])\n...
5de9759e922265d7d7f6d42bce373249
update Updates the minimap and sprite movement on the minimap.
[ { "docid": "0c2dc2af98115429a1f424822a827303", "score": "0.63861054", "text": "def update(override = false)\n # creates the passable floor map if new map entered\n create_passable_floor if @map_id != $game_map.map_id\n # get events\n ev = check_events\n # if events or names changed\n i...
[ { "docid": "410a8e793c81ce61950df74ced98d741", "score": "0.7423394", "text": "def update\n sprite.update\n sprite.x = @map.x + @x * 32 unless moving?\n sprite.y = 32 + @map.y + @y * 32 unless moving?\n end", "title": "" }, { "docid": "4ec05a3417dae26ea486f37fbb5b6036", "score":...
c923345fc182849edd9dae46a1e2d468
move accepts index and player's character. places the player's character at provided index
[ { "docid": "8748e2e551d2c1eb894a932e9f15bcf4", "score": "0.0", "text": "def move(index,token)\n return @board[index] = token\n end", "title": "" } ]
[ { "docid": "f2bfce97c2e432c587e904bec3a18af3", "score": "0.8405913", "text": "def move(index, character)\n @board[index] = character\n end", "title": "" }, { "docid": "2c3545ef3b05a873dbbc80cadbb6cf5e", "score": "0.81857663", "text": "def move(index, character)\n @board[index]...
08c6c7f75ca6883ff712ec723ee7da6a
Loops through the string Passes each character into prefix starting for [0]
[ { "docid": "6d6e755553fb15ea05644747603c9cf9", "score": "0.6938486", "text": "def build_prefix\n @prefix = @str[@i_last_real_word...@i]\n end", "title": "" } ]
[ { "docid": "f70397dde4c36465b314389adbe94443", "score": "0.70853", "text": "def leading_substrings(str)\n running_str = ''\n sub_strings = []\n str.each_char { |chr| sub_strings << running_str += chr }\n sub_strings\nend", "title": "" }, { "docid": "0573ff8a4144fe2024267fc10e0f66fb", ...
99f79cbb15f234cda7fd6dc7c429486a
you need to be logged in, except when viewing all projects, or a specific project show page.
[ { "docid": "38a3bb73c9a8348b8c0af2fbca9768bc", "score": "0.0", "text": "def index\n if params[:title]\n @projects = Project.where(\"LOWER(title) LIKE LOWER(?)\", \"%#{params[:title]}%\")\n # query to search for projects.\n else\n @projects = Project.all\n end\n\n respond_to do...
[ { "docid": "385e93605f79794e33312cb292314c1e", "score": "0.7766865", "text": "def check_auth\n if @project.project_owner_id != current_user.id && !current_user.admin? && current_user.id != @project.project_manager_id && !(current_user.company == @project.project_owner.company && current_user.compan...
6c1d591d915e01b6062c9b1049976155
I worked on this challenge [by myself, with: ]. 2. Review the simple assert statement
[ { "docid": "ca0df44d8b905e0fd44c1e24ba84312c", "score": "0.0", "text": "def assert\n raise \"Assertion failed!\" unless yield\nend", "title": "" } ]
[ { "docid": "3fcc75a227c5cd0de58359677e7bc992", "score": "0.7407178", "text": "def test_case_6\n assert false\n end", "title": "" }, { "docid": "0e27ed76988a692adb5cdf7709fe4144", "score": "0.74045664", "text": "def test_case_7\n assert false\n end", "title": "" }, {...
93a5adc59bee362d15cc4cd99bc488d6
indicates whether this view has to set its datacontext in order to function
[ { "docid": "9010e3b89e91151929a0e9830910441a", "score": "0.76256806", "text": "def sets_datacontext?\n !has_parent? || !!@sets_datacontext\n end", "title": "" } ]
[ { "docid": "567f6e6fb9546d1a6f1d19ec01f45815", "score": "0.6976646", "text": "def has_datacontext?\n !proxy.nil? && !proxy.instance.data_context.nil?\n end", "title": "" }, { "docid": "b36c501f667937e4247b73a84a7d4ac0", "score": "0.63155663", "text": "def context_set?; en...
7032bd2d2204c560a8a3a83437887c13
Complete the freqQuery function below.
[ { "docid": "19bff9f025cf398c0264a6313ee2da6b", "score": "0.74055153", "text": "def freqQuery(queries)\n @freq_map = Hash.new {|h, k| h[k] = {}}\n @count_map = {}\n @count_map.default = 0\n res = []\n queries.each do |type, x|\n case type\n when 1\n add_to_ds x\n when 2\n remove_f...
[ { "docid": "4561af3a0e14d76d55193ad88e3774f7", "score": "0.7215223", "text": "def freqQuery(queries)\n h = {}\n freqs = {}\n ans = []\n counter = 0\n queries.each do |q|\n v = q[1]\n case q[0]\n when 1 # add\n if h[v]\n freqs[h[v]].delete(v)\n ...
e4b67a53fcd2c64d0aa89f5f975d1774
GET /store_formats/new GET /store_formats/new.json
[ { "docid": "3e8cd85608a056383783131ec2415e31", "score": "0.80178547", "text": "def new\n @store_format = StoreFormat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @store_format }\n end\n end", "title": "" } ]
[ { "docid": "ea25a54927418813c7aa2d64ef9afe37", "score": "0.7683687", "text": "def new\n @format_type = FormatType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @format_type }\n end\n end", "title": "" }, { "docid": "74dbb8e312d30...
7c5564dc968cf4d1d966f39e1d7402c3
PATCH/PUT /mainposts/1 PATCH/PUT /mainposts/1.json
[ { "docid": "3851dc17260e638526a5bdfe0c6d2e26", "score": "0.64498925", "text": "def update\n respond_to do |format|\n if @mainpost.update(mainpost_params)\n format.html { redirect_to @mainpost, notice: 'Mainpost was successfully updated.' }\n format.json { render :show, status: :ok,...
[ { "docid": "7599b6acda033b21082c7a67a2516d88", "score": "0.66888714", "text": "def update\n json_update_and_sanitize(post,post_params, Post)\n end", "title": "" }, { "docid": "fef606243741752603cf8b7a9b458009", "score": "0.65999925", "text": "def update\n user = User.find...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "518b4fd6ab05bfdf31bf8932b6f7bb00", "score": "0.0", "text": "def set_user\n @user = User.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6164095", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.6046031", "text": "def action_hook;...
09438f1c56f56e13e7b5f8edbcce3c4a
=begin Function to delete a Photo from the Photo Album =end
[ { "docid": "104cc1ad9365def79c7eb1b7f5ab866c", "score": "0.0", "text": "def delete_picture\n if !check_session #Validate if the user session is active\n return #If not force return to trigger the redirect of the check_session function\n end\n resp = Photo.find(params[:id],session[:user])\n...
[ { "docid": "b8fb763f86ecb48c72f859aba85bcbf9", "score": "0.8261627", "text": "def delete photo_id\n @flickr.photos.delete(photo_id: photo_id)\n end", "title": "" }, { "docid": "7b4fdd52dc73f3b29db36765aae79a62", "score": "0.8248657", "text": "def delete(photo)\n photo = ph...
82187171250abb7a38a74bbea03a2f11
Returns an escape sequence.
[ { "docid": "8588be1ef78aea288fcc5027b18b435e", "score": "0.0", "text": "def numbered\n format(numbered_prefix, colour)\n end", "title": "" } ]
[ { "docid": "5925d15551c745ff6ca404dcc41a7396", "score": "0.7383794", "text": "def escape(seq); \"\\033[#{seq}m\"; end", "title": "" }, { "docid": "f9b6ab899e80458a4f91fdac271ea2ea", "score": "0.73639995", "text": "def _CharacterEscapeSequence\n\n _save = self.pos\n while true #...
ef2bc7085615439d8035306feec4edfb
Returns the quotient of `self` divided by `other`.
[ { "docid": "4c6eb516c9e4b822622d0ef816067a18", "score": "0.6548787", "text": "def /(other)\n RDF::Literal(to_d / (other.respond_to?(:to_d) ? other.to_d : BigDecimal(other.to_s)))\n end", "title": "" } ]
[ { "docid": "7e3b5432c03f9ce65489c53bf8d6cb92", "score": "0.77996355", "text": "def %(other)\n result = self./(other)\n result = (result.num%result.denom).to_i\n end", "title": "" }, { "docid": "953f2ea6cf2b55166353377e7abea314", "score": "0.76913226", "text": "def divide!...
944d2ab7edbc76ad36f4ae261625f37e
+value+ may be a Member; Roles can also be converted to Members.
[ { "docid": "340e993145f7a43fea7e19d6f8417887", "score": "0.66468227", "text": "def expect_member name, value\n expect_type name,\n value, \n \"Member\", \n Member,\n lambda{ Member.new(value) if test_role(value) }\n end", "title": "" } ]
[ { "docid": "864b4e54a6d57b581c99cb850aae6bd6", "score": "0.65805066", "text": "def render_value(value, field:, **opt)\n (value.to_s == 'roles') ? roles(**opt) : super\n end", "title": "" }, { "docid": "a580a0950dc33524ce63fb017dc9a567", "score": "0.6153036", "text": "def filter_v...
e6ee26c1da2b2ac1d01e1af7bfccf92a
Returns the number of teams left in the bracket.
[ { "docid": "6f0d7ac5ebd76ea0c9e0ee2ffe3835ab", "score": "0.80723894", "text": "def teams_left\n return 1 + @winners.inject(0) { |memo, arr| arr.inject(memo) {|memo2, team| memo2 += (team == UNKNOWN_TEAM ? 1 : 0)} }\n end", "title": "" } ]
[ { "docid": "84308964f0eeed768230d9bc3128cbf3", "score": "0.6841482", "text": "def guesses_left(current_guess_count)\n\t3 - current_guess_count\nend", "title": "" }, { "docid": "fa5e689d765c02551e60a4dc4e3affb6", "score": "0.6738918", "text": "def number_of_outcomes\n @number_of_ou...
30c0f3d701871b771cb24bb313f4c32b
DELETE /webinars/1 DELETE /webinars/1.json
[ { "docid": "e0d4844e2e7a4214692934eed7a3f396", "score": "0.0", "text": "def destroy\n @current_id = params[:id]\n\n @webinar = Webinar.find(params[:id])\n @webinar.destroy\n\n respond_to do |format|\n format.html { redirect_to webinars_url }\n format.js { @current_id }\n forma...
[ { "docid": "850bc8d7f1d609dd4320db6d1d151ad9", "score": "0.72193646", "text": "def destroy\n # @web_resource.destroy\n # respond_to do |format|\n # format.html { redirect_to web_resources_url }\n # format.json { head :no_content }\n # end\n end", "title": "" }, { "docid":...
7039a7bdcfb57265d6f746d80a07aeeb
Brute force checks the various integral combinations
[ { "docid": "bf67c2a0f1d76a51817f46e7c065823a", "score": "0.0", "text": "def solution_set(target, operation, number_of_unknowns, max, number_of_dups=0) \n if (number_of_unknowns == 1)\n return [[target] & (1..max).to_a]\n end\n \n range = case operation\n when \"+\"\...
[ { "docid": "4c6410f316e75b25f95848e54e28dd43", "score": "0.650522", "text": "def run_tests()\n check_solution(1, 25, 12, true)\n check_solution(2, 7, 11, true)\n check_solution(3, 30, 9, false)\n check_solution(4, 6, 24, false)\nend", "title": "" }, { "docid": "64d22b527e18190029...
f0c8ebc080c48c2f260ffb43b1834e56
GET /products/1 GET /products/1.json
[ { "docid": "cd48311582676f70f99e35a715501619", "score": "0.0", "text": "def show\n @product = Product.find(params[:id])\n @evenement = @product.event.name\n end", "title": "" } ]
[ { "docid": "b4b28cd3d622f32a8398a02f689e4baf", "score": "0.79350877", "text": "def get_product\n product = Product.find(params[:product_id])\n json_response(product)\n end", "title": "" }, { "docid": "a06eb43eff1d37c3950104b8608b37f8", "score": "0.7778388", "text": "def show\n...
5769cc4cef292e96808346c2ee2d0d48
PATCH/PUT /company_from_emails/1 PATCH/PUT /company_from_emails/1.json
[ { "docid": "d012113a0a54cbef61a3beedfd18f52c", "score": "0.71006274", "text": "def update\n respond_to do |format|\n if @company_from_email.update(company_from_email_params)\n format.html { redirect_to @company_from_email, notice: 'Company from email was successfully updated.' }\n ...
[ { "docid": "8a4fc5bbfb20a6b7480dc98d8c7c7478", "score": "0.70270056", "text": "def update\n @company_email = CompanyEmail.find(params[:id])\n\n respond_to do |format|\n if @company_email.update_attributes(params[:company_email])\n format.html { redirect_to @company_email, notice: 'Comp...
5e267b0a33dfe5bd78db03590c8fbb2e
True if on_error called with :raise :callseq: raise_on_error? > bool
[ { "docid": "3507c415e75473789cef0e092f8d1bb7", "score": "0.8994594", "text": "def raise_on_error?\n @on_error == :raise\n end", "title": "" } ]
[ { "docid": "b53821a6b687c646c8fdc9a806f9016b", "score": "0.7792621", "text": "def raise_errors?\n @raise_errors != false\n end", "title": "" }, { "docid": "6602d44cf46bfd43387efe5c2f8ed411", "score": "0.7739968", "text": "def raise_errors?\n @raise_errors\n end", ...
d011277f4ea87a71e3f64265018ccf6b
prints out all of the mottos for this cult's followers
[ { "docid": "3ccdf72f1d45f80d7832a9789bf7e522", "score": "0.6734543", "text": "def my_followers_mottos\n self.my_followers.map do |follower|\n follower.life_motto\n end\n end", "title": "" } ]
[ { "docid": "de5b91ae8ba81990d3c46fbc1f7e9b41", "score": "0.8234734", "text": "def my_followers_mottos\n puts \"These are the mottos: \"\n puts self.cult_members.map { |followers| puts followers.life_motto}\n end", "title": "" }, { "docid": "48413e9f962f1e6e4f3fbe1f0e7ea160",...
1aa6f73fe5331f7a395cf04ef826cab0
Creates a new tar archive in +dest_file+. A list of paths to store in the archive should be passed next. The last argument can optionally be a hash of options that will dictate how the archive is created (see Archive Options, above). Example: Archive::Tar.create( '~/ruby.tar.gz', Where to put the archive Dir["~/code//....
[ { "docid": "83a3ac1fe244b804ef8d1696f54bac62", "score": "0.5766529", "text": "def create(dest_file, filenames = [], options = {})\n\t\t\tWriter.new(filenames).write(dest_file, options)\n\t\tend", "title": "" } ]
[ { "docid": "6bb77ed0de20b718c9bc549cd82f39e4", "score": "0.6854153", "text": "def archive(sources_dir, dest_dir, dest_file_name)\n Siba::Archive::Tar::Archive.check_compression_type compression\n\n options = get_tar_option\n extension = Archive.get_tar_extension compression\n\n ...
4f9b53f2bd3d31b8aefed346d1d29a71
Read a 'hyperflex.ServiceAuthToken' resource.
[ { "docid": "b476b0c6ac9e83094d2180093442a241", "score": "0.0", "text": "def get_hyperflex_service_auth_token_by_moid(moid, opts = {})\n data, _status_code, _headers = get_hyperflex_service_auth_token_by_moid_with_http_info(moid, opts)\n data\n end", "title": "" } ]
[ { "docid": "58aa456ae6366e94a21f580e5e691836", "score": "0.61193216", "text": "def get_token\n options = {}\n options[:url] = self.auth_url + \"/tokens\"\n options[:method] = :post\n options[:headers] ...
5a79f77159304e729ac3d488997058a1
method to get existing node from the index, or create one
[ { "docid": "b4c8ebfd07f9cc10454b93eb1105d8af", "score": "0.8262548", "text": "def get_or_create_node(conn, index, data)\n\n\tvalue = data.object.to_s.unpack('U*').pack('C*').force_encoding(\"UTF-8\")\n\turi = data.subject.to_s\n\n\t# look for node in the index\n\t#r = conn.get(\"/db/data/index/node/#{in...
[ { "docid": "a60a09991d1e64592c913304a3c8215a", "score": "0.8533482", "text": "def get_or_create_node(conn, index, value)\n # look for node in the index\n r = conn.get(\"/db/data/index/node/#{index}/name/#{CGI.escape(value)}\")\n node = (JSON.parse(r.body).first || {})['self'] if r.status == 200\n un...
d96ccfd2a8935248aa28f3beeadcf55c
Dispatches a status to deliverers this has.
[ { "docid": "5692eae0a2323c295073171ebc99044d", "score": "0.53694016", "text": "def dispatch(data)\n @deliverers.each do |deliverer|\n Thread.new do \n deliverer.deliver(data)\n end\n end\n end", "title": "" } ]
[ { "docid": "78f60487679cf1f4298ac4695d615070", "score": "0.614687", "text": "def deliver\n\t\t\t\t\tself.class.deliver(self.id)\n\t\t\t\tend", "title": "" }, { "docid": "06721ff233c6aa3c7fdda4c24e003338", "score": "0.5976521", "text": "def deliver\n order = current_user.restaurant...
ddab142b6dabacbc40fa6819e95e3395
Get info about the API
[ { "docid": "2b2efcfeb846a0dcb4c0f48e94e88b98", "score": "0.0", "text": "def about\n get(\"/about\")\n end", "title": "" } ]
[ { "docid": "71397886dbd0f26281551d5d595985da", "score": "0.9284478", "text": "def info\n get('api-info')\n end", "title": "" }, { "docid": "b1545ce05dae781b9fe4febfee3aaa33", "score": "0.82791084", "text": "def info\n @requester.get(url: @api_url)\n end", "tit...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "971f8f5a982396da0b0d8bc18db8f6c5", "score": "0.0", "text": "def avancement_params\n params.require(:avancement).permit(:matricule_employe, :date_avancement)\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...
751930652ecbddcafb6d96fa1f4fe579
Returns the string representation of this URI.
[ { "docid": "869c225dc8e4411532164637dd299800", "score": "0.0", "text": "def to_str; value; end", "title": "" } ]
[ { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.88596934", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid": "00887ad5169962069fd7c8ea509f4ad4", "score": "0.88596934", "text": "def to_s\n @uri.to_s\n end", "title": "" }, { "docid":...
580286d5b0e8e75eb03766e9957c76cf
method that consider the values obtained from previous. use shortif expression method
[ { "docid": "f8fdf649e1644ffe716edeb9108895c5", "score": "0.0", "text": "def clasificationByAge\n\t\t@age<=5 ? (puts \"you are a baby\") : \n\t\t@age<=12 ? (puts \"you are a child\") : \n\t @age<=21 ? (puts \"you are a young people\") : \n\t\t@age<=35 ? (puts \"you are a adult\") : (puts \"Age can n...
[ { "docid": "698479674878a403732dbeed32dd11f4", "score": "0.6264606", "text": "def _reduce_343(val, _values, result)\n result = @builder.multi_lhs(val[0], val[1], val[2])\n \n result\nend", "title": "" }, { "docid": "e65043f625034e065a4462e252fd02e3"...
f7717dcfcda6b683a347f1c8d0b0ccb2
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. I worked on this challenge [by myself, with: ]. 0. total Pseudocode make sure all pseudocode is commented out! set variable equal to 0 iterate over numbers and ...
[ { "docid": "b49bb80b7cd1a876f5215ec141f6bd60", "score": "0.0", "text": "def total(arr)\n x = 0\n sum = 0\n while x < arr.length\n sum += arr[x]\n x += 1\n end\n return sum\nend", "title": "" } ]
[ { "docid": "a766c80f7e5ff300ac37fb1a906d93c7", "score": "0.69526976", "text": "def sum(x)\n solution = 0\n x.each do |num|\n solution += num\n end\n solution\nend", "title": "" }, { "docid": "ed3ed7ca3cc39beaf1472ff1f4b8a1a6", "score": "0.68984205", "text": "def total(numbers)\n re...
c56cc4193d416a651a02b030d9e170a8
Called before validation. sets the order number, if the id is nil the order number is bogus
[ { "docid": "b4df985ee6c27fbd78f43276ba954613", "score": "0.74593306", "text": "def set_number\n return set_order_number if self.id\n self.number = (Time.now.to_i).to_s(CHARACTERS_SEED)## fake number for friendly_id validator\n end", "title": "" } ]
[ { "docid": "b7261c7f2b06c7b75b4a952164cb84b1", "score": "0.7591212", "text": "def set_order_number\n self.order_number = Order.generate_order_number\n end", "title": "" }, { "docid": "42bfc80b458ec3fd5dab9153f3838d73", "score": "0.7577801", "text": "def set_number\n return set...
7779e70bb95c0bbf42171fc15539ac14
avoid relying on real, dbbacked items
[ { "docid": "f45b11c919bc3c90183b12a1c972de69", "score": "0.0", "text": "def configuration_item_path(item)\n \"/path/to/#{item.name}\"\n end", "title": "" } ]
[ { "docid": "98ef8aceb97520505fec74eb4f0ddd1d", "score": "0.64318836", "text": "def single_object_db; end", "title": "" }, { "docid": "43abee05a3e4d8d46c7539555f362185", "score": "0.60009533", "text": "def item; @item; end", "title": "" }, { "docid": "43abee05a3e4d8d46c753...
5dc1bc8c66b7e3c9aad3a5e4b9c1e115
GET /requisitos/1 GET /requisitos/1.json
[ { "docid": "09bf02db059a1a9d69ef1005be483040", "score": "0.0", "text": "def show\n respond_to do |format|\n format.html { redirect_to requisitos_path, alert: '<i class=\"fa fa-exclamation-triangle fa-lg\"></i> Ruta no disponible.' }\n end\n end", "title": "" } ]
[ { "docid": "5ead11de07b06f700316eaa3dec1bfbe", "score": "0.7064449", "text": "def index\n @requisitos = Requisito.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @requisitos }\n end\n end", "title": "" }, { "docid": "9b1c552517f9...
9c10438b868b7f3d203feb5c9ae17839
Extract abstract. If the abstract has less than 2 characters, it's ignored Example: Bla Bla Becomes dcterms:abstract "Bla bla"^string
[ { "docid": "f325f876e3fe4344b46ef70f9710218d", "score": "0.67078197", "text": "def handle_abstract(tree, uri)\n predicate ='dcterms:abstract'\n elements = tree.xpath(\"./#{predicate}\", PREFIXES)\n if elements.length > 0\n if elements.length > 1\n puts \"Found #{elements.length} ele...
[ { "docid": "270583b5b81ebb4cd6b2d7cc066073a5", "score": "0.7974885", "text": "def get_abstract(str)\n if (str.include? \"abstract:\")\n match_and_normalize text: str, pattern: /abstract:(\\s+(.*)\\n)/, multiline: true\n end\n end", "title": "" }, { "docid": "f119d...
bdccee3093256a98324957537b913791
Returns true if Premis events say this item has been deleted.
[ { "docid": "922f7d8769bb2552fb75fed8099a24e3", "score": "0.6670722", "text": "def deleted_since_last_ingest?\n last_ingest = self.premis_events.where(event_type: Pharos::Application::PHAROS_EVENT_TYPES['ingest']).order(date_time: :desc).limit(1).first\n last_deletion = self.premis_events.where(eve...
[ { "docid": "ce78b20cfe9e6406cedfd999798abb5e", "score": "0.7718391", "text": "def deleted?\n @deleted\n end", "title": "" }, { "docid": "d8aba07c35373456d04516ce27d3c99f", "score": "0.76898515", "text": "def deleted?\n @deleted\n end", "title": "" }, {...
e36c84293a165c31d7c430f2a52c0313
GET /fullassessments GET /fullassessments.json
[ { "docid": "9f8a106c109ddb5bd5e5089e1fa0501b", "score": "0.788421", "text": "def index\n @fullassessments = Fullassessment.all\n end", "title": "" } ]
[ { "docid": "43ca1d60a4d03a4ede6f1ade848eb2f9", "score": "0.6912744", "text": "def index\n @assessments = Assessment.all\n end", "title": "" }, { "docid": "43ca1d60a4d03a4ede6f1ade848eb2f9", "score": "0.6912744", "text": "def index\n @assessments = Assessment.all\n end", "...
36821af043cdfb7472f7ab9674118d50
Image credits for tweets
[ { "docid": "6a17b1383eab3624bfa1f8a42cc9b780", "score": "0.6675165", "text": "def credits\n if source == 'flickr'\n credits = %Q{Source: \"#{title}\" by #{author} on Flickr}\n\n # Assume '@username' plus the t.co URL take up 40 characters max\n if credits.length > 100 # TODO: M...
[ { "docid": "65e0a90ef40497c616faeb4ee5775840", "score": "0.6741391", "text": "def tweet\r\n img = ImageList.new(\"#{Rails.root}/public/base_img.jpg\")\r\n txt = Draw.new\r\n c = 0\r\n\r\n # 50 characters in one row\r\n (params[:message].length/50 + 1).times do |i|\r\n img.annotate(tx...
acab9b29904f45ed6861bda525d64938
list all the admin settings
[ { "docid": "d35c708c15b788f36383a8b7ce83089c", "score": "0.0", "text": "def index\n end", "title": "" } ]
[ { "docid": "2121c16694c6aae15cc6e803f01eab8e", "score": "0.78575176", "text": "def list\n @client.make_request :get, settings_path\n end", "title": "" }, { "docid": "3069d89820622adf2557d2a97c2dccfc", "score": "0.7853279", "text": "def all_settings\n response = get(\"/se...
9dee685f08211ccfb4b8435e99594cb0
Prepare attribute names to use in sql conditions return array in form ['meetings.starts_at', 'meetings.ends_at']
[ { "docid": "bba42dcf4f2c81f9582f294d2fb38663", "score": "0.49460554", "text": "def attributes_to_sql(record)\n attributes.map { |attr| attribute_to_sql(attr, record) }\n end", "title": "" } ]
[ { "docid": "ce86dcd194d42654b77f32cf9a386192", "score": "0.62838304", "text": "def conditions\n sqlwhere = \"1 = 1 \"\n sqlwhere = sqlwhere + \"and promotions.name like ? \" if is_string_here?(name)\n sqlwhere = sqlwhere + \"and promotions.created_at > ? \" if is_object_here?(created_at_since)\...
843bcc65a206cbc36a006f22bae989d3
Strips the optional UNA segment, also known as the Service String Advice.
[ { "docid": "9503a00dd3eaa2924db955b4d94f13b0", "score": "0.6670267", "text": "def strip_service_string_advice(message_as_string)\n message_as_string.sub(SERVICE_STRING_ADVICE_REGEXP, '')\n end", "title": "" } ]
[ { "docid": "8e3f5f9282920f5f195ec5dae7e0a785", "score": "0.5596671", "text": "def strip\n forward(handler.strip(@string))\n end", "title": "" }, { "docid": "e8c0cc417f6a1f0131636f856b723d44", "score": "0.53700775", "text": "def strip\n if taint_relevant?\n new_string ...
95028a4a2b3370887e20d727f03a44ee
GET /ranking_points_entries GET /ranking_points_entries.json
[ { "docid": "b51fa07d06fc736dc7223c0993d17dea", "score": "0.78711736", "text": "def index\n @ranking_points_entries = RankingPointsEntry.all\n end", "title": "" } ]
[ { "docid": "0205f4387dae1332fd1106f69f976be2", "score": "0.6928057", "text": "def set_ranking_points_entry\n @ranking_points_entry = RankingPointsEntry.find(params[:id])\n end", "title": "" }, { "docid": "cd3ddd7aeff1fcdcbfeee7989418d763", "score": "0.6458746", "text": "def r...
7aed211b8e83a89859baf6f30723da2e
validates_format_of :content_type, :with => /^text/, :message => ' you can only upload text files'
[ { "docid": "5dffc9fcaa6d4ddec025414ecf713990", "score": "0.0", "text": "def uploaded_file=(file_field)\n self.filename = base_part_of(file_field.original_filename)\n\n f_str = Iconv.conv('utf-8', self.encoding, file_field.read)\n\n f = StringIO.new(f_str)\n\n if self.format == 'OBT'\n i...
[ { "docid": "0fb71b4b38a525d1149f4f30570115bd", "score": "0.73937684", "text": "def valid_resume_content_type\n if ! role.nil? && role.casecmp(\"resume\") == 0 \n if attachment_content_type.nil? || attachment_content_type.casecmp(\"text/plain\") != 0\n errors.add(:attachment,\"Re...
3163a3dbd68af397811de9bd17eb2474
look up in environment then look in the _global
[ { "docid": "c92b97f4e8512cf55f2f318dc0c69b7b", "score": "0.0", "text": "def dereference(environment, attribute)\n if environment == \"*\"\n return constants.map do |specific_environment, _|\n dereference(specific_environment, attribute)\n end.compact\n end\n\n from_current_env ...
[ { "docid": "929c49644beff6c266a9d1855fcf6756", "score": "0.7602854", "text": "def global_env; end", "title": "" }, { "docid": "d0c35f723c03f659871b32dbeb6d41a4", "score": "0.72092843", "text": "def lookup_global_silent(param)\n @context.find_global_scope.to_hash[param]\nend", "t...
c4afade2d2b55583161445c15d5be0b3
build_path seperates the input into two parts: path and input. input is the partial string that should be completed path is a proc that takes an input and builds a full path. source://pry//lib/pry/input_completer.rb240
[ { "docid": "d48ef86c3d9b72d8ff7236388be4c35e", "score": "0.799816", "text": "def build_path(input); end", "title": "" } ]
[ { "docid": "cdf89c9d24dda1b3f5b8c268d070c796", "score": "0.7888529", "text": "def build_path(input)\n # check to see if the input is a regex\n return proc { |i| i.to_s }, input if input[%r{/\\.}]\n\n trailing_slash = input.end_with?('/')\n contexts = input.chomp('/').split(%r{/})\n ...
6bbe59dc3e5302f5a8e9601d2b6a5b13
Add a child to the Composite
[ { "docid": "a9c9d3119a7a35e75a614d3b0ecec907", "score": "0.6254456", "text": "def <<(child)\n @children ||= []\n @children << child\n end", "title": "" } ]
[ { "docid": "660cd1ac1468a6fd604e50bf63a07acd", "score": "0.7685355", "text": "def add_child child\n @children << child\n end", "title": "" }, { "docid": "be3cb18a819b65d97c53f23a48990188", "score": "0.7565968", "text": "def add_child child\n @children << child\n ...
e584eb49ec042cc65d5aa5a8ccae9712
write a method that takes any year greater than 0 as input returns true if the year is a leap year, or flase if it is not a leap year leap year = evenly divisible by 4 unless also divisible by 100 evenly divisible by 100 unless evenly divisible by 400
[ { "docid": "1692236b99f4d165b73f90c70099b4a5", "score": "0.8285081", "text": "def leap_year?(year)\n if year % 400 == 0\n true\n elsif year % 100 == 0\n false\n else \n year % 4 == 0\n end\nend", "title": "" } ]
[ { "docid": "d03bdae4f5a044e02b6bfc0175dfcf2a", "score": "0.8870216", "text": "def leap_year?(year)\n #PSEUDOCODE\n #every four years is a leap year\n #2012,2016,2020 are leap years\n #check if input is divisble 4\n #2000 is a leap year because it is divisible by 400\n #1900 is NOT a leap year beca...
c72140dc9b0cb14481290b3fb71f3792
Sends password reset. Required POST params: email Responds to HTML, JS
[ { "docid": "b21cf18f1d189ab87747af8c822574d1", "score": "0.7525545", "text": "def send_password_reset\n @user = User.first(conditions: {email: params[:email].downcase})\n @user.send_password_reset! if @user\n respond_to do |format|\n format.html { redirect_to forgot_password_users_url, not...
[ { "docid": "9386648226fa7a852de05c6bc29cd4a1", "score": "0.7835402", "text": "def send_reset_password_instructions\n token = set_reset_password_token\n send_reset_password_instructions_email(token)\n end", "title": "" }, { "docid": "27db6276d4837a180b98c92b11fdd7bb", "score": "0.7...
fd4a78f645b78084002c41def80d8826
Replace only the first match of +pattern+ with +replacement+. Call block (if given) for each match and replace +pattern+ with the value of the block. Modify +self+ with the final value. ISO 15.2.10.5.37
[ { "docid": "91dfe9f6a9926acf184fc8ee77d3ee86", "score": "0.0", "text": "def sub!(*args, &block)\n str = self.sub(*args, &block)\n return nil if str == self\n self.replace(str)\n end", "title": "" } ]
[ { "docid": "43593da07cf5ae5d43141e180bf28d57", "score": "0.7681873", "text": "def replace_all(pattern, replacement = nil, multiple_times: false, &block)\n result = if replacement.nil?\n @text.gsub!(pattern, &block)\n else\n @text.gsub!(pattern, ...
3f52973818698070d105a2c20fdb77a5
Serializes information the current object
[ { "docid": "c25a6cf764135f341117cbdb179eb6a8", "score": "0.0", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_enum_value(\"cloudAppSecurityType\", @cloud_app_security_type)\n end"...
[ { "docid": "d162e297d0f84ca205afa381c3f6a428", "score": "0.7830697", "text": "def serialize\n Marshal.dump(self)\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.7645999", "text": "def serialize(object) end", "title": "" }, { "docid": ...
0cfeeef84515593db58e500581253fed
Customize the JSON serialization for Elasticsearch
[ { "docid": "931d5e0be706370acc45da4ac51c1e90", "score": "0.6082391", "text": "def as_indexed_json(options={})\n\n # define JSON structure (including nested model associations)\n _include = self.class.reflect_on_all_associations.each_with_object({}) {|a,hsh|\n hsh[a.name] = {}\n h...
[ { "docid": "b2febbcdc87fd4ec10e56e164da63fe7", "score": "0.7833427", "text": "def as_json_for_index\n self.as_json self.class.elastic_options[:json]\n end", "title": "" }, { "docid": "74df119b8bd0430d60facead6bcdc3ba", "score": "0.74781907", "text": "def to_indexed_json\n...
ca99739da92c665c57784bef14bd6137
PUT /agency_types/1 PUT /agency_types/1.json
[ { "docid": "10c2c95658bf80a17828905fdb62f938", "score": "0.7406154", "text": "def update\n @agency_type = AgencyType.find(params[:id])\n\n respond_to do |format|\n if @agency_type.update_attributes(params[:agency_type])\n format.html { redirect_to @agency_type, notice: 'Agency type was...
[ { "docid": "539204a2d8bf14c318af25a311f62594", "score": "0.6551701", "text": "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n re...
df02db77ad04c9d329db97e64946688f
Returns the user's player that's in a lobby (if any)
[ { "docid": "08f02231832ffd5fb8a532c8a379471b", "score": "0.763179", "text": "def player_in_lobby\n lobby.player(self) rescue false\n end", "title": "" } ]
[ { "docid": "34aa493d371bc8254a0e1ebf97ddfa81", "score": "0.715375", "text": "def lobby\n games(game_state: \"lobby\").any? ? games(game_state: \"lobby\")[0] : false\n end", "title": "" }, { "docid": "6a8f82d902b31dea78d58cc1fa4bbb57", "score": "0.6732527", "text": "def get_game(l...
0be482c9b69decdc4b9ab33e4592996f
Get the name of the executable.
[ { "docid": "5cf33e56470c192a6336c13c299ab221", "score": "0.63523346", "text": "def execname\n\t\tif @name =~ /\\.t\\.cpp$/ then\n\t\t\treturn @name.sub(/\\.cpp$/, \"\").gsub(/\\./, \"_\")\n\t\telse\n\t\t\treturn @name.sub(/\\.b\\.cpp$/, \"\")\n\t\tend\n\tend", "title": "" } ]
[ { "docid": "9b41a15f900ebd59e9953ffb41755c87", "score": "0.8256407", "text": "def executable_name\n app.executable_name\n end", "title": "" }, { "docid": "e8af58fdcbd2875a518889d599f8cbd6", "score": "0.8155946", "text": "def program_name\n File.basename($0, '.*')\n en...
be7333a12d6b55cb586a69e49ffe9f73
returns number of units currently on backorder for this variant.
[ { "docid": "ce5b45daf6aa8ff2395952dd24c972ae", "score": "0.76814026", "text": "def on_backorder\n inventory_units.with_state('backordered').size\n end", "title": "" } ]
[ { "docid": "6d3d88c687f1bc8c37c9293b6a730758", "score": "0.6288926", "text": "def quantity\n quantity_initial - quantity_consumed\n end", "title": "" }, { "docid": "97de70e08836a263336a9e1013134b37", "score": "0.6276952", "text": "def receive_quietly backordered_uni...
b490d2b10bab53d52e60b5cf7e82b817
GET /invoice_outs/1 GET /invoice_outs/1.xml
[ { "docid": "e9b819040d91e9354046acd7553b0d98", "score": "0.6123673", "text": "def show\n @invoice_out = InvoiceOut.find(:first, :conditions => {:id => params[:id], :user_id => session[:user_id]})\n unless @invoice_out\n flash[:notice] = 'Tato faktura neexistuje!'\n redirect_to :action =>...
[ { "docid": "0ae864a41a75661f51428f61c1616a26", "score": "0.6600573", "text": "def new\n @invoice_out = InvoiceOut.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice_out }\n end\n end", "title": "" }, { "docid": "6694cbafea9...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "4e9be73d4fa949328283c8de3fd50073", "score": "0.0", "text": "def mission_params\n params_for_mission = {}\n [:name, :days, :missed_limit, :drop_out_limit, :content, :public, :user_id]\n .each {|item| params_for_mission[item] = params[\"mission\"][item]}\n\n return params_f...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whit...
99edf06d82888d81702c418f3c03dafb
POST /scores POST /scores.xml POST /scores.json
[ { "docid": "92fbb4f676e112059840c8eee09c6b65", "score": "0.64320767", "text": "def create\n\t\tlogger.info(\"HALLO\")\n\t\tif params.key?(\"ajax\")\n\t\t\t@score = Score.new\n\t\t\t@score.value = params[:score][:value]\n\t\t\t@score.game_id = params[:score][:game_id]\n\t\t\tnickname = Nickname.where(:na...
[ { "docid": "48e26ce0ab366b050b73292e622d4aa1", "score": "0.739964", "text": "def post_score initials, score = 0\n self.post_to @score_conn, SCORE_KEY, JSON.generate({ initials: initials, score: score })\n end", "title": "" }, { "docid": "f0fea74ff4b093f7d75a11154c7e5724", "scor...
179fe8880a8a5cbae5be46220477718e
Overrides the default per page, to retrieve everything.
[ { "docid": "3a90df9a3bcfa60273fed2185ecc3abb", "score": "0.0", "text": "def get_all_items(solr_params)\n solr_params['rows'] = 1000000\n end", "title": "" } ]
[ { "docid": "4ba82c64ea400ed2d929ed6740b2344d", "score": "0.70026064", "text": "def per_page\n nil\n end", "title": "" }, { "docid": "9fa530d62cb3862f5180cabd3120a904", "score": "0.6941058", "text": "def index\n respond_with(@pages = Page.all.paginate(:page => params[:page]...
b18809d69b8f25aba4732f18a0c90e1f
Flush content to logfile
[ { "docid": "820eee0d995f82da9f1a416390cabe91", "score": "0.5936362", "text": "def flush\n @handle.flush\n end", "title": "" } ]
[ { "docid": "25d3c0af1345766498a55e7f7c14e4ab", "score": "0.74102986", "text": "def flush\n return unless @buffer.size > 0\n @log.write(@buffer.slice!(0..-1).join)\n end", "title": "" }, { "docid": "0db9439dbc5a09273889bcf9eaf0bcef", "score": "0.73679614", "text": "def fl...
00c395a141b1b1425308affc8ca1567e
render override ActionController::Base::render checks if this is an ajax req. if so, it'll render the response_queue as JSON if not ajax, simply pass on to super to deal with.
[ { "docid": "29c6286781115e08ed36ce02dcf86d46", "score": "0.55456966", "text": "def render(*params)\n\n if (@exception != nil) # <-- look! an exception was set.\n\n if request.xml_http_request?\n res = RExceptionResponse.new(:exception => @exception)\n ...
[ { "docid": "18ccbefa3bf18ffbc3858df33cf2a80a", "score": "0.71817553", "text": "def render(*iArgs, &iBlock)\n if (RailsAjax.config.Enabled)\n lArgs = _normalize_args(*iArgs, &iBlock)\n if ((request.xhr?) and\n (!lArgs.has_key?(:partial)) and\n (!lArgs.has_key?(:la...
51bd9986af71d6abc8cf490a44175231
Helper function to parse days parameter
[ { "docid": "d1168b93dbb08687254a7bdf2e134ed4", "score": "0.79609853", "text": "def parse_days(days)\n begin\n params[:days] ? Integer(params[:days]) : 10\n rescue ArgumentError\n @badParams = true\n 10\n end\n end", "title": "" } ]
[ { "docid": "4deb694273bd092039dcf779b2a60f20", "score": "0.73418516", "text": "def parse_days\n return if days.blank?\n string = days.to_s.downcase\n\n if string.index('weekday').present? && string.index('weekend').present?\n timing = nil\n elsif string.index('weekday').present?\n ...
eb5b45846b697ed22e6368384a4cc8da
GET /job_lists GET /job_lists.json
[ { "docid": "1f0c742672a94d79ecce477ea2dcdb90", "score": "0.79167694", "text": "def index\n @job_lists = JobList.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @job_lists }\n end\n end", "title": "" } ]
[ { "docid": "fa6b3a844032b353d03a7224964c8383", "score": "0.82592016", "text": "def getMyJobList\n request \"/Job/getMyJobList.json\"\n end", "title": "" }, { "docid": "fbeeee52d323ab89a6d3038b718b364b", "score": "0.79867136", "text": "def job_list\n options = {\"username\"...
4bb9af8ce2f842e30843f2db77297560
The arranger(s) of this catalog title.
[ { "docid": "99deaf1621e30046a504af4f0106777b", "score": "0.0", "text": "def arranger_list(**)\n []\n end", "title": "" } ]
[ { "docid": "c4cacbfc3192263df0ceeafb8d2bcd54", "score": "0.6023333", "text": "def arranger\n contributor_names(:arranger)\n end", "title": "" }, { "docid": "94808be0efe95d5f84970b2d0dd56abf", "score": "0.5749198", "text": "def arbiters\n @arbiters ||= (config[ARBITERS] || ...
73a1e7fdce19350f225debc31b9e980b
Update an Application Update the information for an Application
[ { "docid": "753ecdd1ba8fcb5146f20e4eabe906f3", "score": "0.0", "text": "def update_application_using_put_with_http_info(application, application_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ApplicationApi.update_application_using_put ...'\n...
[ { "docid": "0c6848c8f35a92f4d110ab8e89f8252b", "score": "0.7903426", "text": "def update_app_info(name)\n require_login\n raise CloudFoundry::Client::Exception::BadParams, \"Name cannot be blank\" if name.nil? || name.empty?\n get(\"#{CloudFoundry::Client::APPS_PATH}/#{name}/update\...
f2b7a0fe65615d913cfa508d98a1b5c8
puts "Input Date and time. Example:" 0123456789012345678 puts "2020/09/15 05:24:00;" puts ""
[ { "docid": "f65bd61031f6dd56ac56c2a90c81c8c4", "score": "0.0", "text": "def commandRead()\n readbuff = \"#\"\n command_get = 0\n cnt = 0\n loop do\n while(Usb.available() > 0) do #何か受信があったらreadbuffに蓄える\n a = Usb.read()\n readbuff += a\n Usb.print a\n if a.to_s == \";\" then\n ...
[ { "docid": "a91b29b37b084737e8028180079a3a85", "score": "0.6432156", "text": "def showDate( foodLog )\n puts \"Enter the date to show entries for.\"\n date = STDIN.gets.chomp!.strip\n puts \"\\n\" + foodLog.showDate( date )\nend", "title": "" }, { "docid": "3462c76c9c19746e20fba276fa94a19...
2904e209b4d09e9d82004560005fe0ab
GET /videos GET /videos.json
[ { "docid": "a4ea5e77e297ac7046ec252c8120cdc7", "score": "0.67750114", "text": "def index\n # Select last 100 records that have a processed movie\n @videos = Video.order('created_at DESC')\n @videos.select!{|v| File.exists?(v.movie.path(:mp4))}\n @videos = @videos[0..100]\n\n respond_to do...
[ { "docid": "24b55059068ab0d5a2d271c5910b82f2", "score": "0.76701915", "text": "def all_videos\n videos = Video.all\n\n if videos\n render json: {\n videos: videos\n }\n else\n render json:{\n status: 500\n }\n end\n end", "title": "" }, { "docid...
def7d2eedde3b4e59bc3fbb3453eddb6
Load ~/.aprc file with custom defaults that override default options. source://amazing_print//lib/amazing_print/inspector.rb190
[ { "docid": "170c18a20f1658184fd10d9c2466f45a", "score": "0.49639627", "text": "def merge_custom_defaults!; end", "title": "" } ]
[ { "docid": "3c1c4f1a32c91433ef884f62b734bcfa", "score": "0.7968912", "text": "def merge_custom_defaults!\n load_dotfile\n merge_options!(AmazingPrint.defaults) if AmazingPrint.defaults.is_a?(Hash)\n rescue StandardError => e\n warn \"Could not load '.aprc' from ENV['HOME']: #{e}\"\n ...
7a52ca61aa192e39e83ba4882cd984c2
Gets the lastSyncDateTime property value. Last sync time for the Exchange Connector
[ { "docid": "a667de5019e56855b470a6b540e5237b", "score": "0.867225", "text": "def last_sync_date_time\n return @last_sync_date_time\n end", "title": "" } ]
[ { "docid": "f658c2e353f4d06759536f48618668ec", "score": "0.7915699", "text": "def last_sync\n time_parser(self[:last_sync])\n end", "title": "" }, { "docid": "d5ea68ae460ca0eb177c6ac70aed0ccb", "score": "0.7860247", "text": "def last_sync_date_time=(value)\n ...
8767440036e6fd2ac0b762cdc7f39d5e
GET /scores/1 GET /scores/1.json
[ { "docid": "8560042411e0769e1876fadbf007be93", "score": "0.73413235", "text": "def show\n @score = Score.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @score }\n end\n end", "title": "" } ]
[ { "docid": "122f3dd6eea3a50d77bad2612fae3564", "score": "0.7671945", "text": "def index\n @scores = Score.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @scores }\n end\n end", "title": "" }, { "docid": "26a9533fa2163274a2c39777...
cb0b8044b40bde07b7fab86981bcbc1b
Get a list of available databases.
[ { "docid": "016217deb4f26dfb5eac5a68221618f8", "score": "0.8265414", "text": "def databases\n arrayCommand( \"show db\", DictItemArray, RESPONSE_DATABASES_FOLLOW, RESPONSE_NO_DATABASES )\n end", "title": "" } ]
[ { "docid": "f084ff81bb318f2f0983cb351c8e3713", "score": "0.8347395", "text": "def databases\n get '_all_dbs'\n end", "title": "" }, { "docid": "8581e37949786f50eafdfbce816f5e12", "score": "0.819392", "text": "def databases\n CouchRest.get \"#{@uri}/_all_dbs\"\n end", ...
c507a072787db5859b496aa80b126c57
it creates both getter and setter for attribute variable automagically
[ { "docid": "27adc820fce3f2a3623d9481095ea3e2", "score": "0.0", "text": "def initialize(name, age)\n\t\t@name = name\n\t\t@age = age\n\tend", "title": "" } ]
[ { "docid": "89ba975897081e6554a342c8e5895974", "score": "0.7501153", "text": "def attribute_setter_getter(attribute)\n define_method attribute.to_s.to_sym do |value = nil|\n if value.nil?\n instance_variable_get \"@#{attribute}\"\n else\n instance_variable_set \"@#{attribute}\", value\n...
6d212da0261bbf612bd5a66a5ca1e730
template will be loaded again if modified.
[ { "docid": "7f9bb5c182f138f0251c3ace5f0da9a6", "score": "0.0", "text": "def need_update?\n return true unless @lastread\n @lastread < File::stat(@path).mtime\n end", "title": "" } ]
[ { "docid": "f1fff4cf92f2268ea687472424dc1ebd", "score": "0.74820936", "text": "def perform_template_load\n memoize(:template) do\n self.data[:template] = api.stack_template_load(self)\n true\n end\n end", "title": "" }, { "docid": "67e724f9a68a4...