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
/** | |
* Get subtype from an existing type/interface by omitting one or more properties. | |
* | |
* **Usage:** | |
* ```ts | |
* type TSubType = Omit<IOriginalType, 'Prop1' | 'Prop2'> // IOriginalType without Prop1 and Prop2 | |
* ``` | |
*/ | |
export type Omit<T, K extends keyof T> = Pick<T, Exclude<keyof T, K>> |
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
# Source: https://stackoverflow.com/a/43317244 | |
$path = ".\aws-ec2-key.pem" | |
# Reset to remove explict permissions | |
icacls.exe $path /reset | |
# Give current user explicit read-permission | |
icacls.exe $path /GRANT:R "$($env:USERNAME):(R)" | |
# Disable inheritance and remove inherited permissions | |
icacls.exe $path /inheritance:r |
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() { | |
function myModule() { | |
} | |
if (typeof module !== 'undefined' && typeof module.exports !== 'undefined') { | |
module.exports = myModule; | |
} | |
else { | |
if (typeof define === 'function' && define.amd) { | |
define([], function() { |
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
## The `substring(8)` returns the input with everything after "payload=" which is the only parameter passed in, | |
## everything else is encoded JSON inside that parameter. | |
#set ($encodedJSON = $input.body.substring(8)) | |
$util.urlDecode(${encodedJSON}) |
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
get_latest_release() { | |
curl --silent "https://api.github.com/repos/$1/releases/latest" | # Get latest release from GitHub api | |
grep '"tag_name":' | # Get tag line | |
sed -E 's/.*"([^"]+)".*/\1/' # Pluck JSON value | |
} | |
# Usage | |
# $ get_latest_release "creationix/nvm" | |
# v0.31.4 |
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
// -- updated in 2020/04/19 covering the issues in the comments to this point | |
// -- remember you also have things like `ensureDirSync` from https://github.com/jprichardson/node-fs-extra/blob/master/docs/ensureDir-sync.md | |
const fs = require('fs') | |
function writeFileSyncRecursive(filename, content, charset) { | |
// -- normalize path separator to '/' instead of path.sep, | |
// -- as / works in node for Windows as well, and mixed \\ and / can appear in the path | |
let filepath = filename.replace(/\\/g,'/'); | |
// -- preparation to allow absolute paths as well |
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
node_modules/ |
To create anchor links that jump down to different sections of a README (as in an interactive table of contents), first create a heading:
#Real Cool Heading
The anchor link for that heading is the lowercase heading name with dashes where there are spaces. You can always get the anchor name by visiting the README on Github.com and clicking on the anchor that appears when you hover to the left of the heading. Copy everything starting at the #:
#real-cool-heading
Wherever you want to link to your Real Cool Heading section, put your desired text in brackets, followed by the anchor link in parentheses:
[Go to Real Cool Heading section](#real-cool-heading)
NewerOlder