In your Gemfile:
gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git'
In your views:
= accordion do |accordion|
= accordion.pane 'My first pane' do
| /* | |
| * Random-Number Utilities (randutil) | |
| * Addresses common issues with C++11 random number generation. | |
| * Makes good seeding easier, and makes using RNGs easy while retaining | |
| * all the power. | |
| * | |
| * The MIT License (MIT) | |
| * | |
| * Copyright (c) 2015-2022 Melissa E. O'Neill | |
| * |
| // | |
| // From GoingNative 2013 "Inheritance is the Base Class of Evil" talk. | |
| // | |
| #include <memory> | |
| #include <iostream> | |
| #include <vector> | |
| #include <cassert> | |
| using namespace std; |
| # Terminal Progress Indicators. Four examples are included: percentage, | |
| # spinner, progress bar, and combined. This script has been tested on | |
| # Mac OS X 10.8 with Ruby 1.8.7, 1.9.1, 1.9.2, and 1.9.3 | |
| class Spinner | |
| include Enumerable | |
| def each | |
| loop do | |
| yield '|' | |
| yield '/' |
In your Gemfile:
gem 'bootstrap-components-helpers', :git => 'git://gist.github.com/2117187.git'
In your views:
= accordion do |accordion|
= accordion.pane 'My first pane' do
| source "https://rubygems.org" | |
| gem 'sprockets' | |
| gem 'sprockets-sass' | |
| gem 'sass' | |
| gem 'compass' | |
| gem 'bootstrap-sass' | |
| gem 'handlebars_assets' | |
| gem 'coffee-script' |
| # Renders an ItemContainer as a <ul> element and its containing items as <li> elements. | |
| # Prepared to use inside the topbar of Twitter Bootstrap http://twitter.github.com/bootstrap/#navigation | |
| # | |
| # Register the renderer and use following code in your view: | |
| # render_navigation(level: 1..2, renderer: :bootstrap_topbar_list, expand_all: true) | |
| class BootstrapTopbarList < SimpleNavigation::Renderer::Base | |
| def render(item_container) | |
| if options[:is_subnavigation] | |
| ul_class = "dropdown-menu" |
| class ApplicationDecorator < Draper::Base | |
| # See +ApplicationDecorator.humanize+ | |
| def humanize(attribute, key = model.send(attribute), default = key.to_s.humanize) | |
| self.class.humanize attribute, key, default | |
| end | |
| # By default, humanize the attributes listed. | |
| # | |
| # Contrived Example: |
| # ref: http://bit.ly/fN2ep8 | |
| # http://twitpic.com/3rr8dk | |
| def sass_colors | |
| engine= Sass::Engine.new(File.read("app/stylesheets/_colors.scss"), :syntax => :scss, :load_paths => ["app/stylesheets"]) | |
| environment= Sass::Environment.new | |
| engine.to_tree.children.each do | node | | |
| next unless node.kind_of? Sass::Tree::VariableNode | |
| node.perform environment | |
| end |
| $contrasted-default-dark: #000; | |
| $contrasted-default-light: #fff; | |
| @mixin contrasted($bg, $dark:$contrasted-default-dark, $light:$contrasted-default-light){ | |
| background-color: $bg; | |
| color: get_contrast_yiq($bg, $dark, $light); | |
| } |