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
/**
* @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++;
});
/**
* Open file.csv and read all lines
**/
var fs = require('fs');
var casper = require('casper').create({
verbose: true,
logLevel: 'error',
pageSettings: {
@mickaelandrieu
mickaelandrieu / Preferences.sublime-settings
Last active August 29, 2015 14:04
Sublime Text 3 user preferences
// inspired from https://gist.github.com/n1k0/8545743
{
"bold_folder_labels": true,
"caret_style": "smooth",
"default_encoding": "UTF-8",
"detect_slow_plugins": false,
"draw_minimap_border": false,
"hide_minimap": true,
"draw_white_space": "all",
"ensure_newline_at_eof_on_save": true,
We couldn’t find that file to show.
#!/bin/bash
# Runs our end to end tests in casperjs.
# Run this script as follows from the project root;
#
# bin/run_e2e_tests
printf "\e[93m > SEARCHING FOR TEST FILES \033[0m \n"
find "$PWD" -iname "*.e2e.spec.js" -type f -print0 | while read -d '' -r file; do
<?php
// from https://gist.github.com/thunderer/4837269
// to be located in app/ folder of your Symfony application
use Symfony\Component\Console\Application as BaseApplication;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Input\InputOption;
use Symfony\Component\Console\Output\OutputInterface;
use Symfony\Component\HttpKernel\KernelInterface;
use Symfony\Component\HttpKernel\Kernel;