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
| #!/usr/bin/env ruby -rubygems | |
| # :P | |
| # exit | |
| require 'digiusb/digiblink' | |
| # TODO: | |
| COLORS = { | |
| 'success' => 'green', |
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
| if [ -z "$ghprbSourceBranch" ];then | |
| # special case non GHPRB build | |
| git fetch origin '+refs/heads/*:refs/remotes/origin/*' | |
| git reset --hard "$sha1" | |
| fi |
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 MyFoo | |
| def awesome? | |
| true | |
| end | |
| end | |
| describe MyFoo do | |
| let(:my_foo) { MyFoo.new } | |
| it 'is awesome' do |
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 link_to_post(post) | |
| html_class = ["post"] | |
| html_class << "active" if post.active? | |
| link_to(post.title, post, class: html_class) | |
| 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
| class MyCustomDatePresenter < HTMLCalendar::DatePresenter | |
| # Available methods: `date` and `template` | |
| # The only required method | |
| def html_classes | |
| if monday? | |
| ['a-case-of-the-mundays'] | |
| else | |
| [] | |
| 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
| class APIClient | |
| def get_teapots | |
| ignore_errors do | |
| make_request :teapots | |
| end | |
| end | |
| def get_coffeepots | |
| ignore_errors do | |
| make_request :coffeepots |
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
| SMRT_ERRORS = [ServiceClaimsIsATeapot] | |
| def ignore_stupid_errors(error_block = ->(*){}) | |
| yield | |
| rescue *SMRT_ERRORS => e | |
| error_block.call e | |
| 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
| module Navision | |
| class ItemGateway | |
| def initialize(options = {}) | |
| @client = options.fetch(:client) { Navision.item_client } # item_client => Savon.client(...) | |
| end | |
| def get_product_by_number(number) | |
| get_result client.call :read, message: { 'No' => number } | |
| 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
| # LineItemsController | |
| categories: (-> | |
| @get('model').mapBy('category').uniq().map (category) => | |
| Ember.Object.create | |
| name: category | |
| line_items: @get('model').filterBy 'category', category | |
| ).property('@each.category') |
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 ABTestHelper | |
| def test | |
| yield | |
| end | |
| def variant(variant) | |
| if variant_matches(variant) | |
| yield | |
| end | |
| end |