Skip to content

Instantly share code, notes, and snippets.

View bstrie's full-sized avatar

bstrie bstrie

View GitHub Profile
#!/bin/bash
#
# A script that identifies the root of the current rustc checkout.
# If the environment variable RUST_ROOT is not set, then it
# walks up from the current directory to find the right spot.
if [ -n "$RUST_ROOT" ]; then
echo "$RUST_ROOT"
exit 0
fi
@bstrie
bstrie / syntest.rs
Last active October 2, 2015 21:27
Rust syntax highlighter numeric literal stress test
fn main() {
//let bar = (~@&@~&~&@&~@&@&~&@&~@&~@&~@&~@&{ foo: 123.0f64 }).foo;
let _Aa1: int = 6789;
let _Ab1: int = 6__78__9__;
let _Ac1: int = 0xA6b2cDa;
let _Ad1: int = 0x__A6__b2__cD__A__;
let _Ae1: int = 0b0110010;
let _Af1: int = 0b__0__110__10__;
@bstrie
bstrie / gist:2324612
Created April 7, 2012 02:36 — forked from jamorton/gist:2323598
Pygments Test File
/** Comment
Thing / * * /
*/ /* */
// /* test
// TEST
// \\ / Comment \/ // */
set breakpoint pending on
break upcall_fail
r
bt
use std::comm::DuplexStream;
enum PingPong { Ping, Pong };
fn main() {
let (channel1, channel2): (DuplexStream<PingPong, PingPong>, DuplexStream<PingPong, PingPong>) = DuplexStream();
spawn |move channel1| {
channel.send(Ping),
loop {
extern mod rust_lua;
extern mod rust_lualib;
extern mod rust_lauxlib;
use rust_lua::*;
use rust_lualib::*;
use rust_lauxlib::*;
fn main() {
let L = luaL_newstate();
@bstrie
bstrie / fizzbuzz.rs
Last active October 12, 2015 20:48
// THIS CODE IS SOOO OBSOLETE. SUITABLE ONLY FOR HISTORICAL CURIOSITY
use int::range;
use option::get_default;
fn main() {
for range(1,101) |i| {
io::println(get_default(
(if i % 3 == 0 { Some(~"Fizz") } else { None } +
if i % 5 == 0 { Some(~"Buzz") } else { None }),
anonymous
anonymous / gist:4281920
Created December 14, 2012 02:04
extern mod std;
use io::WriterUtil;
const WIDTH: uint = 76;
const HEIGHT: uint = 10;
const NUM_BALLS: uint = 10;
struct Screen([[char * 76] * 10]);
#!/bin/bash
DIR="$PWD"
while [[ "$DIR" != "/" && "$DIR" != "$HOME" ]]; do
if [[ -r "$DIR/src/libsyntax/syntax.rc" ]]; then
echo "$DIR"
exit 0
fi
DIR=$(dirname "$DIR")
done
fn main() {
run_command("ls");
run_command("ls -l");
run_command("ls -l -a");
run_command("lua LoadGen.lua style=pointer_rust -spec=gl -version=3.3 \
-profile=core core_3_3");
}
fn run_command(command: &str) -> int {
let split = command.split_char(' ');