Skip to content

Instantly share code, notes, and snippets.

Matthew Conlen mathisonian

Block or report user

Report or block mathisonian

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View index.md

Setting value on a variable just defines its initial value, if you want a variable that updates derived variables are available:

[var name:"x" value:1 /]
[derived name:"dataToBeCharted" value:`[ {x: 0, y: 0.5}, {x: 3.5, y: 0.5}, {x: 4, y: x}, {x: 4.5, y: 2}, {x: 5, y: 0.5}, {x: 8, y: 0.5} ]` /]

[Range value:x min:0 max:100 step:5/]
[Display value:x /]
View requirify-browser.js
!function e(r,o,t){function n(a,s){if(!o[a]){if(!r[a]){var u="function"==typeof require&&require;if(!s&&u)return u(a,!0);if(i)return i(a,!0);throw new Error("Cannot find module '"+a+"'")}var d=o[a]={exports:{}};r[a][0].call(d.exports,function(e){var o=r[a][1][e];return n(o?o:e)},d,d.exports,e,r,o,t)}return o[a].exports}for(var i="function"==typeof require&&require,a=0;a<t.length;a++)n(t[a]);return n}({1:[function(e,r){function o(e,r){if("function"!=typeof r)throw new Error("Bad callback given: "+r);if(!e)throw new Error("No options given");var a=e.onResponse;if(e="string"==typeof e?{uri:e}:JSON.parse(JSON.stringify(e)),e.onResponse=a,e.verbose&&(o.log=i()),e.url&&(e.uri=e.url,delete e.url),!e.uri&&""!==e.uri)throw new Error("options.uri is a required argument");if("string"!=typeof e.uri)throw new Error("options.uri must be a string");for(var s=["proxy","_redirectsFollowed","maxRedirects","followRedirect"],d=0;d<s.length;d++)if(e[s[d]])throw new Error("options."+s[d]+" is not supported");if(e.callback=r,e.meth
@mathisonian
mathisonian / spec.json
Created Jan 19, 2017
An example vega spec
View spec.json
{
"schema": {
"language": "vega",
"version": "3.0"
},
"width": 500,
"height": 200,
"padding": 5,
"data": [
{
View index.js
document.body.style.margin = 0;
document.body.style.padding = 0;
const width = window.innerWidth;
const height = window.innerHeight;
const canvas = document.body.appendChild(document.createElement('canvas'))
const fit = require('canvas-fit');
const bezier = require('bezier');
@mathisonian
mathisonian / index.js
Last active Sep 9, 2016
requirebin sketch
View index.js
document.body.style.margin = 0;
document.body.style.padding = 0;
const width = window.innerWidth;
const height = window.innerHeight;
const canvas = document.body.appendChild(document.createElement('canvas'))
const fit = require('canvas-fit');
const bezier = require('bezier');
@mathisonian
mathisonian / model.js
Created Sep 17, 2014
mimicking an array data type with sequelize.js
View model.js
var MyModel = sequelize.define('MyModel', {
myArrayField: {
type: DataTypes.STRING,
get: function() {
return JSON.parse(this.getDataValue('myArrayField'));
},
set: function(val) {
return this.setDataValue('myArrayField', JSON.stringify(val));
}
}
View .gitignore
# Logs
logs
*.log
# Runtime data
pids
*.pid
*.seed
# Directory for instrumented libs generated by jscoverage/JSCover
View test.js
var Lightning = require('lightning.js');
var lightning = new Lightning();
lightning.lineStreaming([1,1,2,3,5,8,13,21])
.then(function(viz) {
viz.open()
setInterval(function() {
viz.appendData([Math.random()]); // appends to existing data
@mathisonian
mathisonian / index.js
Last active Aug 14, 2016
2 copies of react
View index.js
//
// dependencies looks like
// {
// "react": "X.Y.Z",
// "victory": "X.Y.Z"
// }
//
exports.decorateTerm = (Term, { React, notify }) => {
@mathisonian
mathisonian / index.js
Last active Aug 14, 2016
hyperterm plugin test
View index.js
exports.decorateTerm = (Term, { React, notify }) => {
// this library calls require('react') internally
const Spinner = require('react-spinner');
return class extends React.Component {
render () {
const children = [];
children.push(React.createElement(Term, Object.assign({}, this.props, { key: 'key1' })));
You can’t perform that action at this time.