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
<!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
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; |
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
Moved to: https://github.com/dcollien/mp4filechecker/blob/master/src/index.ts |
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
<html> | |
<head> | |
<title>Simple xAPI Example</title> | |
<script src="tincan-min.js"></script> | |
</head> | |
<body> | |
<p>This is an xAPI Example</p> | |
<button type="button" id="complete-button">Send Completion Statement</button> | |
<span id="status"></span> | |
<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
import time | |
import urllib.parse | |
import hmac | |
import hashlib | |
import base64 | |
SB_NAME = "ol-events" | |
EH_NAME = "ol-user-metrics" | |
SAS_NAME = "collect-user-metric" | |
SAS_VALUE = "EXAMPLE-TOKEN" |
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
from datetime import datetime | |
import re | |
import string | |
def to_course_code(course_path, creation_date): | |
""" | |
Turns a course path into a short course code. | |
Max 14 characters (but likely under 10). | |
Not guaranteed to be unique | |
but has month/year of creation date, and single character hash |
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 uncurry = (fn) => (...args) => args.reduce((fn, arg) => fn(arg), fn); | |
const curry = (fn) => { | |
const collect = (args, arg) => { | |
const collected = args.concat([arg]); | |
return ( | |
collected.length >= fn.length | |
? fn.apply(null, collected) | |
: collect.bind(null, collected) | |
); | |
}; |
NewerOlder