query_id
stringlengths
32
32
query
stringlengths
7
6.75k
positive_passages
listlengths
1
1
negative_passages
listlengths
88
101
929ae127fe1d2ad28f9bb5e30c1ee00f
REQUIRE AUTH ROUTES BEGIN
[ { "docid": "1a164da23a60058589a3a4a7ecd577e0", "score": "0.0", "text": "def auto_login\n render json: @user\n end", "title": "" } ]
[ { "docid": "fa6526d3fd557f8a24ba2a64757d065e", "score": "0.7177391", "text": "def auth\n end", "title": "" }, { "docid": "fa6526d3fd557f8a24ba2a64757d065e", "score": "0.7177391", "text": "def auth\n end", "title": "" }, { "docid": "0a14fa01faa49d9da7bf9adbca30ee0a", ...
8d5191e343d8c60c53347b48f3467c44
here i forget a persistent session
[ { "docid": "f373792007fc00901b9e0c8d821f5a18", "score": "0.0", "text": "def forget_doctor(doctor)\n doctor.forget_doctor\n cookies.delete(:doctor_id)\n cookies.delete(:remember_token)\n end", "title": "" } ]
[ { "docid": "5243a18da989fbec0e95ad251c878a3f", "score": "0.759555", "text": "def reset_session!; end", "title": "" }, { "docid": "5243a18da989fbec0e95ad251c878a3f", "score": "0.759555", "text": "def reset_session!; end", "title": "" }, { "docid": "caa2e4cdd640ff3beed0a3d4...
eaa88837fdef7812f3e623d09878a24d
Given the information, return a string to write to the log upon failure SUBCLASSES SHOULD REDEFINE THIS TO SOMETHING USEFUL
[ { "docid": "179121526f00e4663794028fcc305d6e", "score": "0.58556163", "text": "def failure_str(_args)\n raise NoMethodError, \"Subclass must define the #{__method__} method and return a string\", caller\n end", "title": "" } ]
[ { "docid": "8d5b7395278e6204ef31855befa48c31", "score": "0.6838346", "text": "def log information \n raise \"Must Implement Log Method\"\n end", "title": "" }, { "docid": "8c2522ce746e57d27cf8b2e10a52378b", "score": "0.6606146", "text": "def info(description); logger.info(descrip...
79bde80844ed844faa242f9eafe384d6
Aggregates on a tuple occurence.
[ { "docid": "fc5cd39f74f39e85ee9734eed4c072c7", "score": "0.0", "text": "def _happens(memo, val) \n memo << val\n end", "title": "" } ]
[ { "docid": "4ae095f3054f43e5034b6556aed8dc93", "score": "0.670644", "text": "def aggregate(enum)\n scope = Support::TupleScope.new\n finalize(enum.inject(least){|m,t| happens(m, scope.__set_tuple(t))})\n end", "title": "" }, { "docid": "c2f1529a5b206a52794d65c69effb920", "sc...
15ed9961fe61bf7fcf658d66715dc461
List any search_reports_ fields that represent criteria to feed to another report in the UI
[ { "docid": "62e4b9551b314c19eb47811743842340", "score": "0.81982535", "text": "def search_reports_fields\n @search_reports_fields ||= all_configured_edit_fields.select { |s| s.to_s.start_with?('search_reports_') }\n end", "title": "" } ]
[ { "docid": "f0065ab487a6ab841e5a3498f521703a", "score": "0.6723479", "text": "def search_fields\n [ 'summary', 'description', 'address' ]\n end", "title": "" }, { "docid": "ba2d77da2b66fb9a33f7988207f09d14", "score": "0.67121196", "text": "def edit_fields\n all_configured_ed...
5555abbbe4df2af44267645b93e5b474
Clean up a signal string/integer. Ints are mapped to the signal name, and strings are reformatted to upper case and without the SIG.
[ { "docid": "cc5928d1584e94b32f929fe1ecccaea4", "score": "0.77066284", "text": "def clean_signal(signal)\n if signal.is_a?(Integer)\n raise Error.new(\"Unknown signal #{signal}\") unless (0..31).include?(signal)\n Signal.signame(signal)\n else\n short_si...
[ { "docid": "41f725b95b3d15988f11e941226532bf", "score": "0.5777983", "text": "def signal(signal)\n @signal = Signal.list[signal.to_s.upcase].tap do |sig|\n unless sig\n raise \"'#{signal}' not found -- see http://ruby-doc.org/core-1.8.7/Signal.html#method-c-list\"\n end\n ...
a9a62b99694bd3826e434715701c0fe5
a failfast, hopefully helpful version of system
[ { "docid": "849436342092db53a210b1df6fc6c714", "score": "0.5415169", "text": "def system!(cmd)\n unless system(cmd)\n raise <<-SYSTEM_CALL_FAILED\nThe following command failed:\n #{cmd}\nSYSTEM_CALL_FAILED\n end\nend", "title": "" } ]
[ { "docid": "ca848521315d82fdc8f1928b9e0c5f67", "score": "0.6691524", "text": "def system; end", "title": "" }, { "docid": "ca848521315d82fdc8f1928b9e0c5f67", "score": "0.6691524", "text": "def system; end", "title": "" }, { "docid": "0b47c7bbf158a08945a18c5355a04daf", ...
bc409c8fd34d86d98b320b952d49df8c
Getting username, and verifying it against our data
[ { "docid": "c0c05d1ffcd9eb590cf2d8abd8f80848", "score": "0.77110004", "text": "def get_username( session, data )\n username = session.gets.chomp\n unless data[username]\n debug_msg \"NOT AUTHORIZED. Unknown username \\\"#{username}\\\". Closing session with #{session.peeraddr[2]} #{Time.now}\...
[ { "docid": "017059d73767166e00151451da9cd058", "score": "0.7550797", "text": "def ensure_username\n if self.username != \"\"\n self.username \n else\n self.username = \"user#{((self.email).hash).to_s[0,6]}\"\n end\n end", "title": "" }, { "docid"...
2932ac13ca8dbad22ab52994a4e1258a
TODO better way to handle shit urls.
[ { "docid": "7d477994a2a827254db339e6c9081078", "score": "0.0", "text": "def domain url\n domain = URI.parse(url.sub(%r{[?#].*$}, '').gsub(/\\s/, '+')).domain rescue nil\n domain || url.scan(%r{https?://([^/]+)}).first\n end", "title": "" } ]
[ { "docid": "0740b6aa1fcfd5206194cca3aa668796", "score": "0.712977", "text": "def url; end", "title": "" }, { "docid": "0740b6aa1fcfd5206194cca3aa668796", "score": "0.712977", "text": "def url; end", "title": "" }, { "docid": "0740b6aa1fcfd5206194cca3aa668796", "score"...
20bf063ab50cf2cfae13286499b8e39c
Initialize reservations object Holds growing and shrinking list of ticket reservations
[ { "docid": "738e8a74e7b4e816b23efb87ddcb3241", "score": "0.694603", "text": "def initialize\n @reservations = {}\n @lockers = Lockerz::Lockers.new\n end", "title": "" } ]
[ { "docid": "023046e3e41cd8eecd3b604faadfa28b", "score": "0.75554866", "text": "def initialize\n @rooms = list_rooms\n @reservations = []\n end", "title": "" }, { "docid": "54087b7479a1f835f613a1fa47c6c8dc", "score": "0.7495674", "text": "def initialize\n @reservatio...
a1dd843f04026ff537456c14a5eb6f8a
GET /library_categories/1 GET /library_categories/1.xml
[ { "docid": "08e3c97735c399c460a4114f205e5f09", "score": "0.6945182", "text": "def show\n @library_category = LibraryCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @library_category }\n end\n end", "title": "" }...
[ { "docid": "bd7f457291ea26e7a11c69e4c64b3fd9", "score": "0.75895184", "text": "def fetch_categories\n xml = \"Request categories.\"\n respond_with_raw get(\"#{BASE_URL}/v1/categories?api_key=#{API_KEY}&format=json\", :body => xml)\n end", "title": "" }, { "docid": "8fb11c432a8bb2c5fc1...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "bad6297c5101b0ea979a58c06cd4f164", "score": "0.0", "text": "def physical_exam_params\n params.require(:physical_exam).permit(:ta_mmgh, :heart_rate, :breathing_frequency, :sat_of_o_ambiente, :sat_of_o_supplementary, :temperature, :weight, :in, :kilograms, :height_in_centimeters, :glucose...
[ { "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...
2423030e4bd55832136bfcdc37524949
extract comments from the file
[ { "docid": "3b7d70cb74dd7b7fa04b65e0a19a678f", "score": "0.8869695", "text": "def extract_comments(file)\n\nend", "title": "" } ]
[ { "docid": "d218820e4456d964cd5820af57904f20", "score": "0.74802136", "text": "def source_file_comments(file)\n file_parts = { dir: File.dirname(file), name: File.basename(file) }\n content = File.read(file)\n matches = content.scan(HEADER_LICENSE_REGEX)\n matches.map...
729131da301ec0ee5645cf5dd5273768
create new object of Course and Batch, make association between course and batch,and perform authorization
[ { "docid": "7586bd0d94fa2975c903eb28dab66355", "score": "0.80530035", "text": "def new\n @course = Course.new\n @batch = Batch.new\n @course.batches.build\n authorize! :create, @course\n end", "title": "" } ]
[ { "docid": "0813739a4d964fb4ab0b7c86fb82958f", "score": "0.7710107", "text": "def new\n @course = Course.shod(params[:course_id])\n @batch = @course.batches.build\n authorize! :create, @batch\n end", "title": "" }, { "docid": "7bdcbef1617721182e25e8141dcf46d7", "score": "0.7371...
a9e192a9e63ea2bda4425809c30bcb86
GET /webmaster/categories/1 GET /webmaster/categories/1.json
[ { "docid": "e2c615a575f11f1a3d9e6ea4b747a9b7", "score": "0.6893095", "text": "def show\n @category = Category.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n #format.json { render json: @webmaster_category }\n end\n end", "title": "" } ]
[ { "docid": "efcb5e10780279c84a4be599091f0268", "score": "0.8020379", "text": "def categories\n call_api('/categories')\n end", "title": "" }, { "docid": "3cba43678b445865af5afd71d9719de9", "score": "0.79819965", "text": "def get_categories()\n response = RestClient.get @ho...
dfcb4f3b95f4ace173ff5c61c5bf4cfa
This method is called if the underying machine ID changes. Providers can use this method to load in new data for the actual backing machine or to realize that the machine is now gone (the ID can become `nil`). No parameters are given, since the underlying machine is simply the machine instance given to this object. And...
[ { "docid": "a0d53e1eec23a3279d7050fb1b1d2dc5", "score": "0.7618911", "text": "def machine_id_changed \n end", "title": "" } ]
[ { "docid": "40714c8527c9c5bd53c0e2016caa26b7", "score": "0.77230597", "text": "def machine_id_changed\n end", "title": "" }, { "docid": "40714c8527c9c5bd53c0e2016caa26b7", "score": "0.77230597", "text": "def machine_id_changed\n end", "title": "" }, { "docid": "...
fb50df19f9aa13a1674390b56348c525
GET /payments GET /payments.json
[ { "docid": "ec96767393645acdb451a56d9424f8e8", "score": "0.74464226", "text": "def index\n @payments = Payment.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @payments }\n end\n end", "title": "" } ]
[ { "docid": "64465651022d07dfe82005c89d193e8c", "score": "0.79699916", "text": "def get_payments\n response = self.class.get('/payments', headers: authorization_header)\n response.parsed_response['payments']\n end", "title": "" }, { "docid": "481c9fcb4cd29ebd951992aa1c6d11ed", ...
c97990bb9ae9e15b349a6207f0ab62f1
Extracts metadata from a file. Metadata should be in the YAML format. Metadata should be at the very start of the file. It removes the metadata from the content that will be parsed.
[ { "docid": "6f4ef79ce35f634e2eda480d7153ec99", "score": "0.745523", "text": "def extract_metadata\n YAML_METADATA.match(content) do |match|\n @metadata = YAML.load(match[0])\n @content = content.gsub(YAML_METADATA, \"\")\n end\n end", "title": "" } ]
[ { "docid": "4fce8c77dfa2d3cf22eed42e11743a82", "score": "0.7076982", "text": "def read\n @metadata = {}\n @content = File.read(path)\n\n if @content =~ /^(---\\s*\\n.*?\\n?)^(---\\s*$\\n?)/m\n @content = $POSTMATCH\n\n begin\n @metadata = YAML.load($1)\n ra...
81ec63faabefbc768951b50d597b9215
p exp_one(0, 0) p exp_one(5, 0) p exp_one(5, 3) p exp_one(0, 3)
[ { "docid": "7468d0b807f0ce220a91277b9bb3b3ba", "score": "0.5652186", "text": "def exp_two(num, power)\n return 1 if power == 0\n return num if power == 1\n if power.odd?\n exp = exp_two(num, (power - 1) / 2)\n num * exp * exp\n else\n exp = exp_two(num, power / 2)\n exp * exp\n end\nend...
[ { "docid": "7c6da6558f781615ecd480a493006201", "score": "0.74669254", "text": "def exp_1(base, exp)\n return 1 if exp == 0\n\n base * exp_1(base, exp-1)\nend", "title": "" }, { "docid": "3fc27dbe61feafdd653210860003d203", "score": "0.73547494", "text": "def exponentiation_one(base,...
bbb380b4b3794a7c9c6b43aba50c4d0f
Fills a bucket with random, but testable objects
[ { "docid": "7512721fcf8a99c9706799d13c34fc92", "score": "0.5688888", "text": "def load_bucket_with_objects(bucket)\n 50.times do\n bucket.put_object({\n acl: \"private\",\n body: SecureRandom.hex,\n key: \"#{SecureRandom.uuid}.txt\",\n content_type: \"text/plain\",\n ...
[ { "docid": "d02099f7000dd950d4f9525ab2944fb6", "score": "0.67258525", "text": "def random_from(bucket, num)\n #ret = {}\n\n rbucket = buckets[\"#{bucket}\"]\n\n begin\n\n ret = rbucket.sort_by{ rand }.slice(0..num-1).collect { |k,v| { k => v } }\n\n rescue Exception => e\n puts e.m...
781498e0d30bde67a0885b0e824e51e7
Workaround the fact that Ruby's Etc module doesn't believe in negative uids, so negative uids show up as the diminished radix complement of a uint. For example, a uid of 2 is reported as 4294967294
[ { "docid": "ce3b986a6181c71a80db7847dbbd18c4", "score": "0.7160803", "text": "def diminished_radix_complement(int)\n if int > UID_MAX\n int - UINT\n else\n int\n end\n end", "title": "" } ]
[ { "docid": "f0a738337e728c54c5fcc388424e47de", "score": "0.6824255", "text": "def get_uid_int\n self.uid.to_i\n end", "title": "" }, { "docid": "455e6caef5e8a998df93040c2332a27a", "score": "0.6564732", "text": "def uint(int)\n \"%064x\" % int\nend", "title": "" }, { ...
8c9e556b2db34055d86fcdbcb56bf6f0
Returns a single Tender category.
[ { "docid": "61da807f1f85c605d91a19d99b0ff272", "score": "0.6468683", "text": "def get_category(id_or_href)\n get(singleton_uri(id_or_href, 'categories'))\n end", "title": "" } ]
[ { "docid": "3ae3247080cc8451a014be9bb0d7ffa1", "score": "0.7673018", "text": "def category\n if self[:category] == nil\n return nil\n end\n return Truck.categories[self[:category]]\n end", "title": "" }, { "docid": "df6a455ecde3f107217230b3b4c99976", "score": "0.75831383",...
f98254a949c8c7e28bac31a95b43ccb2
Returns the percentage of the partition that has been used.
[ { "docid": "770020d744534bb42033dbdd1b7c6f05", "score": "0.77325624", "text": "def percent_used\n 100 - (100.0 * bytes_free.to_f / bytes_total.to_f)\n end", "title": "" } ]
[ { "docid": "7b2d3764818ad23bf8f0a862c42cdd79", "score": "0.8017847", "text": "def used_percentage\n used.to_f / total.to_f * 100\n end", "title": "" }, { "docid": "96a88a900fa36594e2c39cb987340011", "score": "0.7896488", "text": "def disk_percent_used\n info = get_device_i...
4c775aedf5d3a641422da189b9a2f29a
GET /tasks/1 def show end GET /tasks/new
[ { "docid": "6294d57b9a0c74d17eb4d189371d65d8", "score": "0.0", "text": "def new\n @task = current_user.tasks.where(project_id: @project.id).new\n end", "title": "" } ]
[ { "docid": "78b707da30ac7813237a3b03e6162359", "score": "0.8335453", "text": "def new\n @task = tasks.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n end\n end", "title": "" }, { "docid": "b929dacb1a2178e674199ce7c3220b87...
fb6594cf19d8cb783dae1d1e1af633f7
Create a procedure to uppercase only Strings beginning with letter 'a' or 'A'. Proc returns original object if not String.
[ { "docid": "31bd2507b9d224fce5adca0be7eeaea7", "score": "0.7052968", "text": "def bring_up\n proc do |x|\n x = x.upcase if (x.class == String) && ((x[0] == 'a') || (x[0] == 'A'))\n x\n end\nend", "title": "" } ]
[ { "docid": "ff72cf96a2b47610c6a22a59b36b9d37", "score": "0.7120385", "text": "def destructive_uppercase(str)\n is_uppercase = lambda { |char| char == char.upcase }\n str.chars.select(&is_uppercase).join \nend", "title": "" }, { "docid": "c4b2489a745b2fc60b1c6dcd97f388dd", "score...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "6a2c2edf3411ef9b3d13e6f4b7cb5adf", "score": "0.0", "text": "def slider_params\n params.require(:admin_slider).permit(:title, :description, :status, :image)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.74968386", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.6958337", "text": "def strong_params\n params.require(:request).permit(param_whit...
f7a60d349746901aa33544f5b82316d6
True if this requirement satisfied by the Gem::Version +version+.
[ { "docid": "0710847bb3cd7d550e252222820b3e78", "score": "0.83050245", "text": "def satisfied_by?(version)\n normalize\n @requirements.all? { |op, rv| satisfy?(op, version, rv) }\n end", "title": "" } ]
[ { "docid": "d8463368753386b8b8b787174af30ce2", "score": "0.894561", "text": "def satisfied_by?(version)\n @requirement.satisfied_by?(Gem::Version.new(version))\n end", "title": "" }, { "docid": "3905327230e315f98799bb3d985f19be", "score": "0.8374001", "text": "def sat...
0657aeb93ec18e69d73aeb5aec9d15f5
Access doesn't support INTERSECT or EXCEPT
[ { "docid": "28fbcd7af66008e303d04aad70b63ec4", "score": "0.6724983", "text": "def supports_intersect_except?\n false\n end", "title": "" } ]
[ { "docid": "e0b2c7ccdf0dac98f52a5f035866ebf6", "score": "0.6929062", "text": "def supports_intersect_except?\n true\n end", "title": "" }, { "docid": "e0b2c7ccdf0dac98f52a5f035866ebf6", "score": "0.6929062", "text": "def supports_intersect_except?\n true\n end", "...
198bedc7e221e93249aca8a6d622eeac
Helper to initialize a nondevelopment Vault server and store the new token
[ { "docid": "cc59868e4827e0e4040757d2be58f9ed", "score": "0.7665189", "text": "def init(**options)\n raise 'Cannot initialize a Vault server in development mode' if dev?\n\n options[:shares] ||= 1\n options[:threshold] ||= 1\n\n result = client.sys.init(options)\n\n ## Capture th...
[ { "docid": "13cdeff34ca14d9a03410d246c39cdf3", "score": "0.6848278", "text": "def app_init\n @vk = VK::Serverside.new app_id:APP_ID, app_secret: APP_SECRET#, settings: SETTINGS\n @vk.settings = SETTINGS\n @vk.access_token = session[:access_token] if isAuth?\n end", "title": "" }, { ...
46316d3afc18989aca7301ca08f56067
of both of the given numbers
[ { "docid": "6da4388fe7221ed1d9710d8d1d29aa96", "score": "0.0", "text": "def least_common_multiple(num_1, num_2)\n max = num_1 * num_2\n (2..max).each {|multiple| return multiple if multiple % num_1 == 0 && multiple % num_2 == 0}\nend", "title": "" } ]
[ { "docid": "3a4de2e966a9739fc24fa383c5982acb", "score": "0.70791954", "text": "def two_numbers\n return Ambit::choose(0..5), Ambit::choose(0..5)\nend", "title": "" }, { "docid": "3a4de2e966a9739fc24fa383c5982acb", "score": "0.70791954", "text": "def two_numbers\n return Ambit::choo...
aeda6942840639be9bf001647fd2c9cb
Given a center, radius and angle returns the (x,y) point on the circumference for the given radius length at the given angle. The points are returned as floating point numbers.
[ { "docid": "475b0281e696de2a398c4aa205f1bcd1", "score": "0.7268324", "text": "def getPointOnCircleFloat(cx,cy,r,angle)\n x = cx + (r*Math.cos(Math::PI*angle/180))\n y = cy + (r*Math.sin(Math::PI*angle/180)) \n\n return [x,y]\nend", "title": "" } ]
[ { "docid": "a35348474832b7a17a6a719087397866", "score": "0.71151334", "text": "def getPointOnCircle(cx,cy,r,angle)\n x = cx + (r*Math.cos(Math::PI*angle/180)).round\n y = cy + (r*Math.sin(Math::PI*angle/180)).round \n\n return [x,y]\nend", "title": "" }, { "docid": "cfd84628609e1f6860a9e...
ac34b30caada95b147f9007df68bbaad
GET /whl_sl_price_pttrn_whl_sl_price_xrefs/1 GET /whl_sl_price_pttrn_whl_sl_price_xrefs/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "20f3f7fbf545a096441f768b5cda4c1d", "score": "0.6764111", "text": "def index\n @whl_sl_price_pttrn_whl_sl_price_xrefs = WhlSlPricePttrnWhlSlPriceXref.all\n end", "title": "" }, { "docid": "f15da803efd4c66a88a49725a7519cc9", "score": "0.57716286", "text": "def set_whl_s...
4b0c9072f2081931c7e2a191718484d1
NOTE: index_elements is only valid for the xml as parsed, not after subsequent manipulation
[ { "docid": "199bc55d0329b378fceb9eb6ed498ef3", "score": "0.53828", "text": "def initialize\n @file = {}\n @index_elements = {}\n end", "title": "" } ]
[ { "docid": "7afbda94f42a5adb11d4e110aba5005f", "score": "0.71937776", "text": "def check_index_elements_calculated!\n unless index_elements.size > 0\n raise \"primary access rights not calculated. instantiate by calling '.parse(xml, forindex = true)'.\"\n end\n end", "title": ""...
03649d4caed94052912f4457a0bc28c1
GET /mail_users/1 GET /mail_users/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "8f83b126a3fa0bb039737a6429786c33", "score": "0.72081345", "text": "def show\n @user = User.find(params[:id])\n @emails = @user.emails\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @user }\n end\n end", "title": "" }, { ...
1b652f7158870f3e9aeb402715a808b6
Returns an array of hashes returned by fetch_hash Passing a block will act as map
[ { "docid": "1257a00aec4cef6d5daae4d62fc05a9b", "score": "0.63993186", "text": "def hashes(with_table=false, &block)\n rows = []\n self.each_hash(with_table) do |row|\n rows << ((block) ? yield(row) : row)\n end\n rows\n end", "title": "" } ]
[ { "docid": "b1b17a4705398047accf446182427d89", "score": "0.7099032", "text": "def fetch_hash_all\n fetch_many0(nil, Hash)\n end", "title": "" }, { "docid": "0ab54832f03b80cd20d244a1ccfd5197", "score": "0.65765303", "text": "def each_hash\n if block_given?\n while row ...
a3eefd37a2ab021a138128d91c5532f8
Check that the control symbol agrees with the expected value. ==== Parameters check the actual control value. ctrls the allowed set of control values.
[ { "docid": "0a4eb35643409107ad65675c6b13688b", "score": "0.65292895", "text": "def check_ctrl(check, ctrl)\r\n unless ctrl.include?(check)\r\n fail XfOOrthError, \"Syntax Error #{ctrl} vs #{check}\"\r\n end\r\n end", "title": "" } ]
[ { "docid": "5b4e092d527afc94c036b2a6810781a4", "score": "0.64044577", "text": "def check_control_bound(cb)\n \tm = \"addControlBound\"\n \tassert(cb.control, SymDesc::Variable, :control, m, strict: true)\n \tassert(cb.controlType, String, :controlType, m)\n \tasser...
1750dfc9ddf395efa4572817d550c979
Returns the current log level if set, otherwise it returns the global default log level
[ { "docid": "c1490c6e1d3632e553616a7445d8c639", "score": "0.77781737", "text": "def level\n @level || SemanticLogger.default_level\n end", "title": "" } ]
[ { "docid": "a91ce18020f338d561f2a469bf7df66e", "score": "0.82698464", "text": "def log_level\n @log_level ||= DEFAULT_LOG_LEVEL\n end", "title": "" }, { "docid": "875201d9d380bed2d5013f27a2bed06f", "score": "0.7917538", "text": "def log_level\n @log_level ||= options['lo...
5e7b316d1bba251948cb9fc84fcc29a7
sort the provided products by whether or not the "featured" property is set
[ { "docid": "21ff7a331ec873596d0e9587ea28140b", "score": "0.8742246", "text": "def sort_by_featured(products)\n products.sort_by! { |product| [product.property(\"featured\") ? -1 : 0, (product.available_on - DateTime.now).abs, product.name] }\n end", "title": "" } ]
[ { "docid": "7734f372e83da46e3f299e33b8803196", "score": "0.636958", "text": "def featured(n = 4)\n return(Spree::Product.random_marketplace(n)) if self.store.nil?\n return(Spree::Product.random_marketplace(n)) if self.store.taxon.nil?\n ret = []\n ret.concat(self.store.taxon.products.present...
64a9eeafa1aeb060c8a18ef71980a246
Search all child elements recursively which are instances of the nonterminal symbol contNT, collect all contained child elements which are of type childclass and return them as an array. childclass can be a rubyclass or a NonTerminal instance. Used to read in recursive grammardefinitions as a flat array
[ { "docid": "b15c6c8164e53dd93cc16bbec0bb5076", "score": "0.72245383", "text": "def collectRecursive(contNT, childclass)\n\t\t@children.select { |c|\n\t\t\t(childclass.is_a?(Class) && c.is_a?(childclass)) ||\n\t\t\t\t(childclass.is_a?(NonTerminal) && c.is_a?(NTermInst) && c.nonTerminal == childclass) } +...
[ { "docid": "1a326b628e72ac9059eb260183295f03", "score": "0.58892936", "text": "def cti_all_descendants\n result = []\n block = Proc.new do |klass, descendants|\n result << klass\n descendants.each(&block)\n end\n @cti_descendants ||= {}\n ...
48c12bd7cec602931905b2924b7fd4cf
DELETE /letters/1 DELETE /letters/1.json
[ { "docid": "6e2b501b2652947ac1f3cc43818f10bb", "score": "0.7528391", "text": "def destroy\n @letter.destroy\n respond_to do |format|\n format.html { redirect_to letters_url }\n format.json { head :no_content }\n end\n end", "title": "" } ]
[ { "docid": "46e14a7ccd23f3409079e015a359397f", "score": "0.754567", "text": "def destroy\n @letter.destroy\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "title": "" }, { "docid": "d151efa13f594ba83afb9f62...
33d38b0ac95fcdd8b66748a5086397d7
allows user to add unique responses(not case senstive)
[ { "docid": "9e774971951bae782b9b58469966a8aa", "score": "0.6410127", "text": "def add_answers\n\tputs \"Enter a question and hit return to add to responses. type '(q)uit' to exit\"\n\twhile true\n\t\tinput = get_input\n\t\tbreak if input == 'quit' || input == 'q'\n\t\t@responses.include?(input) ? (puts...
[ { "docid": "d3d662faa78e1674f251bd9bb63a81e9", "score": "0.7401041", "text": "def not_duplicate_response \n if respondent_already_answered?\n errors[:respondent_id] << 'You have already entered this response'\n end\n end", "title": "" }, { "docid": "48711ae6759dc5...
0081510b3bdd8546ca41455607982601
path to this should be /find_this_item/test_cases
[ { "docid": "c364cb7777e0935de0f2714d50f8c646", "score": "0.0", "text": "def index\n # this is a page with temporary book lists for testing\n @tickets = []\n 3.times do |i|\n ticket = SearchTicket.new\n ticket.item_title = Faker::Book.unique.title\n ticket.item_callnumber = \"CD #...
[ { "docid": "06a938e78c47269e84bf6d2f3ba3b1ae", "score": "0.62815773", "text": "def test_path\n File.join(root_path, \"test\")\n end", "title": "" }, { "docid": "0654b96ad06becb6850ec954caf16a05", "score": "0.6160382", "text": "def get_test_path\n\n if @current_test_rep...
821a53dac6b68cd9cb2caa515aa551b5
This is a public method that returns the QR Code you have generated as a string. It will not be able to be read in this format by a QR Code reader, but will give you an idea if the final outout. It takes two optional args +:dark+ and +:light+ which are there for you to choose how the output looks. Here's an example of ...
[ { "docid": "69a29214dbda44a0d78021ee2530ed86", "score": "0.6137143", "text": "def to_s(*args)\n options = extract_options!(args)\n dark = options[:dark] || \"x\"\n light = options[:light] || \" \"\n quiet_zone_size = options[:quiet_zone_size] || 0\n\n rows = []\n\n @modules...
[ { "docid": "d387f910bd0cc51707be1e3bfce28589", "score": "0.6308235", "text": "def to_s\n 'RicColor: ' + self.send(@color)\n end", "title": "" }, { "docid": "7fd929451ad0e205944799f4cabb0a1c", "score": "0.6303594", "text": "def to_s\n return \"#{self.barcode.blank? ? 'No ba...
53fcaf372e61976a895a6c8511f4520c
layout 'back/admin', only: [:edit, :update] GET /resource/sign_up
[ { "docid": "039eb78f479894de3efc3aa3e31beb25", "score": "0.0", "text": "def new\n @user_type = params[:user_type]\n if params[:step] == \"1\"\n p @user_type\n redirect_to users_agree_path(user_type: @user_type)\n return\n end\n if @user_type and params[:step] == \"2\"\n b...
[ { "docid": "164421c0c0466a515e6e5891b3d31d94", "score": "0.7044786", "text": "def new\n @signup = Signup.new\n render :layout=>'application'\n end", "title": "" }, { "docid": "faa29b21814c3503a746f01806e90500", "score": "0.6929408", "text": "def set_layout_for_devise\n \"ho...
50d3b343968923b81238eae1266d19d6
create the session resource ie, let user log in
[ { "docid": "8335219ae55a837f77efba137fe6516f", "score": "0.0", "text": "def create\n #this references the funciton we made in user.rb\n user = User.authenticate(params[:session][:email], params[:session][:password])\n if user.nil?\n flash[:login_error] = \"Couldn't find a user with those c...
[ { "docid": "31a54b801e3d746b6a76c21dccb0b78f", "score": "0.75247633", "text": "def create_session\n login, password = get_login_and_password\n create_session_with authenticate_user(login, password, :trace => true)\n end", "title": "" }, { "docid": "09d5f8034a4572b66dfb6cd5f2e2069d", ...
c657de4b70d266e9a3a784b999ea9e60
Never trust parameters from the scary internet, only allow the white list through.
[ { "docid": "f9de07682927916ff299aa56158f5454", "score": "0.0", "text": "def subject_topic_params\n params.require(:subject_topic).permit(:subject_id, :topic_id)\n end", "title": "" } ]
[ { "docid": "3663f9efd3f3bbf73f4830949ab0522b", "score": "0.7495027", "text": "def whitelisted_params\n super\n end", "title": "" }, { "docid": "13a61145b00345517e33319a34f7d385", "score": "0.69566035", "text": "def strong_params\n params.require(:request).permit(param_whit...
f147b75665e84dc09e5215710b870a1a
Split the name string into an array of a first and last name Create a new array for the spy name that takes in the 1th element of the original array as the 0th and 0th as 1th Write method to iterate through each name string and change letters accordingly downcase strings if on "aeiou" change mod 5 if on "bcdfghjklmnpqr...
[ { "docid": "d2aa31a6081d6bed7930b215b356d853", "score": "0.0", "text": "def character_changer(name)\n \tname_chars_array = name.split('') #make array of characters in single name\n \tname_chars_array.map! do |char| #iterate though each character and change accordingly\n \t\tif \"aeiou\".include? char\n...
[ { "docid": "d23a0445cd1451d99813e2f0266b50af", "score": "0.78434926", "text": "def spy_name(name)\nnew_name = name.downcase.split(' ')\n\n#Swap first and last name by calling .reverse to swap the array values, and join them back to string\nswap_name = new_name.reverse.join(' ')\n\n#changing vowels (a, e...
6b9997c844f06bb459735ee79971aadf
Metodo que se encarga de generar las nuevas ordenes partiendo de la principal tomando encuenta las taxonomias y el limite de lineas por factura configurado.
[ { "docid": "a997c88e73bdb7f27af07cbec8c37226", "score": "0.52281624", "text": "def generate_orders\n @productos_por_taxonomias.each do |taxonomia, line_items|\n # Picamos la orden actual en sub-ordenes si la orden excede la cantidad de lineas configuradas en el backend par auna orden.\n ...
[ { "docid": "b0e3136517506d39979e35eebc9f21f4", "score": "0.5540587", "text": "def generateConcreteCharges\r\n\t #For each charge factories asscociated with retail plans, generate concrete charge and total them\r\n\t self.retail_plan.charge_factories.each do |charge_factory| \r\n\t generated_c...
d40ab6d5cf8a6fff49f3d73db6a1b763
via the command line (Terminal) like so: $ ruby shakil_the_dog.rb Your method should wait for user input, which corresponds to you saying something to your dog (named Shakil). You'll probably want to write other methods, but this encapsulates the core dog logic
[ { "docid": "6b6a98c62e672d86a5ab323b1a3db67b", "score": "0.6641739", "text": "def shakil_the_dog\n prompt = \"> \"\n puts \"What do you want to say to Shakil?\"\n print prompt\n \n while say = gets.chomp\n case say\n when \"woof\"\n puts \"WOOF WOOF WOOF\"\n print prompt\n when \"SHAKIL ST...
[ { "docid": "3de6dc5d3383e4e761478fe36742b832", "score": "0.7162543", "text": "def start\n p \"What is your name?\"\n name = gets.chomp\n say_hi(name)\nend", "title": "" }, { "docid": "31da7f65350baddb1c38c423280b5c6f", "score": "0.70866776", "text": "def mad_lib\n user_inpu...
1a41a88e876a053934f205403b22c6f7
def do_something => get_time_string 1.
[ { "docid": "623a39f231b7fc20a70261fbedc16352", "score": "0.6576303", "text": "def get_time_string\r\n # get a time object ###\r\n t = Time.now\r\n ### create: month string ###\r\n month = (t.month.to_s.length == 1) ? \r\n \"0\" + t.month.to_s : t.month.to_s\r\n ### create: day string #...
[ { "docid": "d5ab9b027a16c179ee7e422816af3415", "score": "0.7774251", "text": "def time_string; end", "title": "" }, { "docid": "b54ffac3aa1c6fbc03bb8f61b57fe1a3", "score": "0.7492966", "text": "def time_of_day(time)\n #\n # your code goes here\n #\nend", "title": "" }, { ...
e7716c7cb60afddb738209ba3b31d921
Checks whether the response has been throttled.
[ { "docid": "5a16526a35451fafb0557aa776b033c8", "score": "0.7672336", "text": "def response_throttled?\n !!(content_for_scanner =~ /Please go away for \\d+ Seconds/)\n end", "title": "" } ]
[ { "docid": "92cb407d3c5a4916097921aec39e2b57", "score": "0.8375474", "text": "def response_throttled?\n end", "title": "" }, { "docid": "33691990319aef8f6d52b0b66911849c", "score": "0.82884204", "text": "def throttled?\n !!(@response.code.to_s == '429' || (message && messag...
c21572d552782744677a8fc382a5aa4a
Write a method, `digital_root(num)`. It should Sum the digits of a positive integer. If it is greater than 10, sum the digits of the resulting number. Keep repeating until there is only one digit in the result, called the "digital root". Do not use string conversion within your method. You may wish to use a helper func...
[ { "docid": "527fbabeb8052a8811baca8a782c3af5", "score": "0.751727", "text": "def digital_root(num)\n numstring = num.to_s\n numstring.split(\"\")\n answer = 0\n if numstring.length > 2\n numstring.each do |el|\n answer += el\n end\n else\n return num\n end\n answer\nend", "title...
[ { "docid": "ecc923c7f5689f05f6f148c2da59854e", "score": "0.8605617", "text": "def digital_root(num)\n\n\tif num < 10\n\t\treturn num\n\tend\n\n\t# sum the digits\n\tsum = 0\n\tuntil num < 10\n\t\tsum += num % 10\n\t\tnum = num / 10\n\tend\n\tsum += num\n\n\tif sum > 9\n\t\treturn digital_root sum\n\tend...
8d70ad745b6916cc5d56c7311e9310bd
Debug method. Prints the contents of the variable to the standard output.
[ { "docid": "221312d5cdaab150608b304acc3562f8", "score": "0.0", "text": "def inspect\n \"\\t\\t#{@data.inspect}\\n\"\n end", "title": "" } ]
[ { "docid": "1d3d0c2c598983da5d4ea3b0a1097ed0", "score": "0.80672485", "text": "def debug(variable)\n\n puts \"#################################################################################\"\n\n puts \"===START===\"\n\n puts variable\n\n puts \"===END===\"\n\n puts \"##################...
30f4a61baa2bb45309c16a5d51b21872
GET /educational_resources/1 GET /educational_resources/1.json
[ { "docid": "6b091fae57ee83bf485ca4fec529b4aa", "score": "0.78934675", "text": "def show\n @educational_resource = EducationalResource.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @educational_resource }\n end\n end", "tit...
[ { "docid": "7d7267079ee06b089fe44df4656b89d9", "score": "0.680824", "text": "def new\n @educational_resource = EducationalResource.new(resource_list_id: params[:resource_list_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @educational_resource }...
f42686136400b53fbb55ef59b1254feb
fill in the email field with email
[ { "docid": "74cbefb529d00c43070122b822fe1f51", "score": "0.0", "text": "def fillin_email(text)\n @browser.text_field(:id,\"remind_email_input\").set text \n end", "title": "" } ]
[ { "docid": "a0dc8620bf8daa0179c590fb0a6438f8", "score": "0.83609205", "text": "def set_email_field(email)\n end", "title": "" }, { "docid": "6fab28be150d9c426a1509ea7ce76f6a", "score": "0.816257", "text": "def email=(value)\n @email = value\n end", "title": "" }, { ...
7f27941b64ad53978237b7f883ec242b
rendering phase returns sorted array of items for given kind may return nil if kind is not available
[ { "docid": "70f58ee2f034a9dc4de1a6a29e66df94", "score": "0.5889239", "text": "def hs_items_of_kind(kind)\n\treturn $alls[kind]\nend", "title": "" } ]
[ { "docid": "2ec8c234e1a662bbedb760d979a953bc", "score": "0.61582595", "text": "def render_sorted!\n @render_sorted = true\n end", "title": "" }, { "docid": "b66eefef3423b43e3a85240c573376d9", "score": "0.6016614", "text": "def sort_entries; end", "title": "" }, { ...
9eec5d5af51365b46ab497319fe6b384
DELETE /peticions/1 DELETE /peticions/1.json
[ { "docid": "ab8363bc3dcc00438053422c6df9ec7f", "score": "0.7063254", "text": "def destroy\n @peticion.destroy\n respond_to do |format|\n format.html { redirect_to peticions_url, notice: 'Peticion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "tit...
[ { "docid": "5056c4cf4b052be871df995fef765aa5", "score": "0.7486331", "text": "def destroy\n @pet.destroy\n respond_to do |format|\n format.html { redirect_to user_pets_path, notice: 'You deleted one of your pet' }\n format.json { head :no_content }\n end\n\n end", "title": "" }...
50fe7d4634e14f6b7be5c5ccf6a59d4d
Terminate the main thread
[ { "docid": "e48671349b1defbad408823be8559053", "score": "0.7653043", "text": "def terminate!\n @terminated = true\n @thread.kill if @thread\n ensure\n safe_release!\n end", "title": "" } ]
[ { "docid": "666c608594cfc31ba74134194c28792b", "score": "0.8050221", "text": "def terminate\n @thread.terminate if @thread\n end", "title": "" }, { "docid": "594058613d518646dd9743cc8db9132a", "score": "0.79060346", "text": "def terminate\n @done = true\n ...
e563079fff217989becf22e507303ea9
The args node1 & node2 may represent a RuboCop::AST::Node or a Parser::Source::Comment. Both respond to loc.
[ { "docid": "61f457ce5002b6ccd94e8fb197b64985", "score": "0.49372703", "text": "def preceding_comment?(node1, node2); end", "title": "" } ]
[ { "docid": "435aa05d3ce761cc29f5dd2c20b52b34", "score": "0.53486407", "text": "def node_location(node)\n \"#{node.location.expression.source_buffer.name}:#{node.location.line}\"\nend", "title": "" }, { "docid": "782ae441b900d0f34635b4a9a2dd8b35", "score": "0.5274238", "text": "def _...
6262d7667c10c72dbc18fab4aa267a8d
Is there an action that has been undone that can now be redone?
[ { "docid": "67744d2b111d550a649837e20ec8a221", "score": "0.69077486", "text": "def can_redo?; @last_done < (@actions.size - 1); end", "title": "" } ]
[ { "docid": "65cc2a33cb6e4032d910082c8bc7cc7a", "score": "0.72192335", "text": "def undone?\n !done?\n end", "title": "" }, { "docid": "de9665a2c05ff0a3cfcafaa42a981af5", "score": "0.711954", "text": "def check_replacement_action\n if location_changed? && location_was == 'h...
b13fbd233c71bbb0318b61a4e190fc9f
DELETE /rooms/1 DELETE /rooms/1.json
[ { "docid": "46722385e5651a96dbf447ffc6456f11", "score": "0.7017923", "text": "def destroy\n @room.destroy\n respond_to do |format|\n format.html { redirect_to hotelprofile_path, notice: 'Room was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "title":...
[ { "docid": "1e875f96d32f4af43bc8cb1f2e82abf0", "score": "0.763566", "text": "def destroy\n @room = Room.find(params[:id])\n @room.destroy\n\n respond_to do |format|\n format.html { redirect_to rooms_url }\n format.json { head :ok }\n end\n end", "title": "" }, { "docid...
9384565a7fe17cee6d2b8e42642cd145
Invoke the checks that validations are in place. Should be overwritten in ORM adapter
[ { "docid": "2a8855a48b88ab6332c7f7ddda5c1d76", "score": "0.0", "text": "def register_active_validation_relations; end", "title": "" } ]
[ { "docid": "70f877d5e962241f8652ad20256798ef", "score": "0.76593786", "text": "def run_validations!; end", "title": "" }, { "docid": "70f877d5e962241f8652ad20256798ef", "score": "0.76593786", "text": "def run_validations!; end", "title": "" }, { "docid": "0599f3660c1ba666...
87573e6aedc8ad50c56bb46d305c8e48
Remove an object from the end of the deque. Time complexity: O(1)
[ { "docid": "d6aa66de0d1abb979fb84c884064c0a9", "score": "0.6799179", "text": "def pop\n popped = @tail\n\n if @size == 1\n empty!\n else\n @tail = @tail.from\n @tail.to = nil\n @size -= 1\n end\n\n popped.obj\n end", "title": "" } ]
[ { "docid": "6c6313ae418540ff06df5424df598f91", "score": "0.7473619", "text": "def delete_last\n deque.pop unless deque.empty?\n end", "title": "" }, { "docid": "32eef45176c02dd8a8a82351020cae5e", "score": "0.7346438", "text": "def delete_front\n deque.shift unless deque.empty?...
6408c77ec6cc49e3106fd2771b9c1c8e
WITHOUT (re)digesting the file, convert a hexdigest MD5 value to base64endcoded equivalent. Motivation: we store hexdigest and S3 requires base64 in headers.
[ { "docid": "746a02150c22ecb4227777ceec7655e7", "score": "0.0", "text": "def hex_to_base64(hex)\n [[hex].pack('H*')].pack('m0')\n end", "title": "" } ]
[ { "docid": "6b07ddbdf2adc2e80af8fa6f74bff164", "score": "0.7367889", "text": "def to_base64_digest(content_md5)\n if content_md5\n md5_digest = content_md5.unpack(\"a2\" * 16).collect { |i| i.hex.chr }.join\n Base64.encode64(md5_digest).strip\n end\n end", "title...
ff76cbeb3a7d796ae82737e69310bf71
content for 'config.ru' file
[ { "docid": "a007e4402421c79f4bb2f2486488e037", "score": "0.0", "text": "def config_ru(project_path)\n File.open(\"#{project_path}/config.ru\", 'w') do |file|\n file.puts \"Encoding.default_external = Encoding::UTF_8\nEncoding.default_internal = Encoding::UTF_8\n\nrequire 'marfa'\nrequire Fil...
[ { "docid": "a547de12be65e443c75f5279e30312c9", "score": "0.7211487", "text": "def content\n tmp = \"# This file is managed by puppet\\n#{@resource} {\\n\"\n @config.each do |_, v|\n tmp = \"#{tmp} #{v['dir']}#{v['sep']}#{v['res']}\\n\"\n end\n \"#{tmp}}\\n\"\n end", "title": "" ...
2a068eeeb2811bd186bf2bb83ed4d6f0
Response: 200 OK [text/html] tests/index.html.erb
[ { "docid": "d9c2eb62dbc7c908b5da8c93b94c56a7", "score": "0.0", "text": "def response_info(env)\n if env.has_key?('simpler.controller')\n log_str = 'Response:'\n response = env['simpler.controller'].response\n \n status = response.status\n status_descr = Rack::Utils::HTTP_STAT...
[ { "docid": "2757858827f8c4f5928547b441eed931", "score": "0.79913116", "text": "def index\n render plain: 'ok', status: :ok\n end", "title": "" }, { "docid": "2757858827f8c4f5928547b441eed931", "score": "0.79913116", "text": "def index\n render plain: 'ok', status: :ok\n end",...
4df55d1a3294797b961b23a18dd276f3
Get bestiary complete rate
[ { "docid": "7621a62b2b0f5bacc65438c9fc4948db", "score": "0.66622686", "text": "def enemy_bestiary_comp\n return $game_party.enemy_bestiary_complete_percentage\n end", "title": "" } ]
[ { "docid": "8967677e0d2bfbc59cd2833dead0639f", "score": "0.75656754", "text": "def current_compound_interest_rate() 4.3 end", "title": "" }, { "docid": "8967677e0d2bfbc59cd2833dead0639f", "score": "0.7565444", "text": "def current_compound_interest_rate() 4.3 end", "title": "" ...
27be3894a33eac34647a946ae59baca9
GET /steps/1 GET /steps/1.json
[ { "docid": "68d377f9b6bc5c936554e5d342b28dff", "score": "0.7169545", "text": "def show\n @step = Step.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @step }\n end\n end", "title": "" } ]
[ { "docid": "fa1dbcb23433225fe1f0be4f223d9247", "score": "0.7460981", "text": "def index\n \n @steps = @quest.steps\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @steps }\n end\n end", "title": "" }, { "docid": "237f14abaab4eae...
8af37d8555814550d8a624d33c37e8c2
compare guess_word and check_word and update
[ { "docid": "5f21ec27103ce34abdb1a86636dd928f", "score": "0.0", "text": "def show_letter(computer_word, guessed_word, correct_letter)\n chars = computer_word.split('')\n hello = chars.each_with_index { |character, index|\n if character == correct_letter\n guessed_word.slice!(index)\n ...
[ { "docid": "4b749876ccb5e8be71128248eabb43f7", "score": "0.78682125", "text": "def word_update\n if @guess == 'SAVE'\n save_game\n elsif @guess.length == 0\n puts \"\\nYou didn't type anything\"\n player_guess\n elsif @guess.length == 1\n if @letters_used.include? @guess\n ...
708f16a929e0c7796351b206e44a7a5e
Registers a hook that will be run before properties are set on a resource
[ { "docid": "b52cf27b4e53a73addae83ae759757f6", "score": "0.66409", "text": "def before(type, **options, &block)\n resource_class(type).pre_hooks << options.merge(block: block)\n end", "title": "" } ]
[ { "docid": "9d012dab562a3ed09bc8e25373e82316", "score": "0.66102964", "text": "def pre_init(&block)\n @hooks[:pre_init] = block\n end", "title": "" }, { "docid": "4c9becdc5719c651a460ea020109f39d", "score": "0.63902223", "text": "def register_hooks; end", "title": "" ...
a479426f8d87072f97e807883a75de2c
RELATIONAL OPERATORS equality operator returns true if both temperatures are equal in degrees
[ { "docid": "cf2c397f24b55c28abb1ff5584731dbc", "score": "0.68800586", "text": "def ==( temperature)\r\n if temperature.myScale != self.myScale\r\n case self.myScale\r\n when 'K'\r\n temperature.convertKelvin\r\n when 'C'\r\n temperature.convertCelsius\r\n ...
[ { "docid": "8ab31c064d43b7a61a7cbedcc434c0ec", "score": "0.7720875", "text": "def equalTo otherTemp\n\t\t \tcase @scale\n\t\t\t\twhen 'C'\n\t\t\t\t\t@degrees == otherTemp.toCelsius().degrees\n\t\t\t\twhen 'F'\n\t\t\t\t\t@degrees == otherTemp.toFahrenheit().degrees\n\t\t\t\twhen 'K'\n\t\t\t\t\t@degrees =...
5f6c8089e2ff3c6da6117a767a691b2d
Returns true if there is a connection to the specified node.
[ { "docid": "3bb464be4917f1196a8df303591f4c54", "score": "0.7771682", "text": "def connected?(node)\n @connected.include?(node)\n end", "title": "" } ]
[ { "docid": "661ac6e9e7bf84414574e711ad6a3fe1", "score": "0.7877393", "text": "def connected?(node)\n\t\t\treturn @connections.find{|edge| edge.destination == node}\n\t\tend", "title": "" }, { "docid": "dff740d02032476e33d1dc9a3adf1bb3", "score": "0.7623164", "text": "def has_connecti...
7c0db9652e1868036b53b9e4a12df8e6
local variables who are defined within a block or method can only be accessed within that definition unless its an instance or global var
[ { "docid": "61246550657dd88ac4fbedc8595a18fb", "score": "0.0", "text": "def check_scope(var)\n\tputs defined? var\nend", "title": "" } ]
[ { "docid": "f4a344696272cc01c12fbb15872830e1", "score": "0.7516295", "text": "def local_variables; end", "title": "" }, { "docid": "0269acfb8fbce35816c3cc785bf9a4e8", "score": "0.70539296", "text": "def another\n\t#this is a local variable and not valid outside\n\tlocal\nend", "t...
2a595a07576c8f56e45a2985671b88cc
Returns a collection of all transactions that 1) is not approved
[ { "docid": "07a1816434bc28f87c0ffa1bf72570e0", "score": "0.6973454", "text": "def getPendingTransactions(transactions)\n pending_transactions = Array.new\n transactions.each do |transaction|\n if(transaction.isApproved==0)\n pending_transactions << transaction\n ...
[ { "docid": "dca8d419b8943c17e6dae82a1f61daa4", "score": "0.71687084", "text": "def unreconciled\n transactions.where(\"not is_cleared\")\n end", "title": "" }, { "docid": "6d657a1f843cafb62299f370a8098e08", "score": "0.69801724", "text": "def declined\n where approved: fal...
b8f10d745ea5d8c2145ced4110fbff18
Move the specified distance along the X axis
[ { "docid": "e8f212fa66a5e175650ba0f2c6c99eec", "score": "0.69975746", "text": "def left(distance)\n\t\tmove_x -distance\n\t end", "title": "" } ]
[ { "docid": "96775c9062d5fbb5a04610b391ab4379", "score": "0.87451637", "text": "def move_x(distance)\n\t\tmove Point[distance, 0]\n\t end", "title": "" }, { "docid": "b2a1f9662e34a26e58d0c7820a4881ac", "score": "0.79994345", "text": "def move_x(distance)\n\t\tpush (last || PointZer...
0d6ee6766db8dc25ec88645835ecaeae
Registers a block to preprocess certain files, matched with globs or regular expressions. Registered file paths will be excluded from default comparison by `diff`. A file is preprocessed with the first matching preprocessor.
[ { "docid": "34c53c5617d8e918c8f4a54af4daae9c", "score": "0.6830945", "text": "def preprocess(*file_paths, &block)\n file_paths.each do |file_path|\n self.preprocess_paths[file_path] = block\n end\n end", "title": "" } ]
[ { "docid": "d1019fb9c5b0713838fcda9a9dba54a9", "score": "0.6133129", "text": "def preprocessors_for(file_path)\n select_matching_file_patterns(preprocess_paths, file_path).values\n end", "title": "" }, { "docid": "0d9996339f27867483113aa301b2d998", "score": "0.6052577", "text...
e846ff1b0ec15ee587542a5fa1e6e692
host ipaddr/hostname hostlabel labelname certification common name port 24284 shared_key .... optional shared key username name if required password pass if required
[ { "docid": "aa8a01939ebf7367678dd554fe4a96ce", "score": "0.0", "text": "def initialize\n super\n require 'socket'\n require 'openssl'\n require 'digest'\n end", "title": "" } ]
[ { "docid": "2addb38ba8367ceee9e3d2433a462f03", "score": "0.6081494", "text": "def configure_private_key_and_cert_with_puppet(host)\n configure_cacert_with_puppet(host)\n\n client_key_raw = get_host_private_key(host)\n client_cert_raw = get_host_cert(host)\n\n ssl['client_key'...
f93b3f016e1e7fd2181168cf54c762ab
Returns true if the given token matches the digest.
[ { "docid": "e6d7c1a14c3ecaa5034216a25c785023", "score": "0.0", "text": "def authenticated? attribute, token\n digest = send \"#{attribute}_digest\"\n return false if digest.nil?\n\n BCrypt::Password.new(digest).is_password? token\n end", "title": "" } ]
[ { "docid": "9e854261e13509b56a6bdd7480cceffa", "score": "0.7843973", "text": "def authenticated?(digest, token)\n digest = send(\"#{digest}_digest\")\n # Use metaprogramming to select the appropriate token attribute based on\n # the parameter digest.\n return false if digest.nil? # Digest do...
04e0dcaaa75819eaffc8ff90bbbd0d39
Isolate special properties and rename their keys to align with Mixpanel's naming.
[ { "docid": "0fe3b807959846ee9fa583c091a44ec1", "score": "0.62616354", "text": "def properties_for_mixpanel\n Hash[\n properties.map { |k, v| [mixpanel_special_properties_map[k] || k, v] }\n ]\n end", "title": "" } ]
[ { "docid": "da814f4f14ce5f65e1fedb671d944133", "score": "0.7012578", "text": "def set_property_keys\n return unless properties\n properties.each do |property|\n next if property['key'] # don't set the key if it already exists\n property['key'] = \"#{property['group']} #{property['name']}...
a86b0541a3d9afbe507dde4d950fe729
GET /petitions GET /petitions.json
[ { "docid": "1032df0def4b14d5b0efab87e6ff045b", "score": "0.0", "text": "def index\n @vervolg = true\n\n @page = (params[:page] || 1).to_i\n @sorting = params[:sorting] || 'active'\n @order = params[:order].to_i\n\n # petitions = Petition.joins(:translations).live\n petitions = Petit...
[ { "docid": "6379638e957514df29efd4372e4a43b8", "score": "0.71441895", "text": "def index\n @competitions = Competition.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @competitions }\n end\n end", "title": "" }, { "docid": "17cb2...
d4d3752ef921c2042502ace47f5e0b15
Clear the internal hashes.
[ { "docid": "2a92398c03be6b80e4876d892eeaa6cc", "score": "0.7496616", "text": "def clear!\n @types = {}\n @hashes = {}\n @legacy_types_by_hash = {}\n end", "title": "" } ]
[ { "docid": "2ccedcd49c8aec5cfe578a0894a26977", "score": "0.8003776", "text": "def clear\n @hash.clear\n end", "title": "" }, { "docid": "7cdd46fccd1af567eff4491a20d0c878", "score": "0.784766", "text": "def clear\n @hash = {}\n @keys = []\n end", "title": ...
9ace75bd7623edc81380b33906f80da7
NOT PLANNING ON EDITING USER PROFILE< BUT INCASE WE WANT TO ADD IT
[ { "docid": "d7d85e225a5e57a35a973fd017983c0f", "score": "0.0", "text": "def edit\n @user = User.find(params[:id])\n end", "title": "" } ]
[ { "docid": "af0bc86d7c01368410d856b19b9892cb", "score": "0.69336176", "text": "def user_profile_edit\n\n\n end", "title": "" }, { "docid": "9f3fbb8500cb40a3ebe73e8a0175335e", "score": "0.69104975", "text": "def confirm!\n # add if else here in case user already existed and is upd...
e9fcab2ab9c868f5987a0b6b145914b8
POST /gardens POST /gardens.xml
[ { "docid": "2300ea3a060b65d25f9f831cad3956a1", "score": "0.5448812", "text": "def create\n @garden = Garden.new(params[:garden])\n\n respond_to do |format|\n if @garden.save\n flash[:notice] = 'Garden was successfully created.'\n format.html { redirect_to(@garden) }\n for...
[ { "docid": "ff64f712ca5c171b73151901dc47c4f6", "score": "0.5943448", "text": "def postRequest\n assertRequestData\n assertRequestType\n req = Net::HTTP::Post.new(@uri.request_uri)\n req.add_field('Content-Type', 'text/xml')\n req.body = buildXmlRequest\n @response = sendRequest(req)\n ...
2d6f850be48b23e660a765da31dd5b14
Enumerates over an enum running a partial for each entry and adding the locals is_first, index, is_last, is_alt, list Returns the result as string, or nil if no iterations were done
[ { "docid": "661f4b9a4f9db35fa3476e4446f527e4", "score": "0.71057767", "text": "def partial_enum view_name, enum, locals = {}, &block\n result = []\n did_any = EnumExtension.enumerate_over(enum) do |item, index, first, alt, last|\n result << partial(view_name, item, {:is_first => first, :index...
[ { "docid": "927d199d0f6c5e27b20836afff732d60", "score": "0.5830514", "text": "def _optimized_render_each(enum, optimized_template, as, locals)\n enum.map do |v|\n locals[as] = v\n send(optimized_template, locals)\n end.join\n end", "title": ""...
6ddaa64658692e921a07f2cafc99e1fb
TODO: change the name to this function
[ { "docid": "7a6fca7aa62f87f30ccb56268590cfca", "score": "0.0", "text": "def users_mixtapes\n \t search_terms = params[:search_term]\n # binding.pry\n \tif search_terms == 'all'\n \t\t@mixtapes = Mixtape.all\n elsif search_terms == 'users'\n @mixtapes = Mixtape.where(user_id: current_user....
[ { "docid": "b6b2bcc0062aeb115edab7b10cbe6930", "score": "0.66511184", "text": "def desired; end", "title": "" }, { "docid": "a9dd648a5d0d2e7d56223e7c753f5e2e", "score": "0.6266432", "text": "def telegraphical()\n end", "title": "" }, { "docid": "9dcc74dd11eb115d21bf9af...
88491c365c9ec36102c58644f638d792
Instantiate the new code.
[ { "docid": "3f2d274a5c87e7af0d138a4bcec414e0", "score": "0.0", "text": "def initialize(javascript)\n @javascript = javascript\n end", "title": "" } ]
[ { "docid": "24a907c8753de65096685dbf8784e6fe", "score": "0.73933566", "text": "def initialize(code)\n @code = code \n end", "title": "" }, { "docid": "870e5942637a9796643dc0e840902e97", "score": "0.7379919", "text": "def initialize(code)\n super\n @code...
34e572207782d19df746fc354f83f448
FIND A BETTER WAY TO DRAW SEPARATORS
[ { "docid": "598c91c37d39b933007833e0cf10f0c4", "score": "0.6429391", "text": "def drawSeparators(body)\r\n html = \"\"\r\n @separatorList.each_with_index { |element, index|\r\n width = element.end_x - element.start_x\r\n height = element.end_y - element.start_y\r\n\t if (element.orienta...
[ { "docid": "581ce5d241714ad2f0ac47c9fc67e953", "score": "0.6088124", "text": "def draw_separator(c, w, h)\n c.set_line_width 0.5\n c.set_source_rgba 0.8, 0.8, 0.8, 1\n c.move_to 0, 1\n c.line_to w, 1\n end", "title": "" }, { "docid": "441218b6bed021ba8ea1da2c1d34b5ba", "scor...
1f09320e9de489180b57e58ab23b693c
Initializes a new Site with the given source directory.
[ { "docid": "52d7c94dd76b84e8034afdfb9e39c94a", "score": "0.7308669", "text": "def initialize(source_dir)\n @clean_first = false\n @first_pass = true\n @quick_mode = false\n @check_mtime = false\n @show_statistics = false\n @source_dir = s...
[ { "docid": "b06f224e451714504b5dd3ac286b73c5", "score": "0.7378703", "text": "def initialize(site, base, dir, name); end", "title": "" }, { "docid": "8fc55b0f11d9fb1c6c59d8b179072c0a", "score": "0.69761395", "text": "def initialize(config)\n # Source and destination may not be c...
b3e98451174999407a87ccebf3bff618
GET /groceryproducts/1 GET /groceryproducts/1.json
[ { "docid": "a81945373733e4951b987de6ea99f9a1", "score": "0.0", "text": "def show\n end", "title": "" } ]
[ { "docid": "e7f81a2db5836675357a443a3156c552", "score": "0.74858797", "text": "def get_products()\n\tputs \"Getting products\"\n\tresponse = request_get(\"/api/product\")\n\tputs response.body\nend", "title": "" }, { "docid": "3503e75535ccbeba6849aee931bb6e9d", "score": "0.72227657", ...
b26be1fd14c9c964dea00a9cde60c5ae
POST /day_actions POST /day_actions.json
[ { "docid": "7f7e5a052350e2cd084bb285b8073729", "score": "0.59600836", "text": "def create\n @day_action = current_user.day_actions.new(day_action_params)\n @day_action.duration =\n day_action_params[:hours].to_i * 60 + day_action_params[:minutes].to_i\n\n if @day_action.save\n r...
[ { "docid": "426a78e7c4bbd683157e1c001b38ecba", "score": "0.6551374", "text": "def day_action_params\n params.require(:day_action).permit(:day,\n :importance,\n :duration,\n :actio...
3c073c52c19a4c02b63948e3a0c7fd8c
Method of generating row with given number square boxes
[ { "docid": "26e3084dd0c67cea1e9caa1ce7d62eeb", "score": "0.6683978", "text": "def generate_row(row, count,drawings)\n start_column = row == 1 ? 1 : ((row-1) * count) + 1\n last_column = row == 1 ? count : (row * count)\n\n content_tag :div, :class => \"flex-container\" do\n start_column.up...
[ { "docid": "74fb14c9784ca2173853cd968f6036df", "score": "0.7770577", "text": "def generate_square_boxes(row, drawings)\n content_tag :div, :class => \"drawing_section\" do\n 1.upto(row){|item| concat(generate_row(item, row,drawings))}\n end\n end", "title": "" }, { "docid": "6b10...
f9136453f0a767dfa74fd2e45f02d69b
Returns the start_date if before, the end_date if during and none if after. /d.wessman
[ { "docid": "c2faef14381be9df5f397131ef420cc8", "score": "0.0", "text": "def countdown\n i = view_status\n if i == 1\n return self.start\n elsif i == 2\n return self.end\n end\n nil\n end", "title": "" } ]
[ { "docid": "3b3f18e6ab7a41e59eeadced6afcea9c", "score": "0.72295105", "text": "def event_start_end_dates\n esdate and eedate\n end", "title": "" }, { "docid": "cdf1646aabae8eeabf8792f1f7289c60", "score": "0.7034716", "text": "def active_between\n if self.active\n # If act...
4b3030f6d9a3775713614e1e2d4733e0
DELETE /pagos/1 DELETE /pagos/1.json
[ { "docid": "33c8b43cd063ade8ecc37d93c04692cc", "score": "0.0", "text": "def destroy\n @pago.destroy\n redirect_to pagos_url, notice: t('action.delete')\n end", "title": "" } ]
[ { "docid": "a551bb6d8f17cd35dca87b4776550e14", "score": "0.75668097", "text": "def destroy\n @pago = Pago.find(params[:id])\n @pago.destroy\n\n respond_to do |format|\n format.html { redirect_to pagos_url }\n format.json { head :no_content }\n end\n end", "title": "" }, { ...
6f18fa89aef340d606d0bd47c851605f
Erzeugt die GraphVizDatei, die das Netz grafisch darstellt
[ { "docid": "7d52ebd4c12dbda17bdca20df4be3057", "score": "0.65111023", "text": "def gv(name)\n # Erzeugen der Datei und die ersten Zeilen, die die Datei ausmachen\n graph = File.new(name + '.gv', 'w')\n graph.puts('digraph petrinet{')\n graph.puts('node[shape=circle];')\n graph.puts('rankd...
[ { "docid": "63f028983c6b5f6a33ed54f92c9648d7", "score": "0.7119211", "text": "def to_dot\n n2n , urls , labels = self.get_name2name\n node_names = []\n node_protocols = []\n edges = []\n n2n.keys.each do |name1|\n n2n[name1].keys.each do |name2|\n if config[:edge_label] == \"F...
265af0c0bbf37eab4318c17615e62a86
Compose input and output
[ { "docid": "99ea15f2a728158b8093ab489f4da5d3", "score": "0.75616664", "text": "def compose(input, output)\n composer.call(input, output)\n end", "title": "" } ]
[ { "docid": "b3003c122ecc90232d83d340153fbe2e", "score": "0.6567213", "text": "def output(request, result)\n compose(request, result.output)\n end", "title": "" }, { "docid": "7a5a921e4456eacf5ba2028b885f0c7a", "score": "0.57664156", "text": "def compose\n raise NotIm...
c3e62201ef22de76d8866bb4d7d159a2
Format a single flash message
[ { "docid": "ccc0a730e6eca33a8e9f82f49475e4ff", "score": "0.6917809", "text": "def flash_message(type, message)\n content_tag(:div, :class => \"flash-message #{type.to_s}\") do\n content_tag :p, message\n end\n end", "title": "" } ]
[ { "docid": "fbda24265584fd43c32c46f0c90e6961", "score": "0.76395845", "text": "def format_flash_message(msg)\n return content_tag(:p, msg) unless msg.is_a?(Array)\n title = content_tag(:h1, msg[0])\n desc = content_tag(:p, msg[1])\n\n \"#{title}#{desc}\"\n end", "title": "" }, { ...
99fee103afc6515e80fd7b44a3bca223
Creates and attaches specified number of volumes to the instance provided
[ { "docid": "36c58fc679f9b639e2bc1da44db03f69", "score": "0.76612103", "text": "def attach_volumes!(server, volumes, size)\n #create a new blockstorage connection obj\n block_storage = Fog::Rackspace::BlockStorage.new(\n {\n :rackspace_username => @rackspace_username,\n ...
[ { "docid": "e1661f704edd21b085d93f275af4f5c3", "score": "0.7690385", "text": "def create_and_attach_volumes(volname, numvols, volume_size)\n physical_device_names = generate_physical_device_names(numvols)\n # TODO: make volumes, then wait for attach\n attached_volumes = []\n numvols....
44bbc5c3e4d3b6d0fa3e45469f2e7de2
Write a method that takes one argument, a positive integer, and returns a string of alternating 1s and 0s, always starting with 1. The length of the string should match the given integer. use
[ { "docid": "407d8eb4254efc145073003cb93d9c9b", "score": "0.7536396", "text": "def stringy(int)\n string = [1]\n i = 1\n \n while i < int\n if string[i-1] == 1\n string[i] = 0\n else\n string[i] = 1\n end\n i += 1 \n end\n \n string.join('')\nend", "title": "" } ]
[ { "docid": "25a46ec17ea5339b6742d80df30b89a7", "score": "0.8033001", "text": "def stringy(integer, zero_or_one='1')\n str = ''\n integer.times do |ctr|\n ctr += 1 if zero_or_one == '0'\n ctr % 2 == 0 ? str << '1' : str << '0'\n end\n str\nend", "title": "" }, { "docid": "3567a40abc...
b35d958b267351684405302d9802216d
Constructs an initial response from the given code and subcode
[ { "docid": "abd5cf1799c19ccb758141b245f92218", "score": "0.8215884", "text": "def response_with_code(code, subcode)\n OpenStruct.new(name: code_name(code), code: code, subcode: subcode)\n end", "title": "" } ]
[ { "docid": "6adde231ad4283d4b345e29a01ce1b9e", "score": "0.6559136", "text": "def response_subcode\n params['x_response_subcode']\n end", "title": "" }, { "docid": "9a6e1a5dd012958de257948ce600c7c6", "score": "0.6531909", "text": "def response_subcode\n p...
729af52edecb325233d83d77b6e324c1
Function to open a dialog box for profile management.
[ { "docid": "2bd3c4da8f8960ba01a5de86bd6abe16", "score": "0.84372073", "text": "def profile_management_dialog\n dialog = Dumon::GtkProfileDlg.new\n dialog.show\n end", "title": "" } ]
[ { "docid": "fc845c17bf730e01486c41a130672f78", "score": "0.6773562", "text": "def profile\n self.profilelink.click\n end", "title": "" }, { "docid": "c2ba9758913edc09ef5ef5a080356f44", "score": "0.63013136", "text": "def view_owner_information(name)\n self.button(:title=>\...