Skip to content

Instantly share code, notes, and snippets.

function each(objOrArr, callback) {
/* Test to see if the argument is an array first since `typeof` does not
distinguish between arrays and plain objects. */
if (Array.isArray(objOrArr)) {
/* The `forEach` method of arrays does exactly what we want. The
function you pass to it is called for each item in the array and is
passed the item and its index. */
objOrArr.forEach(callback);
} else {
* @param $type
* @param $id
*
* @return array
*/
function slug($string)
{
$string = strtolower($string);
$string = str_replace(array('ä','ü','ö'), array('ä', 'ü', 'ö'), $string);
$string = str_replace(array('ä', 'ü', 'ö'), array('ae', 'ue', 'oe'), $string);
$string = str_replace('&', '-und-', $string);
$string = str_replace('/', '-oder-', $string);
$string = str_replace('@', '-at-', $string);
$string = str_replace('ß', '-ss-', $string);
$string = convert_accented_characters($string);

FooBar

Lorem Ipsum dfdfgdf

$test123123123 = "uadhsuiashdu";
@FlorianH
FlorianH / gist:667510
Created November 8, 2010 09:06
Doctype und HTML-Tag für ein "XHTML 1.0 transitional"-Dokument
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
class Blubb2 {
function __constuctor() {
echo "HU";
}
}
CREATE TABLE `bkp_guestbook` LIKE `guestbook`;
<?php
$connection = mysql_connect('localhost', 'root', '');
if (!$connection) {
echo "Verbindung konnte nicht hergestellt werden.";
} else {