z, ? | toggle help (this) |
space, → | next slide |
shift-space, ← | previous slide |
d | toggle debug mode |
## <ret> | go to slide # |
c, t | table of contents (vi) |
f | toggle footer |
r | reload slides |
n | toggle notes |
p | run preshow |
$ signore prego
// sometimes I believe compiler ignores all my comments
$ signore prego Lisp
Lisp: from the people who didn’t bring you AI.
$ signore prego Perl
/* obligatory Perl joke (omitted for brevity) */
[Tomasz Dubrownik]
$ signore prego Ruby
Cloud is to datacenter what Ruby is to assembler.
[DevOps Borat]
$ signore prego Python Ruby
‘I swear, Ruby has more syntax for creating strings than Python has total.’
‘"what" + %[are] + <<STR you STR + %q(talking) + 'about?'’
[Gary Bernhardt, Jeff Forcier]
$ signore prego Lisp ~Python Ruby
I love Ruby’s optional parentheses. Lisp doesn’t have optional parentheses.
[Jamis Buck]
$ signore pronto Lisp
text?
(What the world needs (I think) is not (a Lisp (with fewer parentheses))
but (an English (with more.)))
author?
Brian Hayes
source?
The Semicolon Wars
subject?
(What the world needs (I think) is not (a Lisp (with
fewer parentheses)) but (an English (with more.)))
[Brian Hayes, The Semicolon Wars]
# encoding: UTF-8
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
db.push Sig.new 'Patrick Huesler',
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
db.push Sig.new 'Patrick Huesler', ['Ruby', 'Unicorn'],
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
db.push Sig.new 'Patrick Huesler', ['Ruby', 'Unicorn'],
'My deploy log message of the day: ‘sleeping ' +
'for 3 seconds until all old unicorns are dead’.'
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
db.push Sig.new 'Patrick Huesler', ['Ruby', 'Unicorn'],
'My deploy log message of the day: ‘sleeping ' +
'for 3 seconds until all old unicorns are dead’.'
db.push Sig.new 'Chris Wanstrath', ['Ruby', 'Enumerable'],
'Every time I use Ruby’s Enumerable#partition ' +
'I want to give matz a high five.'
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
db.push Sig.new 'Patrick Huesler', ['Ruby', 'Unicorn'],
'My deploy log message of the day: ‘sleeping ' +
'for 3 seconds until all old unicorns are dead’.'
db.push Sig.new 'Chris Wanstrath', ['Ruby', 'Enumerable'],
'Every time I use Ruby’s Enumerable#partition ' +
'I want to give matz a high five.'
sig = db.select { |sig| sig.tags.include? 'Ruby' }.sample
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
db.push Sig.new 'Patrick Huesler', ['Ruby', 'Unicorn'],
'My deploy log message of the day: ‘sleeping ' +
'for 3 seconds until all old unicorns are dead’.'
db.push Sig.new 'Chris Wanstrath', ['Ruby', 'Enumerable'],
'Every time I use Ruby’s Enumerable#partition ' +
'I want to give matz a high five.'
sig = db.select { |sig| sig.tags.include? 'Ruby' }.sample
puts sig.text
puts '— ' + sig.author
# encoding: UTF-8
Sig = Struct.new :author, :tags, :text
db = []
db.push Sig.new 'Patrick Huesler', ['Ruby', 'Unicorn'],
'My deploy log message of the day: ‘sleeping ' +
'for 3 seconds until all old unicorns are dead’.'
db.push Sig.new 'Chris Wanstrath', ['Ruby', 'Enumerable'],
'Every time I use Ruby’s Enumerable#partition ' +
'I want to give matz a high five.'
sig = db.select { |sig| sig.tags.include? 'Ruby' }.sample
puts sig.text
puts '— ' + sig.author
# My deploy log message of the day: ‘sleeping
# for 3 seconds until all old unicorns are dead’.
# — Patrick Huesler
Martin Fowler: The Future is not just NoSQL, it’s Polyglot Persistence
require 'active_record'
require 'logger'
require 'postgres_ext'
require 'active_record'
require 'logger'
require 'postgres_ext'
ActiveRecord::Base.logger = Logger.new $stdout
require 'active_record'
require 'logger'
require 'postgres_ext'
ActiveRecord::Base.logger = Logger.new $stdout
ActiveRecord::Base.establish_connection adapter: 'postgresql',
database: 'arrrrcamp'
require 'active_record'
require 'logger'
require 'postgres_ext'
ActiveRecord::Base.logger = Logger.new $stdout
ActiveRecord::Base.establish_connection adapter: 'postgresql',
database: 'arrrrcamp'
Class.new ActiveRecord::Migration do
end
require 'active_record'
require 'logger'
require 'postgres_ext'
ActiveRecord::Base.logger = Logger.new $stdout
ActiveRecord::Base.establish_connection adapter: 'postgresql',
database: 'arrrrcamp'
Class.new ActiveRecord::Migration do
def change
create_table :sigs do |table|
table.text :author
table.text :text
table.text :tags, array: true
end
end
end
require 'active_record'
require 'logger'
require 'postgres_ext'
ActiveRecord::Base.logger = Logger.new $stdout
ActiveRecord::Base.establish_connection adapter: 'postgresql',
database: 'arrrrcamp'
Class.new ActiveRecord::Migration do
def change
create_table :sigs do |table|
table.text :author
table.text :text
table.text :tags, array: true
end
end
end.new.migrate :up
require 'active_record'
require 'logger'
require 'postgres_ext'
ActiveRecord::Base.logger = Logger.new $stdout
ActiveRecord::Base.establish_connection adapter: 'postgresql',
database: 'arrrrcamp'
Class.new ActiveRecord::Migration do
def change
create_table :sigs do |table|
table.text :author
table.text :text
table.text :tags, array: true
end
end
end.new.migrate :up
# CREATE TABLE "sigs" ("id" serial primary key,
# "author" text, "text" text, "tags" text[])
Sig = Class.new ActiveRecord::Base
Sig = Class.new ActiveRecord::Base
Sig.create author: 'Tim Pope',
Sig = Class.new ActiveRecord::Base
Sig.create author: 'Tim Pope', tags: ['Ruby', 'BigDecimal'],
Sig = Class.new ActiveRecord::Base
Sig.create author: 'Tim Pope', tags: ['Ruby', 'BigDecimal'],
text: 'I wonder if the guy that wrote BigDecimal#inspect has ' +
'a tragic backstory that explains why he hates humanity.'
Sig = Class.new ActiveRecord::Base
Sig.create author: 'Tim Pope', tags: ['Ruby', 'BigDecimal'],
text: 'I wonder if the guy that wrote BigDecimal#inspect has ' +
'a tragic backstory that explains why he hates humanity.'
# INSERT INTO "sigs" ("author", "tags", "text") VALUES ($1, $2, $3)
# RETURNING "id" [["author", "Tim Pope"], ["tags", ["Ruby", "BigDecimal"]],
# ["text", "I wonder if the guy that wrote BigDecimal#inspect has…"]]
Sig = Class.new ActiveRecord::Base
Sig.create author: 'Tim Pope', tags: ['Ruby', 'BigDecimal'],
text: 'I wonder if the guy that wrote BigDecimal#inspect has ' +
'a tragic backstory that explains why he hates humanity.'
# INSERT INTO "sigs" ("author", "tags", "text") VALUES ($1, $2, $3)
# RETURNING "id" [["author", "Tim Pope"], ["tags", ["Ruby", "BigDecimal"]],
# ["text", "I wonder if the guy that wrote BigDecimal#inspect has…"]]
Sig.create author: 'Pаul Bаttley', tags: ['Ruby', 'Bundler'],
text: 'I’d love to see an honest Ruby job ad. ‘You will spend half ' +
'your time running bundle install & the other half facepalming.’'
Sig = Class.new ActiveRecord::Base
Sig.create author: 'Tim Pope', tags: ['Ruby', 'BigDecimal'],
text: 'I wonder if the guy that wrote BigDecimal#inspect has ' +
'a tragic backstory that explains why he hates humanity.'
# INSERT INTO "sigs" ("author", "tags", "text") VALUES ($1, $2, $3)
# RETURNING "id" [["author", "Tim Pope"], ["tags", ["Ruby", "BigDecimal"]],
# ["text", "I wonder if the guy that wrote BigDecimal#inspect has…"]]
Sig.create author: 'Pаul Bаttley', tags: ['Ruby', 'Bundler'],
text: 'I’d love to see an honest Ruby job ad. ‘You will spend half ' +
'your time running bundle install & the other half facepalming.’'
Sig.create author: 'Tom Stuart', tags: ['Git'],
text: 'Just discovered git rebase --interactive --autosquash. ' +
'Holy shit. Will never again need to do any work.'
$ psql arrrrcamp
# SELECT * FROM sigs;
id | author | text | tags
----+--------------+---------------------------------+-------------------
1 | Tim Pope | I wonder if the guy that wrote… | {Ruby,BigDecimal}
2 | Pаul Bаttley | I’d love to see an honest Ruby… | {Ruby,Bundler}
3 | Tom Stuart | Just discovered git rebase --i… | {Git}
(3 rows)
# SELECT * FROM sigs WHERE 'Ruby' = ANY(tags);
id | author | text | tags
----+--------------+---------------------------------+-------------------
1 | Tim Pope | I wonder if the guy that wrote… | {Ruby,BigDecimal}
2 | Pаul Bаttley | I’d love to see an honest Ruby… | {Ruby,Bundler}
(2 rows)
sig = Sig.where(':tag = ANY(tags)', tag: 'Ruby')
sig = Sig.where(':tag = ANY(tags)', tag: 'Ruby').order('random()').first
sig = Sig.where(':tag = ANY(tags)', tag: 'Ruby').order('random()').first
# SELECT "sigs".* FROM "sigs"
# WHERE ('Ruby' = ANY(tags)) ORDER BY random() LIMIT 1
sig = Sig.where(':tag = ANY(tags)', tag: 'Ruby').order('random()').first
# SELECT "sigs".* FROM "sigs"
# WHERE ('Ruby' = ANY(tags)) ORDER BY random() LIMIT 1
puts sig.text
puts '— ' + sig.author
sig = Sig.where(':tag = ANY(tags)', tag: 'Ruby').order('random()').first
# SELECT "sigs".* FROM "sigs"
# WHERE ('Ruby' = ANY(tags)) ORDER BY random() LIMIT 1
puts sig.text
puts '— ' + sig.author
# I wonder if the guy that wrote BigDecimal#inspect has
# a tragic backstory that explains why he hates humanity.
# — Tim Pope
require 'redis-roc'
require 'redis-roc'
Sig = Struct.new :author, :text
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
Sig.new 'Brian P. Hogan',
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
Sig.new 'Brian P. Hogan',
'There are so many things in Rails that make people go ‘AWESOME’ ' +
'and then two years later, make them go ‘I should not have used that’.'
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
brian = Marshal.dump Sig.new 'Brian P. Hogan',
'There are so many things in Rails that make people go ‘AWESOME’ ' +
'and then two years later, make them go ‘I should not have used that’.'
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
brian = Marshal.dump Sig.new 'Brian P. Hogan',
'There are so many things in Rails that make people go ‘AWESOME’ ' +
'and then two years later, make them go ‘I should not have used that’.'
store.init_set('tag:Ruby').add brian
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
brian = Marshal.dump Sig.new 'Brian P. Hogan',
'There are so many things in Rails that make people go ‘AWESOME’ ' +
'and then two years later, make them go ‘I should not have used that’.'
store.init_set('tag:Ruby').add brian
reg = Marshal.dump Sig.new 'Reg Braithwaite',
'The ‘Ruby Community’ is the Woody Allen of programming languages, ' +
'all neuroses and internal monologues, but loveable and means well.'
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
brian = Marshal.dump Sig.new 'Brian P. Hogan',
'There are so many things in Rails that make people go ‘AWESOME’ ' +
'and then two years later, make them go ‘I should not have used that’.'
store.init_set('tag:Ruby').add brian
reg = Marshal.dump Sig.new 'Reg Braithwaite',
'The ‘Ruby Community’ is the Woody Allen of programming languages, ' +
'all neuroses and internal monologues, but loveable and means well.'
store.init_set('tag:Ruby').add reg
store.init_set('tag:movies').add reg
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
brian = Marshal.dump Sig.new 'Brian P. Hogan',
'There are so many things in Rails that make people go ‘AWESOME’ ' +
'and then two years later, make them go ‘I should not have used that’.'
store.init_set('tag:Ruby').add brian
reg = Marshal.dump Sig.new 'Reg Braithwaite',
'The ‘Ruby Community’ is the Woody Allen of programming languages, ' +
'all neuroses and internal monologues, but loveable and means well.'
store.init_set('tag:Ruby').add reg
store.init_set('tag:movies').add reg
adam = Marshal.dump Sig.new 'Adam Keys',
'I want to see a hacker movie where the protagonist just stares in ' +
'confusion at a stack trace for a few minutes. No typing, no chatter.'
require 'redis-roc'
Sig = Struct.new :author, :text
store = ROC::Store::RedisStore.new Redis.new
brian = Marshal.dump Sig.new 'Brian P. Hogan',
'There are so many things in Rails that make people go ‘AWESOME’ ' +
'and then two years later, make them go ‘I should not have used that’.'
store.init_set('tag:Ruby').add brian
reg = Marshal.dump Sig.new 'Reg Braithwaite',
'The ‘Ruby Community’ is the Woody Allen of programming languages, ' +
'all neuroses and internal monologues, but loveable and means well.'
store.init_set('tag:Ruby').add reg
store.init_set('tag:movies').add reg
adam = Marshal.dump Sig.new 'Adam Keys',
'I want to see a hacker movie where the protagonist just stares in ' +
'confusion at a stack trace for a few minutes. No typing, no chatter.'
store.init_set('tag:movies').add adam
ruby = store.init_set 'tag:Ruby'
movies = store.init_set 'tag:movies'
ruby = store.init_set 'tag:Ruby'
movies = store.init_set 'tag:movies'
sig = Marshal.load (ruby & movies).sample
ruby = store.init_set 'tag:Ruby'
movies = store.init_set 'tag:movies'
sig = Marshal.load (ruby & movies).sample
puts sig.text
puts '— ' + sig.author
ruby = store.init_set 'tag:Ruby'
movies = store.init_set 'tag:movies'
sig = Marshal.load (ruby & movies).sample
puts sig.text
puts '— ' + sig.author
# The ‘Ruby Community’ is the Woody Allen of programming languages,
# all neuroses and internal monologues, but loveable and means well.
# — Reg Braithwaite
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
Sig = Struct.new :author, :tags, :text
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
Sig = Struct.new :author, :tags, :text
store.transaction do
end
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
Sig = Struct.new :author, :tags, :text
store.transaction do
store['db'] ||= []
end
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
Sig = Struct.new :author, :tags, :text
store.transaction do
store['db'] ||= []
Sig.new 'Mike Perham', ['Ruby', 'Rails'],
'‘Never wrestle with a pig – you get dirty and the ' +
'pig likes it.’ NOW REPLACE PIG WITH ASSET PIPELINE.'
end
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
Sig = Struct.new :author, :tags, :text
store.transaction do
store['db'] ||= []
store['db'].push Sig.new 'Mike Perham', ['Ruby', 'Rails'],
'‘Never wrestle with a pig – you get dirty and the ' +
'pig likes it.’ NOW REPLACE PIG WITH ASSET PIPELINE.'
end
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
Sig = Struct.new :author, :tags, :text
store.transaction do
store['db'] ||= []
store['db'].push Sig.new 'Mike Perham', ['Ruby', 'Rails'],
'‘Never wrestle with a pig – you get dirty and the ' +
'pig likes it.’ NOW REPLACE PIG WITH ASSET PIPELINE.'
store['db'].push Sig.new 'Solomon White', ['Ruby', 'RubyGems'],
'If you’re ever tempted to add a post-install message ' +
'to a gem, stop and back slowly away from the keyboard.'
end
require 'yaml/store'
store = YAML::Store.new 'sigs.yml'
Sig = Struct.new :author, :tags, :text
store.transaction do # read-write transaction…
store['db'] ||= []
store['db'].push Sig.new 'Mike Perham', ['Ruby', 'Rails'],
'‘Never wrestle with a pig – you get dirty and the ' +
'pig likes it.’ NOW REPLACE PIG WITH ASSET PIPELINE.'
store['db'].push Sig.new 'Solomon White', ['Ruby', 'RubyGems'],
'If you’re ever tempted to add a post-install message ' +
'to a gem, stop and back slowly away from the keyboard.'
end # …atomically written here
store.transaction true do # read-only transaction
end
store.transaction true do # read-only transaction
store['db'].select { |sig| sig.tags.include? 'Ruby' }.sample
end
sig = store.transaction true do # read-only transaction
store['db'].select { |sig| sig.tags.include? 'Ruby' }.sample
end
sig = store.transaction true do # read-only transaction
store['db'].select { |sig| sig.tags.include? 'Ruby' }.sample
end
puts sig.text
puts '— ' + sig.author
sig = store.transaction true do # read-only transaction
store['db'].select { |sig| sig.tags.include? 'Ruby' }.sample
end
puts sig.text
puts '— ' + sig.author
# ‘Never wrestle with a pig – you get dirty and the
# pig likes it.’ NOW REPLACE PIG WITH ASSET PIPELINE.
# — Mike Perham
$ cat sigs.yml
---
db:
- !ruby/struct:Sig
author: Mike Perham
tags:
- Ruby
- Rails
text: ‘Never wrestle with a pig – you get dirty and the
pig likes it.’ NOW REPLACE PIG WITH ASSET PIPELINE.
- !ruby/struct:Sig
author: Solomon White
tags:
- Ruby
- RubyGems
text: If you’re ever tempted to add a post-install message
to a gem, stop and back slowly away from the keyboard.
$ signore prego
Every time I read old computer science articles, I find
that everyone figured everything out before I was even born.
[Steve Klabnik]
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
class Sig
include Candy::Piece
end
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
class Sig
include Candy::Piece
end
fogus = Sig.new # localhost:27017, ‘chastell’ db, ‘Sig’ collection
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
class Sig
include Candy::Piece
end
fogus = Sig.new # localhost:27017, ‘chastell’ db, ‘Sig’ collection
fogus.author = 'fogus' # method_missing resaves
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
class Sig
include Candy::Piece
end
fogus = Sig.new # localhost:27017, ‘chastell’ db, ‘Sig’ collection
fogus.author = 'fogus' # method_missing resaves
fogus.tags = ['Ruby', 'Java']
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
class Sig
include Candy::Piece
end
fogus = Sig.new # localhost:27017, ‘chastell’ db, ‘Sig’ collection
fogus.author = 'fogus' # method_missing resaves
fogus.tags = ['Ruby', 'Java']
fogus.text = 'How many lines of Java would it take to do this? ' +
'obj.class.superclass.public_instance_methods(false).sort'
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
class Sig
include Candy::Piece
end
fogus = Sig.new # localhost:27017, ‘chastell’ db, ‘Sig’ collection
fogus.author = 'fogus' # method_missing resaves
fogus.tags = ['Ruby', 'Java']
fogus.text = 'How many lines of Java would it take to do this? ' +
'obj.class.superclass.public_instance_methods(false).sort'
michael = Sig.new author: 'Michael Feathers', tags: ['Ruby', 'coding'],
text: 'At the dentist’s thinking about whether hints of method size can ' +
'be seen in intra-class dependency diagrams. Oh no, here comes the drill.'
require 'bson'
BSON::ObjectID = BSON::ObjectId
require 'candy'
class Sig
include Candy::Piece
end
fogus = Sig.new # localhost:27017, ‘chastell’ db, ‘Sig’ collection
fogus.author = 'fogus' # method_missing resaves
fogus.tags = ['Ruby', 'Java']
fogus.text = 'How many lines of Java would it take to do this? ' +
'obj.class.superclass.public_instance_methods(false).sort'
michael = Sig.new author: 'Michael Feathers', tags: ['Ruby', 'coding'],
text: 'At the dentist’s thinking about whether hints of method size can ' +
'be seen in intra-class dependency diagrams. Oh no, here comes the drill.'
zach = Sig.new author: 'Zach Holman', tags: ['coding', 'work'],
text: 'I think programming riddles, games, and brain teasers are a great ' +
'way to hire. First one to say ‘fuck this!’ and walk out gets the job.'
class Sigs
include Candy::Collection
end
class Sigs
include Candy::Collection
collects Sig
end
class Sigs
include Candy::Collection
collects Sig
end
sig = Sigs.tags('coding').to_a.sample.refresh
class Sigs
include Candy::Collection
collects Sig
end
sig = Sigs.tags('coding').to_a.sample.refresh
puts sig.text
puts '— ' + sig.author
class Sigs
include Candy::Collection
collects Sig
end
sig = Sigs.tags('coding').to_a.sample.refresh
puts sig.text
puts '— ' + sig.author
# I think programming riddles, games, and brain teasers are a great
# way to hire. First one to say ‘fuck this!’ and walk out gets the job.
# — Zach Holman
$ signore prego
If you have a parrot and you don’t teach it to say, ‘help, they’ve
turned me into a parrot’, you are wasting everybody’s time.
[Julia Segal]
$ alias computer,='sudo'
$ computer, apt-get install postgresql
$ computer, apt-get install redis-server
$ computer, apt-get install mong^C
(just kidding – but do remember about tradeoffs)
$ computer, apt-get install mongodb couchdb slapd
THERE ARE MANY WAYS TO PERSIST OBJECTS
PLAY AROUND WITH THEM — IT’S GREAT FUN