Skip to content

Instantly share code, notes, and snippets.

@julescarbon
julescarbon / cities.json
Created January 28, 2014 19:17
Cities w/ lat lngs and timezones
window.CITIES=[{"city":"Aberdeen","state":"","country":"Scotland","lat":57.1,"lng":-2.1,"tz_time":0},{"city":"Adelaide","state":"","country":"Australia","lat":-34.9,"lng":138.6,"tz_time":9.5},{"city":"Algiers","state":"","country":"Algeria","lat":36.8,"lng":3,"tz_time":1},{"city":"Amsterdam","state":"","country":"Netherlands","lat":52.3,"lng":4.8,"tz_time":1},{"city":"Ankara","state":"","country":"Turkey","lat":39.9,"lng":32.9,"tz_time":2},{"city":"Asunción","state":"","country":"Paraguay","lat":-25.2,"lng":-57.6,"tz_time":-4},{"city":"Athens","state":"","country":"Greece","lat":37.9,"lng":23.7,"tz_time":2},{"city":"Auckland","state":"","country":"New Zealand","lat":-36.8,"lng":174.7,"tz_time":12},{"city":"Bangkok","state":"","country":"Thailand","lat":13.7,"lng":100.5,"tz_time":7},{"city":"Barcelona","state":"","country":"Spain","lat":41.3,"lng":2.1,"tz_time":1},{"city":"Beijing","state":"","country":"China","lat":39.9,"lng":116.4,"tz_time":8},{"city":"Belém","state":"","country":"Brazil","lat":-1.4,"lng":
@julescarbon
julescarbon / gist:8309086
Created January 7, 2014 23:49
checkerboard
t /= 700
x=(t+x/8)|0
y=(t+y/8)|0
if (xor(x%2, y%2)) gray(x+y)
else gray(b+g+r)
a+=cosp(t)*30
// with http://distilleryimage6.ak.instagram.com/3477a9e25e4311e3ab2b12f292af6a15_8.jpg
t -= 100000 // or so
t /= 500
if (a == 0) { r = g = b = x; t /= -3 }
else if (r > 0) { t/=r/4 }
r *= (Math.sin(t*x/y) + 1)/2
g *= (Math.cos(t*y/x) + 0.4)/2
b *= (Math.sin(t) + 1.5)/2
a = b
y += x
PI = Math.PI
sin = function(a){return Math.sin(a)}
cos = function(a){return Math.cos(a)}
v = cos(sin(x/w*PI*2-PI/2)+cos(y/h*PI*2+PI)+t/6666)*127+127
thick = 50
b = v //((v/thick)|0)*thick
x += (v = cos(sin(x/w*PI*2-PI/2)+cos(y/h*PI*2+PI)+t/6666)*127+127)
y += x
PI = Math.PI
sin = function(a){return Math.sin(a)}
cos = function(a){return Math.cos(a)}
v = cos(sin(x/w*PI*2-PI/2)+cos(y/h*PI*2+PI)+t/6666)*127+127
thick = 50
b = v //((v/thick)|0)*thick
x += (v = cos(sin(x/w*PI*2-PI/2)+cos(y/h*PI*2+PI)+t/6666)*127+127)
@julescarbon
julescarbon / csh.mouse.js
Created December 9, 2013 04:24
trigger random mouse events on a csh.bz url
javascript:(function ani(){ requestAnimationFrame(ani);
Mouse.x = ~~(Math.random() * window.innerWidth);
Mouse.y = ~~(Math.random() * window.innerHeight)
})()
@julescarbon
julescarbon / moodify.js
Created March 17, 2013 21:15
Bookmarklet, turns all image links in an Apache directory listing into IMG tags. Examples: http://cd.textfiles.com/gifsgalore/GIFS/ABSTRACT/ http://www.tommoody.us/images/may08/
javascript:(function(){var az = document.getElementsByTagName("a"); for (var i in az) { az[i].innerHTML = "<img src='" + az[i].href + "'>"; } })()
@julescarbon
julescarbon / gist:3908811
Created October 17, 2012 22:43
condensed description example
<style>
.short { display: block; }
.short .more { font-weight: bold; cursor: pointer; }
.long { display: none; }
.long .less { font-weight: bold; cursor: pointer; }
</style>
{{#events}}
<p>{{name}}</p>
<span class="description">
@julescarbon
julescarbon / gist:3908103
Created October 17, 2012 20:52
The code tag as it was intended
<script>$($("code").each(function(){ $(this).html( $(this).html().replace(/</g,"&lt;") ) }))</script>
<code>
<i>i buy water</i>
</code>
@julescarbon
julescarbon / gist:3900730
Created October 16, 2012 17:29
bookmarklet: strip commas #textmeme
javascript:(function () {
function getTextNodesIn(node, includeWhitespaceNodes) {
var textNodes = [], whitespace = /^\s*$/;
function getTextNodes(node) {
if (node.nodeType == 3) {
if (includeWhitespaceNodes || !whitespace.test(node.nodeValue)) {
textNodes.push(node);
}
} else {
for (var i = 0, len = node.childNodes.length; i < len; ++i) {