Skip to content

Instantly share code, notes, and snippets.

View jaytaph's full-sized avatar
:shipit:
Calculating pi

Joshua Thijssen jaytaph

:shipit:
Calculating pi
View GitHub Profile
@jaytaph
jaytaph / gist:4567305
Created January 18, 2013 19:02
parse_args
dll *given;
hash *needed;
given_count = given->size;
needed_count = needed->size;
// Three different situations
// 1. given_count is equal to need_count
// - Always OK. Map normally
// 2. given_count < need_count
class AppKernel extends Kernel
{
...
/**
* Add loader to load settings from /etc/bigproject/settings.conf
*/
protected function getContainerLoader(ContainerInterface $container)
{
imports:
- { resource: /etc/bigproject/settings.conf }
- { resource: parameters.yml }
@jaytaph
jaytaph / shiftin.php
Created February 11, 2013 14:26 — forked from Dynom/shiftin.php
<?php
/**
* @author Mark van der Velden <[email protected]>
*/
/*
* Given, the following specification:
* - part 1, 40 bits wide -- a number between 0 - 1099511627775
* - part 2, 5 bits wide -- a number between 0 - 31
* - part 3, 9 bits wide -- a number between 0 - 511
<?php
try {
// Some code that might trigger an error
} catch (exception $e) {
print "Exception raised: " . $e->getMessage() . "\n";
// Handle exceptions
}
@jaytaph
jaytaph / 001.php
Last active December 12, 2015 10:39
<?php
function foobar($filename) {
$f = fopen($filename, "r");
if (! $f) throw new Exception("Cannot open file $filename");
// Do stuff, maybe throw some exceptions
}
try {
@jaytaph
jaytaph / roadmap.rst
Last active December 12, 2015 10:49
roadmap - saffire v0.01

Saffire v0.01 Roadmap

This is the roadmap for releasing a version 0.01 release of Saffire.

Generic

These are all needed the core components for Saffire.

import numpy as np
import cv2
import os
import fnmatch
FLANN_INDEX_KDTREE = 1 # bug: flann enums are missing
flann_params = dict(algorithm = FLANN_INDEX_KDTREE, trees = 10)
/**
* Returns an iterator object. Must be implemented to work with foreach etc.
*/
interface iterable {
public method __iterator();
}
/**
* Actual iterator interface
import io;
class foo {
public method bar() {
io.print("Hi, this is ", self.__name(), ".bar\n");
}
}