Skip to content

Instantly share code, notes, and snippets.

@imkevinxu
imkevinxu / template.html
Created August 16, 2012 02:11
Django code to read uploaded CSV file
<form action="{% url %}" method="post" enctype="multipart/form-data">{% csrf_token %}
<input type="file" name="csv_file" />
<input type="submit" value="Upload" />
</form>
@imkevinxu
imkevinxu / .gitconfig
Created November 5, 2012 09:42
`git random` alias that will commit a random commit message from http://whatthecommit.com/
[alias]
random = !"git add -A; git commit -am \"$(echo $(curl -s http://whatthecommit.com/index.txt)\" (http://whatthecommit.com)\")\"; git pull --rebase; git push"
@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/

@imkevinxu
imkevinxu / README.md
Last active July 29, 2018 13:57
CSS Fade-In Content
@imkevinxu
imkevinxu / README.md
Last active December 10, 2015 07:38
CSS Fade-Out Content
@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 Rotate Effect
@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 / 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 / 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"