Skip to content

Instantly share code, notes, and snippets.

View dmajka's full-sized avatar

Dan Majka dmajka

  • The Nature Conservancy
  • Madison, WI
View GitHub Profile
@allixender
allixender / make_cog_from_tiff.sh
Created October 29, 2022 12:17
Make proper GeoTiff COG with overviews through GDAL
#!/bin/bash
# https://trac.osgeo.org/gdal/wiki/CloudOptimizedGeoTIFF
input=$1
output=$2
oversample="nearest" # or nearest, average
gdal_translate $1 interm_step1.tif -co TILED=YES -co COMPRESS=DEFLATE
@maptiler
maptiler / globalmaptiles.py
Created August 13, 2018 10:37
globalmaptiles.py
#!/usr/bin/env python
###############################################################################
# $Id$
#
# Project: GDAL2Tiles, Google Summer of Code 2007 & 2008
# Global Map Tiles Classes
# Purpose: Convert a raster into TMS tiles, create KML SuperOverlay EPSG:4326,
# generate a simple HTML viewers based on Google Maps and OpenLayers
# Author: Klokan Petr Pridal, klokan at klokan dot cz
# Web: http://www.klokan.cz/projects/gdal2tiles/
@adactio
adactio / minimal-serviceworker.js
Last active August 18, 2023 09:15
An attempt at a minimal viable service worker.
// Licensed under a CC0 1.0 Universal (CC0 1.0) Public Domain Dedication
// http://creativecommons.org/publicdomain/zero/1.0/
// HTML files: try the network first, then the cache.
// Other files: try the cache first, then the network.
// Both: cache a fresh version if possible.
// (beware: the cache will grow and grow; there's no cleanup)
const cacheName = 'files';
@sgillies
sgillies / advanced_rasterio_features.ipynb
Last active October 19, 2024 17:20
Advanced Rasterio features notebook
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@joshdover
joshdover / README.md
Last active September 28, 2023 21:38
Idiomatic React Testing Patterns

Idiomatic React Testing Patterns

Testing React components seems simple at first. Then you need to test something that isn't a pure interaction and things seem to break down. These 4 patterns should help you write readable, flexible tests for the type of component you are testing.

Setup

I recommend doing all setup in the most functional way possible. If you can avoid it, don't set variables in a beforeEach. This will help ensure tests are isolated and make things a bit easier to reason about. I use a pattern that gives great defaults for each test example but allows every example to override props when needed:

@jserrao
jserrao / custom-search-acf-wordpress.php
Last active May 15, 2024 15:30 — forked from charleslouis/custom-search-acf-wordpress.php
PHP - Wordpress - Search - wordpress custom search function that encompasses ACF/advanced custom fields and taxonomies and split expression before request. I updated this original script with better documentation and XSS / SQL injection support.
/*
##############################
########### Search ###########
##############################
Included are steps to help make this script easier for other to follow
All you have to do is add custom ACF post types into Step 1 and custom taxonomies into Step 10
I also updated this work to include XSS and SQL injection projection
[list_searcheable_acf list all the custom fields we want to include in our search query]
@return [array] [list of custom fields]
@peterdesmet
peterdesmet / 88c30be4-1063-11e5-a9ae-0e853d047bba.md
Last active March 16, 2018 14:29
Bird migration forward trajectory visualizations in CartoDB
@gka
gka / make-tile-urls.py
Last active August 26, 2022 06:27
python script to generate a list of projected tiles
#
# you might want to run this first:
#
# pip install pyproj mercantile
#
from pyproj import Proj
import mercantile
mercator = Proj('+proj=merc +a=6378137 +b=6378137 +lat_ts=0.0 +lon_0=0.0 +x_0=0.0 +y_0=0 +k=1.0 +units=m +nadgrids=@null +wktext +over +no_defs')
albers = Proj('+proj=aea +lat_1=29.5 +lat_2=45.5 +lat_0=37.5 +lon_0=-96 +x_0=0 +y_0=0 +ellps=sphere +towgs84=0,0,0,0,0,0,0 +units=m +no_defs +nadgrids=@null')
@dannyko
dannyko / Readme.md
Last active August 29, 2015 14:06
Rainflow

Rainflow

Gradient flow example using bilinear interpolation of matrix map of Earth altitudes.

For this example, I computed the gravitational force field from a gradient of a 2-D potential energy function, in this case a bilinearly interpolated matrix map of average altitudes of the Earth at every degree (a 180-by-360 dataset).

This global elevation dataset is included with Matlab and is available by running "Load topo". Their doc page references National Geophysical Data Center, NOAA US Department of Commerce under data announcement 88-MGG-02:

http://www.ngdc.noaa.gov/mgg/global/etopo5.HTML

@thefuxia
thefuxia / product-editor-column.php
Last active April 7, 2020 20:14
Plugin Product Editor Column
<?php # -*- coding: utf-8 -*-
/**
* Plugin Name: Product Editor Column
* Description: Adds a column to the products table backend with the name of the last editor. Requires at least PHP 5.4.
* Author: Fuxia
* Version: 2014.08.09
* Licence: MIT
* Plugin URI: http://wordpress.stackexchange.com/a/157258/73
*/
namespace WPSE;