Skip to content

Instantly share code, notes, and snippets.

View StrykerKKD's full-sized avatar

Tóth Róbert StrykerKKD

View GitHub Profile
@StrykerKKD
StrykerKKD / main.dart
Created April 16, 2015 17:05
Web scraping with Dart 2
import 'dart:async';
import 'package:http/http.dart' as http;
import 'package:html/parser.dart' as parser;
import 'package:html/dom.dart';
main() async {
http.Response response = await http.get('https://news.ycombinator.com/');
Document document = parser.parse(response.body);
@StrykerKKD
StrykerKKD / main.dart
Created April 15, 2015 21:48
Web scraping with Dart
import 'package:http/http.dart' as http;
import 'package:html/parser.dart' as parser;
import 'package:html/dom.dart';
main() async {
http.Response response = await http.get('https://news.ycombinator.com/');
Document document = parser.parse(response.body);
document.getElementsByTagName('a').forEach((Element element){
@StrykerKKD
StrykerKKD / main.dart
Created December 11, 2014 21:23
Dart: Processing Big XML by Streaming
import 'package:xmlstream/xmlstream.dart';
import 'dart:io';
main() {
XmlStreamer xmlStreamer = new XmlStreamer.fromStream(new File('BigXMLFile.xml').openRead());
xmlStreamer.read().listen((XmlEvent event){
print(event);
});
}
@StrykerKKD
StrykerKKD / main.dart
Created December 6, 2014 21:01
Dart: Isolate example in a funny way
import 'dart:isolate';
//This is the worker
void worker(SendPort request) {
ReceivePort response = new ReceivePort();
request.send(response.sendPort);
response.listen((message){
print("Boss: $message");
request.send("....");
response.close();