I hereby claim:
- I am kwiest on github.
- I am kylewiest (https://keybase.io/kylewiest) on keybase.
- I have a public key whose fingerprint is 4DAE EBFD D13A BF0E EF6F 7778 3261 4640 F345 24F3
To claim this, I am signing this object:
| import { Pact } from "@pact-foundation/pact"; | |
| import { like } from "@pact-foundation/pact/src/dsl/matchers"; | |
| import { CartApi } from "."; | |
| const provider = new Pact({ | |
| consumer: "MockCartConsumer", | |
| provider: "CartService", | |
| logLevel: "info", | |
| }); |
| {"idempotency_key":"1475d547-7b0e-48c5-bd28-e74700a9d82a","batches":[{"objects":[{"item_data":{"name":"Kyle's Test Item","variations":[{"item_variation_data":{"pricing_type":"FIXED_PRICING","location_overrides":[{"location_id":"WMYW60XEVK9MD","track_inventory":true,"price_money":{"amount":550,"currency":"USD"}}],"name":"Hayes Valley","price_money":{"amount":450,"currency":"USD"}},"present_at_location_ids":["WMYW60XEVK9MD","S7CWFDJ0Y3PD5"],"present_at_all_locations":false,"id":"#Hayes Valley","type":"ITEM_VARIATION"}]},"id":"#Kyle's Test Item","type":"ITEM"}]}]} |
| // Traits are like interfaces | |
| trait MySet[A] extends (A => Boolean) { | |
| def apply(element: A): Boolean = contains(element) | |
| def contains(element: A): Boolean | |
| def +(element: A): MySet[A] | |
| def ++(otherSet: MySet[A]): MySet[A] | |
| def -(element: A): MySet[A] | |
| def --(otherSet: MySet[A]): MySet[A] |
| // Options can be one of 2 things: Something (Some) or nothing (None) | |
| // Because it is "collection" of 2 outcomes, you can iterate using `map` | |
| // Define a function to pass around that uppercases a String or Char | |
| val up : (Any) => Any = (item) => { | |
| item match { | |
| case item: String => item.toUpperCase | |
| case item: Char => Char.toUpperCase(item) | |
| } | |
| } |
I hereby claim:
To claim this, I am signing this object:
| # Trying to re-create a JOIN on a nested SELECT query first in Arel, and then convert to Rails | |
| # SELECT campers.*, payments.total_paid | |
| # FROM campers | |
| # LEFT OUTER JOIN ( | |
| # SELECT payments.source_id, SUM(payments.amount_cents) AS total_paid | |
| # FROM payments | |
| # WHERE payments.source_type = 'Camper' AND payments.state = 'paid' | |
| # GROUP by payments.source_id | |
| # ) payments |
| # Rails 3.2.12 | |
| # Rails engine | |
| # app/controllers/puddy/application_controller.rb | |
| modue Puddy | |
| class ApplicationController < ActionController::Base | |
| layout 'puddy/dashboard' | |
| #... | |
| end |
| class EncryptedAttributesWithAfterCallbacksTest < MiniTest::Unit::TestCase | |
| def setup | |
| @password = '' | |
| @ran_callback = false | |
| callback = lambda { |record| | |
| p 'Callback being called...' | |
| @password = record.password | |
| @ran_callback = true | |
| } | |
| # When I run the test when Redis is running, all tests pass | |
| # When I run the test with Redis purposefully off, I get the error at the end of the gist | |
| # | |
| # I've tried manually raising Redis::CannotConnectError instead of calling Redis.new | |
| # and a new instance of SimpleStore is returned, and again all tests pass | |
| # Gemfile | |
| gem 'redis', '~> 3.0.0' |
| # Migration (created from Devise) | |
| class DeviseCreateUsers < ActiveRecord::Migration | |
| def self.up | |
| create_table(:users) do |t| | |
| t.database_authenticatable :null => false | |
| t.recoverable | |
| t.rememberable | |
| t.trackable | |
| t.string :name |