Skip to content

Instantly share code, notes, and snippets.

@akre54
akre54 / renderer.ts
Created February 1, 2023 21:39
TheatreJS keyframes and WebMMuxer video encoding
import { createRafDriver, ISheet, val } from '@theatre/core'
import WebMMuxer from 'webm-muxer'
export const rafDriver = createRafDriver({ name: 'Hubble rAF driver' })
export const useRenderer = ({
sheet,
fps = 30,
bitrate = 1e6,
}: {
@akre54
akre54 / clean_svg.js
Last active October 13, 2024 13:22
TouchDesigner SVG to SOP and After Effects Bodymovin / Lottie to TD-friendly SVG
const fs = require('node:fs');
const cp = require('node:child_process');
const path = require('node:path');
const { optimize } = require('svgo');
const renderSvg = require('lottie-to-svg');
const paper = require('paper');
const { JSDOM } = require('jsdom');
const svgFlatten = require('svg-flatten');
@akre54
akre54 / .gitignore
Last active September 27, 2021 14:18
Alert me when my car is towed
.env
node_modules/
*.png
@akre54
akre54 / index.js
Last active October 4, 2017 05:52
requirebin sketch
// Welcome! require() some modules from npm (like you were using browserify)
// and then hit Run Code to run your code on the right side.
// Modules get downloaded from browserify-cdn and bundled in your browser.
const React = require('react');
const ReactDOM = require('react-dom');
let interval
const COUNT = 20
import supercluster from 'supercluster'
import tilebelt from 'tilebelt'
import { max } from 'd3-array'
import db from './db'
import getMarkers from './markers'
const MIN_ZOOM = 1
const MAX_STATE_ZOOM = 7
const MAX_COUNTY_ZOOM = 9
@akre54
akre54 / README.md
Created July 8, 2015 15:27
Reflux REST mixin

Call actions on stores RESTfully:

// C
BotActions.save(null, {name: 'Curly', age: 26}); // POST a model without an id

// R
BotActions.fetch(); // GET the whole Collection

BotActions.fetch(2); // GET a single model by id
@akre54
akre54 / .gitignore
Last active October 27, 2015 13:23
Backbone deps test
node_modules
out.js*
@akre54
akre54 / typing.coffee
Created April 3, 2015 20:00
Get a notification when a user starts and stops typing on the passed-in `el`.
# Get a notification when a user starts and stops typing on the passed-in `el`.
#
# Based on https://github.com/narfdotpl/jquery-typing
module.exports = (el, {delay, start, stop}) ->
delay ||= 400
typing = false
timeout = null
@akre54
akre54 / react-svg-patch.coffee
Last active November 23, 2015 18:02
React SVG element monkeypatch
ReactDOM = require 'react/lib/ReactDOM'
ReactElement = require 'react/lib/ReactElement'
ReactElementValidator = require 'react/lib/ReactElementValidator'
SVGDOMPropertyConfig = require 'react/lib/SVGDOMPropertyConfig'
MUST_USE_ATTRIBUTE = DOMProperty.injection.MUST_USE_ATTRIBUTE
createFactory = if __DEV__
ReactElementValidator.createFactory
else
ReactElement.createFactory
@akre54
akre54 / backbone.fetch.js
Last active November 22, 2023 19:10
Backbone.ajax with window.fetch
var defaults = function(obj, source) {
for (var prop in source) {
if (obj[prop] === undefined) obj[prop] = source[prop];
}
return obj;
}
var stringifyGETParams = function(url, data) {
var query = '';
for (var key in data) {