Skip to content

Instantly share code, notes, and snippets.

View fannar's full-sized avatar
🎯
making

fannar fannar

🎯
making
View GitHub Profile
#!/usr/bin/env ruby
# Pow Port
#
# Quickly and easily change the port that Pow is running on. This allows
# you too run Apache and Pow side-by-side (on different ports of course).
#
# WARNING: This will OVERWRITE your ~/.powconfig file. If you have custom
# configurations in there, please back it up first.
#
@fannar
fannar / db.rake
Created November 9, 2010 22:13
Some custom db rake jobs
namespace :db do
task :reboot do
Rake::Task['db:drop'].invoke
Rake::Task['db:create'].invoke
Rake::Task['db:migrate'].invoke
Rake::Task['db:seed'].invoke
end
end
@fannar
fannar / deploy.rb
Created November 9, 2010 16:18 — forked from trevmex/deploy.rb
# In all comments :stage represents the stage you want to use (i.e. production, staging, etc.)
# Follow these steps AFTER modifying your /etc/apache2/httpd.conf file to add a new rails instance and running `sudo apachectl restart`
# Steps to setup capistrano for the first time:
# - cap :stage deploy:setup # this creates the correct directory tree
# - cap :stage deploy:check # this checks to make sure setup ran
# - cap :stage deploy:update # this updates the server with the app code
# - ssh :user@:main_server # fill in the correct user and server here
# - cd :deploy_to/current # again fill in the correct deploy to dir
# - RAILS_ENV=:stage sudo rake gems:install # this installs gems that need native compiling
# Guide
# Configure the essential configurations below and do the following:
#
# Repository Creation:
# cap deploy:repository:create
# git add .
# git commit -am "initial commit"
# git push origin master
#
# Initial Deployment:
// Provides a device_scale class on iOS devices for scaling user
// interface elements relative to the current zoom factor.
//
// http://37signals.com/svn/posts/2407-device-scale-user-interface-elements-in-ios-mobile-safari
// Copyright (c) 2010 37signals.
//
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
@fannar
fannar / .bashrc
Created April 27, 2010 22:15 — forked from henrik/.bashrc
# http://henrik.nyh.se/2008/12/git-dirty-prompt
# http://www.simplisticcomplexity.com/2008/03/13/show-your-git-branch-name-in-your-prompt/
# username@Machine ~/dev/dir[master]$ # clean working directory
# username@Machine ~/dev/dir[master*]$ # dirty working directory
function parse_git_dirty {
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*"
}
function parse_git_branch {
git branch --no-color 2> /dev/null | sed -e '/^[^*]/d' -e "s/* \(.*\)/[\1$(parse_git_dirty)]/"
@fannar
fannar / gist:358969
Created April 7, 2010 14:53 — forked from wayneeseguin/gist:296055
This example shows how to setup an environment running Rails 3 beta under 1.9.2-head with a 'rails3' gem set.
This example shows how to setup an environment running Rails 3 beta under 1.9.2-head with a 'rails3' gem set.
∴ rvm update --head
# ((Open a new shell)) or do 'rvm reload'
# If you do not already have the ruby interpreter installed, install it:
∴ rvm install 1.9.2-head
# Switch to 1.9.2-head and gemset rails3, create if it doesn't exist.
∴ rvm --create use 1.9.2-head@rails3
# Pipe Ars Technica's live Apple event coverage into a Campfire room.
# http://arstechnica.com/apple/news/2010/01/tablet-live-event-liveblog.ars
#
# Usage:
# $ gem install -r hpricot tinder
# $ ruby -rubygems ars_live.rb -ssl mysubdomain myroomid myapikey
require "hpricot"
require "open-uri"
require "tinder"
@fannar
fannar / base58.rb
Created January 24, 2010 21:20 — forked from jou/base58.rb
# DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
# Version 2, December 2004
#
# Copyright (C) 2004 Sam Hocevar
# 14 rue de Plaisance, 75014 Paris, France
# 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
@fannar
fannar / gist:66069
Created February 17, 2009 23:38 — forked from mernen/gist:39566
Term prompt
# colored prompt, with git support
PS1='\[\033[38m\]\u@\h \[\033[94m\]\W\[\033[95m\]$(__git_ps1)\[\033[37m\]$\[\033
[00m\] '
# If this is an xterm set the title to user@host:dir
case "$TERM" in
xterm*|rxvt*)
PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME%.local}: ${PWD/$HOME/~}\007"'
;;
*)