Skip to content

Instantly share code, notes, and snippets.

View GromNaN's full-sized avatar
🚲
☀️

Jérôme Tamarelle GromNaN

🚲
☀️
View GitHub Profile
@marcw
marcw / gist:909430
Created April 8, 2011 07:20
Add twig search to ack-grep
alias ack='ack-grep --type-set twig=.twig'
@ezzatron
ezzatron / clean-use.php
Created May 9, 2011 12:10
Script to clean unnecessary PHP use statements
#!/usr/bin/env php
<?php
$paths = array();
if (isset($_SERVER['argv']))
{
$paths = $_SERVER['argv'];
array_shift($paths);
if (!$paths)
@GromNaN
GromNaN / array_flatter.php
Created June 21, 2011 13:52
array_flatter
<?php
/**
* Convert a multi-dimensions array to a 1 flat array.
*
* @param array $array
* @param string $separator
* @param string $prefix
* @return array
*/
@chanmix51
chanmix51 / app.nginx.conf
Created August 17, 2011 08:45
nginx vhost conf silex & symfony
server {
listen 80;
server_name server.mydomain.net
root /var/www/app/web;
index index.php;
location ~ \.php$ {
fastcgi_pass 127.0.0.1:9000;
fastcgi_index index.php;
include fastcgi_params;
@lucasfais
lucasfais / gist:1207002
Created September 9, 2011 18:46
Sublime Text 2 - Useful Shortcuts

Sublime Text 2 – Useful Shortcuts (Mac OS X)

General

⌘T go to file
⌘⌃P go to project
⌘R go to methods
⌃G go to line
⌘KB toggle side bar
⌘⇧P command prompt
@mrflory
mrflory / Builder.php
Created April 1, 2012 20:24
Twitter Bootstrap Twig Template for KnpMenuBundle in Symfony2
<?php
namespace Linkofy\CommonBundle\Menu;
use Knp\Menu\FactoryInterface;
use Symfony\Component\DependencyInjection\ContainerAware;
class Builder extends ContainerAware
{
public function mainMenu(FactoryInterface $factory, array $options)
@jboner
jboner / latency.txt
Last active April 17, 2024 16:30
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers (~2012)
----------------------------------
L1 cache reference 0.5 ns
Branch mispredict 5 ns
L2 cache reference 7 ns 14x L1 cache
Mutex lock/unlock 25 ns
Main memory reference 100 ns 20x L2 cache, 200x L1 cache
Compress 1K bytes with Zippy 3,000 ns 3 us
Send 1K bytes over 1 Gbps network 10,000 ns 10 us
Read 4K randomly from SSD* 150,000 ns 150 us ~1GB/sec SSD
@piscisaureus
piscisaureus / pr.md
Created August 13, 2012 16:12
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@dzaporozhets
dzaporozhets / gitlab_gitolite.sh
Created October 24, 2012 13:58
Fix gitolite for gitlab 3
# GITOLITE 3
sudo -u git -H sed -i "s/\(GIT_CONFIG_KEYS\s*=>*\s*\).\{2\}/\1'\.\*'/g" /home/git/.gitolite.rc
# GITOLITE 2
sudo -u git -H sed -i 's/\(GL_GITCONFIG_KEYS\s*=>*\s*\).\{2\}/\1"\.\*"/g' /home/git/.gitolite.rc
@igorw
igorw / FooController.php
Last active December 11, 2015 01:38
Convention-based Reflection Controller Provider for Silex.
<?php
// src/Igorw/FooController.php
namespace Igorw;
class FooController
{
function getIndexAction()
{