This gist is a collection of my rough notes from Strange Loop 2012.
| #!/bin/bash -x | |
| # This should be your "script/ci" checked into version control, and then wired as your sole build step in Jenkins. | |
| # | |
| # Simplifying Assumptions: | |
| # | |
| # * You build all branches | |
| # * You want to deploy all branches. | |
| # * You wired up an SSH key to your CI server appropriately so it can talk to your deployment target(s) via Cap |
| # A queue that you can pass to IO.select. | |
| # | |
| # NOT THREAD SAFE: Only one thread should write; only one thread should read. | |
| # | |
| # Purpose: | |
| # Allow easy integration of data-producing threads into event loops. The | |
| # queue will be readable from select's perspective as long as there are | |
| # objects in the queue. | |
| # | |
| # Implementation: |
| class NodeMemory | |
| attr_reader :outstanding | |
| def initialize | |
| @slabs = [] | |
| @free_list = nil | |
| @outstanding = 0 | |
| end | |
| def alloc |
| RSpec::Matchers.define :have_json_key do |expected_key| | |
| match do |response| | |
| @body = MultiJson.load(response.body) | |
| result = @body.key?(expected_key.to_s) | |
| result &&= @body[expected_key.to_s] == @expected_val if @val_provided | |
| result | |
| end | |
| chain :with_value do |val| |
If people want to move, and the leads of those projects deem them qualified, there’s no reason not to allow this.
Deeming someone qualified is a pretty nuanced and difficult process. I wouldn’t expect all or even most temporary tech leads to get it right (or even be close) for a long time.
This is a proof-of-concept of a couple of concurrent data structures written in Ruby.
The implementations are heavily commented for those interested. There are benchmarks (with results) included below. The results are interesting, but, as always, take with a grain of salt.
AtomicLinkedQueue is a lock-free queue, built on atomic CAS operations.
| # Touch tmp/caching.txt to turn on caching | |
| if Rails.root.join('tmp/caching.txt').exist? | |
| config.action_controller.perform_caching = true | |
| config.cache_store = :mem_cache_store | |
| else | |
| config.action_controller.perform_caching = false | |
| config.cache_store = :null_store | |
| end | |
| # Touch tmp/precompile.txt to test with asset precompiles. Run |
Ideas are cheap. Make a prototype, sketch a CLI session, draw a wireframe. Discuss around concrete examples, not hand-waving abstractions. Don't say you did something, provide a URL that proves it.
Nothing is real until it's being used by a real user. This doesn't mean you make a prototype in the morning and blog about it in the evening. It means you find one person you believe your product will help and try to get them to use it.