Skip to content

Instantly share code, notes, and snippets.

# as seen in time19.rb
def respond_to_missing?(method, *)
method == "succ" || super
end
def method_missing(method, *args, &block)
if method.to_s == "succ"
self +1
else
@burningTyger
burningTyger / gist:1858524
Created February 18, 2012 09:51
Git issue after replacing XCode with Command line Tools

After I uninstalled XCode via

sudo /Developer/Library/uninstall-devtools --mode=all

and reinstalled the new command line tools from apple I had a weird git error:

fatal: You don't exist. Go away!

whenever I tried to connect with a remote repository like Github or Bitbucket.

@burningTyger
burningTyger / patch.md
Created March 21, 2012 14:14
Using PATCH in Rack::Test

In case you want to use the PATCH verbin Rack::Test and you get errors when you try it with the current gem release you will have to use the git version in your Gemfile:

group :test do
  gem 'rack-test', :git => "https://github.com/brynary/rack-test.git"

While the PATCH verb has been included in a recent patch it's not yet in the gem release. Using the :git repo lets you test also PATCH routes for your rack app.

@burningTyger
burningTyger / aa_instructions.md
Created May 2, 2012 13:42 — forked from NZKoz/aa_instructions.md
Back Up All Your Gmail
  • Install getmail (aptitude install getmail4)
  • Set Up Your Imap Server (tl;dr)
  • getmail
  • ruby date_based_archive.rb ~/Maildir/.Archive
@burningTyger
burningTyger / sparkle.zsh
Created May 16, 2012 22:25
An omyzsh theme file with git and rvm features
PROMPT='$fg_bold[blue][ $fg[red]%t $fg_bold[blue]] $fg_bold[blue] [ $fg[red]%n@%m:%~$(git_prompt_info)$fg[yellow]$(rvm_prompt_info)$fg_bold[blue] ]$reset_color
$ '
# git theming
ZSH_THEME_GIT_PROMPT_PREFIX="$fg_bold[green]("
ZSH_THEME_GIT_PROMPT_SUFFIX=")"
ZSH_THEME_GIT_PROMPT_CLEAN="✔"
ZSH_THEME_GIT_PROMPT_DIRTY="✗"
@burningTyger
burningTyger / .rn
Created June 13, 2012 07:32
Powering off a ReadyNas Drive from the command line
#use this script to turn off your ReadyNas file server from your command line without using the browser.
#Add your ReadyNas host IP, username and password and then call your script from the terminal.
#you might have to install curl which is used to contact the server.
host='readynas_ip'
user='username'
pass='password'
curl -u $user:$pass -k "https://$host/get_handler?PAGE=System&OUTER_TAB=tab_shutdown&INNER_TAB=NONE&shutdown_option1=1&command=poweroff&OPERATION=set"
@burningTyger
burningTyger / gist:3479004
Created August 26, 2012 13:05
Drupal on Openshift

#Drupal on Openshift There is an existing repo for a quick install of Drupal 7 over at https://github.com/openshift/drupal-example. This didn't really cut the deal for me because the example was Drupal 7, I needed Drupal 6 and I wasn't happy about the way it is managed codewise.

I needed this:

  • Drupal 6
  • easy updates via git
  • simple module management
  • multisite setup
left:
++ dirname powerline.sh
+ export TMUX_POWERLINE_DIR_HOME=.
+ TMUX_POWERLINE_DIR_HOME=.
+ source ./config/helpers.sh
+ source ./config/paths.sh
++ export TMUX_POWERLINE_DIR_LIB=./lib
++ TMUX_POWERLINE_DIR_LIB=./lib
++ export TMUX_POWERLINE_DIR_SEGMENTS=./segments
@burningTyger
burningTyger / h.rb
Created January 3, 2013 16:41
Here you have multi-key lookup for Ruby. Original idea by @txustice: https://twitter.com/txustice/status/286790996438683648 I can actually think of use cases :-) If you know a better way for dealing with that return value let me know.
class Hash
alias_method :original, :[]
def [](*keys)
keys.uniq!
if keys[1]
keys.map { |key| original key }
else
original keys[0]
end
end

#Here is how I keep my secrets out of my source code when working with OpenShift

  1. find your app's ssh address:

    rhc app show YOUR_APP_NAME

  2. ssh into your gear to set your environment variables:

    ssh YOUR_APPS_SSH_URL