Skip to content

Instantly share code, notes, and snippets.

View atebitftw's full-sized avatar
💭
I may be slow to respond.

AteBit atebitftw

💭
I may be slow to respond.
  • Santa Monica, CA
View GitHub Profile
@ltackmann
ltackmann / SVGSamples.dart
Created December 29, 2011 04:09
SVG in Dart
#import('dart:html');
class SVGSamples {
void run() {
drawlines();
}
void drawlines() {
final int maxY = 250;
@d2m
d2m / gist:1696850
Created January 29, 2012 02:36
Read/write files server-side under frogsh/minfrog
/**
* location: dart/frog/file_system_node.dart
* library: file_system_node
* class: NodeFileSystem
* File system implementation using nodejs api's (for self-hosted compiler).
*/
#import('../../frog/file_system_node.dart');
NodeFileSystem _fs = new NodeFileSystem();
@sethladd
sethladd / app.dart
Created February 2, 2012 05:39
Web Audio API and Dart
#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);
#import('dart:io');
void main() {
List<int> data = [0x00, 0x01, 0x10, 0x11, 0x7e, 0x7f, 0x80, 0x81, 0xfe, 0xff];
ListInputStream stream = new ListInputStream();
int count = 0;
ReceivePort donePort = new ReceivePort();
stream.write(data);
void onData() {
print('bytes available on stream is ' + stream.available());
@adam-singer
adam-singer / CrimsonHttpImportPatch.diff
Created March 31, 2012 23:43
Quick Dart Starter Pack
diff --git a/core/crimson.dart b/core/crimson.dart
index 50c09e1..938c7a8 100644
--- a/core/crimson.dart
+++ b/core/crimson.dart
@@ -6,7 +6,7 @@
#library("crimson:core");
-#import('../../log4dart/LogLib.dart');
+#import('../../log4dart/Lib.dart');
@pjako
pjako / docsGen.dart
Created April 3, 2012 13:05
Dart Docs generation Script
#import('dart:io');
final String PATH_TO_DARTSDK = "/Users/XYZ/dart-sdk";
final String SUBDIRECTORY = "";
final String LIBRARY_DARTFILE = "XYZ.dart";
@adam-singer
adam-singer / dartIrcbot.dart
Created April 21, 2012 06:18
simple dart bot that joins irc.freenode.net/#dart
#import("dart:io");
#import("dart:utf");
#import('dart:json');
#import('dart:isolate', prefix:'isolate');
String API_KEY = "INSERT_KEY_HERE";
class Bot {
Socket socket;
bool sendNick = true;
String botName = "dartBot";
@adam-singer
adam-singer / decoder.dart
Created April 25, 2012 04:24
redis dart decoder
#import("../lib/redis.dart");
#import("dart:utf");
void main() {
String okStr = "+OK";
String getStr = "\$16\r\nmy spaced string\r\n";
String listStr = "*4\r\n\$5\r\nWorld\r\n\$5\r\nHello\r\n\$3\r\nbar\r\n\$3\r\nfoo\r\n";
Utils.setVerboseState();
Decoder decoder = new Decoder(listStr);
var i = decoder.decode();
@adam-singer
adam-singer / dartVisitorDesignPattern.dart
Created June 26, 2012 03:41
Basic Visitor Pattern Example
// Reference: http://en.wikipedia.org/wiki/Visitor_pattern
interface CarElementVisitor {
void visitWheel(Wheel wheel);
void visitEngine(Engine engine);
void visitBody(Body body);
void visitCar(Car car);
}
interface CarElement {
void accept(CarElementVisitor visitor); // CarElements have to provide accept().