Skip to content

Instantly share code, notes, and snippets.

View yuletide's full-sized avatar
🤘

Alex Yule yuletide

🤘
View GitHub Profile
@yuletide
yuletide / getStyleComponents.js
Last active February 23, 2023 20:52
Get a list of all mapbox layer ids grouped by feature component for easy toggling of mapbox streets layers
#!/usr/bin/env node
// usage node getStyleComponents.js > groups.json
// looks for a style named style.json, rename to match or use process.argv if you want
// then save these ids to an array and toggle with:
// layers?.forEach(lyr => map.setLayoutProperty(lyr, "visibility", value));
const style = require("./style.json");
const components = style.layers.reduce((map, lyr) => {
@yuletide
yuletide / .block
Last active April 5, 2022 17:44 — forked from alexmacy/.block
Projection Transitions v4
license: gpl-3.0
@yuletide
yuletide / index.html
Last active May 29, 2020 21:40
Mapbox Swap Studio Source for GeoJSON
<!DOCTYPE html>
<html lang="en">
<head>
<title>Swap Studio Source for GeoJSON</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<link
rel="shortcut icon"
href="https://static-assets.mapbox.com/branding/favicon/v1/favicon.ico"
type="image/x-icon"
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8' />
<title></title>
<meta name='viewport' content='initial-scale=1,maximum-scale=1,user-scalable=no' />
<script src='https://api.tiles.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.js'></script>
<link href='https://api.tiles.mapbox.com/mapbox-gl-js/v0.39.1/mapbox-gl.css' rel='stylesheet' />
<script src='http://mapbox-gl-inspect.lukasmartinelli.ch/dist/mapbox-gl-inspect.min.js'></script>
<link href='http://mapbox-gl-inspect.lukasmartinelli.ch/dist/mapbox-gl-inspect.css' rel='stylesheet' />
{
"version": 0.6,
"generator": "Overpass API 0.7.54.12 054bb0bb",
"osm3s": {
"timestamp_osm_base": "2018-01-09T23:33:02Z",
"timestamp_areas_base": "2018-01-09T23:09:02Z",
"copyright": "The data included in this document is from www.openstreetmap.org. The data is made available under ODbL."
},
"elements": [
{
" vim-plug
" Specify a directory for plugins
" - For Neovim: ~/.local/share/nvim/plugged
" - Avoid using standard Vim directory names like 'plugin'
if !has('nvim')
call plug#begin('~/.vim/plugged')
else
call plug#begin('~/.local/share/nvim/plugged')
endif
@yuletide
yuletide / helpers.py
Created October 26, 2012 04:38 — forked from pwfff/helpers.py
coursera neural networks assignment 1 sample code (ported from octave)
import scipy.io
UNWANTED_KEYS = ('__globals__', '__header__', '__version__')
def load_dataset(path):
data = scipy.io.loadmat(path)
for key in UNWANTED_KEYS:
del data[key]
@yuletide
yuletide / get_defs.php
Last active January 19, 2023 17:29
EPSG postgis scraper for `node-proj4js-defs`
<?php
/* from http://lists.osgeo.org/pipermail/openlayers-users/2010-June/017976.html */
$conn_string = "host=localhost port=5432
dbname=mydatabase_with_postgis_activated user=my_user password=my_password";
$link = pg_connect($conn_string) or die("Could not connect");
$start_epsg = 'Proj4js.defs["EPSG:';
$end_epsg_start_proj4js = '"] = "';
$end_proj4js ='";';
@yuletide
yuletide / epsg.js
Created October 18, 2012 01:22
Proj4js EPSG Definitions as a node module
module.exports = function(Proj4js){
Proj4js.defs["EPSG:3819"] = "+proj=longlat +ellps=bessel +towgs84=595.48,121.69,515.35,4.115,-2.9383,0.853,-3.408 +no_defs";
Proj4js.defs["EPSG:3821"] = "+proj=longlat +ellps=aust_SA +no_defs";
Proj4js.defs["EPSG:3824"] = "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
Proj4js.defs["EPSG:3889"] = "+proj=longlat +ellps=GRS80 +towgs84=0,0,0,0,0,0,0 +no_defs";
Proj4js.defs["EPSG:3906"] = "+proj=longlat +ellps=bessel +towgs84=682,-203,480,0,0,0,0 +no_defs";
Proj4js.defs["EPSG:4001"] = "+proj=longlat +ellps=airy +no_defs";
Proj4js.defs["EPSG:4002"] = "+proj=longlat +ellps=mod_airy +no_defs";
Proj4js.defs["EPSG:4003"] = "+proj=longlat +ellps=aust_SA +no_defs";
Proj4js.defs["EPSG:4004"] = "+proj=longlat +ellps=bessel +no_defs";
@yuletide
yuletide / gist:3741017
Created September 18, 2012 03:09
action_mailer local dev settings
# config/environments/development.rb
# current setting -- saves sent mails locally in rails_root/tmp/mails/
config.action_mailer.delivery_method = :file
# OR...
config.action_mailer.delivery_method = :smtp
config.action_mailer.smtp_settings = {
:enable_starttls_auto => true,
:address => "smtp.gmail.com",