This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| A Beastiary of Badassery | |
| - | |
| SQLisms | |
| -- | |
| WITH | |
| arrays and unnest | |
| window functions | |
| JSON | |
| row types |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pvh$ bundle exec irb | |
| irb(main):001:0> require 'sequel' | |
| => true | |
| irb(main):002:0> DB = Sequel.connect("postgres:///") | |
| => #<Sequel::Postgres::Database: "postgres:///"> | |
| irb(main):003:0> DB.extension(:pg_array, :pg_row) | |
| => #<Sequel::Postgres::Database: "postgres:///"> | |
| irb(main):004:0> DB[:databases].select(Sequel::lit('(databases)')).all.first.values.first | |
| => "(foo,localhost:5432)" | |
| irb(main):005:0> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| module Shogun | |
| module Once | |
| class OnceRecord < Sequel::Model | |
| Sequel.extension :pg_array | |
| DB.extend Sequel::Postgres::PGArray::DatabaseMethods | |
| unrestrict_primary_key | |
| end | |
| def self.ever(*arguments, &blk) | |
| OnceRecord.create(signature: signature(arguments), arguments: arguments.pg_array) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| require 'spec_helper' | |
| describe Thing do | |
| subject { Thing.new() } | |
| describe "#rating" do | |
| its(:amount) { should == 25 } | |
| end | |
| describe "winning" do | |
| before { subject.win } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| (ns states.core) | |
| (def resource-transitions | |
| {:create | |
| [{:condition #(= (% :ec2-state "pending")) | |
| :transition :booting}, | |
| {:condition #(> (* 10 60) (% :created_at050)) | |
| :transition :failed}] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env ruby | |
| u = URI.parse(ARGV[0]) | |
| u.scheme == "postgres" or abort("Must provide a postgres://user:pass@host/dbname form url.") | |
| ENV["PGPASSWORD"] = u.password | |
| cmd = "psql -U #{u.user} -h #{u.host} #{u.path[1..-1]}" | |
| puts cmd | |
| exec cmd |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| PS1='\h:\W$(__git_ps1 "(%s)") \u\$ ' |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/swirl/ec2.rb b/lib/swirl/ec2.rb | |
| index fd795f5..4f97bf5 100644 | |
| --- a/lib/swirl/ec2.rb | |
| +++ b/lib/swirl/ec2.rb | |
| @@ -21,11 +21,11 @@ module Swirl | |
| def initialize(options) | |
| @aws_access_key_id = | |
| - options[:aws_access_key_id] || | |
| - raise ArgumentError, "no aws_access_key_id provided" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| diff --git a/lib/swirl/ec2.rb b/lib/swirl/ec2.rb | |
| index 19b2497..ed02b3a 100644 | |
| --- a/lib/swirl/ec2.rb | |
| +++ b/lib/swirl/ec2.rb | |
| @@ -35,7 +35,7 @@ module Swirl | |
| end | |
| def escape(value) | |
| - CGI.escape(value).gsub(/\+/, "%20") | |
| + CGI.escape(value.to_s).gsub(/\+/, "%20") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| pvhbook:bifrost((f8551e6...)) pvh$ bin/bifrost info ruronin | |
| [ ruronin ] | |
| Judo ID : 17wnkw7 | |
| Ip : 184.73.174.19 | |
| Plan : ronin | |
| CallbackURL : | |
| URL : postgres://w23c56tn748j47:a891myo7zoe815yohbzhjgej4@ec2-184-73-174-19.compute-1.amazonaws.com/w23c56tn748j47 | |
| Created At : Tue May 25 11:15:40 -0700 2010 | |
| Started At : Tue May 25 11:15:55 -0700 2010 | |
| pvhbook:bifrost((f8551e6...)) pvh$ bin/bifrost backup ruronin |
NewerOlder