Skip to content

Instantly share code, notes, and snippets.

View pnkfelix's full-sized avatar
🍩
re-pat; ex-🥐

Felix S Klock II pnkfelix

🍩
re-pat; ex-🥐
View GitHub Profile
#[macro_escape];
use std::rt::task::Task;
use std::rt::local::Local;
mod libunwind;
macro_rules! run(
($expr:expr) => (
{
@chris-morgan
chris-morgan / result_for.rs
Created February 20, 2014 02:19
A prototype of a `Result<T, E>`-based `Iterator<T, E>` replacing the `Option<T>`-based `Iterator<T>`.
#[feature(macro_rules)];
// There must be two variants of the macro for this simple prototype, each of
// them lacking one important feature and with one remaining feature completely
// infeasible in a macro_rules! macro. Done properly in the compiler these
// would be entirely reasonable.
// A variant with support for an output value from the else clause, but with no
// support for breaking out of the `for` block.
macro_rules! forr1 (
////////////////////
// in visit.rs:
trait Visitor {
fn visit_item(&mut self, item: @ast::item) { ... }
fn visit_expr(&mut self, expr: @ast::expr) { visit_expr(self, expr); }
...
}
// default implementations:
@nikomatsakis
nikomatsakis / gist:5443789
Created April 23, 2013 14:01
elisp to move diff hunks to another buffer
(defun diff-hunk-move (dest-buffer)
"Move current hunk to another buffer."
(interactive "bBuffer to move to:")
(save-excursion
(let* ((start
(point))
(start-of-file
(ignore-errors
(goto-char start)
(diff-beginning-of-file)
@nikomatsakis
nikomatsakis / gist:5533501
Created May 7, 2013 15:26
Make etags-select invoke visit-tags-table is tags-table-list is empty
commit f4a21a1e16f6e9234dc4930b4a68feb67fafaf1b
Author: Niko Matsakis <niko@alum.mit.edu>
Date: Tue May 7 11:25:56 2013 -0400
query if the tags table is not yet loaded
diff --git a/emacs/etags-select.el b/emacs/etags-select.el
index 751ac18..96bcdb0 100644
--- a/emacs/etags-select.el
+++ b/emacs/etags-select.el
@ilyakatz
ilyakatz / chrubuntu12.04.md
Last active December 17, 2015 05:59
html5 video

Ubuntu 12.04 on Samsung ChromeBook

Prerequisites

  • perform system update
    • if you do it later it will ask for all kind of permissions to override various config files
    • change password for root
      • default password is user

###Fix trackpad sudo apt-get install git

  • perform system update
    • if you do it later it will ask for all kind of permissions to override various config files
    • change password for root
      • default password is user
  • Fix trackpad
  • logout and log back in
@Aatch
Aatch / trait_visitor.rs
Created June 26, 2013 07:41
Visitor impl using a trait & default methods.
#[allow(default_methods)];
extern mod syntax;
use std::os;
use syntax::abi::AbiSet;
use syntax::codemap::span;
use syntax::parse;
use syntax::opt_vec;
@klutzy
klutzy / hello.rs
Last active April 26, 2016 19:15
Rust with Emscripten
// emscripten uses le32-unknown-nacl triple but rustc doesn't know it now.
// So just use similar target instead.
// `rustc hello.rs --target=i686-unknown-linux --emit-llvm -S --cfg libc`
// `emcc hello.ll -o hello.js`
// no `extern mod`.
#[no_std];
#[feature(macro_rules)];
use core::container::Container;
@amatus
amatus / rust_for_rpi.md
Last active February 18, 2017 21:13 — forked from anonymous/gist:6664882
Howto build a rust compiler for the Raspberry Pi on Debian 7.1 (wheezy)

Howto build a rust compiler for the Raspberry Pi on Debian 7.1 (wheezy)

sudo apt-get install git build-essential
test `uname -m` = x86_64 && sudo apt-get install ia32-libs
git clone https://github.com/raspberrypi/tools.git
export PATH=$PWD/tools/arm-bcm2708/gcc-linaro-arm-linux-gnueabihf-raspbian/bin:$PATH
git clone http://github.com/mozilla/rust.git
cd rust
./configure --target-triples=arm-unknown-linux-gnueabihf

make