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
| ; A REPL-based, annotated Seesaw tutorial | |
| ; Please visit https://github.com/daveray/seesaw for more info | |
| ; | |
| ; This is a very basic intro to Seesaw, a Clojure UI toolkit. It covers | |
| ; Seesaw's basic features and philosophy, but only scratches the surface | |
| ; of what's available. It only assumes knowledge of Clojure. No Swing or | |
| ; Java experience is needed. | |
| ; | |
| ; This material was first presented in a talk at @CraftsmanGuild in | |
| ; Ann Arbor, MI. |
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
| # coding: utf-8 | |
| require 'sinatra' | |
| set server: 'thin', connections: [] | |
| get '/' do | |
| halt erb(:login) unless params[:user] | |
| erb :chat, locals: { user: params[:user].gsub(/\W/, '') } | |
| end | |
| get '/stream', provides: 'text/event-stream' 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
| unshred = (shreddedImage, shredWidth) -> | |
| {width, height} = shreddedImage | |
| shreds = split shreddedImage, shredWidth | |
| weights = cross shreds, (x, y) -> | |
| if x == y | |
| 0 | |
| else | |
| mean zipWith unzip(rightEdge(x)), unzip(leftEdge(y)), correlate |
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
| require 'test_helper' | |
| shared_examples_for 'An Adapter' do | |
| describe '#read' do | |
| before do | |
| @adapter.write(@key = 'whiskey', @value = "Jameson's") | |
| end | |
| it 'reads a given key' do | |
| @adapter.read(@key).must_equal(@value) |
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
| require 'java' | |
| require 'lib/akka-actor-1.2.jar' | |
| require 'lib/scala-library.jar' | |
| java_import 'akka.actor.Actors' | |
| java_import 'akka.actor.UntypedActor' | |
| java_import 'akka.actor.UntypedActorFactory' | |
| module Sieve |
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
| guard 'shell' do | |
| watch(/relation_tree_spec\.rb/) { `clear && ruby relation_tree_spec.rb` } | |
| 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
| // Dependency resolution, adapted from https://gist.github.com/1232505/f16308bc14966c8d003c2686b1c258ec41303c1f | |
| function resolve(graph) { | |
| var sorted = [], // sorted list of IDs ( returned value ) | |
| visited = {}; // hash: id of already visited node => true | |
| // 2. topological sort | |
| Object.keys(graph).forEach(function visit(name, ancestors) { | |
| if (!Array.isArray(ancestors)) ancestors = []; | |
| ancestors.push(name); | |
| visited[name] = true; |
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
| source "https://rubygems.org" | |
| gem 'sprockets' | |
| gem 'sprockets-sass' | |
| gem 'sass' | |
| gem 'compass' | |
| gem 'bootstrap-sass' | |
| gem 'handlebars_assets' | |
| gem 'coffee-script' |
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 A | |
| def initialize_dup(other) | |
| puts 'init dup' | |
| super | |
| end | |
| def initialize_clone(other) | |
| puts 'init clone' | |
| super | |
| 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
| 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 |