Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
| # Support for Rspec / Capybara subdomain integration testing | |
| # Make sure this file is required by spec_helper.rb | |
| # (e.g. save as spec/support/subdomains.rb) | |
| def switch_to_subdomain(subdomain) | |
| # lvh.me always resolves to 127.0.0.1 | |
| hostname = subdomain ? "#{subdomain}.lvh.me" : "lvh.me" | |
| Capybara.app_host = "http://#{hostname}" | |
| end |
| /* Sample JavaScript file added with ScriptTag resource. | |
| This sample file is meant to teach best practices. | |
| Your app will load jQuery if it's not defined. | |
| Your app will load jQuery if jQuery is defined but is too old, e.g. < 1.7. | |
| Your app does not change the definition of $ or jQuery outside the app. | |
| Example: if a Shopify theme uses jQuery 1.4.2, both of these statements run in the console will still return '1.4.2' | |
| once the app is installed, even if the app uses jQuery 1.9.1: | |
| jQuery.fn.jquery => "1.4.2" | |
| $.fn.jquery -> "1.4.2" | |
| */ |
| A bunch of stenciles for wireframing, data & user flow diagrams and more: | |
| Empty Chrome Browser Window: | |
| https://www.graffletopia.com/stencils/938 | |
| Twitter Bootstrap UI: | |
| https://www.graffletopia.com/stencils/934 | |
| Google Web GUI: | |
| https://www.graffletopia.com/stencils/10431 |
| 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 |
| # Title: Photos tag for Jekyll | |
| # Authors: Devin Weaver | |
| # Description: Allows photos tag to place photos as thumbnails and open in fancybox. Uses a CDN if needed. | |
| # | |
| # ** This only covers the markup. Not the integration of FancyBox ** | |
| # | |
| # To see an unabridged explination on integrating this with [FancyBox][1] | |
| # Please read my [blog post about it][2]. | |
| # | |
| # [1]: http://fancyapps.com/fancybox/ |
| .gist { | |
| color: #000; | |
| } | |
| .gist div { | |
| padding: 0; | |
| margin: 0; | |
| } | |
| .gist .gist-file { |
Just install this in your apps like so:
gem 'test-spec-mini', :git => 'git://gist.github.com/1806986.git', :require => 'mini'
| #!/usr/bin/env ruby | |
| # Usage: gitio URL [CODE] | |
| # | |
| # Turns a github.com URL | |
| # into a git.io URL | |
| # | |
| # Copies the git.io URL to your clipboard. | |
| url = ARGV[0] | |
| code = ARGV[1] |
| #!/usr/bin/env ruby | |
| #/ Usage: <progname> [options]... | |
| #/ How does this script make my life easier? | |
| # ** Tip: use #/ lines to define the --help usage message. | |
| $stderr.sync = true | |
| require 'optparse' | |
| # default options | |
| flag = false | |
| option = "default value" |
| # autoload concerns | |
| module YourApp | |
| class Application < Rails::Application | |
| config.autoload_paths += %W( | |
| #{config.root}/app/controllers/concerns | |
| #{config.root}/app/models/concerns | |
| ) | |
| end | |
| end |