Skip to content

Instantly share code, notes, and snippets.

View Swop's full-sized avatar
👨‍💻

Sylvain MAUDUIT Swop

👨‍💻
View GitHub Profile
@Swop
Swop / gist:4090417
Created November 16, 2012 20:04
Install php sundown shared library
#!/bin/bash
apt-get install php5-dev rake
cd /tmp
git clone https://github.com/chobie/php-sundown.git php-sundown -b development
cd php-sundown
# this command will fetch submodule and copy neccesally files to src dir. and compile it.
@Swop
Swop / Mac OSX PHP Tech stack for Symfony2 projects
Last active December 10, 2015 16:48
Mac OSX PHP Tech stack for Symfony2 projects (Original Mac OS Apache, Compiled PHP & tools)
mkdir -p /usr/local/src
== XCode Command line tools
Installer XCode ou récuppérer depuis l'Apple Developper Center l'install unique des CommandLine Tools
== X11
http://xquartz.macosforge.org/
== HomeBrew
ruby -e "$(curl -fsSkL raw.github.com/mxcl/homebrew/go)"
@Swop
Swop / Screencast to GIF file
Last active December 11, 2015 10:48
Simple steps to create a GIF from a screencast (OSX but works with Linux)
# Install ffmepg (for the screencast) & imagemagick (to optimize the GIF file for web usage)
brew install ffmpeg
brew install imagemagick
# Make the screencast and compress it
ffmpeg -i ScreenFlow.mov -pix_fmt rgb24 output.gif
convert -layers Optimize output.gif output_optimized.gif
# Upload it somewere in the cloud...
# ... and use the file in the desire website. Here's the markdown syntax:
@Swop
Swop / gist:5192053
Created March 18, 2013 23:40
Increase shmmax on MacOS X to enable more concurrent clients on Postgres.app
To increase temporary (during the current session):
sudo sysctl -w kern.sysv.shmmax=12582912
sudo sysctl -w kern.sysv.shmall=12582912
To enable it forever:
sudo vim /etc/sysctl.conf
kern.sysv.shmall=12582912
kern.sysv.shmmax=12582912
@Swop
Swop / gist:5520908
Created May 5, 2013 13:59
Delete submodule
oldPath="vendor/example"
git config -f .git/config --remove-section "submodule.${oldPath}"
git config -f .gitmodules --remove-section "submodule.${oldPath}"
git rm --cached "${oldPath}"
rm -rf "${oldPath}" ## remove src (optional)
rm -rf ".git/modules/${oldPath}" ## cleanup gitdir (optional housekeeping)
git add .gitmodules
git commit -m "Removed ${oldPath}"
@Swop
Swop / gist:5591187
Created May 16, 2013 11:48
Vim: save the file as root (by Vincent Jousse)
" Paste this in your .vimrc file
" Use w!! when you've forgotten to open your file as root
cmap w!! w !sudo tee % >/dev/null
@Swop
Swop / gist:5766293
Created June 12, 2013 15:25
PHP CLI Debug with Vagrant, XDebug and a allready configured PHPStorm
export PHP_IDE_CONFIG=serverName=mywebsite.lan
php -dxdebug.remote_host=192.168.33.1 app/console ...
@Swop
Swop / gist:5870975
Created June 26, 2013 19:48
Enable and configure OPCache in PHP 5.5
# Enable OPCache
zend_extension=/path/to/lib/php/extensions/no-debug-non-zts-20121212/opcache.so
# OPCache settings
opcache.memory_consumption=128
opcache.interned_strings_buffer=8
opcache.max_accelerated_files=4000
opcache.revalidate_freq=60
opcache.fast_shutdown=1
opcache.enable_cli=1
@Swop
Swop / LocaleListener.php
Created July 2, 2013 07:36
Create a culture switch in Symfony2
<?php
namespace Your\Bundle\Listener;
use Symfony\Component\HttpKernel\Event\GetResponseEvent;
use Symfony\Component\HttpKernel\KernelEvents;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
class LocaleListener implements EventSubscriberInterface
{
<?php
namespace Foo\BarBundle\Controller;
use Symfony\Bundle\FrameworkBundle\Controller\Controller;
class ArticleController extends Controller
{
public function editAction(Article article)
{