Skip to content

Instantly share code, notes, and snippets.

/*
* WARNING
* This is just an idea. This code might not actually run. There are no
* tests. It was abandoned before I could finish it.
*/
/*
* AutoQueue
*
* www.github.com/jtwb
@elieux
elieux / gist:fd63e62fda6a05778004
Created May 5, 2015 23:29
SCons MSYS2/mingw platform patch
--- /usr/lib/python2.7/site-packages/SCons/Platform/msys.py.orig 2014-11-04 23:23:28.000000000 +0100
+++ /usr/lib/python2.7/site-packages/SCons/Platform/msys.py 2015-05-06 01:27:32.333448600 +0200
@@ -39,6 +39,12 @@
posix.generate(env)
env['ENV']['PATH'] = os.getenv('PATH')
+ import_env = [ 'SystemDrive', 'SystemRoot', 'TEMP', 'TMP' ]
+ for var in import_env:
+ v = os.environ.get(var)
+ if v:
@djerius
djerius / compare.pl
Created July 22, 2018 17:39
benchmark hash element assignment and testing
use Benchmark ':all';
my @array = 1 .. 1000;
cmpthese(
10000,
{
'%foo = map { $_ => 1 } @array' => sub {
my %foo = map { $_ => 1 } @array;
enum Command (
CMD_Copy => 0,
CMD_ByteRepeat => 1,
CMD_WordRepeat => 2,
CMD_ByteInc => 3,
CMD_CopyExisting => 4
);
grammar AlttpDecompression {
@victornpb
victornpb / getDeepVal.js
Last active February 22, 2019 14:36
access a object value using a path like getDeepVal(obj, "foo.bar.baz")
/**
* Access a deep value inside an object
* Works by passing a path like "foo.bar", also works with nested arrays like "foo[0][1].baz"
* @author Victor B. https://gist.github.com/victornpb/4c7882c1b9d36292308e
* Unit tests: http://jsfiddle.net/Victornpb/0u1qygrh/
* @param {any} object Any object
* @param {string} path Property path to access e.g.: "foo.bar[0].baz.1.a.b"
* @param {any} [defaultValue=undefined] Optional value to return when property doesn't exist or is undefined
* @return {any}
*/
@md2perpe
md2perpe / README.md
Last active August 18, 2019 16:18
Railroad diagram for 'Hey Jude'
@jayarjo
jayarjo / Chunking: client-side
Last active August 26, 2019 13:56
Plupload Examples: Chunking
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr">
<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
<title>Plupload - Getting Started: Chunking</title>
<script type="text/javascript" src="js/plupload.full.min.js"></script>
</head>
@ViteFalcon
ViteFalcon / BackgroundImage.cpp
Last active September 9, 2019 07:13
OpenSceneGraph: Creating background image
// create a camera to set up the projection and model view matrices, and the subgraph to draw in the HUD
osg::ref_ptr<osg::Camera> camera = new osg::Camera();
// set the view matrix
camera->setReferenceFrame(osg::Camera::ABSOLUTE_RF);
// use identity view matrix so that children do not get (view) transformed
camera->setViewMatrix(osg::Matrix::identity());
// set the projection matrix to be of width and height of 1
camera->setProjectionMatrix(osg::Matrix::ortho2D(0, 1.0f, 0, 1.0f));
// set resize policy to fixed
@dagolden
dagolden / cpan-local-lib-demo.txt
Created January 5, 2011 11:31
Demo of CPAN.pm with local::lib bootstrap
cleanroom@vulcan:~$ /opt/perl/v5.13.7-clean/bin/cpan
CPAN is the world-wide archive of perl resources. It consists of about
300 sites that all replicate the same contents around the globe. Many
countries have at least one CPAN site already. The resources found on
CPAN are easily accessible with the CPAN.pm module. If you want to use
CPAN.pm, lots of things have to be configured. Fortunately, most of
them can be determined automatically. If you prefer the automatic
configuration, answer 'yes' below.
@ashwin
ashwin / depth_type_cvmat.cpp
Created August 27, 2015 04:46
Useful functions to get the depth or type of a cv::Mat
std::string GetMatDepth(const cv::Mat& mat)
{
const int depth = mat.depth();
switch (depth)
{
case CV_8U: return "CV_8U";
case CV_8S: return "CV_8S";
case CV_16U: return "CV_16U";
case CV_16S: return "CV_16S";