Skip to content

Instantly share code, notes, and snippets.

View mickaelandrieu's full-sized avatar
🏠
Working from home

Mickaël Andrieu mickaelandrieu

🏠
Working from home
View GitHub Profile
<?php
// sources: http://stackoverflow.com/a/4719222
class A {
public static function className(){
echo __CLASS__;
}
public static function test(){
self::className();
}
## Common bash function
alias sudo="sudo " # Hack, for sudo an aliases
alias ls="ls --color"
alias l="ls -lh --color"
alias ll="ls -lh --color"
alias lla="ll -a --color"
alias df="df -h"
@mickaelandrieu
mickaelandrieu / .bashrc
Created January 30, 2014 17:03
From @lyrixx github
if [ -f ~/.bash_aliases ]; then
. ~/.bash_aliases
fi
if [ -f /etc/bash_completion ] && ! shopt -oq posix; then
. /etc/bash_completion
fi
if [ -d $HOME/.rbenv/bin ]; then
PATH="$HOME/.rbenv/bin:$PATH"
@mickaelandrieu
mickaelandrieu / minimal benchmark
Last active August 29, 2015 13:56
A very minimal benchmark: casperjs vs beautifulsoup4
python version:
from bs4 import BeautifulSoup
import requests
r = requests.get("http://www.google.fr/search?num=100&q=scrapping")
data = r.text
<?php
namespace Foo\Bar\BazBundle\Util;
abstract class BaseManager
{
protected $em;
protected $class;
/**
* @author Thomas Bley
* @licence GNU-FDL
* Source: http://we-love-php.blogspot.fr/2012/12/create-pdf-invoices-with-html5-and-phantomjs.html
*/
var page = new WebPage();
var system = require("system");
// change the paper size to letter, add some borders
// add a footer callback showing page numbers
/**
* @author Mickaël Andrieu <mickael.andrieu@sensiolabs.com>
* @licence MIT
* Usage: casperjs casperPDF.js "[url]" [filename.<format>]
*/
var casper = require('casper').create({
pageSettings: {
paperSize: {
format: "Letter",
<?php
function it($m,$p){echo ($p?'✔︎':'✘')." It $m\n"; if(!$p){$GLOBALS['f']=1;}}function done(){if(@$GLOBALS['f'])die(1);}
run:
casperjs index.js && convert *.jpg video.mpeg && gify video.mpeg out.gif && rm *.jpg video.mpeg
@mickaelandrieu
mickaelandrieu / captureCollection.js
Created May 17, 2014 15:10
How to capture multiples images with the same class with CasperJS ?
var clipRects = this.getElementsBounds('.list_item img.poster');
var i = 0;
clipRects.forEach(function(clipRect) {
casper.capture(i+'.png', clipRect);
i++;
});