Skip to content

Instantly share code, notes, and snippets.

@mertonium
mertonium / embed_scripts.html
Created Jul 26, 2012
Embed scripts for Own The Vote
View embed_scripts.html
<!-- User-selected issues -->
<script data-electnext>
(function() {
var script = document.createElement('script');
script.type = 'text/javascript';
script.async = true;
script.src = 'http://electnext.com/widget/v2.js?key=dae517d92ae38ee6e8c48a23401f52a75a10b362';
var entry = document.getElementsByTagName('script')[0];
entry.parentNode.insertBefore(script, entry);
@mertonium
mertonium / appconfig.json
Created Nov 15, 2011
Config file for the Public Art Finder
View appconfig.json
{
"_id": "appconfig",
"doc_type": "config",
"city_name": "San Francisco",
"brought_to_you_by": "SF Arts Commision",
"google_analytics": "UA-XXXXXXXX-X"
}
@mertonium
mertonium / massupload.js
Created Sep 12, 2011
Node.js script that loads a CSV into a Couch. I used it to upload a stop_times.txt file from the Twin Cities GTFS feed.
View massupload.js
var csv = require('csv'),
cradle = require('cradle');
var docs = [];
var successCount = 0,
failCount = 0,
curproc = 0,
throttle = 5;
View boston_public_art.json
[
{
"rmt":"276/0",
"latitude":"42.325384",
"longitude":"-71.075201",
"markername":"orange",
"opts":{
"title":"Roxbury Friendship Fence"
},
"text":"<div class=\"gmap-popup\"></div>"
@mertonium
mertonium / tcase_transform.js
Created Aug 16, 2011
Recline transform to Title Case
View tcase_transform.js
function(doc) {
doc['clean_address'] = doc['ALL_meSSed_uP_addr'].toLowerCase().replace(/\b[a-z]/g, function() { return arguments[0].toUpperCase();});
return doc;
}
@mertonium
mertonium / categoryexcluder.php
Created Aug 13, 2011
Copy of the default WordPress category widget - but you can pass a list of IDs to exclude. (Children categories will be excluded as well)
View categoryexcluder.php
<?php
/*
Plugin Name: Category Excluder
Plugin URI: https://gist.github.com/1143511
Description: Added a way to pass a list of IDs to be excluded from the default Wordpress Categories widget.
Author: @mertonium
Version: 0.1
Author URI: http://mertonium.com
*/
/**
@mertonium
mertonium / philly311_scraper.rb
Created May 5, 2011
This script cycles through the Philly311 Knowledgebase, devouring FAQs.
View philly311_scraper.rb
#!/usr/bin/env ruby
###############################################################################
# Philly Open311 Knowledgebase Scraper
###############################################################################
require 'nokogiri'
require "net/http"
require "uri"
require "CSV"
@mertonium
mertonium / couchdb_replicator.php
Created Apr 19, 2011
Replicates all the dbs from one couch instance to another
View couchdb_replicator.php
<?php
// Config variables
define("FULL_OVERWRITE", true);
$source_couch = "http://yourcouchinstance.com";
$destination_couch = "http://yourothercouchinstance.com";
// Counter
$db_count = 0;
// Time check (we'll use this later)
@mertonium
mertonium / couchapp_mass_installer.php
Created Apr 19, 2011
Little php script to install the same couch app on a bunch of dbs in the same instance
View couchapp_mass_installer.php
<?php
// Configure control variables
$couch_url = "http://yourcouchinstance.com";
$path_to_couchapp = "/local_path_to/couchapp/";
// Counter
$db_count = 0;
// Time check (we'll use this later)
$start_ts = time();
You can’t perform that action at this time.