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
'use strict' | |
const fs = require('fs').promises; | |
function write(){ | |
return fs.mkdir('./tmp').then(function(){ | |
fs.writeFile('./tmp/foo.txt', 'Hello World'); | |
}).catch((err) => { | |
/// handle error | |
console.log(err); |
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
document.querySelector('body').addEventListener('click', () => console.log(1)); | |
setTimeout(() => console.log(2), 0); | |
for (var i = 0; i < 1000000000000; i++) {/*code*/} | |
console.log(3); |
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
FROM google/dart:2.4 | |
WORKDIR /app | |
ADD pubspec.* /app/ | |
ENV PATH="$PATH":"$HOME/.pub-cache/bin" | |
RUN pub global activate webdev | |
RUN pub get | |
ADD . /app | |
RUN pub get --offline |
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
void main(){ | |
print((new TestClass() as dynamic).test()); | |
} | |
class TestClass { | |
@override | |
noSuchMethod(Invocation invocation){ | |
print(1231231); | |
} | |
} |
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 'dart:async'; | |
import 'dart:io'; | |
void main() async { | |
var controller = StreamController<int>.broadcast(); | |
controller.stream.listen(print); | |
controller.stream.listen(print); |
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 'dart:io'; | |
void main() { | |
Directory.current.list().where((FileSystemEntity i) => i is Directory).map((i) => "path $i").listen((i){ stdout.writeln(i); }); | |
} |
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 'dart:async'; | |
import 'dart:io'; | |
void main() async { | |
try { | |
await Directory('temp').create(); | |
await File('temp/temp').create(); | |
} catch(e){ | |
} |
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
Iterable<BigInt> getFibIterator() sync* { | |
var initial = true; | |
BigInt prev = null; | |
BigInt beforePrev = BigInt.from(1); | |
while(true){ | |
if(initial && prev == null){ | |
initial = false; | |
prev = BigInt.from(0); | |
yield BigInt.from(0); | |
} else { |
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
void main(){ | |
print(fib(5)); | |
print(fibCached(100)); | |
} | |
int fib(input) { | |
if (input == 0) { | |
return 0; | |
} else if (input == 1) { | |
return 1; |
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
void main(){ | |
final bar2= Bar2(); | |
assert(bar2.bar1 =='test1'); | |
assert(bar2.bar1 =='test2'); | |
final bar = Bar('test1'); | |
assert(bar.bar1 == 'test1'); | |
assert(bar.bar2 == 'test2'); | |
} |