Skip to content

Instantly share code, notes, and snippets.

View Kimundi's full-sized avatar

Marvin Löbel Kimundi

  • Dortmund, Germany
View GitHub Profile
@Kimundi
Kimundi / foo.rs
Last active December 22, 2015 20:19
priv use std::prelude::*;
priv extern mod std;
mod __std_macros {
#[macro_escape];
#[doc(hidden)];
priv use std::prelude::*;
}
static SQUARE_SIZE: uint = 256;
static DEMI_SQUARE_SIZE: uint = SQUARE_SIZE / 2;
@Kimundi
Kimundi / ohnoes.rs
Created September 27, 2013 21:28 — forked from sw17ch/ohnoes.rs
fn r̄ͬ̇ͦ̓u͗͗̅̐s̔̈́ͯ̄̓ͭ͋tͣͯͦ̂̃̆̓_̍͌̉̃l̆a͐̾̿̋̈́n̉ͬͥ́ͪ̊gͭ͛̾_́cͪͬ͑͂̈oͭͨ̊̋̓ͧm̌̿̐̿ͤ̆͐e̔̓̆ͭͨ̾̚s() {
println("ĭ̒̚tͧ̂͆ͫ̄ ̃ͬ͗̍̂c̈͒̊õ͑̓ͩͦ͒m̊͗̐̒esͩ͛!ͨ̀ͩ̀͆̄̚ ĭ̿̈̍̀ͮ͑tͦ͂̉̒̔̇ ̓co͛́̾ͤ̄̉͌m͂͆̀ͫe͛ͨ͌̇͆ͣͥs͂!̇̌̎̆");
}
fn main() {
r̄ͬ̇ͦ̓u͗͗̅̐s̔̈́ͯ̄̓ͭ͋tͣͯͦ̂̃̆̓_̍͌̉̃l̆a͐̾̿̋̈́n̉ͬͥ́ͪ̊gͭ͛̾_́cͪͬ͑͂̈oͭͨ̊̋̓ͧm̌̿̐̿ͤ̆͐e̔̓̆ͭͨ̾̚s();
}
@Kimundi
Kimundi / gist:7640453
Created November 25, 2013 12:18 — forked from cnd/gist:7640445
let (cfg, appCfg) = if nix {(
& Path::new ( "~/.Sync.conf" ) ,
& Path::new ( "~/.Mirana.conf" )
)} else {
let prefix = getenv("HOME").unwrap_or(~"");
(
& Path::new ( prefix + "~/.Sync.conf" ),
& Path::new ( prefix + "~/.Mirana.conf" )
)
};
use output_stream::OutputStream;
use message::Message;
use wire_type::LengthDelimited;
pub struct OutputCounter {
byte_count: uint,
nested: ~[uint]
}
impl OutputCounter {
@Kimundi
Kimundi / caters
Created January 10, 2014 15:27 — forked from DylanLukes/caters
trait Category<S, T> {
fn id<A, AA: Category<A, A>>() -> AA;
fn compose<A, B, C, AB: Category<A, B>, BC: Category<B, C>, AC: Category<A, C>>(BC, AB) -> AC;
}
impl<'a, S, T> Category<S, T> for ('a |S| -> T) {
fn id<A, |A| -> A>() -> ('a |A| -> A) {
|a: A| -> A { a }
}
@Kimundi
Kimundi / foo.rs
Last active January 2, 2016 23:29
struct NotFancy<T> {
x: Option<T>
}
impl<T> NotFancy<T> {
fn simple0<'a>(&'a self) -> Option<&'a T> {
match *self.x {
Some(ref t) => Some(t),
None => None
}
enum X {
A(~str),
B(~str)
}
struct Y {
x: X
}
fn f(a: &mut Y) {
mod config {
pub enum Node<T> {
Directory(~str, ~[Node<T>]),
Entry(~str, ~T)
}
pub fn add_entry<T>(node: &Node<T>, entry: &Node<T>) -> ::std::option::Option<&Node<T>> {
match node {
Directory(name, list) => { ::std::vec::append_one(list, entry); Some(node) }
_ => { None }
@Kimundi
Kimundi / test.rs
Last active August 29, 2015 13:57
mod config {
pub enum Node<T> {
Directory(~str, ~[Node<T>]),
Entry(~str, ~T)
}
pub fn add_entry<'a, T>(node: &'a mut Node<T>, entry: Node<T>) -> Option<&'a mut Node<T>> {
if match node {
&Directory(_, ref mut list) => { list.push(entry); true }
_ => false
use std::{io,mem,raw,cast};
struct BlobContainingSlices<'a> {
data:~[u8],
subset1: &'a [u32],
subset2: &'a [u16],
}
fn slice_within_as<TO,FROM>(owner:&[FROM], start:uint, len_in_new_units:uint)->&[TO] {