Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View patrick-mota's full-sized avatar

Ganon patrick-mota

  • Geneva / Lausanne
  • X @8ice
View GitHub Profile
public function truncate($string, $length=100, $append="…") {
$string = trim($string);
if(strlen($string) > $length) {
$string = wordwrap($string, $length);
$string = explode("\n", $string, 2);
$string = $string[0] . $append;
}
return $string;
@patrick-mota
patrick-mota / gist:abe4a8e0d9849e70549d800da93009f1
Created April 21, 2017 08:51
composer install without memory limit
php -d memory_limit=-1 composer.phar install
# As example I take pidgin container.
# Mount your x11:
docker run -d --device /dev/snd --name pidgin -v /tmp/.X11-unix:/tmp/.X11-unix -e DISPLAY=unix$DISPLAY thshaw/pidgin
# Store container id
export containerId=$(docker ps -l -q)
# Stop container
docker stop $containerId
@patrick-mota
patrick-mota / 0_reuse_code.js
Created December 23, 2015 00:12
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console