Skip to content

Instantly share code, notes, and snippets.

@sc0ttj
sc0ttj / country-bounding-boxes.py
Created May 20, 2024 16:23 — forked from graydon/country-bounding-boxes.py
country bounding boxes
# extracted from http//www.naturalearthdata.com/download/110m/cultural/ne_110m_admin_0_countries.zip
# under public domain terms
country_bounding_boxes = {
'AF': ('Afghanistan', (60.5284298033, 29.318572496, 75.1580277851, 38.4862816432)),
'AO': ('Angola', (11.6400960629, -17.9306364885, 24.0799052263, -4.43802336998)),
'AL': ('Albania', (19.3044861183, 39.624997667, 21.0200403175, 42.6882473822)),
'AE': ('United Arab Emirates', (51.5795186705, 22.4969475367, 56.3968473651, 26.055464179)),
'AR': ('Argentina', (-73.4154357571, -55.25, -53.628348965, -21.8323104794)),
'AM': ('Armenia', (43.5827458026, 38.7412014837, 46.5057198423, 41.2481285671)),
@sc0ttj
sc0ttj / README.md
Created December 13, 2023 12:29 — forked from armollica/README.md
Convert SVG to Canvas

Convert SVG to canvas on-the-fly.

This article from MDN explains the process: Drawing DOM object into a canvas. This works for any DOM object, not just SVG. Not sure if this is well supported by older browsers. Works on Chrome, Firefox and IE 10 for me. The bar chart is a fork of this block by Mike Bostock: Canvas Bar Chart.

@sc0ttj
sc0ttj / handlebars-helpers.md
Last active January 22, 2024 11:31
Handlebars helpers for VJ

Handlebars helpers

We'll see some example "helpers" which access the vocabs, without needing lookup, or passing in @root.vocab.

Lets use the following vocabs:

key english
country_names_1 England
country_names_2 Scotland
@sc0ttj
sc0ttj / SCSS.md
Created October 31, 2023 18:29 — forked from jareware/SCSS.md
Advanced SCSS, or, 16 cool things you may not have known your stylesheets could do

⇐ back to the gist-blog at jrw.fi

Advanced SCSS

Or, 16 cool things you may not have known your stylesheets could do. I'd rather have kept it to a nice round number like 10, but they just kept coming. Sorry.

I've been using SCSS/SASS for most of my styling work since 2009, and I'm a huge fan of Compass (by the great @chriseppstein). It really helped many of us through the darkest cross-browser crap. Even though browsers are increasingly playing nice with CSS, another problem has become very topical: managing the complexity in stylesheets as our in-browser apps get larger and larger. SCSS is an indispensable tool for dealing with this.

This isn't an introduction to the language by a long shot; many things probably won't make sense unless you have some SCSS under your belt already. That said, if you're not yet comfy with the basics, check out the aweso

@sc0ttj
sc0ttj / modifiers.scss
Created October 31, 2023 18:28 — forked from sarahdayan/modifiers.scss
Sass Modifiers Mixin
// ----
// Sass (v3.4.21)
// Compass (v1.0.3)
// ----
// Sass modifiers mixin by Sarah Dayan
// Generate All Your Utility Classes with Sass Maps: frontstuff.io/generate-all-your-utility-classes-with-sass-maps
// http://frontstuff.io
// https://github.com/sarahdayan
@sc0ttj
sc0ttj / safe-objects.js
Last active February 5, 2024 13:23
Javascript - safer objects, with "prototype pollution" prevention, and schema validation
// NOTE:
// ----------------------------------------------------------------------------
//
// ** When a key/value structure is needed, Map should be preferred to Object. **
//
// It’s possible to create Objects in JavaScript that don’t have a prototype.
// It requires the usage of Object.create(). Objects created through this
// API won’t have the __proto__ and constructor attributes.
// "Prototype pollution" attacks
@sc0ttj
sc0ttj / watchfiles.md
Created June 8, 2023 15:56 — forked from thiagoh/ watchfiles.md
watchfiles: Watch multiple files and execute bash commands as file changes occur

watchfiles

  • author: Thiago Andrade thiagoh@gmail.com
  • license: GPLv3
  • description:
  • watches the given paths for changes
  • and executes a given command when changes occur
  • usage:
  • watchfiles <paths...>
@sc0ttj
sc0ttj / watchdir.sh
Created June 8, 2023 15:55 — forked from fabswt/watchdir.sh
Watch a directory using bash and inotifywait
#!/bin/sh
# Usage
#
# Call the script with the directory you want to watch as an argument. e.g.:
# watchdir.sh /app/foo/
#
#
# Description:
# Uses inotifywait to look for new files in a directory and process them:
@sc0ttj
sc0ttj / watchdo.sh
Created June 8, 2023 15:55 — forked from molotovbliss/watchdo.sh
watchdo: Linux bash script to monitor file modifications recursively & execute bash commands as changes occur
#!/usr/bin/env bash
# script: watchdo
# author: Mike Smullin <mike@smullindesign.com>
# modified: Jared Blalock <mb@molotovbliss.com>
# possible use for monitoring .less changes to compile to .css
# license: GPLv3
# description:
# watches the given path for changes
# and executes a given command when changes occur
# usage: