Skip to content

Instantly share code, notes, and snippets.

# Convert a live action video to gif
# Works best for videos with high color palettes like videos from your phone
#
# @param $1 - video file name like `video.mp4`
# @param @optional $2 - width size like `720`
#
# Example: ffmpegtogif video.mp4 720
# Requirements: ffmpeg. Can be downloaded via homebrew
#
# http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html
@imkevinxu
imkevinxu / vidtogif.sh
Last active June 17, 2016 17:35
Convert an animated video to gif from http://chrismessina.me/b/13913393/mov-to-gif
# Convert an animated video to gif
# Works best for videos with low color palettes like Dribbble shots
#
# @param $1 - video file name like `animation.mov`
# @param @optional $2 - resize parameter as widthxheight like `400x300`
#
# Example: vidtogif animation.mov 400x300
# Requirements: ffmpeg and gifsicle. Can be downloaded via homebrew
#
# http://chrismessina.me/b/13913393/mov-to-gif
@imkevinxu
imkevinxu / Increment Build Number Based on Git Commits.sh
Last active February 5, 2018 14:45
Xcode build phase script to increment the build number on every build or every commit
if [ -z "${PROJECT_DIR}" ]; then
PROJECT_DIR=`pwd`
fi
if [ -z "${PREFIX}" ]; then
PREFIX=""
fi
SVN_DIR="${PROJECT_DIR}/.svn"
GIT_DIR="${PROJECT_DIR}/.git"
@imkevinxu
imkevinxu / Device.swift
Last active March 4, 2023 16:09
iOS device checks for OS version and screen size in Swift
//
// Device.swift
// imHome
//
// Created by Kevin Xu on 2/9/15. Updated on 6/20/15.
// Copyright (c) 2015 Alpha Labs, Inc. All rights reserved.
//
import Foundation
@imkevinxu
imkevinxu / UIFont+Extensions.swift
Last active January 16, 2019 06:06
iOS UIFont Sensible Defaults
import Foundation
extension UIFont {
class func systemFontOfSize(size: CGFloat) -> UIFont {
return UIFont(name: "HelveticaNeue", size: size)!
}
class func italicSystemFontOfSize(size: CGFloat) -> UIFont {
return UIFont(name: "HelveticaNeue-Italic", size: size)!
}
@imkevinxu
imkevinxu / README.md
Last active December 10, 2015 07:38
CSS Rotate Effect
@imkevinxu
imkevinxu / README.md
Last active December 10, 2015 07:38
CSS Bounce Effect
@imkevinxu
imkevinxu / README.md
Last active December 10, 2015 07:38
CSS Fade-Out Content
@imkevinxu
imkevinxu / README.md
Last active July 29, 2018 13:57
CSS Fade-In Content
@imkevinxu
imkevinxu / README.md
Last active September 1, 2022 05:53
Time Spent on Page

Javascript code that calculates how much active time is spent on a tab and takes into account changing tabs, switching windows, or leaving the page.

Demo here http://bl.ocks.org/d/4393523/