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
| 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}"]; |
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 transactions | |
| responses.inject([]) do |transactions, response| | |
| transactions << response.transactions | |
| end.sort_by &:timestamp | |
| end |
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
| 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 = [] |
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 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! |
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
| 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 |
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 calculate_total(products) | |
| Array(products).inject(0) { |sum, product| sum + product.price } | |
| end |
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
| App.FeatureView = SC.View.extend({ | |
| classNames: ['feature'], | |
| templateName: 'feature', | |
| createdAt: function () { | |
| return $.timeago.distanceInWords(this.getPath('content.createdAt')); | |
| }.property('createdAt').cacheable() | |
| }); |
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
| $ 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: |
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 FeaturesHash < HashWithIndifferentAccess | |
| def with_features features | |
| current = dup | |
| replace features | |
| yield | |
| ensure | |
| replace current | |
| end | |
| def method_missing method, *args, &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
| // 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); |