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
@mickaelandrieu
mickaelandrieu / quotes_json.js
Created November 26, 2013 12:50
Scrap a website with CasperJs, JSON output.
var links = [];
var quotes = [];
var tempUrl = [];
var infos = [];
var maxLinks = 10;
var firstUrl = 'http://www.imdb.com/search/title?at=0&num_votes=5000,&sort=user_rating,desc&start=1&title_type=tv_infoss';
var newUrl;
var x = require('casper').selectXPath;
@mickaelandrieu
mickaelandrieu / quotes_csv.js
Last active May 19, 2017 15:29
Scrap a website using CasperJs, CSV export
var quotes = 0;
var maxLinks = 5;
var firstUrl = 'http://www.imdb.com/search/title?at=0&num_votes=5000,&sort=user_rating,desc&start=1&title_type=tv_infoss';
var x = require('casper').selectXPath;
var fs = require('fs');
var utils = require('utils');
var casper = require('casper').create({
verbose: true,
@mickaelandrieu
mickaelandrieu / travis.yml
Created January 8, 2014 14:39
Common travis configuration to test Symfony projects
language: php
php:
- 5.3.3
- 5.3
- 5.4
- 5.5
before_script:
- composer --prefer-source install
@mickaelandrieu
mickaelandrieu / parallel.sh
Created January 23, 2014 15:31
Parallelize your phpunit test
# from http://jwage.com/post/30490205475/a-cool-script-for-running-phpunit-tests-in-parallel
#!/bin/bash
NUM=0
QUEUE=""
MAX_NPROC=2 # default
REPLACE_CMD=0 # no replacement by default
USAGE="A simple wrapper for running processes in parallel.
Usage: `basename $0` [-h] [-r] [-j nb_jobs] command arg_list
-h Shows this help
-r Replace asterix * in the command string with argument
# Based on https://gist.github.com/fernandoaleman/5083680
# Start the old vagrant
$ vagrant init ubuntu_saucy
$ vagrant up
# You should see a message like:
# [default] The guest additions on this VM do not match the install version of
# VirtualBox! This may cause things such as forwarded ports, shared
# folders, and more to not work properly. If any of those things fail on
<table class="table table-bordered">
<thead>
<tr>
<th>Domain</th>
<th class="visible-lg">Url</th>
<th>Position</th>
<th>Google PageRank/ Alexa PageRank</th>
<th>Actions</th>
</tr>
</thead>
## 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;