query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
82d2e8487ac3aecbe0e29a1f7e36e76f
TODO: handle bad lines TODO: handle wrong names
[ { "docid": "13ac4bba6443573804136fd8f4918fde", "score": "0.0", "text": "def initialize(user, card_list = '')\n raise 'User not supplied' unless user\n\n @user = user\n\n @cards = card_list.lines.map do |line|\n count, name = line.strip.split(/\\t|\\;/)\n mono_card_array(count, name)\n...
[ { "docid": "ea55e42daa86bc1cb42fca7a1602d7a0", "score": "0.6509178", "text": "def get_line_name(line)\n case line\n when :line_n then \"Line N\"\n when :line_l then \"Line L\"\n when :line_6 then \"Line 6\"\n else\n \"Line does not exist\"\n end\nend", "title": "" }, { "docid": "6f2...
c311d84a9115ea0123ed1feef002280f
[] rather than loop, is it possible to compute?
[ { "docid": "f7fbbb021814f530c14d2e3923388661", "score": "0.0", "text": "def solution(array, shift_count)\n \"output #{array} #{shift_count}\"\nend", "title": "" } ]
[ { "docid": "7f1a388f0a0da236132e568fef7befae", "score": "0.6671313", "text": "def compute(ary)\n return nil if ary.nil?\n ary.map do |x, y|\n y ||= 0\n x + y \n end\nend", "title": "" }, { "docid": "3944f56d0d810f8952a9fd577beb2161", "score": "0.6226684", "text": "def reduce...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "7ea8603bb31cd41f1cc9546bfde88307", "score": "0.0", "text": "def collections_bill_params\n params.require(:collections_bill).permit(:id, :sale_id, :invoice_number,\n :ship_number, :po_number, :payment_terms, :bol_date, :total_amt,\n :user_id, :customer_id, :created_at, :label_one...
[ { "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...
3c70fb469b312e8eccea8434d3f3ef29
A sequence of handles, maintained in sorted order, future to present.
[ { "docid": "dcd200078c7201682aec0733b5ab0edf", "score": "0.0", "text": "def initialize\n @sequence = []\n end", "title": "" } ]
[ { "docid": "23b0054c36fed089d24e5859b057f037", "score": "0.6584214", "text": "def build_handle_list\n return @handles.uniq.join(\"\\n\")\n end", "title": "" }, { "docid": "6d91a12acb70999810823e66d89594d5", "score": "0.63065493", "text": "def load_handles\n handle = start_hand...
44c312ce06015c7efefe072298df3d58
Add a local secondary index definition.
[ { "docid": "2038f94a621cb861e77da44a37322069", "score": "0.6784509", "text": "def add_lsi(name, key_name)\n local_secondary_indices[name.to_s] = LocalSecondaryIndex.new(name.to_s, key_name.to_s)\n end", "title": "" } ]
[ { "docid": "dca89f78a7505c433e857cd5c3490aeb", "score": "0.6412433", "text": "def local_secondary_index(index_name)\n indexes = table.local_secondary_indexes\n indexes.find {|index| index.index_name.eql?(index_name)} if indexes\n end", "title": "" }, { "docid": "794d2cf126...
aef80ae7ed9e852890b5e23aedd1c4e5
PATCH/PUT /orders/1 PATCH/PUT /orders/1.json
[ { "docid": "f0fc78bd0057e91b1ccff1b5c4b7f51a", "score": "0.0", "text": "def update\n respond_to do |format|\n if @order.update(order_params)\n format.html { redirect_to @order, notice: 'Order was successfully updated.' }\n format.json { render :show, status: :ok, location: @order }...
[ { "docid": "5475e478e362598519f05ab929db4ab8", "score": "0.7210738", "text": "def update\n @order = Order.find(params[:id])\n @order.update_attributes(order_params)\n render :json => @order\n end", "title": "" }, { "docid": "66c979dede895693d89bd15161614588", "score": "0.703249...
22120f6859c6afeee15b4fda7aae5aff
Delete Auto Template By Id
[ { "docid": "4e58785f994360d27026e189b9d5ba76", "score": "0.0", "text": "def service_boards_id_auto_templates_auto_template_id_delete(id, auto_template_id, opts = {})\n service_boards_id_auto_templates_auto_template_id_delete_with_http_info(id, auto_template_id, opts)\n return nil\n end", ...
[ { "docid": "a70e91b619d62d2de9f549db00db544c", "score": "0.7963437", "text": "def delete_content_template(id)\n # TODO: Inform ContentTemplateController.destroy method has been modified\n @client.raw('delete', \"/content/templates/#{id}\")\n end", "title": "" }, { "docid": "354bf276af...
656f6d62dc3135072cec7b3df299cc3e
Change book status to "lost" if assigned lost status.
[ { "docid": "40961df9812b61bddd53d22a9cfbed39", "score": "0.8499328", "text": "def is_lost\r\n\t\tbook.status = 'Lost'\r\n\tend", "title": "" } ]
[ { "docid": "4198b9e55f549bf53c1fe6f4b486b808", "score": "0.68015856", "text": "def lost?\n book.status=\"lost\" if Time.now > (book.due_date + (30*24*60*60))\n end", "title": "" }, { "docid": "23f9162d3a98df6cc4d2a6add8f9cdb8", "score": "0.6202117", "text": "def status(book)\n\t\t...
5c656f86d303878d202b3a589fbf1211
reduce 348 omitted reduce 349 omitted reduce 350 omitted reduce 351 omitted reduce 352 omitted reduce 353 omitted reduce 354 omitted reduce 355 omitted reduce 356 omitted reduce 357 omitted reduce 358 omitted reduce 359 omitted reduce 360 omitted reduce 361 omitted reduce 362 omitted reduce 363 omitted reduce 364 omitt...
[ { "docid": "d0f7323139cbb7b91d2c5008335601e4", "score": "0.0", "text": "def _reduce_373(val, _values, result)\n (_, line), c, _, t, rest = val\n\n result = s(:if, c, t, rest).line line\n\n result\nend", "title": "" } ]
[ { "docid": "5d54341fb90a0c63c354c3d68463fbf9", "score": "0.744162", "text": "def _reduce_608(val, _values, result)\n yyerrok\n \n result\nend", "title": "" }, { "docid": "a8706cdc7b74be0615d378fea787974d", "score": "0.7310507", "text": "def _red...
a15be76aeb6f5fe555c07f0b70138f6c
Visit an explicit receiver
[ { "docid": "66ededa013f050e40d58c7ee19fb35d4", "score": "0.5343753", "text": "def visit_this(receiver, thing, args)\n raise \"Visitor Error: Too few arguments passed. min = #{@min_args}\" unless args.length >= @min_args\n if @max_args\n raise \"Visitor Error: Too many arguments passed. max = ...
[ { "docid": "42994f668d503442c3cc3f8119b3d4ed", "score": "0.70573294", "text": "def visit(thing, *args)\n visit_this(@receiver, thing, *args)\n end", "title": "" }, { "docid": "c5660c6cc80613600fe965593a91db6b", "score": "0.6981263", "text": "def visit(thing, *args)\n visit_thi...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "39be87ce157b7f64ab1225845ddcd3d3", "score": "0.0", "text": "def set_ticket\n @ticket = Ticket.find(params[:id])\n end", "title": "" } ]
[ { "docid": "631f4c5b12b423b76503e18a9a606ec3", "score": "0.603186", "text": "def process_action(...)\n run_callbacks(:process_action) do\n super\n end\n end", "title": "" }, { "docid": "7b068b9055c4e7643d4910e8e694ecdc", "score": "0.6015241", "text": "def ...
da3a04d890abfd72d8ca79c4206c1e59
GET /image_banks/new GET /image_banks/new.json
[ { "docid": "3bc208521dfc70a73957373b6d0a6505", "score": "0.81028", "text": "def new\n @image_bank = ImageBank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @image_bank }\n end\n end", "title": "" } ]
[ { "docid": "e58f53873d8d3031d853e9b6b1fc22c6", "score": "0.7475171", "text": "def create\n @image_bank = ImageBank.new(params[:image_bank])\n \n respond_to do |format|\n if @image_bank.save\n format.html { redirect_to @image_bank, notice: 'Image bank was successfully created.'...
d7c6512eea535791e4d095f74d0c280e
the method is used to clear four cards of the same kind from the hand
[ { "docid": "687d35d11efaad680d3c5ae29037632d", "score": "0.83136976", "text": "def clear_four_of_a_kind\n @hand.cards.delete(nil)\t\n if(@hand.cards.size > 0)\n grouped_by_rank = @hand.cards.group_by {|card| card.rank}\n four_of_rank_hash = grouped_by_rank.select {|key, value| value.size...
[ { "docid": "ddde6797ebf66f11268f3fe2c9666749", "score": "0.7917831", "text": "def clear_hand\n self.cards_held = []\n end", "title": "" }, { "docid": "87d1c8a8c9c06c03b29af00e8eb3fb0c", "score": "0.7842172", "text": "def clear_hand\n @hand_cards.clear\n @points = 0\n end",...
68bf8c34e83fb304bbab95900a91c2fa
Methods to handle dynamic waits
[ { "docid": "f6f006acb9732608f3c24087e199c798", "score": "0.0", "text": "def wait_for_element(element)\n wait = Selenium::WebDriver::Wait.new(timeout: 60)\n wait.until { find_element(element) }\n end", "title": "" } ]
[ { "docid": "cc4b395e67624622b320eb03fe2989b3", "score": "0.7109904", "text": "def wait; end", "title": "" }, { "docid": "cc4b395e67624622b320eb03fe2989b3", "score": "0.7109904", "text": "def wait; end", "title": "" }, { "docid": "cc4b395e67624622b320eb03fe2989b3", "sc...
f210e755e518f57449e8ead176c234ee
puts threed([1, 2, 3, 4, 5, 6]) false puts threed([3, 2, 3]) false puts threed([3, 4, 3, 5, 3]) true puts threed([1, 2, 3, 3, 4, 5, 3, 3, 4]) false
[ { "docid": "701049d185d3e8d1fca6dc658f749b70", "score": "0.0", "text": "def same_first_last(list)\n (list.size).times do |i|\n if list.size == 0 \n return false\n end\n if list[0] == list[list.size - 1]\n return true\n end\n end\n return false\n...
[ { "docid": "7372b4e64d940e51ce1d5a42fe6eca3f", "score": "0.6758623", "text": "def threed(list)\n count = 0\n list.each do |i|\n if i == 3\n count += 1\n end\n end\n\n (list.size - 1).times do |n|\n if list[n] == 3 && list[n + 1] == 3\n return false\...
7f97ad112cc0a8f899df4940ebfd8b62
Returns a Hash from Twitter's search results JSON.
[ { "docid": "12fcc06411511bbd1b2934ae57de297f", "score": "0.65054804", "text": "def search (search_term)\n params = {\n :q => search_term,\n :rpp => @results_per_page,\n }\n\n response = HTTParty.get(SEARCH_URL, :query => params)\n nasty_hash = JSON.parse(response.body...
[ { "docid": "07540458a3f57e95585fd7d21fd881ba", "score": "0.6774473", "text": "def parse_searched_result(searched_results)\n parsed_search_results = []\n searched_results.map.each do |status|\n parsed_search_results << {:twitter_created_at => status.created_at.to_s,\n ...
26392360525a8dfe5ee19702cb7b2874
GET /events GET /events.json
[ { "docid": "9adf3a9d00cdbde7f1c359e67d4c5883", "score": "0.0", "text": "def index\n @events = Event.all\n end", "title": "" } ]
[ { "docid": "483079b80dfb97ee802273ad3849fa6b", "score": "0.795317", "text": "def events\n @page = 'events'\n respond_to do |format|\n format.html {\n @events = Event.find(:all)\n }\n format.json {}\n end\n end", "title": "" }, { "docid": "a85255d083e155277c720...
2edc251211d16f0f96280063f7cc530c
Approve the friendship and create a record in the opposite direction so friendship is easy to query
[ { "docid": "5e25d94efde4ae43da8b98a7b38091f9", "score": "0.67162067", "text": "def approve!\n # If this is a suggested relationship simply set to pending so the other person sees it\n if self.suggested?\n self.status = Relationship::PENDING\n self.pending_at = Time.now\n if self.sav...
[ { "docid": "cb1cd9ffa1ef14c164b01bc6210a96e7", "score": "0.8269632", "text": "def approve!\n friendship = Friendship.new(user_id: sender_id, friend_id: recipient_id)\n if friendship.save && friendship.reverse_friendship.save\n self.destroy\n end\n end", "title": "" }, { "docid...
cec014c50cedcb9255a6944fe5e3b108
for my over method i previously have the below and was getting my first 3 tests to pass but not the 4th and that's when i went to ask a question and they helped me reactor it down to a much simpler code base of just one line of code and then they helped me refactor my draw method to just one line of code as well what t...
[ { "docid": "b6b263a396aba89872c04c0c1061b198", "score": "0.0", "text": "def winner(board)\n if won_game = won?(board)\n return board[won_game.first]\n end\n end", "title": "" } ]
[ { "docid": "3408e613057986415ca26d0aa7cf2671", "score": "0.8805403", "text": "def over?(board)\n#over? == true if won? is true OR full is true. There is no need to\n#check for draw?, as a draw will happen if board is full.\n won?(board) || full?(board)\nend", "title": "" }, { "docid": "2eff...
a91134c450ad65ddbb1d831b26dff076
Convert to rational number
[ { "docid": "dbcc1a919575383251f24c926175daf1", "score": "0.7153639", "text": "def rational_number\r\n RationalNumber.new(self.rational_number_nv, self.rational_number_dv, self.rational_number_snv, self.rational_number_sdv)\r\n end", "title": "" } ]
[ { "docid": "f5562c46084e6d4280a4a47c2ddc633a", "score": "0.8126349", "text": "def rational\n Rational(integer, integer(0..INTMAX))\n end", "title": "" }, { "docid": "f8bc7e104719fe7194dc1f00c3cae38d", "score": "0.79523075", "text": "def rational\n denom_gen = such_that(fix...
2582c614d5ef48aba25caa7e6155e8e7
POST /saidas POST /saidas.xml
[ { "docid": "aa73258549593c74130afde7d3b443b4", "score": "0.6284005", "text": "def create\n @saidas = Saida.new(params[:saida])\n\n respond_to do |format|\n if @saidas.save\n flash[:notice] = 'LANÇAMENTO SAIDA EFETUADO.'\n format.html { redirect_to(homes_path) }\n format.x...
[ { "docid": "d9b404c9747534beb653f54c4d90af88", "score": "0.6115342", "text": "def submit(stanza)\n @service.context.post(@path, stanza, {})\n end", "title": "" }, { "docid": "040b1dcc9c0431f2a79f0e6876ea2be5", "score": "0.60571414", "text": "def post( path, body = nil )\n ...
120873e8d50df97b46a8aa95e336d673
[String] the end of the string source://syntax_tree//lib/syntax_tree/node.rb11056
[ { "docid": "0f688875676cb4e5fb1a58d865b51cca", "score": "0.0", "text": "def value; end", "title": "" } ]
[ { "docid": "d0ffae733cd6c326c5e53532a98a2398", "score": "0.73004854", "text": "def visit_tstring_end(node); end", "title": "" }, { "docid": "e4ef033576b05aa8ffef7b9e43ebd63e", "score": "0.65511084", "text": "def visit_tstring_end(node)\n node.copy\n end", "title": "" ...
b483c67771b4de80cee3bbbee461a12d
Returns the Faraday connection options hash for this resource.
[ { "docid": "aeb5878beda3cf1a46b47a120832c070", "score": "0.76555914", "text": "def faraday_options\n cfg_get(:faraday_options)\n end", "title": "" } ]
[ { "docid": "3b5cf3eca0393dc8cbb6a453da6e3a65", "score": "0.7473365", "text": "def faraday_options\n cfg_get(:faraday_options)\n end", "title": "" }, { "docid": "58d99172f47beda6f9cdc8194c027a94", "score": "0.7084844", "text": "def faraday_options(options)\n {\n...
6022e7cd5f3de11a114a8baf96e7b800
Iterate over a field collection. message.each_field do |field_object, value| do something end
[ { "docid": "ad9784dd8b9cfd8f9bf576b69a93bc01", "score": "0.7912182", "text": "def each_field\n all_fields.each do |field|\n value = __send__(field.name)\n yield(field, value)\n end\n end", "title": "" } ]
[ { "docid": "fca58fc39e35b9a66bcd674674c1ad4a", "score": "0.770016", "text": "def each_field # :yield:name, type\n\t\t@fields.each { |field| yield(*field) } \n\t end", "title": "" }, { "docid": "8f1b55f4dbeb3489594f7274bd400ad6", "score": "0.7643195", "text": "def each(&block)\n ...
7846e14bbc0f1c4d2f922fcf20ac159a
Get the root `options` object, and instance of OpenStruct
[ { "docid": "4ea36d67044ce93716728797f31d9558", "score": "0.76642805", "text": "def options\n @options ||= OpenStruct.new(default_options)\n end", "title": "" } ]
[ { "docid": "31056345df9bca01797fb31e4a056c7d", "score": "0.8128862", "text": "def options\n @options ||= OpenStruct.new\n end", "title": "" }, { "docid": "31056345df9bca01797fb31e4a056c7d", "score": "0.8128862", "text": "def options\n @options ||= OpenStruct.new\n end...
b06502622e5df8a22c1147fec56ed2b0
=begin Your task is to create a function that does four basic mathematical operations. The function should take three arguments operation(string/char), value1(number), value2(number). The function should return result of numbers after applying the chosen operation. =end
[ { "docid": "16dce2bc68fddcde3d31e4dc0f0007b6", "score": "0.0", "text": "def basic_op(operator, value1, value2)\nvalue1.send(operator,value2)\nend", "title": "" } ]
[ { "docid": "dd18a7b5637dac010467c882b4e9feca", "score": "0.7688857", "text": "def calculate(operation, n1, n2)\n if operation == \"add\" || operation == \"+\"\n return \"#{n1} + #{n2} = #{n1+n2}\"\n elsif operation == \"subtract\" || operation == \"-\"\n return \"#{n1} - #{n2} = #{n1-n2}\"\n el...
f2f5c15a88913634d607367315194111
GET /oauth_remote_service_providers/new GET /oauth_remote_service_providers/new.xml
[ { "docid": "3e634cc90d969cf67a0a4ef3f4eebec7", "score": "0.8012521", "text": "def new\n @oauth_remote_service_provider = OauthRemoteServiceProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @oauth_remote_service_provider }\n end\n end"...
[ { "docid": "8cacbee4273423eedb42761f85d567fd", "score": "0.7225985", "text": "def create\n @oauth_remote_service_provider = OauthRemoteServiceProvider.new(params[:oauth_remote_service_provider])\n\n respond_to do |format|\n if @oauth_remote_service_provider.save\n flash[:notice] = 'Oau...
219f00df740aeb7acc05bb7a34d08f9b
Extract time, which is in the master's stdout. Currently checking all stdout.
[ { "docid": "ea137e1c1b87df2f5ee84feb23a43018", "score": "0.5840404", "text": "def extract_times(sandbox_path, verbose=false)\n time = \"\"\n trig_times = {}\n Dir.glob(File.join(sandbox_path, \"**\", \"stdout_*\")) do |out_file|\n short_nm = /.*stdout_(.*)$/.match(out_file)[1]\n role ...
[ { "docid": "0ece2d5ae81580593351ffc7c65f2720", "score": "0.63979244", "text": "def last_stdout\n strip_duration(@last_stdout)\n end", "title": "" }, { "docid": "64356142cdc178bcfcb0aa6b41429089", "score": "0.62599444", "text": "def get_timestamp(output)\n output.split(\"\\n\...
d7a0912c539d0aed694e313e1c62bb8f
Returns an array containing all extra ingredients
[ { "docid": "6857b8fceea060d1ffa190de85a579bd", "score": "0.70870423", "text": "def extra\n @ingredients.select {|item| item.extra?}\n end", "title": "" } ]
[ { "docid": "84956bc41d95f856a4c90d1cda15b2c4", "score": "0.80432636", "text": "def ingredients\n self.recipe_ingredients.map do |recipeingredient|\n recipeingredient.ingredient\n end\n #returns an array of ingredients in the recipe_ingredients array\n end", "title"...
ce04998cef5b6941d6a30deb2727f8b1
Returns a boolean value. Argument is provided through the command line.
[ { "docid": "74c252bd3d0a8744b87d67f732683381", "score": "0.0", "text": "def palindrome(s)\n result = true\n len = s.length\n s.delete! s[(len - 1) / 2] if len % 2 != 0\n len = s.length\n (0..(len / 2) - 1).each do |i|\n s[i] == s[len - 1 - i] ? next : result = false\n end\n result\nend", "...
[ { "docid": "c065df107fca8682421116576809cf94", "score": "0.76254797", "text": "def boolean(arg)\n case arg\n when 'true'\n 1\n when 'false'\n 0\n when nil\n 0\n end\n end", "title": "" }, { "docid": "bbb841c9046518ecf32dc71479172fd...
5fd7bc60bbace0724e1cc760a6b3516c
the new form for a category
[ { "docid": "fdf2e3a74a6e4cd559d637b49bac0725", "score": "0.79457325", "text": "def new\n\t\t@category = Category.new\n\tend", "title": "" } ]
[ { "docid": "dbe062c51d0e2065f845b4ad8555e110", "score": "0.8530633", "text": "def new\n # Create a new category instance that will be used in the form:\n @category = Category.new;\n end", "title": "" }, { "docid": "d70ce1903bf6c53cb2c332d30db573d8", "score": "0.8137924", "...
9b2a9c5aab79ce2c01afcf9b31a6b73e
GET /services GET /services.json
[ { "docid": "29bfd07069fe6534049e9834af65fad2", "score": "0.0", "text": "def index\n if current_driver\n @Driver=Driver.find(params[:driver_id])\n @services = @Driver.services\n else\n @Client=Client.find(params[:client_id])\n @services = @Client.services\n end\n respond_to do |...
[ { "docid": "ebe514c18cc054477b6b5147c9a9c89f", "score": "0.76993996", "text": "def services\n get('catalog/services')\n end", "title": "" }, { "docid": "b9fc5ee843e8993c0b85bf69d2815fdc", "score": "0.75796443", "text": "def get_services()\n exec_get(\"#{@base_path}/api/v2/...
b65c72a008eb42069f232cc04015442f
PATCH/PUT /work_histories/1 PATCH/PUT /work_histories/1.json
[ { "docid": "250ce7d927b36fff0543ebd07254bf2c", "score": "0.69434947", "text": "def update\n respond_to do |format|\n if @work_history.update(work_history_params)\n format.html { redirect_to admin_employee_work_histories_path(@employee), notice: 'Work history was successfully updated.' }\n...
[ { "docid": "f2404dde11983b46b93f0855943b0654", "score": "0.66819274", "text": "def update\n @work = Work.find(params[:id])\n work_params = params[:work]\n work_params.delete('progress')\n respond_to do |format|\n if @work.update_attributes(work_params)\n format.html { redirect_to...
1d5dd9d73c82710bf18df11b17546dae
Access/Modify data in hash Add new data to hash
[ { "docid": "13269db175976ec05561cdec1c4ced37", "score": "0.0", "text": "def new_hash\n new = {}\n return new\nend", "title": "" } ]
[ { "docid": "4ae9c87a0bde2592e6ec9fd19454ae08", "score": "0.7498526", "text": "def update(hash); end", "title": "" }, { "docid": "d108f2a65c0ccb4090e3c90c4286495f", "score": "0.7183903", "text": "def add_data!(hash, key, data)\n return if data.nil?\n\n hash[key] = data\n ...
ca9ff7ad89f83cddc9bb0f5a19a80486
Extract username from a string
[ { "docid": "9c7278d97c5b43d6a267f5f436951624", "score": "0.793152", "text": "def extract_username(str)\n #s = \"USERNAME: Brian\\nUSERNAME: Mats\\nUSERNAME:beta\"\n matches = str.scan(/(USERNAME: [a-zA-Z0-9]+)/)\n return matches\nend", "title": "" } ]
[ { "docid": "18ec8a2b570bcad1241acf6c81c8c7cf", "score": "0.8313948", "text": "def extract_user_name\n name = @text.scan(USERNAME_REGEX)\n return name.first.first.strip unless name.empty?\n\n ''\n end", "title": "" }, { "docid": "7ed9935f2433c445e940e661f561bbb5", "score...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b916f5448a6426c147878e01d74310e2", "score": "0.0", "text": "def set_story\n @story = Story.find(params[:id])\n end", "title": "" } ]
[ { "docid": "bd89022716e537628dd314fd23858181", "score": "0.6165152", "text": "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "title": "" }, { "docid": "3db61e749c16d53a52f73ba0492108e9", "score": "0.60463154", "text": "def action_hook...
026d6a426c1d1c195af9eb823af06dcb
Watch for exit events from another actor
[ { "docid": "07c57072a6f0125034dbc94ba4cdc6f2", "score": "0.0", "text": "def monitor(actor)\n raise NotActorError, \"can't link outside actor context\" unless Celluloid.actor?\n Thread.current[:celluloid_actor].linking_request(actor, :link)\n end", "title": "" } ]
[ { "docid": "e7059219c662c12b72ef4c80a9d37c2c", "score": "0.72414666", "text": "def notify_exited(actor, reason)\n event = [:exit, actor, reason]\n\n if @trap_exit\n send event\n elsif ex\n # Need to raise the error in the context of the actor thread itself,\n # or else kill the a...
af630984682f1a0b5a68e6092af0d102
Update properties of this object
[ { "docid": "a94891758db159c9294d6fe88e67ed3f", "score": "0.0", "text": "def update!(**args)\n @memberships = args[:memberships] if args.key?(:memberships)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "title": "" } ]
[ { "docid": "184b1b1ed771473d3eb9f338c0734c38", "score": "0.73066413", "text": "def update *args\n opts = args.extract_options!\n fill_properties opts\n self.save\n end", "title": "" }, { "docid": "5076c5a88404ae72986f958710f5687a", "score": "0.72631145", "text": "def update...
8179898aeda6733d257b407fd2edad78
Group the plaintext into pairs of letters
[ { "docid": "e26ab27a7189799166cb1e3c7aad713a", "score": "0.71366906", "text": "def pair_letters_of_text(text)\n text = text.scan(/../).join(' ')\nend", "title": "" } ]
[ { "docid": "9a7a7a3770494f6d95f27d2033cefbfa", "score": "0.7612564", "text": "def letter_pairs str, &block\n chars = str.chars.to_a\n chars[0..-2].zip(chars[1..-1]).map(&:join)\n end", "title": "" }, { "docid": "9c0b8e1407d3793b37cd17458797bccd", "score": "0.7177142", "text": ...
1a739f2d120b1beab773fbdb3a8ec10b
Write the DATAFORMAT chart BIFF record. This record specifies the series that the subsequent sub stream refers to.
[ { "docid": "9d0a4e6a0708b417dff6262c6add44d0", "score": "0.5792583", "text": "def store_dataformat(series_index, series_number, point_number) # :nodoc:\n record = 0x1006 # Record identifier.\n length = 0x0008 # Number of bytes to follow.\n # series_index # Se...
[ { "docid": "f546ba7c9c78558d95a0b4e1ed3df046", "score": "0.70142883", "text": "def store_chartformat_stream # :nodoc:\n # The _vary_data_color is set by classes that need it, like Pie.\n store_chartformat(@vary_data_color)\n\n store_begin\n\n # Store the BIFF record that will define the ch...
cbe2ffe63b2a314fe906aebf705fe1af
Returns the full name of a user
[ { "docid": "6c4cd2697a57b8d7e3b3752df922df71", "score": "0.0", "text": "def full_name\n \"#{self.first_name} #{self.last_name}\"\n end", "title": "" } ]
[ { "docid": "0bfe8fd1b47e95215f554ef52c06d7ca", "score": "0.8668673", "text": "def user_full_name\n if user\n user.first_name + ' ' + user.last_name\n else\n 'Anonymous'\n end\n end", "title": "" }, { "docid": "e721494723e4739e9accf8af3ac4d5f2", "score": "0.8577364", ...
b501139d2f2e8b2ee48057c64c6b75e3
PUT /routes/1 PUT /routes/1.json
[ { "docid": "a19cc696e7f690d0ac2b06fafee168c4", "score": "0.60421675", "text": "def update\n @route = Route.find(params[:id])\n authorize_action_for(@route)\n respond_to do |format|\n if @route.update_attributes(params[:route])\n format.html { redirect_to @route, notice: 'Route was s...
[ { "docid": "aa0b87a16ede7353758305dbbaf57c22", "score": "0.72261864", "text": "def put(*a) route 'PUT', *a end", "title": "" }, { "docid": "15795b8668a671dd9e5b413207169df5", "score": "0.68336046", "text": "def update(id, params)\n put(\"routes/#{id}\", params)\n end"...
e58d23b72f9166cb52ddce1c99bf496a
Returns the weight of directed edge (source, destination), or returns Float::INFINITY if no such edge exists
[ { "docid": "928b9dcd603bdbabb7b78fb7190a1934", "score": "0.899087", "text": "def get_edge_weight(source, destination)\n if contains_edge?(source, destination)\n @edges[source][destination]\n else\n Float::INFINITY\n end\n end", "title": "" } ]
[ { "docid": "f1556b485ba6f8cf13bb12e72cb12360", "score": "0.77202505", "text": "def edge_weight(from, to)\n return nil if @adjacency_list[from].nil?\n\n @adjacency_list[from].get_weight(to)\n end", "title": "" }, { "docid": "82f7d92cdd4878f1bb913b898abb0d40", "score": "0.7366081", ...
ca376fccf9d20e1a1b8ced2bde2c4133
Inicializa las dos barajas de cartas: monstruos y tesoros
[ { "docid": "0e45b666a44a557f08775733aa7d734e", "score": "0.0", "text": "def initCards()\n initTreasureCardDeck()\n initMonsterCardDeck()\n initCultistCardDeck()\n \n shuffleMonsters()\n shuffleTreasures()\n shuffleCultists()\n \n @usedTreasures = Array.new\n ...
[ { "docid": "473207593a318cbc81b94b775a25b069", "score": "0.70951915", "text": "def initialize\n cartas = [*1..13].product(['C', 'D', 'E', 'T'])\n @cartas = cartas\n end", "title": "" }, { "docid": "75bb8f707d62d1103f4d819992561909", "score": "0.63804156", ...
3fd15169bacb33f774b6774810acbfbf
GET /fechas/1 GET /fechas/1.xml
[ { "docid": "d4e9fd672644eca5f38a07ba5cf776d4", "score": "0.6032761", "text": "def show\n @fecha = Fecha.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @fecha }\n end\n end", "title": "" } ]
[ { "docid": "7e246eb151c0860393afbc4513ba9faa", "score": "0.6416252", "text": "def show\n @franchisee = Franchisee.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @franchisee }\n end\n end", "title": "" }, { "docid"...
db8d35a7103ae4154623f544a439962f
Create a gist on gist.github.com
[ { "docid": "8079a1bcb0527aacd79769996954f2ce", "score": "0.0", "text": "def write(files, private_gist = false, description = nil)\n response = request(create_url) do |url|\n Net::HTTP::Post.new(url.path).tap {|req|\n req.body = JSON.generate(data(files, private_gist, description))\n ...
[ { "docid": "3546824255d36f2f04802b9208783422", "score": "0.80842507", "text": "def make_gist\n @gist = Gist.new(:description => \"TODO Gist\",\n :public => false)\n @gist[\"list.json\"] = \"[]\"\n @gists.save @gist\n end", "title": "" }, { "docid": "8fbf33cebacf...
d461158a46b0fe182c6d2bab976b7bf1
GET /request_forms/1 GET /request_forms/1.json
[ { "docid": "fa6fd1413e4073944e8a69eb755dfb34", "score": "0.0", "text": "def show\n @travel_forms = RequestForm.all\n @departments = Department.all\n end", "title": "" } ]
[ { "docid": "312798fa69ee7bcd7be50e37da3e8505", "score": "0.75516117", "text": "def retrieve_forms()\n start.uri('/api/form')\n .get()\n .go()\n end", "title": "" }, { "docid": "cd581c71627e13e8c2e5333ebcd13272", "score": "0.7047721", "text": "def form(id)\n ...
950dc22421ff5267f5215b778ff88c2c
GET /nutrition_data GET /nutrition_data.json
[ { "docid": "e58e536de5ac39fca9cc319bd26db059", "score": "0.0", "text": "def index\n if params[:food_item].nil?\n @nutrition_datum = NutritionDatum.all\n\n else\n @nutrition_datum = NutritionDatum.where(\"Food_item LIKE?\", '%' + params[:food_item] + '%')\n end\n end", "title": ""...
[ { "docid": "8ccf4bf0eda275ab522b48c6704ec758", "score": "0.6660678", "text": "def index\n @food_nutrients = FoodNutrient.all\n render json: @food_nutrients\n end", "title": "" }, { "docid": "30976fb4f98dae044e3cfac73f0fe6e4", "score": "0.6355781", "text": "def show\n render...
f9b956f746707d3fc4751a3a322626e4
GET /workouts/1 GET /workouts/1.json
[ { "docid": "0625c2433416f3ae2b7e99edc516dd29", "score": "0.75218934", "text": "def show\n @workout = Workout.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @workout }\n end\n end", "title": "" } ]
[ { "docid": "cc817e66d12315976416fb0b61014beb", "score": "0.80446106", "text": "def index\n @workouts = @user.workouts\n render json: @workouts\n end", "title": "" }, { "docid": "6a0430f7e0e3758002c6f44065bc2a6c", "score": "0.76467335", "text": "def show\n render jso...
ef47d6e896bb0492aac8cec244abb2e0
Executed on every request
[ { "docid": "ea11ddbf4327d989ae5492ee69903d38", "score": "0.0", "text": "def call env\n @env = env\n # Call app if no area or already confirmed\n return @app.call(env) if !area || confirmed?\n \n if post? # When request is a POST\n if xhr? # and request was cal...
[ { "docid": "a3e7d8341eba0b20d55bbfdcd0684953", "score": "0.7794276", "text": "def on_pre_request( request )\n end", "title": "" }, { "docid": "1f67ef3705601df94a57b24a0b635a54", "score": "0.76965", "text": "def on_pre_request( request ); end", "title": "" }, { "docid": "...
98032ea3f9591798ea0b8f5a0fde7b9c
C000 EOR $c080 C002 BRK
[ { "docid": "c65e77947b1f85b5ab772c2394afb8af", "score": "0.0", "text": "def test_EOR_absolute\n reset_and_load_memory %w[4d 80 c0 00]\n\n @cpu.accumulator = 0b0110_0110\n @cpu.write_ram(address: 0xc080, data: 0b0011_1100)\n @cpu.execute(address: @base_address)\n assert_equal(0b0101_1010, ...
[ { "docid": "99b25ccd4208b2867cd85661ef26ce2e", "score": "0.6291579", "text": "def alu_c0; @bits[12]; end", "title": "" }, { "docid": "4e4fece32d782a9972f51f5ab24dc0b0", "score": "0.6224914", "text": "def control_codes\n 'CC12345'\n end", "title": "" }, { "doci...
311c4c95feaa13f9d599713d3ac201a9
sum the array lengths
[ { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.0", "text": "def solution4(input)\n end", "title": "" } ]
[ { "docid": "0a4036cf40f366d5041f1be6e4de24f5", "score": "0.7580196", "text": "def add_array_lengths(array1,array2)\n return array1.length+array2.length\nend", "title": "" }, { "docid": "3ffe4da1b61954720829721ea3bc3074", "score": "0.7424766", "text": "def add_array_lengths(array1, a...
c0c408c67af1288422319d7907d3adac
Save a model instance to the store
[ { "docid": "0893f01a7f7354879b418b29ff66809a", "score": "0.82799995", "text": "def save(model_instance)\n store(object_key(model_instance.id), model_instance.attributes)\n end", "title": "" } ]
[ { "docid": "9254a8d9113493ab25b6d0ee39206e58", "score": "0.79268044", "text": "def store(model)\n new(model).create\n end", "title": "" }, { "docid": "03134624da643aad4be3c2c56e935059", "score": "0.7786815", "text": "def save_model(model)\n model.save\n end", ...
28d975f3a7d6892593c23737f8841ca0
posting multipart data not supported in tests? doesn't seem to work
[ { "docid": "44af98de046970d7d5bfe8d2f6665e95", "score": "0.0", "text": "def test_should_create_picture\n #old_count = Picture.count\n\n #login_as(:john)\n # post :create, :picture => { :data => fixture_file_upload('files/picture_2.png', 'image/png'), :multipart => true }, :multipart => true\n\n...
[ { "docid": "6e407c5ed7c53c392b87275bd465749a", "score": "0.7145431", "text": "def multipart_post!\n request = Net::HTTP::Post.new(uri)\n request.body = build_request_body\n\n response = get_response(request)\n GunBroker::Response.new(response)\n end", "title": "" }, { ...
f74c29bdfc4a183e1ec1b91334cd5be2
Use callbacks to share common setup or constraints between actions.
[ { "docid": "b926e7cca354e0b19ae37af98d739d06", "score": "0.0", "text": "def set_conversation\n @issue = Conversation.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;...
98e1559333ea8d8a7e6958511c022a41
inserts element into a specific index of array
[ { "docid": "6d839f37cd6976e3c358a6d05b52ac88", "score": "0.7986566", "text": "def using_insert(array, element)\n array.insert(4, element)\nend", "title": "" } ]
[ { "docid": "1efdf10d9605729f5286105ecd969fdd", "score": "0.8251038", "text": "def using_insert (array,element)\n\tind=4\n\tarray.insert(ind,element)\nend", "title": "" }, { "docid": "fcfddb5f50e843daffbf0ed654edf5c5", "score": "0.8215629", "text": "def insert_after_index(array, index...
1faa83bce164543b4d24c669bea5f9fb
used when someone wants to sort on name determines proper name to use based on type
[ { "docid": "af80f62b5c19ed45823ddd72165c0f37", "score": "0.58869976", "text": "def name_sort_value\n real_name = name(false) # no anonymous conversion\n if automatic? && real_name.blank?\n val = email\n else\n val = real_name\n end\n val\n end", "title": "" } ]
[ { "docid": "44adc5e982557b6ac186c24c6105355a", "score": "0.7041312", "text": "def get_best_name(name, type)\n slugs = find :all, :conditions => ['name LIKE ? AND sluggable_type = ?', \"#{name}%\", type.to_s], :select => \"name\"\n return name if slugs.size == 0\n slugs.reject! { |x| x.bas...
966f24415246b94bfeae2a79c60bbefb
Studentadd_boating_test should initialize a new boating test with a student (Object), a boating test name (String), a boating test status (String), and an Instructor (Object) instance method creates a new test via class BoatingTest 'student' instance = self
[ { "docid": "45c08ef418f414a4b02f982fc8afc4fb", "score": "0.7721944", "text": "def add_boating_test(test_name, status, instructor)\n BoatingTest.new(self, test_name, status, instructor)\n end", "title": "" } ]
[ { "docid": "79b87776793b2cedf7a965d0fb929774", "score": "0.8577", "text": "def add_boating_test(boating_test_name, boating_test_status, instructor)\n# We're in the Student class, so this method won't accept an argument of student; the instance IS the student.\n new_boating_test = BoatingTest.new(self...
4823fba1179dae22e3d77d8bb8b372d0
Return the cloud identifier for the default route of this subnet.
[ { "docid": "b8f4f07572d29ccdbda9b11b5075e4fa", "score": "0.0", "text": "def defaultRoute\n end", "title": "" } ]
[ { "docid": "fe88d6cec3f67d129c4a699def8da874", "score": "0.7363807", "text": "def default_subnet_id\n data[:default_subnet_id]\n end", "title": "" }, { "docid": "b6cc198aaa0a1a41847f8bfbb2ea5131", "score": "0.67744845", "text": "def defaultRoute\n if cloud_desc and...
2cf655342b214b5f13f8c1bed786e049
POST /curriculos POST /curriculos.json
[ { "docid": "876cdc20ac449c4b1750a20b746be5c7", "score": "0.651517", "text": "def create\n\t\thash = Hash.new\n\t\tarray = Array.new\n\t\tcurriculo_params[:disciplinas_attributes].each do |k,v|\n\t\t\tcurr = Curriculo.new\n\t\t\tcurr[:codigo] = curriculo_params[:codigo]\n\t\t\tcurr[:curso_id] = curriculo...
[ { "docid": "2d595cb6579e97b10f682358f56d2a36", "score": "0.6334292", "text": "def create\n @unidad_curricular = UnidadCurricular.new(unidad_curricular_params)\n\n respond_to do |format|\n if @unidad_curricular.save\n format.html { redirect_to unidades_curriculares_path, notice: 'Unidad...
c0fdfcd20be1fd5c266b53fbf8b72d98
Find all bridges in the system
[ { "docid": "7011c53acc414604d0b05c2978310f2b", "score": "0.80238277", "text": "def find_all_bridges(params={}, headers=default_headers)\n @logger.info(\"Find all bridges.\")\n get(\"#{@api_url}/bridges\", params, headers)\n end", "title": "" } ]
[ { "docid": "bc6e96f52bdf438bc570550d8cd50212", "score": "0.77416813", "text": "def find_bridges(space, params={}, headers=default_headers)\n @logger.info(\"Find all bridges in the \\\"#{space}\\\" space.\")\n get(\"#{@api_url}/spaces/#{space}/bridges\", params, headers)\n end", "title":...
073a990ab3b468862b590d90c4d7c9ff
DELETE /project_code_allocations/1 DELETE /project_code_allocations/1.json
[ { "docid": "ef3333ab82d7f5a067b1906ddabecf1d", "score": "0.72776747", "text": "def destroy\n @project_code_allocation.destroy\n respond_to do |format|\n format.html { redirect_to project_code_allocations_url, notice: 'Project code allocation was successfully destroyed.' }\n format.json {...
[ { "docid": "5bd2a706c71a304fa3432f21fa1db815", "score": "0.68127036", "text": "def destroy\n @project_code.destroy\n respond_to do |format|\n format.html { redirect_to project_codes_url, notice: 'Project code was successfully destroyed.' }\n format.json { head :no_content }\n end\n e...
e6e25dea6007cb554d5d72aa9df9f287
create 2 empty arrays, one for each team iterate down to teams + values conditional to return selected team's stats push to corresponding teams empty array conditional: using reduce, add up both teams array of points return winning team
[ { "docid": "64715b7966d048e371ea3caadf271fe4", "score": "0.6529807", "text": "def winning_team\n nets = []\n hornets = []\n\n game_hash.values.each do |nets_stats|\n if nets_stats[:team_name] == \"Brooklyn Nets\"\n nets_stats[:players].each do |bk|\n nets << bk[:points]\n end\n ...
[ { "docid": "97623a49e891012a66b06cda30c27586", "score": "0.7229301", "text": "def winning_team\n team_p = []\n team_n = []\n\n game_hash.each do | location, team_data|\n temp = 0\n team_data[:players].each do |p_name, stats|\n temp += stats[:points]\n end\n team_n << team_data[:team_...
f42a1b98c2d92ed70237aceb1a5f6de3
GET /website_pdfs/1 GET /website_pdfs/1.json
[ { "docid": "1d09a130a972456bb498d3741c3fe4bd", "score": "0.6181052", "text": "def show\n @website_pdf = WebsitePdf.where(:file_name => params[:id]).first\n end", "title": "" } ]
[ { "docid": "a45c51258f615a62fe745125dac47a8c", "score": "0.72122973", "text": "def index\n @website_pdfs = WebsitePdf.all.order(\"updated_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @website_pdfs }\n end\n end", "title": "" ...
38bfbe797a46f410fb09dcc59000f7dd
PUT /device_batteries/1 PUT /device_batteries/1.json
[ { "docid": "b252c7d8b916ef82904c2d89faf603b3", "score": "0.5988842", "text": "def update\n @device_battery = DeviceBattery.find(params[:id])\n\n respond_to do |format|\n if @device_battery.update_attributes(params[:device_battery])\n format.html { redirect_to @device_battery, notice: '...
[ { "docid": "773a6658f62250448659cc414efe069a", "score": "0.6293697", "text": "def update\n boat = Boat.find_by(name: params[:name])\n\n if boat.update(boat_params)\n render json: BoatSerializer.new(boat).serialized_json\n else\n render json: errors(boat), status: 4...
230a491c48baa7fffd0513354f203266
DELETE /student_informations/1 DELETE /student_informations/1.json
[ { "docid": "fb787de972129cbb7d8cc18ce121a68a", "score": "0.74733764", "text": "def destroy\n @student_information.destroy\n respond_to do |format|\n format.html { redirect_to student_informations_url, notice: 'Student information was successfully destroyed.' }\n format.json { head :no_co...
[ { "docid": "a41be49f6458790d5a2d38db09348203", "score": "0.7677871", "text": "def destroy\n require 'net/http'\n require 'json'\n\n # Correct URL for deleting a resource.\n uri = URI(\"http://localhost:3000/students/#{params[:id]}.json\")\n\n request = Net::HTTP::Delete.new uri\n\n # H...
185b801dc7723defe7e3b33c6a98af50
Compute a link href to the given symbol for use within the HTML output.
[ { "docid": "1d0d6b9453d8fd24300c90da334d4fa1", "score": "0.66052854", "text": "def link_for(symbol)\n\t\t\t\tpath = symbol.lexical_path.map{|entry| entry.to_s}\n\t\t\t\t\n\t\t\t\tif symbol.container?\n\t\t\t\t\treturn Trenni::Reference.new(@source_path + path + \"index\")\n\t\t\t\telse\n\t\t\t\t\tname =...
[ { "docid": "7ae489fe3c6116676d7f5ced21326e50", "score": "0.66971624", "text": "def href_link(url)\n \"<a href='#{url}' rel='external'>#{url}</a>\".html_safe\n end", "title": "" }, { "docid": "d97d6bfe5331ac83747d391dfc82017f", "score": "0.66362303", "text": "def href(link, cls, n...
d0b0eeccb3c37b9e652f0ae209839ce4
left over from deck.js' introduction/index.html todo: promote into Page
[ { "docid": "a3425edcf6ae02eaddac0be2370f8353", "score": "0.0", "text": "def stylesheet src, attributes = {}\n link({:rel => \"stylesheet\", :href => src}.merge(attributes))\n end", "title": "" } ]
[ { "docid": "9ece808270a1246645b2133518c623c7", "score": "0.6571054", "text": "def loadHandinPage()\n end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0721", "score": "0.649474", "text": "def page; end", "title": "" }, { "docid": "39c4ae2ead6ecb0d9e6c5ba2764a0...
902f0ec26bb7d3937a1a97c8bbb557c5
POST /attendances POST /attendances.json
[ { "docid": "7b657ad60804e0d0fe273fdc9805b77b", "score": "0.0", "text": "def create\n @attendance = Attendance.new(attendance_params)\n\n found_attendance = Attendance.all.where(day_type: @attendance.day_type, employee: @attendance.employee)\n if found_attendance.present?\n redirect_to new_...
[ { "docid": "cc6e7e7cf7b591018e9dac4d99387d68", "score": "0.77696353", "text": "def create\n\t\t@attendance = Attendance.new(attendance_params)\n\t\tif @attendance.save\n\t\t\trender json: @attendance, status: :created\n\t\telse\n\t\t\t render json: @attendance.errors, status: :unprocessable_entity\n\t\t...
ef5b985b85180b6d1c87dd7fcd67381b
checks population_density and assigns the appropriate multiplication factor to calculate number of deaths using if/elsif/else statements prints the appropriate string using those values
[ { "docid": "4322dcfac1016b799915c47efa7f5bd8", "score": "0.0", "text": "def speed_of_spread # (population_density, state) #in months\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 ...
[ { "docid": "ad4a3d63a56b6600208577499b9b63eb", "score": "0.8086509", "text": "def disease_report(population_density, population, state)\n speed = 0.0\n \n if @population_density >= 200\n number_of_deaths = (@population * 0.4).floor\n speed += 0.5\n elsif @population_density >= 150\n ...
914591ac8b42b5999f06a29a2f91923f
GET /yamato_logistic_order_templates/1 GET /yamato_logistic_order_templates/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "1a44d0fa4272206ac5ddcfae8407a7de", "score": "0.7748435", "text": "def index\n @yamato_logistic_order_templates = YamatoLogisticOrderTemplate.all\n end", "title": "" }, { "docid": "2d8899dbf1f42f3fde3643c4fd6d511e", "score": "0.6967682", "text": "def create\n @yamat...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bef294bfe40f1a0c3123f1f559aafa58", "score": "0.0", "text": "def sfmodule_params\n params.require(:sfmodule).permit(:name, :pillar_id)\n end", "title": "" } ]
[ { "docid": "e164094e79744552ae1c53246ce8a56c", "score": "0.6981273", "text": "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "title": "" }, { "docid": "e662f0574b56baff056c6fc4d8aa1f47", "score": "0.6783789", "text": "def strong_params\n params.requi...
dd7d60a21fd19c1f14b5fcbcb6721948
apply standardized naming convention to all Collections within Community
[ { "docid": "7598fb9322ddff54e769b0dc88f7c344", "score": "0.0", "text": "def name_workflow_groups\n @obj.getCollections.each { |col| DSpace.create(col).name_workflow_groups }\n self\n end", "title": "" } ]
[ { "docid": "e14db69ee04b69b8a0a15d800d349584", "score": "0.72138846", "text": "def set_collection_name(_arg0); end", "title": "" }, { "docid": "3a4e68047e79f134cccd816f531997f0", "score": "0.6965328", "text": "def collection_name=(_arg0); end", "title": "" }, { "docid": "...
d2557060f5bc66429b4e6d1f2f66da36
I worked on this challenge [by myself, with: Chris Pine lol:)]. Your Solution Below
[ { "docid": "d7c97f4819965c5e967b623334f0c920", "score": "0.0", "text": "def leap_year?(year)\nyear % 4 ==0 && (year %100 !=0 || year % 400 ==0)\n\nend", "title": "" } ]
[ { "docid": "b9960478999684c2b536f76e22f6fc63", "score": "0.64178145", "text": "def solution4(input)\n end", "title": "" }, { "docid": "bca12d2414c241325b8beea187f866fa", "score": "0.62419665", "text": "def isLucky(n)\r\nhalf1 = []\r\nhalf2 = []\r\nn_string = n.to_s\r\n\r\n\r\nfirsth...
d98913f7a69789ba00b69876c7861684
Ensures that a nonzero response from the system proxy delete call and the ignore errors flag disables results in an exception bubbling.
[ { "docid": "647bd239cc9193531fc2e4abde2f28ec", "score": "0.6393242", "text": "def test_delete_all_ignore\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_delete).with(anything, anything, anything, anything, anything).returns(['Stdout', 'Stderr', 1]).onc...
[ { "docid": "cebee8566df3d485662b64fd680545e8", "score": "0.6619321", "text": "def test_delete_failure\n proxy = OpenShift::FrontendProxyServer.new\n\n uid = 500\n\n proxy.expects(:system_proxy_show).with(35531).returns(\"127.0.0.1:8080\").once\n proxy.expects(:system_proxy_delete).with(35531...
45e2f668a8f3e2ce25c128fab18cdabc
Execute this migration in the named direction
[ { "docid": "217003a6dd4b183da07d831f9c2dbab8", "score": "0.5914087", "text": "def migrate(direction)\n return unless respond_to?(direction)\n\n case direction\n when :up then announce \"migrating\"\n when :down then announce \"reverting\"\n end\n\n result ...
[ { "docid": "4853d7c5f5d4f8ccd71178af47db6e83", "score": "0.69874614", "text": "def run_migration; end", "title": "" }, { "docid": "01f11a8451dd306df374c49537e5c95f", "score": "0.6923416", "text": "def migrate(direction)\n @dir = direction\n super\n end", "title": "" }, ...
8cb7cac566bd1cfe11dcd27b8094b259
Delete the image after it has been rendered in the pdf.
[ { "docid": "b3aa8a6d7f3c41dcee7f54c60843d527", "score": "0.69402206", "text": "def delete_image(image_name)\n File.delete(image_name)\n end", "title": "" } ]
[ { "docid": "441005c2c3a4fd1f109b1c0310ddbb88", "score": "0.7118611", "text": "def delete_files\n\t\t\tFileUtils.rm_rf(@clean_image)\n\t\t\tFileUtils.rm_rf(@image) if pdf?\n\t\tend", "title": "" }, { "docid": "e57471cbc7e4d176ba238b8ec1f6425f", "score": "0.7111299", "text": "def destr...
f97bf132f68718c3cd1df11e5e62e454
def try_to_install_gem(name, repository=nil, version = '>0') ret = false require 'rubygems/command.rb' require 'rubygems/dependency_installer.rb' inst.install name, version TODO WIZARD TODO accept repository, too end
[ { "docid": "5b9f19b0d286bbccad69c480a718c928", "score": "0.8581696", "text": "def try_to_install_gem(name, repository=nil, version = '>0')\n ret = false\n \n sh=ArcadiaSh.new\n cmd = \"gem install #{name}\"\n cmd=\"sudo #{cmd}\" if !is_windows?\n cmd+=\" --source=#{repository}\" if rep...
[ { "docid": "5fac58ce7f5552fd276db4b41e00181d", "score": "0.76482093", "text": "def install_gem name, version = nil\n gem_cmd = Gem.default_exec_format % 'gem'\n sudo = 'sudo ' unless Hoe::WINDOZE\n local = '--local' unless version\n version = \"--version ...
28b7887d7b88381e25dddc8038e6e410
GET /consumer_categories/1 GET /consumer_categories/1.json
[ { "docid": "a36f1ac92f53f0699580e1fe9efa898e", "score": "0.71765876", "text": "def show\n @consumer_category = ConsumerCategory.find(params[:id])\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @consumer_category }\n end\n end", "title": ""...
[ { "docid": "04779fc6a7223751fb3e79f2b7a6f82c", "score": "0.6920756", "text": "def get_categories\r\n categories = Taxonomy.get_categories\r\n render json: categories, root: 'categories', adapter: :json, status: :ok\r\n end", "title": "" }, { "docid": "5764a0170d2f7500c118bf40f6e4a5d2"...
9f2a4305718c9376a69d7a39783ecbe6
Removes boost from a selected bot/server
[ { "docid": "71a2ec92f51f99783bedf3a512cb10fc", "score": "0.72343606", "text": "def delete_boost(id, type = :bot)\r\n DList._validate_id id\r\n raise DList::Error, DList::Errors::TYPE_NOT_ALLOWED unless DList::User::Client::ALLOWED_TYPES.include?(type)\r\n\r\n DList._delete(\"/#{type}s/#{i...
[ { "docid": "e257ef1ebecc70a65a4b758717ed856a", "score": "0.63256526", "text": "def deactivate_boost(stateid)\n @act_boosts = [] if @act_boosts.nil?\n @act_boosts.delete(stateid)\n end", "title": "" }, { "docid": "948aac0f3dfe831ec0d368239bd50b68", "score": "0.6269274", "text":...
05893355be9d37c0b161d3746390bb02
def link_to_slides_2 ' Slides ' end
[ { "docid": "276e08b06d25bd53b346f3172fb5c539", "score": "0.7781156", "text": "def link_to_slides(attrs = {})\n link_to(\"slides\", \"./slides.html\", attrs)\n end", "title": "" } ]
[ { "docid": "ab573e5ee93788eed4ad344e65862ba7", "score": "0.6570946", "text": "def show\n @slides =@lecture.slides(params[:urlpage])\n \n end", "title": "" }, { "docid": "3312da46735b8b93fb74eb05448d2856", "score": "0.6528411", "text": "def slideshow\n self\n end", ...
f0536860dba074732b7a0d7ceb32542e
Generates a sync token Return values: On success: 200 OK => [user, personal_key] (same as user_create) On failure: Cannot fail (unless not authenticated) URL params: : Login of the user to sync : Output format wanted POST params: auth_token: timebased token generated (string, length == 8) Query URLs: POST /users//sync_...
[ { "docid": "26891f9d1d6788be8acdf3c454d0b7de", "score": "0.74811584", "text": "def create\n prev = @user.sync_tokens.current.first\n prev.revoke! if prev\n sync_token = @user.sync_tokens.create\n @response.status = :created\n @response.body = sync_token\n respond\n end", "title": ...
[ { "docid": "e12a0ace9fb6bd8d7e9db220b399baee", "score": "0.67996055", "text": "def sync_token\n end", "title": "" }, { "docid": "3fcae0367795fe1a3c875f52edc335ca", "score": "0.6715101", "text": "def account_sync\n sync_token = @user.sync_tokens.current.find_by_sync_token pa...
60bf3745b7b16d66e5a4114cfd310ed6
This method logs the supplied buffer as coming from the local side of the session.
[ { "docid": "708e1802aeac452721020f7b2bcc6730", "score": "0.7099164", "text": "def log_from_local(buf)\n\t\trlog(buf, log_source)\n\tend", "title": "" } ]
[ { "docid": "bda2ed11a9144f87f7269340668c0b22", "score": "0.6796617", "text": "def log_from_remote(buf)\n\t\trlog(buf, log_source)\n\tend", "title": "" }, { "docid": "bda2ed11a9144f87f7269340668c0b22", "score": "0.6796617", "text": "def log_from_remote(buf)\n\t\trlog(buf, log_source)\...
bc25af3d63330f481daf80743950b2c3
PATCH/PUT /ambulanceinfos/1 PATCH/PUT /ambulanceinfos/1.json
[ { "docid": "7a11e378ccbcdfade500642e64fa75b8", "score": "0.7355907", "text": "def update\n respond_to do |format|\n if @ambulanceinfo.update(ambulanceinfo_params)\n format.html { redirect_to @ambulanceinfo, notice: 'Ambulanceinfo was successfully updated.' }\n format.json { render ...
[ { "docid": "dcd8cfed63d87d12c71e62ace36d7cbe", "score": "0.6578657", "text": "def update\n @ambiance = Ambiance.find(params[:id])\n\n respond_to do |format|\n if @ambiance.update_attributes(params[:ambiance])\n format.html { redirect_to(@ambiance, :notice => 'L ambiance a ete modifiee....
3d55cc4e86bb9c60a0a7bda068bbe705
Drops a PostgreSQL database. Example: drop_database 'matt_development' source://activerecord//lib/active_record/connection_adapters/postgresql/schema_statements.rb53
[ { "docid": "d510ed2f37f7a6cd4db8ca77ce1fa808", "score": "0.80328447", "text": "def drop_database(name); end", "title": "" } ]
[ { "docid": "e8907fc90dea2c3da7f029a8b95ca392", "score": "0.86371076", "text": "def drop_postgresql_database database, user, password, host\n Rake::Task['db:drop'].invoke\n end", "title": "" }, { "docid": "e8e6347f066335166c015ea06750e776", "score": "0.83442765", "text": "def psql...
7dd4dcaa2dc9a8c09c4f297120316d97
POST /assignments POST /assignments.json
[ { "docid": "8545d84abb0c1bd3b73da2a514484b5a", "score": "0.58894914", "text": "def create\n unless current_user.instructor?(@course)\n return\n end\n if params[:assignment][:submission_due_date].blank? or params[:assignment][:review_due_date].blank?\n flash[:error] = 'Please fill in d...
[ { "docid": "6036033b73732a6b5794f660654178da", "score": "0.6971812", "text": "def create\n @assignment = Assignment.new(assignment_params)\n @assignment.creator_id = current_user.id\n\n # THIS IS ONLY FOR CREATING ASSIGNMENT FOR THE VERY FIRST TIME\n # if users wants to add more users to thi...
aa735cc6a7ced2fb23f0351a6388da9a
Fecha en que se ejecutara el job, es la fecha hasta del validez del paquete o promocion
[ { "docid": "50604e8c72724b3eacaa08c23dcc5603", "score": "0.6026814", "text": "def fecha_validez\n run_at = self.valid_until\n end", "title": "" } ]
[ { "docid": "1dfa5e643313a0179e2efcfeca2e8bed", "score": "0.6608129", "text": "def execute(job, time)\n end", "title": "" }, { "docid": "ca8058b83c9ab6fbff65c9ea3ca519ba", "score": "0.6333887", "text": "def ejecutarEnFecha(empleado,fecha)\n time = Time.new\n cheque = Cheque.n...
8e584ee5b88f5423ae896fe0af3eaabe
Helper method. Call this when you want to log an info message. Logs to the standard logger.
[ { "docid": "5fbfa04f035feb8512a10eb202c94919", "score": "0.0", "text": "def info(description)\n SC.logger.info(description)\n end", "title": "" } ]
[ { "docid": "860e5fdcf858cf6cf65032d74d350f27", "score": "0.8694632", "text": "def info(info)\n @logger.info info\n end", "title": "" }, { "docid": "2801a31f8dbb8644183a7075f752d610", "score": "0.8627331", "text": "def info(msg)\n log msg, :info\n end", "title": ""...
fcd39474a8e3d28bbc1b2b37a5169fa0
GET /affiliate_reward_settings/1 GET /affiliate_reward_settings/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "b514648fafe866df5cdc20589ee1af64", "score": "0.7701516", "text": "def index\n @affiliate_reward_settings = AffiliateRewardSetting.all\n end", "title": "" }, { "docid": "1a4f831b5c1d2b0ec1d60ebe6a42262d", "score": "0.7481776", "text": "def set_affiliate_reward_setting\...
bcb5bf133c1545252ac7a52003fb7a03
See < for specifics on the DC protocol
[ { "docid": "24bf750f4a175bd261a9c110e3f429bd", "score": "0.0", "text": "def receive_message type, message\n case type\n when :lock\n @validated = false\n send_message 'Key', generate_key(message[:lock])\n when :hubname\n @hubname = message[:name]...
[ { "docid": "5a9c239ddfc810dc44c25ff426860250", "score": "0.6048034", "text": "def connection_type\n :dc\n end", "title": "" }, { "docid": "5f3bd50ea129c1a325a4bafc165d4ebb", "score": "0.60143775", "text": "def ips_sd; end", "title": "" }, { "docid": "d631b73c6...
558567e9f385ffb941d56ad90e2b7d13
POST change_to_todo/:id changes task's status from done to todo
[ { "docid": "626e1a0eb7574502992b5efe0a5b6b8a", "score": "0.8146274", "text": "def change_to_todo\n @task = Task.find(params[:id])\n @task.done = false\n @task.save\n redirect_to root_path\nend", "title": "" } ]
[ { "docid": "f6be716b62e2ef8a1aeb1bc2033b8d1b", "score": "0.723696", "text": "def update\n @todo = Todo.find(params[:id])\n \n if params[:todo][:done]\n \n if params[:todo][:done].to_s == \"true\" \n res = \"done\"\n params[:todo][:done_at] = Time.now\n ...
59de05832958a0ccf21470f742ed83c6
refactored create loop, sorting array each time pop off the last two elements, x & y if their difference (yx) is not zero, push that difference back onto the array now we either have an empty array, meaning we should return 0, or one element left to return
[ { "docid": "6b30dbe973f028a447bba3f080f1f5bb", "score": "0.0", "text": "def last_stone_weight(stones)\n while stones.length > 1\n stones.sort!\n y = stones.pop\n x = stones.pop\n stones.push(y-x) if y-x != 0\n end\n stones.empty? ? 0 : stones[0]\nend", "title": "...
[ { "docid": "00200124ba790b23d9f76a394d106be3", "score": "0.68870884", "text": "def diff_zero( nums )\n\n i = 0\n\n from_back_of_array = nums.length() - 1\n\n # puts(\"from_back_of_array #{from_back_of_array}\")\n\n indices = []\n\n up_one = 1\n\n param_length = nums.length() - 1\n\n # puts(\"para...
9444792d56572dbbc3bfd4abab0d468b
GET /sites/1 GET /sites/1.json
[ { "docid": "9020a763ddd42a52b6c079155ce12300", "score": "0.70891887", "text": "def show\n @site = Site.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @site }\n end\n end", "title": "" } ]
[ { "docid": "85f624b9ca21e24fec1a59dafa0c20e1", "score": "0.7546538", "text": "def index\n @sites = Site.all\n render json: @sites\n end", "title": "" }, { "docid": "1c578611b1fd3d62e827e901deee1799", "score": "0.7469465", "text": "def index\n @sites = Site.by_user(current_u...
36713eed5ec2e40531de41351a42a9c6
the name of the monitor socket we use for the running KVM, based on the Machine's name.
[ { "docid": "2352af28122d08234d7592bf4d63dca5", "score": "0.651631", "text": "def monitorfile\n \"/machines/.#{@machine.name}.monitor\"\n end", "title": "" } ]
[ { "docid": "151b3d53e2fe2630780fe498d7746756", "score": "0.6673005", "text": "def host_name\n return @config['os']['host']['name']\n end", "title": "" }, { "docid": "c25764cd45117fdc83ae1cb13c825503", "score": "0.6669566", "text": "def find_socket\n # ps axf | grep qem...
c224ac7248ccde11635dc405ebff3062
Get clients belonging to the realm Returns a list of clients belonging to the realm
[ { "docid": "fb822371a15081a6ef7de1e62b51eb7e", "score": "0.5894707", "text": "def realm_clients_get_with_http_info(realm, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ClientsApi.realm_clients_get ...'\n end\n # verify the required par...
[ { "docid": "6f17c20047c1be77b33b10f4b80a0721", "score": "0.7667306", "text": "def realm_clients_get(realm, opts = {})\n data, _status_code, _headers = realm_clients_get_with_http_info(realm, opts)\n data\n end", "title": "" }, { "docid": "d13c2d78bb25c6756843f5fab7bb874c", "...
f0c6e10fad813236cea46f5392178d94
API header for use at top of API info
[ { "docid": "4d0df6c1c93e526ecefd916d34b4a7d3", "score": "0.7856395", "text": "def api_header\n clear\n puts @api_logo\n end", "title": "" } ]
[ { "docid": "5a3813e6ae57ee414d53fc8661eda734", "score": "0.80859804", "text": "def headers\n @apiheader\n end", "title": "" }, { "docid": "5a3813e6ae57ee414d53fc8661eda734", "score": "0.80859804", "text": "def headers\n @apiheader\n end", "title": "" }, { "docid":...
91aaead79a7b11cbfdd42f275c69b9c0
Replaces all identified variables with the matching properties in the payload ==== Parameters +params+ the Postman URL POST request parameters
[ { "docid": "021d315da2ea0de65ebd52140fa64ad9", "score": "0.69487023", "text": "def process params\n begin\n @template[:payload].each_pair do |key,value|\n variables = @help.identify_variables @template[:payload][key]\n variables.each do |v|\n unless params[v].nil...
[ { "docid": "503e0c68f84e5da84d13f98f494aebb2", "score": "0.62802726", "text": "def envify_params(params)\n params.each_with_object({}) do |(k, v), h|\n v = v.to_json unless v.is_a?(String)\n h[\"PT_#{k}\"] = v\n end\n end", "title": "" }, { "docid": "32e1...
a6655a98d6ef956d37ed3a2edf81189f
VOID ClientName Identify the client
[ { "docid": "407cf892666925d9b8e76d80377b18af", "score": "0.7594763", "text": "def ClientName=(arg0)", "title": "" } ]
[ { "docid": "f053cbcc585dfb48172b19201952aac8", "score": "0.767458", "text": "def client_name\n\t\t\n\tend", "title": "" }, { "docid": "67a23ebd8b74cbcd16afe7e443540867", "score": "0.74979794", "text": "def client_name; end", "title": "" }, { "docid": "3cb887c6b91e94758edb...
0c60fbc214bb4d10cd6240f1276cfe6d
individual integers or a range of integers denoted by the starting integer separated from the end integer in the range by a dash, ''. The range includes all integers in the interval including both endpoints. It is not considered a range unless it spans at least 3 numbers. For example ("12, 13, 1517") Complete the solut...
[ { "docid": "268ed7b06fb1b5860c93c906de794650", "score": "0.6376599", "text": "def solution(array)\n array = array.compact.uniq.sort\n ranges = []\n if !array.empty?\n left, right = array.first, nil\n array.each do |obj|\n if right && obj != right.succ\n ranges << Range.new(left,righ...
[ { "docid": "b57c5fdab058247051432a3f00f11dd6", "score": "0.7507335", "text": "def to_s\n return '' if range.nil?\n [range.min, range.max].uniq.join('-')\n end", "title": "" }, { "docid": "1bb6629b306ed9e56d29cbbd50e6b27a", "score": "0.7192951", "text": "def to_s()\n \...
73b40d5f49c211263b00e7ddcb22d695
GET /galleries GET /galleries.json
[ { "docid": "29d2d8a717820e50a18cbf89b3a15146", "score": "0.0", "text": "def index\n @galleries = Gallery.chronological.order(:name).paginate(:page => params[:page])\n end", "title": "" } ]
[ { "docid": "6694330a3b8825be16bed3ca60ad03c3", "score": "0.8698901", "text": "def galleries\n get(FinerWorks::Gallery, \"/Galleries\")\n end", "title": "" }, { "docid": "ea1969f104ef4289434158e802f63742", "score": "0.8372952", "text": "def index\n \n @galleries = @user....