This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
struct A<T: Test> { | |
a: T, | |
} | |
impl<T: Test> A<T> { | |
fn new<U: Test>(t: T) -> A<T> { | |
A { a: t } | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
__git_ps1() { | |
if [ "$(git status -s 2>&1 1>/dev/null)" ]; then | |
return | |
fi | |
local nn=$(git status -s 2>/dev/null | grep "??" | sed -n '$=') | |
local nc=$(git status -s 2>/dev/null | grep M | sed -n '$=') | |
local branch=$(git branch 2>/dev/null | grep "*" | sed 's/^* //') | |
nn=$nn | |
nc=$nc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
__git_ps1() { | |
if [ "$(git status -s 2>&1 1>/dev/null)" ]; then | |
return | |
fi | |
if [ -z "$(ps | grep fetch | grep -v grep)" ]; then | |
(git fetch 2>/dev/null 1>/dev/null &) > /dev/null | |
fi |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// requires the 'graphics' package | |
use graphics::math::{Vec2d, Matrix2d}; | |
fn transform(t: Matrix2d, e: [Vec2d; 2]) -> [Vec2d; 2] { | |
use graphics::math::transform_pos; | |
[ | |
transform_pos(t, e[0]), | |
transform_pos(t, e[1]), | |
] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function bchangedat { | |
git log -1 $@ | grep 'Date: ' | perl -pe 's|^\S+\s+(.+?)\s+\S+$|\1|' | |
} | |
function mywork { | |
bwithdates=$( | |
for i in $(git branch | sed 's/^..//'); do | |
chng=$(bchangedat $i --date=raw --author=`git config --global user.name`) | |
if [ "$chng" ]; then | |
echo $chng $i "($( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extern crate ketos; | |
use ketos::{Interpreter, FromValue}; | |
macro_rules! ketos_mod { | |
( | |
mod $name:ident { | |
$( $inner:tt )* | |
} | |
) => { | |
mod $name { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
macro_rules! overloaded { | |
( | |
fn $name:ident | |
$( | |
($first_name:ident : $first_type:ty) -> $out:ty; | |
$body:block | |
)* | |
) => { | |
fn $name<T: Inner>(f: T) -> <T as Inner>::Output { | |
Inner::do_inner(f) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use ::set::Set; | |
use std::convert::TryFrom; | |
use std::ops::Add; | |
use sdl2::rect::Rect as SdlRect; | |
use num::Num; | |
pub type Bounds = Rectangle<f64>; | |
pub type Clip = Rectangle<u32>; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$def is_even:a ( | |
$def is_even_internal: counter even | |
$if counter | |
is_even_internal: sub: counter 1 not:even | |
even; | |
is_even_internal: a 1 | |
); | |
$def ?a $if a "yes" "no"; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#![feature(pattern)] | |
use std::str::pattern::Pattern; | |
use std::marker::PhantomData; | |
#[derive(PartialEq, Eq)] | |
enum Method { | |
Get, | |
Post, | |
Put, |
OlderNewer