Skip to content

Instantly share code, notes, and snippets.

View GromNaN's full-sized avatar
🚲
☀️

Jérôme Tamarelle GromNaN

🚲
☀️
View GitHub Profile
@GromNaN
GromNaN / console-colors.md
Created December 8, 2011 09:43
Console Colors

Characters Codes to get color in your console

Reset

  • reset \033[0

Text Colors

@GromNaN
GromNaN / git.md
Created December 15, 2011 08:03
My Git Commands

Initialize a repository without working directory

git init --bare --shared=0700

Undo last commit

git reset --hard HEAD~1

Review changes going to be committed

@GromNaN
GromNaN / gist:1560785
Created January 4, 2012 16:24
Track GIT changes into SVN
# Track changes from a GIT repository as snapshots into SVN
SVN_REPOS=<svn_repos>
GIT_REPOS=<git_repos>
GIT_BRANCH=<branch>
git svn clone $SVN_REPOS repos
cd repos
git remote add origin $GIT_REPOS
git fetch origin
function refreshIframeHeight(id) {
parent.window.document.getElementById(id).height = document.body.offsetHeight ;
}
@GromNaN
GromNaN / composer.json
Created March 15, 2012 23:26
Redirection
{
"name": "jerometamarelle/redirect",
"require": {
"silex/silex": "dev-master"
},
"authors": [
{
"name": "Jérôme Tamarelle",
"email": "jerome@tamarelle.net"
}
@GromNaN
GromNaN / latency.txt
Created July 5, 2012 16:42 — forked from jboner/latency.txt
Latency Numbers Every Programmer Should Know
Latency Comparison Numbers
--------------------------
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
Send 1K bytes over 1 Gbps network 10,000 ns 0.01 ms
Read 4K randomly from SSD* 150,000 ns 0.15 ms
@GromNaN
GromNaN / mirror-git.sh
Created August 30, 2012 15:54
Mirror Git repositories
# This commands to keep in sync a clone of a Git repository
ORIGIN=https://github.com/symfony/symfony.git
MIRROR=git@gitlab.xxx.com
BARE=~/mirror/symfony.git
# First clone
git clone --bare ${ORIGIN} ${BARE}
cd ${BARE}
@GromNaN
GromNaN / MirrorCommand.php
Created October 3, 2012 16:30
Satis Mirror repositories
<?php
/*
* This file is part of Satis.
*
* (c) Jordi Boggiano <j.boggiano@seld.be>
* Nils Adermann <naderman@naderman.de>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
@GromNaN
GromNaN / errors.php
Created November 21, 2012 09:31
Jolies erreurs PHP
<?php
function handler ($errno, $errstr, $errfile, $errline)
{
echo "<div style=\"background: #ffe13b; color: black; position: fixed; bottom: 0; width: 100%; text-align: center; font-size: 13px; padding: 5px; box-shadow: 0 0 5px black;\">Erreur $errno $errstr in $errfile:$errline
</div>";
}
set_error_handler('handler');
@GromNaN
GromNaN / Symfony1GuardPasswordEncoder.php
Created April 5, 2013 14:22
Implements symfony1 password encoding for Symfony2 security component
<?php
namespace Security\Encoder;
use Symfony\Component\Security\Core\Encoder\MessageDigestPasswordEncoder;
/**
* Implements symfony1 password encoding
*
* @see PluginsfGuardUser::checkPasswordByGuard()