Skip to content

Instantly share code, notes, and snippets.

@jhjwind
jhjwind / gist:1164156
Created August 23, 2011 02:12
write file
import java.io.FileWriter
val fw = new FileWriter(outputFilename, true)
try{
fw.write(w.toString)
} finally{
fw.close
2013-04-26T19:55:16.878249+00:00 app[web.9]: Started GET "/members" for 108.162.219.131 at 2013-04-26 19:55:16 +0000
2013-04-26T19:55:16.878645+00:00 app[web.9]: ** [NewRelic][04/26/13 19:55:16 +0000 fcde660b-20f6-4b45-80a6-610ebe1c5a1e (157)] ERROR : Error getting query plan:
2013-04-26T19:55:16.878645+00:00 app[web.9]: ActiveRecord::StatementInvalid: PG::Error: ERROR: there is no parameter $1
2013-04-26T19:55:16.878645+00:00 app[web.9]: LINE 1: ...ECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1
2013-04-26T19:55:16.878645+00:00 app[web.9]: ^
2013-04-26T19:55:16.878645+00:00 app[web.9]: : EXPLAIN SELECT "users".* FROM "users" WHERE "users"."id" = $1 LIMIT 1
2013-04-26T19:55:16.878645+00:00 app[web.9]: /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/active_record/connection_adapters/postgresql_adapter.rb:650:in `exec'
2013-04-26T19:55:16.878645+00:00 app[web.9]: /app/vendor/bundle/ruby/1.9.1/gems/activerecord-3.2.13/lib/

Deploy Rails 4 app with Dokku on DigitalOcean

Install dokku

First create a Ubuntu 13.04 x64 droplet on DigitalOcean Control Panel

Then ssh with root account, run this in termianl:

$ wget -qO- https://raw.github.com/progrium/dokku/master/bootstrap.sh | sudo bash

Set up a Spree backend only install

rails new store-backend

Gemfile

gem 'spree_backend', github: 'spree/spree'
@jhjwind
jhjwind / gist:c3ee55a38fc90cd953c2
Created April 1, 2015 20:05
postgres finding missing index
SELECT relname, seq_scan-idx_scan AS too_much_seq, case when seq_scan-idx_scan>0 THEN 'Missing Index?' ELSE 'OK' END, pg_relation_size(relname::regclass) AS rel_size, seq_scan, idx_scan
FROM pg_stat_all_tables
WHERE schemaname='public' AND pg_relation_size(relname::regclass)>80000 ORDER BY too_much_seq DESC;
@jhjwind
jhjwind / script
Last active August 29, 2015 14:22
Profile model deprecation plan
#Step 1
heroku run rake db:migrate
#step 2
heroku run rake profiles_to_companies:move_active
heroku run rake profiles_to_companies:move_inactive
heroku run rake remove_profile:migrate_profile
#step 3
heroku run rake remove_profile:migrate_seats
Adyen Test Card Numbers
These cards are only valid on our TEST system and they will never involve any actual transaction or transfer of funds. The TEST card numbers will not work on the Adyen LIVE Platform.
For all cards use the following expiration and CVV2/CVC2/or CID for Amex.
For all cards:
Expiration Dates CVV2 / CVC3 CID (American Express)
06/2016 OR 08/2018 737 7373
@jhjwind
jhjwind / rvm2rbenv.txt
Created November 19, 2016 22:48 — forked from brentertz/rvm2rbenv.txt
Switch from RVM to RBENV
## Prepare ###################################################################
# Remove RVM
rvm implode
# Ensure your homebrew is working properly and up to date
brew doctor
brew update
## Install ###################################################################
@jhjwind
jhjwind / Readm.md
Created November 30, 2016 04:54 — forked from jeroenvandijk/Readm.md
Instructions to test Logstash with Kafka

Test Logstash with Kafka

Setup Kafka

Download Kafka from:

https://www.apache.org/dyn/closer.cgi/incubator/kafka/kafka-0.7.2-incubating/kafka-0.7.2-incubating-src.tgz

Install Kafka

@jhjwind
jhjwind / ladder.md
Created January 17, 2017 23:10 — forked from jamtur01/ladder.md
Kickstarter Engineering Ladder