Skip to content

Instantly share code, notes, and snippets.

View abonello's full-sized avatar

Anthony Bonello abonello

View GitHub Profile
@abonello
abonello / .block
Last active May 22, 2018 05:57
My Petals
license: mit
@abonello
abonello / .block
Last active May 22, 2018 07:14
enterAppend
license: mit
@abonello
abonello / print_filter.js
Created June 16, 2018 05:59 — forked from ls404/print_filter.js
print crosfilter results in console
/**
* Created by user on 18/05/17.
*/
// Super useful for debug in web console
function print_filter(filter){
var f=eval(filter);
if (typeof(f.length) != "undefined") {}else{}
if (typeof(f.top) != "undefined") {f=f.top(Infinity);}else{}
if (typeof(f.dimension) != "undefined") {f=f.dimension(function(d) { return "";}).top(Infinity);}else{}
console.log("DC DEBUG: "+filter+"("+f.length+") = "+JSON.stringify(f).replace("[","[\n\t").replace(/}\,/g,"},\n\t").replace("]","\n]"));
@abonello
abonello / print_filter.js
Created June 16, 2018 05:59 — forked from xhinking/print_filter.js
Crossfilter & dc filter printer source: codeproject
function print_filter(filter) {
var f=eval(filter);
if (typeof(f.length) != "undefined") {}else{}
if (typeof(f.top) != "undefined") {f=f.top(Infinity);}else{}
if (typeof(f.dimension) != "undefined") {f=f.dimension(function(d) { return "";}).top(Infinity);}else{}
console.log(filter+"("+f.length+") = "+JSON.stringify(f).replace("[","[\n\t").replace(/}\,/g,"},\n\t").replace("]","\n]"));
}
function isPrime(num) {
let prime = true;
for (let d = 2; d <=
Math.sqrt(num); d++) {
if (num % d == 0) {
prime = false;
break;
}
}
@abonello
abonello / LeapYear.js
Created June 16, 2018 06:01 — forked from ls404/LeapYear.js
Leap year finder
function isLeap(x) {
let leap = (x % 4 == 0 && x % 100 != 0) || x % 400 == 0;
console.log(leap ? "yes" : "no");
}
isLeap(['2016']);
data.forEach(function(d) {
var tempDate = new Date(d.date); // turn string to date
d.date = tempDate; // pop it back to overwrite the string.
});
WEBGL // p5 WEBGL rendering mode.
createCanvas(w, h, renderer) // Creates a 3D canvas (if renderer is WEBGL).
// Primitives
plane(width, height) // Creates a plane in 3D space. Equivalent to rect() in the default rendering mode.
plane(width, height, detailX, detailY) // Creates a plane in 3D space with the number of triangle subdivisions specified.
box(width) // Creates a cube in 3D space.
box(width, height, depth) // Creates a cuboid in 3D space.
box(width, height, depth, detailX, detailY) // Creates a cuboid in 3D space with triangle subdivisions.
sphere(radius) // Creates a sphere in 3D space.
@abonello
abonello / django_cheat_sheet.md
Created November 29, 2018 12:19 — forked from bradtraversy/django_cheat_sheet.md
Django command cheat sheet

Django 2.x Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder

python -m venv ./venv
@abonello
abonello / django_cheat_sheet.md
Created November 29, 2018 12:19 — forked from bradtraversy/django_cheat_sheet.md
Django command cheat sheet

Django 2.x Cheat Sheet

Creating a virtual environment

We need to create a virtual env for our app to run in: More Here Run this command in whatever folder you want to create your venv folder

python -m venv ./venv