Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
# add your user to www-data and vise versa | |
sudo usermod -a -G www-data myusername | |
sudo usermod -a -G myusername www-data | |
# override umask in ~/.bashrc and /etc/init.d/apache2 | |
umask 002 | |
#restart |
<?php | |
/** | |
* One-pointer Circular Buffer | |
* | |
* This comes without any overwrite | |
* checks or FIFO functionality. | |
* You'll need SPL. | |
* | |
* @author Bernhard Häussner | |
* @date 2011-09-07 |
Awesome PHP has been relocated permanently to its own Github repository. No further updates will made to this gist.
Please open an issue for any new suggestions.
<?php | |
namespace Silex\Provider; | |
use Silex\Application; | |
use Silex\SilexEvents; | |
use Silex\ControllerProviderInterface; | |
use Silex\ControllerCollection; | |
use Symfony\Component\HttpFoundation\Request; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\HttpKernel\Event\GetResponseEvent; |
#!/bin/bash | |
# Will add --dry-run unless the --go option is set. All other arguments passed to rsync (e.g. --delete) | |
SOURCE=. | |
DEST=example.com:/var/www/mysite | |
DRYRUN="--dry-run" | |
args=() | |
for var in "$@" |
<?php | |
namespace PW\ApplicationBundle\Command; | |
use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand, | |
Symfony\Component\Console\Input\InputArgument, | |
Symfony\Component\Console\Input\InputInterface, | |
Symfony\Component\Console\Input\StringInput, | |
Symfony\Component\Console\Output\OutputInterface; |
<?php | |
namespace Upload; | |
class File implements IFile { | |
/** | |
* The meta data about the file (from the $_FILES array) | |
* | |
* @var array $uploadMeta |
false
as "0"
, so you want to typecast them.$hidden
array then OOPS!/users/id/5/active/true
. Your API does not need to be SEO optimised.?format=xml
is stupid, use an Accept: application/xml
header. I added this to the CodeIgniter Rest Server once for lazy people, and now people think it's a thing. It's not.This is an example of using laravel 4.1 CookieGuard middleware with silex. This demonstrates the composability of stack middlewares.
All of the outgoing cookies are encrypted. If decryption of incoming cookies fails, the application will ignore them.
Just clone the gist and install the dependencies via composer.
#!/bin/sh | |
# Fix NTP/Time | |
# https://github.com/boot2docker/boot2docker/issues/290 | |
boot2docker ssh -- sudo killall -9 ntpd | |
boot2docker ssh -- sudo ntpclient -s -h pool.ntp.org | |
boot2docker ssh -- sudo ntpd -p pool.ntp.org |