Skip to content

Instantly share code, notes, and snippets.

View Kerrick's full-sized avatar

Kerrick Long Kerrick

View GitHub Profile
@Kerrick
Kerrick / aptana-studio-3.desktop
Created June 19, 2011 08:58
Aptana Studio 3 launcher for Ubuntu's Unity (save to /usr/share/applications/)
[Desktop Entry]
Name=Aptana Studio 3
Comment=Integrated development environment (IDE) for building Ajax web applications.
Exec=/home/kerrick/Applications/Aptana/AptanaStudio3 -applciation
Icon=/home/kerrick/Applications/Aptana/icon.xpm
Terminal=false
Type=Application
StartupNotify=true
Categories=Development;RevisionControl;
X-GNOME-FullName=Aptana Studio 3
@Kerrick
Kerrick / gist:2476702
Created April 24, 2012 05:21
Ready a live site for deployment via Git instead of FTP, and keep the git directory separate from the working tree on the server.
# On the server
# Assuming you the site is served from ~/www/example.com/ and you want the git directory to live in ~/git/
# Keep in mind that ^C is Control-C, or what ever the command is for your server to halt a program.
mkdir ~/git/example.com.git && cd ~/git/example.com.git
git init --bare
git config core.bare false
git config core.worktree ~/www/example.com
git config receive.denycurrentbranch ignore
cat > hooks/post-receive
#!/bin/sh
@Kerrick
Kerrick / fizzbuzz.rb
Created April 24, 2012 20:36
Different solutions for Fizz Buzz in Ruby
def fizz_buzz_1(max)
arr = []
(1..max).each do |n|
if ((n % 3 == 0) && (n % 5 == 0))
arr << "FizzBuzz"
elsif (n % 3 == 0)
arr << "Fizz"
elsif (n % 5 == 0)
arr << "Buzz"
else
@Kerrick
Kerrick / sublime.desktop
Created April 27, 2012 02:15
Sublime Text 2 launcher for Ubuntu's Unity (save as ~/.local/share/applications/sublime.desktop)
[Desktop Entry]
Name=Sublime Text Editor
Comment="Sublime Text is a sophisticated text editor for code, html and prose. You'll love the slick user interface and extraordinary features."
Exec="/home/kerrick/Applications/sublimetext2/sublime_text" %F
MimeType=text/plain;
Terminal=false
Type=Application
Icon=/home/kerrick/Applications/sublimetext2/Icon/48x48/sublime_text.png
Categories=GNOME;GTK;Utility;TextEditor;Development;Utility;
@Kerrick
Kerrick / Starting on the Server.sh
Created April 27, 2012 03:34
Create a new website and deploy it via Git
# On the server
# Assuming the site is served from ~/www/example.com/ and you can hide the .git directory from public view
# Keep in mind that ^D is Control-D, or what ever the command is for your shell to stop input.
mkdir ~/www/example.com && cd ~/www/example.com
git init
git config core.worktree ~/www/example.com
git config receive.denycurrentbranch ignore
cat > .git/hooks/post-receive
#!/bin/sh
git checkout -f
@Kerrick
Kerrick / gist:2715717
Created May 17, 2012 02:18
Sublime Text 2 settings for a happier life
{
"auto_indent": true,
"caret_style": "phase",
"color_scheme": "Packages/Color Scheme - Default/IR_Black.tmTheme",
"default_line_ending": "unix",
"draw_minimap_border": true,
"ensure_newline_at_eof_on_save": true,
"font_face": "Bitstream Vera Sans Mono",
"font_options":
[
@Kerrick
Kerrick / gist:2716568
Created May 17, 2012 05:08
HOWTO install Sublime Text 2 in Debian Squeeze
# Download Sublime Text 2 from http://www.sublimetext.com/2
# If you aren't root, sudo su
tar -xvjf Sublime\ Text\ 2*.tar.bz2
mv Sublime\ Text\ 2/ /opt/sublime-text-2/
ln -s /opt/sublime-text-2 /usr/local/sublime-text-2
ln -s /usr/local/sublime-text-2/sublime_text /usr/local/bin/sublime_text
rm Sublime\ Text\ 2*.tar.bz2
# Sublime Text 2 can now be run as normal user with command "sublime_text"
@Kerrick
Kerrick / gist:2839458
Created May 30, 2012 23:01
Override how rails computes asset tags to work in multi-server deployments via git commits
# Override how rails computes asset tags to work in multi-server deployments via git commits
module ActionView
module Helpers
module AssetTagHelper
def rails_asset_id(source)
if asset_id = ENV["RAILS_ASSET_ID"]
asset_id
else
if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])
@Kerrick
Kerrick / perl via bash
Created February 12, 2013 06:14
Convert ruby 1.8 style hashes (hashrockets) into ruby 1.9 style hashes (json-style) Source: http://robots.thoughtbot.com/post/17450269990/convert-ruby-1-8-to-1-9-hash-syntax
perl -pi -e 's/:([\w\d_]+)(\s*)=>/\1:/g' path/to/file.rb
@Kerrick
Kerrick / git-reauthor.sh
Created February 12, 2013 06:33
If you forgot to configure git with your email and username, you _may_ want to use the following shell script, customizing the email it searches for and the name and email it replaces them with to what you see in git log. Be careful! Heed the warnings from the source: https://help.github.com/articles/changing-author-info
#!/bin/sh
git filter-branch --env-filter '
an="$GIT_AUTHOR_NAME"
am="$GIT_AUTHOR_EMAIL"
cn="$GIT_COMMITTER_NAME"
cm="$GIT_COMMITTER_EMAIL"
if [ "$GIT_COMMITTER_EMAIL" = "kerrick@dirk-tooth.(none)" ]