Skip to content

Instantly share code, notes, and snippets.

View mattfreer's full-sized avatar

Matt Freer mattfreer

View GitHub Profile
@mattfreer
mattfreer / width-by-sibling-count.scss
Created December 12, 2012 10:08
Applies width property to siblings conditionally. Width is applied if the number of siblings matches the supplied sibling-count. This allows developers to set different widths based on the number of siblings. If $sibling-count matches the number-of-siblings then all siblings will be set to an equal percentage width, with a combinded total width …
// @param $sibling-selector: selector to target siblings (e.g. h5 | ".simple-filed")
// @param $sibling-count: the number of siblings that must exist in order for these widths to be applied
// @param $fixed-widths: optional keyword argument, list of fixed (percentage) widths to be applied to
// the first-n siblings (e.g. $fixed-widths: 40 30)
//
// Usage:
// h5 {
// @include width-by-sibling-count(h5, 4, $fixed-widths: 55);
// @include width-by-sibling-count(h5, 5, $fixed-widths: 40);
//}
docker run -rm -t -i -v $(dirname $SSH_AUTH_SOCK):$(dirname $SSH_AUTH_SOCK) -e SSH_AUTH_SOCK=$SSH_AUTH_SOCK ubuntu /bin/bash
# http://stackoverflow.com/questions/5108876/kill-a-postgresql-session-connection
namespace :db do
desc "Fix 'database is being accessed by other users'"
task :terminate => :environment do
ActiveRecord::Base.connection.execute <<-SQL
SELECT
pg_terminate_backend(pid)
FROM
pg_stat_activity
WHERE
@mattfreer
mattfreer / bad_template.eex
Last active October 12, 2015 07:48
Since upgrading to Elixir 1.1 and Eralang 18, I'm noticing that Dialyzer has some issues with String interpolation. This Gist demonstrates an issue with EEx templates that map over a list of Strings
<%= Enum.map arbitrary_list, fn(item) -> %>
<%= item %>
<%= end %>