Skip to content

Instantly share code, notes, and snippets.

🚲
Pedaling

Jérôme Tamarelle GromNaN

🚲
Pedaling
Block or report user

Report or block GromNaN

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View composer.json
{
"name": "jerometamarelle/redirect",
"require": {
"silex/silex": "dev-master"
},
"authors": [
{
"name": "Jérôme Tamarelle",
"email": "jerome@tamarelle.net"
}
View iframeHeight.js
function refreshIframeHeight(id) {
parent.window.document.getElementById(id).height = document.body.offsetHeight ;
}
@GromNaN
GromNaN / gist:1560785
Created Jan 4, 2012
Track GIT changes into SVN
View gist:1560785
# 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
@GromNaN
GromNaN / git.md
Created Dec 15, 2011
My Git Commands
View git.md

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

View console-colors.md

Characters Codes to get color in your console

Reset

  • reset \033[0

Text Colors

@GromNaN
GromNaN / detect-utf8.php
Created Dec 1, 2011
How to detect UTF-8 string in PHP
View detect-utf8.php
<?php
function isUtf8($string)
{
return preg_match('%(?:'
. '[\xC2-\xDF][\x80-\xBF]' // non-overlong 2-byte
. '|\xE0[\xA0-\xBF][\x80-\xBF]' // excluding overlongs
. '|[\xE1-\xEC\xEE\xEF][\x80-\xBF]{2}' // straight 3-byte
. '|\xED[\x80-\x9F][\x80-\xBF]' // excluding surrogates
. '|\xF0[\x90-\xBF][\x80-\xBF]{2}' // planes 1-3
@GromNaN
GromNaN / autoload.php
Created Nov 29, 2011
PSR-0 autoload.php
View autoload.php
<?php
/**
* Simple autoloader that follow the PHP Standards Recommendation #0 (PSR-0)
* @see https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-0.md for more informations.
*
* Code inspired from the SplClassLoader RFC
* @see https://wiki.php.net/rfc/splclassloader#example_implementation
*/
spl_autoload_register(function($className) {
@GromNaN
GromNaN / Doctrine_Connection_Mssql.php
Created Nov 10, 2011
Doctrine_Connection_Mssql with optimized modifyLimitQuery()
View Doctrine_Connection_Mssql.php
<?php
/*
* $Id: Mssql.php 5804 2009-06-02 19:52:42Z jwage $
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
View gist:1342799
# Find the process ID
ps -ax | grep Safari
# Pause the process
kill -STOP 1234
# Resume the process
kill -CONT 1234
@GromNaN
GromNaN / TempDir.php
Created Jun 22, 2011
Temporary directory deleted when PHP ends.
View TempDir.php
<?php
/**
* Temporary directory deleted when PHP ends.
*
* @author Jérôme Tamarelle <jerome@tamarelle.net>
*/
final class TempDir
{
private static $instances = array();
You can’t perform that action at this time.