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
HttpServer.bind('127.0.0.1', 8889) | |
.then((HttpServer server) { | |
var sc = new StreamController(); | |
sc.stream.transform(new WebSocketTransformer()).listen(handleWebSocket); | |
server.listen((HttpRequest request) { | |
if (request.uri.path == '/ws') { | |
sc.add(request); | |
} else if (request.uri.path == '/foo') { | |
request.response.addString('foo'); |
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
HashMap(RunTime): 17443.478260869564 us. | |
SplayTreeMap(RunTime): 31250.0 us. | |
LinkedHashMap(RunTime): 817000.0 us. | |
HashMap(RunTime): 0.7287397466317649 us. | |
SplayTreeMap(RunTime): 2.640243113585899 us. | |
LinkedHashMap(RunTime): 1.4227564198326554 us. | |
HashMap(RunTime): 0.7923399740667126 us. | |
SplayTreeMap(RunTime): 2.406854722248965 us. | |
LinkedHashMap(RunTime): 1.4545084306944913 us. |
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:math'; | |
/* | |
* Findings: | |
* streams can be single or broadcast, but not sure why the diff. | |
* can check if a stream is broadcast with isBroadcast | |
* StreamController make it easy to use a stream and send it events | |
*/ |
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
application: new-project-template | |
version: 1 | |
runtime: python27 | |
api_version: 1 | |
threadsafe: yes | |
handlers: | |
- url: (.*/) | |
static_files: static_content\1index.html | |
upload: static_content |
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
web: dart main.dart |
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:html'); | |
#import('dart:json'); | |
// Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | |
// for details. All rights reserved. Use of this source code is governed by a | |
// BSD-style license that can be found in the LICENSE file. | |
dataReceived(MessageEvent e) { | |
var data = JSON.parse(e.data); |
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
#library('lib2'); | |
#source('lib2_helper.dart'); | |
String lib2String = "hello from lib2"; |
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:dom', prefix:'dom'); | |
#import('dart:html'); | |
String VERSION = "1"; | |
String TODOS_STORE = 'todos'; | |
initDb(db) { | |
if (VERSION != db.version) { | |
dom.IDBVersionChangeRequest versionChange = db.setVersion(VERSION); | |
versionChange.addEventListener('success', (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
#import('dart:dom', prefix:'dom'); | |
#import('dart:html'); | |
main() { | |
dom.AudioContext audioContext = new dom.AudioContext(); | |
dom.AudioBufferSourceNode source = audioContext.createBufferSource(); | |
dom.AudioGainNode gainNode = audioContext.createGainNode(); | |
source.connect(gainNode, 0, 0); |
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
#!/usr/bin/ruby | |
require 'rubygems' | |
require 'hpricot' | |
require 'open-uri' | |
require 'ftools' | |
doc = Hpricot(open("http://postsecret.blogspot.com/")) | |
images = [] |