Skip to content

Instantly share code, notes, and snippets.

View Widdershin's full-sized avatar

Nick Johnstone Widdershin

View GitHub Profile
@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
@Widdershin
Widdershin / smart-switch.rb
Created April 27, 2016 08:57
Switch/open tmux sessions with ease using fzf
#!/usr/bin/env ruby
require 'set'
PROJECTS_DIR = '/Users/nickj/Projects/'
def tmux_is_running?
ENV.include? 'TMUX'
end
@Widdershin
Widdershin / contributors.md
Last active May 2, 2016 21:28
Cycle.js contributors wanted!

I'm looking for some awesome people to join me in working on some of the Cycle.js projects I've released. Have a look at the list. If you're unsure about anything (such as wanting to help but being unsure if you're able/welcome) please contact me!

Collaborators wanted:

tricycle (difficulty: beginner-advanced)

Tricycle lets you try out Cycle.js in your browser. Try it out here.

Tricycle has lots of opportunities to help out and improvements would make a big difference to the community as for a lot of beginners Tricycle is their first introduction to writing Cycle code.

$('.search_result_with_extract').toArray().map(function (result) {
var message = $(result).find('.extract_content').text()
var date = $(result).parents(".search_message_result").find('.date_links').text().split('•')[1].trim()
return date + ': ' + message.trim()
}).filter(function (text) {
return text.match(/group's topic/)
}).join('\n')