Skip to content

Instantly share code, notes, and snippets.

View benjiwheeler's full-sized avatar

Benjamin Wheeler benjiwheeler

View GitHub Profile
@benjiwheeler
benjiwheeler / zip2tz.csv
Last active August 13, 2017 18:42
Zip to Time Zone csv
We can't make this file beautiful and searchable because it's too large.
'00501','Holtsville','NY','America/New_York'
'00544','Holtsville','NY','America/New_York'
'01001','Agawam','MA','America/New_York'
'01002','Amherst','MA','America/New_York'
'01003','Amherst','MA','America/New_York'
'01004','Amherst','MA','America/New_York'
'01005','Barre','MA','America/New_York'
'01007','Belchertown','MA','America/New_York'
'01008','Blandford','MA','America/New_York'
'01009','Bondsville','MA','America/New_York'
@benjiwheeler
benjiwheeler / .gitignore
Last active May 10, 2017 17:49
.gitignore canonical
# originally copied from https://help.github.com/articles/ignoring-files
# i manually keep this in sync with https://gist.github.com/benjiwheeler/d100b0c4ed7fbce3dfce
# Compiled source #
###################
*.com
*.class
*.dll
*.exe
*.o
@benjiwheeler
benjiwheeler / Gemfile
Last active July 22, 2016 03:24
Gemfile canonical
#######################################
# CANONICAL GEMS
# lives at https://gist.githubusercontent.com/brw12/d508024dcd7e230e4a88/raw/2e65efe2a145dda7ee51d1741299f848e5bf752e/Gemfile
#######################################
#######################################
# CORE SETUP
#######################
# core setup
source 'https://rubygems.org'
@benjiwheeler
benjiwheeler / angularJsonDataService.js
Last active May 18, 2016 16:45
Angular Service to share JSON data among controllers
// data.json could look like:
// {
// "menu": [{"name": "Contact Us"}, {"name": "About Us"}]
// }
// app.js could look like:
var app = angular.module('myApp');
app.factory('commonData', ['$http', '$q', function($http, $q){
<html>
<head>
<!-- Pleace this snippet right after opening the head tag to make it work properly -->
<!-- This code is licensed under GNU GPL v3 -->
<!-- You are allowed to freely copy, distribute and use this code, but removing author credit is strictly prohibited -->
<!-- Generated by http://insider.zone/tools/client-side-url-redirect-generator/ -->
<!-- REDIRECTING STARTS -->
<link rel="canonical" href="http://destinationsitehere.com"/>
@benjiwheeler
benjiwheeler / navMenuCtrl.js
Created November 18, 2015 17:42
Angular navigation menu controller from Begin to Code
// see the very bottom of http://angular-rails.com/find_and_browse.html
// by omitting second parameter, we tell angular we're looking for existing module.
var controllers = angular.module('basicControllers');
controllers.controller('NavMenuCtrl', ['$scope', '$stateParams', '$state', 'ProgramCache',
function($scope, $stateParams, $state, ProgramCache) {
// variables
$scope.menuStates = []; // all of the menu items, each a complete state
// IMPORTANT: we are binding global program service to local program scope!
// this lets us update menu item content on the fly, since our template will be digested.
@benjiwheeler
benjiwheeler / route.js
Created November 18, 2015 17:40
Angular route/state file from Begin to Code
app.config(['$stateProvider', '$urlRouterProvider', '$locationProvider',
function($stateProvider, $urlRouterProvider, $locationProvider) {
$stateProvider.state('root', {
url: '/',
templateUrl: 'root.html',
controller: 'RootCtrl'
})
.state('program', {
url: '/program/:program_id',
@benjiwheeler
benjiwheeler / txt
Created September 25, 2015 00:24
The one thing I'd most like to remind myself
"Be who you are and say what you feel, because those who mind don't matter and those who matter don't mind."
--Bernard Baruch
@benjiwheeler
benjiwheeler / NSLayoutConstraint+Init.swift
Created July 7, 2015 14:13
NSLayoutConstraint+Init.swift
//
// NSLayoutConstraint+Init.swift
// Created by Benjamin Wheeler starting 6/2013
//
//
import UIKit
// improves the clarity and flexibility of NSLayoutConstraint
extension NSLayoutConstraint {
@benjiwheeler
benjiwheeler / rect.html
Created June 10, 2015 16:49
Processing simple rectangle in javascript
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/processing.js/1.4.9/processing.js"></script>
</head>
<body>
<div>
<canvas id="canvas" width="600" height="600" />
</div>
The content of the body element is displayed in your browser.