query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
1bd29f505293d7dc79cfd0ec0972796d
Add a new task with the supplied properties.
[ { "docid": "5c87aefd64683b2b5404f4bef99c2ef0", "score": "0.58731323", "text": "def addTask(sourceDescription, sourceURL, context, taskText)\n\t\n\t\tapplication=Appscript.app(self.getApplicationName())\n\t\n\t\t#Applescript dictionary defines this list as \"default list\", rbappscript uses an underscore...
[ { "docid": "ef0ecf69d606e418aec53397415b5159", "score": "0.7329741", "text": "def add_task(hash_task, *args)\n add_tasks([hash_task,], *args)\n end", "title": "" }, { "docid": "bf63ad1b4033e05939cad8e4e2f3bc48", "score": "0.7320299", "text": "def add_task(task)\n @tasks ...
e02834a54df9e2700677af5506a01bf2
set up recipient configuration prior to submission
[ { "docid": "36d85685a666775dc5b89ad98914e8e5", "score": "0.0", "text": "def configure\n yield self\n end", "title": "" } ]
[ { "docid": "962091617c03fa81999e4a9c7c372a61", "score": "0.75953436", "text": "def set_recipient\n end", "title": "" }, { "docid": "080f424696270a6f04545ad264fc931c", "score": "0.66229373", "text": "def setup_email(user)\n recipients user.email\n from self.contact_email\...
3f6f2832a8c5c03da9b4e95a58404870
GET /results/1 GET /results/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "53469497ccbcd9be7e11635c5f665fc1", "score": "0.7399799", "text": "def index\n @results = Result.all\n\n respond_to do |format|\n format.html\n format.json { render json: @results }\n end\n end", "title": "" }, { "docid": "b918cc042e361e52f8c219bef07e3591", ...
3f52973818698070d105a2c20fdb77a5
Serializes information the current object
[ { "docid": "e306e37ad63f31192bd55f93fbdfe941", "score": "0.0", "text": "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n writer.write_object_value(\"edge\", @edge)\n writer.write_string_value(\"@odata.type\", @odata_type)\...
[ { "docid": "d162e297d0f84ca205afa381c3f6a428", "score": "0.7830697", "text": "def serialize\n Marshal.dump(self)\n end", "title": "" }, { "docid": "762bca0e2db3ff19d91cc4521bb1e1d9", "score": "0.7645999", "text": "def serialize(object) end", "title": "" }, { "docid": ...
d29f7e8aa9e724182983a05cd2f5600c
END BACKPORTED FROM 2.0
[ { "docid": "8200b7583930218057e51e018defd5aa", "score": "0.0", "text": "def have_libvar(var, headers = nil, opt = \"\", &b)\n checking_for checking_message([*var].compact.join(' '), headers, opt) do\n try_libvar(var, headers, opt, &b)\n end\nend", "title": "" } ]
[ { "docid": "74400dcfec21a40e76cf5a5be6b14cb1", "score": "0.6367372", "text": "def exclude_end; end", "title": "" }, { "docid": "766a1755b1f9472b764bda8eec9716c6", "score": "0.63399297", "text": "def chore; end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af45b3ec4e3"...
becf38e9929282131aab0403345b1f08
If we use the normal decorator options that have policy objects we can get into recursive loops in Pactflow, so just make a simple variant of the decorator options here
[ { "docid": "3f06ccbbe5df64e82b2528ef66546c4f", "score": "0.0", "text": "def decorator_options_for_error\n { user_options: { base_url: base_url } }\n end", "title": "" } ]
[ { "docid": "bb2276b2d3bcab4bf601295064d2f0c1", "score": "0.5666631", "text": "def skip_policy_scope; end", "title": "" }, { "docid": "d0f62febacb010b97120ef28c345d057", "score": "0.55754274", "text": "def permissions_policy(&block); end", "title": "" }, { "docid": "57984c...
fe22c64fac17dc87511e0344cff93ce2
of fourth powers of their digits: 1634 = 1^4 + 6^4 + 3^4 + 4^4 8208 = 8^4 + 2^4 + 0^4 + 8^4 9474 = 9^4 + 4^4 + 7^4 + 4^4 As 1 = 1^4 is not a sum it is not included. The sum of these numbers is 1634 + 8208 + 9474 = 19316. Find the sum of all the numbers that can be written as the sum of fifth powers of their digits.
[ { "docid": "3449dd75ee83b80747955ceb9e33427a", "score": "0.6831188", "text": "def sum_of_power(n)\n\tsum=[]\n\t(2..1000000).each do |value|\n\t\tarray = value.to_s.split('').collect{ |m| (m.to_i)**n }.inject(:+)\n\t\tif array == value\n\t\t\tsum << value\n\t\tend\n\tend\n\tsum\nend", "title": "" }...
[ { "docid": "87b4f1248337675123ca2b3329cc256f", "score": "0.79911506", "text": "def digit_fifth_powers\n sum = 0\n 0.upto(354294) do |i|\n fifth_powers = split_digits(i).map { |digit| digit ** 5 }\n sum_of_fifth_powers = fifth_powers.inject(:+)\n sum += sum_of_fifth_powers if sum_of_fifth_powe...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "43446e1c622dba2698c224c008833af6", "score": "0.0", "text": "def set_ssh_key\n @ssh_key = SshKey.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.60322535", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6012846", "text": "de...
533e0feef989abac123590f84d060555
Sets the chatInfo property value. The chatInfo property
[ { "docid": "7be0e27536751c5038b26f7e676ffe74", "score": "0.88720936", "text": "def chat_info=(value)\n @chat_info = value\n end", "title": "" } ]
[ { "docid": "97b235bd72edd44c40db1234e194c1d5", "score": "0.8930168", "text": "def chat_info=(value)\n @chat_info = value\n end", "title": "" }, { "docid": "8dc71312e465abe18c54652663d3aadc", "score": "0.67511034", "text": "def set_chat(chat)\n @msg.chat...
612bc8a3e252818cce1ede617aeed374
Execute a command on an Agent. Does not try to provision on failure
[ { "docid": "9f291d194bd56a4d75e392bb26580681", "score": "0.6405554", "text": "def exec_internal(agent, command)\n return CommandLog.log_exec(agent, command, @current_user) do\n exec_api(agent, \"shell_exec\", command.to_hash)\n end\n end", "title": "" } ]
[ { "docid": "d4c72d4373ab8b2118d77b45633c006e", "score": "0.7757467", "text": "def exec(agent, command)\n\n agent = get_model(agent, Agent)\n command = create_spec(command)\n\n ret = exec_internal(agent, command)\n\n if ret.success? || ret.code != 404 then\n return CommandRespo...
eb820a7e690d2258810f7544c661d371
===merge Helper method for mSort. Takes an array and four positions and merges the high and low of all four positions into the original array in sorted order. Much simpler using Ruby than other versions I've seen.
[ { "docid": "830ffe985ca36ffe5df3909f27737db1", "score": "0.67478245", "text": "def merge(target, trueLow, high, low, trueHigh)\n \t# First, build a temporary array to hold the values we're sorting. \n \t# We put the second half of the array in reverse order to allow us to \n \t# merge more eas...
[ { "docid": "8f3080d6ea1ac14e49f4ea53dd715187", "score": "0.74048454", "text": "def merge(arr, low, mid, high)\r\n left = arr.slice(low..mid)\r\n right = arr.slice(mid+1..high)\r\n l = r = 0\r\n for i in low..high\r\n if (l < left.length && (\r\n r >= right.length || \r\n left[l] < right...
a2099a77c85e91272ae2f9e35b937953
Only allow a trusted parameter "white list" through.
[ { "docid": "dffe60ef7502115384dbde353e0d6cc7", "score": "0.0", "text": "def virtual_machine_template_params\n params.require(:virtual_machine_template).permit(:id_at_site, :name, :state,\n :tenant_id,\n ...
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.79439425", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "f6060519cb0c56a439976f0c978690db", "score": "0.69581985", "text": "def permitted_params\n params.permit!\n end", "title...
f70f1d08c1df6b891e0e0c74f3173819
Metodo de validacion de columnas
[ { "docid": "da85068e2aa11125ceb1b06cb0d09855", "score": "0.0", "text": "def column\n if((0...3).collect {|i| @tab[i][0] } == @x_wins)\n winer_x\n elsif((0...3).collect {|i| @tab[i][0] } == @o_wins)\n winer_o\n elsif((0...3).collect {|i| @tab[i][1] } == @x_wins)...
[ { "docid": "0306ed1a642fd7b1b2726218e205388c", "score": "0.73059446", "text": "def result_columns_valid?\n return if self.result_columns.nil?\n for column in self.result_columns\n if column.blank? or !RESULT.respond_to?(column.to_sym)\n errors.add('result_columns', \"'#{column}' is not...
57dc30a71b14285a7829450df1230dd1
Adds worker to the service and appends it to the ordered worker list.
[ { "docid": "1756f3968b340d7a7fcba9a712733e3f", "score": "0.7897073", "text": "def add(worker)\n super\n @ordered_workers.unshift(worker)\n end", "title": "" } ]
[ { "docid": "1f1a1ff07c29ed91223df05b71e692ef", "score": "0.71883386", "text": "def add_worker(worker)\n idx = 0\n while idx < @worker_list.length && @worker_list[idx].connections < worker.connections\n idx += 1\n end\n if idx == 0\n @worker_list.unshift(worker)\n else\n @wo...
b690df00ff90d3b4838bb945037d41da
weighting applied and no gap considered
[ { "docid": "4002726bf9f39cade38f7836cacb5e24", "score": "0.0", "text": "def relative_probability_of(aa)\n @aa_rel_prbs[aa]\n end", "title": "" } ]
[ { "docid": "970ca7bdede3384ea936fe3fd1ca6928", "score": "0.7294602", "text": "def weight\n 0\n end", "title": "" }, { "docid": "ab39aaa7dc9c5fff643a487ee592465b", "score": "0.7290113", "text": "def weight; end", "title": "" }, { "docid": "ab39aaa7dc9c5fff643a487ee...
1e644be9d3adc8a1226a7c01e478e0df
POST /library_clips POST /library_clips.xml
[ { "docid": "3f83fe634ffcd4a6c7d90b7a2b94b5a6", "score": "0.5745358", "text": "def create\n @library_clip = LibraryClip.new(params[:library_clip])\n\n respond_to do |format|\n if @library_clip.save\n format.html { redirect_to(@library_song, :notice => 'Library clip was successfully crea...
[ { "docid": "5706a894f71f81542e6f6ca9e8725149", "score": "0.5794702", "text": "def create\n @clipping = Clipping.new(params[:clipping])\n\n respond_to do |format|\n if @clipping.save\n format.html { redirect_to(@clipping, :notice => 'Clipping was successfully created.') }\n forma...
066675d4dedb4f6f6bebce652b9d552f
Execute the Choreo using the specified InputSet as parameters, wait for the Choreo to complete and return a ResultSet containing the execution results.
[ { "docid": "6c82e210175d732957a85f0f9700772f", "score": "0.0", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = DeleteEntryResultSet.new(resp)\n return results\n end", "title": "" } ]
[ { "docid": "ea872306361fc864408e8279b0199bbe", "score": "0.7593966", "text": "def execute(input_set = nil)\n resp = super(input_set)\n results = QueryResultSet.new(resp)\n return results\n end", "title": "" }, { "docid": "bf6609d69b18cbe3a5f620c672c2cbbf", "score": "0.7...
086e5c74008530321702c2801f23509d
Completions are called when you enter (or are in) either a :failed or a :succeeded state. They are stored as a special (reserved) state called :completed. source://eventmachine//lib/em/completion.rb218
[ { "docid": "bf77179ff992a66002761ba0c8b21b88", "score": "0.5892761", "text": "def completion(*a, &b); end", "title": "" } ]
[ { "docid": "14d7eac1ca634ee5659bb80894ba8309", "score": "0.7108649", "text": "def completion_states; end", "title": "" }, { "docid": "658b0eed07e11b1f949f9e9eb4d6b4be", "score": "0.70760363", "text": "def completion_states\n [:succeeded, :failed]\n end", "title": "" }, ...
dfcb68641cfa516d5d47095c9636ae32
fibonacci make a method that generatates fibbonacci numbers in an array be able to find
[ { "docid": "b68489331fa663368f33a2e7e68ad51d", "score": "0.0", "text": "def fib(n)\r\n \r\n return n if n <= 1\r\n \r\n (fib(n - 1) + fib(n - 2))\r\n #p fibon\r\nend", "title": "" } ]
[ { "docid": "d9319d3567fcb3144dea3273b224622c", "score": "0.8137366", "text": "def fibonacci_iterative(n) # METODO ITERATIVO\n \n# def fibonacci_iterative(n)\n# array = [0,1]\n# until (array.length - 1) >= n\n# array << (array[-1] + array[-2])\n# end\n# array[n]\n# end\n array_fibona...
a719092ff2ea9444f7ab0efd5a98ab73
Modifies the current user. Takes any of the parameters of create, but not necessarily all.
[ { "docid": "a4aff04ca1c403239158d639cde4f2e7", "score": "0.0", "text": "def update\n session[:user].set_password params[:password] if params[:password]\n set_properties session[:user]\n session[:user].save\n @result = { user: session[:user].private_description, success: true }\n end", "...
[ { "docid": "53fd32cf490cfd3b09b33376bfd5a19b", "score": "0.7359644", "text": "def set_user\n UserInfo.current_user = current_user\n end", "title": "" }, { "docid": "1cc73f80b5e7223c0981bec93b023107", "score": "0.7302821", "text": "def set_user\n if @user\n \t\t edi...
04b2f2e798ad60b2f4dc329543743f67
method for converting form based on index
[ { "docid": "e24d9d5cfb41c92821c807bde5b993b1", "score": "0.7301651", "text": "def convertform(index)\n\t\t# return form binary value\n\t\treturn @@allForms[index][\"binary\"]\n\tend", "title": "" } ]
[ { "docid": "8bdc5c704b7ce769a293855814d77566", "score": "0.6406764", "text": "def index_to_input(index)\n (index + 1).to_s\n end", "title": "" }, { "docid": "f5f2f617fcf763e8c41310da2e470b64", "score": "0.6027246", "text": "def convert_offer_by_index(idx)\n raise NotIm...
23b83b3eac28bc0b9c3616b79a4a6137
before_filter :get_follow, :only => [:destroy]
[ { "docid": "65f75b0e7f8f33b10629083b1c5d332a", "score": "0.0", "text": "def new\n @follow = @followable.follows.build\n end", "title": "" } ]
[ { "docid": "6134066091c751006b8be2d2081ee46a", "score": "0.72638613", "text": "def destroy\n @follow = Follow.where(:follower_id => session[:user_id], :followee_id => params[:id])\n @follow.destroy\n\n respond_to do |format|\n format.html { redirect_to :back, notice: \"You are now longer f...
618901195c157d1f2e0946c2a55e0cf6
Enabled everytime a char is pressed in a texbox
[ { "docid": "630eaae91b3ec98cd046199545645451", "score": "0.0", "text": "def try_to_write(widget)\n\n \t# interrompe thread di scrittura se esiste, altrimenti scritture multiple\n\t\t\t@tmain.kill if @tmain.is_a? Thread\n\n \t@previous_title= widget.text\n\n \t#Thread principale\n \t@tmain= T...
[ { "docid": "55a795885442817ab8167d8cfe818bf7", "score": "0.68020844", "text": "def handle_key ch\n if ch == 32\n toggle\n @repaint_required = true # need to change the label\n else\n super\n end\n end", "title": "" }, { "docid": "e068545b82f34fa4f4e21c6...
4c50de96f112dddac2f415c419fa0a84
an empty array accessible to all methods
[ { "docid": "92ca42577392b99b3b52b5f93b6640a4", "score": "0.0", "text": "def print_menu\n # print the menu and ask the user what to do\n puts \"1. Input the students\"\n puts \"2. Show the students\"\n puts \"3. Save the list to a file\"\n puts \"4. Load the list from students.csv\"\n puts \"9. Exit...
[ { "docid": "5ce8381bb8c21395e1a80fdba9a3cedf", "score": "0.7548412", "text": "def create_an_empty_array\n []\nend", "title": "" }, { "docid": "5ce8381bb8c21395e1a80fdba9a3cedf", "score": "0.7548412", "text": "def create_an_empty_array\n []\nend", "title": "" }, { "docid...
a4f17685e4c62aadc9ae0a9fbbd4e108
Returns true if the car has been successfully removed Returns false otherwise
[ { "docid": "0025f3df25cb6c0a4e3e3c60ba8fae4f", "score": "0.77894175", "text": "def remove_car(car)\n for c in @cars\n if c.get == car.get\n @cars.delete(c)\n return true\n end\n end\n\n return false\n end", "title": "" } ]
[ { "docid": "91ba2e40e8b35756129088bfb3cac5f6", "score": "0.6899573", "text": "def removed?\n (status == REMOVED)\n end", "title": "" }, { "docid": "91ba2e40e8b35756129088bfb3cac5f6", "score": "0.6899573", "text": "def removed?\n (status == REMOVED)\n end", "title": "" }...
e5b9d52dc1b0706fbc247f912e53218f
Increase or decrease horizontal and vertical scale for the image. 1.0 is identical to the current scale. If y_scale is omitted, x_scale is used for both axes. TODO: Take vectors for first args as well
[ { "docid": "e13597b94b2259ddf97d7197e6354882", "score": "0.68419564", "text": "def image_scaling(x_scale, y_scale = nil)\n y_scale = x_scale if y_scale.nil?\n store_image(@image.get_scaled_copy(x_scale.to_f * image_size.x, y_scale.to_f * image_size.y))\n end", "title": "" } ]
[ { "docid": "5b33606e84a78c45740d7d47a4c9a5fd", "score": "0.73744816", "text": "def scale scale_x, scale_y = nil\r\n scale_y = scale_x unless scale_y\r\n @gr.scale scale_x, scale_y\r\n end", "title": "" }, { "docid": "e3442e4257591c1b40cf5b56ca6c9261", "score": "0.7133796", "te...
44c696ff9eb6a42401f0ed140beb29ae
add a new Question to this Category and return the new Category object
[ { "docid": "516538fd28f6d0cf12a0e84ba9808acb", "score": "0.0", "text": "def add_new_default_question(question_type, label=nil, author = nil, definition={} )\n author ||= User.get_user_system\n questions_genuine << (new_question = Question.create_default(author, question_type, label, definition))\n...
[ { "docid": "b2874f6e62f52fa1ba9d261df40e14d7", "score": "0.81782436", "text": "def add_category(name)\n category = Category.find_or_create_by_name(name)\n category.add_question(self)\n end", "title": "" }, { "docid": "b1e446131be95bfb05f2a9c391a321af", "score": "0.7108226", "t...
fb72cf64bad04c8b1ef65a19ddd93067
we need this to be able to pass in a product when adding an account Method to return fully qualified domain name
[ { "docid": "f4d45faff9703ad817b7a156b8a43ef5", "score": "0.5673607", "text": "def fqdn\n if(self.host_name != nil) and (self.host_name != '')\n [self.host_name, self.domain_name].compact.join('.')\n else\n self.domain_name\n end\n end", "title": "" } ]
[ { "docid": "39015931014e8e31cc4fcf43d0ed6f35", "score": "0.66689956", "text": "def domain_name; end", "title": "" }, { "docid": "39015931014e8e31cc4fcf43d0ed6f35", "score": "0.66689956", "text": "def domain_name; end", "title": "" }, { "docid": "8c858a45f7bcd915b267dc5204...
a59c8c58616fd83bb80717f507efe538
Calculate the digest of a directory at the given path. Each file in the directory is read in binary chunks to prevent excess memory usage. Filesystem entries of all types are included in the digest, including directories, links, and sockets. The contents of nonfile entries are represented as: $type $path while the cont...
[ { "docid": "2ad985cb30171e1676881eeef8867da7", "score": "0.7976256", "text": "def digest_directory(path, type = :md5, options = {})\n digest = digest_from_type(type)\n log.info(log_key) { \"Digesting #{path} with #{type}\" }\n FileSyncer.all_files_under(path, options).each do |filename|\n...
[ { "docid": "eb0840972cc1ae2dbaa8e8b1310297e3", "score": "0.7909444", "text": "def file_digest(path)\n if stat = self.stat(path)\n # If its a file, digest the contents\n if stat.file?\n digest.file(path.to_s)\n\n # If its a directive, digest the list of filenames\n ...
9a50c9de90b4e6489ecd70df3c35e641
the board array, the index in the board array that the player would like to fill out with an "X" or an "O", and the player's character (either "X" or "O"). The third argument, the player's character, should have a default of "X"
[ { "docid": "4d6e8a2435283a5ecd590e70f458b46f", "score": "0.6941881", "text": "def move(board, place, char=\"X\")\n board[place] = char\nend", "title": "" } ]
[ { "docid": "be65598fc337bfa768cc6ea13d1d13d7", "score": "0.7828444", "text": "def move(index, character = \"X\")\n if character == \"X\"\n @board[index] = \"X\"\n else character == \"O\"\n @board[index] = \"O\"\nend\nend", "title": "" }, { "docid": "878d98e1152e31e48ef7aa1df2af4e5d",...
33781e8fb4ab22ab974232a70a3d09ae
GET /pages/1 GET /pages/1.json
[ { "docid": "60df884c35d3b3b4a718d5feccf527a6", "score": "0.0", "text": "def contact\n end", "title": "" } ]
[ { "docid": "64e61b39be3e009082a46bd86ef7f8cc", "score": "0.77813053", "text": "def index\n @pages = Page.page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pages }\n end\n end", "title": "" }, { "docid": "0e06be4547a...
aba39b0f1b2131a1461c78091d1f4c84
Returns true if the given application instance is the current top level application
[ { "docid": "c2569635dc5f3dc3b620c413e6334f05", "score": "0.77709156", "text": "def current?\n # If this is called before the plugins are loaded (i.e. by a plugin's application file), then\n # it is definitely not the top-level app\n if Origen.application_loaded?\n Origen.app == sel...
[ { "docid": "20fdfeb38740545262aa4682f7464ddc", "score": "0.8041767", "text": "def has_current_application?\n not self.current_application.nil?\n end", "title": "" }, { "docid": "e100151c47d7dc0bde8f8a76ca49d4ca", "score": "0.7334613", "text": "def is_app_instance?\n if @servic...
0b1901b9fd6835bad32fb978a69ba133
Takes an array, returns a frequency array by day
[ { "docid": "b1ef279a787eaf15574b3ddef04eb95e", "score": "0.69916284", "text": "def graph_by_day(array)\n array.sort!{|x,y| x.created_at <=> y.created_at}\n finish = array.last.created_at + 1.day\n start = array.first.created_at -1.day\n days = []\n day = start.midnight\n while day < fi...
[ { "docid": "8d41f180c3f5946d9bc5aaf426ba49ef", "score": "0.73602057", "text": "def frequency(array)\n array.inject(Hash.new(0)) { |h,v| h[v] += 1; h }\n end", "title": "" }, { "docid": "61963131e0f52bc7b44ec1b1fec624f0", "score": "0.7093007", "text": "def one_way_freq \n...
dfb9d03c6d560b22f4d0ee649386d5f0
Return value should be the same array object, do not use reverse or reverse! Take the array and take the length of the array times to iterate through each iteration use Arrayunshift(Arraypop) This will take an element from the end of the array and put it to the start Return the array at the end
[ { "docid": "1ec3c4798255ecddc7152d2d0bb411a8", "score": "0.0", "text": "def reverse!(arr)\n index = 0\n (arr.length).times do\n arr.insert(index, arr.pop)\n index += 1\n end\n arr\nend", "title": "" } ]
[ { "docid": "1d346d6a5841ba1b03105856a81ef8d1", "score": "0.78836703", "text": "def reverse(array)\n result_array = []\n array.each { |element| result_array.unshift(element) }\n result_array\nend", "title": "" }, { "docid": "8cc01f1edab80b73e4d75d8052b3a5dd", "score": "0.7852241", ...
22580aaf2a6271b647a629088b01de33
PATCH/PUT /items/1 PATCH/PUT /items/1.json
[ { "docid": "fac6758699959643ff13240d887e8394", "score": "0.0", "text": "def update\n if @item.update(item_params)\n render :show, status: :ok, location: @item\n else\n render json: @item.errors, status: :unprocessable_entity\n end\n end", "title": "" } ]
[ { "docid": "0886720a82e037d1feaa9397bf1e4d5f", "score": "0.74256986", "text": "def update\n item = Item.find(params[\"id\"])\n item.update_attributes(items_params)\n respond_with item, json: item\n end", "title": "" }, { "docid": "ab7b511e7fdb14f278ada05c46659bfc", "score": "0....
3cba39d40deff2ed448928076f9846d2
get 6 parent categories name and firstchild categories for homepage
[ { "docid": "5cb21384af67d878b32f9a2048c2121e", "score": "0.6760347", "text": "def get_cates_descs\n categoryDescArr = []\n categoriesRoot = Category.where(parent_id: 0).limit(6)\n categoriesRoot.each do |parentCate|\n cateInfo = []\n firstChildren = Category.where(parent_id: parentCat...
[ { "docid": "e218e6539f409a74535f5ec9ebbc5da8", "score": "0.72320694", "text": "def top_level_categories\r\n Category.where(parent_id: 0).order(:name).limit(8)\r\n end", "title": "" }, { "docid": "a0254045a3dc4ed5a3bc92332ef36078", "score": "0.68332005", "text": "def categories\n...
b3a4e041315bfc301c661bb77456d016
Elrey and Jack Loftus
[ { "docid": "70300624d268acc41e853a4882ac691d", "score": "0.0", "text": "def foo(array)\n\tarray.each {|item| puts \"This is an item in the array: #{item}\"}\nend", "title": "" } ]
[ { "docid": "908a75d2715d45fa47a68ef923e9a084", "score": "0.6696695", "text": "def sereward_laking_tuchunize()\n end", "title": "" }, { "docid": "bc658f9936671408e02baa884ac86390", "score": "0.6530128", "text": "def anchored; end", "title": "" }, { "docid": "a9dd648a5d0...
17515aff532e51d80130a487c85861dc
use the math type inputted by the user to determine which math function to use All math functions return values, which will be returned by assign_type
[ { "docid": "87a0dda7cba08ac46898d0d51491462d", "score": "0.7683503", "text": "def assign_type(math_type)\n\tcase math_type\n\twhen 1\n\t\tputs 'Ok, addition. Give me two numbers to add. First number:'\n\t\tnum1 = get_it\n\t\tputs 'Second number:'\n\t\tnum2 = get_it\n\t\taddition(num1, num2)\n\twhen 2\n\...
[ { "docid": "f95fe3ddbc9ea75871f3251a91f4d940", "score": "0.70760816", "text": "def basic_type\n \tputs \"Type 1 to add, 2 to subtract, 3 to multiply, 4 to divide, 5 to square two numbers, 6 to find the squareroot and 7 for your bmi: \"\n\toperator = gets.to_f\n\n\tif operator == 1 \n\t\t\"add\"\n\telsif...
51e3b36603d760768dfbd631ec802690
POST route to receive info needed to create a Buyer
[ { "docid": "24ff5d1c0aa0f6078ce2176d4eacaf6f", "score": "0.808003", "text": "def create\n # YOUR CODE HERE\n # Receive the parameters in the `params` hash and create a new Buyer object!\n end", "title": "" } ]
[ { "docid": "1ccf36af58835a226694a9fa61e5326c", "score": "0.74278224", "text": "def create\n @buyer = Buyer.new(params[:buyer])\n\n respond_to do |format|\n if @buyer.save\n format.html { redirect_to @buyer, notice: 'Buyer was successfully created.' }\n format.json { render json:...
dca9474924549c5b59dcc5cb85351e70
This is so SolrObserver can easily call metaphors on each object it's observing.
[ { "docid": "08824950a6a65545a782e5546cb961d4", "score": "0.0", "text": "def metaphors\n self.authors.map{|a|a.metaphors}.flatten.uniq\n end", "title": "" } ]
[ { "docid": "5c8deb19f186b2a188ea62c4451b93d2", "score": "0.671892", "text": "def after_save(object)\n logger.info \"SolrObserver: A #{object.class} was just saved! Updating #{object.metaphors.size} solr documents...\"\n update_solr(object)\n end", "title": "" }, { "docid": "b4253a7e10...
0b4f60bdc9d37df5b6384842844daafa
Print "Brands" in ascii art For each brand in the data set: Print the name of the brand Count and print the number of the brand's toys we stock Calculate and print the average price of the brand's toys Calculate and print the total sales volume of all the brand's toys combined Call methods to make brands section
[ { "docid": "294d09df2d00b76d28ab31c457a010e8", "score": "0.79607546", "text": "def makes_brands_section\n items = $products_hash[\"items\"]\n brands = items.map {|item| item[\"brand\"]}.uniq\n\n brands.each do |brand|\n by_brand = items.select { |item| item[\"brand\"] == brand}\n\n ...
[ { "docid": "203177d2f7359535580b4e86ccbb0c64", "score": "0.85024273", "text": "def make_brands_section\n ascii_art_brands\n brands.each do |brand|\n print_brand_name(brand)\n print_toys_stock(calc_toys_stock(brand))\n print_avg_price_toys(avg_price_toys(calc_total_price_toys(brand), brand))\n...
77cdf961f5e1d3aab3d6a08f21f776d0
GET /new_tests/1 GET /new_tests/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "ee1acba817d32315a7e9447c810a7abe", "score": "0.7400622", "text": "def new\n @testspec = Testspec.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @testspec }\n end\n end", "title": "" }, { "docid": "75e0f3f9b25e543932187...
1c84390d2a400055ab70977217256997
PATCH/PUT /people/1 PATCH/PUT /people/1.json
[ { "docid": "73a167c23e20c1d313c6c306e366b9b6", "score": "0.62808484", "text": "def update\n @people.user_updated_id = current_user.id\n respond_to do |format|\n if @people.update(people_params)\n format.html { redirect_to @people, notice: 'Persona actualizada con éxito.' }\n for...
[ { "docid": "6eddf15605851198cb1f19714d1003f9", "score": "0.7046235", "text": "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json...
bd0a1a902db8f4daca5670791f1197bb
Looks through all users to find user with a speific username
[ { "docid": "713e21ab80b46aaa186bead18ead81e7", "score": "0.7543863", "text": "def getUserByUsername(username)\n \n @users.each {|user| \n if user.getUsername == username\n return user\n end\n }\n\n return nil\n \n end", "titl...
[ { "docid": "5dd39e72dc44abf84b91a9fe65c1399c", "score": "0.8499954", "text": "def find_user(username)\n @users.values.find_all { |e| e.username == username }\n end", "title": "" }, { "docid": "d9a23abcc3568cc5564775f7219c8c04", "score": "0.80937344", "text": "def find_user_by...
cec1f2ce57b45f0c4d141308db701851
Replaces the whole file content with the new content
[ { "docid": "927311ab5b1da09b44bc96a92e3344e0", "score": "0.75148726", "text": "def replace(id, new_content)\n File.write(find(id), new_content)\n end", "title": "" } ]
[ { "docid": "5ca72798ca78e86a9be61c6d8ff56161", "score": "0.8065329", "text": "def modify_content(source, content, replace_value)\n file = File.read(source)\n replace = file.gsub(/#{content}/, replace_value)\n File.open(source, \"w\"){|f|\n f.puts replace \n }\n end", ...
e659e374f9df85d7ab80e1d34d61869b
Returns the value of the `id` attribute.
[ { "docid": "84607347a1c54679a8961c8525fed15e", "score": "0.0", "text": "def id\n @id\n end", "title": "" } ]
[ { "docid": "d800b257bfdc34d27ff1f519d573830d", "score": "0.8528124", "text": "def id\n (a = attribute('id')).nil? ? a : a.value\n end", "title": "" }, { "docid": "fe58cf24252be77de724e98700a5aef0", "score": "0.82572293", "text": "def id # :nodoc:\n @attributes[ 'id' ]\n ...
002d10952e8f2e65a79a084ea62719cb
Delete an invite by its code.
[ { "docid": "4d11fe45b0ef1841cf28a02a4810e650", "score": "0.85348535", "text": "def delete_invite(invite_code, reason: nil)\n route = Route.new(:DELETE, '/invites/%{invite_code}', invite_code: invite_code)\n request(route, reason: reason)\n end", "title": "" } ]
[ { "docid": "afde596e2ab4344e3da3e99201946f51", "score": "0.7483851", "text": "def destroy\n @invite_code = InviteCode.find(params[:id])\n @invite_code.destroy\n\n respond_to do |format|\n format.html { redirect_to(invite_codes_url) }\n format.xml { head :ok }\n end\n end", "t...
6cdc22b30bde8d2ce41c23722e6832ac
Translate hash keys/values into SQL conditions.
[ { "docid": "aca2d3c495488c67565bfda31c960f9e", "score": "0.6558469", "text": "def sql_clauses(hash, join: :and, connector: join)\n result = hash.map { |k, v| sql_clause(k, v) }.compact_blank!\n connector &&= connector.to_s.strip.upcase\n connector ? result.join(\" #{connector} \") : result\n e...
[ { "docid": "79773473c935fcb0e40ef1d4a6d10bcb", "score": "0.7059284", "text": "def hash_to_condition(table, hash)\n conditions = hash.map do |attr, value|\n if value.is_a?(Array) && value.size > 1\n table[attr].in(value)\n elsif value.is_a?(Array)\n table[attr].eq(val...
01a10acddb4b1b199a469dffdef2731b
GET /graphs GET /graphs.json
[ { "docid": "53797584c4cb277a16b1ec65f1e0340d", "score": "0.7361771", "text": "def index\n @graphs = Graph.where(:user_id => current_user_id)\n\n if @graphs.count > 0\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @graphs }\n end\n el...
[ { "docid": "a77f3750dc2720d681e37dc0d2b4f7cc", "score": "0.768263", "text": "def get_graphs_data\n service_response = DashboardManagement::GetGraphsData.new(params).perform\n\n if service_response.success?\n render :json => service_response.data\n elsif\n service_response.http_code = ...
6a0a1f45fe2ea2efa5a1d4357d3787eb
DELETE /registros/1 DELETE /registros/1.json
[ { "docid": "c2c39594321b76df87b6b40f2d6260cd", "score": "0.0", "text": "def set_registro\n if(Registro.where(id: params[:id] ).length>0)\n @registro = Registro.find(params[:id])\n\n else\n respond_to do |format|\n format.html { redirect_to personas_url, alert: '<i class=\"fa fa-ex...
[ { "docid": "689954d031232e6847710dd58ed2129f", "score": "0.72331303", "text": "def destroy\r\n @comite_registro.destroy\r\n respond_to do |format|\r\n format.html { redirect_to comite_registros_url, notice: 'Su petición para registrar su comité tutorial fue eliminada.' }\r\n format.json ...
fd0826cfa749ebb67e492c2e85af23e3
Returns the mailbox portion of the local port, with no tags. Usually, this can be considered the user account or role account names. Some systems employ dynamic email addresses which don't have the same meaning.
[ { "docid": "337f61c6e8fbdfcfc5ec3d7d203fa671", "score": "0.7386057", "text": "def mailbox\n @local.mailbox\n end", "title": "" } ]
[ { "docid": "50e3a72595b02f1c7cf71c2edfe0aaec", "score": "0.79385144", "text": "def mailbox\n @mailbox || to.split('@')[0]\n end", "title": "" }, { "docid": "163e631fc82eee215eac1f850a6e2035", "score": "0.7549145", "text": "def mailbox\n local.mailbox\n end", "title": ...
4fd4dfaee5529d571113532a65a15b1b
GET /inventory(/:id)/inventory Get an inventory by an Inventory ID
[ { "docid": "26512e414e7fd3aea977293d21a22ba2", "score": "0.65465975", "text": "def get_inventory\n respond_to do |format|\n format.json { render json: { success: true, item: @inventory } }\n end\n end", "title": "" } ]
[ { "docid": "3850bc6899d84c591c735d35e8670b1f", "score": "0.847445", "text": "def get_inventory(id, params={})\n validate_id!(id)\n execute(method: :get, url: \"#{base_path}/items/#{id}\", params: params)\n end", "title": "" }, { "docid": "227636a6f0490335e71534bdfbba670a", "score"...
e528564f287710d4ac26f4d328ed19c1
This patch adds the implementation of osdep_get_cwd for Darwin platform, so that tmux can get current working directory correctly under Mac OS. NOTE: it applies to 1.6 only, and should be removed when 1.7 is out. (because it has been merged upstream)
[ { "docid": "7eaab53b1d9bdfbe4d7f15d4a8670809", "score": "0.0", "text": "def patches\n DATA if ARGV.build_stable?\n end", "title": "" } ]
[ { "docid": "59e86cceddd7046c89d8cccb8d40e354", "score": "0.6358202", "text": "def cwd\n @cwd ||= begin\n exec! 'pwd'\n rescue => e\n raise e\n '/'\n end\n end", "title": "" }, { "docid": "735dc6953952ad22e4b5f8459784ddce", "score": "0.6036524", "text": "def c...
908e3dd9fe13881b1d33ddb128112c9d
Ensure the lat/lon is formatted as a decimal e.g. not 4.0e05
[ { "docid": "a25de074fc9e1348171177340505c4d2", "score": "0.54354477", "text": "def test_lat_lon_xml_format\n node = build(:node, :latitude => 0.00004 * OldNode::SCALE, :longitude => 0.00008 * OldNode::SCALE)\n\n assert_match /lat=\"0.0000400\"/, node.to_xml.to_s\n assert_match /lon=\"0.0000800\...
[ { "docid": "104cf0eb933017ba9e0425241d2db989", "score": "0.68799126", "text": "def to_s\n prec = error_defined? ? \" +-#{@error.round()} m\" : ''\n valid? ? \"#{format(@latitude, 'NS')} #{format(@longitude, 'EW')}#{prec}\" : ''\n end", "title": "" }, { "docid": "fef8252caebc267e122e43...
25f93db5a7df5502840406d4ec4a5da6
POST /homers POST /homers.json
[ { "docid": "adae799f143cf9b2f3f1160fee075abd", "score": "0.6023311", "text": "def create\n @homer = Homer.new(params[:homer])\n if params[:horace_id]\n @horace = Horace.find(params[:horace_id])\n @intertext = Intertext.new\n @intertext.horace = @horace\n @intertext.homer = @hom...
[ { "docid": "62d08ab921a0d1ef42291a54d4198c92", "score": "0.73872566", "text": "def create\n @homer = Homer.new(params[:homer])\n\n respond_to do |format|\n if @homer.save\n format.html { redirect_to @homer, notice: 'Homer was successfully created.' }\n format.json { render json:...
e94b456dbefbea51fa8533743dd8aebb
POST /organisaties POST /organisaties.json
[ { "docid": "4d34eac92b2ba0124f641d449d8414fb", "score": "0.69193375", "text": "def create\n @organisatie = Organisatie.new(organisatie_params)\n\n respond_to do |format|\n if @organisatie.save\n format.html { redirect_to @organisatie, notice: 'Organisatie was successfully created.' }\n...
[ { "docid": "3f88b0f513d47c4f38a06ddd7174b9e8", "score": "0.6835228", "text": "def create\n @organism = Organism.new(params[:organism])\n\n respond_to do |format|\n if @organism.save\n format.html { redirect_to @organism, :notice => 'Organism was successfully created.' }\n format...
928c43e45a97a3bfde85636074831e10
This function calculates the value of a word based on its letters
[ { "docid": "3ba7c4a672ba201c6fcea992a8a4ac23", "score": "0.70625687", "text": "def calculateWordValue(lets)\n sum = 0\n for i in 0..lets.length-1\n sum += $points[lets[i]]\n end\n return sum\nend", "title": "" } ]
[ { "docid": "7b7e29042ac8a45ea85dde2af9abc1f5", "score": "0.8210654", "text": "def word_value(word)\n val = 0\n word.split('').each { |c| val += 2 ** 'abcdefghijklmnopqrstuvwxyz'.index(c) }\n val\nend", "title": "" }, { "docid": "fc99822f35b77e6ecedc36e3521030c2", "score": "0.77968246"...
beafdde53cbdb420fb9467aafb7997a6
HTML/XML escape a string, based on CGI module
[ { "docid": "280e43ef8cde574cbc5e03e002e2acb1", "score": "0.0", "text": "def h(string)\n\tstring.gsub(/&/, '&amp;').gsub(/\\\"/, '&quot;').gsub(/>/, '&gt;').gsub(/</, '&lt;')\nend", "title": "" } ]
[ { "docid": "e3ad8c4d93c6682c3739b3efa49d08fb", "score": "0.86624897", "text": "def html_escape(string); end", "title": "" }, { "docid": "abccbae7d0b74e12c0d4ab4ffd089614", "score": "0.8389503", "text": "def html_escape(s); end", "title": "" }, { "docid": "abccbae7d0b74e12...
10fccbd9e9e42c18727e32d17b68623e
Get the tuple space for distributed processing
[ { "docid": "e2518e92a0c34247aae8f5d14451bb4f", "score": "0.70773965", "text": "def tuple_space\n unless @tuple_space \n DRb.start_service\n ring_server = Rinda::RingFinger.primary\n\n ts = ring_server.read([:name, :TupleSpace, nil, nil])[2]\n @tuple_space = Rin...
[ { "docid": "5ad82001ac0851cd72d6260f8846e95c", "score": "0.6876136", "text": "def get_tuple_space(tuple_space_id)\n @tuple_space\n end", "title": "" }, { "docid": "0a8f49c69c00fd8da983bed21a3eb20a", "score": "0.67566735", "text": "def tuple_space_server\n @__tuple_sp...
441dcae2778efb33b8758dffa6f25710
GET /switts GET /switts.json
[ { "docid": "f7df549d9e0a659ca62113f7fc45d837", "score": "0.65698767", "text": "def index\n @switts = Switt.all\n end", "title": "" } ]
[ { "docid": "7bf278041bd23f7564ff918e871cb1cc", "score": "0.6861649", "text": "def index\n @sightings = Sighting.all\n render json: @sightings\n end", "title": "" }, { "docid": "c19c2eced75cc6a85d669c9ed6a1e850", "score": "0.6609658", "text": "def index\n @swits = Swit.all\n...
e323051b350780313b3dc76be00bc861
Return if value presents in mask (raw value) and mask set
[ { "docid": "cdc123d27b5757c267d8e7df9bd9a157", "score": "0.5734924", "text": "def value?(column_name, val)\n ![0, false].include?(send(column_name) & val)\n end", "title": "" } ]
[ { "docid": "2e7b3188a4a7075d337c03f3826db711", "score": "0.72434354", "text": "def mask\n raw_value\n end", "title": "" }, { "docid": "2294faf92083f1b64413341e5e9407fe", "score": "0.71487373", "text": "def masked_val(value, mask)\n \nend", "title": "" }, { "d...
cd05e1a89e0b6873828e904d3852f4be
Provide a detailed, user friendly representation source://twilioruby//lib/twilioruby/rest/pricing/v1/messaging/country.rb177
[ { "docid": "473108fa97cee58671b779c2ccfec06f", "score": "0.0", "text": "def inspect; end", "title": "" } ]
[ { "docid": "565ab42a99ac31b200699b11d49e3a09", "score": "0.75156283", "text": "def message_country\n countries = self.travels.country\n return nil if countries.blank?\n n = AppConfig.shown_countries\n if countries.size == 1\n ctext = countries.first.countryname\n elsif countries.size...
050a6751bf9b1361f6e6a793badf7d62
Create permissions by credential privileges
[ { "docid": "259363bd8d4148fd9bedba7dcac4573a", "score": "0.73172385", "text": "def create_credential_permissions(credential)\n all_privileges = credential.privilege?('*')\n is_slice_cred = credential.type.eql?('slice')\n is_user_cred = credential.type.eql?('user')\n\n debug \"is_slic...
[ { "docid": "96f1b17eb518f273c837b157c2603cda", "score": "0.7335878", "text": "def create_permissions\n if user_groups.include?('admin_group') || user_groups.include?('gis_cataloger')\n can [:new, :create], ActiveFedora::Base\n end\n end", "title": "" }, { "docid": "377123d7a9285f...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "54d22735abb536da5660f4150c8e7b3e", "score": "0.0", "text": "def oui_params\n params.require(:oui).permit(:prefix, :manufacturer)\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...
2e4da1ca4957f9e79f866362b53f160a
Called when a recording is stopped
[ { "docid": "1c5646112bfb0d153b9534d8c420e5a4", "score": "0.0", "text": "def on_stop &block\n block_given? ? @on_stop = block : @on_stop\n end", "title": "" } ]
[ { "docid": "2d776d637388b8518f009c73c405bd2b", "score": "0.7412278", "text": "def stop_recording\n cm_status = status\n new_params = {:event_id => event.cm_event_id,\n :session_id => cm_session_id,\n :status => SESSION_STATUS[:recorded]}\n cm_status.load(...
8769bac109e0469717cad7b33b766d8c
GET /aseguradoras/1 GET /aseguradoras/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "f3bdb2a7844db693d13c611cf6542261", "score": "0.7410044", "text": "def show\n @asesoria = Asesoria.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @asesoria }\n end\n end", "title": "" }, { "docid": "766ab...
271f1e2836541e62bd5eeda617a27703
we want to determine if all of the repos provided in request are part of the given profile
[ { "docid": "4ebb6be667bebdf29038d6c9e2d4b541", "score": "0.6605276", "text": "def valid_repos?(profile_id, repos)\n allowed_profile_repos = DeploymentProfile.find_by_profile_id(profile_id).repos.pluck(:repo_name)\n invalid_repos = repos.keys.select { |repo| !allowed_profile_repos.include?(repo) }\...
[ { "docid": "34becea3eef789ccd515d426a9335776", "score": "0.61333215", "text": "def profile_complete?\n self.subdomain.present? && self.name.present? && self.owner.profile_complete?\n end", "title": "" }, { "docid": "48a1945c5593461ecdf2329ab52fca7f", "score": "0.60577446", "text"...
eec91b69c483109e84fcf3f2fb815c7e
Helper to read a JSON
[ { "docid": "c55b738c332caaeb62d290a2cbf3a048", "score": "0.7631592", "text": "def read_json(path)\n return JSON.parse(File.read(path).rstrip)\nend", "title": "" } ]
[ { "docid": "5285a36c7787417c5f1dc50508078f56", "score": "0.87566924", "text": "def read_json; read.from_json; end", "title": "" }, { "docid": "a9ec941d813f074397462c2a33725b3f", "score": "0.8071866", "text": "def read\n JSON.parse(File.read(@json))\n end", "title"...
693401950dd824a42ab12f8dd82524c4
Problem 4: You have array of integers. Write a recursive solution to determine whether or not two adjacent elements of the array add to 12.
[ { "docid": "6426f136b4b715b318c9799198a527c6", "score": "0.73397595", "text": "def add_to_twelve?(array)\n return false if array.count < 2\n return true if array[-1] + array[-2] == 12\n add_to_twelve?(array[0..-2])\nend", "title": "" } ]
[ { "docid": "c807f524dd9b57512c70649ef548632a", "score": "0.7883079", "text": "def adjacent_elements(array)\n return false if array.length <= 1\n array[0] + array[1] == 12 || adjacent_elements(array[1...-1])\nend", "title": "" }, { "docid": "cfe2ff699e2cb80ced7b490b5b68297f", "scor...
21e9bc1f586db152f11c66856fea0316
Push the local git repo to gitlabhq
[ { "docid": "0757e0c54c8f7efa78054e4b89cd3d00", "score": "0.84405315", "text": "def push\n create_remote\n begin\n raise \"repo does not exist\" unless GitlabAPI.project_set.include? name\n puts \"#{name} starting push\"\n cmd \"cd #{git_dir} && git remote add origin #{git_url}\"\n ...
[ { "docid": "7a54ee9f1645e5be94746e27bf704859", "score": "0.73769325", "text": "def push_remote_repo\nend", "title": "" }, { "docid": "dd89cbd0f02b2838f49a86a9dda4e73b", "score": "0.73765886", "text": "def push\n logger.info \"pushing changes to git \"\n cmd = `git --git-dir...
b01f0a6ab612136527f9d6e5f9f72974
If it's the final frame, goes to special roll assignment logic. If roll_one_val is not assigned: update roll_one_val with pins_down and set the frame status to pending if the frame was a strike If the frame exists and has a roll_one_val, but was not a strike and does not have a roll_two_val: update roll_two_val with pi...
[ { "docid": "8f763f874df0b70c083304b97ab0ff33", "score": "0.7630319", "text": "def update_roll_value\n\n return assign_roll_values_for_final_frame if frame.frame_number == 10\n\n if !frame.roll_one_val\n frame.roll_one_val = pins_down\n set_frame_to_pending! if frame.strike?\n elsif fr...
[ { "docid": "a554f420a32515d30cddcc2dcc05852d", "score": "0.7924661", "text": "def assign_roll_values_for_final_frame\n if !frame.roll_one_val\n frame.roll_one_val = pins_down\n set_frame_to_pending! if frame.strike?\n elsif !frame.roll_two_val\n frame.roll_two_val = pins_down\n ...
08fc66d2f645ddd4d481d291cec32808
Match example: ++extra loud or +loud+
[ { "docid": "3a5a4afb5188d9a9b597bec03e160888", "score": "0.5253176", "text": "def loud_volume\n /(?:#{ws_start}\\+\\+#{content('x-loud')}\\+\\+#{ws_end})|(?:#{ws_start}\\+#{content('loud')}\\+#{ws_end})/\n end", "title": "" } ]
[ { "docid": "440c86feae1aa94a6d5e18408bc27e62", "score": "0.6479418", "text": "def matchExtra()\n @sMatched.match(Regexp.new(@effectorObj.reExtra))\n end", "title": "" }, { "docid": "13aa97f9b0a925faf9ca95197e7e5683", "score": "0.56910133", "text": "def anything\n add(\"(?:...
8d59d9817b5355bf384c049955cea2ee
DELETE /price_lists/1 DELETE /price_lists/1.json
[ { "docid": "4aa4c29f6905f6fca219da10082783db", "score": "0.724123", "text": "def destroy\n @price_list.destroy\n\n respond_to do |format|\n format.html { redirect_to price_lists_url(\n :room_type_id => @price_list.room_type_id, :meal_plan => @price_list.meal_plan) }\n format.json ...
[ { "docid": "075c63fe97a3afcc6da03c4dff0f9028", "score": "0.7762159", "text": "def destroy\n @price_list = PriceList.find(params[:id])\n @price_list.destroy\n\n respond_to do |format|\n format.html { redirect_to price_lists_url }\n format.json { head :ok }\n end\n end", "title"...
d0d5ce112154c2f9202e297f536fba1d
Sets the period list as given, after checking to make sure there are no holes in the schedule. If there are it returns false and does not set the schedule.
[ { "docid": "e0f90b3a7dfab419f17e04810d8aa07c", "score": "0.583577", "text": "def set_periods(new_periods)\n # Check start and end\n raise InvalidPeriodList, 'First and/or last periods are missing!' unless new_periods.first.start_time.strftime(TIME_FORMAT) == '08:40 AM' and new_periods.last.end_tim...
[ { "docid": "776d64a6cbc290fb85a706892cab6f38", "score": "0.6049036", "text": "def scheduleable?(starts, ends)\n !scheduled?(starts - lead_days, ends)\n end", "title": "" }, { "docid": "5454c7c7c7fa770fd32f321359f7b303", "score": "0.60077643", "text": "def save_period?\n !@peri...
918c193126b16091f7ba46fe67912906
and returns an array containing all of the prime factors of the given number.
[ { "docid": "0656b252e384989a92fcd306d452e338", "score": "0.8464953", "text": "def prime_factors(num)\n\tprime_fact = []\n \t(1..num).each do |i|\n \t\tif num % i == 0 && prime?(i)\n \t\tprime_fact << i\n \tend\n \tend\n \treturn prime_fact\nend", "title": "" } ]
[ { "docid": "5f996ef47d7f12be001bb9d709491be5", "score": "0.876912", "text": "def prime_factors(num)\n array = []\n factors(num).each do |factor|\n if prime?(factor)\n array << factor\n end\n end\n return array\nend", "title": "" }, { "docid": "cc5b843b32c...
dfe3bd44c27c2f6ffc85287ed6abfd86
Read an L3Vpn Read the L3Vpn with the given id. Sensitive data is returned as part of the response. This API is deprecated. Please use the following APIs instead: GET /infra/tier0s//localeservices//ipsecvpnservices/ default/sessions/L3VPN_?action&x3D;show_sensitive_data to get the associated IPSecVpnSession. GET /infra...
[ { "docid": "9f10ebf178557a79294fbd13c00ee606", "score": "0.5304013", "text": "def read_l3_vpn_with_sensitive_data_show_sensitive_data_0_with_http_info(tier_0_id, locale_service_id, l3vpn_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNe...
[ { "docid": "1dd62564d9e5edc0097aeb715f561454", "score": "0.7462836", "text": "def read_l3_vpn(tier_0_id, locale_service_id, l3vpn_id, opts = {})\n data, _status_code, _headers = read_l3_vpn_with_http_info(tier_0_id, locale_service_id, l3vpn_id, opts)\n data\n end", "title": "" }, { ...
e75e69e96773190110f8416d5dad9645
remove_from_cc_list Description: This method updates the CC list with the user that was selected to be removed. Parameters from params [:id] Identifies the user to be added to the CC list. Return value: None Additional information:
[ { "docid": "d29b5736305dc06343b9ed79aeffb203", "score": "0.74191964", "text": "def remove_from_cc_list\n\n @eco_task = EcoTask.find(params[:eco_task_id])\n\n # Add the user to the email cc list.\n @eco_task.users.delete(User.find(params[:id]))\n @eco_task.reload\n @users_eligible_for_cc_l...
[ { "docid": "afa4c359a457002ba4a1d64505181477", "score": "0.62521124", "text": "def remove_user(user_id)\n\t\treturn if is_admin?(user_id)\n\t\tparty_list.delete(user_id)\n\t\tself.update_attribute(:party_list, party_list)\n\tend", "title": "" }, { "docid": "8dab770a95acb3cda90d35e585a12c01",...
1928207bad1e6bd258fb0a7844ce0c00
Commercial bill no serial length must be 5 and code must returns 15 chars
[ { "docid": "abd080e7e10db2536769526de57a30b4", "score": "0.5826895", "text": "def commercial_bill_next_no(company, office = nil)\n year = Time.new.year\n code = ''\n serial = ''\n office_code = office.nil? ? '00' : office.to_s.rjust(2, '0')\n # Builds code, if possible\n company_code =...
[ { "docid": "4057d29fdaa5bbd98ac15edb368c2427", "score": "0.6200039", "text": "def credit_card_number; end", "title": "" }, { "docid": "2dd1ae66c7925fde2700c617feaa813c", "score": "0.6142398", "text": "def full_no\n # Debt claim no (Office & year & sequential number) => OOOO-YYYY-N...
a30198f1b0692cc1eb3244b9fa15e8e6
GET /everythings GET /everythings.json
[ { "docid": "26ae24be61c64729b7440be8df378152", "score": "0.67752904", "text": "def index\n @everythings = current_guest.everythings.all\n end", "title": "" } ]
[ { "docid": "c13feebdb6b4a8e4f0d605b45fba410d", "score": "0.6894361", "text": "def index\n @things = Thing.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @things }\n end\n end", "title": "" }, { "docid": "73c6fe16abca69b1a4c0edc2...
76a3995b18079160ce2df927977a432d
please override this function in any child class
[ { "docid": "42b9fb4eb97df7135cd3712faabc62bf", "score": "0.0", "text": "def input_reports\n []\n end", "title": "" } ]
[ { "docid": "2290804b238fc95bfd6b38f87c6d2895", "score": "0.8348698", "text": "def override; end", "title": "" }, { "docid": "7d3206fdee515addbaa426dffb5132aa", "score": "0.75369644", "text": "def method\n raise NotImplementedError, 'Define this method on the child classes'\n ...
503c299001e880f50abf07e5b895b372
GET /manifestation_relationships GET /manifestation_relationships.json
[ { "docid": "25ec53fd302ce8560a50f26a544dde11", "score": "0.6640902", "text": "def index\n case\n when @manifestation\n @manifestation_relationships = @manifestation.manifestation_relationships.order('manifestation_relationships.position').page(params[:page])\n else\n @manifestation_re...
[ { "docid": "ed46f3d1f662dda6636296ba2f0c6e61", "score": "0.68648136", "text": "def related_manifestations\n find_related_frbr_objects( :is_related_to, :which_manifestations?) \n end", "title": "" }, { "docid": "62d2be18e9b886f29c4c91bd98c3571a", "score": "0.67225623", ...
5681f708509b7d1640d22d7f8807ee5f
Record time against a project
[ { "docid": "74a5dc3298a93a8b79fdfe7f57f9dd52", "score": "0.0", "text": "def record_time(options)\n raise ArgumentError unless options.values_at(:date, :client, :type, :hours, :description, :employee).all?\n request 'time.recordTime', options\n end", "title": "" } ]
[ { "docid": "4e44216c55beb53e5c5d2376a22d4b7d", "score": "0.7449481", "text": "def in(project)\n @timein = Time.now.asctime\n lf = File.new(\"/home/sam/Dropbox/timeclock/timelog.txt\", \"a\")\n lf.puts \"#{@name.capitalize} clocked INto #{project} at #{@timein}.\"\n lf.puts \"================...
75f7b7afa06295b949743f60b4b0e462
Insert beer data into the database from a crawler's JSON blob
[ { "docid": "87f18e720675319d7eee09e6658a7e14", "score": "0.8127412", "text": "def insertCrawlerBlob(data)\n data.each do |beer|\n beer['price'] = beer['price'].gsub(/[^\\d\\.]/, '').to_f\n beer['style'] = JSON.generate(beer['style'])\n @db.execute \"INSERT INTO #{...
[ { "docid": "5c76af2abefb29fa0c8ad45064c44a2b", "score": "0.645304", "text": "def insertUntappdBlob(data)\n data[\"beers\"][\"items\"].map { |item|\n b = item[\"beer\"]\n @db.execute \"INSERT INTO #{@untappdTable} VALUES (?,?,?,?,?,?,?,?,?,?)\",\n [b[\"bid\"], ...
4113e15da299c2c090b5d54643322dbe
don't expand models when ext_name receive nil
[ { "docid": "3a05d52c3b497baa0189bf735664dfaa", "score": "0.57575554", "text": "def load_expander(ext_name)\n %w(models helpers).each do |targets|\n Chanko::Loader.directories.each do |directory|\n Pathname.glob(directory.join(\"#{ext_name}/#{targets}/*.rb\")).sort.each do |tar...
[ { "docid": "fbac72cb01757fd60aec08ffb54db7cb", "score": "0.59785", "text": "def model_name\n ''\n end", "title": "" }, { "docid": "9c8818eb02b63e5daf391de6c9877fa2", "score": "0.5923809", "text": "def lookup_model_names; end", "title": "" }, { "docid": "27b31afb...
2c9c232888f3b839e18f24defc872bda
Nach dem Aufruf von compute soll die Anmeldung stehen Sie fasst den Prozess in einer Methode zusammen
[ { "docid": "847a8602b7843246bb6ae1361e52f5c2", "score": "0.0", "text": "def compute()\n\t\t\n\t\treqToken = flickr.get_request_token()\n\t\t@AuthURL = flickr.get_authorize_url(reqToken['oauth_token'], :perms => 'delete')\n\t\t\n\t\t#Öffnet die Seite für die Authorsierung im Standardbrowser\n\t\topenURI(...
[ { "docid": "dda26c3e6df5c3f3365a9728e947769d", "score": "0.64560115", "text": "def compute\n raise NotImplementedError, '#compute not defined for this widget'\n end", "title": "" }, { "docid": "da32862891e2ebc3c8d71f65524bb4c1", "score": "0.62292224", "text": "def prosa\n en...
2d98f60c709500c518ac3d5c6a018e37
Delivers the current session_counts lists to the session endpoint. source://bugsnag//lib/bugsnag/session_tracker.rb102
[ { "docid": "1825191908969ad89159377f2334a27c", "score": "0.59123856", "text": "def send_sessions; end", "title": "" } ]
[ { "docid": "c9b473c58ad57fb02bc42025e334aa54", "score": "0.73039997", "text": "def session_counts; end", "title": "" }, { "docid": "6742d3fa6f8095718b972d424210d61f", "score": "0.64666194", "text": "def count\n find(\"/sessionCount\",CiscoISE::SessionCount).count\n end", ...
d5bdea4157a01b9a5101bccedbe98645
install git using Homebrew. TODO: Homebrew? Is that a dependency we're tracking in the go script? How do we know it's installed?
[ { "docid": "c6f7ac20175213f19ecb07b65909d846", "score": "0.82266146", "text": "def install_git\n\tsudo \"brew install git\" unless git_installed?\n end", "title": "" } ]
[ { "docid": "48c55bf6ba3444998e6ac4dfa90b94ec", "score": "0.75046563", "text": "def install\n bin.install \"git-active-branches\"\n bin.install \"git-branches-containing\"\n bin.install \"git-cherry-pick-to\"\n bin.install \"git-cleanup\"\n bin.install \"git-cleave\"\n bin.install \"git...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f290f070caf30e274b4024dffc657a80", "score": "0.0", "text": "def portfolio_category_params\n\t\tparams.require(:portfolio_category).permit(:name)\n\tend", "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...
e9562aafa5b2e6be225eb09f2d59ac96
Get position in array of a stop
[ { "docid": "5f4e64a5fcb4e1658e78bbc27efd4016", "score": "0.6535262", "text": "def getStationPosition (l,s)\n @lines[l][:stops].index(s)\nend", "title": "" } ]
[ { "docid": "555c34eba62faaa160cdb7537ffd5427", "score": "0.7438085", "text": "def find_index_of_stop(stops_array, stop_to_find)\n result = stops_array.index(stop_to_find)\n return result\nend", "title": "" }, { "docid": "5eac921f5dc6f9f5617f978aacc14bb8", "score": "0.68264985", "te...
eb59b2c2f6340e5699063d3eb1b0bffc
List HTTPS log endpoints List all of the HTTPS objects for a particular service and version.
[ { "docid": "202a67b694dcaf3d3bb5c49e8ee0608c", "score": "0.71919805", "text": "def list_log_https(opts = {})\n data, _status_code, _headers = list_log_https_with_http_info(opts)\n data\n end", "title": "" } ]
[ { "docid": "6cf75346f9331a7d93033add56067d2c", "score": "0.6961609", "text": "def list_log_https_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: LoggingHttpsApi.list_log_https ...'\n end\n # unbox the parameters from the h...
daab5583e6c76c0287455d8c93cf926d
Restricts processing of the user's profile. This will set +data_processable+ to +false+ in +spree_users+.
[ { "docid": "185038cfc92448891eb22eb48ad12d84", "score": "0.7997621", "text": "def restrict_processing\n user&.update!(data_processable: false)\n end", "title": "" } ]
[ { "docid": "7beeea42acdeafa649052693d2fd3043", "score": "0.7019043", "text": "def resume_processing\n user&.update!(data_processable: true)\n end", "title": "" }, { "docid": "c34747e414bcb4edcbfdfbffdaf95ae8", "score": "0.587997", "text": "def current_user_can_list_profil...
c5a509d1e4d1f36906f699e1be5f00a5
Allow the sublease to be changed if true. Returns true or false.
[ { "docid": "f1b21dea90e1efb2a41e0607f560ca22", "score": "0.0", "text": "def allow_sublease_change\n @allow_sublease_change ||= false\n end", "title": "" } ]
[ { "docid": "5a409b78449874ba2a00df3b02305418", "score": "0.74435997", "text": "def settable?\n true unless allow_change == false\n end", "title": "" }, { "docid": "d2d2ec6fc191dbe894b6e7b07dd301c9", "score": "0.6894853", "text": "def changed?\r\n return false\r\n end"...
d54236d04aebd96004a565725a9a0263
Control this bot. _cemmand_ is command symbol. _params_ is command parameters. Parameters is array. If _report_by_message is true, report the command result by sending direct message to owner. By default, this is true.
[ { "docid": "f88c1b118e14d09b116a5c9c11e06e71", "score": "0.6014409", "text": "def control_command(command, params, report_by_message = true)\n log \"control_command: #{command}\"\n raise ArgumentError unless params.is_a?(Array)\n case command\n when :is_ignore_owner\n if params[0]\n ...
[ { "docid": "137823100944ab65d6cf70af9f0f9977", "score": "0.5246045", "text": "def sendCommand(cmprt, cmadr, cm_msg)\n cmstr = cm_msg\n @cmc_socket.send(cmstr, 0, cmadr, cmprt)\n end", "title": "" }, { "docid": "19bc2019e89b76246882fcb211cd11da", "score": "0.5188612", "te...
e0c012fb1959794c9e475027673ac843
def titleize(word) title = word.split.map(&:capitalize).join(' ') title = title.gsub("And","and") return title end
[ { "docid": "5a0d1d2b17d550d445ae3606ce3d7ef8", "score": "0.83728987", "text": "def titleize(name)\n lowercase_words = %w{a an the and but or for nor of over}\n name.split.each_with_index.map{|x, index| lowercase_words.include?(x) && index > 0 ? x : x.capitalize }.join(\" \")\nend", "title": "" } ]
[ { "docid": "fd71761013a3cb699172953e179de7f1", "score": "0.8922799", "text": "def titleize(word)\n\tlittle_words = [\"a\", \"an\", \"the\", \"at\", \"by\", \"for\", \"in\", \"of\", \"on\",\"over\", \"to\", \"up\", \"and\", \"as\", \"but\", \"it\", \"or\", \"and\", \"nor\"]\n\ttitle =word.split.map {|w| ...
a2f573c6713d81f02ee35324f2f22fd5
Automatically load the app/views/customers/index.html.erb
[ { "docid": "d606f39ebc87bbc95d8d2902fe6f217e", "score": "0.0", "text": "def remember_to_call\n id = params[:id].to_i\n session[:customers_to_call] << id unless session[:customers_to_call].include?(id)\n redirect_to root_url, notice: \"Successfully added customer to the to-call list.\"\n end", ...
[ { "docid": "6b01fab37ccabc52fddb3b4b6e9c0e65", "score": "0.68695545", "text": "def index\n @companies = Company.find(:all, :conditions => {:user_id => getUserId()}, :order => \"name\")\n @path = 'customers'\n @pagetitle = \"Customers\"\n end", "title": "" }, { "docid": "5b416ca3dcb...
6d8e5d2d254ec5e09ce08eb773703589
uniq! keeps the first occurrence of each path, otherwise preserving order, preserving the effective load path source://bootsnap//lib/bootsnap/load_path_cache/change_observer.rb34
[ { "docid": "34e18fc1ce127f3fb54b9215930b4758", "score": "0.0", "text": "def uniq!(*args); end", "title": "" } ]
[ { "docid": "e0ac5cb9d55d0fb521421cfbf6f8de2c", "score": "0.6866626", "text": "def unique_paths(c, r)\n return up_helper(c, r, cache={})\nend", "title": "" }, { "docid": "55e49e264ec9288b707df90a994626a0", "score": "0.67183024", "text": "def uniq_roots\n\t\tparsed_urls = []\n\t\t@url...
f63b0151a83939560a8f34272774d57d
Returns number of unpaused seconds elapsed since beginning of session.
[ { "docid": "1c2dd642bdcb3548cfbee7d8588d448f", "score": "0.0", "text": "def elapsed\n es = @count + @dot_count # es = elapsed seconds; omits starts and pauses.\n # Given seconds, return (as last processed line) a string in the form\n # \"12:34\", supporting single digits (\"00:01\"), etc.\n ...
[ { "docid": "0c42ce117929d4fecd402df9c77bf3fd", "score": "0.7254722", "text": "def seconds_left_in_code_session\n if code_session \n start_time = code_session.created_at \n end_time = start_time + current_exercise.minutes * 60#secs/min\n elapsed_seconds = (end_time - Time.now).ceil\n ...
8ed7e7df462a511bade975f6d6f09403
Save user credit card info
[ { "docid": "d79555d9c5e81833cffbe64eefd11905", "score": "0.61005014", "text": "def save_credit_card_info_with_http_info(request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: V2UserCustomerApi.save_credit_card_info ...\"\n end\n # ver...
[ { "docid": "a4be172fac10b6b803c66eb453de6e50", "score": "0.7208794", "text": "def save_card(credit_card)\n Cielo::API30::Request::SaveCardRequest.new(merchant, environment).execute(credit_card)\n end", "title": "" }, { "docid": "db1b2319360e481d98a31b478ae8dcc6", "score": "0....
e04f62657d3b04a47da0d31d08c5dbdf
UCEnemyGraphic aligned to middle/center
[ { "docid": "db7399eee7b243d50e743bd75f8802a4", "score": "0.7490364", "text": "def test_alignMiddleCenter\n [@window, @sprite, @bitmap].each{|container|\n uc = UCEnemyGraphic.new(container, Rect.new(0, 192, @window.contents.width, 288), $data_enemies[1], 1, 255, 1)\n uc.draw()\n }\n re...
[ { "docid": "c235c63c319b7c3ecda0bbbb9b6382fd", "score": "0.7400653", "text": "def test_alignTopCenter\n [@window, @sprite, @bitmap].each{|container|\n uc = UCEnemyGraphic.new(container, Rect.new(0, 192, @window.contents.width, 288), $data_enemies[1], 1)\n uc.draw()\n }\n return true\n...
8c6465db56fc69d1cf68c8449ad79df6
opTime in lastWrite subdocument of the hello response.
[ { "docid": "2d1b31b1d2469881d69d77b8e06c9e1c", "score": "0.72227114", "text": "def op_time\n if config['lastWrite'] && config['lastWrite']['opTime']\n config['lastWrite']['opTime']['ts']\n end\n end", "title": "" } ]
[ { "docid": "a6c038892923e1a31382182ecb5429fd", "score": "0.58809125", "text": "def last_written\n data.last_written\n end", "title": "" }, { "docid": "50ae8cb3e2a43f573f0cd16cf91d3260", "score": "0.57787085", "text": "def add_time(doc)\n db = get_connection\n coll = db.coll...