Skip to content

Instantly share code, notes, and snippets.

View bronson's full-sized avatar

Scott Bronson bronson

  • Santa Cruz, CA
View GitHub Profile
@bronson
bronson / readme.md
Created July 25, 2014 09:45
Vim's string handling doesn't make sense?

Type this into Vim:

:echo 'doesn''t' == "doesn't"

That demonstrates that the literal string exactly equals the regular string.

So why does

QUERY PLAN
---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
HashAggregate (cost=546.68..546.72 rows=4 width=4) (actual time=1.886..1.887 rows=5 loops=1)
Group Key: a.property_id
-> Hash Anti Join (cost=347.73..546.55 rows=54 width=4) (actual time=1.814..1.885 rows=5 loops=1)
Hash Cond: (a.property_id = b.property_id)
Join Filter: (b.created_at > a.created_at)
-> Bitmap Heap Scan on change_histories a (cost=73.84..271.28 rows=61 width=12) (actual time=1.079..1.147 rows=15 loops=1)
Recheck Cond: ((target_type)::text = 'Asset'::text)
Filter: ((created_at >= '2015-01-23 00:00:00'::timestamp witho
@bronson
bronson / site_spec.rb
Last active August 29, 2015 14:17
trying to rspec a live site
require 'net/http'
require 'nokogiri'
describe "build site", build_site: true, network: true do
let(:host) { 'property-build.prologisweb.com' }
def get path
# it appears path must be absolute
Net::HTTP.get_response(host, path)
@bronson
bronson / gist:3518270bca2f849d9422
Created May 15, 2015 23:08
disable ctrl-f keybindings to try to speed up atom
'.platform-darwin .tree-view':
'ctrl-f': 'unset!'
'body':
'ctrl-f': 'unset!'
'body .native-key-bindings':
'ctrl-f': 'unset!'
bobrock [11:11 AM]
I assume Atom grammars can be written in JSON interchangeably with CSON?
lee-dohm [12:25 PM]
I believe so, but I’ve never tried it
thomasjo [12:26 PM]
Yes.
bronson@t500-jaunty:~$ ifconfig
eth0 Link encap:Ethernet HWaddr 00:1c:25:97:40:e0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)
Memory:fc000000-fc020000
lo Link encap:Local Loopback
# download the command
cd /tmp
wget http://github.com/bronson/git-subtree/raw/6aa0e3e116daafd3292b862555b7a0da81352070/git-subtree
chmod a+x /tmp/git-subtree
# and put another git project as a subtree into myrepo
cd ~/myrepo/
VERBOSE=1 /tmp/git-subtree clone git://blah/subproject.git
# (VERBOSE shows the git commands that it's using)
@bronson
bronson / example.erb
Created October 9, 2009 02:31 — forked from sbr/example.erb
<div class="list">
<ul>
<% @items.each do |item| %>
<li class="<%= item_classes_for_user(item, @current_user) %>">
<%= image_tag "/icons/#{item.state}.png" %>
<span class="name">
<%= item.name %>
</span>
</li>
<% end %>
<div class="list">
<ul>
<% @items.each do |item| %>
<li class="<%= item_classes_for_user(item, @current_user) %>">
<%= image_tag "/icons/#{item.state}.png" %>
<span class="name">
<%= item.name %>
</span>
</li>
<% end %>

Setup

To prepare the production database and launch the server, run these two command lines:

RAILS_ENV=production rake db:drop db:create db:migrate db:seed assets:precompile
RAILS_ENV=production RAILS_SERVE_STATIC_ASSETS=true rails server

Now, load each URL and see what Rack and Chrome Devtools show for response time.

Fair warning: this is running on a Macbook Air with 20% battery... kinda flimsy.