Skip to content

Instantly share code, notes, and snippets.

View donavon's full-sized avatar
🏁
nothing is happening

Donavon West donavon

🏁
nothing is happening
View GitHub Profile
@donavon
donavon / index.js
Created November 21, 2014 01:58
requirebin sketch
// example using the raf module from npm. try changing some values!
var requestAnimationFrame = require("raf")
var canvas = document.createElement("canvas")
canvas.width = 500
canvas.height = 500
document.body.appendChild(canvas)
var context = canvas.getContext("2d")
@donavon
donavon / index.js
Last active August 29, 2015 14:20
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var console = require("consoleit");
var compareVersions = require("compare-versions");
function isBricked(appVersion, brickedVersion) {
brickedVersion = brickedVersion || "0.0.0";
return compareVersions(appVersion, brickedVersion) < 1;
}
@donavon
donavon / index.js
Created April 30, 2015 23:25
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var console = require("consoleit");
var semver = require("semver");
var brickedVer = "1.7.4";
var thisVer = "1.7.3"; // Get this from package.json
var showBrick = semver.lte(thisVer, brickedVer);
console.log("The app will " + (showBrick ? "" : "NOT ") + "show as bricked");
@donavon
donavon / index.js
Last active August 29, 2015 14:20
requirebin sketch
// require() some stuff from npm (like you were using browserify)
// and then hit Run Code to run it on the right
var console = require("consoleit");
var compareVersions = require("compare-versions");
function isBricked(appVersion, brickedVersion) {
return brickedVersion && compareVersions(appVersion, brickedVersion) < 1;
}
var brickedVersion = "1.7.4";
@donavon
donavon / index.js
Last active January 25, 2016 20:01
requirebin sketch
var console = require("consoleit"); // remove when running in Node
var crypto = require("browserify-cipher"); // requiring just "cipher" _should_ work, but doesn't
function encrypt(data, key, algorithm, encoding) {
algorithm = algorithm || "aes256";
encoding = encoding || "base64";
var cipher = crypto.createCipher(algorithm, key);
return cipher.update(data, "utf8", encoding) + cipher.final(encoding);
}
@donavon
donavon / index.js
Last active August 29, 2015 14:25
requirebin sketch
var Keen = require("keen-js");
var client = new Keen({
projectId: "55b29d1b46f9a76aaee2b60c",
readKey: "3b027fb718e707742d4b21a52138cec2a7b2fc03cc61a68d2712ace541ab511b0e79ba7f5807d919d1bba4f0099e9b2de99ac8e082516ad529767a1c70bc5de0efc71a9c0194748a384d57a576c4d487746aa9a0ef34418f41d84a931228d1620cb58c7b005cee1c76190e824b7426c0"
});
Keen.ready(function(){
var query = null;
@donavon
donavon / index.js
Last active August 29, 2015 14:27
requirebin sketch
var crypto = require("crypto");
function encrypt(data, key, algorithm, encoding) {
algorithm = algorithm || "aes256";
encoding = encoding || "base64";
var cipher = crypto.createCipher(algorithm, key);
return cipher.update(data, "utf8", encoding) + cipher.final(encoding);
}
function decrypt(data, key, algorithm, encoding) {
class SignInForm extends React.Component {
constructor() {
super();
this.state = {
username: "",
password: ""
};
}
onChange(key, value) {
@donavon
donavon / test_runner.js
Last active January 22, 2020 23:08 — forked from joakimbeng/test_runner.js
A small and simple Javascript test runner
/**
* A Javascript test runner in 20 lines of code
* From http://joakimbeng.eu01.aws.af.cm/a-javascript-test-runner-in-20-lines/
*/
(function () {
// The test queue:
var tests = [];
// Function to add tests:
this.test = function test (name, cb) {

Slack Etiquette Tips

Here are some guidelines to think about when deciding to use @here or @channel.

@here Here is a funny article about cats

🚫 Ask yourself “is this timely?” No. An article on funny cats will be there tomorrow, but thx for interrupting my meeting.

@here Leaving for Bob’s going away happy hour in 15 mins 🍷