Skip to content

Instantly share code, notes, and snippets.

View mythmon's full-sized avatar

Michael Cooper mythmon

View GitHub Profile
@mythmon
mythmon / gist:8108065
Created December 24, 2013 02:39
Spot It symbols
!
?
apple
art
balloon
bomb
bottle
cactus
candle
car
@mythmon
mythmon / gist:8102730
Created December 23, 2013 19:07
How I want ES6 promises to work (sometimes).
var p;
var stream;
function foo() {
p = new Promise();
stream = TweakWidgets();
stream.once('message', bar);
return p;
}
@mythmon
mythmon / parsing_http.ipynb
Last active December 30, 2015 12:29
iPython notebook for parsing http requests.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
@mythmon
mythmon / .jshintrc
Last active December 30, 2015 09:39
Genetic Algorithms to find images made of triangles.
{
"undef": true,
"strict": false,
"browser": true,
"loopfunc": true,
"asi": false,
"eqeqeq": true,
"evil": false,
"shadow": false,
"unused": true,
@mythmon
mythmon / grid.rs
Last active December 29, 2015 22:49
I'm having trouble with rust borrowed pointers
$ rust run tetrissums.rs
grid.rs:9:27: 9:32 error: Illegal anonymous lifetime: anonymous lifetimes are not permitted here
grid.rs:9 highlight: Option<&'self Piece>,
^~~~~
pieces.rs:4:15: 4:19 error: Illegal anonymous lifetime: anonymous lifetimes are not permitted here
pieces.rs:4 grid: &'self Grid,
#!/usr/bin/env python
import os
import re
import subprocess
import requests
repo_dir = "{HOME}/src/kitsune".format(**os.environ)
environments = {
@mythmon
mythmon / githelper.py
Created November 18, 2013 22:14
A helper to make calling git with subprocess nicer in python.
def to_cli_args(*args, **kwargs):
cmd = []
for k, v in kwargs.items():
short = len(k) == 1
if short:
cmd.append('-' + k)
if v is not True:
cmd.append(v)
else:
if v is True:
@mythmon
mythmon / gist:7236259
Created October 30, 2013 17:05
This is my test for showfor.
>= tests
for fx:
{for fx}null{/for}
{for fx,win}win{/for}
{for fx,winxp}winxp{/for}
{for fx,win7}win7{/for}
{for fx,win8}win8{/for}
{for fx,mac}mac{/for}
{for fx,linux}linux{/for}
diff --git a/kitsune/offline/tests/test_views.py b/kitsune/offline/tests/test_views.py
index e3dc13b..b65155f 100644
--- a/kitsune/offline/tests/test_views.py
+++ b/kitsune/offline/tests/test_views.py
@@ -16,6 +16,13 @@ from kitsune.wiki.tests import document, revision
class OfflineViewTests(TestCase):
+ def setUp(self):
+ super(OfflineViewTests, self).setUp()
@mythmon
mythmon / test.rs
Created August 26, 2013 02:04
Short self contained test case demonstrating something I don't understand about rust.
fn foo<T:Copy>(arr: ~[T]) -> ~[T] {
~[arr[0]]
}
fn main() {
let bar = ~[1,2,3];
for foo(bar).iter().advance |i| {
println(fmt!("%?", i));
}
}