query_id stringlengths 32 32 | query stringlengths 7 6.75k | positive_passages listlengths 1 1 | negative_passages listlengths 88 101 |
|---|---|---|---|
450769141165812a33511802fd510c72 | Code to add before and after the node for covering purposes | [
{
"docid": "3f54cf5d0709ff1745541d005e8abd75",
"score": "0.0",
"text": "def rewrite\n end",
"title": ""
}
] | [
{
"docid": "e5657ef6328647460a01172218b1611b",
"score": "0.697519",
"text": "def preceding(node); end",
"title": ""
},
{
"docid": "4e21e856a5b8e79665b3f605843d8246",
"score": "0.6800558",
"text": "def insert_after(child1, child2); end",
"title": ""
},
{
"docid": "02c73ad7... |
4f625b56cd2ebb289dadec8f1c78e9eb | Method Name: publisher_hourly_traffic Purpose: this method is used to construct publisher hourly traffic chart Version: 1.0 Author:Md Shujauddeen A Last Modified: 14Oct2008 by Md Shujauddeen Notes: None. | [
{
"docid": "cd3d009d16b92a73e5439b74aed001fd",
"score": "0.57964194",
"text": "def publisher_hourly_traffic\n begin\n @aes = AESSecurity.new() #creating an object for AES Security\n if (session[:user_id]==nil)\n flash[:notice]=\"Your session has expired. Plea... | [
{
"docid": "f68c0cb1b716b44b1962bf77cd09712c",
"score": "0.60264593",
"text": "def traffic_init(host, traffic, time = Time.now)\n dputs(3) { \"Initialising #{host}\" }\n @traffic[host.to_sym] = {\n sec: Array.new(60*2) { [0, 0] },\n min: Array.new(60*2) { [0, ... |
de8a367e9625d0b840f04f8743b26600 | to create album by selecting in the images in the view and show the preview | [
{
"docid": "9dead29cff80a9d5f1ab822a5106f316",
"score": "0.65780735",
"text": "def images_select_album_create\n title = params[:title]\n album_name = params[:album_name]\n movie_id = params[:edit_movie_id]\n artist_id = params[:edit_artist_id]\n event_id = params[:edit_event_id]\n user... | [
{
"docid": "f2f799f6e49b863c161c01b6f96f1dfe",
"score": "0.6703451",
"text": "def new\n @album = Album.new\n 1.upto(3) { @album.photos.build }\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @album }\n end\n end",
"title": ""
},
{
"... |
704eb7c1da366c893d8ad20063b13ca4 | Unsubscribe from the given channel name | [
{
"docid": "92662f9d59dc1b578dd57873c93a2917",
"score": "0.8080039",
"text": "def unsubscribe(channel_name)\n return nil unless subscribed? channel_name\n \n WSChannel.find_by_name(channel_name).remove_subscriber(self)\n @subscribed_channels.delete channel_name\n end",
... | [
{
"docid": "e6865459c3ada468658ea10b2741a282",
"score": "0.8080335",
"text": "def unsubscribe_from_channel channel_id\n delete(\"/channels/#{channel_id}\", code:204)\n end",
"title": ""
},
{
"docid": "c5160679a6841b4a8d513337d3f176fd",
"score": "0.7976394",
"text": "def u... |
170952720094e6b8c9574b7ea67f01e9 | The `block` or `numblock` node associated with this method dispatch, if any. | [
{
"docid": "fc7c69e40a66ec8b135ee5c4f7f1ca7d",
"score": "0.70371586",
"text": "def block_node; end",
"title": ""
}
] | [
{
"docid": "a973b709cc0d84320fbab5cfd9e19a24",
"score": "0.71095395",
"text": "def block_node\n case sexp_type\n when :method_add_block\n self[2]\n end\n end",
"title": ""
},
{
"docid": "845eac4cc0e461348d838912ea325c1b",
"score": "0.6910919",
"text": "def process_bloc... |
d82383a36dfa7c399827b4961b60f234 | DELETE /clinic_services/1 DELETE /clinic_services/1.json | [
{
"docid": "a29f7883327b5a033c5af7369aca692c",
"score": "0.75389427",
"text": "def destroy\n @clinic_service.destroy\n respond_to do |format|\n format.html { redirect_to clinic_services_url, notice: 'Clinic service was successfully destroyed.' }\n format.json { head :no_content }\n en... | [
{
"docid": "86bd23d6faf3e6039b39f08e648a8bf8",
"score": "0.71698284",
"text": "def destroy\n @clinic.destroy\n respond_to do |format|\n format.html { redirect_to clinics_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "3a954c53d7babf443732... |
0212582f16ef753b716f6bb5594e0a91 | prints the map to the log as tables | [
{
"docid": "96e20ef60223b9b885d9c12eb29963c4",
"score": "0.76899767",
"text": "def print_map\n\t\tLog.full \"Junctions: #{junctions.count}\"\n\t\tLog.full \" \" << Junction.list_header\n\t\tjunctions.each_with_index { |junction,i| Log.full \"(#{i}) #{junction.as_list_line}\" }\n\n\t\tLog.full \"Roads... | [
{
"docid": "7becc9283c00f277f9429a9a77056311",
"score": "0.69360715",
"text": "def printmap\n\t\t@map.each { |row|\n\t\t\tprintf \"%d to %d is a range of %d, translating to %d / %s to %s\\n\",row[0],row[1],row[1]-row[0],row[2],\n\t\t\t\tip(row[2].to_i),ip(row[3].to_i)\n\t\t}\n\tend",
"title": ""
}... |
f9d36c29ca02572d0bf2e76f92e4f312 | get complaint by complaint id | [
{
"docid": "888b0c077f42394dce95608f30948321",
"score": "0.6531626",
"text": "def show_complaint_by_id\n complaint = Complaint.find(params[:id])\n if complaint\n complaint_status = ComplaintStatus.where(complaint_id: complaint.id).first\n if complaint_status\n complaint.status = c... | [
{
"docid": "4ce2a51611339aa807b3019c8f6455f3",
"score": "0.72552073",
"text": "def find_complaint\n\t\t@complaint = @company.complaints.find(params[:id])\n\tend",
"title": ""
},
{
"docid": "5bd1f19e8477f9d8df4ef26618cc9e69",
"score": "0.6756625",
"text": "def complaints(id, params={}... |
754e24f6446686053eae33516cd099b0 | Calculer le montant pour le recu d'impot | [
{
"docid": "1291cf50b816b79ad3910cdc47537db4",
"score": "0.66348004",
"text": "def montantRecu(famille, membre, annee)\n return 0 unless membre.eligibleRecu(annee)\n ctes = Constantes.instance\n montant = 0.0\n\n # Si le membre a des activites, ajouter sa part de la cotisation de base\n i... | [
{
"docid": "ae7bacbe3572ff1b5c8822e13a41803a",
"score": "0.7058372",
"text": "def imc\n (@peso / (@talla * @talla)).round(1)\n end",
"title": ""
},
{
"docid": "41ea24c209b78c534f6af6bb2a144da5",
"score": "0.69895023",
"text": "def impacto_mujer\n\t\timp=valor_energetico/240... |
5ff6abb81e52162c0ca023c2ff1252f8 | Get the list of properties and their various options for the supplied Entity name. | [
{
"docid": "126dc1114768b3552b4a514ec5a04645",
"score": "0.691733",
"text": "def properties_for_entity(entity_name)\n type_definition = metadata.xpath(\"//EntityType[@Name='#{entity_name}']\").first\n raise ArgumentError, \"Unknown EntityType: #{entity_name}\" if type_definition.nil?\n pr... | [
{
"docid": "5b37d171837b4206ff5b7368fdbdb059",
"score": "0.69078535",
"text": "def properties_for_entity(entity_name)\n namespace, _, entity_name = entity_name.rpartition('.')\n raise ArgumentError, 'Namespace missing' if namespace.nil? || namespace.empty?\n schemas[namespace].properties_... |
b77754cb160de006efa0432656783ec5 | Crawls hash for all the request parameters and adds namespace reference for the keys. Args: args: Hash element of subtree of request parameters. Returns: Modified Hash with all keys updated and all values crawled. | [
{
"docid": "c787eade7f698b8a2d4e8644a9182361",
"score": "0.71428347",
"text": "def prepare_hash_args(args)\n res = {}\n args.each do |key, value|\n res[prepend_namespace(key)] = prepare_args(value)\n end\n return res\n end",
"title": ""
}
] | [
{
"docid": "b5398fe2c07b6928a6beec10ea2cbaae",
"score": "0.6117563",
"text": "def build_hash(args)\n define_method(:hash) do\n args.map { |arg| instance_variable_get(\"@#{arg}\") }.unshift(self.class).hash\n end\n end",
"title": ""
},
{
"docid": "65ad46c6e1990f2c88fe23a2379adc31"... |
7054e3289aec3a30e19b91bdbb84e088 | GET /students/new GET /students/new.json | [
{
"docid": "f31ea40029e0d71047eae194d5eaf452",
"score": "0.71248436",
"text": "def new\n @student = Student.new(ms_year: Time.now.year, phd_year: Time.now.year, status: \"Current student\")\n @student.build_default_qualifier\n @student.committees.build\n\n respond_to do |format|\n forma... | [
{
"docid": "4e668af36a24c1261d41361896c01e77",
"score": "0.8022949",
"text": "def new\n @student = Student.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @student }\n end\n end",
"title": ""
},
{
"docid": "4e668af36a24c1261d413618... |
4a11a742e71ff910c9ac67f31d7c5835 | Update a &39;compute.Board&39; resource. | [
{
"docid": "1a4e3960c03db6ffac2ba9a09214ef19",
"score": "0.0",
"text": "def patch_compute_board_with_http_info(moid, compute_board, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ComputeApi.patch_compute_board ...'\n end\n # verify the ... | [
{
"docid": "90e1b3bb3e62e360c1a6b63234b85464",
"score": "0.6860338",
"text": "def update_compute_board(moid, compute_board, opts = {})\n data, _status_code, _headers = update_compute_board_with_http_info(moid, compute_board, opts)\n data\n end",
"title": ""
},
{
"docid": "c271b1... |
0d623bafd924963c9d606a0953283ecb | Returns records from sandbox where values in column_names are not null and optionally filtered down by specified scope Pass Arel::Table | [
{
"docid": "26b4651c59860da97b9e56ae04457258",
"score": "0.6576835",
"text": "def scoped_records_arel(s)\n not_null_nodes = required_column_names.map do |c|\n s[c].not_eq(nil)\n end\n not_null_conds = not_null_nodes.shift\n not_null_nodes.each { |n| not_null_conds = not_null_conds.and(n... | [
{
"docid": "6d4272d73f238bfca5b72c909007bfd4",
"score": "0.7279973",
"text": "def non_null_scopes!\n boolean_scopes!\n columns.select_null.names.to_syms.each {|col|\n unless respond_to? col\n scope col, lambda {where \"#{quoted_table_name}.#{col} is not null\"}\n ... |
545a8c16110edb5704948cdda3cace50 | Replace Management Report Notification | [
{
"docid": "7319aaef641128c68985766dc0571cab",
"score": "0.0",
"text": "def company_management_id_management_report_notifications_management_report_notification_id_put_with_http_info(id, management_report_notification_id, management_report_notification, opts = {})\n if @api_client.config.debugging\... | [
{
"docid": "b6c9a5cfd10761f893c5744f210ad7ba",
"score": "0.6042317",
"text": "def notify_new_finding\n # TODO: make the method avoid the creation of a Notification record\n end",
"title": ""
},
{
"docid": "890a00cb74dd4ff61aa7abf89b6f2b23",
"score": "0.59540063",
"text": "def not... |
c99b3b4909a78f12adc98c0d17a884ba | read 4 bytes if block is true; otherwise, read 2 bytes | [
{
"docid": "70324862aab38c68fcbadb1e61ac0bf0",
"score": "0.0",
"text": "def read_index(f)\n if yield then\n f.read_dword\n else\n f.read_word\n end\n end",
"title": ""
}
] | [
{
"docid": "717d0baf50affcf0a1166e064435b40f",
"score": "0.65974385",
"text": "def read\n\t\t\t\t\t@stream.readpartial(BLOCK_SIZE)\n\t\t\t\trescue EOFError, IOError\n\t\t\t\t\t# I noticed that in some cases you will get EOFError, and in other cases IOError!?\n\t\t\t\t\treturn nil\n\t\t\t\tend",
"tit... |
dc4c84c54215366fafd6a86012a0c60f | Fetches the included resourcs as an Array containing only nonwildcard resource specifiers. | [
{
"docid": "12963e26e2beda4893ccce68b44c48f5",
"score": "0.78260404",
"text": "def included_resources\n without_wildcard = []\n\n if has_included_resources?\n include_param_array = @include_param.split(',')\n include_param_array.each do |x|\n if x.include? \"*\"\n # do no... | [
{
"docid": "9424297156d4106b3c830e1386784ba1",
"score": "0.72675717",
"text": "def included_resources\r\n # TODO: implement me\r\n if @include_param == nil then return [] end\r\n valid_resources = []\r\n for resource in @include_param.split(',') do\r\n if (!resource.include? '*') && (!r... |
27ec33e1ea51de8b4fba9cb269c3af67 | Check if file already exists and ask for user input on collision | [
{
"docid": "0a15ac0050dc49c71884c752b652748f",
"score": "0.56310654",
"text": "def detect_collision\n if exist?\n if identical?\n notify(:identical, :cyan)\n elsif options[:force]\n notify(:force, :yellow)\n yield unless options[:noop]\n ... | [
{
"docid": "78b8c203ab9575cbe81908ea99df203b",
"score": "0.6953877",
"text": "def check_if_exists!(file)\n if File.exists?(file)\n if !@opthash[:overwrite]\n puts \"File '#{file}' exists. exiting\"\n puts \"Please use the flag -o if you want to overwrite files\"\n exit 1\n end\n e... |
29963b6d519e4c4bca773ace702bca7c | check if all elements in tree is lesser than value | [
{
"docid": "1a7decd29ffe81b75d82cff5234e9c01",
"score": "0.7101835",
"text": "def is_subtree_lesser(root, value)\nend",
"title": ""
}
] | [
{
"docid": "b7e900fc79654e786b1ee1a5b02e1926",
"score": "0.71955454",
"text": "def is_subtree_lesser?(value, root = @root)\n return true if root == nil\n if root.value <= value &&\n is_subtree_lesser?(value, root.link_left) &&\n is_subtree_lesser?(value, root.link_left) \n ret... |
190e5db94cb2cb7644be278cc9b4afc7 | Used to set meta data in headers. | [
{
"docid": "1403b7ecf8d15e53e6e70aa089ad3046",
"score": "0.0",
"text": "def injectable_meta \n set_meta_tags title: \"#{controller_name.humanize.titleize + ' - ' + action_name.capitalize}\",\n description: 'NoBull Software Co.\\'s NoBull Website Ordering Thingy™!👋' ,\n ... | [
{
"docid": "c24d9de19f45c7aa17796e0755e324c8",
"score": "0.77405524",
"text": "def set_meta_headers(headers)\n @logger.info \"Setting #{headers.keys.join(', ')} for tenant #{@fog_options[:hp_tenant_id]}...\"\n response = @connection.request({\n :method => 'POST',\n ... |
5157deac13eff82d3f611eabf057e66e | Generates the Remember_Me token for the user. | [
{
"docid": "b3462e0b0f517b462464b095e54ccdac",
"score": "0.0",
"text": "def remember_me!\n self.remember_token = encrypt(\"#{salt}--#{id}--#{Time.now.utc}\")\n save_without_validation\n end",
"title": ""
}
] | [
{
"docid": "2aa3895fc375fe2f42d0e7ff17175278",
"score": "0.78993034",
"text": "def generate_remember_token\n self[:remember_token] = User.new_token\n end",
"title": ""
},
{
"docid": "cdc482c24c1afb7adf565a1a65ccccd0",
"score": "0.72598",
"text": "def remember_me\n self.rem... |
8e125af3ef901032daff66ca7a898df3 | there is definitely repeated work to be done here. noteably that if a subsequence is already increasing or decreasing you only need to know the next value and the last value to determine if that's still true. | [
{
"docid": "1cff4200fece9d0f890266f1758e6e16",
"score": "0.0",
"text": "def quicksort(array)\n return array if array.length <= 1\n\n pivot = array.first\n left = array.drop(1).select { |el| el <= pivot }\n right = array.drop(1).select { |el| el > pivot }\n quicksort(left) + [pivot] + quicksort(righ... | [
{
"docid": "1abbda63fdf8cde0799594f8dc2f2f07",
"score": "0.73293227",
"text": "def almostIncreasingSequence(sequence)\n counter = 0\n biggest_value = -10 ** 5 # valeur la plus basse de l'exo\n second_biggest_value = biggest_value\n\n sequence.each do |seq|\n if seq > biggest_value # si le nb est ... |
757f090e68cd8bed83108dd1c1057f0f | Saves shifts in a period if template shift isn't already applied. | [
{
"docid": "aea9f680cfd073e92306b6f0318e9475",
"score": "0.6044031",
"text": "def careful_make_period(i)\n self.careful_apply(i).each do |shift| shift.save end\n end",
"title": ""
}
] | [
{
"docid": "3992687cdc16292c1b12b16af511e011",
"score": "0.60999656",
"text": "def make_period(i)\n self.apply(i).each do |shift| shift.save end\n end",
"title": ""
},
{
"docid": "09731d291e0c5e22c5311302259d9e5a",
"score": "0.5958003",
"text": "def create\n Shift.active.first... |
2e42a4f089c696c01c388dfd6c7a12a4 | Pop entries off the schedule that are due | [
{
"docid": "a8bb22af3946b1cba13648790adef9b8",
"score": "0.7483986",
"text": "def entries_due\n [].tap do |entries|\n sync do\n while schedules.first && schedules.first.due?\n entries << schedules.shift\n end\n end\n end\n end",
"title": ""
}... | [
{
"docid": "3b405b97028701e9b5c115b2aec40406",
"score": "0.67308563",
"text": "def dequeue\n [].tap do |items|\n entries.each do |entry|\n items << entry\n end if entries.any?\n\n items.each {|i| entries.delete(i) }\n\n available = later.select {|ent... |
a61bec6cd0e8503da9d63698e69ca652 | Gives log probability of this chain of events. | [
{
"docid": "ca8e96a0f8d6aaabf65dc7db8296f9a6",
"score": "0.6981964",
"text": "def prob_of_events(events)\n @trellis = LogarithmicViterbiTrellis.new(self) unless @trellis\n prob,_ = @trellis.prob_and_bt(events)\n return prob\n end",
"title": ""
}
] | [
{
"docid": "be9518f87bf01b962d3bd9a0bf07e595",
"score": "0.7131761",
"text": "def probability(event)\n (@p[event] * 100).round\n end",
"title": ""
},
{
"docid": "62010841b5068997afc7f900b3764c5b",
"score": "0.6835473",
"text": "def log_prob(key)\n if @counter.total == 0 || !... |
6ede72526308d4b0c0e112f5884c06d7 | returns all registered nodes | [
{
"docid": "b7245bf25985177c6674cf5a7f029748",
"score": "0.83479613",
"text": "def registered\n @registered_nodes ||= []\n end",
"title": ""
}
] | [
{
"docid": "fad21412c4f205bdbd17399216cc8fae",
"score": "0.8078006",
"text": "def nodes\n global.nodes\n end",
"title": ""
},
{
"docid": "7a8849062d462369a52c1a63eebd5f14",
"score": "0.8071492",
"text": "def all\n DCell.registry.nodes\n end",
"title": ""
},
... |
2d8854df19d01784d35857b5ca1ab4de | property BSTR FieldList BSTR table_name [IN] | [
{
"docid": "8ecd4ff665e16cf6abcd2da0b1d9b9db",
"score": "0.6646167",
"text": "def FieldList\n @_FieldList ||= OLEProperty.new(@ole, 4, [VT_BSTR], [VT_BSTR, VT_BSTR])\n end",
"title": ""
}
] | [
{
"docid": "ebb144e148066e67aaed99e728cf7f49",
"score": "0.68481106",
"text": "def field_list_command(table, field)\n synchronize do\n reset\n write [COM_FIELD_LIST, table, 0, field].pack(\"Ca*Ca*\")\n fields = []\n until self.class.eof_packet?(data = read)\n fi... |
89b95f75e00e82c92c1f359c19eaaf2c | Delete an event +id+ of the event to delete | [
{
"docid": "28380dea2adb76d63898028d6e79e69c",
"score": "0.8572565",
"text": "def delete_event(id)\n @event_svc.delete(id)\n end",
"title": ""
}
] | [
{
"docid": "4bd782c74f6f0b12c9da67d0a737b65a",
"score": "0.85929364",
"text": "def delete(id)\n wf_event_id?(id)\n api.delete(id)\n end",
"title": ""
},
{
"docid": "8fe9dba03465c66e05ebd6fde9501df8",
"score": "0.8154532",
"text": "def delete_event(event)\n @connecti... |
5ac9777a0903873e7a5a92d4ed7cf125 | Draw an outline of a quad. | [
{
"docid": "f432a0201643f21fe6afe6ce370a67fd",
"score": "0.71387076",
"text": "def draw_quad(x1:, y1:, x2:, y2:, x3:, y3:, x4:, y4:, stroke_width: 1, color: nil, colour: nil)\n draw_polyline closed: true,\n coordinates: [x1, y1, x2, y2, x3, y3, x4, y4],\n color... | [
{
"docid": "98b33b61100634957a12bef2ff363334",
"score": "0.68635476",
"text": "def make_quad(tl, tr, bl, br, fill_color = BLUE, opacity = 255, z = 0)\n fill_color.alpha = opacity\n Gosu.draw_quad(tl[:x], tl[:y], fill_color,\n tr[:x], tr[:y], fill_color,\n bl[:x], bl[:y], ... |
b057e7514b88aef3d533214caee199c8 | PUT /chinabanks/1 PUT /chinabanks/1.xml | [
{
"docid": "37e0f6e11a82088d532539e14ee15747",
"score": "0.67562056",
"text": "def update\n @chinabank = Chinabank.find(params[:id])\n\n respond_to do |format|\n if @chinabank.update_attributes(params[:chinabank])\n flash[:notice] = 'Chinabank was successfully updated.'\n format... | [
{
"docid": "3dcf86585efc3ff5d39f6326a1b80381",
"score": "0.5709022",
"text": "def create\n @chinabank = Chinabank.new(params[:chinabank])\n\n respond_to do |format|\n if @chinabank.save\n flash[:notice] = 'Chinabank was successfully created.'\n format.html { redirect_to(@chinaba... |
d6a031ca79a835e3ffdb16bf0e875d82 | Returns the string value of the token. | [
{
"docid": "b0d4227caf5b51c7199379ed7edaf4d1",
"score": "0.76658654",
"text": "def to_s\n @token\n end",
"title": ""
}
] | [
{
"docid": "fcdef87c0e9e8f4e4fecf3fdc73d59ff",
"score": "0.82070637",
"text": "def token_string\n @token\n end",
"title": ""
},
{
"docid": "c1b935889dce759ae4da4210113a4700",
"score": "0.81460303",
"text": "def string_value(token); end",
"title": ""
},
{
"docid": ... |
a526487af4068608d9f81bdb31604c9b | an now lets dry up the mocking and route building | [
{
"docid": "a0d1c94962bbb269e6a27849b45da530",
"score": "0.56692797",
"text": "def fancyroutes(&blk)\n FancyRoutes(@map,&blk)\n end",
"title": ""
}
] | [
{
"docid": "04b574985fadc91df45fa0a1b3277c42",
"score": "0.6971899",
"text": "def test_route_with_params_to_block_returning_router_routing_to_resource_with_more_params\n root_router do\n route('/foo/{x}') do |router1, uri1, params1|\n\n Class.new do\n include Doze::Router\n ... |
23e1edf2bca7d4d0e31488f07de41727 | validates_uniqueness_of :applicant, :scope => [:committee, :deliberation_id] | [
{
"docid": "e9950342868daef1a05941ab17082f87",
"score": "0.5277618",
"text": "def get_applicant\n \treturn Applicant.find(self.applicant)\n end",
"title": ""
}
] | [
{
"docid": "9cc4818c3ca359b48b65d99065ea2e49",
"score": "0.6779906",
"text": "def validate_duplicated_application\n if job.job_applicants.exists?(:applicant_id => applicant.id) #21\n if is_hired == false\n errors.add(:job, \"has been applied before. You can't apply it again\")\n... |
6dd4aae0ac13c3e6107ccaf93d913570 | Time Complexity: O(n) where is equal to number of each single node in the tree Space Complexity: O(n) where n is the number of functino calls | [
{
"docid": "8f79ef9c4b783080a3a2cfc105a5d99a",
"score": "0.0",
"text": "def height\n # raise NotImplementedError\n # return 0 if @root.nil?\n return height_helper(@root, 0, 1)\n end",
"title": ""
}
] | [
{
"docid": "a11565bfce15075e1ca2cc65e69e3480",
"score": "0.65899783",
"text": "def size(tree)\n if isEmpty?(tree)\n 0\n else\n 1 + size(tree.left) + size(tree.right)\n end\nend",
"title": ""
},
{
"docid": "751bc6f151fc4e87e3fd9118f4624696",
"score": "0.6387855",
"text": "def... |
18f3523b835c8d4a5f2fd91e84d53eff | GET /rooms/1 or /rooms/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "feaa838e2a85e776367fbf59114d5c2a",
"score": "0.7220368",
"text": "def index\n rooms = Room.includes(:problems, :registrations, :users, :owner)\n if params[:name]\n render json: rooms.where(name: params[:name])\n else\n render json: rooms\n end\n end",
"title": ""
... |
78fff4da966577d51993e411eccda396 | Validates an mbox style mailbox and returns the number of messages it contains. | [
{
"docid": "83d9f9aaef8a46726d53521101e4dd3f",
"score": "0.70565665",
"text": "def validate_mbox(filename, sentinel)\n mailcount = 0\n line_count = 1\n message_line_count = 0\n body_line_count = -1\n prevline = nil\n sentinel_match = true\n IO.foreach(fil... | [
{
"docid": "4bff86f4325b363441edd6dadf492d8a",
"score": "0.7197211",
"text": "def mailbox_count\n return @mailbox_count\n end",
"title": ""
},
{
"docid": "dcc7530e763a61c7d3b142e933304b60",
"score": "0.691039",
"text": "def count_in_mailbox_less_than_three?\... |
53f71441024d4d2c51d55ba4083f1459 | Get the links which can be shown as multimedia content | [
{
"docid": "34de83b4ed758f371c862f50cc443833",
"score": "0.8396384",
"text": "def multimedia_content\n return [] if more_info_urls.blank?\n\n multimedia = more_info_urls.map do |link|\n auto_html(link) {\n youtube(width: 360)\n vimeo\n audio\n soundcl... | [
{
"docid": "58a17aa503ff00a7006d0a601dd6e1ce",
"score": "0.73462677",
"text": "def get_content_links\n content_links = []\n content_links = get_links('.*content\\/.*')\n return content_links\n end",
"title": ""
},
{
"docid": "c3bd622468739b9207617abf2a2a1faf",
"score": "0.69942... |
077b2bc6b8116a2b6a9c3fac98d9db9e | ============ = AWS KEYS = ============ aws vars | [
{
"docid": "913a1009ac91657f54b24a9bbc0debdb",
"score": "0.5489686",
"text": "def aws_access_id\n AWS_ACCESS_ID\n end",
"title": ""
}
] | [
{
"docid": "6010eac99119044591a1fb74beadb1d3",
"score": "0.6447641",
"text": "def env_vars\n {\n \"AWS_ACCESS_KEY_ID\" => auth.userid || \"\",\n \"AWS_SECRET_ACCESS_KEY\" => auth.password || \"\",\n \"AWS_SECURITY_TOKEN\" => auth.auth_key\n }.delete_nils\n... |
7283303c2cf4661a024b951ee1ffccf9 | Description: Sets the text of the text field withoud firing the events like onKeyPress, onKeyDown etc. This should not be used generally, but it is useful in situations where you need to set large text to the text field and you know that you don't have any event to be fired. Input: v Text to be set. def value=(v) asser... | [
{
"docid": "5c785f11ac2b8b3022084de4fe7673d5",
"score": "0.0",
"text": "def doKeyPress( value )\r\n begin\r\n maxLength = @o.maxLength\r\n if (maxLength != -1 && value.length > maxLength)\r\n original_value = value\r\n value = original_value[0..... | [
{
"docid": "a485b5a650a9626051592a71de99177e",
"score": "0.78700477",
"text": "def set_Text(value)\n set_input(\"Text\", value)\n end",
"title": ""
},
{
"docid": "a485b5a650a9626051592a71de99177e",
"score": "0.78700477",
"text": "def set_Text(value)\n set_inp... |
8aeb9e307183caa3ad07d4e6b3005d9c | Coerce schema into a Attribute> Hash | [
{
"docid": "6dba62c28fbfd53cacf590d59cee494c",
"score": "0.59598845",
"text": "def to_h\n each_with_object({}) { |attr, h| h[attr.name] = attr }\n end",
"title": ""
}
] | [
{
"docid": "a24b8119a869dc24d077daf2da5e036b",
"score": "0.7160926",
"text": "def to_input_hash\n HASH_SCHEMA.schema(\n map { |attr| [attr.name, attr.to_write_type] }.to_h\n )\n end",
"title": ""
},
{
"docid": "ba0ad4b0d649b5f14e6e73a6dd99294b",
"score": "0.71596164",... |
d86056d3605adf21b7e6d13a108815cb | mutate the solr_parameters to remove words that are boolean operators, but not intended as such. | [
{
"docid": "56d50db61d6bfeead4f37b36228361e5",
"score": "0.7955222",
"text": "def cleanup_boolean_operators(solr_parameters)\n return add_advanced_parse_q_to_solr(solr_parameters) if run_advanced_parse?(solr_parameters)\n solr_parameters[:q] = cleaned_query(solr_parameters[:q])\n return solr_pa... | [
{
"docid": "747bffa373813c90daf0a6d0ebb7070f",
"score": "0.65910614",
"text": "def parslet_trick(_solr_parameters)\n return unless blacklight_params[:q].is_a?(String)\n return unless blacklight_params[:q].strip.end_with?(\"()\")\n blacklight_params[:q] = blacklight_params[:q].strip.gsub(\"()\",... |
e1f58e8e928fe570a65313b247b68682 | For the benefit of error handlers, returns the most recent glob pattern which didn't find a file in the filesystem | [
{
"docid": "931676c218017638790050b7a1db075a",
"score": "0.0",
"text": "def unmatched\n @_merb_unmatched\n end",
"title": ""
}
] | [
{
"docid": "bf3950d09439d98c404900994c325137",
"score": "0.64692676",
"text": "def latest_file(glob)\n require 'find'\n return FileList[glob].map{|path| [path, File.mtime(path)]}.sort_by(&:last).map(&:first).last\n end",
"title": ""
},
{
"docid": "d26132ad57b262a4fb74263861f5e392",
... |
207877a4e8df264b8fac46ba3cf6f6f1 | Close the connection to twitter without closing the eventmachine loop | [
{
"docid": "d719226d40682d2792c4479e85793882",
"score": "0.5998591",
"text": "def close_connection\n @stream.close_connection if @stream\n end",
"title": ""
}
] | [
{
"docid": "6ac43b066370202a9a2ab30ab8757d85",
"score": "0.75600815",
"text": "def close\n puts \"closing twitter stream\"\n @stop = true\n @connection.finish if @connection\n Thread.pass\n rescue IOError\n #raised if not already started, so no action\n rescue StandardError => e\n pu... |
1eadf00dab4dd32ce0f52b9a7fe5c458 | If you have extra params to permit, append them to the sanitizer. | [
{
"docid": "5d58f9959f5fd4a2410d63fef33c5511",
"score": "0.0",
"text": "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end",
"title": ""
}
] | [
{
"docid": "9f3b62fe05ad1542504f6ef13056ac4e",
"score": "0.6905034",
"text": "def sanitize_parameters!(sanitizer, params)\n # replace :readwrite with :onlyif\n if params.has_key?(:readwrite)\n warn \":readwrite is deprecated. Replacing with :onlyif\"\n params[:onlyif] = p... |
9d11ac03b3dec20944218affb461c1ec | def set_file_system(path) Liquid::Template.file_system = SubjectService::FileSystem.new(path, "_%s.html.liquid".freeze) end | [
{
"docid": "4579c6e4f1320938a00cda5a8ad45efb",
"score": "0.5669637",
"text": "def set_resource_file_system(resource, *args)\n resource_file_system(resource)\n set_file_system File.join(resource_file_system(resource), *args)\n end",
"title": ""
}
] | [
{
"docid": "acb9e7efcbdec9607b42436ab6ffe230",
"score": "0.63934755",
"text": "def set_file_system\n @file_system = FileSystem.find(params[:id])\n end",
"title": ""
},
{
"docid": "12950448feae5e8ee0300a7efdd5a751",
"score": "0.61803967",
"text": "def template=(file)\n @templ... |
ada2a13af2e7384e0ab13e9a51a58405 | Generate an ISO 8601 representation of the specified date expressed in UTC. | [
{
"docid": "b07a1cde65dfd799e80c2bfea687ea81",
"score": "0.6052033",
"text": "def to_datetime date\n #date.getutc.strftime('%FT%T%:z')\n date.getutc.iso8601\nend",
"title": ""
}
] | [
{
"docid": "98b0e4fe9783dd6ea3364021af7f78c1",
"score": "0.6798587",
"text": "def iso8601\n \"#{start_date.iso8601}/#{end_date.iso8601}\"\n end",
"title": ""
},
{
"docid": "9dc0c0244153531664aa550abc4d2d69",
"score": "0.6776414",
"text": "def iso_date(date)\n date.iso8601\n ... |
67b5942173f9787609c2f02120e13cca | MAKES PARAMS test minimum params for residuals endpoint | [
{
"docid": "ff626cb8e78678ffce9917010455115b",
"score": "0.52640224",
"text": "def makes_params_1\n {\n dataSetId: @dataSetId,\n effectiveDate: @effectiveDate,\n modelYear: \"2017\",\n makeCode: \"100\",\n residuals: true\n }\n end",
"title": ""
}
] | [
{
"docid": "432b02fb893ea5a21468c22f2b9234d4",
"score": "0.5676342",
"text": "def params_required\n\n min, max = 0, @action_params.size\n\n unlimited = false\n @action_params.each_with_index do |setup, i|\n\n increment = setup[0] == :req ? true : false\n\n if param... |
28351b37974dd50e2d7d886c13e46826 | Tells the IRC server who you are. The _nickname_ parameter is the name by which other clients display your messages; _realname_ is a more elaborate name containing the name of the person behind the user agent or (more commonly) a silly witticism. The _passwd_ is +nil+ by default and therefore will not be sent. The mode... | [
{
"docid": "a5e612ec64d178e4d9fa6c9da71ec00f",
"score": "0.58266646",
"text": "def register(nicknam, realname, passwd = nil, mode = 0)\n pass(passwd) if passwd\n nick(nicknam)\n user(nicknam, realname, mode)\n end",
"title": ""
}
] | [
{
"docid": "3dfd09cd7efb7f091a876c4b072eab04",
"score": "0.6654996",
"text": "def user_mode(modes = nil, nicknam = nil)\n raise ArgumentError, 'bad user mode' unless modes =~ USER_MODE_REGEX\n raise ArgumentError, 'bad nickname' unless !nick || IRC.nickname?(nicknam)\n send_msg(\"MODE #{n... |
5c6278a1bb20c28bf48cf5f287c852d4 | Get the post from params | [
{
"docid": "134bb58574f5678044a5f08be1382eaf",
"score": "0.57048315",
"text": "def get_post\n @post = Post.find(params[:id])\n end",
"title": ""
}
] | [
{
"docid": "9734c6a114a58454829035809227a33e",
"score": "0.78994185",
"text": "def post_params\n params[:post]\n end",
"title": ""
},
{
"docid": "1c8dff9afbd0d1d7e58e1ac79c820ef7",
"score": "0.76300097",
"text": "def post_params\n params[:post]\n end",
"title": ""
}... |
03c2dc5b533a48fb76aa319ba64b728a | Return the total number of strings in the provided array using the count enumerable i created an empty variable to return the total number of strings in my array, i started by selecting my array and using the count enumerable to count the total number of objects, then from those ojbects selecting only the number of str... | [
{
"docid": "8d4a789dcff04ac9181db81c95b610ef",
"score": "0.6053077",
"text": "def count_empty_strings(array)\n array.count do |element|\n # element == \"\"\n element.class == String && element.empty?\n end\nend",
"title": ""
}
] | [
{
"docid": "0557e74984120f891d2d4776ebea92db",
"score": "0.69784737",
"text": "def count_elements(array)\n array.uniq.collect do |word|\n word[:count] = array.count(word)\n word\n end\nend",
"title": ""
},
{
"docid": "c78fdd7bd304e003020d7f3e3bb4df68",
"score": "0.68128914",
... |
3c85ed037c8a385681e22da5fd0833ac | Get xAPI statements for a Registration Returns xAPI statements for the registration. | [
{
"docid": "acfc09bd336cd03eb1d7be7fa3f6c832",
"score": "0.54694486",
"text": "def get_registration_statements(registration_id, opts = {})\n data, _status_code, _headers = get_registration_statements_with_http_info(registration_id, opts)\n data\n end",
"title": ""
}
] | [
{
"docid": "5be79e081333cdb6e5bc14cb052925e7",
"score": "0.639766",
"text": "def get_registration_statements_with_http_info(registration_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: RegistrationApi.get_registration_statements ...'\n en... |
3c34c5097ef215e4394a21ae8f243f22 | Creates new user, starting credit set to 0 | [
{
"docid": "e581626145d558526978a21d591effa1",
"score": "0.0",
"text": "def create\n @user = User.new(user_params)\n if (@user.isFilled(session)) # Checks if the form was filled. If not it adds an error message \n User.all.each do | sel | # This checks every other user in the us... | [
{
"docid": "f09b18f59fb4fc7c830846175351d062",
"score": "0.76850396",
"text": "def create_new_user\n begin\n # Creates hash of the password enetered by the user\n password = Utility.encrypt_password(@password)\n # Insert a new entry in the database for a user\n @client... |
9cba8df50db57d5dd0e5178fbb08b8cb | Main control method of application | [
{
"docid": "4cdd04a6f1c3ccd9f55583eeb9f3d944",
"score": "0.0",
"text": "def controler(args)\n check_severity(args)\n\tif args[:hosts]\n\t\tparse_scan_for_report(args[:hosts])\n\t\tmatch_hosts_to_findings(args[:hosts], args)\n\t\tScanhost.display_all_hosts(SCANHOSTS, args)\n\telsif args[:nessusscan]\n\t... | [
{
"docid": "e95cfad9c46711f2a05857f5bcaad7b7",
"score": "0.82403064",
"text": "def main\n\n end",
"title": ""
},
{
"docid": "e95cfad9c46711f2a05857f5bcaad7b7",
"score": "0.82403064",
"text": "def main\n\n end",
"title": ""
},
{
"docid": "c821ff4ec859b1dd0f587dc9... |
37f88620fab067c2f2f4214f3b5764ca | All nested set queries should use this nested_set_scope, which performs finds on the base ActiveRecord class, using the :scope declared in the acts_as_nested_set declaration. | [
{
"docid": "ec60d3ae32ad973cffd39a1372d90929",
"score": "0.7651104",
"text": "def nested_set_scope\n conditions = scope_column_names.inject({}) do |cnd, attr|\n cnd.merge attr => self[attr]\n end\n\n self.class.base_class.order(q_left).where(conditions)\n ... | [
{
"docid": "0b59ac927a1d882ac26ee73a307fd323",
"score": "0.7323871",
"text": "def nestable_scope\n self.class.base_class.where(self.class.nestable_options[:scope].inject({}) { |scope, field| scope.merge!(field => send(field)) })\n end",
"title": ""
},
{
"docid": "83c07ae21aea8cce... |
3a1ccecd277eab053582bce8ed130924 | Sets the value of the `external_status` attribute. | [
{
"docid": "67762a2acb5b062d49a06f4faeff86a2",
"score": "0.8976698",
"text": "def external_status=(value)\n @external_status = value\n end",
"title": ""
}
] | [
{
"docid": "5c86cbd7315357fe6aecf09e29f64563",
"score": "0.6904942",
"text": "def set_status(status)\n @status = status\n end",
"title": ""
},
{
"docid": "28f6ec75354f02637065251ac5593d43",
"score": "0.6902702",
"text": "def set_status(status)\n @status = status\n e... |
ccbe66ef2621bc0e542cb308df3db41d | print1 and print2 put a space when a list is initialized without a value. this is probably related to the "nil" value | [
{
"docid": "bf3c537f68a66eacdee8583e47d9eb33",
"score": "0.536311",
"text": "def print1\r\n\t\tputs \"{\"\r\n\t\tcurrent = @head\r\n\t\twhile current != nil\r\n\t\t\tputs current.data\r\n\t\t\tcurrent = current.next\r\n\t\tend\r\n\t\tputs \"}\"\r\n\tend",
"title": ""
}
] | [
{
"docid": "e4041ab1e3fb8a2eea544cae4e09b27a",
"score": "0.6467294",
"text": "def print_list\n\t\tnode = @start\n\t\twhile (node.nil? == false)\n\t\t\tputs(node.value)\n\t\t\tnode=node.right\n\t\tend\n\tend",
"title": ""
},
{
"docid": "2eb3e3add96d2392dd72da1ea6458f79",
"score": "0.63038... |
5405f00177a551b3a9c4139d58d59e2e | instantiate the bot and the plugin fresh | [
{
"docid": "5fc380b9113582b24c23e2bf298147dc",
"score": "0.0",
"text": "def setup\n bot = CampfireBot::Bot.instance\n bot.stub!(:config).and_return({'nickname' => 'Bot'})\n @beer = SpecBeer.new()\n CampfireBot::Plugin.registered_plugins['Beer'] = @beer\n @message = SpecMessage.new(:person => 'Josh'... | [
{
"docid": "652d2a7f1990a35bebcf506eed07acbf",
"score": "0.72537446",
"text": "def initialize(instance_bot=nil)\n super instance_bot\n \n # Since Core registers the commands of plugins that it loads, and it loads\n # itself, it must also register itself. Other plugins don't need this.\n ... |
42f7e7c265dbdb9b64d367aa75733326 | Render a dropdown button as filter select | [
{
"docid": "6a45e263c30812a700e63aebf2ec13e7",
"score": "0.67708045",
"text": "def values_dropdown query_params, field\n filter_opts = query_params.filters[field] || {}\n value = query_params.filter_value(field)\n values = filter_opts[:values] || []\n\n label = [field_name(field), field_valu... | [
{
"docid": "241f8a50c11c9463a17098ef285dbc8a",
"score": "0.71545124",
"text": "def filter_button(label='Apply Filter', options={}, html_options={})\n options.reverse_merge! :prefix => 'filter'\n html_options.reverse_merge! :disabled => true, :type => 'button',\n :value => label, :id => ... |
bd0930d8d2bfb591b13d9a0d46534d75 | Generates a new API token for the Project. Does not save the Project. | [
{
"docid": "b47483a89740e3ae8526581422bd2b02",
"score": "0.74803543",
"text": "def create_api_token(); self.api_token = SecureRandom.urlsafe_base64(180); end",
"title": ""
}
] | [
{
"docid": "f77e2c209cec003164ae485343376363",
"score": "0.74308515",
"text": "def generate_api_token\n self.api_token = SecureRandom.uuid\n end",
"title": ""
},
{
"docid": "a6c90a4fc644b6dee29c2a116fcf920d",
"score": "0.7226913",
"text": "def generate_api_key\n token = Secure... |
3368cecb12290dea80902a9897800b02 | GET /disciplines GET /disciplines.xml | [
{
"docid": "c0b1e91497eb2c63608aed484aecc73a",
"score": "0.60721093",
"text": "def index\n @disciplines = @course.disciplines.latest_versions\n @disciplines = @disciplines.where_code_or_name(params[:term]) if params[:term]\n @disciplines = @disciplines.paginate :page => params[:page] \n \n ... | [
{
"docid": "96844d404e2476d42e0e347ec5737453",
"score": "0.64370245",
"text": "def index\n @disciplinas = Disciplina.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @disciplinas }\n end\n end",
"title": ""
},
{
"docid": "113aa4... |
c0e59fd941015869b222542c96d22a8a | POST /teams POST /teams.json | [
{
"docid": "119df72636139a28531344aea3f4d286",
"score": "0.6778875",
"text": "def create\n @team = Team.new(team_params)\n @team.save\n respond_with(@team)\n end",
"title": ""
}
] | [
{
"docid": "3280629651000a453e2e1dec9c2eca31",
"score": "0.7685086",
"text": "def create\n\n\t @team = Team.new\n\n\t #Need the [:teams] because its a hash based on the post, and then\n\t #within that hash, we access the [:name]\n\t @team.name = params[:team][:name]\n\t @team.wins_total =... |
74e550258132c14a508ae46fdec0b264 | GET /bus_line_directions GET /bus_line_directions.json | [
{
"docid": "8f97ea45eec976a777e8a7dfe322684b",
"score": "0.7396735",
"text": "def index\n @bus_line_directions = BusLineDirection.all\n end",
"title": ""
}
] | [
{
"docid": "7e09d1d0931a97b1e6729cd59d9ef950",
"score": "0.7047474",
"text": "def bus_api_getdirections(route)\n url_safe_route = URI.encode(route)\n apiKey = \"UPGw2J5PBxNnF967CAMyHygeB\"\n apiLink = \"http://www.ctabustracker.com/bustime/api/v1/getdirections?key=#{apiKey}&rt=#{url_safe_route}... |
5d881e0cf507b56fe367237be87f25d9 | GET /admin/contacts/1 GET /admin/contacts/1.json | [
{
"docid": "4eaa6bae49fcaead8d26dbe39e4c6c1d",
"score": "0.7703216",
"text": "def show\n @admin_contact = Contact.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_contact }\n end\n end",
"title": ""
}
] | [
{
"docid": "8eea3a2e86364d38226af95d61abd66e",
"score": "0.81767255",
"text": "def contacts\n get('contacts')\n end",
"title": ""
},
{
"docid": "680464823216e7f4871a0a4894b924aa",
"score": "0.8123372",
"text": "def contacts()\n get('contactsList')\n end",
"title": ""
... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "a7211969b35330823082e7eb2f83325d",
"score": "0.0",
"text": "def order_params\n params.require(:order).permit(:user_id, :status, :orderType, :orderFrom, :image, :user_ids => [])\n end",
"title": ""
}
] | [
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.6980629",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.67819995",
"text": "def strong_params\n params.requ... |
a1cee71a99602b70d71851fcbf7cb5b8 | there may be a more efficient way to do this but I check the length of the set then I get the score of the last value I want to keep then remove all keys with a lower score | [
{
"docid": "e04fdb024244591a1b9e81e4d2c31646",
"score": "0.0",
"text": "def trim_feed(id=self.id_s, location=\"feed\", indx=FEED_LENGTH)\n k = key(:feed)\n if ($redis.zcard k) >= indx\n n = indx - 1\n if (r = $redis.zrevrange k, n, n, :with_scores => true)\n $redis.zremrangebyscor... | [
{
"docid": "2664002d1cd56d0462d4354cd8b1ad83",
"score": "0.6949692",
"text": "def remove_by_score keys, *population\n if population.empty?\n population = 1\n else\n population = population.first\n end\n i = 0 \n keys.each {|k| @redis.zremrangebyscore(k, '-inf', population); i... |
3aa18a23935cfaa5ebce1bf614ca37f5 | GET /description_of_components/1 GET /description_of_components/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "bf82ba16654ac983d707a70dc526e17b",
"score": "0.7602657",
"text": "def index\n @description_of_components = DescriptionOfComponent.all\n end",
"title": ""
},
{
"docid": "7021214e68687f3932b5c92cbc0c0633",
"score": "0.68399143",
"text": "def components\n\t return JSON.... |
bf3482578f2332acb5639834c9a09cce | the cache is expired | [
{
"docid": "e1a1a7499692c5dd3570cd2f305e43ab",
"score": "0.79037213",
"text": "def cache_expired\n if Lock.acquire_lock(cache_path)\n pass\n else\n # haven't acquired lock, return stale cache\n check_cache\n end\n end",
"title": ""
}
] | [
{
"docid": "a55d53b4fc810c24ff722339c3947d98",
"score": "0.82542586",
"text": "def expire_cache; end",
"title": ""
},
{
"docid": "a55d53b4fc810c24ff722339c3947d98",
"score": "0.82542586",
"text": "def expire_cache; end",
"title": ""
},
{
"docid": "bf971416243658c6bad2f6f8... |
77199746fe481289a07a05728c4be404 | GET /word_srcs/1 GET /word_srcs/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "38320436e342f366d053f05f7a95ad6a",
"score": "0.71973705",
"text": "def index\n @word_srcs = WordSrc.all\n end",
"title": ""
},
{
"docid": "477fc772461dce29090df58215c03ce0",
"score": "0.6183881",
"text": "def show\n curWord = Word.find_by_word(params[:id])\n res... |
ef91e7660efdd196d0b556b60207219c | DELETE /comments/1 DELETE /comments/1.xml | [
{
"docid": "9a443b1f001b7846b27c437bdd12b464",
"score": "0.0",
"text": "def destroy\n @comment = @computer.comments.find(params[:id])\n @comment.destroy\n\n respond_to do |format|\n format.html { redirect_to(computer_comments_url) }\n format.xml { head :ok }\n format.js\n end... | [
{
"docid": "b44ce28afcd584c4b9966829c6ff230b",
"score": "0.70702124",
"text": "def delete_comments\n end",
"title": ""
},
{
"docid": "34124a60af3035f72f2c565669a4e3a4",
"score": "0.7065266",
"text": "def destroy\n @comment = Comment.find(params[:id])\n @comment.destroy\n \n... |
1c426200987e7a082c1e16fd1ced5563 | only archive if there are no related plan stages or environments | [
{
"docid": "6cda8410f8bfad203a4276121a9684fa",
"score": "0.72523457",
"text": "def can_be_archived?\n self.environments.blank? && self.plan_stages.blank?\n end",
"title": ""
}
] | [
{
"docid": "625fcc6f8f56645b59f77fc36c0e87d1",
"score": "0.6587175",
"text": "def can_be_archived?\n # prevent archiving with a running plan and not the default\n self.active_plans.empty? && !default?\n end",
"title": ""
},
{
"docid": "5e31f705d37f12bc86ba1f311b9c849b",
"score": "... |
9c7f4d4ff7089e074c1fe1a9085b4831 | Makes the current thread join the engine's scheduler thread You can thus make an engine standalone with something like : require 'openwfe/engine/engine' the_engine = OpenWFE::Engine.new the_engine.join And you'll have to hit CTRLC to make it stop. | [
{
"docid": "acfcd04f9ee78bc90a2a60a11b5ce073",
"score": "0.6870944",
"text": "def join\n\n get_scheduler.join\n end",
"title": ""
}
] | [
{
"docid": "71d314c5d751d39a5c77740caa5ea4ba",
"score": "0.7049494",
"text": "def join\n\n @scheduler_thread.join\n end",
"title": ""
},
{
"docid": "7bab64eb83db14066c24b40face3739f",
"score": "0.69238555",
"text": "def join\n scheduler.join\n end",
"title":... |
eb27727eac051c418e4e8b6dddcebffb | GET /map_layers/1 GET /map_layers/1.xml | [
{
"docid": "95f502366e2b6f903754723313fedda3",
"score": "0.7328853",
"text": "def show\n @map_layer = MapLayer.find(params[:id])\n\n respond_to do |format|\n format.html { render 'show', :layout => false}\n format.xml { render :xml => @map_layer }\n end\n end",
"title": ""
}
] | [
{
"docid": "61d258ed2ba8704e8e3d6cac9205b5b8",
"score": "0.7665787",
"text": "def index\n @map_layers = MapLayer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @map_layers }\n end\n end",
"title": ""
},
{
"docid": "cdaad512dc3... |
5c0ad73295b069df3e2c8b3c152e46e4 | PATCH/PUT /musics/1 PATCH/PUT /musics/1.json | [
{
"docid": "cdacd28cc1395a9a9eb43803cc23d5c8",
"score": "0.0",
"text": "def update\n respond_to do |format|\n if @music.update(music_params)\n Docsplit.extract_images(@music.slide.path, size: '1000x', format: [:jpg], output: 'public/uploads/music/slide/'+ @music.id.to_s)\n format.h... | [
{
"docid": "bac7f237227d97c139237a8266e4335b",
"score": "0.657478",
"text": "def update\n @muscle = Muscle.find(params[:id])\n\n respond_to do |format|\n if @muscle.update_attributes(params[:muscle])\n format.html { redirect_to @muscle, notice: 'Muscle was successfully updated.' }\n ... |
b9d9405a91a8be1f57d22cc89ed5b44c | It is possible not to call Twitter API in this method only when accessing from crawlers, but since the same Twitter API is called in other places, it's a bit meaningless. | [
{
"docid": "13b45ee9ccb49521123cdc920392e74e",
"score": "0.0",
"text": "def not_found_user?(screen_name)\n SearchRequestValidator.new(current_user).not_found_user?(screen_name)\n end",
"title": ""
}
] | [
{
"docid": "ac6e96a3513a5220967d255fc4f834ce",
"score": "0.6938172",
"text": "def twitter\n end",
"title": ""
},
{
"docid": "cfe7cdef439fa7455b111c58ac605afe",
"score": "0.6852652",
"text": "def twitter ; callback end",
"title": ""
},
{
"docid": "61fb6e2ecd7f281aac6ab27... |
82f3b7f9ee94ce08461e2f828baa7f28 | Returns the document date. If metadata is not present then calculates it based on Jekyll::Sitetime or the document file modification time. Return document date string. | [
{
"docid": "dc7602904bb9be2afd223890faee93db",
"score": "0.6870719",
"text": "def date\n data[\"date\"] ||= (draft? ? source_file_mtime : site.time)\n end",
"title": ""
}
] | [
{
"docid": "9c6a61a72cb8d90777aad74bdacd9b5c",
"score": "0.6695055",
"text": "def datacite_issued_date\n res = resources.with_public_metadata.order(created_at: :asc).first\n return nil unless res.present?\n\n res.publication_date || res.updated_at\n end",
"title": ""
},
{
"... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "a544be43e8d15c608927ff7fd14b20cf",
"score": "0.0",
"text": "def shift_schedule_params\n params.require(:shift_schedule).permit(:shift_time_id, :from, :to, :status)\n end",
"title": ""
}
] | [
{
"docid": "e164094e79744552ae1c53246ce8a56c",
"score": "0.69792545",
"text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end",
"title": ""
},
{
"docid": "e662f0574b56baff056c6fc4d8aa1f47",
"score": "0.6781151",
"text": "def strong_params\n params.requ... |
ed83ad168ad3f79094205e1a4dbe7302 | DELETE /postulations/1 DELETE /postulations/1.json | [
{
"docid": "7be571b284b624d5451d48cba3f049b6",
"score": "0.71221983",
"text": "def destroy\n @postulation.destroy\n respond_to do |format|\n format.html { redirect_to user_postulations_path, notice: \"Postulation was successfully destroyed.\" }\n format.json { head :no_content }\n end... | [
{
"docid": "25c7914cf9caabef9302ca4d523b9a66",
"score": "0.7280447",
"text": "def destroy\n @postulate.destroy\n respond_to do |format|\n format.html { redirect_to postulates_url }\n format.json { head :no_content }\n end\n end",
"title": ""
},
{
"docid": "6cb169e3d1e71e8... |
a2099a77c85e91272ae2f9e35b937953 | Only allow a trusted parameter "white list" through. | [
{
"docid": "8d437062b0ac269765383a9f6bc1ec97",
"score": "0.0",
"text": "def snapshot_params\n params.require(:snapshot).permit(:name, :query)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7943618",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.69572574",
"text": "def permitted_params\n params.permit!\n end",
"title"... |
02bd78737db36f3fce70daad8019b35e | By default, log to rack.errors. | [
{
"docid": "65b851cdd671564212d67675beaee693",
"score": "0.6291538",
"text": "def <<(str)\n @env[\"rack.errors\"].write(str)\n @env[\"rack.errors\"].flush\n end",
"title": ""
}
] | [
{
"docid": "7ed4f73bd5bf46834a0c3203ad47a333",
"score": "0.74924666",
"text": "def test_logs_errors_to_rack_logger\n app = TestApp.new(LogErrors) do |env|\n raise 'Kaboom'\n end\n\n logger_output = StringIO.new\n without_error do\n app.get('/', 'rack.logger' => Logger.new(logger_ou... |
c657de4b70d266e9a3a784b999ea9e60 | Never trust parameters from the scary internet, only allow the white list through. | [
{
"docid": "611e734f8f11a3cf7dfdc4ed8a681219",
"score": "0.0",
"text": "def subsubcategorium_params\n params.require(:subsubcategorium).permit(:frequencia, :ativo, :subcategoria_id)\n end",
"title": ""
}
] | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.7495027",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "13a61145b00345517e33319a34f7d385",
"score": "0.69566035",
"text": "def strong_params\n params.require(:request).permit(param_whit... |
a2e0d5712398579d8437dee5cbad721a | The "slug" of the article that shows up in its URL. | [
{
"docid": "3957e611031507b86a7ac2a1aed8567c",
"score": "0.74626315",
"text": "def slug\n @_slug ||= data[\"slug\"]\n\n @_slug ||= if blog_options.sources.include?(\":title\")\n path_part(\"title\")\n elsif title\n title.parameterize\n else\n raise ... | [
{
"docid": "2896371282292bd191a71ed532ecc885",
"score": "0.7984458",
"text": "def slug\n @_slug ||= path_part(\"title\")\n end",
"title": ""
},
{
"docid": "3a3ae70aaa799512bc7a8898b6af0407",
"score": "0.7938603",
"text": "def slug\n @_slug ||= path_part(\"title\"... |
a0e97974d41bf6be95b8d0c7738574ab | true if it is whitelisted, an Integer, or a Float | [
{
"docid": "685060b88ff78618f44dbac89dcbe6d4",
"score": "0.7537517",
"text": "def valid?(value)\n whitelisted_value?(value) || value.is_a?(Integer) || value.is_a?(Float)\n end",
"title": ""
}
] | [
{
"docid": "03361bac3a04af8617708712a45dbfb3",
"score": "0.6942512",
"text": "def whitelisted_value?(value)\n WHITELIST.any? { |clazz| value.is_a?(clazz) }\n end",
"title": ""
},
{
"docid": "a8fe092610b5106c0d1543f2732c97d1",
"score": "0.6676384",
"text": "def allowed?(va... |
452fecd92cae8f811b2471c1dc78c254 | Create a new worktree for this branch at the given path location. | [
{
"docid": "d23203c32d4a9b40756335b8de00ea25",
"score": "0.7757673",
"text": "def new_worktree(path, opts = {})\n @base.new_worktree(path, full, opts)\n end",
"title": ""
}
] | [
{
"docid": "e7c800b6b40acae78c693bad44f3cb2c",
"score": "0.8337973",
"text": "def new_worktree(path, branch = nil, opts = {})\n self.lib.worktree_add(path, branch, opts) unless Dir.exists?(path)\n self.class.new({:working_directory => path})\n end",
"title": ""
},
{
"docid": "8a... |
0e92526de95d5efb2cf0fb9e700dc3c6 | Delete the instance from the database | [
{
"docid": "f41317159865cad956b6911b9a495dc5",
"score": "0.7563899",
"text": "def delete\n Database.delete @id, self.class.table_name\n end",
"title": ""
}
] | [
{
"docid": "087e9dd27bdcd5001b10eba7755e8dce",
"score": "0.8205462",
"text": "def delete\n self.class.database.delete self\n end",
"title": ""
},
{
"docid": "8d314cdfb099dc6c90afbbaf33f278f4",
"score": "0.80951273",
"text": "def destroy\n self.class.database.delet... |
a599c66e1c7230c3feeb169b1b4c278c | GET /daycares/1 GET /daycares/1.json | [
{
"docid": "a81945373733e4951b987de6ea99f9a1",
"score": "0.0",
"text": "def show\n end",
"title": ""
}
] | [
{
"docid": "916bae95a90d2eacaee2f52a3d4acc9b",
"score": "0.71646947",
"text": "def show\n render json: @dailycares\n end",
"title": ""
},
{
"docid": "d4f384162574fbcb4f4c5bdec7757986",
"score": "0.7109825",
"text": "def index\n @dailycares = Dailycare.all\n render json: @da... |
c2bcac70e158112eebe523071d1b6fd2 | all nonmine spaces are visible | [
{
"docid": "4a54b606c2d1e12ac919ab184f3be580",
"score": "0.6649537",
"text": "def victory?\n self.grid.flatten.select {|space| !space.mine }.\n all? {|space| space.visible }\n end",
"title": ""
}
] | [
{
"docid": "0070083828e3fa187fc52a2392aa1597",
"score": "0.65656203",
"text": "def all_occupied_spaces\n occupied_spaces('black') + occupied_spaces('white')\n end",
"title": ""
},
{
"docid": "7d0b2fbebf732c29321c412e05b9de56",
"score": "0.64989644",
"text": "def check_for_open_bo... |
4aa1145dc56b17c89f12fcd239c0b0c5 | Publish the draft NLU Domain Version. | [
{
"docid": "56c0dc87650ffb7205ab2855bc8aa3bd",
"score": "0.5423839",
"text": "def post_languageunderstanding_domain_version_publish_with_http_info(domain_id, domain_version_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: LanguageUnderstanding... | [
{
"docid": "8b6ee16f3cc9a0aac4e55555e3c3ea0c",
"score": "0.59028125",
"text": "def publish\n fail_with! 'Already published' if version.published?\n\n version.published_at = Time.zone.now\n version.active = true\n\n ActiveRecord::Base.transaction do\n save_or_die! version\n TosVersi... |
d9a06e1f555bbf19950d9ae22a53fe76 | GET /targeted_muscles GET /targeted_muscles.json | [
{
"docid": "3e81a44d1da49e4d70fb9af8cf87307a",
"score": "0.7734318",
"text": "def index\n @targeted_muscles = TargetedMuscle.all\n end",
"title": ""
}
] | [
{
"docid": "4f9c89504742eb7d4e85c43aee7c2f4b",
"score": "0.7441265",
"text": "def set_targeted_muscle\n @targeted_muscle = TargetedMuscle.find(params[:id])\n end",
"title": ""
},
{
"docid": "25617ccfd623d685a6d96f36793fef59",
"score": "0.726036",
"text": "def set_target_muscl... |
4065a0b7017cf300342f265c4c13dd40 | Returns the column they drop the token into | [
{
"docid": "0208ad12a87ddc71460ac9b9830be37a",
"score": "0.0",
"text": "def get_move_column\r\n move = (0..6).to_a.sample\r\n move\r\n end",
"title": ""
}
] | [
{
"docid": "aefca7f7175dd9ef966af2f9c2a48518",
"score": "0.73496026",
"text": "def token_drop column_index, token\n column = get_column(column_index)\n\n column.each do |cell|\n if cell.value == \" \"\n @board[cell.coordinate].set_value(token)\n ret... |
3d71a4c0389213f251e98726724cf3e0 | DELETE /players/1 DELETE /players/1.json | [
{
"docid": "278411a3f43ea7a6f84bab3a92066c5e",
"score": "0.74481",
"text": "def destroy\n @player.destroy\n respond_to do |format|\n format.html { redirect_to players_url }\n format.json { head :no_content }\n end\n end",
"title": ""
}
] | [
{
"docid": "221858579afa4f11746f587f4bfaf259",
"score": "0.77819896",
"text": "def delete\n\n thePlayer = Player.find(@player_id)\n render :json => thePlayer.destroy, :except => [:password_digest]\n\n end",
"title": ""
},
{
"docid": "d88b1d645b1bfaa512d198cd8c5e12a2",
"score": "0.... |
ae4fa4ab30874e18d9698454d9f3b906 | Returns a random token | [
{
"docid": "89b52412e34ab608eae513f90ca581fd",
"score": "0.0",
"text": "def new_token\n SecureRandom.urlsafe_base64\n end",
"title": ""
}
] | [
{
"docid": "e94c754e7cb05e18572d244168bd16f1",
"score": "0.8688152",
"text": "def random_token\n rand(36**11).to_s(36).upcase[0,6]\n end",
"title": ""
},
{
"docid": "abc2b2e068eb56448a592733b89781b8",
"score": "0.8532833",
"text": "def random_token\n rand(36**8).to_s(36)\n en... |
9f3c12d79eb129d443515d81c9f7fa46 | it returns hash (only the item that has the highest_standard_deviation) key => highest_standard_deviation, value = the instance of it | [
{
"docid": "9f9e1af09b78ece37237f8533b5d2235",
"score": "0.8971339",
"text": "def highest_standard_deviation\n highest_standard_deviation_hash = {}\n analytics_hash = self.get_std_all_items\n highest_standard_deviation = analytics_hash.keys.max\n highest_standard_deviation_instance = analyti... | [
{
"docid": "7982d46371ea9ea315ff65f1c7c8d4c7",
"score": "0.66108096",
"text": "def find_highest_value(hash)\n highest_value = hash.max_by {|driver, value| value}[0]\nend",
"title": ""
},
{
"docid": "17d84776c6246512f46855f068e9d7e2",
"score": "0.6401809",
"text": "def best_hash\n ... |
20b6b8047c5c729f9103ff19228de1eb | Saves block and figures out the current main chain. For those blocks that get connected to the main chain, extra transaction verification is performed. Vaguely similar to ActivateBestChainStep() in bitcoind. | [
{
"docid": "705507c2f5150c175810f076ec17c44c",
"score": "0.6260961",
"text": "def add_block(block, state)\n start_time = Time.now\n\n mainchain_tip_hash = @storage.mainchain_tip_hash\n thischain_tip_hash = block.prev_block_hex\n\n mainchain_tip = @storage.block_header_for_hash(mainch... | [
{
"docid": "7220c12b4ff517eceb8c58d538b4290c",
"score": "0.6777248",
"text": "def save_block_on_main_branch(block, height, prev_work = 0)\n @block_index.insert_block(block, height, prev_work)\n !!Toshi::Models::Block.create_from_block(block, height, Toshi::Models::Block::MAIN_BRANCH, @output_c... |
763b033d41133ed420071129d895c474 | Generate a authorization request url | [
{
"docid": "d9393093394d26c2e759a0c03d3e76b9",
"score": "0.6564917",
"text": "def get_authorize_url\n @request_token = @consumer.get_request_token\n return @request_token.authorize_url\n end",
"title": ""
}
] | [
{
"docid": "25494a477dea4ee0e50e28c80541e023",
"score": "0.8014142",
"text": "def authorization_url\n \"https://\" + auth_host + authorize_path + \"?\" + authorize_url_params\n end",
"title": ""
},
{
"docid": "84e2003627164368f181b9acc0ea96b1",
"score": "0.7729414",
"text... |
688dcc1e8dc321b0569e507a84d103bc | Returns the value of attribute bugsnag_user_id. source://bugsnag//lib/bugsnag/meta_data.rb4 | [
{
"docid": "b3236cafc6c084a77b314e7d8742b9a6",
"score": "0.7757908",
"text": "def bugsnag_user_id; end",
"title": ""
}
] | [
{
"docid": "9302c93f76eba9a19d9e3da189f70c56",
"score": "0.7262656",
"text": "def user_id()\n\t\t\treturn @user_data['user_id']\n\t\tend",
"title": ""
},
{
"docid": "1301a863940de7dd3e35e522e6a78d9f",
"score": "0.72044086",
"text": "def user_id\n data[:user_id]\n end",
"t... |
a2099a77c85e91272ae2f9e35b937953 | Only allow a trusted parameter "white list" through. | [
{
"docid": "472c5d0d56f82f2064401ccb984c1c1d",
"score": "0.0",
"text": "def defensive_back_stat_params\n params.require(:defensive_back_stat).permit(:position_name, :shorthand, :sport_id, :position_id, :sport_name, :event, :win, :loss, :wins, :losses, :tackles, :sacks, :fumbles, :interception, :sco... | [
{
"docid": "3663f9efd3f3bbf73f4830949ab0522b",
"score": "0.79428834",
"text": "def whitelisted_params\n super\n end",
"title": ""
},
{
"docid": "f6060519cb0c56a439976f0c978690db",
"score": "0.6957111",
"text": "def permitted_params\n params.permit!\n end",
"title"... |
c3b18403d8faa6898d77031636bd697b | Get a specific token | [
{
"docid": "e83bad629ecefadddfd6cc85a59c5584",
"score": "0.7012112",
"text": "def token(id, options = {})\n objectify get(\"/token/#{id}\", options)['token']\n end",
"title": ""
}
] | [
{
"docid": "cd40cacb5445164819aafb95f0743bf3",
"score": "0.84879774",
"text": "def get_token\n token\n end",
"title": ""
},
{
"docid": "baca167289dda1324ca0bf835f00e13c",
"score": "0.807553",
"text": "def get_token\n return @token\n end",
"title": ""
},
{
"d... |
4cef4412cc2badbc81a659490d0720c8 | Get all settings, sorted by key, as ConfigSetting objects. | [
{
"docid": "5577cd82358203d188e870c2697162b0",
"score": "0.83033025",
"text": "def all_settings\n @settings.values.sort_by(&:key)\n end",
"title": ""
}
] | [
{
"docid": "0cec64804434e99630af27cb2d3678a6",
"score": "0.6496622",
"text": "def get_all_keys\n settings, _ = _get_settings()\n if settings === nil\n @log.error(1000, \"Config JSON is not present. Returning empty list.\")\n return []\n end\n return settings.keys\n e... |
d6956ba276d8ec02a7133a99252769b8 | multiplies each element by a scalar | [
{
"docid": "6c5c9e20890a77d5b0a186bf771cd75a",
"score": "0.7376853",
"text": "def scalar_multiply!(to_multiply)\n collect! { |e| e * to_multiply }\n end",
"title": ""
}
] | [
{
"docid": "62c4a25c827b7875639fd9350b92e7ad",
"score": "0.7939319",
"text": "def scalar_multiple!(array, multiplier)\n array.map! { |ele| ele * multiplier }\nend",
"title": ""
},
{
"docid": "c75307357c2d0ab7a8524ca93ec24870",
"score": "0.790554",
"text": "def multiply valArray\n ... |
6d2967265a2b06d6266b75525781c932 | functonality can be called on a model object and it will update the title in real time | [
{
"docid": "cec04a0eed7140c6a5f58213b885ec88",
"score": "0.0",
"text": "def update_title!\n title = Nokogiri::HTML.parse(open(full_url)).title\n self.update(title: title)\n end",
"title": ""
}
] | [
{
"docid": "bbced04eca409b5b944c5a33141471f8",
"score": "0.7822056",
"text": "def update_title(new_title)\n \t@title = new_title\n end",
"title": ""
},
{
"docid": "24d92ff32ed82cee2dfbddb4a66e59b6",
"score": "0.7759977",
"text": "def update_title!\n self[:title] = reload.tit... |