Skip to content

Instantly share code, notes, and snippets.

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 July 1, 2017 08:28
Controlled recursion for fuzzers
module Recurse exposing (..)
{-| -}
{-| Function for creating controller recursive values.
-}
recurse : (a -> a) -> a -> a
recurse next done =
-- This example recurses two levels down.

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:

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
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.
@jwoudenberg
jwoudenberg / cvimrc
Last active January 23, 2016 11:16
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 January 15, 2015 15:15
How to use .bind to pre-apply arguments.
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 September 12, 2014 10:49
Bug in cucumber.js 0.4.3
Feature: Demonstrating a bug.
Scenario Outline: Scenario one.
Given I do anything
Examples:
|property |
|one |
|two |
@jwoudenberg
jwoudenberg / test.spec.js
Created October 9, 2013 18:50
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.
/**
* 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');