Skip to content

Instantly share code, notes, and snippets.

Justin Palmer caged

Block or report user

Report or block caged

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SpaceColonization.hs
data Graph = Graph
{ pointsLeft :: Set.Set (V2 Double)
-- ^ All the points in the whole graph left to be connected
, branches :: Set.Set LineSegment
-- ^ All branches we have found, connecting two points
, currentPoints :: [V2 Double]
-- ^ Points that are currently being processed
, maxDist :: Double
-- ^ Maximum distance a thing can be away from a thing
}
anonymous
anonymous / mapgen.js.coffee
Created Feb 15, 2015
Core algorithm for procedural city generation article (http://www.tmwhere.com)
View mapgen.js.coffee
# author: tmwhere.com
# --- third party dependencies
PIXI = require('pixi.dev')
_ = require('lodash')
noise = require('perlin').noise
Quadtree = require('quadtree').Quadtree
seedrandom = require('seedrandom')
# ---
@nbremer
nbremer / README.md
Last active Feb 13, 2019
Valentine's day Heart curve
View README.md

A heart created with D3 and a nice formula found on Wolfram to celebrate Valentine's Day!

  • The blog can be found here
  • The second example of a heart from one sharp line can be found here
@tamoyal
tamoyal / gist:2ea1fcdf99c819b4e07d
Last active Apr 20, 2019
Upgrade Postgres 9.3 to 9.4 on Ubuntu
View gist:2ea1fcdf99c819b4e07d
# Be sure to save your config files. Optional but I do:
sudo cp /etc/postgresql/9.3/main/postgresql.conf ~
sudo cp /etc/postgresql/9.3/main/pg_hba.conf ~
# Package repo (for apt-get)
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ precise-pgdg main" >> /etc/apt/sources.list.d/postgresql.list'
# Also probably optional but I like to update sources and upgrade
sudo apt-get update
@bbest
bbest / .block
Last active Oct 21, 2019
Aster Plot in D3
View .block
license: mit
height: 300
scrolling: no
border: no
View README.md

A representation of the current time of year using the Sun, Earth, and Moon.

The position of the Earth in orbit around the Sun indicates the hour of year. The Earth itself is a pie chart indicating the second of day. The Moon's position in orbit around the Earth indicates the hour of month. The time is updated every second.

CodePen demo

Copyright 2014 Clay Walker
MIT License

@darrell
darrell / voronoi.sql
Last active Aug 1, 2018
Code to generate Voronoi diagrams in PostGIS using Python. Many thanks to everyone who contributed to this code. Original blog post describing the work is here: http://geogeek.garnix.org/2012/04/faster-voronoi-diagrams-in-postgis.html
View voronoi.sql
CREATE OR REPLACE FUNCTION voronoi(table_name text,geom_col text) returns SETOF record as $$
#############################################################################
#
# Voronoi diagram calculator/ Delaunay triangulator
# Translated to Python by Bill Simons
# September, 2005
#
# Additional changes by Carson Farmer added November 2010
#
View electric-heat
#3de6b1
#22ecf0
#19d1fd
#14b1fd
#2c7fdb
#3d52bf
#6539b3
#a032b2
#d124a9
#fb139c
@bycoffe
bycoffe / README.md
Created Jun 26, 2013
Highlighting with point-in-polygon
View README.md

This code demonstrates how to draw circles on multiple SVGs using d3.js and highlight them by dragging the mouse to draw an enclosing shape.

This is a simplified version of the code used for the Massachusetts special Senate election results on The Huffington Post.

@creationix
creationix / output.log
Created May 8, 2013
Working version of generator async code sample. Using node from https://github.com/andywingo/node/tree/v8-3.19
View output.log
tim@touchsmart:~/Code$ nvm use v0.11.2-generators
Now using node v0.11.2-generators
tim@touchsmart:~/Code$ node --harmony testgen.js
<Buffer 76 61 72 20 66 73 20 3d 20 72 65 71 75 69 72 65 28 27 66 73 27 29 3b 0a 66 75 6e 63 74 69 6f 6e 20 72 65 61 64 46 69 6c 65 28 70 61 74 68 2c 20 65 6e 63 ...>
Sleeping for 2000ms...
Done
You can’t perform that action at this time.