View wip_private_ruby.vim
function! Snake()
ruby << EOF
b = Vim::Buffer.current
line_count = b.length
indexed_lines = { |i| [ i, b[i + 1] ] }
matches = { |i, line| line.match(/^\s+private$/) }
matches.each { |priv_i, priv_text|
re = /^#{priv_text.sub(" private", "end")}$/
View plug_conn_request_url.ex
defmodule Plug.Conn.RequestURL do
def request_url(conn) do
shown_port(conn.scheme, conn.port),
View rightmove_full_images.js
document.body.innerHTML = $("a[id^=thumbnail-] img").get().map(function(x) { return '<img src="' + x.src.replace(/_max_\d+x\d+/, "") + '" />' }).join()

You may have heard about cyber attacks in the news.

The data in <the service we provide> is well protected from attacks.

We also recommend that you protect your own computers, so you don't risk losing important data. You should do two things:

1. Back up important data. You can put important files in Dropbox or Google Drive, or back up your entire computer with something like Crashplan. In case of theft, catastrophy or the recent kind of cyber attacks, it's not enough to have backup only on your own machine (like Apple's "Time Machine"). You should have backups to "the cloud" (another computer on the Internet).

2. Keep your computers updated. Make sure automatic updates are turned on in Windows or macOS (also known as OS X). If your computer asks you whether it should be updated or restarted, make sure to do that within a few days. The recent cyber attacks could have been avoided if the computers had been u

View ruby_exhaustive_switch_case.rb
# By Henrik Nyh <> under the MIT license.
class Enum
class Switch
def initialize(value_to_match_against, *values)
@checked_values = { |v| [ v, false ] }.to_h
values.each do |value|
define_singleton_method(value) { |&block|
@checked_values[value] = true
# For use with dokku/dokku-postgres.
# Based on
set -e
mkdir -p $base_dir
ymd=$(date "+%Y-%m-%d")
View Z_output.txt
$ ruby example.rb
Hello from Foo_Bar!
example.rb:10:in `const_missing': uninitialized constant Foo_Baz (NameError)
Did you mean? Foo_Bar
from example.rb:20:in `<main>'

The sound transcriptions are best attempts by a madman and do not follow any convention…

Sound Meaning
BUM-pi-d-BA Turning on
dum-du-di-du! Connected (typically plays soon after turning on, when connected to the primary device)
DUNG-DING-DUNG Turning off (by button, or by not receiving input in 20 minutes)
pika-pika-DUM Battery level 60%? Have also heard this at 30% though…
pika-pika-DUM-DUM Battery level 30%?
du-du-du! Entered pairing mode

Sent this support request to B&W support.

My new P5 wireless headphones have worked flawlessly with my iPhone 6 since I got them a few days ago, but I'm seeing a lot of problems with them when connecting to my Mac.

I have a MacBook Pro (Retina, 13-inch, Late 2013) running macOS Sierra (10.12).

I'll describe the problems below. What I want to know is mostly: Are these known issues? Are they likely to be fixed in software updates? Do you know if they affect only some of your headphones (I've heard of other such issues), so a replacement might fix it? Any workarounds?

I'm a programmer, so techy workarounds are fine. I'm also happy to provide more details from logs or whatever. Let me know.

View iplayer_availability_time_on_tabs.user.js
// ==UserScript==
// @name iPlayer better tabs
// @namespace
// @version 0.2
// @description Indicates on browser tabs when the episode becomes unavailable. Counts down if the tab is left open. Also strips title prefixes like "BBC iPlayer" so tabs show actual titles.
// @author Henrik Nyh
// @match*
// @match*
// @grant none
// @updateURL