Skip to content

Instantly share code, notes, and snippets.

View lukecampbell's full-sized avatar

Luke Campbell lukecampbell

View GitHub Profile
initialize: function(options) {
if(options && options.mode) {
this.mode = options.mode
} else {
this.mode = null; // better than an udefined, don't you think?
}
...
@lukecampbell
lukecampbell / notes.md
Created March 10, 2015 14:58
Notes about GLOS HABS Data Portal

Map Page

TOCView

  • Collection of Categories

TOCCategoryItem

@lukecampbell
lukecampbell / cdl.py
Last active August 29, 2015 14:16
CDL Output in Python
def printify(attr):
'''
Returns a prettier version of the attribute
'''
if isinstance(attr, basestring):
return '"%s"' % attr
return attr
def dtype_to_cdl(dtype):
dtype_map = {
"""Module for validating data provider provided NetCDF files against the IOOS
National Glider Data Assembly Center (NGDAC) specification"""
from netCDF4 import Dataset
import os
import sys
import argparse
default_nc_template = u'/Users/kerfoot/code/ioosngdac/nc/template/IOOS_Glider_NetCDF_v2.0.nc'
@lukecampbell
lukecampbell / glider_days.py
Last active August 29, 2015 14:15
Glider Days
#!/usr/bin/env python
'''
glider_days.py
Determines the glider days for a thredds catalog
'''
from dateutil.parser import parse
from datetime import datetime
from thredds_crawler.crawl import Crawl
@lukecampbell
lukecampbell / example.py
Created February 11, 2015 21:48
example python
#!/usr/bin/env python
'''
mymodule.py
what the module does
'''
import sys
import argparse
@lukecampbell
lukecampbell / install_drivers.py
Created January 16, 2015 19:15
Integration testing with Selenium
#!/usr/bin/env python
import requests
from zipfile import ZipFile
import os
import stat
def main(path):
chrome_fo_mac = 'http://chromedriver.storage.googleapis.com/2.13/chromedriver_mac32.zip'
print "Downloading Chrome Driver to", path
zip_file = download_file(chrome_fo_mac, path)
@lukecampbell
lukecampbell / handlebars.sql
Created January 7, 2015 19:32
OOI Data Stuff
--
-- PostgreSQL database dump
--
SET statement_timeout = 0;
SET lock_timeout = 0;
SET client_encoding = 'UTF8';
SET standard_conforming_strings = on;
SET check_function_bodies = false;
SET client_min_messages = warning;
@lukecampbell
lukecampbell / keybase.md
Created January 6, 2015 16:25
Keybase Identity Confirmation

Keybase proof

I hereby claim:

  • I am lukecampbell on github.
  • I am luke_c (https://keybase.io/luke_c) on keybase.
  • I have a public key whose fingerprint is 9B6B 24B2 8A3B CED8 CC7A B912 8BC7 FBC8 DAEC 37C5

To claim this, I am signing this object:

@lukecampbell
lukecampbell / absurd.sql
Created January 5, 2015 14:07
Schema and SQL for the OOI Instrument Naming Tables
DROP TABLE IF EXISTS PlatformNames;
CREATE TABLE PlatformNames(
id SERIAL PRIMARY KEY,
reference_designator TEXT,
array_type TEXT,
array_name TEXT,
site TEXT,
platform TEXT,
assembly TEXT);