Skip to content

Instantly share code, notes, and snippets.

View dsottimano's full-sized avatar

Dave dsottimano

View GitHub Profile
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css" integrity="sha384-BVYiiSIFeK1dGmJRAkycuHAHRg32OmUcww7on3RYdg4Va+PmSTsz/K68vbdEjh4u" crossorigin="anonymous">
</head>
<body>
<div class="container">
<p style="color:red;">Sorry about the email change at the last minute, Google and Gmail decided to block this message as spam, so I can't send it to you. Yeah, I'm changing providers ;)</p>
<p>Thanks for watching my MozCon presentation! Even though it was only 30 minutes, it took me years for me to get to this point.
I’m really excited to share concepts that should help you cut out boring tasks and focus on more important things.</p>
console.log([...new Set(new URL('https://www.amazon.com/SanDisk-128GB-microSDXC-Memory-Adapter/dp/B073JYC4XM/memory').pathname.toLowerCase().split(/-|\//gi).filter(Boolean))])
//output handles dupes for casing and removes falsy values
//[ 'sandisk','128gb','microsdxc','memory','adapter','dp','b073jyc4xm' ]
function REMOVE_SPECIFIC_QUERY(url,queriesToRemove) {
try {
if (!url) return "Error: Missing parameter. To Fix: Ensure you have both parameters set";
if (url.map) url.map(u=> REMOVE_QUERY(u))
else {
let result = "?hello=hi&ga=123"
//if (!result.includes("&")) return url.replace("?" + result,"");
result = result.split("&")
queriesToRemove = queriesToRemove.split(",")
@dsottimano
dsottimano / 30 second beat code
Last active September 3, 2020 04:19
Beating the apps script custom function 30 second time limit. Alpha? Beta? :P
//David Sottimano
//@dsottimano on Twitter for feedback please!
//lets set up our queue runner to run every 1 minutes
function onOpen() {
ScriptApp.newTrigger('queueRunner')
.timeBased()
.everyMinutes(1)
.create();
def parsepath(string):
try:
string = str(string)
if string[0] == "/":
country = ''
language = ''
category = ''
category_flag = False
split_string = string.split("/")
/**
* Recursively deletes specified keys from an object and its nested objects.
* @param {object} obj - The object to delete keys from.
* @param {string[]} keysToDelete - An array of keys to delete.
*/
function deleteKeysRecursive(obj, keysToDelete) {
for (let key in obj) {
if (keysToDelete.includes(key)) {
delete obj[key];
} else if (typeof obj[key] === 'object') {
WITH calendar AS (
SELECT
date,
EXTRACT(DAYOFWEEK FROM date) day_of_week,
EXTRACT(MONTH FROM date) month,
EXTRACT(YEAR FROM date) year
FROM UNNEST(GENERATE_DATE_ARRAY('2000-01-01', '2020-12-31')) AS date
),
date_spine AS (
SELECT * FROM calendar