This is purposefully ambitious and aspirational. Some concepts that are worth understanding in addition to the principles outlined here include:
Here’s a CodePen I’ll periodically update with the compiled CSS to use as a testing playground.
require 'mustache' | |
class Ranger < Mustache | |
self.template = <<-template | |
{{#range_0_to_10}} | |
<option value="{{i}}">{{i}}</option> | |
{{/range_0_to_10}} | |
template | |
def range(first, last) |
# coding: utf-8 | |
# chcp 65001 | |
require 'rubygems' | |
require 'hpricot' | |
require 'nokogiri' | |
require 'fileutils' | |
require 'yaml' | |
require 'time' | |
require 'pandoc-ruby' |
module Ruhoh::Views::Helpers | |
module Paginator | |
# current_page is set via a compiler or previewer | |
# in which it can discern what current_page to serve | |
def paginator | |
per_page = config["paginator"]["per_page"] rescue 5 | |
current_page = master.page_data['current_page'].to_i | |
current_page = current_page.zero? ? 1 : current_page | |
offset = (current_page-1)*per_page |
module SortablePaginator | |
# provides helpful metrics for the paginator and mustache templates | |
def paginator_data | |
per_page = config["paginator"]["per_page"] rescue 5 | |
paginator_sort = config["paginator"]["sort"] rescue 'desc' | |
current_page = master.page_data['current_page'].to_i | |
post_count = all.length | |
page_count = (post_count.to_f/per_page).ceil | |
if paginator_sort == 'asc' |
This is purposefully ambitious and aspirational. Some concepts that are worth understanding in addition to the principles outlined here include:
Here’s a CodePen I’ll periodically update with the compiled CSS to use as a testing playground.
=begin | |
Notes | |
===== | |
Labels: On the label you should put a "for" attribute if you're not using something like simple_form | |
This helps capybara to find your field | |
e.g. <label for="my_field_id">Some label</label> | |
=end | |
field = "Label on my field" | |
value = "existing option in list" |
This is now a Bower package: [gist-async]. [gist-async]: https://github.com/razor-x/gist-async
Requires jQuery.
Jekyll plugin included that modifies the gist markup added by its gist Liquid tag.
Load GitHub Gists asynchronously and optionally specify which file to show.
# lib/capistrano/tasks/config_files.cap | |
# | |
# Capistrano task to upload configuration files outside SCM | |
# Jesus Burgos Macia | |
# | |
# This allows us to have server's config files isolated from development ones. | |
# That's useful for several reasons, but the most important is that you can | |
# ignore files from repository. | |
# | |
# The task will upload all files found in |
def select_from_chosen(item_text, options) | |
field = find_field(options[:from]) | |
option_value = page.evaluate_script("$(\"##{field[:id]} option:contains('#{item_text}')\").val()") | |
page.execute_script("$('##{field[:id]}').val('#{option_value}')") | |
end |
On the Refinery29 Mobile Web Team, codenamed "Bicycle", all of our unit tests are written using Jasmine, an awesome BDD library written by Pivotal Labs. We recently switched how we set up data for tests from declaring and assigning to closures, to assigning properties to each test case's this
object, and we've seen some awesome benefits from doing such.
Up until recently, a typical unit test for us looked something like this:
describe('views.Card', function() {