Skip to content

Instantly share code, notes, and snippets.

# Convert string keys to symbols for a hash
class Hash
def symbolize_keys
self.replace(self.inject({}) { |h,(k,v)| h[k.to_sym] = v; h })
end
end
@tschmidt
tschmidt / Prompt (ZSH)
Created October 24, 2010 06:59
Prompt
PROMPT='%{$fg[cyan]%}%c $(rvm_prompt_info) %{$fg_bold[blue]%}$(git_prompt_info)%{$fg_bold[blue]%} % %{$reset_color%}
%{$fg_bold[red]%}➜ %{$reset_color%}'
@tschmidt
tschmidt / CSS3_Clock.html
Created January 14, 2011 17:25
A clock made using CSS3 techniques and a little bit of JS
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>CSS 3 clock face</title>
<style type='text/css'>
* {
margin: 0;
padding: 0;
@tschmidt
tschmidt / 3d_text_with_css.html
Created January 21, 2011 22:25
3D Text using only CSS...that means no images. At all. Period.
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>3D Text</title>
<style>
body {
background-color: #11a9e2;
@tschmidt
tschmidt / dock_spacer.txt
Created February 3, 2011 18:21
Command to add dock spacers to OS X dock
> defaults write com.apple.dock persistent-apps -array-add '{tile-data={}; tile-type=“spacer-tile”;}’
> killall Dock
var myCountdown = (function () {
var index;
function log() {
console.log(index)
}
function iterate() {
log();
if(index>1) setTimeout(iterate, 1000);
var Person = function (name) {
this.name = name;
}
Person.prototype.getName = function () {
console.log(this.name);
}
var thomas = new Person("Thomas");
var amy = new Person("Amy")
// Answer 1
document.getElementById('the_div').addEventListener(
'click', function(){ log('the_div!') }, true);
document.getElementById('the_list').addEventListener(
'click', function(){ log('the_list!') }, false);
document.getElementById('the_item').addEventListener(
'click', function(){ log('the_item!') }, false);
@tschmidt
tschmidt / Rails simple_format and auto_link.rb
Created July 14, 2011 21:12
Rails simple_format and auto_link weirdness
@tschmidt
tschmidt / my_git_workflow.txt
Created April 3, 2012 21:38
My Git Workflow (TL;DR version)
First Steps
========================================================================================
# Initialize git in a project
git init
# add and commit any existing files
git add .
git commit -m "Initial commit"
# associate with a remote repository