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 stateA = { | |
idA:{ | |
xx:1 | |
} | |
} | |
const stateB = { | |
idA:{ | |
yy:1 | |
} | |
} |
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
// for文内のcontinueはNG | |
const abc = (arg: (string | number)[]) => { | |
for (let i=0;i<arg.length;i++) { | |
if (typeof arg[i] === 'string') continue; | |
const abc: number = arg[i]; | |
} | |
} | |
// if文のearly returnはOK | |
const abc2 = (arg: (string | number)[]) => { |
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
// redux-towerに使えるかな? | |
function interested(filename: string): boolean { | |
return filename.slice(filename.lastIndexOf('.')) === ".vue"; | |
} | |
function importInterested(filename: string): boolean { | |
return interested(filename) && filename.slice(0, 2) === "./"; | |
} |
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
|hoge| | |
hoge := array collect: [ :elem | | |
| dict | | |
dict := Dictionary new. | |
dict at: #base put: elem. | |
dict at: #translated put: (self trans: elem). | |
dict | |
]. | |
hoge := hoge asOrderedCollection |
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
async function waitAndMaybeReject() { | |
// Wait one second | |
await new Promise(r => setTimeout(r, 1000)); | |
// Toss a coin | |
const isHeads = Boolean(Math.round(Math.random())); | |
if (isHeads) return 'yay'; // comment out when error | |
throw Error('Boo!'); | |
} |
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
foo(&i); | |
foo(&mut i); | |
fn foo<T: Borrow<i32> + Display>(a: T) { | |
println!("a is borrowed: {}", a); | |
} |
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
{ | |
"name": "test", | |
"version": "1.0.0", | |
"description": "", | |
"main": "index.js", | |
"scripts": { | |
"dev": "vuepress dev" | |
}, | |
"keywords": [], | |
"author": "", |
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 promiseFunc = () => { | |
return new Promise((resolve, reject) => { | |
setTimeout(() => { | |
resolve(); | |
}, 2000) | |
}) | |
} | |
const forEachAsync = () => { | |
[1, 2, 3, 4, 5].forEach(async (index) => { |
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
fn main() { | |
println!("Hello, world!"); | |
} |
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
extern { | |
pub static lorem: c_int; | |
} |
OlderNewer