Skip to content

Instantly share code, notes, and snippets.

@sbillig
sbillig / Makefile
Created Jan 28, 2014
C++ starter Makefile
View Makefile
CXX := clang++
CXXFLAGS := -isystem ./external -std=c++11 -stdlib=libc++ -MMD -MP \
-Wall -Wpedantic -Wextra -Weffc++ -O3
SRCS := $(wildcard src/*.cpp)
OBJS := $(SRCS:.cpp=.o)
TESTSRCS := $(wildcard tests/*.cpp)
TESTOBJS := $(TESTSRCS:.cpp=.o)
TESTOBJS += $(filter-out src/main.o,$(OBJS))
@sbillig
sbillig / gist:5287073
Created Apr 1, 2013
Rust str each_char error.
View gist:5287073
use core::str::*;
fn main() {
let s = ~"hello";
let f = |ch| { io::println(fmt!("%?",ch)); true };
// Works:
each_char(s, f);
// Fails:
// s.each_char(f);
@sbillig
sbillig / gist:5272756
Last active Dec 15, 2015 — forked from thomaslee/gist:4753338
Dumb "Hello World" TCP server in Rust. Updated for Rust 0.6
View gist:5272756
extern mod std;
use std::net;
use std::uv;
type ErrChan = comm::SharedChan<Option<net::tcp::TcpErrData>>;
fn on_ready(_kill_ch: ErrChan) {
io::println("listener is ready");
}