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
@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')
@Widdershin
Widdershin / rx_hangman.rb
Created October 31, 2015 21:57
Reactive hangman
require '/Users/nickj/.rbenv/versions/2.1.7/lib/ruby/gems/2.1.0/bundler/gems/RxRuby-e493b321a7a9/lib/rx'
require 'ostruct'
def random_word
File.readlines('words.txt').sample.chomp.upcase
end
def view(state, hide_letters: true)
letters_to_display = state.word.chars
@Widdershin
Widdershin / .markdown-doctest-setup.js
Created October 29, 2015 01:06
.markdown-doctest-setup.js for RxJS tests
'use strict';
let Rx = require('.');
let assert = require('assert');
let test = (description, f) => f();
function ok (isOk, message) {
if (!isOk) {
@Widdershin
Widdershin / test.md
Last active December 14, 2015 08:32
Testing github syntax highlighting
var foo = 5;
const foo = 5;

You can tell markdown-doctest to skip examples by adding `` before the example:

@Widdershin
Widdershin / changes.rb
Created October 24, 2015 05:20
Get a day's worth of changes from github for a repo
require 'open-uri'
def get_diff(url = "https://github.com/Widdershin/rx-undoable/compare/master%40%7B1day%7D...master.diff")
open(url) do |diff_file|
diff_file.read
end
end
diff = get_diff
class Worm:
def __init__(self, pName):
self.name = pName
class Apple:
def __init__(self):
self.myWorm = None
self.myWorm = self.makeWorm()
print self.myWorm.name # works
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)
$ cat bundle.js
window.helixPi = require('helix-pi');
window._ = require('lodash');
console.log(window._);
$ cat public/bundle.js | head -n 10
(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
'use strict';