Skip to content

Instantly share code, notes, and snippets.

@bonsi
bonsi / gist:28faa641acd6135d26dc
Created November 26, 2015 15:58 — forked from adamjimenez/gist:5917897
Generate thumbnails from video files using HTML5's video tag and canvas
<?php
//where you want your thumbnails to go
$thumbs_dir = 'uploads/thumbs/';
//this should be an array of video paths
$videos = array();
if( $_POST["name"] ){
// Grab the MIME type and the data with a regex for convenience
if (!preg_match('/data:([^;]*);base64,(.*)/', $_POST['data'], $matches)) {
@bonsi
bonsi / Git push deployment in 7 easy steps.md
Created October 26, 2015 10:16 — forked from thomasfr/Git push deployment in 7 easy steps.md
7 easy steps to automated git push deployments. With small and configurable bash only post-receive hook
if [ -f /etc/bash_completion ]; then
source /etc/bash_completion
fi
__has_parent_dir () {
# Utility function so we can test for things like .git/.hg without firing up a
# separate process
test -d "$1" && return 0;
current="."
@bonsi
bonsi / gist:8950e0820ec88eb5d87f
Last active August 29, 2015 14:24
Gulpfile with remote GNTP notifications (currently using localhost + ssh tunnel back to host + Growl for Windows)
var gulp = require('gulp');
var phpspec = require('gulp-phpspec');
var run = require('gulp-run');
var notify = require('gulp-notify');
var nn = require('node-notifier');
var customNotifier = notify.withReporter(function (options, callback) {
new nn.Growl().notify(options, callback);
});
@bonsi
bonsi / Vagrantfile
Last active August 29, 2015 14:23
WorkInProgess - Vagrant - Debian Jessie / Apache2 / Git
# -*- mode: ruby -*-
# vi: set ft=ruby :
# All Vagrant configuration is done below. The "2" in Vagrant.configure
# configures the configuration version (we support older styles for
# backwards compatibility). Please don't change it unless you know what
# you're doing.
Vagrant.configure(2) do |config|
config.vm.box = "spoof/debian-jessie64"
@bonsi
bonsi / Vagrantfile
Created June 23, 2015 09:31
Vagrant - Debian / MySQL / Dotdeb / PHP bootstrap
# -*- mode: ruby -*-
# vi: set ft=ruby :
# Vagrantfile API/syntax version. Don't touch unless you know what you're doing!
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "chef/debian-7.4"
config.vm.box_url = "https://vagrantcloud.com/chef/boxes/debian-7.4/versions/1/providers/virtualbox.box"
config.vm.network :private_network, ip: "192.168.56.10"