Skip to content

Instantly share code, notes, and snippets.

View JonRowe's full-sized avatar
💭
⛵️

Jon Rowe JonRowe

💭
⛵️
View GitHub Profile
ls -al /usr/llvm-gcc-4.2/bin/
total 9280
drwxrwxr-x 11 root admin 374 20 Jan 06:46 .
drwxrwxr-x 7 root admin 238 20 Jan 06:45 ..
-rwxrwxr-x 1 root admin 201664 20 Jan 06:45 gcov-4.2
-rwxrwxr-x 1 root admin 859664 20 Jan 06:45 i686-apple-darwin10-llvm-g++-4.2
-rwxrwxr-x 1 root admin 851472 20 Jan 06:45 i686-apple-darwin10-llvm-gcc-4.2
-rwxrwxr-x 1 root admin 182512 20 Jan 06:45 llvm-c++-4.2
-rwxrwxr-x 1 root admin 562896 20 Jan 06:45 llvm-cpp-4.2
@JonRowe
JonRowe / gist:c0861d56c69f2c8ab5d61988460dee32
Last active September 30, 2021 16:09 — forked from corbanb/gist:76d0658493e93830af48
Setting up PostGIS for Timezone Lookup

Forked from: corbanb/gist:76d0658493e93830af48 which borrowed heavily from http://blog.shupp.org/2012/08/12/local-timezone-lookups-by-coordinates-with-postgis/ to make this geared towards mac users, which has been updated.

Step 1: Install Postgresql & Postgis + dependencies

$ psql -U <user> -d template_postgis  
$ template_postgis=> select postgis_lib_version(); should return installed version!  
$ template_postgis=> \d+tz_world  

Hi, I'm Jon and I’m a freelance / contract Ruby / RoR developer based in Sydney;

I've been working with Ruby professionally for around 10 years, I consider myself a specialist in test driven development with Ruby, using Rails for customer facing sites (e.g. if it serves HTML). I'm one of the current maintainers of RSpec so as you can appreciate I'm a huge fan of using it for both unit and integration testing.

How can I help you? I have a lot of experience building prototype apps, polishing existing products, improving site performance, reviewing and improving code quality or improving test setups. Our work together could be a specific project or a time based contract. I typically work with the server side

mkdir bash-fix
cd bash-fix
curl https://opensource.apple.com/tarballs/bash/bash-92.tar.gz | tar zxf -
cd bash-92/bash-3.2
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-052 | patch -p0
curl https://ftp.gnu.org/pub/gnu/bash/bash-3.2-patches/bash32-053 | patch -p0
cd ..
xcodebuild
sudo cp /bin/bash /bin/bash.old
sudo cp /bin/sh /bin/sh.old
@JonRowe
JonRowe / .rspec
Last active February 11, 2016 07:02
RubyConfAU16 Code
-r ./talk_helper
@JonRowe
JonRowe / any_size_benchmark.rb
Created January 16, 2014 01:16
TIL that `empty?` is still significantly faster than `any?` despite `any?` being lazy.
require 'benchmark'
array = 10000000.times.to_a
puts "Any"
puts Benchmark.measure { 1000.times { array.any? } }
puts "Empty"
puts Benchmark.measure { 1000.times { array.empty? } }
@JonRowe
JonRowe / active.md
Last active December 28, 2015 15:08 — forked from parndt/active.md

Most active GitHub users (git.io/top)

The count of contributions (summary of Pull Requests, opened issues and commits) to public repos at GitHub.com from Sat, 17 Nov 2012 22:58:25 GMT till Sun, 17 Nov 2013 22:58:25 GMT.

Only first 1000 GitHub users according to the count of followers are taken. This is because of limitations of GitHub search. Sorting algo in pseudocode:

githubUsers
 .filter((user) -&gt; user.followers &gt; 30)
@JonRowe
JonRowe / better_better_specs.md
Created October 11, 2013 03:09
Whilst betterspecs.org has good ideas, it's examples are flawed.

Use contexts

Contexts are a powerful method to make your tests clear and well organized. In the long term this practice will keep tests easy to read.

I agree with the premise, and I agree that this:

BAD
it 'has 200 status code if logged in' do
1.9.3p448 :002 > a = [-> { puts 1; true }, -> { puts 2; false}, -> { puts 3; false }]
=> [#<Proc:0x007fe5c41a8f68@(irb):2 (lambda)>, #<Proc:0x007fe5c41a8f18@(irb):2 (lambda)>, #<Proc:0x007fe5c41a8ef0@(irb):2 (lambda)>]
1.9.3p448 :003 > a.all?(&:call)
1
2
=> false
1.9.3p448 :004 > a = [-> { puts 1; false }, -> { puts 2; true}, -> { puts 3; false }]
=> [#<Proc:0x007fe5c4276620@(irb):4 (lambda)>, #<Proc:0x007fe5c42765d0@(irb):4 (lambda)>, #<Proc:0x007fe5c42765a8@(irb):4 (lambda)>]
1.9.3p448 :005 > a.any?(&:call)
1
@JonRowe
JonRowe / benchmark.rb
Created August 20, 2013 11:35
Hash key lookup performance vs local variable.
require 'benchmark'
require 'stringio'
sizes = [10,100,1000,10000]
def measure(&block)
puts Benchmark.measure { 100000.times(&block) }
end
sizes.each do |size|