Skip to content

Instantly share code, notes, and snippets.

View rdjpalmer's full-sized avatar
🌻

Richard Palmer rdjpalmer

🌻
View GitHub Profile
@furf
furf / sleep.html
Created September 2, 2020 16:52
Detect system sleep and wake events in browser.
<html>
<head>
<title>sleep.js</title>
</head>
<body>
<h1>sleep.js</h1>
<script src="sleep.js"></script>
@gaearon
gaearon / Marble.js
Last active February 14, 2019 06:54
Marble-style sequencer + sampler for https://github.com/FormidableLabs/react-music
/*
This replaces <Sequencer> + multiple <Sampler>s with a marble diagram sequencer.
You can use it like this:
<Marble
resolution={16}
samples={[
'samples/kick.wav',
'samples/snare.wav',
]}
@gbenedict
gbenedict / pow_nip_io.md
Last active April 4, 2017 09:47
Modifying the Pow web server to support nip.io in addition to xip.io

The xip.io DNS servers are proving to be troublesome for both latency and reliability. In researching solutions, I found the nip.io DNS servers to be much more reliable.

This modification to add nip.io support is for version 0.5.0 of Pow.

Go to line 78 of the file ~/Library/Application\ Support/Pow/Current/lib/configuration.js:

this.allDomains.push(/\d+\.\d+\.\d+\.\d+\.xip\.io$/, /[0-9a-z]{1,7}\.xip\.io$/);
@acdlite
acdlite / flux.js
Last active October 7, 2021 17:19
A Redux-like Flux implementation in <75 lines of code
/**
* Basic proof of concept.
* - Hot reloadable
* - Stateless stores
* - Stores and action creators interoperable with Redux.
*/
import React, { Component } from 'react';
export default function dispatch(store, atom, action) {
@Rob--W
Rob--W / html5-formdata-polyfilll.js
Created May 27, 2014 22:07
FormData polyfill for Web Workers.
/*
* FormData for XMLHttpRequest 2 - Polyfill for Web Worker
* (c) 2014 Rob Wu <[email protected]>
* License: MIT
* - append(name, value[, filename])
* - XMLHttpRequest.prototype.send(object FormData)
*
* Specification: http://www.w3.org/TR/XMLHttpRequest/#formdata
* http://www.w3.org/TR/XMLHttpRequest/#the-send-method
* The .append() implementation also accepts Uint8Array and ArrayBuffer objects