Skip to content

Instantly share code, notes, and snippets.

View eevee's full-sized avatar
🦊

Eevee eevee

🦊
View GitHub Profile
@eevee
eevee / gist:3970206
Created October 28, 2012 22:29
passing a rust function as a C callback
extern fn status_foreach_callback(path: *c_char, stat: c_uint, payload: *c_void) -> c_int unsafe {
let path_str = str::raw::from_c_str(path);
let f: *fn(&str, uint) = cast::reinterpret_cast(&payload);
(*f)(path_str, stat as uint);
return 0;
}
// ...
#include <stdio.h>
#include <term.h>
void main() {
char** p = boolnames;
while (*p != NULL) {
printf("%p %p %c %s\n", p, *p, **p, *p);
p++;
}
}
display.rs:21:12: 21:27 error: cannot infer an appropriate lifetime due to conflicting requirements
display.rs:21 return @TerminalDisplay{
^~~~~~~~~~~~~~~
display.rs:13:56: 27:1 note: first, the lifetime cannot outlive the anonymous lifetime #4 defined on the block at 13:56...
display.rs:13 pub fn TerminalDisplay(game: @Game) -> @TerminalDisplay {
display.rs:14 let window = amulet::ll::init_screen();
display.rs:15 window.hide_cursor();
display.rs:16
display.rs:17 // Create persistent status areas
display.rs:18 let status_window = amulet::ll::new_window(0, 0, 0, game.map.width());
@eevee
eevee / gist:4186568
Created December 2, 2012 02:05
veekun datae
overworld items
- item balls
- hidden items
- spawned items (beaches in BW2)
shop contents
- shop in place X sells Y
- battle point exchange
- game corner
@eevee
eevee / everlang.rs
Created December 5, 2012 07:06
everlang solution in rust
fn main() {
for (io::stdin() as io::ReaderUtil).each_line |line| {
for str::words_each(line) |message| {
io::print(message);
io::print(" ");
if is_valid_message(str::chars(message)) {
io::println("VALID");
}
else {
io::println("INVALID");
@eevee
eevee / gist:4514402
Created January 11, 2013 22:12
Porting my IRC shenanigans to unreal
/mode #rust -n
/mode #rust +b ~q:*!*@*
/mode #rust +e ~q:~c:#rust
/mode #rust +e ~q:github!*@*
@eevee
eevee / .asoundrc
Created January 29, 2013 06:15
~/.asoundrc incantation
pcm.pulse {
type pulse
}
ctl.pulse {
type pulse
}
pcm.!default {
type pulse
}
ctl.!default {
@eevee
eevee / gist:4942613
Last active December 13, 2015 16:48
Pokédex API

RIGHT SO there are several use cases here; essentially we want to make the entire website navigable via API.

which means you should be able to REQUEST:

  • lookup a single Pokémon
  • retrieve a single Pokémon unambiguously -- by identifier or id
  • search across all manner of properties

and RETRIEVE:

  • any property
  • in any language
@eevee
eevee / TODO.md
Created February 15, 2013 23:13
TODO accretion for pyScss

BUGS

  • null is not supported -- it's treated as trueish

  • interactive mode is broken and untested

  • @keyframes is collapsed like it were a nested rule

  • content: ''; becomes content: ; (pull #51, breaks stuff)

@eevee
eevee / flags.rs
Created February 18, 2013 21:37
lvalues can update themselves in Rust? (there is probably a nicer way to write this)
enum Flag {
X0 = 1,
X1 = 2,
X2 = 4,
X3 = 8,
X4 = 16,
}
type Flagset = uint;