Skip to content

Instantly share code, notes, and snippets.

View jackjennings's full-sized avatar
⛰️

Jack Jennings jackjennings

⛰️
View GitHub Profile
@jackjennings
jackjennings / clock.js
Last active August 29, 2015 14:14
Bacon.Clock
var Bacon = require('baconjs');
var pad = require('./pad');
module.exports = function(interval) {
interval = interval || 500;
var get = {
date: function(event) { return new Date(); },
hour: function(date) { return date.getHours(); },
minute: function(date) { return date.getMinutes(); },
var el = $('.foo');
var clicks = el.asEventStream('click');
var active = clicks.flatMapLatest(function() {
return Bacon.once(true).merge(Bacon.later(1000, false));
}).toProperty(false);
active.assign(el, 'toggleClass', 'active');
after_bundle do
# Create the database and basic tables
rake "db:create"
rake "db:migrate"
# Create the git repository
git :init
git add: '--all'
git commit: "-m 'Initial commit'"
def ask_with_default message, default
result = ask "#{message} [#{default}]"
result.blank? ? default : result
end
# Lock ruby version (default to current ruby version)
ruby_version = ask_with_default "Ruby version:", RUBY_VERSION
file ".ruby-version", ruby_version
# Specify gemset name (default to app name)
def cap_install!
log :capify, ""
in_root do
run("#{extify(:cap)} install", verbose: false)
end
end
def include_cap_modules(cap_modules)
escaped_modules = cap_modules.map(&Regexp.method(:escape))
matcher = /require 'capistrano\/(#{escaped_modules.join('|')})'/
@include archive(exhibition) {
@include and-card(regular-archive) {
@include full-width;
@include meta-margin-small;
@include float-grid(post, 33%);
@include green-background;
@extend %expandable-archive;
.posts {
@include animated-height;
@mixin inline-grid($object, $width, $gutter: 30px) {
font-size: 0;
.#{$object}s {
margin-right: -$gutter;
}
.#{$object} {
@include text;
display: inline-block;
@jackjennings
jackjennings / posts.scss
Last active August 29, 2015 14:22 — forked from briansw/posts.scss
.posts {
@include whitespacefix;
@include c6;
@include nogutters;
.post {
@include inlineblock;
@include c2;
@include regular;
}
class NewsItemsController < ApplicationController
include Dateable
has_scope :page, default: 1
has_scope :year
def index
@year_range = NewsItem.year_range
@records = apply_scopes(default_scope)
$ cutest dig.rb
.
test: should get remaining segments from ReturnsSegmentsDigger
line: assert_equal ['two', 0], data.dig('one', 'two', 0)
file: dig.rb +53
Cutest::AssertionFailed: ["two", 0] != [0]