Skip to content

Instantly share code, notes, and snippets.

@colingourlay
colingourlay / idle-analytics.js
Created September 7, 2016 07:41
Defer the standard Google Analytics script until the page is idle, in supported browsers.
(function(x,y,z){(x[y]&&x[y](z))||z()})(window,'requestIdleCallback',function(){
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-XXXXX-X', 'auto');
ga('send', 'pageview');
});
@joho
joho / staff_development.md
Created April 20, 2016 05:38
Follow on resources from a work talk I gave related to developing staff.
# Hello, and welcome to makefile basics.
#
# You will learn why `make` is so great, and why, despite its "weird" syntax,
# it is actually a highly expressive, efficient, and powerful way to build
# programs.
#
# Once you're done here, go to
# http://www.gnu.org/software/make/manual/make.html
# to learn SOOOO much more.
@jwalton
jwalton / RickshawGraph.md
Last active July 30, 2021 02:35
Rickshaw Graph is a drop in replacement for Dashing's graph

Graphing Widget

The graphing widget shows graphs using the Rickshaw graphing library. The names of data fields should be (vaguely) familiar if you've used Rickshaw before.

It's recommended that you replace the /assets/javascripts/rickshaw.min.js from your dashboard with the latest from here.

Supported HTML data fields

@dnagir
dnagir / readme.md
Created November 23, 2012 02:27
Unobtrusive and testable AJAX in Rails 3

The problem

Initially asked at RORO but I will elaborate with an example.

What we need to do is the following:

  • we list a set of items (let's say posts) and want to show a drop-down menu next to each one (quick example)
  • when the drop-down arrow is clicked the menu is loaded from the server.
@tommeier
tommeier / Rakefile
Created September 20, 2012 05:25
Rake Timer
require 'rake_timer'
@pda
pda / spec_helper.rb
Created March 14, 2012 06:23
Fast RSpec with a tiered environment: SPEC=(unit|model|full) rspec …
mode = ENV["SPEC"] || "full"
require_relative "spec_helper_#{mode}"
@bguthrie
bguthrie / notcode.md
Created December 16, 2011 03:22
A brief list of activities that do not produce code.

Thanks to @mipearson for his help in compiling this extremely serious and meaningful list.

  • Drawing Visio diagrams
  • Project management
  • Standards governance
  • Analyzing technical requirements
  • Attending meetings
  • Tweeting
  • Drinking
  • Writing gists
#!/bin/sh
set -u
set -e
# Example init script, this can be used with nginx, too,
# since nginx and unicorn accept the same signals
# Feel free to change any of the following variables for your app:
APP_ROOT=/home/deploy/public_html/rm/current
PID=$APP_ROOT/tmp/pids/unicorn.pid
ENV=production