Skip to content

Instantly share code, notes, and snippets.

Avatar
💭
🚁🦖

Denny Abraham dennyabraham

💭
🚁🦖
View GitHub Profile
View dice-roller.rb
class Dice
attr_accessor :collection
def initialize(*collection)
@collection = collection
end
def +(other)
@collection.last + other
self
View keybase.md

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 Sep 30, 2016
karabiner config for ms sculpt
View private.xml
<?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 Aug 29, 2015
odd jruby behavior
View cruby
# 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
View gist:7208561
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
View privacy_filter.rb
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 Nov 4, 2011
In the year 201X, app was beginning...
View combined_template.rb
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 Oct 5, 2011 — forked from jimeh/mass_insert_mongo.js
Simple MySQL vs. MongoDB Insert benchmark.
View mass_insert_mongo.js
for (var i=0; i < 100000; i++) {
db.mass_insert.save({
"first_name": "James",
"middle_name": "Richard",
"last_name": "Windsgate",
"email": "jamesrichardwindsgate@email.com"
});
};