Skip to content

Instantly share code, notes, and snippets.

View tcmacdonald's full-sized avatar
🪕

Taylor MacDonald tcmacdonald

🪕
  • Ample
  • Cincinnati, OH
View GitHub Profile
@tcmacdonald
tcmacdonald / front_matter.rb
Created October 30, 2012 14:54
Pulling front matter from Rails views template.
require 'active_support/concern'
module FrontMatter
extend ActiveSupport::Concern
included do
helper_method :front_matter
end
def front_matter
if has("gui_macvim")
macmenu &File.New\ Tab key=<nop>
map <D-t> :CommandT<CR>
endif
# Adapted from Frank:
# https://github.com/blahed/frank/
# Copyright (c) 2010 Travis Dunn
#
# Permission is hereby granted, free of charge, to any person
# obtaining a copy of this software and associated documentation
# files (the "Software"), to deal in the Software without
# restriction, including without limitation the rights to use,
# copy, modify, merge, publish, distribute, sublicense, and/or sell
@tcmacdonald
tcmacdonald / jsbin.ikowub.css
Created August 7, 2013 14:17
Responsive SVG Charts
.chart{
width: 100%;
height: 100px;
overflow: hidden;
}
.chart_icon{
position: absolute;
font-size: 25px;
right: 5px;
@tcmacdonald
tcmacdonald / conditions.js.coffee
Created September 23, 2013 17:40
Conditions provides a simple API for conditional JS behaviors. This allows a developer to show or hide certain sections of a stepped-form based on the user's response in previous sections. For every condition, a session cookie is set providing very basic persistance of control-flow for clients.
# **Conditions** provides a simple API for conditional behaviors within the <a href="/docs/form.js.html">Form</a> class. This allows a developer to show or hide certain sections of a stepped-form based on the user's response in previous sections.
# For every condition, a session cookie is set providing very basic persistance of control-flow for clients.
# ### Usage
# Every action item (button, link) that carries a condition must define the following attributes...
#
# <pre>
# data-condition="#target_selector"
# data-conditional-group="some_group"
@tcmacdonald
tcmacdonald / poltergeist.rb
Created April 21, 2014 13:43
Poltergeist sliencer
module Capybara::Poltergeist
class Client
private
def redirect_stdout
prev = STDOUT.dup
prev.autoclose = false
$stdout = @write_io
STDOUT.reopen(@write_io)
# MySQL. Versions 4.1 and 5.0 are recommended.
#
# Install the MySQL driver:
# gem install mysql2
#
# And be sure to use new-style password hashing:
# http://dev.mysql.com/doc/refman/5.0/en/old-client.html
development:
adapter: mysql2
encoding: utf8

Keybase proof

I hereby claim:

  • I am tcmacdonald on github.
  • I am tcmacdonald (https://keybase.io/tcmacdonald) on keybase.
  • I have a public key whose fingerprint is 8364 00E2 13F8 F969 6EC1 D875 8D50 EB66 1F9A 781E

To claim this, I am signing this object:

--
-- open currently active Chrome tab with Safari
-- forked from https://gist.github.com/3151932 and https://gist.github.com/3153606
--
property theURL : ""
tell application "Google Chrome"
set theURL to URL of active tab of window 0
end tell
if appIsRunning("Safari") then