Skip to content

Instantly share code, notes, and snippets.

View joemaddalone's full-sized avatar

Joe Maddalone joemaddalone

View GitHub Profile
@joemaddalone
joemaddalone / bounce-array
Last active December 26, 2020 16:11
bounce in a two-dimensional array
export function* bounce(arr) {
let x = 0;
let y = 0;
let mx = 1;
let my = 1;
const w = arr.length - 1;
const h = arr[0].length - 1;
while (true) {
if (mx + x > w || mx + x < 0) {
mx = mx * -1;
@joemaddalone
joemaddalone / gist:4e824df3a15d8ecd1d7066d486cab833
Last active July 11, 2020 22:27
filltext example w/o pretty & callback
{
"rows" : "100",
"id" : "{index}",
"active" : "{bool}",
"fname" : "{firstName}",
"lname" : "{lastName}",
"category" : "[13,16,19,21]",
"tel" : "{phone}",
"address" : "{addressObject}",
"cc" : "{ccObject}",
@joemaddalone
joemaddalone / filltextGist
Last active April 25, 2020 09:26
gist example for filltext.com
{
"rows" : "!",
"id" : "{index}",
"active" : "{bool}",
"fname" : "{firstName}",
"lname" : "{lastName}",
"category" : "[13,16,19,21]",
"tel" : "{phone}",
"address" : "{addressObject}",
"cc" : "{ccObject}",
{
"htmli": {
"prefix": "htmli",
"body": "<link rel=\"import\" href=\"$0\" />",
"description": ""
},
"wat": {
"prefix": "wat",
"body": "attachedCallback(){\n\t$0\n}",
"description": ""
{
"editor.snippetSuggestions": "top",
"editor.insertSpaces": false,
"editor.minimap.enabled": false,
"editor.hideCursorInOverviewRuler": true,
"editor.fontFamily": "Fira Code",
"editor.fontLigatures": true,
"workbench.colorTheme": "Afterglow",
"window.zoomLevel": 2,
"workbench.iconTheme": "vs-seti",
const Map = ({list, key, children}) => {
const child = React.Children.only(children);
const Item = child.type;
return list.map((item, index) => {
const keyed = Object.assign({key: item[key] || index}, item)
return React.createElement(Item, keyed);
})
};

index.html

<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>Setup</title>
</head>
<body>
  <div id="app"></div>
@joemaddalone
joemaddalone / cg-animation
Last active August 29, 2015 14:05
cg-animate.md
# CG #
> #### Overall Issues: ####
* Performance on lower powered devices when animating & retrieving data in parallel.
* Intercept route changes, navigate + trigger: false
* identify end state as next view's initial state
* Possible library http://ricostacruz.com/jquery.transit/
* Add explorer viewstate to Session variable
* Can *n* number of genes be shown at the same time with current drawing utils?
@joemaddalone
joemaddalone / abbrevify
Created March 22, 2014 16:46
find unique abbreviations from array... did not end up needing or completing this, but might be useful later
function abbevify(items,targetLength,pos,obj){
var obj = obj || {},
pos = pos || 1,
arr = items.slice(0),
t = arr[0].substring(0, pos)
if(!obj[t]){
obj[t] = arr.shift();
pos=1
}