This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var Multipart = { | |
parse: (function() { | |
function Parser(arraybuf, boundary) { | |
this.array = arraybuf; | |
this.token = null; | |
this.current = null; | |
this.i = 0; | |
this.boundary = boundary; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { | |
useRef, | |
useImperativeHandle | |
} from "react"; | |
import useAnimationFrame from "../hooks/animationFrame"; | |
type UpdateHandler = (dt: number, canvas: HTMLCanvasElement) => void; | |
export interface CanvasProps extends React.CanvasHTMLAttributes<HTMLCanvasElement> { | |
onAnimationFrame: UpdateHandler; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Compress (gzip) JSON-serialisable object and output as base 64; Decompress base 64 data and output as parsed JSON. | |
Useful for URLs, e.g. | |
Compress: | |
const bigObject = { ...lotsOfData }; | |
const url = "https://www.example.com/?" + await compressToUrl(bigObject); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[ | |
{ | |
"label": "1850's Daguerrotype", | |
"value": "Daguerrotype", | |
"filters": [ | |
"photography", | |
"digital art" | |
] | |
}, | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let hasBlobConstructor = typeof(Blob) !== 'undefined' && (function () { | |
try { | |
return Boolean(new Blob()); | |
} catch (e) { | |
return false; | |
} | |
}()); | |
let hasArrayBufferViewSupport = hasBlobConstructor && typeof(Uint8Array) !== 'undefined' && (function () { | |
try { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Simple GitHub Webhook Listener | |
express = require 'express' | |
bodyParser = require 'body-parser' | |
crypto = require 'crypto' | |
bufPack = require 'bufferpack' | |
app = express() | |
PORT = process.argv[2] or process.env.PORT or 8081 | |
AUTH_SECRET = process.argv[3] or process.env.SECRET_TOKEN or 'test' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <sys/types.h> | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <unistd.h> | |
#include <string.h> | |
#include <event.h> | |
#include <evhttp.h> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>xAPI Form Example</title> | |
<!-- xAPI base functionality, from: https://github.com/RusticiSoftware/TinCanJS/blob/master/build/tincan-min.js --> | |
<script src="tincan-min.js"></script> | |
<!-- Setting up the xAPI connection from launch data --> | |
<script src="xapi-interface.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const ContrastTools = { | |
relLuminance(rgba) { | |
// http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef | |
var rgb = rgba.slice(); | |
for (var i = 0; i < 3; i++) { | |
var channel = rgb[i] / 255; | |
rgb[i] = channel < .03928 ? channel / 12.92 : Math.pow((channel + .055) / 1.055, 2.4); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useRef, useEffect, useCallback, useState } from "react"; | |
type UpdateHandler = (dt: number) => void; | |
type ContextRenderer = (ctx: CanvasRenderingContext2D) => void; | |
export interface IAnimatedCanvasProps { | |
width: number; | |
height: number; | |
onFrame: UpdateHandler; | |
render: ContextRenderer; |
NewerOlder