Skip to content

Instantly share code, notes, and snippets.

View COil's full-sized avatar
🎯
Focusing

Loïc Vernet COil

🎯
Focusing
View GitHub Profile
@mattattui
mattattui / gist:879249
Created March 21, 2011 10:08
Convert named HTML entities to numeric for XML compatibility
<?php
/* html_convert_entities($string) -- convert named HTML entities to
* XML-compatible numeric entities.
*/
function html_convert_entities($string) {
return preg_replace_callback('/&([a-zA-Z][a-zA-Z0-9]+);/S',
'convert_entity', $string);
}
@mm53bar
mm53bar / deploy.rb
Created October 7, 2011 21:05
My capistrano deployment
require File.join(File.dirname(__FILE__), 'deploy/nginx')
require File.join(File.dirname(__FILE__), 'deploy/log')
default_run_options[:pty] = true
set :ssh_options, { :forward_agent => true }
set :application, "appname"
set :repository, "git@giturl"
set :scm, :git
@ziadoz
ziadoz / awesome-php.md
Last active May 10, 2024 15:06
Awesome PHP — A curated list of amazingly awesome PHP libraries, resources and shiny things.
@jakzal
jakzal / fix-permissions.sh
Created February 10, 2012 17:33
Symfony2 permission fix
#/bin/sh
setfacl -R -m u:apache:rwx app/cache app/logs
setfacl -R -d -m u:apache:rwx app/cache app/logs
setfacl -R -m u:kuba:rwx app/cache app/logs
setfacl -R -d -m u:kuba:rwx app/cache app/logs
setfacl -R -m mask:rwx app/cache app/logs
setfacl -R -d -m mask:rwx app/cache app/logs
<?php
namespace Examplecms\Bundle\ExampleCoreBundle\Form\EventListener;
use Examplecms\Bundle\ExampleCoreBundle\Form\GroupTreeType;
use Symfony\Component\Form\Event\DataEvent,
Symfony\Component\Form\FormEvents,
Symfony\Component\Form\FormFactoryInterface,
Symfony\Component\EventDispatcher\EventSubscriberInterface;
@jaytaph
jaytaph / complete_console.sh
Last active October 5, 2015 21:08
Console completion for Symfony2
#!/bin/sh
#
# Symfony2 App/Console autocompletion (commands and arguments only)
#
# Usable for both bash and zsh (probably)
#
# Usage:
# Load the script (or add to your .bashrc)
#
# source ./complete_console.sh
@brandonb927
brandonb927 / osx-for-hackers.sh
Last active June 13, 2024 02:39
OSX for Hackers: Yosemite/El Capitan Edition. This script tries not to be *too* opinionated and any major changes to your system require a prompt. You've been warned.
#!/bin/sh
###
# SOME COMMANDS WILL NOT WORK ON macOS (Sierra or newer)
# For Sierra or newer, see https://github.com/mathiasbynens/dotfiles/blob/master/.macos
###
# Alot of these configs have been taken from the various places
# on the web, most from here
# https://github.com/mathiasbynens/dotfiles/blob/5b3c8418ed42d93af2e647dc9d122f25cc034871/.osx
@mudge
mudge / test.retry.php
Created July 8, 2013 13:27
A retry function for PHP.
<?php
require_once dirname(__FILE__) . '/../lib/simpletest/autorun.php';
function retry($f, $delay = 10, $retries = 3)
{
try {
return $f();
} catch (Exception $e) {
if ($retries > 0) {
sleep($delay);
@liuggio
liuggio / All Your Pull request.md
Last active September 14, 2020 10:05
Your Pull Request timeline

In order to obtain all your Open source Pull-Request history:

  1. Go to Google bigquery and execute the following query replacing liuggio with your GitHub login

  2. execute query

SELECT repository_url, repository_owner, repository_name, count(*) as numberOfPR
FROM [githubarchive:github.timeline]
WHERE payload_pull_request_head_repo_owner_login = "liuggio"
@COil
COil / gist:79a284e101b5d78e761e
Last active August 29, 2015 14:06
Inline docblock in a foreach statement
<?php
// ...
$awardCount = count($this->finder);
foreach ($this->finder as $file /** @var $file \SplFileInfo */) {
try {