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
<?xml version="1.0" encoding="UTF-8" standalone="yes"?> | |
<widget id="com.hello.world" version="0.0.1" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"> | |
<name>Hello World</name> | |
<description> | |
</description> | |
<author> | |
</author> | |
<content src="index.html"/> | |
<access origin="*"/> | |
<preference name="webviewbounce" value="false"/> |
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
( |\t)*?<!--(.|\s)*?-->( |\t)*/gm | |
https://regex101.com/r/OraWn4/4 | |
<!-- comment with whitespaces before tag --> <div> | |
<div> <!-- comment with whitespaces after tag -->aa |
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
angular.module('myApp') | |
.directive('betterCloak', function() { | |
return { | |
scope: { | |
'ngHide': '=', | |
'ngShow': '=' | |
}, | |
link: function(scope,element, attrs){ | |
if (typeof scope.ngHide == 'undefined' && typeof scope.ngShow == 'undefined' || scope.ngHide === false || scope.ngShow === true) { | |
$(element).addClass('better-cloak-ready'); |
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
require('crypto').randomBytes(64).toString('hex'); |
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
#!/usr/bin/env node | |
// Fork of: | |
// https://gist.github.com/ohh2ahh/f35ff6e0d9f8b4268cdb | |
// Save hook under `project-root/hooks/before_build/` | |
// | |
// Don't forget to install xml2js using npm | |
// `$ npm install xml2js` |
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 disable_jQuery() { | |
if(!is_admin()){ | |
wp_deregister_script('jquery'); | |
} | |
} | |
function add_jQuery_from_cdn(){ | |
if(!is_admin()){ | |
wp_deregister_script('jquery'); | |
wp_register_script('jquery', 'https://code.jquery.com/jquery-2.2.4.min.js', null, null, true); |
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
Keys with Dutch keyboard | |
' Apostrophe: right key of semicolon | |
" Quotation Mark: right key of semicolon+shift | |
‘ Left Single Quotation Mark: alt+[ | |
“ Left Double Quotation Mark: alt+] | |
’ Right Single Quotation Mark: alt+shift+[ | |
” Right Double Quotation Mark: alt+shift+] | |
´ Acute Accent: alt+e | |
` Grave Accent: left key of z |
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
/** | |
This util is a trick to ensure you get an array with all the elements of a type. | |
You have to pass an object with all the possible types as keys, and true as a value (arbitrarily chosen to be true) | |
*/ | |
export const getListOfType = <A extends string>(obj: Record<A, true>): A[] => { | |
return keys(obj); | |
}; | |
function keys<O extends object>(o: O): Array<keyof O> { | |
return Object.keys(o) as Array<keyof O>; |
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
// https://en.wikipedia.org/wiki/List_of_UTC_time_offsets | |
export enum TimeZoneOffset { | |
UTC_Minus_12_00 = '-12:00', | |
UTC_Minus_11_00 = '-11:00', | |
UTC_Minus_10_00 = '-10:00', | |
UTC_Minus_09_30 = '-09:30', | |
UTC_Minus_09_00 = '-09:00', | |
UTC_Minus_08_00 = '-08:00', | |
UTC_Minus_07_00 = '-07:00', | |
UTC_Minus_06_00 = '-06:00', |
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
// https://stackoverflow.com/a/61476921/1355416 | |
type FilteredKeys<T, U> = { [P in keyof T]: T[P] extends U ? P : never }[keyof T] | |
const compareStrings = <T extends object>(key: FilteredKeys<T, string>) => (a: T, b: T): number => { | |
const valA = (a[key] as unknown) as string | |
const valB = (b[key] as unknown) as string | |
return valA.localeCompare(valB) | |
} |
OlderNewer