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
/** | |
* Returns an array of the specified enum type with values that are the | |
* intersection of the array and enum type. | |
* | |
* Example: | |
* convertArrayToEnumType(["VISA", "CARTES_BANCAIRES"], AllowedCardNetworks) | |
* => ["VISA"] | |
*/ | |
export function convertArrayToEnumType<S, T extends string>(arr: Array<S>, type: Record<T, T>): Array<T> { | |
return arr.filter((k) => Object.keys(type).includes((k as unknown) as T)).map((k) => (k as unknown) as T); |
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
# Taken from https://www.reddit.com/r/MacOS/comments/i4czgu/big_sur_airpods_script/gck3gz3/ | |
# by https://github.com/smithumble | |
use framework "IOBluetooth" | |
use scripting additions | |
set AirPodsName to "AirPods" | |
on getFirstMatchingDevice(deviceName) | |
repeat with device in (current application's IOBluetoothDevice's pairedDevices() as list) |
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
(setTimeout(function () { | |
var TM_PARAM_NAME = 'tmsource'; | |
var UTM_PARAMS = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content']; | |
var COOKIE_NAME = 'tmsource'; | |
var COOKIE_EXPIRES_DAYS = 60; | |
var LOCATION = window.location; | |
var URL = LOCATION.href; | |
var COOKIE_DOMAIN = LOCATION.hostname.replace(/^www\./, ''); | |
function getParameterByName(name) { |
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
/** | |
* Minified with http://ted.mielczarek.org/code/mozilla/bookmarklet.html | |
*/ | |
javascript:(function(){function observe(){var observer=new MutationObserver(sortTooltip);observer.observe(document.body,{childList:true});}function sortTooltip(){var tooltip=$('#tooltip');if(!tooltip.length){return;}var items=$('#tooltip > .graph-tooltip-list-item');items.sort((a,b)=>strToNum($('.graph-tooltip-value',a).text())>strToNum($('.graph-tooltip-value',b).text())?-1:1);items.detach().appendTo(tooltip);}function strToNum(str){var num=parseFloat(str);if(isNaN(num)){return-1;}if(str.indexOf('K')>-1){return num*1000;}if(str.indexOf('Mil')>-1){return num*1000000;}if(str.indexOf('min')>-1){return num*60000;}if(str.indexOf('ms')>-1){return num*1;}if(str.indexOf('s')>-1){return num*1000;}return parseFloat(str);}observe();})(); | |
/** | |
* Unminified: | |
*/ | |
function observe () { |