brew install cmake
brew install python
sudo easy_install pip
Add powerline bin to your path. In your zshrc file (or the paths files sourced in zshrc) add the following line
PATH="/usr/local/share/python/:$PATH"
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
##Introduction
One definition of unit testing is the process of taking the smallest piece of testable code in an application, isolating it from the remainder of your codebase and determining if it behaves exactly as expected. In this section, we'll be taking a look at how to unit test Backbone applications using a popular JavaScript testing framework called Jasmine from Pivotal Labs.
For an application to be considered 'well'-tested, distinct functionality should ideally have its own separate unit tests where it's tested against the different conditions you expect it to work under. All tests must pass before functionality is considered 'complete'. This allows developers to both modify a unit of code and it's dependencies with a level of confidence about whether these changes have caused any breakage.
As a basic example of unit testing is where a developer may wish to assert whether passing specific values through to a sum function results in the correct output being re
require "money" | |
class Decorator < BasicObject | |
undef_method :== | |
def initialize(component) | |
@component = component | |
end | |
def method_missing(name, *args, &block) |
#!/usr/bin/env ruby | |
begin | |
require 'rainbow' | |
rescue LoadError | |
module Rainbow | |
def color(color) | |
self | |
end | |
def background(color) |
#!/usr/bin/env ruby | |
require 'net/smtp' | |
def run(command) | |
output = `#{command} 2>&1` | |
if not $?.success? | |
raise Exception, "Command Failed '#{command}': #{output}" | |
end | |
output |
/* | |
SCSS Color Methods for Accessibility | |
================================================================================ | |
Adjust given colors to ensure that those color combination provide sufficient | |
contrast. | |
@version 0.1 | |
@link http://eye48.com/go/scsscontrast |
# create the template | |
template = PageOfflineTemplate.new | |
template.quote = quote | |
template.pages = quote.build_pages | |
# Here I render a template with layout to a string then a PDF | |
pdf = PDFKit.new template.render_to_string(:template=>"quotes/review.html.haml") | |
// | |
// Backbone.Rails.js | |
// | |
// Makes Backbone.js play nicely with the default Rails setup, i.e., | |
// no need to set | |
// ActiveRecord::Base.include_root_in_json = false | |
// and build all of your models directly from `params` rather than | |
// `params[:model]`. | |
// | |
// Load this file after backbone.js and before your application JS. |
### IMPORTANT NOTE: See the comment thread below for a more concise way to determine this now, using has_css... | |
#A better 'I should not see' for Capybara that lets jQuery determine visibility of the text you're looking for. | |
Then /^"([^\"]*)" should not be visible$/ do |text| | |
finder_script = %{ | |
function is_text_visible_on_page(text) { | |
var match = false; | |
$('*:visible') |