This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); }, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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'" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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('|')})'/ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @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; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| @mixin inline-grid($object, $width, $gutter: 30px) { | |
| font-size: 0; | |
| .#{$object}s { | |
| margin-right: -$gutter; | |
| } | |
| .#{$object} { | |
| @include text; | |
| display: inline-block; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| .posts { | |
| @include whitespacefix; | |
| @include c6; | |
| @include nogutters; | |
| .post { | |
| @include inlineblock; | |
| @include c2; | |
| @include regular; | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| $ 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] |