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
parse_git_branch() { | |
git branch 2> /dev/null | sed -e '/^[^*]/d' -e 's/* \(.*\)/(\1)/' | |
} | |
PS1="\\[$(tput setaf 7)\\]\\w \$(parse_git_branch)> \\[$(tput sgr0)\\]" |
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 ruby | |
# Usage: gitio URL [CODE] | |
# | |
# Turns a github.com URL | |
# into a git.io URL | |
# | |
# Copies the git.io URL to your clipboard. | |
url = ARGV[0] | |
code = ARGV[1] |
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
# | |
# This is the base class | |
# for the classes below. | |
# Each class calls :register which | |
# saves its self into subclasses | |
# | |
# When the display method is called on | |
# the base class it loops through the collection | |
# insdie @@subclasses and if the instance method |
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
#config/initializers/form_builder.rb | |
class ActionView::Helpers::FormBuilder | |
alias :orig_label :label | |
def label(method, content_or_options = nil, options = nil, &block) | |
if content_or_options && content_or_options.class == Hash | |
options = content_or_options | |
else | |
content = content_or_options |
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
# 2 workers and 1 master | |
worker_processes 2 | |
# Load the app into the master before forking workers for fast worker spawn times | |
preload_app true | |
# Restart any workers that haven't responded in 30 seconds | |
timeout 30 | |
pid "/tmp/unicorn.my_site.pid" |
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
worker_processes 1; | |
user nobody nogroup; | |
pid /tmp/nginx.pid; | |
error_log /tmp/nginx.error.log; | |
events { | |
worker_connections 1024; # increase if you have lots of clients | |
# Set this to on if you have more than 1 working processes |
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
#The code in the rake task looks like this: | |
#lib/tasks/scheduler.rake | |
desc "Updates the images for winter conditions" | |
task :update_images => :environment do | |
puts "Updating Images" | |
WinterCondition.update_images | |
puts "Done Updating Images" | |
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
class State | |
#usage: | |
#State.new.state_by_abbreviation("WY") | |
#=> "Wyoming" | |
#State.new.abbreviation_by_state("Wyoming") | |
#=> "WY" | |
#State.new.abbreviations | |
#-Returns all abbreviations | |
#State.new.names | |
#-Returns all States Names |
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
# config/initializers/database_limits.rb | |
module ActiveRecord | |
module ConnectionAdapters | |
module DatabaseLimits | |
def index_name_length | |
#this is a monkey patch to get the ms sql db schema to work in sqlite. | |
#errors with the names in sql server being to long for sqlite cause of | |
#of the original 64 character limit. Switch it to 84 to allow the longer | |
#names. | |
84 |
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
<html> | |
<head> | |
<title>dug.js - Retriever dropdown</title> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap.min.css"> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/css/bootstrap-theme.min.css"> | |
<script src="https://code.jquery.com/jquery-2.1.3.min.js"></script> | |
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.3.0/css/font-awesome.min.css"> | |
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.2/js/bootstrap.min.js"></script> |
OlderNewer