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
| export `heroku config \$@ | grep S3_ | sed -e "s/ //g" -e "s/>//g" | tr "\\n" " "`¬ |
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 | |
| # Lean Architecture example in Ruby - | |
| # with ContextAccessor | |
| # Module that can be mixed in to any class | |
| # that needs access to the current context. It is | |
| # implemented as a thread-local variable. | |
| # | |
| module ContextAccessor | |
| def context |
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
| Notes from: https://groups.google.com/d/msg/rubyparley/7grAQjnjwe0/A6PcFITW9U4J | |
| Also see: http://railscasts.com/episodes/146-paypal-express-checkout | |
| Use ActiveMerchant::Billing. When you're ready to have someone checkout, send them to a rails controller action Paypal#checkout. This will: | |
| 0. "gateway" is a ActiveMerchant::Billing::PaypalExpressGateway.new | |
| 1. send a message to gateway.setup_purchase. | |
| 2. #setup_purchase has a method redirect_url_for that you'll use to redirect the user to Paypal. | |
| 3. Paypal will redirect the user back to Paypal#complete | |
| 4. on the complete page, you show the user the order form again with a finalize button |
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
| # Inspired by this thread: | |
| # https://groups.google.com/forum/?fromgroups=#!msg/rubyparley/Rnm2tC0Ry8g/xoyIfH4Qb_AJ | |
| # | |
| # "My habit is to pass all the data for the operation in the constructor, and then have a generic `run` method to make it go. | |
| # That way I can separate creation from execution should I want to, just as you can with a block." - Martin Fowler | |
| class CheckoutController | |
| def purchase | |
| purchase_order | |
| 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
| //table//tr[@class='store_credit'] | |
| [ | |
| td[@class='description' and .='Order Refund'] and | |
| td[@class='remaining_amount' and contains(., '10')] and | |
| td[@class='amount' and contains(., '10')] and | |
| td[@class='expires_on' and contains(., '2013')] and | |
| td[@class='expires_on' and contains(., '03')] and | |
| td[@class='expires_on' and contains(., '10')] | |
| ] |
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
| # Create a nice DSL around the service factories. The DSL becomes a list of commands the Applicaton supports. | |
| module MyApp | |
| module_function | |
| def ship_package(package_id) | |
| service = ShipIssueFactory.build(package_id) | |
| service.call | |
| end | |
| 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
| open(“| pbcopy”, “w”) { |clipboard| clipboard.write array.inspect } |
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 TaxController < ApplicationController | |
| def update | |
| update_tax.call(order) | |
| redirect_to checkout_shipping_path(order), :notice => "Tax was calculated successfully" | |
| rescue BusinessException => e | |
| render :action => :edit, :error => e.message | |
| end | |
| private |
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 UsersController < ApplicationController | |
| def create | |
| CreateUser.new(User).call(params[:user], CreateResponse.new(self)) | |
| end | |
| class CreateResponse < SimpleDelegator | |
| def user_created(user) | |
| flash[:notice] ="The user was created successfully" | |
| redirect_to :index |
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
| brew install haskell-platform | |
| cabal update | |
| cabal install cabal-install | |
| export PATH=$PATH:~/.cabal/bin | |
| cabal install pandoc | |
| brew install xmlstarlet | |
| brew install fontforge | |
| curl -o prince-9.0r2-macosx.tar.gz http://www.princexml.com/download/prince-9.0r2-macosx.tar.gz | |
| tar -xzvf prince-9.0r2-macosx.tar.gz | |
| cd prince-9.0r2-macosx |