This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.
To capture the video (filesize: 19MB), using the free "QuickTime Player" application:
# shove this in ~/.chef/bootstrap/joyent-smartos.erb | |
# run knife bootstrap <hostname> -d joyent-smartos | |
bash -c ' | |
if [ ! -f /opt/local/bin/chef-client ]; then | |
cd /tmp | |
pkgin install gcc-compiler gcc-runtime gcc-tools-0 ruby19 scmgit-base scmgit-docs gmake sun-jdk6 | |
wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.10.tgz | |
tar -xzf rubygems-1.8.10.tgz | |
cd rubygems-1.8.10 |
/** | |
* An implementation for Quicksort. Doesn't | |
* perform as well as the native Array.sort | |
* and also runs the risk of a stack overflow | |
* | |
* Tests with: | |
* | |
* var array = []; | |
* for(var i = 0; i < 20; i++) { | |
* array.push(Math.round(Math.random() * 100)); |
#!/usr/bin/env sh | |
## | |
# This is script with usefull tips taken from: | |
# https://github.com/mathiasbynens/dotfiles/blob/master/.osx | |
# | |
# install it: | |
# curl -sL https://raw.github.com/gist/2108403/hack.sh | sh | |
# |
function isRetina(){ | |
return (('devicePixelRatio' in window && devicePixelRatio > 1) || | |
('matchMedia' in window && matchMedia("(min-resolution:144dpi)").matches)) | |
} |
env = (function() { | |
var flags = {}, ua = navigator.userAgent, el = document.createElement('div'), video = document.createElement('video'), audio = document.createElement('audio'), root = document.documentElement, i | |
function flag(names) { | |
names = names.split(' ') | |
for (i = 0; i < names.length; i++) | |
flags[names[i]] = true | |
} | |
function classnames() { | |
var names = [], name | |
for(name in flags) if (flags.hasOwnProperty(name)) |
gifify() { | |
if [[ -n "$1" ]]; then | |
if [[ $2 == '--good' ]]; then | |
ffmpeg -i $1 -r 10 -vcodec png out-static-%05d.png | |
time convert -verbose +dither -layers Optimize -resize 600x600\> out-static*.png GIF:- | gifsicle --colors 128 --delay=5 --loop --optimize=3 --multifile - > $1.gif | |
rm out-static*.png | |
else | |
ffmpeg -i $1 -s 600x400 -pix_fmt rgb24 -r 10 -f gif - | gifsicle --optimize=3 --delay=3 > $1.gif | |
fi | |
else |
<?php | |
class SimpleImage { | |
private $img; | |
public function __construct($path) { | |
$path = Filesystem::resolvePath($path); | |
Filesystem::assertExists($path); |
<?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)) { |
#!/usr/bin/env bash | |
# fresh-chrome | |
# | |
# Use this script on OS X to launch a new instance of Google Chrome | |
# with its own empty cache, cookies, and user configuration. | |
# | |
# The first time you run this script, it will launch a new Google | |
# Chrome instance with a permanent user-data directory, which you can | |
# customize below. Perform any initial setup you want to keep on every |