Skip to content

Instantly share code, notes, and snippets.

View benbalter's full-sized avatar
Verified

Ben Balter benbalter

Verified
View GitHub Profile

Keybase proof

I hereby claim:

  • I am benbalter on github.
  • I am benbalter (https://keybase.io/benbalter) on keybase.
  • I have a public key whose fingerprint is 07C6 73FB F30E 01C0 C342 7AB8 DBB6 7C24 6AD3 56C4

To claim this, I am signing this object:

@benbalter
benbalter / jekyll-csv.rb
Created May 27, 2014 22:06
Converts `.csv` files in a `_csvs` directory of a Jekyll site to `site.data` content
require 'csv'
module JekyllCsv
class Generator < Jekyll::Generator
def generate(site)
dir = File.expand_path "_csvs", site.source
return if site.safe && File.symlink?(dir)
entries = Dir.chdir(dir) do
Dir['*.csv']
@benbalter
benbalter / transparency-is-so-08.md
Last active August 29, 2015 14:02
Transparency is so '08: Why treating data as code & collaboration are the next frontier for open gov (Notes from Transparency Camp 2014, http://transparencycamp.org/schedule/2014/transparency-is-so-08-why-treating-data-as-code-co/)

Transparency is so '08: Why treating data as code & collaboration are the next frontier for open gov

Question: Open government is a great first step, but how can we push towards collaborative government, the world's largest and longest-running open source project

Background

  • What differentiates open source from transparency is collaboration: the essential promise that you can see the underlying source code and make things better.
  • PDF of excel spreadsheets are technically transparency, but that's really not good enough.
  • A central promise of open source is not just to see the process, but participate and be able to modify source
  • Nothing -> FOIA -> Open Gov -> (Collaborative Gov?)
@benbalter
benbalter / sam.coffee
Last active August 29, 2015 14:04
Hubot script to interact with the SAM.gov API
# Description:
# Displays our current DUNS number or SAM.gov registration
#
# Configuration:
# You'll need to set HUBOT_GOV_API_TOKEN as an environmental variable.
# To get an token, head over to https://api.data.gov/signup/.
# You just need a name/email combo as it's solely used for rate limiting.
#
# Commands:
# hubot samdotgov me - display's your current Sam.gov registration

GitHub for Government

What is GitHub

  • GitHub is a social network for software developers
  • GitHub is a social layer built on top of a long-standing open source project called Git.
  • At its most basic level, Git simply tracks who made what change when
  • Used by many popular open source projects, bulk of technology you touch on a daily basis built on our platform
  • While it was originally used for collaborative software development, and still is, the collaborative workflow is equally applicable to countless applications including modern open data and open government efforts
  • GitHub hosts projects, commonly referred to as repositories
@benbalter
benbalter / after.txt
Last active August 29, 2015 14:07
Licensee Benchmark
Begining benchmark...
user system total real
Load: 0.000000 0.000000 0.000000 ( 0.000161)
16 licenses loaded
Benchmarking vendored licenses...
user system total real
apache-2.0 0.220000 0.030000 1.610000 ( 0.724164)
artistic-2.0 0.020000 0.000000 0.200000 ( 0.089318)
@benbalter
benbalter / licensee-rugged-benchmark.txt
Created October 2, 2014 16:48
Benchmark of Licensee using Rugged
Begining benchmark...
user system total real
Load: 0.000000 0.000000 0.000000 ( 0.000149)
15 licenses loaded
Benchmarking vendored licenses...
user system total real
agpl-3.0 0.020000 0.000000 0.020000 ( 0.023164)
gpl-2.0 0.000000 0.000000 0.000000 ( 0.000449)
@benbalter
benbalter / example-output.md
Last active August 29, 2015 14:16
Ruby script to check if the status of an export license application (STELA request) has changed and output the result
Status: UNCHANGED
+-------------------+--------------------------+
|             Application XXXX                 |
+-------------------+--------------------------+
| Application Type  | Commodity Classification |
| Review Status     | Completed                |
| Registration Date | 01/01/2015               |
| Completion Date   | 01/02/2015               |
| Final Decision | |
@benbalter
benbalter / Conditionally-load-Google-Analytics.js
Created April 4, 2011 18:34
Conditionally load Google Analytics Tracking Code
//Conditionally load Google Analytics tracking code
//GA code optimized by Html5boiler plate -- https://github.com/paulirish/html5-boilerplate
if ( !window._gat || !window._gat._getTracker ) {
var _gaq=[["_setAccount","UA-XXX-1"],["_trackPageview"]];
(function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];g.async=1;
g.src=("https:"==location.protocol?"//ssl":"//www")+".google-analytics.com/ga.js";
s.parentNode.insertBefore(g,s)}(document,"script"));
}
@benbalter
benbalter / Google-analytics-virtual-event-tracking-code.js
Created April 4, 2011 18:13
Google Analytics virtual event tracking code for external links, downloads, and mailtos using jQuery.
//Mailto tracking code
$('a[href^="mailto\:"]').click(function() {
_gaq.push(['_trackEvent','Email', 'Click', $(this).attr('href') ]);
});
//Download Tracking Code
$('a[href$="zip"],a[href$="pdf"],a[href$="doc"],a[href$="docx"],a[href$="xls"],a[href$="xlsx"],a[href$="ppt"],a[href$="pptx"],a[href$="txt"],a[href$="csv"]').click(function() {
var u = $(this).attr('href'); _gaq.push(['_trackEvent','Download', u.match(/[^.]+$/), u ]);
});