Skip to content

Instantly share code, notes, and snippets.

View joachimdoerr's full-sized avatar

Joachim Dörr joachimdoerr

  • Germany
View GitHub Profile
@font-face {
font-family: 'EntypoRegular';
src: url('font/entypo.eot');
src: url('font/entypo.eot?#iefix') format('embedded-opentype'),
url('font/entypo.woff') format('woff'),
url('font/entypo.ttf') format('truetype'),
url('font/entypo.svg#EntypoRegular') format('svg');
font-weight: normal;
font-style: normal;
}
@dominicvogl
dominicvogl / analytics.html
Last active August 16, 2022 09:06
Google Analytics Snippet with Anonymize IP
<script type="text/javascript">
(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
(i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
})(window,document,'script','//www.google-analytics.com/analytics.js','ga');
ga('create', 'UA-xxxxxx-x');
ga('set', 'anonymizeIp', true);
ga('send', 'pageview');
@hirbod
hirbod / Ausgabe_im_Template.php
Last active June 22, 2016 09:14
Redaxo Advanced Navigation MULTIPLE
<?php
$nav = new advanced_rex_navigation();
$main_navigation = $nav->get(0,3,FALSE,TRUE,'main');
// 'main' ist der name des navigationstyps
// bitte anpassen je nach einstellung im meta-info-addon
/* weitere setter methoden:
$nav->setClasses(array('menu_item'));
$nav->setSeperator('/');
@staabm
staabm / base64decode.php
Created September 26, 2012 06:59
native stream filter conversion
<?php
function convert($size) {
$unit = array('b', 'kb', 'mb', 'gb', 'tb', 'pb');
return @round($size / pow(1024, ($i = floor(log($size, 1024)))), 2) . ' ' . $unit[$i];
}
function mem() {
return convert(memory_get_usage(true));
}
@masnun
masnun / annotations.php
Created August 12, 2012 15:54
Demonstration of Doctrine Annotation Reader
<?php
/**
*@Annotation
*/
class AnnotatedDescription
{
public $value;
public $type;
public $desc;
}
@marzocchi
marzocchi / controller.php
Created August 2, 2012 15:12
Change a Doctrine entity's table name at runtime
<?php
class FooController extends Controller {
function fooAction() {
$em = $this->getDoctrine()->getEntityManager();
$cm = $em->getClassMetadata('FooBundle:FooEntity');
$cm->setTableName('special_table_name');
@havvg
havvg / ajax-form.js
Created August 1, 2012 13:20
jQuery AJAX form submit with Twitter Bootstrap modal
jQuery(function($) {
$('form[data-async]').live('submit', function(event) {
var $form = $(this);
var $target = $($form.attr('data-target'));
$.ajax({
type: $form.attr('method'),
url: $form.attr('action'),
data: $form.serialize(),
@staabm
staabm / parser.php
Created July 18, 2012 08:31
Email conversation parser
<?php
preg_match_all("/^((?:\h*>+\h*)*)(.*)$/m", $s, $matches, PREG_SET_ORDER);
$indent = 0;
$s = '';
foreach ($matches as $match) {
$newIndent = substr_count($match[1], '>');
$diff = $newIndent - $indent;
/*
@Ocramius
Ocramius / User.php
Last active December 17, 2025 23:36
Doctrine 2 ManyToMany - the correct way
<?php
use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;
/**
* @ORM\Entity()
* @ORM\Table(name="user")
*/
class User
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<link rel="stylesheet" href="style.css">
</head>
<body>
<svg id="defs">
<defs>
<linearGradient id="gradBlue" x1="0%" y1="0%" x2="100%" y2="0%">