Skip to content

Instantly share code, notes, and snippets.

var redis = require('redis'),
client = redis.createClient();
exports.freshKey = function() {
// create an 5 character alphanumeric string from a random number
candidate = genKey();
while (exists(candidate)) {
candidate = genKey();
}
return candidate;
@jcuffe
jcuffe / irb
Created September 19, 2012 22:11
1.9.3p194 :007 > a.revert_to! 1
(0.2ms) SELECT MAX("versions"."number") AS max_id FROM "versions" WHERE "versions"."versioned_id" = 15 AND "versions"."versioned_type" = 'Article'
VestalVersions::Version Load (0.4ms) SELECT "versions".* FROM "versions" WHERE "versions"."versioned_id" = 15 AND "versions"."versioned_type" = 'Article' AND ("versions"."number" BETWEEN 1 AND 8) ORDER BY versions."number" DESC
(0.1ms) begin transaction
Article Load (3.6ms) SELECT "articles".* FROM "articles" WHERE "articles"."id" = ? LIMIT 1 [["id", 15]]
(0.4ms) UPDATE "articles" SET "attachment" = '--- !ruby/object:ArticleUploader
model: !ruby/object:Article
attributes:
id: 15
author: ''183''
before_save do
self.temp = self.attachment
def attachment
self.read_column('attachment')
end
end
after_save do
self.attachment = self.temp
end
~/repos/spacely
> cap deploy master [b78cb8b]
* executing `deploy'
* executing `deploy:update'
** transaction: start
* executing `deploy:update_code'
executing locally: "git ls-remote [email protected]:upstartmobile/spacely.git HEAD"
command finished in 3040ms
* getting (via checkout) revision b78cb8bc959e1a506bde7a7f82034044c5f48986 to /var/folders/t2/m792zyzj4zz4xf1g4dwrkjt00000gn/T/20121009191553
executing locally: git clone -q [email protected]:upstartmobile/spacely.git /var/folders/t2/m792zyzj4zz4xf1g4dwrkjt00000gn/T/20121009191553 && cd /var/folders/t2/m792zyzj4zz4xf1g4dwrkjt00000gn/T/20121009191553 && git checkout -q -b deploy b78cb8bc959e1a506bde7a7f82034044c5f48986
servers: ["ec2-23-22-241-159.compute-1.amazonaws.com"]
Password:
failed: "sh -c 'git clone -q [email protected]:upstartmobile/spacely.git
/u/apps/spacely/releases/20121009211205 && cd /u/apps/spacely/releases/20121009211205
&& git checkout -q -b deploy 1054d24099a11aa6047f5aa95b2f0e01510ad239 &&
(echo 1054d24099a11aa6047f5aa95b2f0e01510ad239 > /u/apps/spacely/releases/20121009211205/REVISION)'"
on ec2-23-22-241-159.compute-1.amazonaws.com
@jcuffe
jcuffe / gist:3929963
Created October 22, 2012 06:24
add a user to a group, OSX
sudo dscl . append /Groups/$GROUP GroupMembership $USER
; add ruby DSL filetypes to ruby mode
(setq auto-mode-alist
(append auto-mode-alist '(("\\.god\\'" . ruby-mode)
("\\.ru\\'" . ruby-mode)
("Gemfile\\'" . ruby-mode))))
node 25277 jared 0u IPv4 0x7938ac630e9153bd 0t0 TCP *:8085 (LISTEN)
node 25277 jared 9u IPv4 0x7938ac6313b686dd 0t0 TCP *:8086 (LISTEN)
ruby 28769 jared 34u IPv4 0x7938ac630e3586dd 0t0 TCP localhost:8155 (LISTEN)
ruby 28769 jared 40u IPv4 0x7938ac6313982af5 0t0 TCP localhost:54799->localhost:8155 (ESTABLISHED)
ruby 28769 jared 41u IPv4 0x7938ac6312b527d5 0t0 TCP localhost:8155->localhost:54799 (ESTABLISHED)
ruby 28769 jared 42u IPv4 0x7938ac631112c09d 0t0 TCP localhost:8155->localhost:55050 (ESTABLISHED)
ruby 28769 jared 43u IPv4 0x7938ac631ccd9f0d 0t0 TCP localhost:55052->localhost:8154 (ESTABLISHED)
ruby 28769 jared 44u IPv4 0x7938ac6313b1254d 0t0 TCP localhost:8155->localhost:55053 (ESTABLISHED)
ruby 29095 jared 32u IPv4 0x7938ac630ea5d22d 0t0 TCP localhost:55050->localhost:8155 (ESTABLISHED)
ruby 29095 jared 41u IPv4 0x7938ac63139aaf0d 0t0 TCP localhost:8154 (LISTEN
> checkports
ruby 34497 jared 28u IPv4 0x7938ac630e08a09d 0t0 TCP localhost:8154 (LISTEN)
ruby 34497 jared 37u IPv4 0x7938ac631112a3bd 0t0 TCP localhost:62314->localhost:8154 (ESTABLISHED)
ruby 34497 jared 38u IPv4 0x7938ac6312b4f54d 0t0 TCP localhost:8154->localhost:62314 (ESTABLISHED)
ruby 34497 jared 47u IPv4 0x7938ac63138a822d 0t0 TCP localhost:8156 (LISTEN)
ruby 34497 jared 50u IPv4 0x7938ac630e927e15 0t0 TCP localhost:7155 (LISTEN)
ruby 34497 jared 51u IPv4 0x7938ac6312b503bd 0t0 TCP localhost:62317->localhost:8154 (ESTABLISHED)
ruby 34497 jared 52u IPv4 0x7938ac630e91709d 0t0 TCP localhost:8154->localhost:62317 (ESTABLISHED)
ruby 34497 jared 53u IPv4 0x7938ac6313b6b965 0t0 TCP localhost:62319->localhost:8156 (ESTABLISHED)
ruby 34497 jared 54u IPv4 0x7938ac6312ea6c85 0t0 TCP localhost:8156->localhost:62319 (ESTABLISHED)