Skip to content

Instantly share code, notes, and snippets.

View justinpeterman's full-sized avatar

Justin Peterman justinpeterman

  • San Francisco, CA
View GitHub Profile
@padolsey
padolsey / gist:2521471
Created April 28, 2012 19:20
Regular click event for touch devices [jQuery]
'createTouch' in document && (jQuery.event.special.click = {
setup: function(data, namespaces, eventHandle) {
var t;
$(this).bind('touchstart.touchClick', function() {
t = +new Date;
}).bind('touchend.touchClick', function(e) {
if (+new Date < t + 200) {
$(this).trigger('click', e);
}
})
@nathansmith
nathansmith / .htaccess
Created October 1, 2011 03:33
Route extension-less files to HTML.
# Route extension-less URLs to the equivalent *.html file.
# For instance: example.com/about = example.com/about.html
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteCond %{REQUEST_FILENAME} !-f
RewriteRule ^([^\.]+)$ $1.html [NC,L]
</IfModule>
@jeremyckahn
jeremyckahn / truncateWithEllipsis.js
Created August 15, 2011 22:29
Lets you limit the length of the string and truncate the end with ellipses (...).
/**
* Lets you limit the length of a string and truncate the end with ellipses (...).
*
* @param {String} str The String to truncate.
* @param {Number} limit The maximum size of the string.
*/
function truncateWithEllipsis (str, limit) {
var truncatedString;
limit -= 3;