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
import 'package:flutter_hooks/flutter_hooks.dart'; | |
import 'package:hooks_riverpod/hooks_riverpod.dart'; | |
T useProvider<T>(ProviderListenable<T> provider) { | |
final context = useContext(); | |
final container = ProviderScope.containerOf(context); | |
final result = useState<T?>( | |
container.read(provider), | |
); |
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
import { | |
WatchOptions, | |
DispatchOptions, | |
CommitOptions, | |
MutationPayload, | |
} from 'vuex'; | |
export interface ActionConvertible { | |
[key: string]: { | |
payload: string; |
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
declare const process: any; | |
const stdin = process.openStdin(); | |
enum TokenType { | |
VarName = 'VarName', | |
Assign = 'Assign', | |
Plus = 'Plus', | |
Minus = 'Minus', | |
Multi = 'Multi', | |
Divi = 'Divi', |
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
const spdy = require('spdy'); | |
const express = require('express'); | |
const fs = require('fs'); | |
const path = require('path'); | |
const app = express(); | |
const publicPath = path.join(__dirname, "."); | |
app.use(express.static(publicPath)); |
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
let matA = [ | |
[1, 1, 0, 3], | |
[2, 1, -1, 1], | |
[3, -1, -1, 2], | |
[-1, 2, 3, -1] | |
]; | |
let N = matA.length; | |
console.log("matA", matA); |
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 asyncTask(count) { | |
return new Promise(resolve => { | |
setTimeout(() => { | |
resolve(count); | |
}, 1000); | |
}); | |
} | |
const async = function(generator) { |
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 asyncTask(count, next) { | |
setTimeout(() => { | |
next(count); | |
}, 1000); | |
} | |
const async = function(generator) { | |
let gen = generator(function (value) { | |
gen.next(value); | |
}); |
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 asyncTask(count, gen) { | |
setTimeout(() => { | |
gen.next(count); | |
}, 1000); | |
} | |
const generator = (function* () { | |
let count = 0; | |
console.log(yield asyncTask(count++, generator)); | |
console.log(yield asyncTask(count++, generator)); |
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
class LinkedList { | |
constructor(...values) { | |
this.head = null; | |
this.tail = null; | |
this.size = 0; | |
if (values.length > 0) { | |
values.forEach(this.add.bind(this)); | |
} | |
} |
NewerOlder