Skip to content

Instantly share code, notes, and snippets.

View jpetitcolas's full-sized avatar

Jonathan Petitcolas jpetitcolas

View GitHub Profile
jpetitcolas / Finding all test files not included in PHPUnit
Last active August 29, 2015 13:57
Finding all test files not included in PHPUnit testsuite
View Finding all test files not included in PHPUnit
find src/ -type f -name *Test.php -exec grep -H -c "@group" {} \; | grep :0\$ | awk -F':' '{ print $1 }'
jpetitcolas / Pair lines with
Created March 6, 2014 13:33
Pair lines with sed
View Pair lines with
sed '$!N;s/\n/ /' infile
jpetitcolas / Split big files into several smaller
Created March 24, 2014 08:34
Split a big file into several parts with Linux
View Split big files into several smaller
# Splitting file into smaller parts
split --bytes=512M bigfile prefix
# Joining all file parts
cat prefix* > bigfile
jpetitcolas /
Created April 2, 2014 10:34
Cleaning all Docker containers and images
sudo docker stop $(sudo docker ps -a -q)
sudo docker rm $(sudo docker ps -a -q)
sudo docker rmi $(sudo docker images -a -q)
jpetitcolas / issue.php
Last active August 29, 2015 13:58
Issue with Document Manager
View issue.php
// Controller
$tag = new Tag();
$this->getContainer()->get('my_service')->import($content, $tag);
// Service
jpetitcolas / Makefile
Created January 27, 2015 13:01
Playing with websockets in Go
View Makefile
docker run \
--rm \
--volume="`pwd`:/srv" \
--tty \
--interactive \
--publish="8080:8080" \
marmelab/go run src/marmelab/gollabedit/*.go
jpetitcolas / Application.js
Created February 27, 2015 10:45
Issue with Babel
View Application.js
import View from "./folder/View";
class Application {
constructor() {
this.view = new View("I'm a view!");
sayHello() {
jpetitcolas /
Created September 19, 2015 13:14
Dump a Docker-ized database to Amazon S3
# @see
# Configuration
FILENAME="awesomeproject-`date +%Y-%m-%d-%H:%M:%S`.sql"
jpetitcolas / couvent.js
Created September 22, 2015 12:19
Only French would understand this lib... ;)
View couvent.js
// couvent.js - MIT license'*')).forEach(function (el) { = 'none';
jpetitcolas / read-only-on-select-list.js
Created December 28, 2012 06:33
A short snippet to simulate read-only attribute on a select list, which is currently not W3C-compliant. We can not just disable it, as a disabled input is not sent when submitting a form. The trick here is to store the disabled select value into a hidden field.
View read-only-on-select-list.js
* Simulate the read-only attribute on a select list (as it is not normalized).
* @see
* @param Object Select list element
function setReadOnlyOnSelect(selectList)
// Ensure selectList exists
if(!selectList.length) {
console.warn("Unable to find specified select list.");