Skip to content

Instantly share code, notes, and snippets.

View Widdershin's full-sized avatar

Nick Johnstone Widdershin

  • Wellington, New Zealand
  • X @widdnz
View GitHub Profile
self: super:
{
# Install overlay:
# $ mkdir -p ~/.config/nixpkgs/overlays
# $ curl https://gist.githubusercontent.com/LnL7/570349866bb69467d0caf5cb175faa74/raw/3f3d53fe8e8713ee321ee894ecf76edbcb0b3711/lnl-overlay.nix -o ~/.config/nixpkgs/overlays/lnl.nix
userPackages = super.userPackages or {} // {
self.config.allowUnfree = true;
# core
# requires anybar https://github.com/tonsky/AnyBar (brew cask install anybar)
# to get your player_id and your authorization_header, open the devtools and go to the network inspector
# refresh the games list, and then inspect the /games request
# set authorization_header to the value of the authorization header
# you can find your steam id in the json response of that same request
#
# to automatically update, make a cronjob
# run crontab -e and add this line
#
# * * * * ruby <path-to-this-script>

Testing JavaScript embedded in Markdown

  • Use case: Blog posts and books, not documentation for software.
  • As much code as possible should be included within the Markdown file.
  • I’m currently using § as a meta-character.
    • I’m open to alternatives. Other characters I considered: ¡ ¿ Δ ≡
    • I wanted it to be a non-ASCII character, to minimize the risk of conflicts.

Checking is opt-in

@Widdershin
Widdershin / router-tdd.ts
Created February 11, 2017 03:22
TDD Router in Cycle.js
import {mockTimeSource} from '@cycle/time';
import {mockDOMSource} from '@cycle/dom';
describe.only('steve example', () => {
function Router (sources, change$, definitions) {
let instances = {};
function map (attr) {
return change$.map(path => {
if (path in instances) {
@Widdershin
Widdershin / esnextbin.md
Last active December 7, 2016 05:01
esnextbin sketch
#!/usr/bin/env ruby
term = ARGV.join('+')
puts "\033browse https://google.co.nz/#q=#{term}\033"
@Widdershin
Widdershin / whitespace.txt
Last active October 7, 2016 02:54
A poem about whitespace
Never put a new line at the top of a scope
So that you can see the structure of the tree
Always put new lines between things on the same level with different responsibilities
But if you have some things that are alike
Like
This
And that
@Widdershin
Widdershin / producers.js
Last active September 18, 2016 23:39
xstream producers
import fs from 'fs';
import assert from 'assert';
import xs from 'xstream';
function xray (url, classToScrape) {
return function scrape (callback) {
// goes and parses internetty stuff
callback(stuff);
}
class Message
def initialize(method_name, *args, &block)
@method_name = method_name
@args = args
@block = block
end
def call(value)
value.send(@method_name, *@args, &@block)
live_loop :drums do
sample :drum_tom_lo_hard
sleep 0.4
end
i = 0
live_loop :woo do
sync :drums
if i % 4 == 0 && i % 40 < 20
sample :bass_thick_c