Skip to content

Instantly share code, notes, and snippets.

View zslayton's full-sized avatar

Zack Slayton zslayton

View GitHub Profile
@zslayton
zslayton / demo_client.js
Created December 27, 2011 18:38
Demo client & server for issue #359
var io_client = require('socket.io-client');
host = 'localhost';
port = 8001;
var url = "http://" + host + ":" + port;
var client = io_client.connect(url);
console.log("Attempting to connect with server@" + host + ":" + port);
extern mod extra;
use extra::treemap::TreeMap;
fn main(){
let mut map : ~TreeMap<~str, ~str> = ~TreeMap::new();
map.swap(~"dog", ~"cat");
let value : &~str = map.find(&~"dog").unwrap();
println!("dog -> {:s}", *value);
extern mod extra;
use extra::treemap::TreeMap;
use extra::json::{Json,Object};
enum NestedSearchError {
NoSuchAncestor(~str),
NoSuchKey,
TypeMismatch
}
extern mod extra;
use extra::treemap::TreeMap;
use extra::json::{Json,Object,from_str};
/*
fn find_nested_string(&self, key_iterator: I) -> Result<V, NestedSearchError>;
fn find_nested_number(&self, key_iterator: I) -> Result<V, NestedSearchError>;
fn find_nested_boolean(&self, key_iterator: I) -> Result<V, NestedSearchError>;
fn find_nested_list(&self, key_iterator: I) -> Result<V, NestedSearchError>;
{
"module": {
"view_items": [
{
"node": [
"ViewItemUse",
[
{
"node": [
"ViewPathGlob",
fn main(){
let json_value = from_str("{\"dog\" : \"cat\"}").unwrap();
let keys = &[
&~"1", &~"2", &~"3", &~"4", &~"5", &~"6", &~"7", &~"8", &~"9", &~"10",
&~"11", &~"12", &~"13", &~"14", &~"15", &~"16", &~"17", &~"18", &~"19", &~"20",
&~"21", &~"22", &~"23", &~"24", &~"25", &~"26", &~"27", &~"28", &~"29", &~"30",
&~"31", &~"32", &~"33", &~"34", &~"35", &~"36", &~"37", &~"38", &~"39", &~"40",
&~"41", &~"42", &~"43", &~"44", &~"45", &~"46", &~"47", &~"48", &~"49", &~"50"
#![feature(globs)]
extern crate mio;
use mio::*;
use mio::net::*;
use mio::net::tcp::*;
const SERVER: Token = Token(0);
struct Server {
#!/usr/bin/python
import socket, time
connections = []
for i in range(10000):
s = socket.socket()
s.connect(("localhost", 44444))
connections.append(s)
if len(connections) % 100 == 0:
print "Connections: " + str(len(connections))
print "Sleeping"
pub trait ToMessageHandler {
fn to_message_handler<'a>(self) -> Box<MessageHandler + 'a>;
}
impl <'b, F> ToMessageHandler for F where F : Fn(&Frame) -> AckOrNack + 'b {
fn to_message_handler<'a>(self) -> Box<MessageHandler + 'a> {
Box::new(ClosureMessageHandler{closure : self}) as Box<MessageHandler>
}
}
$ ./mach build
Usage: git submodule [--quiet] add [-b branch] [-f|--force] [--reference <repository>] [--] <repository> [<path>]
or: git submodule [--quiet] status [--cached] [--recursive] [--] [<path>...]
or: git submodule [--quiet] init [--] [<path>...]
or: git submodule [--quiet] update [--init] [-N|--no-fetch] [-f|--force] [--rebase] [--reference <repository>] [--merge] [--recursive] [--] [<path>...]
or: git submodule [--quiet] summary [--cached|--files] [--summary-limit <n>] [commit] [--] [<path>...]
or: git submodule [--quiet] foreach [--recursive] <command>
or: git submodule [--quiet] sync [--] [<path>...]
Error running mach: