Skip to content

Instantly share code, notes, and snippets.

View demographus's full-sized avatar

demographus demographus

View GitHub Profile
@benjchristensen
benjchristensen / index.html
Created August 9, 2011 05:38
Simple Sparkline using SVG Path and d3.js
<html>
<head>
<title>Simple Sparkline using SVG Path and d3.js</title>
<script src="http://mbostock.github.com/d3/d3.v2.js"></script>
<style>
/* tell the SVG path to be a thin blue line without any area fill */
path {
stroke: steelblue;
stroke-width: 1;
fill: none;
@mbostock
mbostock / .block
Last active October 27, 2024 19:53
Spinny Globe
license: gpl-3.0
redirect: https://observablehq.com/@d3/rotating-orthographic
@ns-1m
ns-1m / gist:2296532
Created April 4, 2012 00:04
PHP Spatialite to GeoJSON
<?php
/**
* Spatialite to GeoJSON
It needs:
* apache2
* php5-cli
* php5-sqlite
@bycoffe
bycoffe / LICENSE
Last active March 13, 2022 18:37
D3.js world map with force layout
Copyright (c) 2016 Aaron Bycoffe
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
@jasonfarrell
jasonfarrell / usage.js
Last active February 23, 2021 22:15
Checks if a DOM element is visible. Takes into consideration its parents and overflow.
var my_element = document.getElementById('my-element');
//-- Returns true/false
my_element.isVisible(my_element);
@potfur
potfur / $.js
Last active February 15, 2023 14:49
window.S = function(s) {
return document[{
'#': 'getElementById',
'.': 'getElementsByClassName',
'@': 'getElementsByName',
'=': 'getElementsByTagName'}[s[0]]
|| 'querySelectorAll'](s.slice(1))
};
// [S('#header'), S('.container'), S('?div')]
@ofca
ofca / $.3.js
Last active March 2, 2025 15:05
// based on https://gist.github.com/Potfur/5576225 & https://github.com/james2doyle/saltjs
// more info: https://plus.google.com/109231487156400680487/posts/63eZzzrBSb6
window.$ = function(s) {
var c = {
'#': 'ById',
'.': 'sByClassName',
'@': 'sByName',
'=': 'sByTagName'}[s[0]];
return document[c?'getElement'+c:'querySelectorAll'](s.slice(1))
};
@jczaplew
jczaplew / postgis2geojson.py
Last active March 23, 2023 19:08
A tool for extracting data from PostGIS into GeoJSON and TopoJSON. UPDATE: Added a dedicated repo for contributions - https://github.com/jczaplew/postgis2geojson
'''
A simple tool for exporting from a PostGIS table to GeoJSON and TopoJSON. Assumes Python 2.7+,
psycopg2, and TopoJSON are already installed and in your PATH.
Adapted from Bryan McBride's PHP implementation
(https://gist.github.com/bmcbride/1913855/)
by John Czaplewski | [email protected] | @JJCzaplewski
TODO:
- Add argument for SRS
@maggiben
maggiben / i8n.js
Last active January 11, 2021 23:52
I8N (Internacionalization) Module fast easy and jQuery independent
////////////////////////////////////////////////////////////////////////////////
// @file : i8n.js //
// @summary : Internacionalization module //
// @version : 0.1 //
// @project : i8n //
// @description : //
// @author : Benjamin Maggi //
// @email : [email protected] //
// @date : 7 Mar 2014 //
// -------------------------------------------------------------------------- //
@bennadel
bennadel / code-1.htm
Created March 25, 2014 12:09
Extending Window To Create A Dynamic Scope Chain For Method Execution In JavaScript
<!DOCTYPE html>
<html>
<head>
<title>Extending Window To Create A Dynamic Scope Chain</title>
<script type="text/javascript">
// I return a function with a "scope" property that can be
// used to alter the runtime bindings of the functions.
var getFoo = (function(){