This file contains hidden or 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 logResult(result) { | |
console.log(result); | |
} | |
function logError(error) { | |
console.log('Looks like there was a problem: \n', error); | |
} | |
function validateResponse(response) { | |
if (!response.ok) { |
This file contains hidden or 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
/* Anchors */ | |
a.clear-style { | |
color: inherit; | |
text-decoration: none; | |
} | |
/* Buttons */ | |
button.clear-style, | |
input[type=button].clear-style, | |
input[type=reset].clear-style { |
This file contains hidden or 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
const encodedDestHref = encodeURIComponent('https://example.com/#/hash/path?hparam1=a&hparam2=b'); | |
location.href = `https://example.com/path?dest=${encodedDestHref}`; | |
const searchParams = new URLSearchParams(location.search); | |
const destHref = searchParams.get('dest'); | |
const destUrl = new URL(destHref); | |
const hashRelativeUrl = new URL(destUrl.hash.substr(1), destUrl.origin); //hack | |
console.log(hashRelativeUrl.pathname); // '/hash/path' | |
console.log(hashRelativeUrl.search); // '?hparam1=a&hparam2=b' |
This file contains hidden or 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
angular.element(document.body).injector().get('$http') |
This file contains hidden or 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
shasum -a 256 -c <<< 'd42fc3297cff5ffae69b4dd4df628d50b520b26f24d7e7671c0a6b6f30d66b28 *tidy-5.6.0-macos.dmg' | |
tidy-5.6.0-macos.dmg: OK |
This file contains hidden or 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 fetchJson(url, options) { | |
return fetch(url, { cache: 'no-store', ...options }) | |
.then(res => { if (res.ok) return res; throw res; }) | |
.then(res => res.json()); | |
} |
This file contains hidden or 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
# where xyz is a branch name fragment, e.g. 525 (using a ticket number) | |
git checkout `git branch | grep xyz` |
This file contains hidden or 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'; | |
angular | |
.module('theApp') | |
.config(config); | |
config.$inject = ['$stateProvider', '$locationProvider', '$urlRouterProvider']; | |
function config($stateProvider, $locationProvider, $urlRouterProvider) { |
This file contains hidden or 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
window.addEventListener('error', e=>{if (e.target.tagName !== 'IMG') return; e.target.style.visibility = 'hidden';}, true) |
This file contains hidden or 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 fetchJSON(url, options, retries = 0) { | |
return fetch(url, { cache: 'no-store', ...options }) | |
.then(res => { | |
if (res.ok) return res.json(); | |
if (retries > 0) return fetchJSON(url, options, --retries); | |
throw res; | |
}); | |
} |