Skip to content

Instantly share code, notes, and snippets.

🆗

John Hawthorn jhawthorn

🆗
Block or report user

Report or block jhawthorn

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
View backtrace_cleaner_benchmark.rb
# frozen_string_literal: true
ENV['RAILS_ROOT'] = "/Users/jhawthorn/src/current_status/"
require 'benchmark/ips'
require 'rails/all'
require 'rails/backtrace_cleaner'
class MyApp < Rails::Application
config.root = "/Users/jhawthorn/src/current_status"
View _actionview_cache.md

Testing performance from https://github.com/rails/rails/pull/35629

This only compares this PR vs its parent. (ie. "before" already includes #35623)

I stacked the deck a little to make this change look as good as possible:

  • Rendered quite a few different templates
  • Used a very fast test app
  • Commented out js/css tags in header (the slowest part of the page in dev)

But the results were very good:

@jhawthorn
jhawthorn / main.workflow
Last active Jan 14, 2019
GitHub actions workflow for my static site https://github.com/jhawthorn/site-example for more
View main.workflow
workflow "Build and deploy on push" {
on = "push"
resolves = [
"Branch master",
"Invalidate cache",
]
}
action "Build" {
uses = "docker://ruby:latest"
@jhawthorn
jhawthorn / todo_test.gemspec
Created Jan 1, 2019
This gem is about TODOs https://twitter.com/searls/status/1079929935660236801
View todo_test.gemspec
require "fullwidth" # https://github.com/jhawthorn/fullwidth
Gem::Specification.new do |spec|
spec.name = "todo_test"
spec.version = "0.0.0"
spec.authors = ["John Hawthorn"]
spec.email = ["john@hawthorn.email"]
spec.summary = %q{This gem is about TODOs}.to_fullwidth
spec.description = %q{This gem is about TODOs. lol}.to_fullwidth
@jhawthorn
jhawthorn / dtruss.txt
Created Sep 13, 2018
Dir["app/views/users/show*"]
View dtruss.txt
getattrlist("app\0", 0x7FFEEC328C50, 0x7FFEEC328C90) = 0 0
getattrlist("app/views\0", 0x7FFEEC328A70, 0x7FFEEC328AB0) = 0 0
getattrlist("app/views/users\0", 0x7FFEEC328890, 0x7FFEEC3288D0) = 0 0
sigprocmask(0x1, 0x0, 0x7FFEEC3292A0) = 0x0 0
sigaltstack(0x0, 0x7FFEEC329290, 0x0) = 0 0
openat(0xFFFFFFFFFFFFFFFE, "app/views/users\0", 0x1100000, 0x1) = 7 0
fstat64(0x7, 0x7FFEEC329220, 0x0) = 0 0
fcntl_nocancel(0x7, 0x2, 0x1) = 0 0
fstatfs64(0x7, 0x7FFEEC328968, 0x0) = 0 0
getdirentries64(0x7, 0x7FA162008000, 0x1000) = 104 0
@jhawthorn
jhawthorn / dtruss.txt
Last active Sep 12, 2018
app/views/users/show{.en,}{.html,.text,.js,.css,.ics,.csv,.vcf,.vtt,.png,.jpeg,.gif,.bmp,.tiff,.svg,.mpeg,.mp3,.ogg,.m4a,.webm,.mp4,.otf,.ttf,.woff,.woff2,.xml,.rss,.atom,.yaml,.multipart_form,.url_encoded_form,.json,.pdf,.zip,.gzip,}{}{.raw,.erb,.html,.builder,.ruby,}
View dtruss.txt
getattrlist("app\0", 0x7FFEEE3598D0, 0x7FFEEE359910) = 0 0
getattrlist("app/views\0", 0x7FFEEE3596F0, 0x7FFEEE359730) = 0 0
getattrlist("app/views/users\0", 0x7FFEEE359510, 0x7FFEEE359550) = 0 0
getattrlist("app/views/users/show.en.html.raw\0", 0x7FFEEE359330, 0x7FFEEE359370) = -1 Err#2
getattrlist("app\0", 0x7FFEEE3598D0, 0x7FFEEE359910) = 0 0
getattrlist("app/views\0", 0x7FFEEE3596F0, 0x7FFEEE359730) = 0 0
getattrlist("app/views/users\0", 0x7FFEEE359510, 0x7FFEEE359550) = 0 0
getattrlist("app/views/users/show.en.html.erb\0", 0x7FFEEE359330, 0x7FFEEE359370) = -1 Err#2
getattrlist("app\0", 0x7FFEEE3598D0, 0x7FFEEE359910) = 0 0
getattrlist("app/views\0", 0x7FFEEE3596F0, 0x7FFEEE359730) = 0 0
@jhawthorn
jhawthorn / Gemfile
Last active Jul 4, 2018
bundler vs bundler-explain: A real world Gemfile during an upgrade to Rails 5 https://github.com/jhawthorn/bundler-explain
View Gemfile
source 'https://rubygems.org'
gem 'rails', '~> 5.0.0'
# Soft-deletion
gem 'paper_trail'
gem 'discard', '~> 1.0'
# auth
gem 'pundit'
View output.txt
$ ruby report.rb
Outage from 2018-06-07 02:50:49 -0700 to 2018-06-07 02:58:32 -0700
duration: 8 minutes
pings lost: 77% (34 / 44)
average ping: 22ms
Outage from 2018-06-07 05:07:10 -0700 to 2018-06-07 05:21:04 -0700
duration: 14 minutes
pings lost: 83% (65 / 78)
average ping: 16ms
View log_uptime.rb
# A stable ping target
# pretty much anything is more reliable than shaw
target_ip = "1.1.1.1"
# Maximum wait time in seconds.
wait = 1
interval = 10
require 'fileutils'
You can’t perform that action at this time.