This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
create or replace function dataset.array_int_least(x array<int64>) as | |
((select min(y) from unnest(x) as y)); | |
create or replace function dataset.array_int_greatest(x array<int64>) as | |
((select max(y) from unnest(x) as y)); | |
create or replace function dataset.array_timestamp_least(x array<timestamp>) as | |
((select min(y) from unnest(x) as y)); | |
create or replace function dataset.array_timestamp_greatest(x array<timestamp>) as |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// run in console at twitter.com/username/likes (replace username with your username) | |
(function(document,window) { | |
function clearlikes(){ | |
window.scrollTo(0,document.body.scrollHeight); | |
Array.from(document.querySelectorAll('[data-testid="unlike"]')).forEach(function(el){ | |
el.click(); | |
}) | |
setTimeout(clearlikes, 5000); | |
} | |
clearlikes(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function(){ | |
"use strict"; | |
/** | |
* Constants | |
*/ | |
var VERSION = '2.1'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function buildQueryParams(params){ | |
return Object.keys(params).map(function(key) { | |
return encodeURIComponent(key) + '=' + encodeURIComponent(params[key]); | |
}).join('&'); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
www.domain.com | ^www\.resmed\.com$ | |
www.domain.com | ^www\d?\.resmed\.com$ | |
www3.domain.com | | |
www.domain.com | ^(www\d?\.)?resmed\.com$ | |
www3.domain.com | | |
domain.com | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Extract domain from string (with or without protocol) | |
[?:http(s)?:\/\/]?([a-z0-9\-]+\.?[a-z0-9\-]+\.[a-z]{2,3}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<script> | |
(function(){ | |
var data = { | |
"@context": "http://schema.org", | |
"@type": "BlogPosting", | |
"mainEntityOfPage": { | |
"@type": "WebPage", | |
"@id": {{Page URL}} | |
}, | |
"headline": {{SCHEMA - Article Headline}}, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Simple regex/user agent mobile checker | |
* about 99% accurate when compared to 175k sessions in GA | |
*/ | |
function isMobile() | |
{ | |
return window.navigator.match(/Mobi|Touch|Opera\ Mini|Android/) | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var docWidth = document.documentElement.offsetWidth; | |
[].forEach.call( | |
document.querySelectorAll('*'), | |
function(el) { | |
if (el.offsetWidth > docWidth) { | |
console.log(el); | |
} | |
} | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getUrlParam(url, param) { | |
var match = url.match('(?:\\?|&)' + param + '=([^&#]*)'); | |
return (match && match.length == 2) ? decodeURIComponent(match[1]) : ''; | |
} |
NewerOlder