Skip to content

Instantly share code, notes, and snippets.

View riccardoscalco's full-sized avatar
🐢
Thinking slowly

Riccardo Scalco riccardoscalco

🐢
Thinking slowly
View GitHub Profile
@tomstove
tomstove / europe.topo.json
Created April 25, 2013 12:53
UK Satellite Projection D3
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@phobson
phobson / horizon2.py
Last active March 14, 2017 16:03
Milla's version of horizons in python
import numpy as np
import matplotlib.pyplot as plt
def makeLayer(y, height):
neg=0.0
pos=0.0
if y > 0:
if y - height >= 0:
pos = height
y -= pos
@idbrii
idbrii / example.sh
Created March 1, 2011 18:43
example for How to 'git remote add' and track a branch in the same filesystem
#! /bin/sh
# Script to provide answer for question:
# http://stackoverflow.com/questions/5149872/how-to-git-remote-add-and-track-a-branch-in-the-same-filesystem
echo create origin
mkdir origin
cd origin/
git init --bare
cd ..
@widged
widged / index.html
Last active April 15, 2021 16:26
Rapid implementation of a ternary plot with d3js
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>D3 Ternary Plot</title>
<style>
line.axis {
stroke-width: 2;
stroke: #363636;
}
const vertex = `
attribute vec2 a_position;
attribute vec3 a_barycentric;
uniform mat3 u_matrix;
varying vec3 vbc;
void main() {
vbc = a_barycentric;
gl_Position = vec4((u_matrix * vec3(a_position, 1)).xy, 0, 1);
}`
@mbostock
mbostock / .block
Last active November 22, 2022 23:32
Line Transition
license: gpl-3.0
@mattdesl
mattdesl / MeshCustomMaterial.js
Last active April 5, 2023 08:41
Custom mesh standard material with glslify + ThreeJS r83dev
const glslify = require('glslify');
const path = require('path');
// This is the original source, we will copy + paste it for our own GLSL
// const vertexShader = THREE.ShaderChunk.meshphysical_vert;
// const fragmentShader = THREE.ShaderChunk.meshphysical_frag;
// Our custom shaders
const fragmentShader = glslify(path.resolve(__dirname, 'standard.frag'));
const vertexShader = glslify(path.resolve(__dirname, 'standard.vert'));
@mbostock
mbostock / README.md
Last active June 7, 2023 18:33
Underscore’s Equivalents in D3

Collections

each(array)

Underscore example:

_.each([1, 2, 3], function(num) { alert(num); });
@patricksurry
patricksurry / README.md
Last active June 17, 2023 09:48 — forked from mbostock/README.md
D3JS quadtree nearest neighbor algorithm

This example adapts mbostock's quadtree brushing demo to find the nearest neighbor (shown red) of a new point (shown yellow). Choose a new point to classify by clicking on the diagram. (An alternative approach for nearest neighbors of the mouse position is D3's Voronoi polygons, but the idea here would extend to rapidly classifying many new points against a base collection of points.)

We use a data-dependent order of recursion through the quadtree

@mbostock
mbostock / .block
Last active July 8, 2023 20:00
SVG foreignObject Example
license: gpl-3.0