Skip to content

Instantly share code, notes, and snippets.


Thomas Gratier ThomasG77

View GitHub Profile
ghoseb /
Created November 14, 2008 18:58
The evolution of a Python Programmer
#Newbie programmer
def factorial(x):
if x == 0:
return 1
return x * factorial(x - 1)
print factorial(6)
#First year programmer, studied Pascal
View requirements.txt
#Sample pip requirements.txt file from:
# latest version of package on PyPI
# package with version specified
Django >= 1.1
RandomEtc / tile.js
Created November 9, 2010 01:25
shape rendering in nodejs with LearnBoost's node-canvas
View tile.js
// node.js geo polygon map tile rendering!
// requires and GeoJSON data files
// e.g.
// data from converted to GeoJSON with GDAL's ogr2ogr
// or from, reprojected too:
// ogr2ogr -f GeoJSON sfbay.js sfbay.shp -t_srs EPSG:4326
var Canvas = require('./vendor/node-canvas/lib/canvas'),
http = require('http'),
fs = require('fs');
ajturner / EncodedPolyline.js
Created November 21, 2010 22:32
Javascript tools for encoding polylines
View EncodedPolyline.js
// PolylineEncoder.js copyright Mark McClure April/May 2007
// This software is placed explicitly in the public
// domain and may be freely distributed or modified.
// No warranty express or implied is provided.
// History:
// V 2.1 July 2007
// Minor modification in distance function to enhance
// speed. Suggested by Joel Rosenberg.
pamelafox /
Last active April 15, 2023 04:53
Python list of country codes, names, continents, capitals, and pytz timezones
countries = [
{'timezones': ['Europe/Andorra'], 'code': 'AD', 'continent': 'Europe', 'name': 'Andorra', 'capital': 'Andorra la Vella'},
{'timezones': ['Asia/Kabul'], 'code': 'AF', 'continent': 'Asia', 'name': 'Afghanistan', 'capital': 'Kabul'},
{'timezones': ['America/Antigua'], 'code': 'AG', 'continent': 'North America', 'name': 'Antigua and Barbuda', 'capital': "St. John's"},
{'timezones': ['Europe/Tirane'], 'code': 'AL', 'continent': 'Europe', 'name': 'Albania', 'capital': 'Tirana'},
{'timezones': ['Asia/Yerevan'], 'code': 'AM', 'continent': 'Asia', 'name': 'Armenia', 'capital': 'Yerevan'},
{'timezones': ['Africa/Luanda'], 'code': 'AO', 'continent': 'Africa', 'name': 'Angola', 'capital': 'Luanda'},
{'timezones': ['America/Argentina/Buenos_Aires', 'America/Argentina/Cordoba', 'America/Argentina/Jujuy', 'America/Argentina/Tucuman', 'America/Argentina/Catamarca', 'America/Argentina/La_Rioja', 'America/Argentina/San_Juan', 'America/Argentina/Mendoza', 'America/Argentina/Rio_Gallegos', 'America/Argentina/Ushuai
tokumine / redis_pool.js
Created June 12, 2011 15:38
A pool implementation for redis in node.js. 1 pool per redis database.
View redis_pool.js
var redis = require('redis')
, Pool = require('generic-pool').Pool;
var RedisPool = {
// Acquire resource.
// - `database` {String} redis database name
// - `callback` {Function} callback to call once acquired. Takes the form
// `callback(err, resource)`
acquire: function(database, callback) {
coolaj86 /
Last active April 17, 2023 19:19
How to publish packages to NPM

Getting Started with NPM (as a developer)

As easy as 1, 2, 3!


  • Aug, 08, 2022 update config docs for npm 8+
  • Jul 27, 2021 add private scopes
  • Jul 22, 2021 add dist tags
  • Jun 20, 2021 update for --access=public
  • Sep 07, 2020 update docs for npm version
mboersma / yaml2json
Last active October 18, 2022 20:21
YAML to JSON one-liner
View yaml2json
python3 -c 'import sys, yaml, json; y=yaml.safe_load(; print(json.dumps(y))'
kevinfjbecker / bfs.html
Created December 27, 2011 16:16
Breadth-first Graph Traversal in JavaScript
View bfs.html
<!DOCTYPE html>
<meta charset=utf-8 />
<title>A Graph</title>
<!--[if IE]>
<script src=""></script>
article, aside, figure, footer, header, hgroup,
mourner / TileLayer.Common.js
Created February 11, 2012 23:11
Leaflet shortcuts for common tile providers
View TileLayer.Common.js
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {, this.url, options);
(function () {