Skip to content

Instantly share code, notes, and snippets.

Sami Ylönen samiy-xx

Block or report user

Report or block samiy-xx

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ugh.dart
void start() {
window.animationFrame.then(pump);
}
void pump(num delta) {
_time.pump();
_engine.update(_time);
_engine.draw(_time);
if (_keepPumping)
View blaa.dart
import 'dart:io';
void main() {
getFiles().then((List<String> paths) {
print(paths[0]);
});
}
Future<List<String>> getFiles() {
Completer<List<String>> c = new Completer<List<String>>();
@samiy-xx
samiy-xx / readfiles.dart
Created Dec 19, 2013
read files in dir
View readfiles.dart
var d = new Directory("PATH");
d.exists().then((bool exists) {
if (!exists)
return;
d.list().toList().then((List<FileSystemEntity> entities) {
entities.forEach((FileSystemEntity entity) {
if (entity is File) {
// Do something with the file
}
View quickie.dart
import 'dart:json' as json;
class CartItem {
int id;
String name;
String category;
CartItem(this.id, this.name, this.category);
Map toJson() {
View gist:5212544
import 'dart:html';
void main() {
RtcPeerConnection pc1 = new RtcPeerConnection(null);
RtcPeerConnection pc2 = new RtcPeerConnection(null);
pc1.onAddStream.listen((MediaStreamEvent e) {
print("pc1 got stream");
});
View test8361.dart
import 'dart:html';
void main() {
RtcPeerConnection pc1 = new RtcPeerConnection(null);
RtcPeerConnection pc2 = new RtcPeerConnection(null);
pc1.onAddStream.listen((MediaStreamEvent e) {
print("pc1 got stream");
});
@samiy-xx
samiy-xx / asynctest.dart
Created Jan 25, 2013
Async unittesting with Dart on the server side
View asynctest.dart
test("Channel, joining/leaving, fires event", () {
User u = TestFactory.getTestUser(userId, ws);
MockChannelConnectionEventListener l = new MockChannelConnectionEventListener();
c.subscribe(l);
bool wasJoined = false;
bool wasLeft = false;
l.joinCallback = (Channel chan, User user) {
expect(chan, equals(c));
expect(user, equals(u));
You can’t perform that action at this time.