query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
ef9bba09d6bdb9024614a8044a70fcda
Returns true if this Segment has no points.
[ { "docid": "0925d6cea521ac4bece98987c6c3988b", "score": "0.7930666", "text": "def empty?\n (points.nil? || points.empty?)\n end", "title": "" } ]
[ { "docid": "095e92b02c24ae1712df087dc9bd463b", "score": "0.80537385", "text": "def empty?\n !points\n end", "title": "" }, { "docid": "25efb4b2cca72f63863e0c81c8b16a3c", "score": "0.7938324", "text": "def empty?\n (points.nil? or (points.size == 0))\n end", "t...
5c791781282c8fa51edd50901b07b446
Is called when an object in the cache is expired. Iterates through the defined finalization methods, if any.
[ { "docid": "e5a7c5ceb0cfd129ca494658d2d1c78c", "score": "0.6203112", "text": "def do_finalization(key,obj)\n\t\t\t\t\tbegin\n\t\t\t\t\t\t@finalizers.each do |f|\n\t\t\t\t\t\t\tf[0].call(key,obj,*f[1])\n\t\t\t\t\t\tend\n\t\t\t\t\trescue Exception => e\n\t\t\t\t\t\tputs e, e.backtrace\n\t\t\t\t\t\traise e...
[ { "docid": "a55d53b4fc810c24ff722339c3947d98", "score": "0.6930898", "text": "def expire_cache; end", "title": "" }, { "docid": "a55d53b4fc810c24ff722339c3947d98", "score": "0.6930898", "text": "def expire_cache; end", "title": "" }, { "docid": "8bcd1970f6b7107678d3d94a07...
fd059556bde4c24da0b515853fdced1e
Builds a Snapshot to be persisted. Returns the Snapshot.
[ { "docid": "fa4ea4a852bcaac12a556b5a35f43c0a", "score": "0.0", "text": "def snapshot\n MetricSnapshot.new(name, evaluate)\n end", "title": "" } ]
[ { "docid": "32b5604abf6b3738dda5eeb433ce3ec7", "score": "0.67063963", "text": "def snapshot\n Snapshot.new(self.to_hash)\n end", "title": "" }, { "docid": "3fce7ae7d150e81f54c60eec79ee2cd2", "score": "0.66351116", "text": "def build_snapshot(options = {})\n observation_sourc...
dffd2325b62f8a26fe711531c21214c8
GET /surveychoices/1 GET /surveychoices/1.xml
[ { "docid": "0125081dd366d4b86169b12e25775968", "score": "0.69038624", "text": "def show\n @surveychoice = Surveychoice.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @surveychoice }\n end\n end", "title": "" } ]
[ { "docid": "82b362544b4c3970c16c7d56f38810fe", "score": "0.67112255", "text": "def choices\n\n @question = SurveyQuestion.find(params[:id])\n @options = SurveyQuestionOption.where(survey_question_id: params[:id]) rescue nil\n end", "title": "" }, { "docid": "82b362544b4c3970c16c7d56f3...
53b2e4e43637c60ca5169a3fa72da47b
GET /vehicle_cards/1 GET /vehicle_cards/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "846266430ccc873a1229727d420bd503", "score": "0.7459726", "text": "def cards\n @celebrity = Celebrity.find(params[:id])\n @cards = @celebrity.cards\n render json: @cards\n end", "title": "" }, { "docid": "e6520d8ed0ada8afb6a0e72ab5daf7e7", "score": "0.6969144", "...
27daa62aab72de56bec0a5c19e9f0c67
Esto es una validacion para los nuevos formularios
[ { "docid": "739f43b8d801f0091de44b6c284723a0", "score": "0.0", "text": "def capacidad_combustible_f=(valor)\n self.capacidad_combustible = format_valor(valor)\n end", "title": "" } ]
[ { "docid": "5bb56804d2ec003acd895a8bbf25ba07", "score": "0.6859495", "text": "def valida_titulo\n errors.add_to_base 'avisotitulo' if tituloes.blank? and titulofr.blank? \nend", "title": "" }, { "docid": "a844ca41de8648ab03d0d5c23f588ce4", "score": "0.66279227", "text": "def submit_...
bfeabd25b476c01dfe47e960e31b7b25
Loads config data from the specified file.
[ { "docid": "3d76b81e3954a4aba1360342122ac280", "score": "0.0", "text": "def initialize(fname, o={})\n \n # ensure the keys in the options hash are symbols\n o.keys.each{|k| o[k.to_sym] = o.delete(k)}\n \n do_parse = o.has_key?(:do_parse) && o[:do_parse]===false ?\n false : true\n ...
[ { "docid": "325d48126428b9da9abcd58a1ece1930", "score": "0.81685835", "text": "def load_config(file)\n file = File.expand_path(file)\n open(file, \"r\") { |f| f.read } if File.exists?(file)\n end", "title": "" }, { "docid": "3a6b6dbbf518c6263e0bf7e8c43ab171", "score": "0.7993283",...
a81f31b54a91b0d77c886de2f7d73d7e
Returns an inspectlike string for the value of the attribute +attr_name+. String attributes are truncated up to 50 characters. Other attributes return the value of inspect without modification. person = Person.create!(name: 'David Heinemeier Hansson ' 3) person.attribute_for_inspect(:name) => "\"David Heinemeier Hansso...
[ { "docid": "59c7e92cf41138e908c3a04fb6be45b7", "score": "0.77852494", "text": "def attribute_for_inspect(attr_name); end", "title": "" } ]
[ { "docid": "29e4df4269b207390b442244d3a10a38", "score": "0.8272611", "text": "def attribute_for_inspect(attr_name)\n value = read_attribute(attr_name)\n\n if value.is_a?(String) && value.length > 50\n \"#{value[0, 50]}...\".inspect\n elsif value.is_a?(Date) || value.is_a?(Time)\n ...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "297f5a8d23b85a92e3cbcf66bbef1886", "score": "0.0", "text": "def tour_set_admin_params\n params.fetch(:tour_set_admin, {})\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"...
68ed6c82b952dbb51943ef6e51f2c5e6
POST /team_goals POST /team_goals.json
[ { "docid": "e611f93e289c12fb793b2b22e49a78a7", "score": "0.7294601", "text": "def create\n @team_goal = TeamGoal.new(team_goal_params)\n\n respond_to do |format|\n if @team_goal.save\n format.html { redirect_to @team_goal, notice: 'Team goal was successfully created.' }\n format...
[ { "docid": "509107298fad661a8b3789eeec343f58", "score": "0.7140327", "text": "def create\n @goal = Goal.new(goal_params)\n current_user.goals << @goal\n\n if @goal.save\n render json: @goal, status: :created\n else\n render json: @goal.errors, status: :unprocessable_entity\n end...
4213e2169aaea2d15f2bf96af8382d64
TODO: This is horrible, fix this
[ { "docid": "ce48dfeb3fefc4f0ccbdb1176623a6fe", "score": "0.0", "text": "def translate(tokens)\n result = \"\"\n tokens.each{ |token| \n if token.match?(/[a-zA-Z]/)\n result += RomanNumeral.new(token).asInt().to_s\n else \n result += token\n end\n }\n result\n en...
[ { "docid": "ef1e4c0cc26e4eec8642a7d74e09c9d1", "score": "0.7331411", "text": "def private; end", "title": "" }, { "docid": "0b8b7b9666e4ed32bfd448198778e4e9", "score": "0.6649349", "text": "def probers; end", "title": "" }, { "docid": "65ffca17e416f77c52ce148aeafbd826", ...
9e7cfae34cbd9587071ac244e6b3fbeb
Remembers a user in the database for use in persistent sessions.
[ { "docid": "2b9c1f664948755a7d3dc4c1ecb1c018", "score": "0.0", "text": "def remember #this is also called a user.remember method\n self.remember_token = User.new_token #save the generated token into a class variable called remember_token, accessible in the whole User class with attr_accessor\n upd...
[ { "docid": "d4904389d6c1f1f0af71a818c6589cbb", "score": "0.68847036", "text": "def reset_user\n return unless exists?(:previous_user)\n set :user, fetch(:previous_user)\n unset :previous_user\n clear_sessions\n end", "title": "" }, { "docid": "a692135dd9551e5...
674851744ed002351d99a58922ba76d0
Just write message to stdout.
[ { "docid": "b4906463e0c2e207069de0b6a6ec62b7", "score": "0.0", "text": "def show(msg)\n puts msg\n false\n end", "title": "" } ]
[ { "docid": "b14b2788134682c0a7daabbf80b18043", "score": "0.83689773", "text": "def msg(message)\n stdout.puts message\n end", "title": "" }, { "docid": "ba692b36f9ce6e9e6012797cd9ba7c75", "score": "0.82279384", "text": "def message(msg)\n STDOUT.puts msg\n end", "...
627908cd00f446ecfc8ed4d961a717fd
TODO refactor TODO error handling?
[ { "docid": "4bd31b07a56a951be87170b93f020541", "score": "0.0", "text": "def add_match!(match)\n self.matches << match\n self.player_ratings.create(\n :is_professional => self.is_professional,\n :k_factor => self.k_factor,\n :rating => match.create_rating_for_player(s...
[ { "docid": "6d967e0574a93ad1a7a438ecf62b646c", "score": "0.68540394", "text": "def ex; end", "title": "" }, { "docid": "6d967e0574a93ad1a7a438ecf62b646c", "score": "0.68540394", "text": "def ex; end", "title": "" }, { "docid": "0aa0db9270c5a88c81da713a1ee0e8f8", "scor...
f6ea142b89e8de048e28225faaf54a6b
2.1.11 Implement a method that returns an array of the shell sort increment sequence. Note: Use the decreasing values for (3k 1)/2, starting at the largest increment less than n/3, decreasing to 1 The method will receive a value n, and be expected to return an array with the decrement sequence for such n Assumptions: n...
[ { "docid": "49c406b8026f9a99aa96907563e60de1", "score": "0.0", "text": "def test_e2111_shell_sort_increment\n verify_method :e2111_shell_sort_increment,\n :with => [\n {\n param: 3,\n predicate...
[ { "docid": "5e81305775b6fb736a67ff76423cff0b", "score": "0.73149186", "text": "def shell_sort(a)\n n=a.length\n h=1\n \n while (h<n/3) #for computing increment factor \"h\"\n h= (3*h)+1\n end\n \n while h>=1\n # Logic of insertion sort with inrement steps of \"h\"\n ...
3cd167eae6a69ba9b11438ff7ba777a1
Add stored SQL fragment to column creation SQL.
[ { "docid": "058fa392489cdf01dd3dbecdfbeed18e", "score": "0.72763073", "text": "def generated_column_definition_stored_sql(sql, column)\n sql << STORED if column[:stored]\n end", "title": "" } ]
[ { "docid": "eae15f5de187e43ca97d2200d4ab26c2", "score": "0.7222031", "text": "def create_column_sql column, table = table_name\n full_table_create_sql = create_table_sql(table)\n parts = full_table_create_sql.split(\"\\n\")\n create_table = parts.shift # take off the first CREATE TABLE pa...
c9d34eb1fe4604239c43a7a78bebf6f0
for the data page
[ { "docid": "2c2d2d8119759ab09119633564abddb9", "score": "0.0", "text": "def total_application_count\n self.applications.count\n end", "title": "" } ]
[ { "docid": "8d82f8543da3d7247a7662d8e15c4f4e", "score": "0.75965124", "text": "def data\n {:page => find_page}\n end", "title": "" }, { "docid": "259011ca4e008e99e8119457ec69ec1c", "score": "0.7010573", "text": "def index\n\t\t# @data_pages = DataPage.all\n\t\t@data_p...
e2c8b6817880424b53cd9627c8cee490
2.5.10 Bes The Bes structure specifies either a Boolean (section 2.5.14) value or an error value.
[ { "docid": "b823f9e394709870fd01118d3c248c65", "score": "0.6966245", "text": "def bes(data)\n b_bool_err, f_error = data.unpack('CC')\n\n b_bool_err_d = case f_error\n when 0\n {\n 0x00 => :False,\n 0x01 => :True\n }\n\n when 1\n {\n 0x00 => :'#NULL!',\n ...
[ { "docid": "2804e4856a212b93d85eb3c65edc2ac2", "score": "0.6011077", "text": "def boolean\n Util.from_bytes :boolean, value\n end", "title": "" }, { "docid": "05829bb8ac9a43fb6a4f0dea0f8748a3", "score": "0.57466006", "text": "def to_b(value)\n [0,false,nil].include?(value) ? f...
f65b8d8939e69dc8ea27572190b3d9af
POST /contact_infos POST /contact_infos.json
[ { "docid": "02f5a955bc95f04cd997e2ab3d2b51d5", "score": "0.0", "text": "def create\n @ConctactInfo = ConctactInfo.new(ConctactInfo_params)\n\n respond_to do |format|\n if @ConctactInfo.save\n format.html { redirect_to @ConctactInfo, notice: 'ConctactInfo was successfully created.' }\n ...
[ { "docid": "18e1b7f0c90451b2ba8379aca84bc00e", "score": "0.756049", "text": "def create\n @contactinfo = Contactinfo.new(params[:contactinfo])\n\n respond_to do |format|\n if @contactinfo.save\n format.html { redirect_to @contactinfo, notice: 'Contactinfo was successfully created.' }\n...
23d87ae8e8d5dadd221f34a083581062
Simple trip list react app
[ { "docid": "75cbee6aef5b146ac9cb5a1fec01024d", "score": "0.0", "text": "def index; end", "title": "" } ]
[ { "docid": "5f1d9c963df86600e394f8af1c6801bc", "score": "0.6396025", "text": "def index\n @trips = current_user.trips\n render :layout => \"trip_index\"\n end", "title": "" }, { "docid": "b754b1a6557a8ec773ca0286e1ed608d", "score": "0.6390153", "text": "def index\n @trip = ...
8b78192c44612979bd165e401adcf70c
Returns the value of attribute name. source://activerecord//lib/arel/nodes/window.rb69
[ { "docid": "6e1ada2a1ca2235d1d4411d51623a583", "score": "0.0", "text": "def name; end", "title": "" } ]
[ { "docid": "318735ad3f36f97aba5ee1fd7f270a5e", "score": "0.6922024", "text": "def name\n @attrib[:name]\n end", "title": "" }, { "docid": "d0d3658a5bdc9669e942d86266f65966", "score": "0.67296666", "text": "def name\n @attrs[:name]\n end", "title": "" }, { ...
e6f17f26b43b47b3c6a6af37ed47947d
POST /notes POST /notes.json
[ { "docid": "1a4a76ca8aadeecf68c909e3f34064b8", "score": "0.68206424", "text": "def create\n @note = current_user.notes.new(params[:note])\n @note.note = view_context.markdown(@note.note).gsub(\"\\n\",\"\").gsub(\"\\r\",\"\")\n @note.save\n $statsd.increment 'animal.note.created'\n respond...
[ { "docid": "24d2ec872aba018945dc8187176a72e5", "score": "0.7317462", "text": "def create\n @note = @current_user.notes.create(note_params)\n render json: @note\n end", "title": "" }, { "docid": "25c896c0e39c96c6b19d1f9fb484bb7c", "score": "0.7093732", "text": "def create\n ...
f27495501f89eb2f7906cab22bf8e4d0
method return basic headers
[ { "docid": "38e4f2810406b433cd3edb3f4b69bc55", "score": "0.0", "text": "def headers\n RallyAPI::CustomHttpHeader.new({:vendor => 'Vendor', :name => 'Custom Name', :version => '1.0'})\n end", "title": "" } ]
[ { "docid": "e2503c153f60da7fa57986cd91d5fb67", "score": "0.84846556", "text": "def headers()\n end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d72e", "score": "0.8359773", "text": "def headers; end", "title": "" }, { "docid": "56c1686a79124e9a9952f26250c0d...
eb72f4e25040e3a7175296efa2b4f9c9
Takes in a full sentence and returns the sorted words.
[ { "docid": "5b6fb2fc80412c6d80c64bc1add1ee50", "score": "0.6257252", "text": "def sort_sentence(sentence)\n words = break_words(sentence)\n return sort_words(words)\ned\n\n# Prints the first and last words of the sentence.\ndef print_first_and_last(sentence\n words = break_words(sentence)\n print_first_...
[ { "docid": "525bd7021263d2db1e6dd356ac02745c", "score": "0.81174713", "text": "def sort_sentence(sentence)\n words = break_words(sentence)\n return sort_words(words)\nend", "title": "" }, { "docid": "07563554152842c494fd9c3d53083a30", "score": "0.80459726", "text": "def sort_se...
bf0d87031f2168fce19e16109ba5b6e1
this action runs before any other action
[ { "docid": "9b522559718b9320f33d9147794fc2d1", "score": "0.0", "text": "def set_current_user ##rails looks for index.html.erb file inside views in about folder \n if(session[:user_id])\n #@user=User.find(session[:user_id]) #find is used when we are sure we will find this is\n ...
[ { "docid": "bb445e7cc46faa4197184b08218d1c6d", "score": "0.8063932", "text": "def pre_action\n # Override this if necessary.\n end", "title": "" }, { "docid": "a3e77c4b438be75fccee1cd2e7cdae87", "score": "0.776082", "text": "def before_run() end", "title": "" }, {...
25056a5e541a5550412c91a6767f6f6c
POST /foster_parents POST /foster_parents.json
[ { "docid": "8dab8540b79bdb4f245397a20bf254c4", "score": "0.6535701", "text": "def create\n @bob = \"yay\"\n @foster_parent = FosterParent.new(foster_parent_params)\n @why = \"nay\"\n respond_to do |format|\n if @foster_parent.save\n format.html { redirect_to @foster_parent, notic...
[ { "docid": "cf2284e1b8a1e4c144bcfa1b80f70df7", "score": "0.6879073", "text": "def create\n @parent = current_user.parents.build(parent_params)\n\n respond_to do |format|\n if @parent.save\n format.html { redirect_to @parent, notice: 'Parent was successfully created.' }\n format....
bff98c8ab6c828742e8d0ce0ffff0bcd
Write out the PDF Cross Reference Table, as per spec 3.4.3
[ { "docid": "72bee41d29d5a55529274c8308345f5c", "score": "0.6272704", "text": "def render_xref(output)\n @xref_offset = output.size\n output << \"xref\\n\"\n output << \"0 #{@store.size + 1}\\n\"\n output << \"0000000000 65535 f \\n\"\n @store.each do |ref|\n output.printf...
[ { "docid": "804e1bcd3d915b0278bdb3ca49649234", "score": "0.61508447", "text": "def generate_table_of_contents(file_names, address)\n \n table_of_contents = Prawn::Document.new do\n contents_hash = { 0 => \"Contract for #{address}\" }\n\n file_names.each_with_index do |val,index|\n # store l...
d262142ad2863e2f5103518fbc575109
GET /nodes GET /nodes.xml
[ { "docid": "4cfa2e42af16e7823fae1efbd19325d0", "score": "0.57335305", "text": "def index\n @sum = 0\n session[:node] = params[:name]\n if params.has_key?(:role)\n result = NodeObject.all #this is not efficient, please update w/ a search!\n @nodes = result.find_all { |node| node.role? ...
[ { "docid": "a4a5705411dbebcdb2c3f903421d5284", "score": "0.7313184", "text": "def index\n @nodes = Node.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @nodes }\n end\n end", "title": "" }, { "docid": "a4a5705411dbebcdb2c3f9034...
ed922894f1a726b5a916c7ff421e538b
Allow equivalent objects to be considered equal
[ { "docid": "2f697c01056e5bc44aa9e91eb4ef7484", "score": "0.0", "text": "def ==(other)\n for field in [:group, :type, :value, :internal]\n return false unless self.send(field) == other.send(field)\n end\n return true\n end", "title": "" } ]
[ { "docid": "6ab9f46e2ac46433d40d73181fb613a1", "score": "0.7527014", "text": "def eql?(obj); self.eql_count += 1; super; end", "title": "" }, { "docid": "f481db1fc0c48636f25e9d3787aa5d61", "score": "0.7253118", "text": "def eq(other); end", "title": "" }, { "docid": "57db...
ea2c304b5a4373938950eb76cd85683a
declaring rewrite rules. first argument should be a regex and a proc should be provided. the regex(actual rule) will be compared against Request URI, i.e. current URL without query string. if some rule depend on query string, use `params` inside proc to determine either some param was or not set. the proc will decide h...
[ { "docid": "4edd7c7255f9a1e8e96ef0030852a1f7", "score": "0.6902464", "text": "def rewrite rule, &proc\n rewrite_rules << [rule, proc] if proc\n end", "title": "" } ]
[ { "docid": "43981f11766f62a56ece4371891b8e3e", "score": "0.71329147", "text": "def rewrite &proc\n\n return unless proc\n\n @rewriter = Class.new do\n\n attr_reader :http, :matched_rule\n\n define_method :initialize do |env|\n @http = ::Rack::Request.new env\n s...
e4d05b797f5fa46cd5d114fcd9c8adb2
def sort params[:items].each_with_index do |id, index| Item.update.all(["order = ?", index+1], ['id = ?', id]) end render :nothing=> true end PATCH/PUT /items/1 PATCH/PUT /items/1.json
[ { "docid": "e83a9e590bc540618cf3a61da9dc3f0b", "score": "0.0", "text": "def update\n respond_to do |format|\n if @item.update(item_params)\n format.html { redirect_to @item, notice: 'Item was successfully updated.' }\n format.json { render :show, status: :ok, location: @item }\n ...
[ { "docid": "ae4fddbe3efbff13cee41cdd3b293386", "score": "0.8962378", "text": "def sort\n params[:item].each_with_index do |id, index|\n Item.where(id: id).update_all({position: index+1})\n end\n render nothing: true\n end", "title": "" }, { "docid": "a7cf3cee8151b448dac67dfc97cd...
ecf6ba93f53609407242cf4e008ed2cf
Provide a user friendly representation source://twilioruby//lib/twilioruby/rest/notify/v1/service/notification.rb158
[ { "docid": "84c2aa104b8a70acbe3f11eca76559b3", "score": "0.0", "text": "def to_s; end", "title": "" } ]
[ { "docid": "43060d8e5a506f4366f7a93ab0eecad3", "score": "0.7277871", "text": "def inspect\n \"<Twilio.Notify.V1.NotificationInstance>\"\n end", "title": "" }, { "docid": "60885c9507d0790e88a03e0a34688dad", "score": "0.7228065", "text": "def i...
735997cd9e41145880abc21d97c6aad0
Validates the size of and Uploaded image
[ { "docid": "a4de515c78e3a0438db2a68077497fb7", "score": "0.70202273", "text": "def picture_size\n if picture.size > 5.megabytes\n errors.add(:picture, \"Image file size should be less than 5MB\")\n end\n end", "title": "" } ]
[ { "docid": "f8f555c217d19ab739f3f902f11febe0", "score": "0.794243", "text": "def image_validation\n if image.attached?\n if !image.blob.content_type.in?(%w(image/jpeg image/jpg image/png))\n image.purge_later\n errors.add(:image, 'The image wrong format')\n elsif image.blob.co...
5109719e16691b2cd29389a281ee9907
speed of spread is tiered based off of population density, and it returns a speed increment in inverse relationship to population density
[ { "docid": "262a7b4f0a1b312809f454653506f804", "score": "0.0", "text": "def speed_of_spread(population_density, state) #in months\r\n # We are still perfecting our formula here. The speed is also affected\r\n # by additional factors we haven't added into this functionality.\r\n speed = 0.0\r\n\...
[ { "docid": "f9c7dde2b283939bc48ea4f612c3c615", "score": "0.8374192", "text": "def speed_of_spread\n # We are still perfecting our formula here. The speed is also affected\n # by additional factors we haven't added into this functionality.\n @speed = 0.0\n\n if @population_density >= 200\n ...
a6997d567a148e270c6a1706db999677
def Method: start Starts the members of the cluster. This method does not return until the cluster has been stopped by an `INT` or `TERM` signal.
[ { "docid": "6bd8e35fb99117bd36cf7bcb4ce3fbee", "score": "0.8250058", "text": "def start\n @should_keep_members_alive = true\n log_message \"Starting #{@size} subprocesses...\"\n @size.times { |i| start_cluster_member_on_port(@base_port + i + 1) }\n log_message \"Cluster started.\"\n ...
[ { "docid": "ceb430aff48498061f540df7608a8670", "score": "0.71071935", "text": "def start_and_wait!\n # register handler before starting cluster\n register_shutdown_handler\n # start the cluster\n start\n # Wait for all child processes to end then return\n Proces...
38a562e17859d8432aeb7b3d32b0c363
process request to reset password
[ { "docid": "b201b78b242b880875d3abea62d1d1af", "score": "0.0", "text": "def update\n @user.validate_password = true\n if @user.update_attributes params[:user]\n flash[:notice] = \"Your password has been reset\"\n redirect_to dashboard_path\n else\n render :action => \"edit\"\n ...
[ { "docid": "4bf82e61c7d514146678ce22b13153e9", "score": "0.7838469", "text": "def request_password_reset\n end", "title": "" }, { "docid": "95feeb9318385de35d3625eb73c70edf", "score": "0.77942467", "text": "def request_reset_password\n end", "title": "" }, { "docid": "1...
d53288ef220aa5b797edf42416f7c39e
Replace string in Word DOCX document, return result Replace all instances of a string in an Office Word Document (docx)
[ { "docid": "149fbdf7c4f743788a9fe9e5c2fbbd21", "score": "0.7013043", "text": "def transform_document_docx_replace_with_http_info(match_string, replace_string, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransformDocumentApi.transform_document_...
[ { "docid": "40f8646c37c5075aa68237e55956b9d5", "score": "0.7754795", "text": "def transform_document_docx_replace(match_string, replace_string, opts = {})\n data, _status_code, _headers = transform_document_docx_replace_with_http_info(match_string, replace_string, opts)\n data\n end", "...
b6de4830db1533efe76c921fc8f98c98
call your method here!
[ { "docid": "dfb1876cb390e34d65f9325a6f12141c", "score": "0.0", "text": "def hello_t(array)\n if block_given?\n i = 0\n \n while i < array.length\n yield(array[i])\n i = i + 1\n end\n \n array\n else\n puts \"Hey! No block was given!\"\n end\nend", "title": "" } ]
[ { "docid": "6199333fb432af38c8abaadcbc60a77e", "score": "0.7614652", "text": "def call\n\n\tend", "title": "" }, { "docid": "6199333fb432af38c8abaadcbc60a77e", "score": "0.7614652", "text": "def call\n\n\tend", "title": "" }, { "docid": "3923598cefdb39ff94e39293456a9cf0",...
7c871672751fe689395d7dedac8765cc
TODO: Show milestone, number of comments, pull request attached.
[ { "docid": "ee72ea1152b2b8457df566861ed3d19c", "score": "0.5570141", "text": "def format_issue i, width = columns\n return unless i['created_at']\n ERB.new(<<EOF).result binding\n<% p = i['pull_request']['html_url'] if i.key?('pull_request') %>\\\n<%= bright { no_color { indent '%s%s: %s' % [p...
[ { "docid": "3ea3404be426b2691d400af686369567", "score": "0.63751584", "text": "def describe_issue;\n puts @issue\n end", "title": "" }, { "docid": "43da793dec4d4b2491d5280cadcd22f6", "score": "0.62371194", "text": "def info_html(project)\n %Q{\n <b>Tasks:</b> #{project.is...
e13bc9741d9535c8134a133fe9a57e86
this function find Post by its ID
[ { "docid": "b8c906e82b52a8e4579b3d5f905561c6", "score": "0.75656736", "text": "def find_post\n\t\t@post = Post.friendly.find(params[:id])\n\tend", "title": "" } ]
[ { "docid": "d87cdff96cf54de26a704270ab6839f8", "score": "0.8385919", "text": "def post(id:)\n Post.find(id)\n end", "title": "" }, { "docid": "d87cdff96cf54de26a704270ab6839f8", "score": "0.8385919", "text": "def post(id:)\n Post.find(id)\n end", "title": "" }, { ...
a28e478681ac9d29c5dd796aa824781d
PATCH/PUT /users/1 PATCH/PUT /users/1.json
[ { "docid": "e9ec81882fa5fd68a1daa6c2577cec3f", "score": "0.0", "text": "def update\n \n if user_params[:password].blank? && user_params[:password_confirmation].blank?\n user_params.delete(:password)\n user_params.delete(:password_confirmation)\n end\n \n successfully_updated = ...
[ { "docid": "f0686f191a0def3b6c3ad6edfbcf2f03", "score": "0.7243734", "text": "def update_user(email)\n url = Addressable::URI.new(\n scheme: 'http',\n host: 'localhost',\n port: 3000,\n path: '/users/2.json'\n ).to_s\n\n puts RestClient.patch(\n url,\n { user: { email: email } }\n ...
2c016aa8be98d74b61aae231b06b7ffd
A before action for create CRUD functions: checks that all the necessary members of the model are indeed in the parameters
[ { "docid": "501cd455143dc0281b4ac0cbb2d4bb50", "score": "0.7268083", "text": "def check_create_params\n check_params(*(model.properties.find_all { |p| model.updatable?(p.name) && p.required? }.map(&:name)))\n end", "title": "" } ]
[ { "docid": "9764eb82dbd318f5919f2d9be6866088", "score": "0.68105656", "text": "def before_create() end", "title": "" }, { "docid": "9764eb82dbd318f5919f2d9be6866088", "score": "0.68105656", "text": "def before_create() end", "title": "" }, { "docid": "f5529352e96278799331...
5b08fc208ab715a80bd7c5d1d580d400
GET /rota/1 GET /rota/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "04b19a22535722976a4d4e7252f9a622", "score": "0.7534798", "text": "def show\n @rota = Rota.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rota }\n end\n end", "title": "" }, { "docid": "0fa6caac15cf10a21...
6e7c404e6736b5763229a46e97d9a7ac
DELETE /auto_ids/1 DELETE /auto_ids/1.xml
[ { "docid": "8f32e9b2254c1952d96ff620c9717c20", "score": "0.75930494", "text": "def destroy\n @auto_id = AutoId.find(params[:id])\n @auto_id.destroy\n\n respond_to do |format|\n format.html { redirect_to(auto_ids_url) }\n format.xml { head :ok }\n end\n end", "title": "" } ]
[ { "docid": "b35aabc9e4efa90130485266684ca670", "score": "0.67834556", "text": "def delete_by_id(ids)\n ids = [ids] unless ids.is_a?(Array)\n xml.delete do |xml|\n ids.each do |id|\n xml.id(id)\n end\n end\n end", "title": "" }, { "docid": "155853a1a67...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "a6ba8feb400559bc9ebf8b1a54410215", "score": "0.0", "text": "def set_pol_post\n @pol_post = PolPost.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;...
485ca99d9b0e0555346a2b50d128adf8
input = "2 3 0 3 10 11 12 1 1 0 1 99 2 1 1 2".split(" ").map(&:to_i) Part 1
[ { "docid": "749f8b6cc881a2ce0442e18de1c23814", "score": "0.0", "text": "def nav(list)\n childCount = list.shift\n metaCount = list.shift\n # p [childCount, metaCount]\n\n sum = 0\n childCount.times { |i| sum += nav(list) }\n metaCount.times { |i| sum += list.shift }\n sum\nend", "title": "" ...
[ { "docid": "f570e82e26c740192a18edbd026d1813", "score": "0.68926257", "text": "def part1(input)\n input.map{ |line| line.to_i/3-2 }.inject(:+)\nend", "title": "" }, { "docid": "537891b880848a8f972781ece5050924", "score": "0.6744658", "text": "def part2(input)\n sum = 0\n inp...
26277c3f16e571a0196c3a6cc9538219
completed?: Returns true if grid g does not contain any nil values, otherwise false.
[ { "docid": "f5f526ca108c3f9c41eddce893f107f7", "score": "0.84915066", "text": "def completed?\n g.flatten.select(&:nil?).empty?\n end", "title": "" } ]
[ { "docid": "0e8e8f80df95c760ee175e290793c372", "score": "0.7705439", "text": "def completed?\n return true if all_cells_used?\n\n !winner.nil?\n end", "title": "" }, { "docid": "1454d0f963f683345d8aa3b07a5b4af3", "score": "0.7605634", "text": "def has_game_finished\n if @gr...
43da221c636c6929051e38424e54bb87
Method returns standart hash
[ { "docid": "4e9f22ea7760833456f536e6dc41dd8a", "score": "0.0", "text": "def test_get_worst_hash\n html = Nokogiri::HTML('<!DOCTYPE html><html><head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=UTF-8\"><title>ahoj</title></head><body><div class=\"test\">ahoj <a href=\"pokus\">textik<...
[ { "docid": "b78a8c3fbbda0dc6b3ed59f810316f24", "score": "0.8141087", "text": "def hash(*) end", "title": "" }, { "docid": "8f97e73317cd71f4efbc229f285343ba", "score": "0.7869348", "text": "def hash_function\n @hash_function ||= 'sha256'\n end", "title": "" }...
ee7273ee7268d17c7704d4e7c8b73ffb
Specify associated resources (nested resources) === Example +belongs_to+ :lottery +belongs_to+ :table, :card_game +belongs_to+ :card_game, :as => :bridge
[ { "docid": "f48b62f295674fd4652a2aac9c972296", "score": "0.58793175", "text": "def belongs_to(*resources)\n raise ArgumentError, \"You must specify at least one resource after belongs_to\" unless resources\n logger.debug \"#{@model} belongs_to #{resources.inspect}\"\n options = reso...
[ { "docid": "f4190a5dd7bec4ebd5f1d3aaf9143332", "score": "0.5751354", "text": "def belongs_to_resource(resource_name, class_name: nil, foreign_key: nil, polymorphic: false)\n return if find_resource(resource_name).present?\n\n resource_associations << BelongsToResource.new(\n name: resou...
48077f11b66bc49859891af6e9cd5e93
converts a path to unc_path if it contains a drive letter. Uses the server name provided
[ { "docid": "d329b270ca9e784940284671cac09c92", "score": "0.7563511", "text": "def to_unc_path(path, server_name)\n return nil if path.nil? || path.empty? || server_name.nil? || server_name.empty?\n path.gsub(/(\\p{L})+(:\\\\)/i) { \"\\\\\\\\#{server_name}\\\\#{Regexp.last_match(1)}$\\\\\" } # repl...
[ { "docid": "e739e57f900982b04817f13c03593ba2", "score": "0.76192844", "text": "def windows_unc_path(path)\n path = path.gsub(\"/\", \"\\\\\")\n\n # Convert to UNC path\n if path =~ /^[a-zA-Z]:\\\\?$/\n # If the path is just a drive letter, then return that as-is\n ...
f4f15b0a80eb3bec9d6da44444ae2acd
Raise an error if no connected device was found
[ { "docid": "1ac216135c11ec677fc56ff6a232f633", "score": "0.8337628", "text": "def check_devices\n\traise \"No connected device was found.\" if no_device?\nend", "title": "" } ]
[ { "docid": "9bc0f21a31a4d6588cdf18d78e392cb0", "score": "0.68239665", "text": "def raise_if_no_exists_in_one\n raise 'OpenNebula device does not exist at the moment' unless one?\n end", "title": "" }, { "docid": "4a2595e4a054d233441f09c0b6687bee", "score": "0.66925645",...
a000e74a3b3ca30c46efc7866f5ad4b4
PROBLEM 7: Sort Stack: Write a program to sort a stack such that the smallest items are on the top. You can use an additional temporary stack, but you may not copy the elements into any other data structure (such as an array). The stack supports the following operations: push, pop, peek, and isEmpty. This algorithm is ...
[ { "docid": "00c01901b263efec3415cc6749e818ea", "score": "0.8111722", "text": "def sort_stack(stack)\n temp_stack = Stack.new\n\n until stack.empty?\n temp = stack.pop\n\n # while the top element in the temp_stack is greater than temp we push\n # those elements to the stack and push ...
[ { "docid": "4d2b155c4d23567d9cecac787a55ff13", "score": "0.85136586", "text": "def stack_sort(stack)\n min = 1.0/0.0\n count = 0\n length = stack.length\n to_sort = stack\n storage = Stack.new\n until count == length\n sorted = true\n until to_sort.is_empty?\n test_el = to_sort.pop\n ...
bb210418b5bc0b13481638b366ff79cd
Clicks the Add to Document button on the Image tab. This method will fail if the image tab is not the currently selected tab.
[ { "docid": "aa76cef840edd3827f28f87733e24a8b", "score": "0.8242638", "text": "def add_image_to_document\n frm.div(:id=>\"PostForm:tab1\").button(:value=>\"Add to document\").click\n end", "title": "" } ]
[ { "docid": "ed2b86388000d067a2860220fe75afa5", "score": "0.75471777", "text": "def add_file_to_document\n frm.div(:id=>\"PostForm:tab3\").button(:value=>\"Add to document\").click\n end", "title": "" }, { "docid": "ed2b86388000d067a2860220fe75afa5", "score": "0.75471777", "text":...
de4849bfc92ac1e9fc097787db220f46
Returns a set of all the possible values which can occupy this row
[ { "docid": "4cb6b7ddc7a3d5434698622e50179900", "score": "0.728267", "text": "def possible\n\t\t@cells.inject(Set.new) { |row_set, cell|\n\t\t\trow_set.merge(cell.possible)\n\t\t}\n\tend", "title": "" } ]
[ { "docid": "9fdccef9dce85ba965de947b1ce6a5db", "score": "0.7681973", "text": "def possible_values(row, col)\n\t\t((1..9).to_a - (row_values(row) + col_values(col) + cell_values(row, col)).uniq)\n\tend", "title": "" }, { "docid": "a9af5801bdb6dd2542e992821616411a", "score": "0.7484577", ...
1097a7e7758f08d32addfc88ea3fdcab
GET /users GET /users.json
[ { "docid": "8b1dbac81472eff58cb602a4a1473ebb", "score": "0.0", "text": "def index\n @users = User.all\n end", "title": "" } ]
[ { "docid": "8a29471646191d84def95f7af1e081bf", "score": "0.82109934", "text": "def users(args = {})\n get(\"/users.json\",args)\n end", "title": "" }, { "docid": "fd6f331d604ba2ad8967a7e5ed218329", "score": "0.7873764", "text": "def show\n begin\n user = User.find...
9dff2876e2f135d5c1b5862db3043596
callseq: sysinit > KATCP::Response Writes the timing ctl register that resets the entire system. [Presumably this depends on a certain register naming convention?]
[ { "docid": "df825422a8db76f60364ca7bb0d1d834", "score": "0.4728757", "text": "def sysinit\n request(:sysinit)\n end", "title": "" } ]
[ { "docid": "00cf40cea5d315fd5d905c38b09fd293", "score": "0.62872124", "text": "def sendReset()\n write(\"R\")\n end", "title": "" }, { "docid": "7b7c9e23e13f24722e06d181ee42dd1e", "score": "0.6249033", "text": "def sys_reset\n send_to_plug(:system => {:reset => {:delay => 1}...
51a898d3a7f3b681b14bf7a7dfc65f38
Sends prebuilt test Requests to new users
[ { "docid": "b2665ff629ed6b93c179f4d5ba3e1d32", "score": "0.6334203", "text": "def initial_test_pack\n user = User.where({admin: true}).first\n user.problems.each do |problem|\n self.requests.create(user_id: self.id, problem_id: problem.id)\n end\n end", "title": "" } ]
[ { "docid": "06e1b08b0c3f68ee40bd66cb3bab0bdf", "score": "0.6336401", "text": "def setup\n @account = accounts(:test_account)\n @user = @account.users.first\n \n # All requests are at account domain with logged-in user unless\n # otherwise specified in the test method\n @request....
049cd0d9ba56de2c92eb3092b0e9f56d
Finds details of the object currently selected.
[ { "docid": "c464c08cb0c51e70f4e9ad6b0231b42a", "score": "0.6823561", "text": "def show_details\n\t\t\treturn @selected\n\t\tend", "title": "" } ]
[ { "docid": "00763f282cc5b2d161a294b11559f15f", "score": "0.6854197", "text": "def show_details\n raise ArgumentError, \"Nothing is selected\" if @selected == nil\n return @selected.details\n end", "title": "" }, { "docid": "cb2cb0418604df1b2aaa99adf20f562f", "score": "0.6802167", ...
867c7b226eb6439d0b50b7352e0b078b
Fetch identifier and deserialize if neccessary
[ { "docid": "81c413552549db0030484c9d7bf47e8f", "score": "0.0", "text": "def fetch_identifier(name)\n @cached_ids[name] ||= @cached_ids.fetch(name) do\n val = ids[name.to_s]\n next val unless val.is_a?(String)\n\n GlobalID::Locator.locate(val) || val\n end\n ...
[ { "docid": "b6e4430b0b42da6a95730bbf5ddb183b", "score": "0.67227274", "text": "def parse_id; end", "title": "" }, { "docid": "b3e601189229762d5a19ac579b52fd5d", "score": "0.6580767", "text": "def id\n object.read_attribute_for_serialization(:id)\n end", "title": "" }, { ...
59271eb59cc955e7fd807d7668ed8cd3
Inserts an outline section to the outline tree (see outlinedefine). Although you will probably choose to exclusively use outlinedefine so that your outline tree is contained and easy to manage, this method gives you the option to insert sections to the outline tree at any point during document generation. This method a...
[ { "docid": "0151e9180d95d46d5179cced5e05a8a0", "score": "0.7786851", "text": "def add_subsection_to(title, position = :last, &block)\n @parent = items[title]\n unless @parent\n raise Prawn::Errors::UnknownOutlineTitle,\n \"\\n No outline item with title: '#{title}' exists in th...
[ { "docid": "7b962ee0e4a5887010eeb54f6e21104a", "score": "0.7399281", "text": "def insert_section_after(title, &block)\n @prev = items[title]\n unless @prev\n raise Prawn::Errors::UnknownOutlineTitle,\n \"\\n No outline item with title: '#{title}' exists in the outline tree\"\n ...
340361a95b9d40ded5392d0167301fb0
Fetches historical stats for each of your fastly services and groups the results by service id. If you pass in a :field opt then fetches only the specified field. If you pass in a :service opt then fetches only the specified service. The :field and :service opts can be combined. If you pass in an :aggregate flag then f...
[ { "docid": "7f5cde8d821b3a9cae009775ead51949", "score": "0.7013483", "text": "def stats(opts)\n if opts[:aggregate] && (opts[:field] || opts[:service])\n fail Error, \"You can't specify a field or a service for an aggregate request\"\n end\n\n url = '/stats'\n\n url += '/aggregate' if ...
[ { "docid": "e8aecf86d7c25d618059d5012497c9ae", "score": "0.67621744", "text": "def get_hist_stats_service_field_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_hist_stats_service_field ...'\n end\n # unbo...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "2a934276852d710c295361957271c647", "score": "0.0", "text": "def set_training_approval\n @training_approval = TrainingApproval.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;...
1730ec1104a46f47ece5241d419ccd44
GetFileChunk file_path string start_point int64 size int32 this call has no page on the wiki, I have no idea what it does.
[ { "docid": "9650d100ae4bf5a0f717843673dbf4e3", "score": "0.8128094", "text": "def get_file_chunk(file_path, start_point, size)\n request({req: 'getfilechunk', path: file_path, start: start_point, length: size})\n end", "title": "" } ]
[ { "docid": "6c133b7898c0ebb9f0b64cffbb0346c3", "score": "0.6860722", "text": "def get_chunk(file_id, chunk_number)\n get_file(chunk_id_for(file_id, chunk_number))\n end", "title": "" }, { "docid": "d424fa3dd4ce923e33132712fafaa0dd", "score": "0.6174603", "text": "def chun...
0fd15c46708b8714e787ac608db51474
"ermittelt die Adresse des Kunden"
[ { "docid": "5cdc8e07b609971317a161df14992d5d", "score": "0.0", "text": "def addressGet(options={})\n assert_valid_keys(options, :customerId)\n assert_keys_exists(options, :customerId)\n execute(:addressGet, options)\n end", "title": "" } ]
[ { "docid": "d67b11a2073fe811e1a5377b1488729b", "score": "0.64205474", "text": "def full_address; end", "title": "" }, { "docid": "0a64b244d01788edabfd39e93eff74e2", "score": "0.6299518", "text": "def address\n \"%s %s %s %s\"%([self.prefecture_code,self.address_city,self.address_s...
67df3dcad06bcc5a74d36a294f75eb11
this is really only used after leaving a page with a form because the edit_line elements don't get removed on the clear() call
[ { "docid": "05ef60f85706d56afee629cd90d91258", "score": "0.6570964", "text": "def remove_edit_lines\n if lines = App.edit_lines\n unless lines.empty?\n puts \"Removing edit_lines\"\n lines.map &:remove\n end\n end\n end", "title": "" } ]
[ { "docid": "f070b87f4c98acdbcef520d12bd9735c", "score": "0.67733663", "text": "def remove_line\n render :update do |page|\n page.replace(\"atom_form_#{params[:id]}\", \"\")\n end\n end", "title": "" }, { "docid": "be65210bcf25869ef47c9f56a5908b0e", "score": "0.64370286", ...
7b00707bf21db3ec18b2233470c2a37b
POST /suite_results POST /suite_results.json
[ { "docid": "b5e25e6e6c1a5fad6cc89be9aff8f60d", "score": "0.7172768", "text": "def create\n @suite_result = SuiteResult.new(params[:suite_result])\n\n respond_to do |format|\n if @suite_result.save\n format.html { redirect_to @suite_result, notice: 'Suite result was successfully created...
[ { "docid": "4725e14848f6ffba1a331fc091057521", "score": "0.68722105", "text": "def post\n Typhoeus.post(@url,\n body: @results_hash.to_json,\n headers: { 'Content-Type' => 'application/json' })\n end", "title": "" }, { "docid": "3da082066593253bdbe60874c...
389290d7dd9bb702e92e9474b7572be9
POST /orders POST /orders.json
[ { "docid": "0bfc37c7b081e229d9c7dd1aeca93437", "score": "0.0", "text": "def create\n @order = Order.new(order_params)\n @order.user_id = current_user.id\n @order_item = OrderItem.create\n respond_to do |format|\n if @order.save\n format.html { redirect_to @order, notice: 'Замовле...
[ { "docid": "e351d40efb5569993155750656dc7979", "score": "0.7586514", "text": "def orders\n authenticated_post(\"orders\").body\n end", "title": "" }, { "docid": "4e46e5bc223a332a8352fa259adf12e8", "score": "0.74892014", "text": "def orders\n authenticated_post(\"auth/r/o...
c170829e9162f499c54edfa4a9aa760e
~ This method calls all the exercise classes that a member has enrolled in ~
[ { "docid": "260264312879e9c69cd9ea259e83a692", "score": "0.57885337", "text": "def exercise_classes\n sql = \"SELECT exercise_classes.* FROM exercise_classes INNER JOIN booking_infos ON exercise_classes.id = booking_infos.exercise_class_id WHERE member_id = $1;\"\n values = [@id]\n result...
[ { "docid": "71522f1c7f54664c09490eeca9ef19b4", "score": "0.6111688", "text": "def test_classes\n if(@fiber && @input_classes.size == 0)\n @fiber.transfer [:error, \"Could not find any classes\"]\n end\n @input_classes.each do |c|\n if @regression_file.nil?\n single_...
2cbd2e7ffc770aa202a333d6bdd40f8b
display the flash messages using foundation
[ { "docid": "9124875f30107476941930f9e94c72fd", "score": "0.6650915", "text": "def notice_message(cls: 'alert-box')\n flash_messages = []\n _type = 'notice'\n flash.each do |type, message|\n next if message.nil?\n _type = type\n flash_messages << html_msg(message, cls)...
[ { "docid": "9eb5adf3f20b91ca13a741f9ea5f7ca6", "score": "0.7989329", "text": "def display_flash_message\n type = nil\n message = nil\n\n if flash[:error]\n type = 'error'\n message = flash[:error]\n elsif flash[:success]\n type = 'success'\n message = flash[:succ...
01b4df1feebbb4a97f6bda3c86fe8c9c
Gets a list of event keys for events in the given district.
[ { "docid": "3ca0f2f91e09c280069491d7cd6b9d0d", "score": "0.54227793", "text": "def get_district_events_keys_with_http_info(district_key, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: EventApi.get_district_events_keys ...'\n end\n # ver...
[ { "docid": "052cccbf40433b1a1ed2cbb24b66871b", "score": "0.6457057", "text": "def get_district_events_keys(district_key, opts = {})\n data, _status_code, _headers = get_district_events_keys_with_http_info(district_key, opts)\n data\n end", "title": "" }, { "docid": "052cccbf4043...
d9bbb6e7bad851ba392e98347b1c989a
GET /products GET /products.json
[ { "docid": "502db4d9e3b7122d093991e9f5a82783", "score": "0.0", "text": "def index\n @products = @products.paginate(:page => params[:page], :per_page => 7)\n redirect_to new_product_url, notice: 'Completá el formulario para crear un producto' if Product.all.blank?\n end", "title": "" } ]
[ { "docid": "e7f81a2db5836675357a443a3156c552", "score": "0.7949958", "text": "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "title": "" }, { "docid": "ca2505d77a30a229da977ec6ddf7a596", "score": "0.79288375", ...
f335213ed9d09da4b7d5fc0b2c31c217
If location2 is given for input toLocation, location1 is returned loc1 & loc2 are doubles for Location objects.
[ { "docid": "82ee3039a039e136c0626989d251e515", "score": "0.5817556", "text": "def test_loc2_to_loc1\n loc1 = Minitest::Mock.new(\"Location 1\")\n loc2 = Minitest::Mock.new(\"Location 2\")\n avenue = Street::new(\"Foo\", loc1, loc2)\n assert_equal loc1, avenue.to_location(loc2)\n end", "...
[ { "docid": "f3b8bfe8675575df917b01753af47db4", "score": "0.6663619", "text": "def to_location\n if self =~ NumericLocation\n [$1, $2].to_location\n else\n self\n end\n end", "title": "" }, { "docid": "cf47eb0f81d0bed8becb371a8b6204d5", "score": "0.6462602", "text"...
88fdafc90fb2862b220c178b7f69e213
For similarity with legacy mode
[ { "docid": "062e8be199d0c37867e61c39f80b1622", "score": "0.0", "text": "def assignment_method?\n false\n end", "title": "" } ]
[ { "docid": "0b2b910e238135e49b52786b5f1fdede", "score": "0.65712696", "text": "def similarity_matrix\n multiply_self(normalize)\n end", "title": "" }, { "docid": "d314f5743fec7bd7e604bd96ae8a30fe", "score": "0.6547375", "text": "def similarity_score(word_1, word_2)\n raise NotIm...
9b694e3e8207dea743969cfba86012cb
Return an empty BmetCost
[ { "docid": "4893fdcef8ff79d25ae0a98b63745ac9", "score": "0.6776048", "text": "def new\n @bmet_cost = BmetCost.new\n end", "title": "" } ]
[ { "docid": "e14230f6f7dc40dceb5921b2e1efb644", "score": "0.7370581", "text": "def cost\n nil\n end", "title": "" }, { "docid": "38d64632bc43961ef3442199712bb4a6", "score": "0.66875696", "text": "def cost\r\n 0\r\n end", "title": "" }, { "docid": "38d64632bc439...
01bda71b8429ec4fbe6e4b0f9ed6f2ca
Helpers / Methods used in other actions
[ { "docid": "4414dee89d7138c341f36bbbda9e764f", "score": "0.0", "text": "def current_user\n if session[:current_user_id]\n @current_user ||= User.find(session[:current_user_id])\n end\n end", "title": "" } ]
[ { "docid": "801bc998964ea17eb98ed4c3e067b1df", "score": "0.7130285", "text": "def actions; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", "score": "0.6954717", "text": "def action; end", "title": "" }, { "docid": "e6d7c691bed78fb0eeb9647503f4a244", ...
811dab12a71c6937b5cd6a42422df540
Check a User is Logged In
[ { "docid": "e87eb7137f5e121a052a0da6daa4f38a", "score": "0.0", "text": "def logged_in?\n session[:user_id]\n end", "title": "" } ]
[ { "docid": "5e8797ab67adadcb571fb446716121fe", "score": "0.83856654", "text": "def userIsLoggedIn()\n user = getUser()\n if user != nil\n true\n else\n false\n end\n end", "title": "" }, { "docid": "5cb14ea67fd965781b881908c150186b", "score": "0.8043889", "text...
a559f867e9ceee734a764aad3db6b6cf
Helper method to generate the WHERE sql for a +field+, +operator+ and a +value+
[ { "docid": "81b721e2a3eb840febda0fa88e585271", "score": "0.74221796", "text": "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n ...
[ { "docid": "33382d4670e0801e4b1f26bf922c6dfe", "score": "0.7367262", "text": "def sql_for_field(field, operator, value, db_table, db_field, is_custom_filter=false)\n sql = ''\n case operator\n when \"=\"\n if value.any?\n case type_for(field)\n when :date, :date_past\n ...
ac2709235b0eeef2587ffcecf68d5d79
View to offer a View to offer a ./deny endpoint for denying a IncomeRequest.
[ { "docid": "13ce806240131781debc610fa8606f47", "score": "0.0", "text": "def deny_income_request_post(platform_pk, pk, opts = {})\n data, _status_code, _headers = deny_income_request_post_with_http_info(platform_pk, pk, opts)\n return data\n end", "title": "" } ]
[ { "docid": "89d15ea5df50c5f001307dbfad7c6e7c", "score": "0.6515571", "text": "def deny_request(request)\n # Implementation\n end", "title": "" }, { "docid": "508e65445a280890d4e76aebc6e73f7b", "score": "0.64432865", "text": "def deny_control &block\n @app.request(\"deny_co...
53d179729b9d988004b1a5c4b28cbb24
Override the given _sql method based on the type, and cache the result of the sql.
[ { "docid": "b6360c6890faccc8d8e11b459600a9b8", "score": "0.6118585", "text": "def prepared_sql\n if sql = @opts[:prepared_sql] || cache_get(:_prepared_sql)\n return sql\n end\n cache_set(:_prepared_sql, super)\n end", "title": "" } ]
[ { "docid": "27e0c0c6113dd859136cd3ba3b0d33e4", "score": "0.630913", "text": "def update_sql(sql, name = nil)\n super\n end", "title": "" }, { "docid": "b5c38707f42204cab68245a3df30fbee", "score": "0.6306694", "text": "def result_value_of(declared_type, value)\n if ...
968160b718b5630429f578233966ffc2
Match this, other is optional
[ { "docid": "f07f3c4795e531136c5e6f28b4af861c", "score": "0.5260667", "text": "def >(other)\r\n Parser.new do |input|\r\n first = run(input)\r\n matched = \"\"\r\n output = []\r\n if first.ok?\r\n matched = first.matched\r\n output += first.output\r\n second =...
[ { "docid": "ee189300f62f5be27f16d20231109fc6", "score": "0.73914886", "text": "def match!( other )\n return false unless prefers?( other ) && !matched?( other )\n matches << other\n other.matches << self\n end", "title": "" }, { "docid": "31705f9cbee54ef7d1f2c072f52e0...
26f5b7acdb4633a773833948439c0e46
see the duplication? Let's separate the logic from the data by creating a function that provides the logic and returns a lambda prefilled with the multiplier. Pattern: Partial Application Using partial application to fill variables into a lambda: Returns a lambda that, when called with a number, will return the specifi...
[ { "docid": "ec4b0335f5c15f6ff1f4a8f6944849c7", "score": "0.68513614", "text": "def fn_multiply_by(factor)\n ->(n) { factor * n }\nend", "title": "" } ]
[ { "docid": "b5ecadfb486770665893b0009edfb0d1", "score": "0.72775006", "text": "def multiplier(n) \n lambda {|data| data.collect{|x| x*n } }\nend", "title": "" }, { "docid": "b5ecadfb486770665893b0009edfb0d1", "score": "0.72775006", "text": "def multiplier(n) \n lambda {|data| data....
afad350215e42923c07782bfc1b12712
Adjusts the max memory of a virtual machine so that it satisfies the constraints imposed by the engine. The max memory is supported since version 4.1 and limited to 1TB according to the UI limits defined for ovirt provider.
[ { "docid": "8de11870424681deea3c09b04fbf8168", "score": "0.7172762", "text": "def calculate_max_memory(vm, memory)\n max = vm.memory_policy&.max || memory\n if memory >= 1.terabyte\n max = memory\n elsif memory > max\n max = [memory * 4, 1.terabyte].min\n end\n\n m...
[ { "docid": "149af5aa6a3389e4941c9e4e2c821acc", "score": "0.7097189", "text": "def max_memory=(value)\n FFI::Libvirt.virDomainSetMaxMemory(self, value) == 0\n end", "title": "" }, { "docid": "6c72651d7150cc92482c06647d9aa8d3", "score": "0.66683257", "text": "def memory(mb)\n ...
0aa238356bc8aabdb4e7f2163d003e9a
PATCH/PUT /promotions/1 PATCH/PUT /promotions/1.json
[ { "docid": "3d2ac0f4bd18f739f0560c9a4ef1939c", "score": "0.0", "text": "def update\n respond_to do |format|\n if @promotion.update(promotion_params)\n puts params[:categories_to_be_added]\n for category in params[:categories_to_be_added]\n # c=Category.find_by_name(ca...
[ { "docid": "dd4437688d187b36af64fe44f4e4458c", "score": "0.61312884", "text": "def update\n @promocion = Promocion.find(params[:id])\n\n respond_to do |format|\n if @promocion.update_attributes(params[:promocion])\n format.html { redirect_to @promocion, notice: 'Promocion was successfu...
74e677e43a531927ac253c90e10253e5
presents an error message on top of the board if there is an illegal move
[ { "docid": "643f9ce95e1a0763face3792e7a7435e", "score": "0.66555935", "text": "def error_message(team, piece, from_coordinate, to_coordinate)\n if not_your_turn(team, turn)\n \"It is not your turn!\"\n # Does the piece you want to move exist?\n elsif piece.nil?\n \"That piece does not...
[ { "docid": "6548cc3ab172c6e0c3ba64889d3631de", "score": "0.74505734", "text": "def off_board_error\n pos = [99, 99]\n until valid_move?(*pos)\n puts \"Please select valid location on the board.\"\n print \"New row: \" \n row = gets.chomp.to_i\n print \"New column: \"\n col...
393413b8d3b1ace35e3799e3ecb3a039
This sweeper is going to keep an eye on taggable models If our sweeper detects that a taggable (User) was activated
[ { "docid": "5a84185a59fbab01fe73bcaed2acea5f", "score": "0.0", "text": "def after_activate(taggable)\n expire_cache_for(taggable)\n end", "title": "" } ]
[ { "docid": "be93fa7b3d2097893b1b620e935d111b", "score": "0.61856073", "text": "def tag user\n unless tagged? user\n users << user\n end\n end", "title": "" }, { "docid": "be93fa7b3d2097893b1b620e935d111b", "score": "0.61856073", "text": "def tag user\n unless tagged? u...
5b6fe42b1df10f2d93902a1df50a5e2e
Build xml Fedex Web Service request
[ { "docid": "daa567f640dd9b1b577a48a38f6ea5e6", "score": "0.72120917", "text": "def build_xml\n ns = \"http://fedex.com/ws/pickup/v#{service[:version]}\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.CreatePickupRequest(:xmlns => ns) {\n add_web_authentication_de...
[ { "docid": "b2e5a59d41425b4b039dfac4f7e137b6", "score": "0.75306565", "text": "def build_xml\n ns = \"http://fedex.com/ws/rate/v#{service[:version]}\"\n builder = Nokogiri::XML::Builder.new do |xml|\n xml.RateRequest(:xmlns => ns){\n add_web_authentication_detail(xml)\n...
03ac9fccc0f76559e314a404d2c571e4
end of the array and the second, in the right end of the array. The left pivot must be less than or equal to the right pivot, so we swap them if necessary. Then, we begin partitioning the array into three parts: in the first part, all elements will be less than the left pivot, in the second part all elements will be gr...
[ { "docid": "904e55c34fe6179ba102a258edf0acac", "score": "0.8403998", "text": "def dual_pivot_quicksort(arr)\n return [] if arr.empty?\n return arr if arr.size == 1\n\n # this check is necessary if the left pivot is larger than the right pivot\n arr[0], arr[-1] = arr[-1], arr[0] if arr[0] > arr[-1]\n...
[ { "docid": "4c13578ea477503987c70959524403b7", "score": "0.8371756", "text": "def quick_sort(array)\n if array.length < 3\n if array.length == 2\n if array[0] > array[1]\n array[0], array[1] = array[1], array[0]\n end\n end\n return array\n else\n pivot = array[array.lengt...
cee2e0204747b61f937b502b914a9fb4
Join a set of 2dimensional arrays of rows with appropriate padding, e.g. ["a", "b", "c"] ["d", "e"] ["a", "b", "c", "d", "e"] [ [ ["i", "j", "k"] ] ,[ ["l", "m"] ] ].matrix_join => [ ["i", "j", "k", "l", "m"] ] ["n", "o", "p"] ["q", "r"] ["n", "o", "p", "q", "r"] ["s", "t", "u"] ["s", "t", "u", "", "" ]
[ { "docid": "ba223709d0acaa8fc39322c62b45562c", "score": "0.8141417", "text": "def matrix_join\n return self.dup if size == 0 # Deal with the trivial case\n normalized_matrixes = self.map{|matrix| matrix.normalize } # Ensure component matrixes are squared up\n row_counts = normalized_matrixes.ma...
[ { "docid": "92546779c5f9f2a5ca02f8de505a45ee", "score": "0.71834713", "text": "def join_matrix(m_input, m_id)\n m_result = Array.new\n n_cols = m_input[0].size\n nc_id = m_id[0].size\n for i in 0..nc_id-1\n m_result[i] = Array.new\n m_result[i][0] = m_id[i][0]\n end\n for i in 0..m...
3305418f2854c04870b26a20abbdb30e
creates a new branch if the branch doesnt already exist if the branch exists just change the current branch name
[ { "docid": "8c71d1c372b83f22ee770c6457ebbaae", "score": "0.73572844", "text": "def branch(brname)\n\t\t@prev_dir = @branch_dir\n\t\t@curbranch = brname\n\t\t@branch_dir = @currentDir + \"/repository/\" + @curbranch\n\t\tif(!directory_exists?(@branch_dir))\n\t\t\tDir.mkdir(@branch_dir, 0700)\n\t\tend\n\t...
[ { "docid": "38d20c01f21702c0138d9252be6437de", "score": "0.8212015", "text": "def git_branch_create(new_branch_name)\n repo.create_branch(new_branch_name)\n end", "title": "" }, { "docid": "b41af57e8ee1ff83218ebdb522163c87", "score": "0.80831367", "text": "def new_branch(...
6098e48217b33b925b6335e9f7578469
def total_price if promotions.any? total = total_amount adjustment = (total / 100).to_f total_flat_percent (total adjustment).to_f else total_amount end end
[ { "docid": "55a21327bfb67d6828cdb554d8e6da93", "score": "0.7988297", "text": "def total_price\n total = total_price_without_installments\n if promotions.any?\n adjustment = adjustments.eligible.map(&:amount).sum\n\n (total += adjustment).to_f\n end\n if line_items.any? { |li| li.re...
[ { "docid": "6c3b2104f73098f688245d7cd383f548", "score": "0.78687173", "text": "def compute_total(total)\n if discount.eq?('percent')\n percent_value = amount.to_f / 100\n total = total - (total * percent_value)\n else\n total = total - amount\n (total < 0) ? 0 : total \n end...
1c091f1d1498f4f76567593f6424c17c
define this but to do it correctly need to setup a counter cache scope :any_active_contacts, where("self.contacts.done IS ?", false).count > 0
[ { "docid": "48ace85d33d3fb73d96f1b77881b6f90", "score": "0.0", "text": "def following?(other_user)\n relationships.find_by_followed_id(other_user.id)\n end", "title": "" } ]
[ { "docid": "361e77d15b752461a3e32e46186136be", "score": "0.669633", "text": "def open_contacts?\n self.contacts.select(&:open?).size > 0\n end", "title": "" }, { "docid": "35b17a17a3224334838f27c8e892dd40", "score": "0.6281623", "text": "def active?\n _active?(@count)\n e...
d2c9534e7f1345f5f2f0de9d6fe782d9
push a byte into the decoder
[ { "docid": "2bc395f3e15dcc3a2c1ea10e35fa8aa6", "score": "0.6102154", "text": "def push(b)\n \n timeNow = Time.now\n \n if (@time - timeNow) > @tio\n @state = :idle \n end\n \n @time = timeNow\n ...
[ { "docid": "53d0d33948b41976b5c1fc64e19dbbf3", "score": "0.66323495", "text": "def stream_in byte\r\n if @cursor > @data.size\r\n (@cursor - @data.size).times {|c| @data.push nil}\r\n end\r\n @data[@cursor] = byte\r\n @cursor += 1\r\n end", "title": "" }, { "doc...
d9b7a8d0a6126fd8af97967429c25d0e
If the host/hostgroup has a medium then use the path from there Else if the host/hostgroup's operatingsystem has only one media then use the image_path from that as this is automatically displayed when there is only one item Else we cannot provide a default and it is cut and paste time
[ { "docid": "216d73feefe28d9ed79f43209e0e196e", "score": "0.6629675", "text": "def default_image_file\n return \"\" unless operatingsystem and operatingsystem.supports_image\n if medium\n nfs_path = medium.try :image_path\n if operatingsystem.try(:media) and operatingsystem.media.size == ...
[ { "docid": "348e1592c6b40c31951db06f4fe1d48c", "score": "0.6897787", "text": "def image_url_medium\r\n if object.topic && object.topic.images && object.topic.images.first.asset.exists?\r\n object.topic.images.first.asset.url(:medium) \r\n end\r\n end", "title": "" }, { "docid": ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "717e287da89dc3308ef03da4696fe09f", "score": "0.0", "text": "def static_page_params\n params.require(:static_page).permit(:name, :route)\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...
bdbce0d8fc5b1605d932e733e7cd68f8
Get the position of the current window.
[ { "docid": "7a4bf1c0b35fe54fcbdefa2b5ec072e5", "score": "0.8082984", "text": "def position\n @bridge.getWindowPosition\n end", "title": "" } ]
[ { "docid": "106f3cde9f52f186bcec1e281f56992a", "score": "0.8236244", "text": "def screen_position\n Position.new(@window.top, @window.left)\n end", "title": "" }, { "docid": "0ebdd9760abdbabdac01ded145cd6e16", "score": "0.8184792", "text": "def position\n @bridge.windo...
7e5e00e1819ab0aef9e5fb02c8464692
find associated assignee names for ticket results
[ { "docid": "82e98c0c1f7a063b42376abfb9bed454", "score": "0.7421873", "text": "def extra_tickets_data_look_up\n return if @results.empty?\n\n users = DataStore.instance.users\n @results.each do |ticket|\n user_name = users.find { |u| u['_id'] == ticket['assignee_id'] }&.send(:[], 'n...
[ { "docid": "03d88aa38a733b48e87241478cea10c5", "score": "0.6771139", "text": "def extra_users_data_look_up\n return if @results.empty?\n\n tickets = DataStore.instance.tickets\n @results.each do |user|\n ticket_names = tickets.select { |t| t['assignee_id'] == user['_id'] }.map { |t...
dff16a2fa659a9957b00e16af072a00d
helper method used to calculate bonus points of frame 10
[ { "docid": "cfeb5ea34e0384faaab9921835b6d5a2", "score": "0.5917112", "text": "def score_frame_10(frame)\n # Open frame\n return frame.map(&:to_i).sum if frame.length == 2\n # X X X\n return 30 if frame[1] == 'X' && frame[2] == 'X'\n # X X <0-9>\n return 20 + frame[3].to_i if frame[1] == 'X'\n # X...
[ { "docid": "99e5d4ee6cf9d480a591bbfce3852c29", "score": "0.7651571", "text": "def bonus_calc\n array_ref = @frame_count - 1\n (0..array_ref).each do |n|\n if @current[n][:roll1] == 10\n @current[n][:bonus] == @current[n + 1][:roll1] + @current[n + 1][:roll2]\n elsif @current[n][:r...
24d2de9b06efd3bbc698904dc24cc456
Returns "Store / Mall" label
[ { "docid": "abef4e968ebd1ab06d70fd12f496e57e", "score": "0.7572318", "text": "def rcm_mall_label\n $tracer.trace(__method__)\n return ToolTag.new(span.id(\"/StoreInfoControl_MallLabel/\"), __method__, self)\n end", "title": "" } ]
[ { "docid": "5f178e60e916f6b5df8c6fdcd6f2bca7", "score": "0.6535546", "text": "def to_label\n catalog_number + \" - \" + manufacturer\n\n end", "title": "" }, { "docid": "74191a36eeaa343d5d8e0dacc37cbd83", "score": "0.63098145", "text": "def to_label\n \"#{product.name}-#{nam...
05488bff036a8853a054ce5bc608ca0f
Identify and describe the Ruby method you implemented. Person 3
[ { "docid": "3aef56e716abe1d4a4adb15fe6b7dacc", "score": "0.0", "text": "def my_array_sorting_method(source)\n # Your code here!\nend", "title": "" } ]
[ { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7338064", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", "score": "0.7338064", "text": "def method; end", "title": "" }, { "docid": "20898baa64ab5fd26066acd36fb4bbbd", ...
d689b5ff798448bb98a0ad14ede177ac
GET /profile/address def dob end PATCH /profile/address
[ { "docid": "143b9323f93f775790dee966315d3109", "score": "0.63732535", "text": "def change_address\n if current_user.update_address!(params[:address])\n redirect_to settings_path, notice: \"Address updated successfully.\"\n else\n @address_error = true\n render :address\n end\n e...
[ { "docid": "900231016bd18d6272d4dac83e95a9bc", "score": "0.72161883", "text": "def update\n respond_to do |format|\n if @user_profile.update(user_profile_params) && @address.update(address_params)\n format.html { redirect_to @user_profile, notice: 'User profile was successfully updated.' ...