Skip to content

Instantly share code, notes, and snippets.

// Popcorn Instance Methods
var p = Popcorn( "#video" )
p.play()
// Play the video (Native "pass through" method)
// Returns the Popcorn instance object
p.load()
// Load the video (Native "pass through" method)
// Returns the Popcorn instance object
@db48x
db48x / gist:1931814
Created February 28, 2012 10:37
the two files not downloaded
[db48x@celebdil wikimedia-commons]$ diff -u file-list downloaded
--- file-list 2012-02-28 02:35:16.828651897 -0800
+++ downloaded 2012-02-28 02:36:36.849870222 -0800
@@ -724,8 +724,6 @@
Strassenbahn-TD.jpg
Strassenbahn_Wien_02.jpg
Streekbus_Connexxion.jpg
-StrugaGoleniowskaIna.jpg
-STS-116_solar_panel_jam.jpg
SUN_interieur.jpg
@db48x
db48x / gist:2041476
Created March 15, 2012 02:51
this doesn't work
fn tail<A:copy, IA:iterable<A>>(self:IA) -> fn@(fn(A)) {
ret fn@(blk:fn(A)) {
let mut first:bool = true;
self.iter {|a|
if (!first) {
blk(a);
} else {
first = false;
}
}
- for line in str::split_char(p.err, '\n') {
- if line == res {
- ret true;
- }
- }
- ret false;
+ ret iter::any(str::by_lines(p.err)) {|&&line| line == res };
compile_and_link: i686-pc-mingw32/stage0/bin/rustc/i686-pc-mingw32/bin/std.dll
compile_and_link: i686-pc-mingw32/stage0/bin/rustc/i686-pc-mingw32/bin/rustc.dll
src/rustc/syntax/ast.rs:6:28: 6:45 error: unresolved import: serialization::serialize_option
src/rustc/syntax/ast.rs:6 serialize_option,
^~~~~~~~~~~~~~~~~
src/rustc/syntax/ast.rs:7:28: 7:47 error: unresolved import: serialization::deserialize_option
src/rustc/syntax/ast.rs:7 deserialize_option,
^~~~~~~~~~~~~~~~~~~
src/rustc/syntax/ast.rs:8:28: 8:43 error: unresolved import: serialization::serialize_uint
src/rustc/syntax/ast.rs:8 serialize_uint,
@db48x
db48x / gist:2049012
Created March 16, 2012 07:35
implement KMP for substring iterator
// uses KMP
fn iter_matches(s:str, sep:str, count:option<uint>, f:fn(uint, uint)) {
let mut table = [-1, 0],
calls = 0u;
let mut pos = 0u, candidate = 0,
sep_len = str::len(sep);
while (pos < sep_len) {
if pos < 2u { pos += 1u; }
else if sep[pos - 1u] == sep[candidate] {
CC(target) /c/Users/db48x/AppData/Roaming/rust/rt/i686-pc-mingw32/libuv/Release/obj.target/uv/src/libuv/src/win/timer.o
../../../../src/libuv/src/win/timer.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
CC(target) /c/Users/db48x/AppData/Roaming/rust/rt/i686-pc-mingw32/libuv/Release/obj.target/uv/src/libuv/src/win/udp.o
../../../../src/libuv/src/win/udp.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
CC(target) /c/Users/db48x/AppData/Roaming/rust/rt/i686-pc-mingw32/libuv/Release/obj.target/uv/src/libuv/src/win/util.o
../../../../src/libuv/src/win/util.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
CC(target) /c/Users/db48x/AppData/Roaming/rust/rt/i686-pc-mingw32/libuv/Release/obj.target/uv/src/libuv/src/win/winapi.o
../../../../src/libuv/src/win/winapi.c:1:0: warning: -fPIC ignored for target (all code is position independent) [enabled by default]
CC(tar
0x6fef79cc in upcall_intrinsic_vec_push () from c:\users\db48x\appdata\roaming\rust\i686-pc-mingw32\stage1\bin\core-14bd852465126fe7-0.1.dll
(gdb) bt
#0 0x6fef79cc in upcall_intrinsic_vec_push () from c:\users\db48x\appdata\roaming\rust\i686-pc-mingw32\stage1\bin\core-14bd852465126fe7-0.1.dll
#1 0x26300020 in ?? ()
#2 0x6feccaf3 in str::iter_matches::_47ecef47d94c5c89 () from c:\users\db48x\appdata\roaming\rust\i686-pc-mingw32\stage1\bin\core-14bd852465126fe7-0.1.dll
#3 0x042d1980 in ?? ()
#4 0x6fecd06b in str::split_str::_713cfd6dfaff192b () from c:\users\db48x\appdata\roaming\rust\i686-pc-mingw32\stage1\bin\core-14bd852465126fe7-0.1.dll
#5 0x00000018 in ?? ()
#6 0x6fed1d10 in u64::from_str::_5a3661bbcf9e5421 () from c:\users\db48x\appdata\roaming\rust\i686-pc-mingw32\stage1\bin\core-14bd852465126fe7-0.1.dll
#7 0x051a8d28 in ?? ()
@db48x
db48x / gist:3158462
Created July 22, 2012 04:44
so far so good
[1]> (test)
(:NAME "Couatl" :FLAVOR "This great serpent has multicolored wings and eyes that glimmer with intense awareness." :NAME ("Couatl") :CR 10 :INIT "+7"
:SENSES "darkvision 60 ft." :AC "22, touch 13, flat-footed 18 (+3 Dex, +1 dodge, +9 natural, –1 size)" :HP "126 (12d10+60)" :FORT "+9" :REF "+13" :WILL
"+14" :SPEED "20 ft., fly 60 ft. (good)" :MELEE "bite +16 (1d8+7 plus" :SPACE "10 ft." :REACH "5 ft." :|SPECIAL ATTACKS| "" :|SPELL-LIKE ABILITIES|
("(CL 9th)" "Constant—detect chaos, detect evil, detect good, detect law"
"At will—detect thoughts (DC 15), ethereal jaunt (CL 16th), invisibility, plane shift (DC 20)")
:|SPELLS KNOWN|
("(CL 9th)" "4th (4/day)—charm monster (DC 17), freedom of movement" "3rd (7/day)—gaseous form, magic circle against evil, summon monster III"
"2nd (7/day)—cure moderate wounds, eagle's splendor, scorching ray, silence (DC 15)"
"1st (7/day)—endure elements, mage armor, obscuring mist, protection from chaos, true strike"
@db48x
db48x / split-dir.sh
Created November 25, 2012 03:29
split-dir test
#!/bin/bash -x
SCENARIO=$(basename $0 .sh)
DIRS="foo bar baz"
URL="file:///home/brooksd/reposurgeon/test/$SCENARIO"
svnadmin create "$SCENARIO"
svn checkout "$URL" "$SCENARIO-checkout"
pushd "$SCENARIO-checkout"