Skip to content

Instantly share code, notes, and snippets.

View martinisoft's full-sized avatar
🍎
Makin' Cider & Writing Code

Aaron Kalin martinisoft

🍎
Makin' Cider & Writing Code
View GitHub Profile
@martinisoft
martinisoft / nginx
Created March 13, 2012 14:00
nginx init.d script
#!/bin/sh
### BEGIN INIT INFO
# Provides: nginx
# Required-Start: $local_fs $remote_fs $network $syslog
# Required-Stop: $local_fs $remote_fs $network $syslog
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: starts the nginx web server
# Description: starts nginx using start-stop-daemon
export rvm_project_rvmrc_default=1
export rvm_project_rvmrc=1
[ -f "$HOME/.rvmrc.local" ] && source "$HOME/.rvmrc.local"
+ : 172 > export rvm_trace_flag=1
+ : 172 > rvm_trace_flag=1
+ : 177 > true 1 0 0 0 HOME=/Users/dev
+ : 181 > (( rvm_ignore_rvmrc == 0 ))
+ : 183 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
+ : 185 > [[ -s /etc/rvmrc ]]
+ : 183 > for rvmrc in /etc/rvmrc '"$HOME/.rvmrc"'
+ : 185 > [[ -s /Users/dev/.rvmrc ]]
+ : 187 > grep '^\s*rvm .*$' /Users/dev/.rvmrc
+ : 194 > source /Users/dev/.rvmrc
@martinisoft
martinisoft / gist:1237739
Created September 23, 2011 15:57
rvm bash autocomplete issue
Last 4 lines of my .bashrc:
# RVM
[[ -s "$HOME/.rvm/scripts/rvm" ]] && . "$HOME/.rvm/scripts/rvm"
# RVM Autocomplete
[[ -r $rvm_path/scripts/completion ]] && . $rvm_path/scripts/completion
Output when I type: rvm install [tab]
@martinisoft
martinisoft / gist:1235506
Created September 22, 2011 18:04
rbx build fail log
gort:~ martinisoft$ rvm install -n 1.9 rbx -- --default-version=1.9rbx-head-1.9 installing #dependencies Pulling from origin master
Copying from repo to source...
rbx-head-1.9 - #configuring
rbx-head-1.9 - #compiling
rbx-head-1.9 - adjusting #shebangs for (erb ri rdoc).
rbx-head-1.9 - #importing default gemsets (/Users/martinisoft/.rvm/gemsets/)
WARN: rbx rbx-1.9-head-1.9 is not installed.
To install do: 'rvm install rbx-1.9-head-1.9'
gort:~ martinisoft$ rvm list
@martinisoft
martinisoft / regext.txt
Created August 23, 2011 02:35 — forked from jt/regext.txt
Regular expression notes
- any character you use it will literally match it except special characters
^ $ ? . / \ [ ] { } ( ) + * - all the special characters that will need escaping if you don't want them to be special
// - regexp ruby class
Common Patterns (I authored)
/[\w+\.~-]+@[\w~-]+.[\w\.]+/ - match emails, conforms to RFC 3986 section 3.3
/\+?(\d)?[-|\.|\s]?\(?(\d{3})\)?[-|\.|\s]?(\d{3})[-|\.|\s]?(\d{4})/ - match phone numbers, https://gist.github.com/1009331
Strategies
run("echo group :test, :development do >> Gemfile;")
run("echo gem \\'rspec-rails\\', \\'\\>\\= 2.3.0\\' >> Gemfile;")
run("echo gem \\'capybara\\', \\'0.3.9\\' >> Gemfile;")
run("echo gem \\'database_cleaner\\' >> Gemfile;")
run("echo gem \\'cucumber-rails\\' >> Gemfile;")
run("echo gem \\'launchy\\' >> Gemfile;")
run("echo end >> Gemfile;")
run("bundle install")
@martinisoft
martinisoft / tpl-cukeapp.rb
Created October 24, 2010 04:35
Rails 3, RSpec, Cucumber, Factory_Girl, HAML, SASS, Devise, Formtastic Template
## Rails App Template
## Updated for Rails 3.0.1
## Created on 10/23/10
## Updated on 11/4/10
## Run using $ rails new [appname] -JT -m tpl-cukeapp.rb
## Gems
# Warden and Devise for security
gem 'warden', '0.10.7'
@martinisoft
martinisoft / jquery_setup.rake
Created July 6, 2010 01:24
Rake task to setup a Rails 3 app for jQuery instead of Prototype
# Rails 3 jQuery Install Rakefile
# by Aaron Kalin
# Compiled from http://www.railsinside.com/tips/451-howto-unobtrusive-javascript-with-rails-3.html
#
# Note: this assumes you use git, if not then use the optional usage
#
# Usage: rake install_query
#
# Optional usage: rake install_jquery[nogit]
#
require 'eventmachine'
module EventMachine
module Protocols
class SRCDS < Connection
include EventMachine::Deferrable
def initialize
@authed = false
@commands = { "exec" => 2, "auth" => 3 }