Skip to content

Instantly share code, notes, and snippets.

View benbalter's full-sized avatar
Verified

Ben Balter benbalter

Verified
View GitHub Profile
@benbalter
benbalter / regex.rb
Last active March 5, 2023 03:46
Regular expression to find government domains for websites / email addresses
# regex to match government emails. Should detect:
# foo.gov, foo.mil
# foo.gov.uk, foo.mil.uk
# foo.fed.us
# foo.govt.nz, foo.gc.ca, foo.guv.ro, gub.uy
# note: foo.gouvt, foo.gc, foo.fed.uk, etc. will technically pass, but they are invalid domains
regex = /(\.g[ou]{1,2}(v|b|vt)|\.mil|\.gc|\.fed)(\.[a-z]{2})?$/i
@benbalter
benbalter / README.md
Last active December 20, 2015 02:29 — forked from wboykinm/README.md

Thanks to Ben Balter and others for pointing out that raw geodata (topojson in this case) can be served from github without cross-domain failure the same way that everything else can be served: under the gh-pages umbrella.

@benbalter
benbalter / geojson-conversion.sh
Last active April 23, 2024 13:16
Bulk convert shapefiles to geojson using ogr2ogr
# Bulk convert shapefiles to geojson using ogr2ogr
# For more information, see http://ben.balter.com/2013/06/26/how-to-convert-shapefiles-to-geojson-for-use-on-github/
# Note: Assumes you're in a folder with one or more zip files containing shape files
# and Outputs as geojson with the crs:84 SRS (for use on GitHub or elsewhere)
#geojson conversion
function shp2geojson() {
ogr2ogr -f GeoJSON -t_srs crs:84 "$1.geojson" "$1.shp"
}
@benbalter
benbalter / jekyll-drafts.md
Last active March 12, 2024 07:39
Example of using drafts in Jekyll

Let's say your Jekyll site's directory structure looks like:

|-- _config.yml
|-- _drafts/
|   |-- a-draft-post.md
|-- _layouts/
|   |-- default.html
|-- _posts/
| |-- 2013-05-10-a-published-post
@benbalter
benbalter / excerpt.md
Last active December 15, 2022 20:28
Example of how to use Jekyll's `excerpt` tag.

If your post looked something like:

# Awesome Blog Post

Here is an example post to show how to use the new `excerpt` tag.

The excerpt tag provides a quick and easy way to tease a post by exposing only the first paragraph such as on a blog index page.
@benbalter
benbalter / gist.md
Last active April 21, 2024 15:50
Example of how to embed a Gist on GitHub Pages using Jekyll.

Here's an example of how to embed a Gist on GitHub Pages:

{% gist 5555251 %}

All you need to do is copy and paste the Gist's ID from the URL (here 5555251), and add it to a gist tag surrounded by {% and %}.

@benbalter
benbalter / move-repo.md
Created April 15, 2013 16:33
How to move one repo to another
$ git clone https://github.com/[user]/[source-repo].git
$ cd [source-repo]
$ git remote rm origin
$ git remote add origin https://github.com/[user]/[target repo].git
$ git push -u origin master
@benbalter
benbalter / privacy-policy.md
Last active December 13, 2015 22:59
Privacy Policy and Terms of Service for MyGov

Privacy policy

We hold your privacy in the highest regard. MyUSA collects some anonymous information automatically to help us improve the service (such as what components are being used when), and offers the opportunity for you to provide us with basic personal information (such as your name or address) to help customize your experience and simplify many common tasks. MyUSA has a few fundamental principles:

  1. Your personal information should only be used to improve or customize your experience.
  2. The information you provide is your information and you should have the ultimate say in how it's used.
  3. We'll always ask before we share your information with an agency or other government entity, and unless you say otherwise, will remain private to you (except where required by law).
  4. We never store personal information on our servers unless required for the on-going operation of one of our services.

Generally

[[ -s "$HOME/.rvm/scripts/rvm" ]] && source "$HOME/.rvm/scripts/rvm" # Load RVM into a shell session *as a function*
# Git
alias gs="git status"
alias ga="git add"
alias go="git checkout"
alias gc="git commit"
alias gl="git log --graph --pretty=format:'%Cred%h%Creset -%C(yellow)%d%Creset %s %Cgreen(%cr) %C(bold blue)<%an>%Creset' --abbrev-commit --date=relative"
alias gp="git push"
@benbalter
benbalter / jd-mba.md
Created January 10, 2013 22:38
JD MBA Description

JD/MBAs are skilled: they think strategically; can anticipate, approach, and offer solutions to complex problems; remain detail-oriented while maintaining a "big-picture" understanding of the issue; can speak and write with precision and clarity; are dynamic presenters; and are bright and creative.

[via http://www.reddit.com/r/jdmba]