Skip to content

Instantly share code, notes, and snippets.

View colllin's full-sized avatar

Collin Kindrom colllin

View GitHub Profile
@colllin
colllin / 1 - Find UTM Zone of source data .sh
Last active May 25, 2022 22:08
GDAL: Convert from UTM Zone to Lat/Lon (EPSG:4326)
$ gdalsrsinfo source.shp
PROJ.4 : '+proj=utm +zone=34 +south +datum=WGS84 +units=m +no_defs '
OGC WKT :
PROJCS["WGS_1984_UTM_Zone_34S",
GEOGCS["GCS_WGS_1984",
DATUM["WGS_1984",
SPHEROID["WGS_84",6378137,298.257223563]],
PRIMEM["Greenwich",0],
@colllin
colllin / jupyter_notebook_config.py
Created September 20, 2017 20:57
Jupyter Example of c.NotebookApp.login_handler_class
# From https://github.com/vlimant/caltech-jupyter/blob/0b113c4aac26d41a35c82c8214351b89b6e80ae5/jupyter/jupyter_notebook_config.py
import os
import json
# Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Configurable configuration
#------------------------------------------------------------------------------
@colllin
colllin / gist:12d77e03b6b6f717d5d1fe15b75bf2d4
Created August 3, 2016 18:36
Auth0 `Get User` database action script NO-OP
function getByEmail (email, callback) {
// This script should retrieve a user profile from your existing database,
// without authenticating the user.
// It is used to check if a user exists before executing flows that do not
// require authentication (signup and password reset).
//
// There are three ways this script can finish:
// 1. A user was successfully found. The profile should be in the following
// format: https://auth0.com/docs/user-profile
// callback(null, profile);
@colllin
colllin / gist:22bc2bb79a842116e18c73b0e6a2368f
Created August 3, 2016 18:36
Auth0 `Login` database action script NO-OP
function login (email, password, callback) {
// This script should authenticate a user against the credentials stored in
// your database.
// It is executed when a user attempts to log in or immediately after signing
// up (as a verification that the user was successfully signed up).
// The `password` parameter of this function is in plain text. It must be
// hashed/salted to match whatever is stored in your database. For example:
// if (bcrypt.compareSync(password, dbPasswordHash)) { ... }
//
// There are three ways this script can finish:
@colllin
colllin / FilepickerPickAndStoreDialog.js
Created November 2, 2015 17:28
React Component for Filepicker.io pickAndStore dialog
import React from 'react';
import $ from 'jquery';
// Accepts these props:
// `apiKey` - Your Filepicker.io API key.
// `onSuccess` - A callback that receives (blobs) upon pickAndStore success.
// `onError` - A callback that receives (error) upon pickAndStore error. Note that a user-initiated cancel triggers an error with {code: 101}.
// `onCancel` - A callback that is triggered when the user closes/cancels the dialog. If `onCancel` is passed, it will be called instead of onError in the event of a user-initiated cancel.
// `onProgress` - A callback that receives (progress) upon pickAndStore progress.
class FilepickerPickAndStoreDialog extends React.Component {
@colllin
colllin / README.md
Last active August 29, 2015 14:22
Reactive Leaflet Wrapper for Meteor (Readme-driven development)

This Meteor package wraps Leaflet in a reactive API.

The following methods have been added to the L.Map class:

isDragging()

returns true or false and is reactive.

getCenterState()

(function() {
Backbone.Events.autorun = function(f, context) {
if (!this.__autorunHandles) this.__autorunHandles = [];
var backboneContext = this;
var handle = Tracker.autorun(function() {
Tracker.currentComputation.__backboneContext = backboneContext;
f();
});
this.__autorunHandles.push(handle);
return handle;
@colllin
colllin / gist:adf4626cc3e38391e5f7
Last active August 29, 2015 14:12
Meteor Shell -- collection.deny does not validate server writes
> Polygons.deny({update: function() { return true; }});
> p=Polygons.findOne();
{ _id: '74iGubCqxB29ZF2tJ',
geom:
{ type: 'Polygon',
coordinates: [ [Object] ],
type2: 'Polygonal' },
tags: {} }
> Polygons.update({_id: p._id}, {$set: {'geom.type2': 'Polygonify'}})
1
@colllin
colllin / _affixWithinContainer.md
Last active November 29, 2020 17:13
ion-list sticky headers

What this does:

Within an <ion-scroll>, this directive creates sticky item headers that get bumped out of the way by the next item.

Demo: http://cl.ly/2u2X390s0H1a

Requirements:

  • Needs UnderscoreJS for its _.throttle utility.
  • Must be used within an or
@colllin
colllin / gist:8321227
Created January 8, 2014 17:56
Meteor.js Custom Publish Function example
Meteor.publish('user-stats', function() {
var initializing = true;
var userStats = [];
var aYearAgo = moment().utc().subtract({years: 1});
var aQuarterAgo = moment().utc().subtract({months: 3});
var aMonthAgo = moment().utc().subtract({months: 1});
var defaultAggregation = {
wins: 0,