Skip to content

Instantly share code, notes, and snippets.

struct A<T: Test> {
a: T,
}
impl<T: Test> A<T> {
fn new<U: Test>(t: T) -> A<T> {
A { a: t }
}
}
__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
#!/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
// 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]),
]
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 "($(
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)
extern crate ketos;
use ketos::{Interpreter, FromValue};
macro_rules! ketos_mod {
(
mod $name:ident {
$( $inner:tt )*
}
) => {
mod $name {
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>;
$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";
@jFransham
jFransham / stack_router.rs
Last active August 26, 2016 12:00 — forked from anonymous/playground.rs
Trying to improve on the Iron router's performance without sacrificing ergonomics
#![feature(pattern)]
use std::str::pattern::Pattern;
use std::marker::PhantomData;
#[derive(PartialEq, Eq)]
enum Method {
Get,
Post,
Put,