Skip to content

Instantly share code, notes, and snippets.

View averyvery's full-sized avatar

Doug Avery averyvery

View GitHub Profile
// better describe() method that nests your describe blocks
// if you pass it a string with slashes
(function() {
var recursiveNestedDescribe = function(title, callback) {
var titleChunk = title.shift();
if (title.length === 0) {
describe(titleChunk, callback);
} else {
describe('/' + titleChunk, function() {
#!/usr/bin/env ruby
# coding: utf-8
require 'pbcopy'
project_data = File.read('projects.csv')
hours_data = File.read('hours.csv')
projects = project_data.split(/\n/)
projects.shift
// Macro: "data-track-gtm - get from element"
// Returns: Boolean - does this element, or one of its parents, have a data-track-gtm attribute?
function() {
var isSet = function(val) {
return val !== null && val !== '';
};
var el = {{element}};
var val = el.getAttribute('data-track-gtm');
while (el && el !== document.body && !isSet(val)) {
@averyvery
averyvery / resize_mobile_images.rb
Created February 20, 2013 21:48
Save resized copies of retina images at regular size.
require 'rmagick'
source = ARGV[0]
Dir.glob('images/' + source + '/*.*').each do |retina_path|
mobile_path = retina_path.sub(/retina/, 'normal')
retina_file = File.new(retina_path)
mobile_file = File.new(mobile_path) if File.exist?(mobile_path)
.shureicons-font {
font-family: 'shureicons';
-webkit-font-smoothing: subpixel-antialiased;
}
@mixin logo($height) {
@include box-sizing(border-box);
display: block;
height: $height;
padding-top: $height;
@averyvery
averyvery / workflow.textile
Created October 11, 2012 20:04
workflow.textile

Viget’s EE Development Workflow

Goals

  • Optimize for local-first development
  • Manage and sync multiple instances of an EE site
  • Deploy from git
  • Work from files, not the DB, wherever possible

EE’s database

<!doctype html>
<html>
<head>
<title>Easy GA debugging - to test, add ?ga_debug to the URL</title>
<script>
var _gaq = _gaq || [];
var _ga_debug = window.location.href.indexOf('ga_debug') !== -1;
_gaq.push(['_setAccount', 'UA-00000000-1']);
_gaq.push(['_trackPageview']);
@averyvery
averyvery / gistdeck.md
Created July 27, 2012 18:41
GistDeck example

Crafting a presentation can be difficult

Too many tools

tools

@averyvery
averyvery / Gemfile
Created July 5, 2012 16:14
Gemfile
source 'http://rubygems.org'
# Compiling
gem 'compass'
gem 'compass-growl'
# Guard
gem 'guard'
gem 'guard-compass'
gem 'guard-livereload'
gem 'guard-process'
@averyvery
averyvery / Guardfile
Created July 3, 2012 21:05
Guarding with Juicer
guard 'process', :name => 'minify-screen-js', :command => 'juicer merge js/all.js -o js/all.min.js --force -s' do
watch /^js\/brianregan\/screen.js/
end