Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@badboy
badboy / playground.rs
Created December 12, 2018 19:13 — forked from rust-play/playground.rs
Code shared from the Rust Playground
trait StateSet {
fn next(self) -> (u32, Self);
}
trait State {
type S: StateSet;
fn next(self) -> (u32, Self::S);
}
macro_rules! delegate {
@badboy
badboy / playground.rs
Created September 27, 2018 20:05 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#![allow(unused)]
use std::collections::HashMap;
#[derive(Debug)]
enum Scalar {
String(String),
Unsigned(u32),
Bool(bool),
}
@badboy
badboy / playground.rs
Created September 27, 2018 16:27 — forked from rust-play/playground.rs
Code shared from the Rust Playground
use std::any::Any;
use std::any::TypeId;
#[derive(Debug)]
enum Scalar {
String(String),
Unsigned(u32),
Bool(bool),
}
@badboy
badboy / playground.rs
Created September 27, 2018 15:53 — forked from rust-play/playground.rs
Code shared from the Rust Playground
#![allow(unused)]
mod generic {
pub struct Scalar<T: Default> {
value: T,
}
impl<T: Default> Scalar<T> {
pub fn new() -> Self {
Scalar {
@badboy
badboy / hkt.rs
Created March 26, 2016 11:33 — forked from 14427/hkt.rs
Higher-kinded type trait
use std::rc::Rc;
pub trait HKT<U> {
type C; // Current type
type T; // Type with C swapped with U
}
macro_rules! derive_hkt {
($t:ident) => {
impl<T, U> HKT<U> for $t<T> {
@badboy
badboy / es6-arrows.sjs
Last active August 29, 2015 14:05 — forked from btd/es6-arrows.sjs
// sweet.js arrow function macro
// https://github.com/mozilla/sweet.js/
macro => {
rule infix { ( $arg:ident (,) ... ) | { $body ... $last:expr } } => {
(function ( $arg (,) ... ) {
$( $body) ...
return $last
}).bind(this)
}
@badboy
badboy / README
Created December 16, 2013 23:14 — forked from bharrisau/README
Need to open /usbkey/config and add
admin_v6_ip=xx:xx:xx/xx
admin_v6_gateway=yy:yy:yy
place ipv6 in /opt/custom/smf
place ipv6.xml in /opt/custom/scripts
@badboy
badboy / README.md
Last active January 25, 2023 12:47 — forked from ryanb/README.md
Save github issues offline.

First install the required gems:

gem install octokit awesomeprint rainbow

Then run it to extract all of your open GitHub issues into files (with comments).

ruby my-gh-issues.rb
@badboy
badboy / README.md
Created June 19, 2013 19:05 — forked from ryanb/README.md

First install the required gems:

gem install octokit awesomeprint rainbow

Then run it to extract all of your open GitHub issues into files (with comments).

ruby my-gh-issues.rb
@badboy
badboy / git-unmerged.tcl
Last active December 17, 2015 14:49 — forked from antirez/gist:4554824
#!/usr/bin/tclsh
#
# Usage: git-unmerged branch1 branch2
#
# Shows all the non-common commits in the two branches, where non-common
# commits means simply commits with a unique commit *message*.
proc getlog branch {
lrange [split [exec git log $branch --oneline] "\n"] 0 400
}