Skip to content

Instantly share code, notes, and snippets.

View Fordi's full-sized avatar

Bryan Elliott Fordi

View GitHub Profile
@Fordi
Fordi / ShaperDomino.jsx
Last active September 24, 2023 00:24 — forked from anonymous/shaper-dots.svg
Print an 11"x8.5" page of fiducial markers for the Shaper Origin. Download this SVG and open it in your browser to use it. PageUp/PageDown to change pages. Demo: http://fordi.org/shaper-dots.svg
import React from 'react';
/**
* Convert a number into a 12-digit binary number string
*/
const dots = num => {
const n = num.toString(2).padStart(12, 0).split('').slice(0, 12);
return `1${n.substr(0, 6)}11${n.substr(6)}1`;
};
/**
* See generateShaperNumbers.js to see how this is generated.
@Fordi
Fordi / mean_presidents_day.js
Last active February 20, 2018 05:41 — forked from anonymous/dates.js
Calculating the average of our Presidents' birthdays.
const CURRENT_YEAR = new Date(new Date().getFullYear(), 0, 0, 0, 0, 0, 0);
const DAY = 1000 * 60 * 60 * 24;
const dates = ['Feb 22', 'Oct 30', 'Apr 13', 'Mar 16', 'Apr 28', 'July 11', 'Mar 15', 'Dec 5', 'Feb 9', 'Mar 29', 'Nov 2', 'Nov 24', 'Jan 7', 'Nov 23', 'Apr 23', 'Feb 12', 'Dec 29', 'Apr 27', 'Oct 4', 'Nov 19', 'Oct 5', 'Mar 18', 'Aug 20', 'Jan 29', 'Oct 27', 'Sep 15', 'Dec 28', 'Nov 2', 'July 4', 'Aug 10', 'Jan 30', 'May 8', 'Oct 14', 'May 29', 'Aug 27', 'Jan 9', 'July 14', 'Oct 1', 'Feb 6', 'June 12', 'Aug 19', 'July 6', 'Aug 4', 'June 14'];
const months = ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];
const TAU = Math.PI * 2;
const getDayNum = d => {
let diff = +new Date(d) - CURRENT_YEAR;
return Math.floor(diff / DAY);
};
@Fordi
Fordi / index.html
Last active August 29, 2015 14:18 — forked from TheMcMurder/index.html
<html>
<head>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap-responsive.css" rel="stylesheet">
<link href="http://getbootstrap.com/2.3.2/assets/css/bootstrap.css" rel="stylesheet">
<script src="http://d3js.org/d3.v3.min.js"></script>
<script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
</head>
<div class="page-header">
<center>
@Fordi
Fordi / lzw.js
Last active March 3, 2019 04:05 — forked from anonymous/lzw.js
export const lzw = {
decode: str => {
var i, code, phrase,
dict = {},
chr = str[0],
last = chr,
out = [chr],
next = 256;
for (i = 1; i < str.length; i++) {
code = str[i].charCodeAt(0);
/**
The idea here is that all changes to your new object can be observed
*/
Ember.View.extend({
model: Ember.StalkableObject.create(),
saveModel: Ember.observer(function () {
/** do some fancy stuff to save changes to your model */
}, 'model.@properties')
});