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
| // import stuffs | |
| app.delete('/todos/:id', (req, res) => { // deletes a todo and return current todo list | |
| const ctx = new TodoContext(req); | |
| Promise.resolve() | |
| .then(() => authorize(['user', 'admin'])) | |
| .then(({ user, roles }) => { | |
| let promise; | |
| if (roles.indexOf('admin') >= 0 && req.query.permanent) | |
| promise = Todo.remove({ _id: req.params.id}); |
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
| setTimeout(function () { | |
| console.log('แสดงอันที่สอง (หลังจากอันแรก 1 วินาที)'); | |
| }, 1000); | |
| console.log('แสดงอันแรก'); |
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
| if (confirm('Are you sure?')) { | |
| console.log('Confirmed'); | |
| } else { | |
| console.log('Canceled'); | |
| } |
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
| function do(cb) { | |
| doA(function(err, a) { | |
| if (err) cb(err); | |
| doB(a, function(err, b) { | |
| if (err) cb(err); | |
| doC(b, function(err, c) { | |
| cb(err); | |
| }); | |
| }); | |
| }); |
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
| function do() { | |
| return doA().then(function(a) { | |
| return doB(a); | |
| }).then(function(b) { | |
| return doC(b); | |
| }); | |
| } |
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 do() { | |
| const a = await doA(); | |
| const b = await doB(a); | |
| const c = await doC(b); | |
| } |
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 do() { | |
| const a = await doA(); | |
| const [b, c] = await Promise.all([doB(a), doC(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
| function secretArchivesLock(lock, actions) { | |
| const getCol = (lock, index) => { | |
| return lock.map(r => r.charAt(index)).filter((x) => x !== '.') | |
| } | |
| const getRows = (lock) => lock.map((v) => v.split("").filter((x) => x !== '.')); | |
| const getCols = (lock) => Array.apply(null, Array(lock[0].length)).map((_, i) => getCol(lock, i)) | |
| const fillLeft = (vector, length) => | |
| Array.apply(null, Array(length - vector.length)).map(() => '.').concat(vector); | |
| const fillRight = (vector, length) => | |
| vector.concat(Array.apply(null, Array(length - vector.length)).map(() => '.')); |
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
| @override | |
| class ChatMessage extends StatelessWidget { | |
| ChatMessage({this.snapshot, this.animation}); | |
| final DataSnapshot snapshot; | |
| final Animation animation; | |
| Widget build(BuildContext context) { | |
| return new SizeTransition( | |
| sizeFactor: new CurvedAnimation( | |
| parent: animation, curve: Curves.easeOut), |
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
| license: gpl-3.0 |
OlderNewer