Skip to content

Instantly share code, notes, and snippets.

View larsthegeek's full-sized avatar

James Peterson larsthegeek

  • Total Tech Shop
View GitHub Profile
@larsthegeek
larsthegeek / config-initializers-resque.rb
Created February 3, 2012 21:13 — forked from andreaseger/config-initializers-resque.rb
carrierwave resque background image processing foo
rails_root = ENV['RAILS_ROOT'] || File.dirname(__FILE__) + '/../..'
rails_env = ENV['RAILS_ENV'] || 'development'
resque_config = YAML.load_file(rails_root + '/config/resque.yml')
Resque.redis = resque_config[rails_env]
#secure the admin view of resque
Resque::Server.use(Rack::Auth::Basic) do |user, password|
password == "secret"
end
@larsthegeek
larsthegeek / init.el
Created February 10, 2012 02:46 — forked from mig/init.el
Simple Emacs 24 configuration for Rails development
;; emacs configuration
(push "/usr/local/bin" exec-path)
(add-to-list 'load-path "~/.emacs.d")
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)
@larsthegeek
larsthegeek / application_controller.rb
Created February 23, 2012 01:21 — forked from a-chernykh/application_controller.rb
devise force https for sign in and sign up routes
class ApplicationController < ActionController::Base
before_filter :ensure_proper_protocol
protected
def ssl_allowed_action?
(params[:controller] == 'users/sessions' && ['new', 'create'].include?(params[:action])) ||
(params[:controller] == 'users/registrations' && ['new', 'create', 'edit', 'update'].include?(params[:action])) ||
(params[:controller] == 'users/omniauth_callbacks')
end
@larsthegeek
larsthegeek / LICENSE.txt
Created February 27, 2012 01:50 — forked from aemkei/LICENSE.txt
Binary Tetris - 140byt.es
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 YOUR_NAME_HERE <YOUR_URL_HERE>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@larsthegeek
larsthegeek / gist:2582039
Created May 3, 2012 00:00
install dmg/pkg on os x via command line
cd ~/Desktop
curl -O http://darwinports.opendarwin.org/downloads/DarwinPorts-1.2-10.4.dmg
hdiutil attach DarwinPorts-1.2-10.4.dmg
cd /Volumes/DarwinPorts-1.2/
sudo installer -pkg DarwinPorts-1.2.pkg -target "/"
@larsthegeek
larsthegeek / init.el
Created June 9, 2012 14:51 — forked from mig/init.el
Simple Emacs 24 configuration for Rails development
;; emacs configuration
(push "/usr/local/bin" exec-path)
(add-to-list 'load-path "~/.emacs.d")
(setq make-backup-files nil)
(setq auto-save-default nil)
(setq-default tab-width 2)
(setq-default indent-tabs-mode nil)
(setq inhibit-startup-message t)
@larsthegeek
larsthegeek / gist:2967980
Created June 21, 2012 19:30 — forked from jasoncodes/gist:1223731
Installing Ruby 1.9.3 with rbenv
brew install rbenv
brew install ruby-build
brew install --HEAD https://raw.github.com/jasoncodes/homebrew/rbenv-vars/Library/Formula/rbenv-vars.rb # https://github.com/mxcl/homebrew/pull/7891
brew install readline
brew install ctags
echo 'eval "$(rbenv init - --no-rehash)"' >> ~/.bash_profile
exec $SHELL -i # reload the shell
CONFIGURE_OPTS="--disable-install-doc --with-readline-dir=$(brew --prefix readline)" rbenv install 1.9.3-p194
rbenv global 1.9.3-p194
gem install bundler rbenv-rehash git-up hitch gem-browse gem-ctags cheat awesome_print pry
@larsthegeek
larsthegeek / hack.sh
Created October 31, 2012 21:49 — forked from erikh/hack.sh
OSX For Hackers
#!/usr/bin/env sh
##
# This is script with usefull tips taken from:
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx
#
# install it:
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh
#
@larsthegeek
larsthegeek / gist:4029012
Created November 7, 2012 01:38
Update RubyGems to a specific version (for legacy system installs)
How to update RubyGems to a specific version
RubyGems can update itself to the latest version:
gem update --system
However, you always get the newest version. This may be a problem if you’re trying to replicate a known-good environment: for example, the output format of `gem list` in RubyGems 1.3.7 breaks Chef 0.8.16 in certain circumstances. 1.3.6 is fine.
Here’s how to update to a specific version—in this case, 1.3.6:
gem install -v 1.3.6 rubygems-update && \
@larsthegeek
larsthegeek / gist:4029013
Created November 7, 2012 01:39
Update RubyGems to a specific version (for legacy system installs)
How to update RubyGems to a specific version
RubyGems can update itself to the latest version:
gem update --system
However, you always get the newest version. This may be a problem if you’re trying to replicate a known-good environment: for example, the output format of `gem list` in RubyGems 1.3.7 breaks Chef 0.8.16 in certain circumstances. 1.3.6 is fine.
Here’s how to update to a specific version—in this case, 1.3.6:
gem install -v 1.3.6 rubygems-update && ruby `gem env gemdir`/gems/rubygems-update-1.3.6/setup.rb