Skip to content

Instantly share code, notes, and snippets.

View blamattina's full-sized avatar

blamattina blamattina

  • HubSpot
  • Boston, Ma
View GitHub Profile
define [
'underscore'
], (_) ->
Object.defineProperty Error.prototype, 'toJSON',
configurable: true
value: ->
json = {}
Object.getOwnPropertyNames(this).forEach (prop) =>
if this[prop] instanceof Error
@blamattina
blamattina / .tmux.conf.local
Last active August 29, 2015 13:58
Customizations to thoughtbot/dotfiles
set-option -g default-command "reattach-to-user-namespace -l zsh"
# Use vim bindings to navigate
bind -n C-h run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-h) || tmux select-pane -L"
bind -n C-j run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-j) || tmux select-pane -D"
bind -n C-k run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-k) || tmux select-pane -U"
bind -n C-l run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys C-l) || tmux select-pane -R"
bind -n C-\ run "(tmux display-message -p '#{pane_current_command}' | grep -iq vim && tmux send-keys 'C-\\') || tmux select-pane -l"
@blamattina
blamattina / settings.py
Last active December 17, 2015 16:09
debug logging settings for django
if DEBUG:
# will output to your console
logging.basicConfig(
level = logging.DEBUG,
format = '%(asctime)s %(levelname)s %(message)s',
)
## in rating.rb
# not the best method name..
# call it with name.rat1.display_rating
def display_rating
read_attribute(:rating).presence || "N/A"
end
@blamattina
blamattina / gist:2860540
Created June 2, 2012 23:48
helper method to create modals with twitter bootstrap
# use on its own
<%= create_modal("modal","Modal Header", render("modal")) %>
# or as part of another helper
def modal_link_with_modal
modal_id = "modal"
link_to("Modal", "##{modal_id}", :data => { :toggle => "modal" }) +
create_modal(modal_id, "Modal Header", render("modal"), true)
end