Skip to content

Instantly share code, notes, and snippets.

@akhenakh
akhenakh / tools.py
Created June 19, 2012 14:47
flask jsonify with support for MongoDB from tools import jsonify
try:
import simplejson as json
except ImportError:
try:
import json
except ImportError:
raise ImportError
import datetime
from bson.objectid import ObjectId
from werkzeug import Response
@vincentpham1991
vincentpham1991 / README.md
Created August 17, 2018 00:25 — forked from lunarmoon26/README.md
D3 V5 - Faux-3d Shaded Globe With Zoom, Places and Arcs

A D3 V5 implementation of a shaded globe mimic the 3d effect. Drag to rotate and middle wheel to zoom. The flyer arcs are interpolated from 2 control points.

You can modify the dataset (Topojson format) to change landmarks.

@jdiscar
jdiscar / gist:9144764
Last active November 11, 2020 06:07
RGB Value to Nearest Color Name (Python)
"""
Original Author Ernesto P. Adorio, Ph.D
Original Source: http://my-other-life-as-programmer.blogspot.com/2012/02/python-finding-nearest-matching-color.html
Modifed By: JDiscar
This class maps an RGB value to the nearest color name it can find. Code is modified to include
ImageMagick names and WebColor names.
1. Modify the minimization criterion to use least sum of squares of the differences.
2. Provide error checking for input R, G, B values to be within the interval [0, 255].
@git-ashish
git-ashish / index.html
Created April 23, 2019 15:19
.Astronomy Star Chart
<!DOCTYPE html>
<head>
<meta charset="utf-8">
<script src="https://cdnjs.cloudflare.com/ajax/libs/d3/3.5.17/d3.min.js"></script>
<style>
body {
background: black;
}
@d3noob
d3noob / index.html
Last active August 7, 2021 01:06
Sankey Diagram with v4
<!DOCTYPE html>
<meta charset="utf-8">
<title>SANKEY Experiment</title>
<style>
.node rect {
cursor: move;
fill-opacity: .9;
shape-rendering: crispEdges;
}
const PIE = 3.14;
function f() {
console.log('function f inside module a');
}
function f123() {
//not accessible
}
@vegard
vegard / primes.py
Created September 21, 2018 07:51
Prime factorisation diagram
# -*- coding: utf-8 -*-
#
# Author: Vegard Nossum <vegard.nossum@gmail.com>
import math
import os
import sys
import cairo
@signed0
signed0 / gist:2031157
Created March 13, 2012 19:53
Google Polyline encoder & decoder
'''Provides utility functions for encoding and decoding linestrings using the
Google encoded polyline algorithm.
'''
def encode_coords(coords):
'''Encodes a polyline using Google's polyline algorithm
See http://code.google.com/apis/maps/documentation/polylinealgorithm.html
for more information.
@mbostock
mbostock / .block
Last active August 5, 2023 12:53
Margin Convention
license: gpl-3.0
redirect: https://observablehq.com/@d3/margin-convention
@guypursey
guypursey / .block
Last active September 21, 2023 09:51 — forked from mbostock/.block
Wrapping long labels with D3 v4 (sample data)
license: gpl-3.0