Skip to content

Instantly share code, notes, and snippets.

View actaneon's full-sized avatar

Josh King actaneon

  • Get Satisfaction
  • San Francisco, CA
View GitHub Profile
@IvanTorresEdge
IvanTorresEdge / setup-docker-osx-virtualbox.sh
Created February 15, 2017 14:14
Setup Docker on Mac OSX (Homebrew)
# Install Virtualbox from Homebrew (or download and install manually https://www.virtualbox.org/wiki/Downloads)
brew cask install virtualbox
# Install Docker
brew install docker docker-machine docker-compose
# Create your VM
docker-machine create -d virtualbox default --virtualbox-cpu-count "2" --virtualbox-cpu-memory "4096"
docker-machine start
@jbgo
jbgo / debug_system_stack_error.md
Created January 9, 2013 15:08
debug SystemStackError in ruby 1.9

This is how I debug SystemStackError when there is no stack trace.

My first attempt was:

begin
  a_method_that_causes_infinite_recursion_in_a_not_obvious_way
rescue SystemStackError
  puts caller
end
require 'resque/errors'
class DatabaseBackupJob
def self.perform(id, foo, bar)
# do backup work
rescue Resque::TermException
# write failure to database
# re-enqueue the job so the job won't be lost when scaling down.
Resque.enqueue(DatabaseBackupJob, id, foo, bar)
@MohamedAlaa
MohamedAlaa / tmux-cheatsheet.markdown
Last active June 20, 2024 06:27
tmux shortcuts & cheatsheet

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@justinko
justinko / Plea.markdown
Created May 30, 2012 19:40
Am I doing it wrong?

Dear Rubyists,

I just lost a contract because of my code in a Rails project.

The specific code in question is related to a "posting a comment" feature. Here are the details:

In this project, "posting a comment" does not simply entail inserting a row into the database. It involves a procedure to yes, insert a row, but also detect its language, check for spam, send emails, and "share" it to Twitter and Facebook. I believe this algorithm should be encapsulated. I do not believe it belongs in a controller or a model. I do not believe Active Record callbacks should be used.

The "senior developer", whom is the stake holder's right hand man, said this:

How to Make a Classic Mojito

Drink recipes are subjective. Experimentation is a lot of fun, and quite frankly encouraged. However, you really should know what the fuck you're doing before you go all willy nilly throwing everything in your kitchen into a glass and calling it a cocktail. This is the classic Mojito. It's damn fine on it's own. In fact, this is the only way I drink them. Once you've mastered this technique, feel free to experiment with other stuff like mangoes or pineapple or whatever. Just, please, don't call your franken-drink a Mojito.

Ingredients

require "money"
class Decorator < BasicObject
undef_method :==
def initialize(component)
@component = component
end
def method_missing(name, *args, &block)
@wisq
wisq / gist:1507733
Created December 21, 2011 21:14
Why I love zsh (and hate being forced to use bash)

Why I love zsh (and hate being forced to use bash)

  • Smarter completion. A few examples:
  • context sensitive -- if you have file "name1" and directory "name2", "cd nam<TAB>" completes to "name2/"
  • "tar xf <TAB>" completes to tarballs only. "unrar x <TAB>" completes to RARs only. etc.
  • rsync / scp completion: "rsync host:anything/<TAB>" shows you files on host under anything/
  • also works with rsync:// URLs
  • SSH host completion from ~/.ssh/config & ~/.ssh/known_hosts
  • lots of other smart completions: Rake tasks, git commands & SHAs, dpkg packages, dash-options for most commands, etc etc.
@actaneon
actaneon / VimCommands.txt
Created April 14, 2010 17:15
Vim Commands
Moved to README within Vim Environment repo
http://github.com/actaneon/VimEnv/blob/master/README
@actaneon
actaneon / Git.txt
Created March 24, 2010 05:42
Git Commands
list untracked, unignored files: git ls-files -o --exclude-standard
unstage: git reset HEAD FILE
unstage and undo local: git reset --hard HEAD FILE
undo unstaged file: git checkout -- FILE
undo commit with using new commit: git revert [HEAD|$id]
update last commit to include missed adds: git commit --amend (after git add FILE)
git push origin :branch #remove remote
git remote prune origin