This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# I made this gist to build my shell prompt based in various references on the web | |
# I will try to list the most of references, but sorry if I not put your here - | |
# http://henrik.nyh.se/2008/12/git-dirty-prompt (GIT) | |
# GIT | |
function parse_git_dirty { | |
[[ $(git status 2> /dev/null | tail -n1) != "nothing to commit (working directory clean)" ]] && echo "*" | |
} | |
function parse_git_branch { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# This file echoes a bunch of color codes to the | |
# terminal to demonstrate what is available. Each | |
# line is the color code of one foreground color, | |
# out of 17 (default + 16 escapes), followed by a | |
# test use of that color on all nine background | |
# colors (default + 8 escapes). | |
# | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#model (idea 100% stolen from ryanb) | |
def author_tokens=(ids) | |
ids.gsub!(/CREATE_(.+?)_END/) do | |
Author.create!(:name => $1).id | |
end | |
self.author_ids = ids.split(",") | |
end | |
# jquery.tokeninput.js |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Usage | |
# body { | |
# background: url(asset_path('background.png')) #FFFFFF; | |
# } | |
module Sass::Script::Functions | |
include Sprockets::Helpers::RailsHelper | |
def asset_path(path) | |
assert_type path, :String | |
Sass::Script::String.new(super(path.value), :string) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python | |
"""Command line script to convert a file, usually an image, into a data URI | |
for use on the web.""" | |
import base64 | |
import mimetypes | |
import os | |
import sys | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<ifmodule mod_deflate.c> | |
AddOutputFilterByType DEFLATE text/text text/html text/plain text/xml text/css application/x-javascript application/javascript | |
</ifmodule> | |
<IfModule mod_expires.c> | |
ExpiresActive On | |
ExpiresByType text/html M3600 | |
ExpiresByType text/css M3600 | |
ExpiresByType application/javascript M3600 | |
ExpiresByType image/bmp M3600 | |
ExpiresByType image/gif M3600 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# set up git and perform initial commit | |
git :init | |
append_file '.gitignore' do | |
<<-EOS | |
*.rbc | |
*.sassc | |
.sass-cache |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(function($){ | |
$('.pagination a[data-remote=true]').live('ajax:success', function(e){ window.history.pushState('', '', $(e.target).attr('href')) }) | |
$(window).bind('popstate', function(){ $.ajax({url:window.location, dataType:'script'}) ; return true }); | |
})(jQuery); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# modify from veewee | |
require 'digest/md5' | |
CURRENT_DIR = File.dirname(__FILE__) | |
PRESEED_MD5 = "#{Digest::MD5.file("#{CURRENT_DIR}/preseed.cfg").hexdigest}" | |
Veewee::Session.declare( { | |
:boot_cmd_sequence => [ | |
"<Esc><Esc><Enter>", | |
"/install/vmlinuz ", | |
"noapic ", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#### | |
# Split MySQL dump SQL file into one file per table | |
# based on http://blog.tty.nl/2011/12/28/splitting-a-database-dump | |
#### | |
if [ $# -lt 1 ] ; then | |
echo "USAGE $0 DUMP_FILE [TABLE]" | |
exit |
OlderNewer