Skip to content

Instantly share code, notes, and snippets.

View bratsche's full-sized avatar

Cody Russell bratsche

View GitHub Profile
@bratsche
bratsche / gist:2645575
Created May 9, 2012 15:32
sass mixin for adding arrows to a div
$defaultBorder: none
=arrow($direction, $size, $color, $border: $defaultBorder)
position: relative
border: $border
&:after, &:before
@if $direction == top
bottom: 100%
@else if $direction == right
@bratsche
bratsche / gist:2323633
Created April 6, 2012 22:40
Get implementations
List<T> GetInstances<T>()
{
return (from t in Assembly.GetExecutingAssembly().GetTypes()
where t.GetInterfaces().Contains(typeof (T)) && t.GetConstructor(Type.EmptyTypes) != null
select (T) Activator.CreateInstance(t)).ToList();
}
@bratsche
bratsche / fix-postgres-seqs.rb
Last active September 30, 2015 11:37
Fix up broken id seqs on Postgres after migrating from MySQL using ar_dbcopy gem
require 'pg'
unless ARGV[0]
puts "Pass the name of the database"
exit 1
end
# Get our Postgres connection
conn = PGconn.open(:dbname => ARGV[0], :host => 'localhost')