Skip to content

Instantly share code, notes, and snippets.

define nodejs::version($version) {
exec {
"Donwload ${version}":
command => "wget http://nodejs.org/dist/v${version}/node-v${version}.tar
cwd => "/tmp",
require => Package['curl'];
"Untar ${version}":
command => "tar -zxf node-v${version}",
cwd => "/tmp"
require => Exec["Download ${version}"];
def transactions
responses.inject([]) do |transactions, response|
transactions << response.transactions
end.sort_by &:timestamp
end
require 'test_helper'
class PayPalExpress::TransactionSearchTest < ActiveSupport::TestCase
test "#search returns a collection of transactions" do
account = MiniTest::Mock.new
period = MiniTest::Mock.new
requester = MiniTest::Mock.new
params = {}
params['ACK'] = 'Success'
params.default = []
class HeroPage < AR::Base
def online_total!
save!
end
end
class HeroPageTest < ActiveSupport::TestCase
test "#total_in_aud includes the registration total" do
mock_hero_page = Class.new SimpleDelegator do
def save!
module ApplicationHelper
def flash_messages
flash.inject([]) do |array, (level, message)|
array << content_tag(:div, flash_content(message), class: "alert-message #{level} fade in", data: {alert: 'alert'})
end.join.html_safe
end
private
def flash_content message
def calculate_total(products)
Array(products).inject(0) { |sum, product| sum + product.price }
end
App.FeatureView = SC.View.extend({
classNames: ['feature'],
templateName: 'feature',
createdAt: function () {
return $.timeago.distanceInWords(this.getPath('content.createdAt'));
}.property('createdAt').cacheable()
});
$ curl -i -H "Authorization: token my_token" https://api.github.com/orgs/everydayhero/repos
HTTP/1.1 200 OK
Server: nginx/1.0.4
Date: Sun, 30 Oct 2011 01:02:50 GMT
Content-Type: application/json; charset=utf-8
Connection: keep-alive
Status: 200 OK
X-RateLimit-Limit: 5000
ETag: "55fef90d58683e3270408d09eae6ee71"
X-OAuth-Scopes:
class FeaturesHash < HashWithIndifferentAccess
def with_features features
current = dup
replace features
yield
ensure
replace current
end
def method_missing method, *args, &block
// Controller for fetching the records
App.leaderboardController = SC.ArrayProxy.create({
content: [],
loadUsers: function() {
var self = this;
$.getJSON('/leaderboard/username/year/month', function(data) {
data.forEach(function(leader) {
self.pushObject(leader.leader);