Skip to content

Instantly share code, notes, and snippets.

View jonrandahl's full-sized avatar
💭
I may be slow to respond.

Jon R. Humphrey jonrandahl

💭
I may be slow to respond.
View GitHub Profile
@jonrandahl
jonrandahl / leaflet.forceZIndex.js
Created September 13, 2023 09:31 — forked from up209d/leaflet.forceZIndex.js
Force zIndex of Leaflet Marker
// Force zIndex of Leaflet
(function (global) {
const MarkerMixin = {
_updateZIndex: function (offset) { // offset at relative value, or put absolute zIndex value with forceZIndex
this._icon.style.zIndex = isNaN(this.options.forceZIndex) // any no-numeric = unassigned. 0 is ok for the forceZIndex
? (this._zIndex + offset)
: (this.options.forceZIndex + (this.options.zIndexOffset || 0))
},
setForceZIndex: function (forceZIndex) {
this.options.forceZIndex = forceZIndex || null
@jonrandahl
jonrandahl / reset.css
Created June 20, 2022 23:47 — forked from EllyLoel/reset.css
CSS Reset
/*
Made by Elly Loel - https://ellyloel.com/
With inspiration from:
- Josh W Comeau - https://courses.joshwcomeau.com/css-for-js/treasure-trove/010-global-styles/
- Andy Bell - https://piccalil.li/blog/a-modern-css-reset/
- Adam Argyle - https://unpkg.com/open-props@1.3.16/normalize.min.css / https://codepen.io/argyleink/pen/KKvRORE
Notes:
- `:where()` is used to lower specificity for easy overriding.
*/
@jonrandahl
jonrandahl / index.es6.js
Created April 28, 2020 23:06 — forked from ydnar/index.es6.js
Versioned documents with Firestore Cloud Functions
import * as admin from 'firebase-admin'
import * as functions from 'firebase-functions'
admin.initializeApp(functions.config().firebase)
const db = admin.firestore()
async function writeIntegerVersion(event) {
const ref = event.data.ref
if (ref.path.indexOf('/_versions/') >= 0) {
return false
const hmac_sha256 = require('crypto-js/hmac-sha256');
const request = require('request');
const functions = require('firebase-functions');
// in order to be able to create custom token we need to initialize Firebase
// Admin SDK with private key
// https://firebase.google.com/docs/admin/setup
const serviceAccount = require('./service-account-key.json');
const admin = require('firebase-admin');
cd ..
sudo rm -r fucking-git-repo-dir
git clone https://some.github.url/fucking-git-repo-dir.git
cd fucking-git-repo-dir
@jonrandahl
jonrandahl / ForceEmptyRecycleBin.sql
Created October 7, 2018 23:15 — forked from leekelleher/ForceEmptyRecycleBin.sql
Umbraco: Force empty the Recycle Bin
-- Uncomment below to verify the number of nodes returned is the same as the number of nodes that is in the Recycle Bin
-- SELECT * FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20
-- Delete all 'related' nodes and table contents...
DELETE FROM cmsPreviewXml WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
DELETE FROM cmsContentVersion WHERE contentId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
DELETE FROM cmsDocument WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
DELETE FROM cmsContentXML WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
DELETE FROM cmsContent WHERE nodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
DELETE FROM cmsPropertyData WHERE contentNodeId IN (SELECT id FROM umbracoNode WHERE path LIKE '%-20%' AND id != -20)
@jonrandahl
jonrandahl / markdown.md
Created September 4, 2018 16:46 — forked from jonschlinkert/markdown-cheatsheet.md
A better markdown cheatsheet. I used Bootstrap's Base CSS documentation as a reference.

Typography

Headings

Headings from h1 through h6 are constructed with a # for each level:

# h1 Heading
## h2 Heading
### h3 Heading
@jonrandahl
jonrandahl / ISO3166-Country-List-Table.sq
Created August 16, 2018 11:31 — forked from ProNotion/ISO3166-Country-List-Table.sq
TSQL ISO3166 Country List Table
PRINT 'Checking for existence of table ''countries'''
/****** Object: Table [dbo].[Countries] Script Date: 11/09/2006 16:58:01 ******/
if exists (select * from dbo.sysobjects where id = object_id(N'[dbo].[Countries]') and OBJECTPROPERTY(id, N'IsUserTable') = 1)
drop table [dbo].[Countries]
PRINT 'Existing table ''countries'' dropped!'
GO
/****** Object: Table [dbo].[Countries] Script Date: 11/09/2006 16:58:01 ******/
@jonrandahl
jonrandahl / bp-sort-members-by-last-name.php
Created May 17, 2018 13:41 — forked from mgmartel/bp-sort-members-by-last-name.php
Sort BuddyPress users by last name in the members directory. Updated for BP 1.7.
<?php
// Sort BuddyPress users by last name
//
// Use this Gist to sort members alphabetically by last name in the
// members directory. Follow the instructions below and drop the code
// in your functions.php or your functions plugin.
//
// Updated to work with BP 1.7. See earlier revisions of this gist for
// earlier versions of BP.
@jonrandahl
jonrandahl / tribe_set_default_date.php
Created May 2, 2018 22:35 — forked from elimn/tribe_set_default_date.php
MT | TEC | Set the default date for views like List and Month
<?php
/*
* Set the default date for views like List and Month
* Modify the $date variable below to set your date
*/
function tribe_set_default_date( $wp_query ) {
// Only run on main event queries
if ( ! tribe_is_event_query() || ! $wp_query->is_main_query() || $wp_query->get( 'eventDate' ) != '') return;