Skip to content

Instantly share code, notes, and snippets.

@lmullen
lmullen / shapefile.r
Last active January 26, 2022 22:07
How I use shapefiles in R with ggplot2 and RGDAL
library(rgdal) # R wrapper around GDAL/OGR
library(ggplot2) # for general plotting
library(ggmaps) # for fortifying shapefiles
# First read in the shapefile, using the path to the shapefile and the shapefile name minus the
# extension as arguments
shapefile <- readOGR("path/to/shapefile/", "name_of_shapefile")
# Next the shapefile has to be converted to a dataframe for use in ggplot2
shapefile_df <- fortify(shapefile)
@chrislkeller
chrislkeller / backup-requirements.sh
Last active April 12, 2021 10:09
A couple quick bash scripts so I can keep virtualenvs somewhat consistent across machines. backup-requirements.sh exports requirements files for each virtualenv, names the files for the virtualenv and sends them to a date-versioned directory. install-requirements.sh loops through a directory of requirements files and checks to see if a virtualen…
#!/bin/bash
# grab the virtualenvwrapper settings
export WORKON_HOME=$HOME/.virtualenvs
export PIP_VIRTUALENV_BASE=$WORKON_HOME
export PIP_RESPECT_VIRTUALENV=true
# the location of your virtualenv wrapper shell script may differ
source /usr/local/share/python/virtualenvwrapper.sh
@joyrexus
joyrexus / README.md
Last active May 3, 2024 10:41 — forked from liamcurry/gist:2597326
Vanilla JS equivalents of jQuery methods

Sans jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@sjenkinsdc
sjenkinsdc / scripttest.php5
Created October 21, 2013 16:03
SAXOTECH/NEWSCYCLE Sample template to demonstrate passing variables to a $S script
// ==========================================================================================
// File: /scripts/scripttest/scripttest.php5
// Desc: for testing vars
// Author: Stacey Jenkins
// Date: 10/14/2013
//
// ==========================================================================================
$title = $SOSE->GetVar("Title");
$substrlen1 = $SOSE->GetVar("substrlen1");
$substrlen2 = $SOSE->GetVar("substrlen2");
@chrislkeller
chrislkeller / crowdsourced-map-functions
Created August 5, 2013 20:07
A series of Google Apps Scripts I use to automate some aspects of making crowdsourced maps...
// Add the ID of the spreadsheet here
var spreadsheetID = '0An8W....';
// Add the name of the sheet here
var workingSheetID = 'working_spreadsheet';
// Add the table ID of the fusion table here
var tableIDFusion = '0An8W....';
// key needed for fusion tables api
@Mao8a
Mao8a / fix-to-iOS-iframe-height-issue.html
Created July 10, 2013 05:21
HTML: Fix to iOS iframe height issue
Fix to iOS iframe height issue
<iframe id="stupid-iframe" height="200" src="a-file.html"></iframe>
<html>
<body>
<div class="iframe-wrapper" style="width: 100%; height: 200px; overflow: auto; -webkit-overflow-scrolling: touch;">
</div>
</body>
require.config({
// enforceDefine: true,
// urlArgs: 'bust=' + (new Date()).getTime(),
waitSeconds: 3,
paths: {
'text': '../components/requirejs-text/text',
'classes': '../scripts/classes',
'jquery': '../components/jquery/jquery',
'jquery.mobile': '../components/jquery-mobile/jquery.mobile',
'jquery.mobileConfig': '../scripts/jquery.mobileConfig',
@schwanksta
schwanksta / parse_scotus.py
Created March 27, 2013 20:41
Quick and dirty script to parse a Supreme Court transcript and output a JSON file of [speaker, words]
import re
import json
ws_re = re.compile("\s+")
line_num_re = re.compile("\s\d+\s{2,}", re.M)
# first, pdftotext -layout <pdf> <text>
with open("12-307_jnt1.txt", "r") as f:
data = f.read()
@desandro
desandro / require-js-discussion.md
Created January 31, 2013 20:26
Can you help me understand the benefit of require.js?

I'm having trouble understanding the benefit of require.js. Can you help me out? I imagine other developers have a similar interest.

From Require.js - Why AMD:

The AMD format comes from wanting a module format that was better than today's "write a bunch of script tags with implicit dependencies that you have to manually order"

I don't quite understand why this methodology is so bad. The difficult part is that you have to manually order dependencies. But the benefit is that you don't have an additional layer of abstraction.


@criccomini
criccomini / gist:3805436
Created September 29, 2012 23:50
Schedules & Scores API for Streaming Live Sports Stats - MSNBC
import pytz
import datetime
import time
import urllib2
import json
import os
import elementtree.ElementTree as ET
# e.g. http://scores.nbcsports.msnbc.com/ticker/data/gamesMSNBC.js.asp?jsonp=true&sport=MLB&period=20120929
url = 'http://scores.nbcsports.msnbc.com/ticker/data/gamesMSNBC.js.asp?jsonp=true&sport=%s&period=%d'