Skip to content

Instantly share code, notes, and snippets.

View mbunge's full-sized avatar
💭
tinker, tinker, ponder, ponder

Marco Bunge mbunge

💭
tinker, tinker, ponder, ponder
View GitHub Profile
@mbunge
mbunge / Collection.php
Created July 24, 2012 15:25
A simple Collectionclass in PHP
<?php
/**
* @author Marco Bunge
* @copyright 2012 Marco Bunge <efika@rubymatrix.de>
*/
interface CollectionInterface
{
/**
* @abstract
@mbunge
mbunge / TraitFlavoredSqlBuilder.php
Created July 26, 2012 13:57
Trait flavored sqlbuilder (experiment)
<?php
/**
* @author Marco Bunge
* @copyright 2012 Marco Bunge <efika@rubymatrix.de>
*/
abstract class AbstractSqlCommand {
public function build(){
return implode(' ', $this->getCommandElements());
@mbunge
mbunge / mysteriousNaN.php
Created August 10, 2012 11:23
Hum. Can'T get any sense about this.
Since NaN is not even equal to itself, here is a way to test it:
From: http://de.php.net/manual/en/function.is-nan.php#50295
<?php
function my_is_nan($_) {
return ($_ !== $_);
}
@mbunge
mbunge / kol.md
Last active October 8, 2015 09:38
Key of life

The key of life is an infinite circle of

inspiration > idea > action > reflection >

@mbunge
mbunge / profiler.php
Created March 26, 2013 14:52
A small profiler.
<?php
class Profiler {
public $time = 0;
public $memory = 0;
public function startRecordTime(){
$this->time = microtime(true);
}
@mbunge
mbunge / bootatrap_ideas.php
Last active December 18, 2015 21:49
Some ideas how bootstrapper could work.
<?php
interface Bootstrap {
public function setBootstrapper(Bootstrapper $object);
public function registerTask($name, $callable);
public function getTasks();
}
interface Bootstrapper {
public function setParam($name,$value);
@mbunge
mbunge / stanalone_view.php
Created June 24, 2013 13:22
Read and reander views by recursion
<?php
class View {
public function throwException($message){
throw new Exception($message);
}
public function getPagesBySection($targetSection,$targetFolder,$decoratorCallback=null){
@mbunge
mbunge / xgs.scss
Last active December 19, 2015 08:58
Nextlevel Gridssystem - XGS by Marco Bunge of rubymatrix.de <marco.bunge@rubymatrix-de>. Based on 960gs (http://960.gs)
/*-----------------------------------------------------
Nextlevel Gridssystem - XGS
by Marco Bunge of rubymatrix.de <marco.bunge@rubymatrix-de>.
Based on 960gs (http://960.gs)
SASS Core
-------------------------------------------------------*/
/* Grid Settings
---------------------------*/
@mbunge
mbunge / loadjsfile.js
Created July 28, 2013 16:48
Load JavaScript asynchrone
var loadJsFile = function (filename) {
var fileref = document.createElement('script')
fileref.setAttribute("type", "text/javascript")
fileref.setAttribute("src", filename)
if (typeof fileref != "undefined") {
document.getElementsByTagName("head")[0].appendChild(fileref)
}
}
@mbunge
mbunge / impex.php
Last active December 22, 2015 07:39
ImpEx is managing profiles as anonymous functions. Each profile receive current ImpEx object and data of previous profile and return processed data. All profiles will executed by running order.
<?php
class ImpEx {
private $data = null;
private $rawData = null;
private $processData = null;
private $profiles = null;
const CSV_DELIMITER = ',';
const CSV_DELIMITER_EXCEL = ';';