Skip to content

Instantly share code, notes, and snippets.

View eevee's full-sized avatar
🦊

Eevee eevee

🦊
View GitHub Profile
@eevee
eevee / exceptions.pl
Created July 23, 2011 20:14
exception handling comparison
package My::Exception;
use Moose;
use Devel::StackTrace;
use overload
'""' => sub { shift->message };
has message => (
is => 'ro',
isa => 'Str',
@eevee
eevee / mako-lexer-fix.diff
Created January 31, 2012 22:37
fix for mako lexing bugs: embedded escaped quotes and dict literals
diff -r 1190503e3c7d mako/lexer.py
--- a/mako/lexer.py Sat Jan 21 18:57:01 2012 -0500
+++ b/mako/lexer.py Tue Jan 31 14:29:30 2012 -0800
@@ -91,31 +91,32 @@
def parse_until_text(self, *text):
startpos = self.match_position
+ text_re = r'|'.join(text)
+ brace_level = 0
while True:
@eevee
eevee / demo.html
Created March 15, 2012 22:52
gcc-python-plugin
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="http://stuff.veekun.com/reset.css"/>
<style type="text/css">
html {
height: 100%;
}
body {
display: box;
@eevee
eevee / hlscroll.pl
Created April 13, 2012 03:49
scroll to next/prev hilighted line in irssi
use strict;
use Irssi qw(command_bind MSGLEVEL_HILIGHT);
use vars qw($VERSION %IRSSI);
# Recommended key bindings: alt+pgup, alt+pgdown:
# /bind meta2-5;3~ /scrollback prev
# /bind meta2-6;3~ /scrollback next
$VERSION = '0.02';
%IRSSI = (
@eevee
eevee / gist:2920527
Created June 12, 2012 22:30
things veekun lacks
priority: -- through ++
due date: fall 2012! not sure when yet. get movin bucko
THINGS TO REDESIGN/REIMPLEMENT
++ pokemon
- consider doing something more useful with moves. perhaps only show current gen (or current compatible gens, i.e., 4 and 5), and put the massive table on yet another subpage?
++ pokemon flavor
- currently wasting a ton of space here, much of it on near-duplicates. need to consolidate like crazy.
- show differences between shiny/not, male/female in a more useful manner
@eevee
eevee / gist:3346875
Created August 14, 2012 06:21
ncurses hello world
use std;
import libc::types::common::c95::c_void;
import libc::types::os::arch::c95::c_char;
import libc::types::os::arch::c95::c_int;
type SCREEN = c_void;
type WINDOW = c_void;
extern mod ncurses {
fn initscr() -> *WINDOW;
@eevee
eevee / rolf.c
Created September 18, 2012 21:47
#include <assert.h>
#include <setjmp.h>
#include <signal.h>
#include <stdio.h>
static jmp_buf _strlen_jump;
static void* _strlen_label;
static void* _strlen_done_label;
static void _strlen_divzero(int signal) {
_strlen_label = _strlen_done_label;
extern mod std;
use std::map::HashMap;
use std::map::Set;
use std::map::vec_from_set;
enum Choice {
Many(Set<int>),
One(int),
}
trait Context<T> {
fn enter() -> T;
fn exit();
fn with(block: fn(T)) {
block(self.enter());
self.exit();
}
}
@eevee
eevee / gist:3901262
Created October 16, 2012 19:02
Rust nitpicks
Some rough edges I have bumbled across. Bearing in mind that I don't do a lot
of low-level statically-typed work:
- Strings are indexed as `u8`, which is incompatible with `char`. If strings
are going to be a first-class type, they should really really REALLY REALLY
act as sequences of Unicode codepoints as much as possible, whatever the
implications of that may be. A trait for `[u8]` could add some niceties for
sequences of meaningless bytes, and `str` could have a method that provides
a view to its UTF-8 encoded byte sequence without needing copying etc. (I
know, indexing by codepoint is O(n), but there are countermeasures.)