Skip to content

Instantly share code, notes, and snippets.

@weierophinney
weierophinney / CompositeAdapter.php
Created April 23, 2015 20:08
Example of a composite authentication adapter for zf-mvc-auth
<?php
use Zend\Http\Request;
use Zend\Http\Response;;
use ZF\MvcAuth\Authentication\AdapterInterface;
use ZF\MvcAuth\Identity\IdentityInterface;
use ZF\MvcAuth\MvcAuthEvent;
class CompositeAdapter implements AdapterInterface
{
private $adapters = [];
@krakjoe
krakjoe / pthreads.md
Last active September 24, 2024 14:50
pthreads.md

Multi-Threading in PHP with pthreads

A Brief Introduction to Multi-Threading in PHP

  • Foreword
  • Execution
  • Sharing
  • Synchronization
  • Pitfalls
/* thumbnails alignment bug fix, see https://github.com/twitter/bootstrap/issues/3494 */
.row-fluid .thumbnails [class*="span"] {
margin-left: 2.5641%;
}
.row-fluid .thumbnails [class*="span"]:first-child {
margin-left: 2.5641%;
margin-bottom: 0;
}
/*
>>> for n in range(1,13): m=12.0/n; print ".row-fluid .thumbnails span%d { width: %g%%;}" % (n,(100.0 - 2.5642*(m)) / m)
@sasezaki
sasezaki / diff_scan_vs_resources.diff
Created February 21, 2013 15:59
diff of ZF2 library directory scanned message templates VS resources/languages/en/Zend_Validate.php
1c1,21
< <?php
---
> <?php
> /**
> * Zend Framework
> *
> * LICENSE
> *
> * This source file is subject to the new BSD license that is bundled
@jjt
jjt / compile.sh
Created June 1, 2012 17:55
Example: Running multiple background processes in one bash script, killing all on SIGINT (ctrl+c)
#!/bin/bash
SITE=/home/dev/sites/rmx
# Arbitrary shell commands, some run in background
echo "RMX using siteroot=$SITE"
$SITE/rmx/manage.py runserver &
compass watch $SITE/media/compass/ &
coffee -o $SITE/media/js -cw $SITE/media/coffee &
hamlpy-watcher $SITE/templates/hamlpy $SITE/templates/templates &
@jasonrudolph
jasonrudolph / git-branches-by-commit-date.sh
Created February 12, 2012 20:40
List remote Git branches and the last commit date for each branch. Sort by most recent commit date.
# Credit http://stackoverflow.com/a/2514279
for branch in `git branch -r | grep -v HEAD`;do echo -e `git show --format="%ci %cr" $branch | head -n 1` \\t$branch; done | sort -r