Skip to content

Instantly share code, notes, and snippets.

@bobbrez
bobbrez / .bashrc
Created April 12, 2011 01:25 — 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)]/"
ActiveRecord::Schema.define(:version => 20110514135759) do
create_table "beers", :force => true do |t|
t.string "name"
t.string "brewery"
t.float "abv"
t.text "description"
t.string "image_url"
t.datetime "created_at"
t.datetime "updated_at"
@bobbrez
bobbrez / gist:993344
Created May 26, 2011 15:15
MySQL on OS X using Homebrew

Change Permissions

You'll need to change the permissions for /usr/local for your local user.

sudo chown -R whoami /usr/local

Homebrew

The easiest way to get everything setup is to use Homebrew. To do this, you'll need to first install XCode from the standard XCode from Apple Developer site. Afterwards you can just install Homebrew though its normal installation

ruby -e "$(curl -fsSLk https://gist.github.com/raw/323731/install_homebrew.rb)"

@bobbrez
bobbrez / address.rb
Created September 28, 2011 19:24 — forked from galiat/gist:1248941
class Address < ActiveRecord::Base
belongs_to :contact
validates_presence_of :street, :town
end
@bobbrez
bobbrez / .gitconfig
Created October 24, 2011 00:16
My GitConfig
[user]
name = Bob Breznak
email = [email protected]
[alias]
co = checkout
st = status
ci = commit
com = commit
di = diff
@bobbrez
bobbrez / gist:2228387
Created March 28, 2012 17:20
Javascript Question

So you have a document like this:

<!DOCTYPE html>
<html>
  <head></head>
  <body>
    <textarea id="myText"></textarea>
  </body>
</html>
@bobbrez
bobbrez / json-table.rb
Last active December 14, 2015 15:58
Simple script to read json and output a table.
#!/usr/bin/env ruby
require 'rubygems'
require 'terminal-table'
require 'json'
require 'hashie'
require 'csv'
data = Hashie::Mash.new JSON.parse(ARGF.read)
CSV.open('uvr.csv', 'w') do |csv|
// This is a manifest file that'll be compiled into application.js, which will include all the files
// listed below.
//
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
// or vendor/assets/javascripts of plugins, if any, can be referenced here using a relative path.
//
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
// compiled file.
//
// WARNING: THE FIRST BLANK LINE MARKS THE END OF WHAT'S TO BE PROCESSED, ANY BLANK LINE SHOULD
@bobbrez
bobbrez / timestamp.cpp
Created August 23, 2013 13:50
C++ for Scott
#include <stdio.h> // for sprintf()
#include <iostream> // for console output
#include <string> // for std::string
#include <ctime>
using namespace std;
int main(int argc, const char * argv[])
@bobbrez
bobbrez / gist:6678139
Created September 23, 2013 22:56
How to do rendering from a model
Don't do this unless you need to.... its kinda punching MVC in the face.