- Matthew McCullough
- Ben Ellingson
- Generally prefer Brew recipes
- Prefer Brew recipes over MacPorts (no sudo needed)
| /* Base fragment to ensure the parent activity implements a contract interface. */ | |
| public abstract class ContractFragment<T> extends Fragment { | |
| private T mContract; | |
| @Override | |
| public void onAttach(Activity activity) { | |
| try { | |
| mContract = (T)activity; | |
| } catch (ClassCastException e) { | |
| throw new IllegalStateException(activity.getClass().getSimpleName() |
| #!/usr/bin/env ruby | |
| require 'bundler' | |
| require 'benchmark' | |
| REGEXPS = [ | |
| /^no such file to load -- (.+)$/i, | |
| /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
| /^Missing API definition file in (.+)$/i, | |
| /^cannot load such file -- (.+)$/i, |
| #!/usr/bin/env ruby | |
| require 'bundler' | |
| require 'benchmark' | |
| REGEXPS = [ | |
| /^no such file to load -- (.+)$/i, | |
| /^Missing \w+ (?:file\s*)?([^\s]+.rb)$/i, | |
| /^Missing API definition file in (.+)$/i, | |
| /^cannot load such file -- (.+)$/i, |
Mac OSX BOF
Questions:
| Latency Comparison Numbers (~2012) | |
| ---------------------------------- | |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns 3 us | |
| Send 1K bytes over 1 Gbps network 10,000 ns 10 us | |
| Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD |
| L1 cache reference 0.5 ns | |
| Branch mispredict 5 ns | |
| L2 cache reference 7 ns 14x L1 cache | |
| Mutex lock/unlock 25 ns | |
| Main memory reference 100 ns 4x mutex op, 20x L2 cache, 200x L1 cache | |
| Compress 1K bytes with Zippy 3,000 ns | |
| Send 2K bytes over 1 Gbps network 20,000 ns | |
| Read 1 MB sequentially from memory 250,000 ns |
| class User < ActiveRecord::Base | |
| end | |
| class Book < ActiveRecord::Base | |
| end | |
| module CustomerRole | |
| end | |
| class AddToCartContext |
| ############################################################################ | |
| # A more comprehensive drop-in replacement for Rails' internal link matcher regex | |
| # which I invented from scratch... Oh yeah, Adderall is awesome. | |
| # Takes about 40% longer to run than the stock auto_link regex in our test suite unfortunately :( | |
| # but it accounts for pretty much EVERY linkable URI/URL, and is far more (in my opinion) | |
| # readable and maintainable, due to its use of named groups/tokens. | |
| # References used to build this: | |
| # http://www.faqs.org/rfcs/rfc1738.html | |
| # http://tools.ietf.org/html/rfc3986 | |
| # http://en.wikipedia.org/wiki/URI_scheme << primary ref, was awesome, great diagram |
| // | |
| // Example usage: phantomjs screenshot.js http://yahoo.com /tmp/yahoo.png | |
| // | |
| var system = require('system'); | |
| var url = system.args[1]; | |
| var filename = system.args[2]; | |
| var page = new WebPage(); | |
| page.open(url, function (status) { |