Skip to content

Instantly share code, notes, and snippets.

Avatar

Jasper Woudenberg jwoudenberg

View GitHub Profile
View draggable.js
window.setupDraggable = function setupDraggable(sendEvent) {
const BEACON_ATTRIBUTE = "data-beacon";
const MINIMUM_DRAG_DISTANCE_PX = 10;
document.addEventListener("pointerdown", awaitDragStart);
function awaitDragStart(startEvent) {
document.addEventListener("pointermove", maybeDragMove);
document.addEventListener("pointerup", stopAwaitingDrag);
@jwoudenberg
jwoudenberg / Recurse.elm
Created Jul 1, 2017
Controlled recursion for fuzzers
View Recurse.elm
module Recurse exposing (..)
{-| -}
{-| Function for creating controller recursive values.
-}
recurse : (a -> a) -> a -> a
recurse next done =
-- This example recurses two levels down.
View keybase.md

Keybase proof

I hereby claim:

  • I am jwoudenberg on github.
  • I am woudenberg (https://keybase.io/woudenberg) on keybase.
  • I have a public key whose fingerprint is 4BE2 7848 2F18 8A4F 68AA 6AC2 9554 0BAC 3740 9D09

To claim this, I am signing this object:

View pseudo.js
const Task = require('data.task')
// Using the Task Monad as an example, but any Monad would work.
const getAnswer = () => Task.of(42)
const even = n => Task.of((n % 2) === 0)
const result = fy(function * () {
// Yield monads to get back their values.
const answer = yield getAnswer()
const halfAnswer = answer / 2
View denormalizer-test-example.js
var dryRun = require('denormalizer-test-utils').dryRun;
var runScene = require('domain-test-utils');
var Denormalizer = require('')
describe('some suite', function () {
var events = null;
var notifications = null;
before(function () {
//In reality, functions below will be async.
View cvimrc
set autoupdategist
set cncpcompletion
let barposition = "bottom"
let defaultengine = "duckduckgo"
map <C-u> scrollPageUp
map <C-d> scrollPageDown
map <C-o> goBack
map <C-i> goForward
map H previousTab
@jwoudenberg
jwoudenberg / bind.js
Created Jan 15, 2015
How to use .bind to pre-apply arguments.
View bind.js
function add(num1, num2) {
return num1 + num2;
}
var addFive = add.bind(null, 5);
var sum = addFive(3);
console.log(sum); //-> 8
@jwoudenberg
jwoudenberg / test.feature
Created Sep 12, 2014
Bug in cucumber.js 0.4.3
View test.feature
Feature: Demonstrating a bug.
Scenario Outline: Scenario one.
Given I do anything
Examples:
|property |
|one |
|two |
@jwoudenberg
jwoudenberg / test.spec.js
Created Oct 9, 2013
The following is a test case of a problem I'm having writing jasmine unit tests for Q code in node. When run, this test specification will abruptly end because of the error thrown by done(). Update: Running the same test with the stand-alone version of Jasmine works fine, the test fails then. Apparently the issue is with jasmine-node.
View test.spec.js
/**
* Test case.
* Below are three tests. The top one should succeed.
* In the second one an exception is thrown, so it should fail.
* The last one should also fail.
* What happens is that the first two are executed, then jasmine drops
* dead when trying to execute the second one.
*/
(function () {
var Q = require('q');
You can’t perform that action at this time.