Skip to content

Instantly share code, notes, and snippets.

@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 / 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 / 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 / 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
// 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) {
# supervisor
#
# Author: Günter Grodotzki <gunter@grodotzki.co.za>
# Version: 2015-04-25
#
# set param "SUPERVISE=enable" to activate
#
packages:
yum:
python27-setuptools: []
@forest
forest / create_koken.sh
Last active January 18, 2016 20:54 — forked from bradleyboy/create_koken.sh
Docker script for Koken
#!/bin/bash
echo ""
# Root check
if [[ "$UID" -ne 0 ]]; then
echo "!! This script requires root privileges. sudo ./create_koken.sh"
echo ""
exit
fi
@forest
forest / nullify_blank.rb
Created February 13, 2016 21:15
nullify_blank.rb
module Virtus
class Attribute
# Attribute extension which nullifies blank attributes when coercion failed
#
module NullifyBlank
# @see [Attribute#coerce]
#
# @api public
diff --git i/lib/virtus/dirty_attribute.rb w/lib/virtus/dirty_attribute.rb
index 3854a36..13c20a3 100644
--- i/lib/virtus/dirty_attribute.rb
+++ w/lib/virtus/dirty_attribute.rb
@@ -16,7 +16,7 @@ module Virtus
def _create_writer_with_dirty_tracking(name)
class_eval <<-RUBY, __FILE__, __LINE__ + 1
def #{name}=(new_regular_object)
- prev_object = #{name}
+ prev_object = instance_variable_get(:@#{name})
@forest
forest / git-workflow.md
Created February 22, 2016 18:15
Git Feature Branch Workflow

We subscribe to the Git Featrue Branch workflow, briefly described in that link.

In practice, it works as follows:

FEATURE DEVELOPMENT

Steps to Follow:

  1. Start with an updated local development branch -- by checking out the dev branch and pulling changes:
    git checkout development
    git pull origin development