Skip to content

Instantly share code, notes, and snippets.

View jcambien's full-sized avatar
👋

Julien Cambien jcambien

👋
  • Lille
  • 01:54 (UTC +02:00)
View GitHub Profile
@jcambien
jcambien / new_gist_file
Created September 6, 2013 08:52
Count big files lines number https://gist.github.com/tyx/6461136
<?php
$file = new SplFileObject("mybigfile.csv");
// Store flags and position
$flags = $file->getFlags();
$current = $file->key();
// Prepare count by resetting flags as READ_CSV for example make the tricks very slow
$file->setFlags(null);
@jcambien
jcambien / new_gist_file
Created August 17, 2013 08:57
Création d'un patch sous GIT From http://gitref.org/
$ wget http://example.com/project.2010-06-01.zip
$ unzip project.2010-06-01.zip
$ cp -R project.2010-06-01 project-my-copy
$ cd project-my-copy
$ (change something)
$ diff project-my-copy project.2010-06-01 > change.patch
$ (email change.patch)
function throttle( fn, time ) {
var t = 0;
return function() {
var args = arguments, ctx = this;
clearTimeout(t);
t = setTimeout( function() {
fn.apply( ctx, args );
}, time );
};