I hereby claim:
- I am rono23 on github.
- I am rono23 (https://keybase.io/rono23) on keybase.
- I have a public key whose fingerprint is F62E 0C85 BDBD E148 795E 1865 018C 5A74 9C66 AA11
To claim this, I am signing this object:
| ## Usage | |
| # gem install oauth2 | |
| # ruby checkins.rb | |
| # | |
| ## .env | |
| # https://foursquare.com/developers/apps | |
| # ENV["4SQ_CLIENT_ID"] = "" | |
| # ENV["4SQ_CLIENT_SECRET"] = "" | |
| # ENV["4SQ_REDIRECT_URI"] = "http://localhost" | |
| # |
| #!/usr/bin/env ruby | |
| # Example: | |
| # git clone git@github.com:github/hub | |
| # cd hub | |
| # open-github #=> https://github.com/github/hub | |
| # open-github issue #=> https://github.com/github/hub/issues | |
| # open-github issue 1 #=> https://github.com/github/hub/issues/1 | |
| # open-github pr #=> https://github.com/github/hub/pulls | |
| # open-github pr 53 #=> https://github.com/github/hub/pull/53 |
I hereby claim:
To claim this, I am signing this object:
| #!/usr/bin/env ruby | |
| percent = (ENV["D"] || "50").to_i | |
| content = ARGF.read | |
| if STDOUT.tty? | |
| print content.chars.map{|c| next c unless c.match(/[\x20-\x7f]/); rand(1..100) <= percent ? " " : c}.join | |
| else | |
| print content | |
| end |
| ActionView::Base.field_error_proc = Proc.new do |html_tag, instance| | |
| html_tag = "<div class='field-with-errors'>#{html_tag}</div>".html_safe | |
| if instance.kind_of?(ActionView::Helpers::Tags::Label) | |
| html_tag | |
| else | |
| method_name = instance.instance_variable_get(:@method_name).to_sym | |
| error_message = instance.object.errors.full_messages_for(method_name).first | |
| html_tag + "<div class='field-with-errors'><p class='error-message'>#{error_message}</p></div>".html_safe | |
| end |
| module ActionView | |
| module Helpers | |
| class DateTimeSelector | |
| def build_options_with_unit(selected, options = {}) | |
| start = options.delete(:start) || 0 | |
| stop = options.delete(:end) || 59 | |
| step = options.delete(:step) || 1 | |
| options.reverse_merge!({:leading_zeros => true, :ampm => false, :use_two_digit_numbers => false}) | |
| leading_zeros = options.delete(:leading_zeros) |
| def eratosthenes(list, primes=[]) | |
| primes << list.shift | |
| prime = primes.last | |
| list.reject!{ |n| n % prime == 0 } | |
| if prime ** 2 > list.max | |
| primes += list | |
| else | |
| eratosthenes(list, primes) | |
| end |
| def fibonacci(num, current, prev, fibo=[]) | |
| return fibo if num < 1 | |
| fibo << current | |
| fibonacci(num - 1, current + prev, current, fibo) | |
| end | |
| fibonacci(10, 1, 0) |
| def fibonacci(n) | |
| if n > 2 | |
| fibonacci(n - 2) + fibonacci(n - 1) | |
| else | |
| 1 | |
| end | |
| end | |
| fibonacci(10) |
| def factorial(n) | |
| return 1 if n < 1 | |
| n * factorial(n - 1) | |
| end | |
| factorial(5) |