Skip to content

Instantly share code, notes, and snippets.

@corysimmons
corysimmons / project_path.py
Created October 17, 2012 18:37
Django settings.py relative project path function
def project_path(dir):
return os.path.join(os.path.dirname(os.path.dirname(__file__)), dir)
# Usage
TEMPLATE_DIRS = (
project_path('templates'),
)
@corysimmons
corysimmons / jQuery_featureList.js
Last active October 12, 2015 03:58
jQuery FeatureList
/*
* FeatureList - simple and easy creation of an interactive "Featured Items" widget
* Examples and documentation at: http://jqueryglobe.com/article/feature_list/
* Version: 1.0.0 (01/09/2009)
* Copyright (c) 2009 jQueryGlobe
* Licensed under the MIT License: http://en.wikipedia.org/wiki/MIT_License
* Requires: jQuery v1.3+
*/
;(function($) {
$.fn.featureList = function(options) {
@corysimmons
corysimmons / html_template.html
Last active December 15, 2015 13:38
HTML template
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title></title>
<meta name="description" content="">
<meta name="viewport" content="width=device-width">
<link rel="stylesheet" href="style.css">
</head>
@corysimmons
corysimmons / Key Bindings
Last active December 16, 2015 13:19
My user settings for Sublime Text. Updated semi-frequently.
[
{ "keys": ["super+shift+d"], "command": "duplicate_lines" },
{ "keys": ["ctrl+d"], "command": "dash_doc"},
{ "keys": ["ctrl+shift+d"], "command": "dash_doc",
"args": { "syntax_sensitive": false } },
{ "keys": ["super+shift+r"], "command": "reindent" }
]
@corysimmons
corysimmons / goodies.styl
Created July 12, 2013 20:01
Jeet's new goodies.styl now with FlatUI colors, sexier buttons, and generic form styling
// Colors
turquoise = #1abc9c
emerald = #2ecc71
peter_river = #3498db
amethyst = #9b59b6
wet_asphalt = #34495e
green_sea = #16a085
nephritis = #27ae60
belize_hole = #2980b9
wisteria = #8e44ad
@corysimmons
corysimmons / detect.js
Created August 2, 2013 15:19
This script will detect if a user is using a mobile browser. If so, it will set the isMobile variable to true.
var isMobile = false;
function detectMobile() {
var browserInfo = navigator.userAgent||navigator.vendor||window.opera;
if(/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|ip(hone|od)|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(browserInfo)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac
@corysimmons
corysimmons / gumby.html
Last active December 21, 2015 11:59
Barebones Gumby 2 index.html starter template. Insanely surprisingly enough, I couldn't find this anywhere, so I just stripped down demo.html.
<!doctype html>
<!-- paulirish.com/2008/conditional-stylesheets-vs-css-hacks-answer-neither/ -->
<!--[if lt IE 7]> <html class="no-js ie6 oldie" lang="en"> <![endif]-->
<!--[if IE 7]> <html class="no-js ie7 oldie" lang="en"> <![endif]-->
<!--[if IE 8]> <html class="no-js ie8 oldie" lang="en"> <![endif]-->
<!--[if IE 9]> <html class="no-js ie9" lang="en"> <![endif]-->
<!-- Consider adding an manifest.appcache: h5bp.com/d/Offline -->
<!--[if gt IE 9]><!--> <html class="no-js" lang="en" itemscope itemtype="http://schema.org/Product"> <!--<![endif]-->
<head>
<meta charset="utf-8">
@corysimmons
corysimmons / .zshrc
Last active December 24, 2015 06:09
My .zshrc aliases
# Path to your oh-my-zsh configuration.
ZSH=$HOME/.oh-my-zsh
# Set name of the theme to load.
# Look in ~/.oh-my-zsh/themes/
# Optionally, if you set this to "random", it'll load a random theme each
# time that oh-my-zsh is loaded.
ZSH_THEME="alanpeabody"
# Example aliases
@corysimmons
corysimmons / Regex Classes
Created October 5, 2013 23:46
Regex to grab the period before words (classes) but not numbers (floats).
(?!.*(?:\b\d+(?:\.\d+)?))\.