A tweet-sized debugger for visualizing your CSS layouts. Outlines every DOM element on your page a random (valid) CSS hex color.
One-line version to paste in your DevTools
Use $$ if your browser aliases it:
~ 108 byte version
| DB = (key) -> | |
| store = window.localStorage | |
| get: -> | |
| JSON.parse store[key] or "{}" | |
| put: (data) -> | |
| store[key] = JSON.stringify(data) |
| require 'sinatra' | |
| set server: :thin | |
| get '/' do | |
| erb :welcome | |
| end | |
| get '/stream', provides: 'text/event-stream' do | |
| stream do |out| | |
| loop do |
| 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 |
| require 'date' | |
| # Actually doesn't matter WHAT you choose as the epoch, it | |
| # won't change the algorithm. Just don't change it after you | |
| # have cached computed scores. Choose something before your first | |
| # post to avoid annoying negative numbers. Choose something close | |
| # to your first post to keep the numbers smaller. This is, I think, | |
| # reddit's own epoch. | |
| $our_epoch = Time.local(2005, 12, 8, 7, 46, 43).to_time |
| require 'faye' | |
| Faye::WebSocket.load_adapter('thin') | |
| use Faye::RackAdapter, :mount => '/faye', :timeout => 25 | |
| require ::File.expand_path('../config/environment', __FILE__) | |
| run App::Application |
| #!/usr/bin/env sh | |
| ## | |
| # This is script with usefull tips taken from: | |
| # https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
| # | |
| # install it: | |
| # curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
| # |
| class Users::Register | |
| def self.call(attributes) | |
| new(attributes).call | |
| end | |
| def initialize(attributes) | |
| @attributes = attributes | |
| end |
| linus@Newton:~$ redis-cli | |
| redis 127.0.0.1:6379> publish /updates.foo "hello there!" | |
| (integer) 1 | |
| redis 127.0.0.1:6379> |
| /* | |
| *= require_self | |
| */ | |
| html, body { | |
| background-color: #eee; | |
| } | |
| body { | |
| padding-top: 40px; /* 40px to make the container go all the way to the bottom of the topbar */ | |
| } |