Skip to content

Instantly share code, notes, and snippets.

@teohm
teohm / capistrano3-rvmsudo.md
Created March 26, 2014 04:39
A working workaround to run rvmsudo in Capistrano 3.

Testability and Good Design

Personal notes on Michael Feather's talk about testability and good design.

Video

The Deep Synergy Between Testability and Good Design (http://vimeo.com/15007792)

@teohm
teohm / rails-reload-example.rb
Created January 29, 2014 01:08 — forked from garybernhardt/gist:8678679
unload/reload
# Goal: put a non-Rails-aware Ruby library using normal `require`s in
# lib/mything. Have it transparently reloaded between requests like Rails app
# code is.
#
# The code here goes inside of your configure block in
# config/environments/development.rb. There are two parts, commented inline.
# Disable reload_classes_only_on_change. This makes Rails invoke the reloader
# even if no source files are changed. This is necessary because the autoloader
# and reloader don't know about our library, so they won't know to trigger a
@teohm
teohm / dynabo-db-local-connect.rb
Last active January 4, 2016 19:08
DynamoDB Local connection sample.
dynamo_db_config = {
api_version: '2012-08-10',
access_key_id: ENV['AWS_ACCESS_KEY_ID'],
secret_access_key: ENV['AWS_SECRET_ACCESS_KEY'],
}
dynamo_db_config.merge!(
use_ssl: false,
dynamo_db_endpoint: 'localhost',
dynamo_db_port: 8000
)
@teohm
teohm / learn-dynamodb.md
Last active July 31, 2021 09:55
personal reading notes about DynamoDB tips & gotcahs

Disclaimer: I'm super new to DynamoDB, so if you found I wrote something incorrect or stupid, just kindly send me a comment :)


Learn DynamoDB

  • database -> tables -> items -> attributes
  • db = a collection of tables
#!/usr/bin/env ruby
require 'benchmark'
REGEXPS = [
/^no such file to load -- (.+)$/i,
/^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i,
/^Missing API definition file in (.+)$/i,
/^cannot load such file -- (.+)$/i,
]
@teohm
teohm / -test-singtel.md
Last active January 3, 2016 07:29
Steps to replicate HTTP timed out using Singtel internet in SG office.

Setup

brew install node
git clone https://gist.github.com/8429958.git test-singtel

Run

cd test-singtel
bash run.sh

need a data backup/restore/migration plan.

Data

Work Projects
Personal projects
Homebrew apps
Applications
Videos 
Movies
@teohm
teohm / -dotfiles.md
Last active January 1, 2016 04:49
my research on managing and writing cross-platform dotfiles.

Requirements

  • one-liner to configure my basic cli tools on linux
  • one-liner to configure my basic cli tools on os x
  • my basic cli tools: vim, tmux, git, ack/ag, ruby debugger, autojump

Findings

Loading startup files