Skip to content

Instantly share code, notes, and snippets.

View dennyabraham's full-sized avatar
💭
🚁🦖

Denny Abraham dennyabraham

💭
🚁🦖
View GitHub Profile
@dennyabraham
dennyabraham / dice-roller.rb
Created March 28, 2019 13:43
a quick dice roller
class Dice
attr_accessor :collection
def initialize(*collection)
@collection = collection
end
def +(other)
@collection.last + other
self

Keybase proof

I hereby claim:

  • I am dennyabraham on github.
  • I am dennyabraham (https://keybase.io/dennyabraham) on keybase.
  • I have a public key ASC-SRUt7RSUUUKNBJJN77AbgQ_jYfnQNSwJsN-0ow2gJQo

To claim this, I am signing this object:

@dennyabraham
dennyabraham / private.xml
Last active September 30, 2016 20:38
karabiner config for ms sculpt
<?xml version="1.0"?>
<root>
<devicevendordef>
<vendorname>MSFT</vendorname>
<vendorid>0x045e</vendorid>
</devicevendordef>
<deviceproductdef>
<productname>SCULPT</productname>
<productid>0x07a5</productid>
@dennyabraham
dennyabraham / cruby
Last active August 29, 2015 13:57
odd jruby behavior
# ruby 1.9.3p392 (2013-02-22 revision 39386) [x86_64-darwin12.5.0]
irb(main):001:0> y = "100000"
"100000"
irb(main):002:0> y.class
String < Object
irb(main):003:0> y[3] = '-'
"-"
irb(main):004:0> y
"100-00"
irb(main):005:0> x = 100000.to_s
require 'date'
def second_wednesday_of(month, year)
month_start = Date.new(year, month)
day_number = (1..14).select do |offset|
(month_start + offset).wednesday?
end.last
month_start + day_number
end
@dennyabraham
dennyabraham / privacy_filter.rb
Created December 12, 2011 04:13 — forked from steveklabnik/privacy_filter.rb
A spec for a filter
class PrivacyFilter
class << self
def filter(controller)
@controller = controller
first_article? or administrator? or user?
end
def first_article?
@controller.params[:id] == 1
@dennyabraham
dennyabraham / combined_template.rb
Created November 4, 2011 15:39
In the year 201X, app was beginning...
project_name = ask("What is the application name?")
project_url = ask("What is the application URL?")
use_default_admin = yes?("Install prebuilt admin?")
use_twitter_bootstrap = yes?("Use the twitter bootstrap?")
setup_heroku = yes?("Set the application up on heroku?")
if setup_heroku
use_s3 = yes?("Configure s3 storage?")
if use_s3
aws_access_key_id = ask("What is the aws access key id?")
aws_secret_access_key = ask("What is the aws secret access key?")
@dennyabraham
dennyabraham / mass_insert_mongo.js
Created October 5, 2011 00:29 — forked from jimeh/mass_insert_mongo.js
Simple MySQL vs. MongoDB Insert benchmark.
for (var i=0; i < 100000; i++) {
db.mass_insert.save({
"first_name": "James",
"middle_name": "Richard",
"last_name": "Windsgate",
"email": "jamesrichardwindsgate@email.com"
});
};