Skip to content

Instantly share code, notes, and snippets.

# supervisor
#
# Author: Günter Grodotzki <[email protected]>
# Version: 2015-04-25
#
# set param "SUPERVISE=enable" to activate
#
packages:
yum:
python27-setuptools: []
// Refer to https://gist.github.com/remy/350433
try {
// Test webstorage existence.
if (!window.localStorage || !window.sessionStorage) throw "exception";
// Test webstorage accessibility - Needed for Safari private browsing.
localStorage.setItem('storage_test', 1);
localStorage.removeItem('storage_test');
} catch(e) {
(function () {
var Storage = function (type) {
@forest
forest / Gemfile
Last active August 29, 2015 14:02
SauceLabs Spec Helper
gem 'sauce', group: [:development, :sauce]
group :sauce do
gem 'rspec'
gem 'rspec-instafail'
gem 'capybara'
# gem 'parallel_tests'
gem 'ci_reporter'
gem 'sauce-connect'
end
@forest
forest / teaching_ruby_objects_first.rb
Created May 8, 2014 18:40
Sugar-Free Ruby: An Experiment in Object-first Teaching
# http://www.confreaks.com/videos/1112-gogaruco2012-sugar-free-ruby-an-experiment-in-object-first-teaching
# https://github.com/simeonwillbanks/gogaruco2012/blob/master/02_Sugar-Free_Ruby:_An_Experiment_in_Object-first_Teaching.md
# Everything is an Object.
5 # => 5
42.0 # => 42.0
"Hello!" # => Hello!
[1, 2, 3] # => [1, 2, 3]
@forest
forest / google_form.js
Last active August 29, 2015 13:56
Google Forms Integration with Constant Contact API
/**
* A trigger-driven function that adds the user to Constant Contact lists.
*
* @param {Object} e The event parameter for form submission to a spreadsheet;
* see https://developers.google.com/apps-script/understanding_events
*/
function onFormSubmit(e) {
Logger.log('onFormSubmit');
try {
@forest
forest / gist:6596698
Created September 17, 2013 16:21
how to exclude essays by tag in Koken
<koken:load source="essays" limit="5" filter:page="{{ location.parameters.page }}">
<koken:loop>
<koken:has_tag title="site-data">
<koken:else>
<article>
<koken:include file="inc/article.html" />
</article>
</koken:has_tag>
</koken:loop>
</koken:load>
@forest
forest / rights.rb
Last active December 21, 2015 04:48
Use OO instead of basic ruby types to represent Rights
ALL_RIGHTS = [
CAN_ACCESS_RESOURCES,
CAN_ACCESS_ORGANIZATIONS,
CAN_CREATE_ORGANIZATIONS,
CAN_ACCESS_SCHOOL_EDITION
]
# ---------------------------
@forest
forest / natcmp.rb
Created July 17, 2013 18:58
Natural order comparison of two strings
# natcmp.rb
#
# Natural order comparison of two strings
# e.g. "my_prog_v1.1.0" < "my_prog_v1.2.0" < "my_prog_v1.10.0"
# which does not follow alphabetically
#
# Based on Martin Pool's "Natural Order String Comparison" originally written in C
# http://sourcefrog.net/projects/natsort/
#
# This implementation is Copyright (C) 2003 by Alan Davies
@forest
forest / deliver_stories
Created November 9, 2012 18:48
A script to connect to tracker, look for finished stories, grep the git log, and mark the finished ones as delivered. #jenkins #pivotal-tracker
#!/usr/bin/env ruby
# gem 'pivotal-tracker'
require 'pivotal-tracker'
TRACKER_TOKEN = "..."
TRACKER_PROJECT_ID = "..."
PivotalTracker::Client.token = TRACKER_TOKEN
PivotalTracker::Client.use_ssl = true
@forest
forest / deliver_stories
Created November 9, 2012 18:48
A script to connect to tracker, look for finished stories, grep the git log, and mark the finished ones as delivered
#!/usr/bin/env ruby
# gem 'pivotal-tracker'
require 'pivotal-tracker'
TRACKER_TOKEN = "..."
TRACKER_PROJECT_ID = "..."
PivotalTracker::Client.token = TRACKER_TOKEN
PivotalTracker::Client.use_ssl = true