Skip to content

Instantly share code, notes, and snippets.

/*
* robotNav.js
*
* The green key is located in a slightly more
* complicated room. You'll need to get the robot
* past these obstacles.
*/
function startLevel(map) {
// Hint: you can press R or 5 to "rest" and not move the
"""
An alternative Django ``TEST_RUNNER`` which uses unittest2 test discovery from
a base path specified in settings, rather than requiring all tests to be in
``tests`` module of an app.
If you just run ``./manage.py test``, it'll discover and run all tests
underneath the ``TEST_DISCOVERY_ROOT`` setting (a path). If you run
``./manage.py test full.dotted.path.to.test_module``, it'll run the tests in
that module (you can also pass multiple modules).
@thachhoang
thachhoang / gist:5250835
Last active December 15, 2015 11:09
Flexible error printing.
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h> /* va_start, va_end */
#define DEBUG 0
void fail(const char *, ...);
void ftrace(FILE *, const char *, ...);
void trace(const char *, ...);
@thachhoang
thachhoang / gist:4554465
Last active December 11, 2015 05:48
Random hex color code generator.
var color='#'+(Math.random()*0xFFFFFF<<0).toString(16);
// by nlogax
// http://paulirish.com/2009/random-hex-color-code-snippets/
@thachhoang
thachhoang / index.html
Created October 3, 2012 17:25
Given a multiple-choice question, record the very first answer test-takers choose.
<html>
<head>
<style>
label { display: block; }
.options { margin-bottom: 20px; }
</style>
<script type="text/javascript"
src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
$(function(){
@thachhoang
thachhoang / excel-theme-colors
Created October 3, 2012 17:03
Theme colors shown in the pickers for text/fill colors in Excel 2007.
private var colors:Array = [
0xffffff, 0x000000, 0xeeece1, 0x1f497d, 0x4f81bd, 0xc0504d, 0x9bbb59, 0x8064a2, 0x4bacc6, 0xf79646,
0xf2f2f2, 0x808080, 0xddd9c3, 0xc5d9f1, 0xdbe5f1, 0xf2dddc, 0xeaf1dd, 0xe5e0ec, 0xdbeef3, 0xfde9d9,
0xd8d8d8, 0x5a5a5a, 0xc5be97, 0x8db4e3, 0xb8cce4, 0xe6b9b8, 0xd7e4bc, 0xccc0da, 0xb6dde8, 0xfcd5b4,
0xbfbfbf, 0x404040, 0x948b54, 0x538ed5, 0x95b3d7, 0xd99795, 0xc2d69a, 0xb2a1c7, 0x93cddd, 0xfac090,
0xa5a5a5, 0x272727, 0x4a452a, 0x17375d, 0x376091, 0x953735, 0x75923c, 0x60497b, 0x31849b, 0xe46d0a,
0x7f7f7f, 0x0d0d0d, 0x1d1b11, 0x0f253f, 0x254061, 0x632523, 0x4f6228, 0x3f3151, 0x215867, 0x974807
];