This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Portfolio extends Composite { | |
public function __construct() { | |
parent::__construct(); | |
$this->addChild( | |
new Template("../views/head.html"), | |
new Menu( | |
new Template("../views/menu.html") | |
), | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class="block"> | |
<div class="inner"> | |
<h2>Files found:</h2> | |
<table> | |
<tr> | |
<th>Last modified</th> | |
<th>File name</th> | |
</tr> | |
[iterator getFiles] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// | |
/// | |
/// | |
/// | |
float BernsteinBasis(const int d, const int n, float x) { | |
// Binomial coefficient: | |
const int b = Factorial(d) / (Factorial(d - n) * Factorial(n)); | |
// Bernstein polynomial: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Line.prototype.intersection = function(other) { | |
// Quick hack to make this work. I've taken this code from my C++ project. | |
var p1 = this.a; | |
var d1 = this.b; | |
var p2 = other.a; | |
var d2 = other.b; | |
console.log("--- starting intersection --"); | |
//function solve(p1, d1, p2, d2) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template <class T, typename...PARAMS> | |
T* Load(const std::string& ident, PARAMS...args) { | |
// Create a hash from the first parameter: | |
long hash = StringHash(ident); | |
auto it = resources.find(hash); | |
if (it != resources.end()) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void ConnectedComponentLabeling() { | |
std::vector<Color> colors; | |
colors.push_back(Color::Red); | |
colors.push_back(Color::Blue); | |
colors.push_back(Color::Purple); | |
colors.push_back(Color::Yellow); | |
colors.push_back(Color::Green); | |
colors.push_back(Color::Grey); | |
colors.push_back(Color::Cyan); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/// Calculate a point on a bézier curve. Works for any number of control | |
/// points. | |
/// | |
/// TODO: contemplate a generic version that does not require std::vector. | |
/// perhaps iterators or clever template usage? Resort to C style arrays? | |
/// | |
/// | |
/// @param points A collection indicating the control points. | |
/// @param delta Interval at which to calculate the point, ranges from 0 to 1. | |
/// @return a point on a bézier curve. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function blaat(var upperbound) { | |
var result = 0; | |
for(var i = 0; i < upperbound; ++i) { | |
for(var j = i; j < upperbound; ++j) { | |
++result; | |
} | |
} | |
return result; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <cstdlib> | |
#include <thread> | |
#include <iostream> | |
#include <cstring> | |
#include <unistd.h> | |
#include <netdb.h> | |
#include <netinet/in.h> | |
#include <netinet/tcp.h> | |
#include <sys/socket.h> | |
#include <arpa/inet.h> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/php | |
<?php | |
if(!isset($argv[1])) { | |
print "Usage: $argv[0] path" . PHP_EOL; | |
exit; | |
} | |
date_default_timezone_set("UTC"); |