Skip to content

Instantly share code, notes, and snippets.

Chris Mytton chrismytton

Block or report user

Report or block chrismytton

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
chrismytton / init.lua
Created Mar 5, 2017
Hammerspoon version of Karabiner's "Control_L to Control_L (+ when you type Control_L only, send escape)"
View init.lua
-- Send escape when ctrl is tapped
local send_escape = false
local ctrl_pressed = false{hs.eventtap.event.types.flagsChanged}, function(event)
local flags = event:getFlags()
if flags["ctrl"] then
ctrl_pressed = true
send_escape = true
chrismytton /
Created Oct 19, 2016
Shell function to convert YAML to JSON
yaml2json () {
ruby -r yaml -r json -e 'puts YAML.load($'
View 01-README
$ ruby benchmark.rb
user system total real
rcsv 1.420000 0.100000 1.520000 ( 1.514617)
csv 11.450000 0.350000 11.800000 ( 11.838005)
chrismytton / rerun_all_reviews.bash
Created Apr 5, 2016
Rerun the review_changes app over all open PRs
View rerun_all_reviews.bash
heroku run -- \
ruby -r ./app -e \
'ARGV.each { |pr| PullRequestReview.perform_async(pr.to_i) }' \
$(curl -s '' | jq '.[] | .number')
View education.csv
id name qualification
3 Edward G. Cross Diploma in Agriculture
3 Edward G. Cross B Sc. Honours in Economics
10 Thamsanqa Mahlangu Advanced Diploma in Purchasing and Supply
10 Thamsanqa Mahlangu Diploma in Stores Management
10 Thamsanqa Mahlangu Journeyman Certificate in Carpentry
19 Fani Munengami Diploma in Marketing, Public Relations and Advertising
22 Tendai Biti Bachelor of Laws (LLB)
25 Fungai J Majome Post Graduate Diploma
25 Fungai J Majome Bachelor of Laws (LLB)

Results from running this on my machine:

$ ruby benchmark.rb 
                           user     system      total        real
ruby_empty_loop        0.010000   0.000000   0.010000 (  0.011223)
for_loop_no_body       1.550000   0.030000   1.580000 (  1.576662)
for_loop_with_body     3.030000   0.020000   3.050000 (  3.058479)
chrismytton / .gitignore
Last active Aug 29, 2015
Image which takes 6 seconds to load
View .gitignore
chrismytton / generateblog.rb
Last active Aug 29, 2015
Super simple static site system
View generateblog.rb
#!/usr/bin/env ruby
require 'date'
require 'kramdown'
require 'erb'
abort "Usage: #$0 <posts_path>" if ARGV.empty?
Post = do
def title
Date.strptime(File.basename(path, '.md'), '%Y-%m-%d').strftime('%d %B %Y')
View Color-warp.markdown
View gist:7257389
% heroku create
Creating frightful-flesh-4163... done, stack is cedar |
Git remote heroku added
You can’t perform that action at this time.