Skip to content

Instantly share code, notes, and snippets.

Brenton Simpson appsforartists

View GitHub Profile
@appsforartists
appsforartists / MyComponent.tsx
Last active Jul 19, 2018
Snippets showing how to use -webkit-canvas to make a paint worklet work in Safari
View MyComponent.tsx
/** @license
* Copyright 2016 - 2017 Google LLC. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View mixins.ts
export type Constructor<T> = new(...args: any[]) => T;
export interface B {
fromB(): void;
}
export function withB<T extends Constructor<object>>(superclass: T): Constructor<B> {
return class B extends superclass {
fromB() {
@appsforartists
appsforartists / adk.js
Last active Jan 9, 2017
Testing Android Accessory Development Kit in JavaScript
View adk.js
/** @license
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View midi-file-parser.log
{time: 0, note: 61, velocity: 97}
{time: 106, note: 61, velocity: 0}
{time: 150, note: 61, velocity: 102}
{time: 1408, note: 44, velocity: 85}
{time: 1410, note: 56, velocity: 81}
{time: 1412, note: 37, velocity: 79}
{time: 1414, note: 53, velocity: 105}
{time: 1504, note: 53, velocity: 0}
{time: 1506, note: 44, velocity: 0}
{time: 1520, note: 37, velocity: 0}
@appsforartists
appsforartists / App.ts
Created Nov 24, 2016
Attempting drag in Cycle.js
View App.ts
/** @license
* Copyright 2016 - present The Material Motion Authors. All Rights Reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy
* of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
View dragstream WIP
function pointersStream = function(target) {
return Rx.Observable.from(
[
'pointerdown',
'pointermove',
'pointerup',
].map(
type => Rx.Observable.fromEvent(target, type)
)
).mergeAll().filter(
@appsforartists
appsforartists / TeleportableMotion.jsx
Created Feb 10, 2016
Sample usage for Motion.onRest
View TeleportableMotion.jsx
/* Copyright 2016 Google Inc.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@appsforartists
appsforartists / Default (OSX).sublime-keymap
Last active Sep 27, 2018
Brenton's Keybindings (Mac)
View Default (OSX).sublime-keymap
[
{"keys": ["super+up"], "command": "swap_line_up"},
{"keys": ["super+down"], "command": "swap_line_down"},
{"keys": ["option+up"], "command": "select_lines", "args": {"forward": false}, "context": [
{"key": "setting.is_sublimerge_view", "operator": "equal", "operand": false, "match_all": true}
]},
{"keys": ["option+down"], "command": "select_lines", "args": {"forward": true}, "context": [
{"key": "setting.is_sublimerge_view", "operator": "equal", "operand": false, "match_all": true}
]},
@appsforartists
appsforartists / gist:7b6e78e84ddddbe0ecf3
Created Oct 1, 2014
Prototyping context local storage in JavaScript
View gist:7b6e78e84ddddbe0ecf3
/* Problem:
* Building an isomorphic app with Webpack makes it hard to share dynamic
* data between the client and server. If you're running multiple apps in
* parallel, you can't use globals because they'll collide. You could
* probably come up with something that involves caching them to the
* filesystem and requiring it from the right places, but serializing
* dynamic data to the filesystem is gross.
*
* This is a proof of concept demonstrates two instances of View, each with
* their own parallel instance of settings, thanks to some call stack
@appsforartists
appsforartists / settings.js
Created Sep 10, 2014
Bug in DefinePlugin?
View settings.js
// …
// SERVER_IP is defined in Webpack, since the client can't run my-local-ip
"API_BASE_URL": "http://" + (require("my-local-ip")() || SERVER_IP) + ":8082/",
// …
/* this is being exported from webpack as:
// SERVER_IP is defined in Webpack, since the client can't run my-local-ip
"API_BASE_URL": "http://" + (__webpack_require__(197)() || (192.168.10.106)) + ":8082/",
You can’t perform that action at this time.