Skip to content

Instantly share code, notes, and snippets.

🌴
On vacation

Chad Fowler chad

🌴
On vacation
Block or report user

Report or block chad

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View yow18-links.md
View hello.js
function(thing) { alert(thing) } // l33t
View example.rb
class TheMigrationClass < AR::Migration
class Conference < ActiveRecord::Base
has_many :attendances
end
class Attendance < ActiveRecord::Base
end
def change
# normal migration code
View gist:9584322
### Keybase proof
I hereby claim:
* I am chad on github.
* I am chadfowler (https://keybase.io/chadfowler) on keybase.
* I have a public key whose fingerprint is 1B2A 172D C190 D9A4 2AEF 38D5 A03B AE7D 7559 8524
To claim this, I am signing this object:
View gist:6921252
We're going to go to this place called Lashouk by the Cinema Hotel. It's really good food-, drink-, and atmosphere-wise. We'll go around 7:45 or so. If anyone wants to join in, it's on Dizengoff Square.
@chad
chad / ryan.rb
Created Oct 8, 2013
Bash and Ruby file/directory manipulation
View ryan.rb
require 'fileutils'
Dir.mkdir("hello") unless Dir.exist?("hello")
FileUtils.mkdir_p("/tmp/foo/bar/baz/this/is/easy/no")
Dir["/etc/**/*"].each { |f| puts IO.readlines(f).grep(/chad/i) rescue nil}
@chad
chad / x.scala
Created Jul 10, 2013
hello nilanjan
View x.scala
Welcome to Scala version 2.10.0 (Java HotSpot(TM) 64-Bit Server VM, Java 1.6.0_51).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import play.api.db.slick.Config.driver.simple._
import play.api.db.slick.Config.driver.simple._
scala> new play.core.StaticApplication(new java.io.File("."))[info] play - database [default] connected at jdbc:mysql://localhost/scala_speakers?characterEncoding=UTF8
[info] play - Application started (Prod)
res0: play.core.StaticApplication = play.core.StaticApplication@4aa65618
View test.rb
module Foo
def self.included(klass)
klass.extend ClassMethods
end
module ClassMethods
def foo(name)
(class << self; self; end).send :attr_accessor, name
end
end
end
View gist:2275456
class Class
def attr_with_default(attr_name, default_value)
attr_writer attr_name
define_method(attr_name) do
instance_variable_get("@#{attr_name}") || default_value
end
end
end
class Person
@chad
chad / exporter.rb
Created Feb 26, 2012 — forked from jcasimir/exporter.rb
Export ActiveRecord Tables to CSV
View exporter.rb
require 'csv'
module Exporter
DEFAULT_EXPORT_TABLES = [ Invoice, InvoiceItem, Item, Merchant, Transaction, User ]
DESTINATION_FOLDER = "tmp/"
def self.included(klass)
klass.extend ClassLevelMethods
end
You can’t perform that action at this time.