Skip to content

Instantly share code, notes, and snippets.

Avatar

Michael Pearson mipearson

View GitHub Profile
@colingourlay
colingourlay / idle-analytics.js
Created Sep 7, 2016
Defer the standard Google Analytics script until the page is idle, in supported browsers.
View idle-analytics.js
(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 Apr 20, 2016
Follow on resources from a work talk I gave related to developing staff.
View Makefile
# 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 Sep 18, 2020
Rickshaw Graph is a drop in replacement for Dashing's graph
View RickshawGraph.md

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 Nov 23, 2012
Unobtrusive and testable AJAX in Rails 3
View readme.md

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.
View Rakefile
require 'rake_timer'
@pda
pda / spec_helper.rb
Created Mar 14, 2012
Fast RSpec with a tiered environment: SPEC=(unit|model|full) rspec …
View spec_helper.rb
mode = ENV["SPEC"] || "full"
require_relative "spec_helper_#{mode}"
@bguthrie
bguthrie / notcode.md
Created Dec 16, 2011
A brief list of activities that do not produce code.
View notcode.md

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
View gist:308216
#!/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
You can’t perform that action at this time.