Skip to content

Instantly share code, notes, and snippets.

Avatar

Mathijs Bernson mbernson

View GitHub Profile
View lol.php
<?php
function rgb_rand()
{
$r1 = mt_rand(0,255);
$r2 = mt_rand(0,255);
$r3 = mt_rand(0,255);
return 'rgb('.$r1.', '.$r2.', '.$r3.')';
}
?>
@mbernson
mbernson / ar.php
Created Jun 22, 2011
Array filter
View ar.php
<pre><?php
$ar = array(
array(103,105,108),
array(53,231,451),
array(103,12,32),
array(623,125,156)
);
$count = 0;
foreach($ar as $i)
View kaasschaaf.php
<?php
/*
* Count from 1 to 100,
* for every multiple of 3, echo "Kaas"
* for every multiple of 5, echo "Schaaf"
*/
function kaasschaaf()
{
$output = '';
for($c = 1; $c <= 100; $c++)
View autoloader.inc.php
<?php
/**
** @file autoloader.inc.php
** @author immeëmosol (programmer dot willfris at nl)
** @date 2010-12-06
** Created: lun 2010-12-06, 14:05.13 CET
** Last modified: lun 2010-12-06, 15:19.01 CET
**/
$classes_directory = dirname( __FILE__ ) . DIRECTORY_SEPARATOR . 'classes';
View autoload.inc.php
<?php
/*
* Autoloader
*/
function mb_autoload($class_name)
{
require_once('classes/'.$class_name.'.class.php');
}
View IfException.php
<?php
/**
* @file IfException.php
* @author
* - immeëmosol (programmer dot willfris at nl)
* @date 2011-09-22
* Created: ĵaŭ 2011-09-22, 02:14.46 CEST
* Last modified: ĵaŭ 2011-09-22, 05:02.52 CEST
**/
View gist:1324320
PHP OOP
Team
- Mathijs
- Stefan
- Farid
- Ertugrul
- Bahtiyar
- Danny
- Fons
@mbernson
mbernson / View.php
Created Nov 23, 2011
PHP View object
View View.php
<?php
/**
* View class.
*
*
*/
class View
{
protected $data = array();
@mbernson
mbernson / hide-jimmy-wales.user.js
Created Nov 28, 2011 — forked from mathiasbynens/hide-jimmy-wales.user.js
Userscript that hides Jimmy Wales on Wikipedia
View hide-jimmy-wales.user.js
// ==UserScript==
// @name Hide Jimmy Wales.
// @match http://*.wikipedia.org/*
// ==/UserScript==
(function() {
var banner = document.getElementById('siteNotice');
banner && banner.style.display = 'none';
}());
@mbernson
mbernson / Punt.js
Created Jan 23, 2012
Punt class in Javascript
View Punt.js
/**
* Punt
*/
var Punt = function( x, y )
{
this.x = x || 0;
this.y = y || 0;
this.distance = function( punt )
{