I hereby claim:
- I am epid on github.
- I am epid (https://keybase.io/epid) on keybase.
- I have a public key whose fingerprint is 8B67 47F9 BBFB C82F 01C4 08EC A96B EE40 D044 0E9A
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
| def is_prime(n) | |
| ("1" * n) !~ /^1?$|^(11+?)\1+$/ | |
| end |
| def path_to_attachment_image(attachment) | |
| image_path("attachments/#{attachment.filename}") | |
| end |
| # Setup git repository | |
| git :init | |
| # Setup .gitignore files | |
| run "touch tmp/.gitignore log/.gitignore vendor/.gitignore" | |
| run %{find . -type d -empty | grep -v "vendor" | grep -v ".git" | grep -v "tmp" | xargs -I xxx touch xxx/.gitignore} | |
| file '.gitignore', <<-END | |
| .DS_Store | |
| log/*.log |
| # Calculate the number of months between two dates | |
| def months_between (start_date=Time.now, end_date=Time.now) | |
| (end_date.month - start_date.month) + 12 * (end_date.year - start_date.year) | |
| end | |
| # Calculate a person's age | |
| def age_at(date, dob) | |
| day_diff = date.day - dob.day | |
| month_diff = date.month - dob.month - (day_diff < 0 ? 1 : 0) | |
| date.year - dob.year - (month_diff < 0 ? 1 : 0) |
| 100000th post |
| class Time | |
| # because i often times have trouble keeping these straight | |
| # >> 1.day.ago.before? Time.now | |
| # => true | |
| # >> 1.day.from_now.before? Time.now | |
| # => false | |
| # >> 1.day.from_now.after? Time.now | |
| # => true | |
| # >> 1.day.ago.after? Time.now |