Skip to content

Instantly share code, notes, and snippets.

View rossta's full-sized avatar
💭
Being curious

Ross Kaffenberger rossta

💭
Being curious
View GitHub Profile
@rossta
rossta / serviceworker.js
Last active September 21, 2016 21:43
Service Worker on Rails example
self.addEventListener('fetch', function(event) {
event.respondWith(
caches.open('mysite-dynamic').then(function(cache) {
return cache.match(event.request).then(function (response) {
return response || fetch(event.request).then(function(response) {
cache.put(event.request, response.clone());
return response;
});
});
})
@rossta
rossta / initializers:hello.js
Last active November 12, 2020 19:45
Webpack with require.context
console.log('initializer hello.js');
@rossta
rossta / bangbangcon-proposal.md
Last active February 4, 2018 14:35
bangbangcon-proposal.md

Title

Iris! Iris! Iris! The story of the 2004 Texas State Botball Championships

Abstract

It's lunchtime at the all-day Botball competition and, for one group of students, things were not going well. Their robot was malfunctioning. They'd lost every contest in the morning round robin. From other competitors, they received insults and scorn. With the afternoon elimination tournament looming, perhaps it would be easier to quit.

An improbable team from inner-city Houston with enters a state-wide robotics competition. Iris, their captan, is a quiet ninth-grader with a knack for debugging under pressure. Their teacher, a former biology major, learned to program alongside his students in their afterschool robotics club. Together, they embark on impossible quest and emerge transformed.

@rossta
rossta / ABOUT.md
Last active March 12, 2018 21:52
Explaining montrose.rb

Montrose

Montrose is a Ruby gem I wrote to specify and enumerate recurring events in Ruby. The source is hosted on Github.

The why: Dealing with recurring events is hard. Montrose provides a simple interface for specifying and enumerating recurring events as Time objects for Ruby applications.

More specifically, this project intends to:

  • model recurring events in Ruby
  • embrace Ruby idioms
@rossta
rossta / talks.md
Last active April 12, 2018 13:53
RailsConf recommended talks

RailsConf - Recommended Talks

Tues, April 17

Morning

  • Who Destroyed Three Mile Island?
  • The GraphQL Way: A new path for JSON APIs

  • Access Denied: the missing guide to authorization in Rails
  • The Doctor Is In: Using checkups to find bugs in production
@rossta
rossta / checklist.md
Last active May 17, 2018 20:07
Triathlon Race checklist

Triathlon Race Checklist

Pre-race shopping

  • plastic ziploc bags
  • pickle juice
  • travel-size squirt bottles
  • gatorades
  • 2-3 gallons of water
  • carbo-pro, gatorade drink mix
@rossta
rossta / pdf.js
Created May 1, 2018 18:10
Example using PDF.js
import range from 'lodash/range'
import('pdfjs/dist').then(pdfjs => {
pdfjs
.getDocument('wibble.pdf')
.then(pdf => {
const pagePromises = range(1, pdf.numPages).map(number => pdf.getPage(number))
return Promise.all(pagePromises)
})
.then(
@rossta
rossta / test-headless-chrome.log
Last active August 16, 2018 15:34
Selenium output for Rails system tests with SSL
Capybara starting Puma...
* Version 3.12.0 , codename: Llamas in Pajamas
* Min threads: 0, max threads: 4
* Listening on ssl://127.0.0.1:61719?key=/Users/ross/dev/learnzillion/system-test-demo/config/ssl/ssl-lvh.me.key&cert=/Users/ross/dev/learnzillion/system-test-demo/config/ssl/ssl-lvh.me.crt
2018-08-16 10:52:20 -0400: SSL error, peer: 127.0.0.1, peer cert: , #<Puma::MiniSSL::SSLError: OpenSSL error: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request - 336027804>
2018-08-16 10:52:21 -0400: SSL error, peer: 127.0.0.1, peer cert: , #<Puma::MiniSSL::SSLError: OpenSSL error: error:1407609C:SSL routines:SSL23_GET_CLIENT_HELLO:http request - 336027804>
2018-08-16 10:52:21 DEBUG Selenium Executing Process ["/Users/ross/.gem/ruby/2.4.1/bin/chromedriver", "--port=9515"]
2018-08-16 10:52:21 DEBUG Selenium polling for socket on ["127.0.0.1", 9515]
2018-08-16 10:52:22 DEBUG Selenium polling for socket on ["127.0.0.1", 9515]
Starting ChromeDriver 2.34.522932 (4140ab217e1ca1bec0c4b4d1b148f3361eb3a03e) on por
@rossta
rossta / rossta.zsh-theme
Last active October 31, 2018 00:55
My ZSH theme
PROMPT_PREFIX="%{$fg[blue]%}[%{$reset_color%}"
PROMPT_SUFFIX="$fg[blue]%}]%{$reset_color%}"
HOST_PROMPT="%{$fg_bold[green]%}%n@%m"
DATE_PROMPT="$PROMPT_PREFIX%{$fg[red]%}%D{%I:%M:%S}$PROMPT_SUFFIX"
PWD_PROMPT="$PROMPT_PREFIX%{$fg[white]%}%~$PROMPT_SUFFIX"
LEADER_PROMPT="%{$fg_bold[blue]%}\$%{$reset_color%}"
PROMPT=$'$HOST_PROMPT $DATE_PROMPT$PWD_PROMPT$RUBY_PROMPT$(git_prompt_info)\
$LEADER_PROMPT '
@rossta
rossta / benchmark_open.rb
Created January 2, 2020 16:33
Comparing open from disk to open-uri
require "benchmark"
require "open-uri"
require "pathname"
n = 1_000
Benchmark.bm do |benchmark|
benchmark.report("open(url).read") do
n.times do
open("http://localhost:3035/packs/manifest.json").read