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
# I am comment | |
# Basic Data type | |
123 # int | |
12.3 # float | |
6.0221409e+23 # scentific notation | |
true # bool | |
"string" | |
# String Operation |
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://www.typescriptlang.org/play?ts=4.1.2#code/C4TwDgpgBAsg9gEwgGwDwwHxQLxQN4BQUxUwEAzsAFxQCMATAMwEC+UAZLAaJFAII58AOwgB3ABQBKGvCRo8AQxoNGLDC27hoAIUF4RE6bEQpUAVyEBrIXFFD1m3gGFBAztsfQAIoN2c+BARIAMbICgBO0ABuEVDBNC4EMeFQCoIGcQQKAHRp7Jw5ZJRBEKER0bEIND5JsQBG6WJQCAR1uRycbUXAQA | |
type Model<M> = { | |
test: 123 | |
} & M | |
type A = {new(): Model<{a: 123}>} | |
type B = {new(): Model<unknown>} | |
type C = A & B | |
type D = B & A |
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
<a class="worker" href="javascript:alert('not prevented')">preventDefault works!</a> | |
<a class="non-worker" href="javascript:alert('not prevented')">preventDefault doesn't work...</a> | |
<script> | |
function createWorker(fn) { | |
const blob = new Blob([`(${fn.toString()})()`], {type: 'application/javascript'}) | |
const url = URL.createObjectURL(blob) | |
return new Worker(url) | |
} | |
const WAITING = 0 |
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 gist demonstrates how powerful TypeScript's new tuple type is. | |
* Say, we want to write a function that receive multiple arguments, and return a tuple of arguments' types. | |
* For example, `getTypes(1, true, 'str')` return a tuple `['number', 'boolean', 'string']`. | |
* We can do that in **type safe** way in TypeScript now! And actually we can do the computation at compile time! | |
* This is so like dependent type in TypeScript! | |
* Reference: https://github.com/Microsoft/TypeScript/pull/24897 | |
*/ | |
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
Error processing request. Cannot set property 'typeParameters' of undefined | |
TypeError: Cannot set property 'typeParameters' of undefined | |
at assignContextualParameterTypes (/project/node_modules/typescript/lib/tsserver.js:36049:38) | |
at checkFunctionExpressionOrObjectLiteralMethod (/project/node_modules/typescript/lib/tsserver.js:36336:29) | |
at checkObjectLiteralMethod (/project/node_modules/typescript/lib/tsserver.js:37103:38) | |
at checkObjectLiteral (/project/node_modules/typescript/lib/tsserver.js:33798:32) | |
at checkExpressionWorker (/project/node_modules/typescript/lib/tsserver.js:37192:28) | |
at checkExpression (/project/node_modules/typescript/lib/tsserver.js:37144:42) | |
at checkExpressionForMutableLocation (/project/node_modules/typescript/lib/tsserver.js:37088:24) | |
at checkPropertyAssignment (/project/node_modules/typescript/lib/tsserver.js:37096:20) |
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
{"jsonrpc":"2.0","id":2,"result":{"isIncomplete":false,"items":[{"label":"aria-activedescendant","kind":12,"textEdit":{"range":{"start":{"line":3,"character":13},"end":{"line":3,"character":14}},"newText":"aria-activedescendant=\"$1\""},"insertTextFormat":2},{"label":"aria-atomic","kind":12,"textEdit":{"range":{"start":{"line":3,"character":13},"end":{"line":3,"character":14}},"newText":"aria-atomic=\"$1\""},"insertTextFormat":2},{"label":"aria-autocomplete","kind":12,"textEdit":{"range":{"start":{"line":3,"character":13},"end":{"line":3,"character":14}},"newText":"aria-autocomplete=\"$1\""},"insertTextFormat":2},{"label":"aria-busy","kind":12,"textEdit":{"range":{"start":{"line":3,"character":13},"end":{"line":3,"character":14}},"newText":"aria-busy=\"$1\""},"insertTextFormat":2},{"label":"aria-checked","kind":12,"textEdit":{"range":{"start":{"line":3,"character":13},"end":{"line":3,"character":14}},"newText":"aria-checked=\"$1\""},"insertTextFormat":2},{"label":"aria-colcount","kind":12,"textEdit":{"range": |
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
export type HTML = { | |
div: IfTag<HTML, 'div'> | |
p: IfTag<HTML, 'p'> | |
ul: UL<HTML> | |
ol: OL<HTML> | |
img: () => HTML | |
} | |
export type Comp<Parent, End extends string> = { | |
props(prop: {[k: string]: any}): Comp<Parent, End> |
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
h('div', {class: 'el-autocomplete', directive: ['clickoutside']}, [ | |
h('el-input', { props: { | |
value: this.value, | |
disabled: this.disabled, | |
placeholder: this.placeholder, | |
name: this.name, | |
size: this.size, | |
}, on: { | |
change: this.handleChange.bind(this), | |
focus: this.handleFocus.bind(this), |
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
"I borrowed this crazy code from vim-tomorrow-theme colorschemes | |
" Returns an approximate grey index for the given grey level | |
fun! s:grey_number(x) | |
if &t_Co == 88 | |
if a:x < 23 | |
return 0 | |
elseif a:x < 69 | |
return 1 | |
elseif a:x < 103 |
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
" Vim syntax file | |
" Language: Vue.js | |
" Maintainer: Eduardo San Martin Morote | |
if exists("b:current_syntax") | |
finish | |
endif | |
if !exists("s:syntaxes") | |
" Search available syntax files. |