Skip to content

Instantly share code, notes, and snippets.

View dgaitsgo's full-sized avatar

David Gaitsgory dgaitsgo

View GitHub Profile
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.
@MoritzStefaner
MoritzStefaner / frustrations.tsv
Created March 17, 2017 20:50
Text answers from the dataviz survey 2017 by Elijah Meeks et al.
We can make this file beautiful and searchable if this error is corrected: No tabs found in this TSV file in line 0.
""
Comp
""
Getting data into the right format/place to do analysis & vis
Poor data governance
Antiquated data architecture
Try to be data driven- but our data efforts aren't consistent
firewalls preventing the movement of data and marketing professionals with no analytical knowledge
""
The lack of time to do original data journalism: lack of proper training and opportunity to expand skills into coding.
@kawanet
kawanet / material-colors.json
Last active October 22, 2025 10:01
Material Design Style Color Palette as JSON
{
"red": {
"50": "#ffebee",
"100": "#ffcdd2",
"200": "#ef9a9a",
"300": "#e57373",
"400": "#ef5350",
"500": "#f44336",
"600": "#e53935",
"700": "#d32f2f",
@joecritch
joecritch / MyComponent.js
Last active September 29, 2021 15:16
Passing specific props in React / JSX
class MyComponent extends React.Component {
render() {
const {location, todos, users} = this.props;
//
// ... do things with your variables!
//
return (
<MyChild {...{location, todos, user}} />
// equivalent to:
// <MyChild location={location} todos={todos} user={user} />
@brumm
brumm / bookmarklet.js
Last active October 4, 2025 01:09
Find out which element is scrolling
javascript:!function() { var slice = Array.prototype.slice; function throttle(type, name, obj) { obj = obj || window; var running = false; var func = function() { if (running) { return; } running = true; requestAnimationFrame(function() { obj.dispatchEvent(new CustomEvent(name)); running = false; }); }; obj.addEventListener(type, func); } slice .call(document.querySelectorAll("*")) .filter( e => e.scrollWidth > e.offsetWidth || e.scrollHeight > e.offsetHeight ) .filter(e => { var style = window.getComputedStyle(e); return [style.overflow, style.overflowX, style.overflowY].some( e => e === "auto" || e === "scroll" ); }) .forEach(e => { var color = Math.floor(Math.random() * 16777215).toString(16); e.style.backgroundColor = "#" + color; throttle("scroll", "optimizedScroll", e); e.addEventListener("scroll", event => { console.log("%c[scroll]", "color: white; background-color:#" + color, event.target); }); }); }()
@stefanschmidt
stefanschmidt / convert-md-pdf.sh
Last active October 12, 2022 07:30
Convert Markdown to PDF with custom page size and margins
# depends on Calibre (available via Homebrew Cask)
ebook-convert \
doc.md doc.pdf \
--extra-css=style.css \
--margin-left 72 \
--margin-right 72 \
--margin-bottom 72 \
--margin-top 72 \
--custom-size 8.5x11 \
--disable-font-rescaling \
@joyrexus
joyrexus / README.md
Last active July 26, 2018 21:13
Block thumbnail HOWTO

So you're using gistup to create gists (and blocks) from the command line. If not, see this tutorial for a quick overview.

And now you want to add thumbnails to your gists so that your blocks portfolio looks all pretty, right. How?

To have a thumbnail associated with your gist you need to create a 230x120 pixel PNG image file named thumbnail.png and include this at the top-level of your gist's repo (generated by gistup).

The main trick is in finding an appropriate image and then right-sizing it for the 230x120 dimensions that the blocks site expects your thumbnail.png to

@semperos
semperos / clj->js.clj
Created January 22, 2012 19:43
ClojureScript to JavaScript (from mmcgrana)
(defn clj->js
"Recursively transforms ClojureScript maps into Javascript objects,
other ClojureScript colls into JavaScript arrays, and ClojureScript
keywords into JavaScript strings."
[x]
(cond
(string? x) x
(keyword? x) (name x)
(map? x) (.strobj (reduce (fn [m [k v]]
(assoc m (clj->js k) (clj->js v))) {} x))