Skip to content

Instantly share code, notes, and snippets.

View icidasset's full-sized avatar
🪴

Steven Vandevelde icidasset

🪴
View GitHub Profile
@KrofDrakula
KrofDrakula / raf.js
Last active December 15, 2015 20:19
Due to a bug in the native `requestAnimationFrame` function running inside `<iframe>` elements on iOS 6, I've decided to write up a custom function that implements a blacklist. Use this snippet and use `nextFrame` and `cancelFrame` on the `window` object to use this workaround with the same method signature as the spec. I've avoided overriding t…
// requestAnimationFrame implementation as a custom function to allow blacklisting
// devices with broken implementation. Currently needs timer-based fallbacks for iOS 6.x for
// code running inside <iframe> elements.
// Uses polyfills based on http://paulirish.com/2011/requestanimationframe-for-smart-animating/
(function() {
var blacklisted = /iP(ad|hone|od).*OS 6/.test(window.navigator.userAgent),
lastTime = 0,
nativeRequest = window.requestAnimationFrame || null,
nativeCancel = window.cancelAnimationFrame || null;
# MAC manipulators
alias random_mac='sudo ifconfig en0 ether `openssl rand -hex 6 | sed "s/\(..\)/\1:/g; s/.$//"`'
alias restore_mac='sudo ifconfig en0 ether YOUR_ORIGINAL_MAC_ADDRESS_GOES_HERE'
@SlexAxton
SlexAxton / .zshrc
Last active April 30, 2026 08:09
My gif workflow
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
@tdreyno
tdreyno / gist:4947918
Created February 13, 2013 20:25
Cross-platform mouse/touch events
var evts = [],
touchEvt,
mouseEvt,
msEvent;
if (evt === 'up') {
touchEvt = 'touchend';
mouseEvt = 'mouseup';
msEvent = 'MSPointerUp';
} else if (evt === 'move') {
@dergachev
dergachev / GIF-Screencast-OSX.md
Last active September 24, 2026 09:33
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@tdreyno
tdreyno / gist:4531832
Last active December 11, 2015 02:39
Polyfill for new Chrome submillisecond requestAnimationFrame timer
function rightNow() {
if (window['performance'] && window['performance']['now']) {
return window['performance']['now']();
} else {
return +(new Date());
}
}
require './config/environment'
require 'capybara/dsl'
require 'terminus'
Capybara.app = Blarg::Application
Capybara.current_driver = :terminus
Terminus.start_phantomjs
@adharris
adharris / postgres_array.go
Created November 28, 2012 19:52
PostgreSQL demo of Array types using Golang
package main
import (
"database/sql"
"errors"
"fmt"
_ "github.com/bmizerany/pq"
"os"
"regexp"
"strings"

It All Starts With Templates

An Ember application starts with its main template. Put your header, footer, and any other decorative content in application.handlebars.

<header>
  <img src="masthead">
</header>

<footer>
@jeremyckahn
jeremyckahn / itunes.rb
Created October 23, 2012 04:49
Futzing around with Ruby and iTunes.
require 'rubygems'
require 'plist'
class ITunes
attr_reader :library, :parse_time
def initialize (path=nil)
@path = path.nil? \
? (Dir::home + '/Music/iTunes/iTunes Music Library.xml') \
: path