This file contains hidden or 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
// @roberocity | |
// this is the minimum to do to provide html5 element support for older versions of IE | |
for(i in k='abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|subline|summary|time|video'.split('|')){document.createElement(k[i]);} | |
// a better solution may be by @rem, @jon_neal & @aFarkas, but I've had a few errors when printing using this: http://html5shim.googlecode.com/svn/trunk/html5.js |
This file contains hidden or 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
class Config | |
attr_reader :data, :env | |
def self.config_path | |
File.join('config') | |
end | |
def initialize(opts) | |
@env = opts[:env] | |
filename = opts[:filename] |
This file contains hidden or 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($) { | |
$.fn.equalizeHeight = function(minHeight, maxHeight) { | |
tallest = (minHeight) ? minHeight : 0; | |
this.each(function() { | |
if($(this).height() > tallest) { | |
tallest = $(this).height(); | |
} | |
}); | |
if((maxHeight) && tallest > maxHeight) tallest = maxHeight; | |
return this.each(function() { |
This file contains hidden or 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
# base 36 | |
# 12 character long random string | |
rand(36**12).to_s(36) |
This file contains hidden or 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
// Sattolo's algorithm as an extention method of Array | |
public static T[] Shuffle<T>(this T[] array) | |
{ | |
var random_generator = new Random(DateTime.Now.Millisecond); | |
int i = array.Length-1; | |
while (i > 1) | |
{ | |
i--; | |
int j = random_generator.Next(i); |
This file contains hidden or 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
ssh username@host "echo `cat ~/.ssh/id_rsa.pub` >> ~/.ssh/authorized_keys" |
This file contains hidden or 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
echo "Setting up the server with initial packages, etc." | |
echo "This should be done as sudo." | |
echo "-------" | |
echo "Upate and Upgrade existing packages. Install basic packages." | |
# initial server setup | |
apt-get update | |
apt-get -y upgrade | |
apt-get -y install build-essential zlib1g-dev libssl-dev libreadline5-dev libpcre3-dev git-core libxml2 libxml2-dev libxslt-dev |
This file contains hidden or 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 zsh | |
#local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})" | |
setopt promptsubst | |
autoload -U add-zsh-hook | |
PROMPT_SUCCESS_COLOR=$FG[117] | |
PROMPT_FAILURE_COLOR=$FG[124] | |
PROMPT_VCS_INFO_COLOR=$FG[242] |
This file contains hidden or 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( $ ) { | |
$.fn.maxHeight = function() { | |
var max = 0; | |
this.each(function() { | |
max = Math.max(max, $(this).height() ); | |
}); | |
return max; | |
}; | |
$.fn.equalizeHeight = function() { |
This file contains hidden or 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
require 'sinatra/base' | |
require 'time' | |
class GitHook < Sinatra::Base | |
def self.parse_git | |
# Parse hash and date from the git log command | |
sha1, date = `git log HEAD~1..HEAD --pretty=format:%h^%ci`.strip.split('^') | |
set :commit_hash, sha1 | |
set :commit_date, Time.parse(date) |
OlderNewer