Skip to content

Instantly share code, notes, and snippets.

Tim Wisniewski timwis

Block or report user

Report or block timwis

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@timwis
timwis / gdrivecms.php
Created Sep 19, 2012
GDriveCMS allows you to use Google Docs' familiar interface for adding content to a mobile-optimized web page. Simply create a Google Document with whatever content you want, publish it to the web (in the File menu), and render it through this script.
View gdrivecms.php
<?php
/* GDriveCRM
Created by Tim Wisniewski (timwis.com)
GDriveCMS allows you to use Google Docs' familiar interface for adding content to a mobile-optimized web page.
Simply create a Google Document with whatever content you want, publish it to the web (in the File menu),
and render it through this script.
1. Create a document in Google Drive (Google Docs)
2. Go to File > Publish to the web
3. Click Start Publishing & check Automatically republish
4. Grab the document link (URL) in that dialog
@timwis
timwis / ratchetscrollfix.css
Created Jan 8, 2013
Ratchet/junior leverages `-webkit-overflow-scrolling` but seems to have a bug on Safari Mobile when you drag the header and then try to scroll the body. This CSS reverts to standard scrolling with a fixed-position header.
View ratchetscrollfix.css
/* Fix scrolling */
body, .content, #app-container { position: static; } /* #app-container is for junior */
.content { -webkit-overflow-scrolling: auto; }
header + .content { padding-top: 44px; }
header + .content-padded { padding-top: 55px; }
.bar-title .title + [class*="button"]:last-child { top: 5px; } /* From ratchet.css, overridden by junior.css */
@timwis
timwis / gist:5554718
Last active Dec 17, 2015
Integrate filepicker.io with Wordpress' Jetpack contact form plugin
View gist:5554718

Installation

  1. Go to Plugins > Editor
  2. Select Jetpack by Wordpress.com at the top-right
  3. Select jetpack/modules/contact-form.php from the list of files on the right (changes the directory)
  4. Select jetpack/modules/contact-form/grunion-contact-form.php from the list of files on the right
  5. Search case 'date'
  6. Below that case and before default, add the following case, replacing ***API-KEY-GOES-HERE*** with your filepicker.io API key, and adding any other filepicker.io rules (mime types, file size, etc.) as attributes
@timwis
timwis / gist:5786397
Created Jun 15, 2013
ATV Election Data Modifier
View gist:5786397
<?php
ini_set('memory_limit', '-1');
define("FILE_IN", "2012_PRIMARY_SPECIAL.txt");
define("FILE_OUT", "2012_PRIMARY_SPECIAL_mod.csv");
define("FILE_IN_DELIMITER", "\t");
error_reporting(E_ERROR);
if( ($file = fopen(FILE_IN, 'r')) === FALSE ) {
die('Unable to open file ' . FILE_IN);
}
@timwis
timwis / gist:6539220
Last active Dec 22, 2015
Tax balance API data structure
View gist:6539220
/**
* /taxbalances/883309000
*/
{
status: "success",
data: {
property: {
account_number: "883309000"
},
balances: [
@timwis
timwis / gist:7882901
Created Dec 9, 2013
Convert between 4326 and 2272 with Proj4js. Written by @davewalk. Uses http://trac.osgeo.org/proj4js/
View gist:7882901
convertCoordinates: function (coords) {
Proj4js.defs['EPSG:2272'] = '+proj=lcc +lat_1=40.96666666666667 +lat_2=39.93333333333333 +lat_0=39.33333333333334 +lon_0=-77.75 +x_0=600000 +y_0=0 +ellps=GRS80 +datum=NAD83 +to_meter=0.3048006096012192 +no_defs';
var source = new Proj4js.Proj('EPSG:4326');
var dest = new Proj4js.Proj('EPSG:2272');
var point = new Proj4js.Point(-75.163789, 39.952335);
Proj4js.transform(source, dest, point);
return point;
}
View gist:d4ce0ffb3f2f616ef892
<iframe src="http://www.phila.gov/openbudget/" width="100%" height="700" frameborder="0"></iframe>
View gist:8ab6607d8f744e70437c
swagger: "2.0"
info:
description: |
Locations of Indego bike share stations in Philadelphia
**Endpoint:** http://api.phila.gov/bike-share-stations/v1
version: "1.0"
title: Bike Share Stations
@timwis
timwis / gist:f24586ace7e43d6c6145
Created May 3, 2015
Election results kimono modification script
View gist:f24586ace7e43d6c6145
function transform(data) {
var newCandidates = [];
var raceIndex = -1; // start at -1 since first index is 0
// Loop through candidates
data.results.candidates.forEach(function(row, index) {
if(row.candidate === 'Candidate Name') {
raceIndex++;
} else {
row.race = data.results.races[raceIndex].race;
View healthy_chinese_takeout.geojson
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
You can’t perform that action at this time.