Skip to content

Instantly share code, notes, and snippets.

@crofty
crofty / gist:2693517
Created May 14, 2012 11:41
Upgrade Postgres data dir to 9.1
pg_upgrade --old-bindir=/usr/local/Cellar/postgresql/9.0.4/bin --new-bindir=/usr/local/bin -d /usr/local/var/postgres.old -D /usr/local/var/postgres
@crofty
crofty / index.html
Last active October 22, 2021 08:24
A example of using Google Map tiles with the Leaflet mapping library - http://matchingnotes.com/using-google-map-tiles-with-leaflet
<!DOCTYPE html>
<html>
<head>
<title>Leaflet</title>
<link rel="stylesheet" href="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.css" />
<script src="http://cdn.leafletjs.com/leaflet-0.3.1/leaflet.js"></script>
<script src="http://maps.google.com/maps/api/js?v=3.2&sensor=false"></script>
<script src="http://matchingnotes.com/javascripts/leaflet-google.js"></script>
</head>
<body>
@crofty
crofty / leaflet-google.js
Created March 25, 2012 15:07
Leaflet plugin that enables the use of Google Map tiles - http://matchingnotes.com/using-google-map-tiles-with-leaflet
/*
* L.TileLayer is used for standard xyz-numbered tile layers.
*/
L.Google = L.Class.extend({
includes: L.Mixin.Events,
options: {
minZoom: 0,
maxZoom: 18,
tileSize: 256,
[{"coordinates":[-1.6680859374999955,52.45372550146754],"type":"Point"},{"coordinates":[-6.1285351562499955,49.825107569391875],"type":"Point"},{"coordinates":[2.6605273437500045,55.16746859594897],"type":"Point"}]
@crofty
crofty / observer example.js
Created February 8, 2012 12:12
Example of observers in Ember
App = Ember.Application.create()
Person = Ember.Object.extend({
fullName: Ember.computed(function() {
var firstName = this.get('firstName');
var lastName = this.get('lastName');
return firstName + ' ' + lastName;
}).property('firstName', 'lastName')
});
@crofty
crofty / index.html
Created January 30, 2012 17:47
Transition a circle between a series of points
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="http://mbostock.github.com/d3/d3.js?1.27.1"></script>
</head>
<body>
<div id='vis'></div>
<script type="text/javascript">
var circle, h, j, points, svg, transition, w, x, y;
@crofty
crofty / gist:1544053
Created December 31, 2011 13:51
Remove mp3 files of size <500K
find . -name '*.mp3' -size -500k -exec rm -f {} \;
# Remove m3u
find . -name '*.m3u' -exec rm -f {} \;
<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8">
<title>UK Map</title>
<script type="text/javascript" src="http://d3js.org/d3.v3.min.js"></script>
<style type="text/css">
svg {
width: 500px;
height: 500px;
@crofty
crofty / gist:1364521
Created November 14, 2011 17:26
Start chrome with access to local files
open /Applications/Google\ Chrome.app --args -allow-file-access-from-files
@crofty
crofty / memcached_
Created October 27, 2011 19:58
Memcached plugin for munin
#!/usr/bin/perl
# -*- cperl -*-
#
# Plugin to monitor memcache statistics
#
# This module has 3 seperate graph datasets:
# rates
# bytes
# counters
#