Skip to content

Instantly share code, notes, and snippets.

Avatar
🤖

Will Jessop wjessop

🤖
View GitHub Profile
View pitch.md

I Am

I am Will Jessop. I am a contractor and consultant advising on Ruby on Rails performance, upgrades, scaling and hosting.

I deployed, scaled, and debugged Ruby on Rails applications at Engineyard before spending nearly six years working in operations at Basecamp (37signals), the company that created Ruby on Rails itself. After that I spent three years contracting for a large company helping them upgrade their Rails version and stack, implement strong parameters, and generally improve quality in their codebase by implementing data-collection, dashboards and reporting, writing documentation and providing advice, as well as updating code myself, all within the company's many Rails apps, including their main multi-million line monolith.

You are

You have an existing Rails app that you might want some assistance with. You might be in one of the following circumstances:

View pizza dough.txt
I used to use Jamie Oliver's recipe, it works pretty well. I use strong white bread flower and do add the semolina flour. It can be sticky, but use semolina flour on the peel (I use course), it acts like little ball bearings. Try forming just before you use them too so they don't stick too much. If you're suffering from stickage then you might just need to work on technique. Don't roll out too early, semolina on the peel, top quickly, and even perhaps get a wooden peel if you have a metal one (see https://www.youtube.com/watch?v=tFgTVhYvNPA, may be BS)
For the 24 hour ferment it's mostly this recipe (but doubled the ingredients which made 7 pizzas):
https://www.cooksillustrated.com/recipes/6316-thin-crust-pizza?sqn=pw9rHm1lTPeh3zAztdP69dX4wdOydPGMgwyLWbsDXp8%3D%0A&extcode=NSCIH27YT&utm_source=youtube&utm_medium=video&utm_content=pizza&utm_campaign=ytwed
Watch this video too:
https://www.youtube.com/watch?v=0kcVGb6HXA0
View gist:87c1c23c6a0c70574a153a2c43b1cbc3
charlock_holmes -v '0.7.6'
Building native extensions. This could take a while...
ERROR: Error installing charlock_holmes:
ERROR: Failed to build gem native extension.
current directory: /Users/will/.rbenv/versions/2.6.1/lib/ruby/gems/2.6.0/gems/charlock_holmes-0.7.6/ext/charlock_holmes
/Users/will/.rbenv/versions/2.6.1/bin/ruby -I /Users/will/.rbenv/versions/2.6.1/lib/ruby/2.6.0 -r ./siteconf20190213-34122-e636v8.rb extconf.rb
checking for -licui18n... yes
checking for -licui18n... yes
checking for unicode/ucnv.h... no
View gist:682989a200deb38a2a1dfbb880fb5cfa
$ dig mx suffolk.com
; <<>> DiG 9.10.6 <<>> mx suffolk.com
;; global options: +cmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 12479
;; flags: qr rd ra; QUERY: 1, ANSWER: 2, AUTHORITY: 0, ADDITIONAL: 1
;; OPT PSEUDOSECTION:
; EDNS: version: 0, flags:; udp: 1452
View til.rb
irb(main):006:0> def foo(a, b = "contains #{a}")
irb(main):007:1> puts a
irb(main):008:1> puts b
irb(main):009:1> end
=> :foo
irb(main):010:0> foo("things")
things
contains things
=> nil
View gist:6a6c44cf60d132dc06ec8eefb9cddde1
* Thread 84636114 at 0x105c3db /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:445 runtime.mach_semaphore_wait
Thread 84636115 at 0x105c3f3 /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:455 runtime.mach_semaphore_timedwait
Thread 84636116 at 0x105c3db /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:445 runtime.mach_semaphore_wait
Thread 84636117 at 0x105c3db /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:445 runtime.mach_semaphore_wait
Thread 84636118 at 0x105c3f3 /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:455 runtime.mach_semaphore_timedwait
Thread 84636119 at 0x105c3db /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:445 runtime.mach_semaphore_wait
Thread 84636120 at 0x105c3db /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:445 runtime.mach_semaphore_wait
Thread 84636121 at 0x105c3db /usr/local/Cellar/go/1.9.2/libexec/src/runtime/sys_darwin_amd64.s:445 runtime.ma
View bsearch.rb
# This code has edge cases on it's edge cases. If you use it in production, or even at all, it may eat your cat/dog/hamster
require 'time'
def time_from_string(line)
m = /\A\[(?<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2} \+\d{4})\]/.match(line)
if m
return Time.parse(m[:time])
end
end
View 99bottles.rb
class Bottles
def verses(start, last)
start.downto(last).map.map{|v| verse(v) }.join("\n")
end
def verse(num_bottles)
"#{bottles_of_beer_on_the_wall(num_bottles).capitalize} of beer on the wall, #{bottles_of_beer_on_the_wall(num_bottles)} of beer.
#{action(num_bottles)}.
"
View es_data_test.rb
require 'open-uri'
require 'json'
require 'net/http'
# EventsIndex.purge!
# EventsIndex.reset!
# Event.create!(
# occured_at: Time.now - 1.day,
# original_payload: {
View lock.rb
with_exclusive_lock("my_operation") do
# Something that can only happen one at a time
end
def with_exclusive_lock(lock_name, &block)
lock_file_name = "/tmp/#{lock_name}.lock"
FileUtils.touch(lock_file_name)
lock_file = File.new(lock_file_name)
lock_file.flock(File::LOCK_EX)
yield