Skip to content

Instantly share code, notes, and snippets.

View techieshark's full-sized avatar

Peter W techieshark

View GitHub Profile
@techieshark
techieshark / pick.js
Created February 22, 2019 04:09
simple pick.js implementation
// @flow
/**
* Returns new object made of the picked paths.
* Native implementation of lodash `pick`.
* Shaves 1-2kb off download size: https://bundlephobia.com/result?p=lodash.pick@4.4.0.
* @see https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_pick
* @see https://lodash.com/docs/#pick
* @return {Object}
*/
@techieshark
techieshark / australian-postcodes.sql
Created June 1, 2018 03:32 — forked from randomecho/australian-postcodes.sql
Australian postcodes (with states and suburb names) geocoded with latitude and longitude.
/*
Taken and cribbed from blog.datalicious.com/free-download-all-australian-postcodes-geocod
May contain errors where latitude and longitude are off. Use at own non-validated risk.
*/
SET NAMES utf8;
SET sql_mode = 'NO_AUTO_VALUE_ON_ZERO';
DROP TABLE IF EXISTS postcodes_geo;
@techieshark
techieshark / add_remove_class.js
Created May 24, 2018 21:31
add/remove class without jQuery (just Vanilla JS)
/**
* Remove a CSS class from an HTML element.
* @param {HTMLElement} el The HTML element to modify.
* @param {string} className The class to remove.
* @returns null
* @see http://youmightnotneedjquery.com/#remove_class
*/
function removeClass(el, className) {
if (el.classList)
el.classList.remove(className);

Keybase proof

I hereby claim:

  • I am techieshark on github.
  • I am techieshark (https://keybase.io/techieshark) on keybase.
  • I have a public key ASAGfHHdWMNLxRSipw5fj5uzzNELExUqoXtBuY0RPYw41go

To claim this, I am signing this object:

# Contributor License Agreement
The following terms are used throughout this agreement:
* You - the person or legal entity including its affiliates asked to accept this agreement. An affiliate is any entity that controls or is controlled by the legal entity, or is under common control with it.
* Project - School Finder project located at https://github.com/CodeforAustralia/school-finder
* Contribution - any type of work that is submitted to a Project, including any modifications or additions to existing work.
* Submitted - conveyed to a Project via a pull request, commit, issue, or any form of electronic, written, or verbal communication with GitHub, Code for Australia, Peter W, contributors or maintainers.
1. Grant of Copyright License.
@techieshark
techieshark / gist:33950a2b88652fde21415c50a42a3d80
Created February 18, 2017 22:59
Enable Chrome Distill mode
open -a "/Applications/Google Chrome.app" 'https://grist.org/politics/trumps-environmental-assault-continues-and-now-hell-have-pruitt-as-a-henchman/' --args --enable-dom-distiller
# Now go to Menu -> Distill Page (on an article page, like the example above)
@techieshark
techieshark / documentation.json
Created July 15, 2016 06:28
Elm documentation example file
[
{
"name": "Data",
"comment": "Data module overview.\n\n#Single items\n\n\n@docs getItem\n\n",
"aliases": [],
"types": [],
"values": [
{
"name": "getItem",
"comment": "Get item from app data store.",
# want to quickly see how large (in bytes) a file is after we gzip it, without actually gzipping it
# on command line, running the following does the trick: gzip -c file.js | wc -c
# we can add this little bit to our .bashrc so we can instead just type gsize file.js
gzipSize() {
gzip -c $1 | wc -c
}
alias gsize=gzipSize
@techieshark
techieshark / git-rebase.log
Created March 9, 2015 23:32
git rebasing municipal
peter@Selene:~/mesa-municipal(master)$ git pull
remote: Counting objects: 7, done.
remote: Compressing objects: 100% (6/6), done.
remote: Total 7 (delta 0), reused 0 (delta 0), pack-reused 1
Unpacking objects: 100% (7/7), done.
From github.com:CityOfMesaAZ/Municipal
1d0be4e..53f4d71 master -> origin/master
* [new branch] master_bu_03-05-15 -> origin/master_bu_03-05-15
* [new branch] mesa-customized_bu_03-05-15 -> origin/mesa-customized_bu_03-05-15
Updating 1d0be4e..53f4d71
@techieshark
techieshark / console.js
Created February 3, 2015 22:20
ie-console.js
/**
* Protect window.console method calls, e.g. console is not defined on IE
* unless dev tools are open, and IE doesn't define console.debug
* http://stackoverflow.com/a/13817235/1024811
*/
(function() {
if (!window.console) {
window.console = {};
}
// union of Chrome, FF, IE, and Safari console methods