Skip to content

Instantly share code, notes, and snippets.

David DeSandro desandro

View GitHub Profile
View Lucida Sans font stack
body {
font-family: 'Lucida Sans', 'Lucida Sans Regular', 'Lucida Grande', 'Lucida Sans Unicode', Arial, sans-serif;
}
View HTML5 quick start template
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title></title>
<style media="screen">
</style>
View jQuery.support.css3.js
// jQuery.support.css3
// verifies css3 properties across browsers
// i.e. $.support.css3('transition')
$.support.css3 = function(prop) {
var
support = false,
thisBody = document.body || document.documentElement,
thisStyle = thisBody.style,
uc_prop = prop.charAt(0).toUpperCase() + prop.substr(1),
props = [
View Textmate CSS3 syntax highlights.plist
{ scopeName = 'source.css';
comment = '';
fileTypes = ( 'css', 'css.erb' );
foldingStartMarker = '/\*\*(?!\*)|\{\s*($|/\*(?!.*?\*/.*\S))';
foldingStopMarker = '(?<!\*)\*\*/|^\s*\}';
patterns = (
{ name = 'meta.selector.css';
begin = '^(?=\s*[:.*#a-zA-Z])';
end = '(?=\{)';
patterns = (
View basic-canvas.html
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
<title>basic canvas</title>
<style media="screen">
body {
font-family: 'Helvetica Neue', Arial, sans-serif;
}
View masonry_issue
<html>
<head>
<style type="text/css">
.box {
margin: 5px;
padding: 5px;
background: #D8D5D2;
font-size: 11px;
float: left;
View getTimeFromMillis.js
// converts milliseconds to '3:45' or if hours > 0, '2:01:23'
var getTimeFromMillis = function( ms ) {
var seconds = ~~( ( ms / 1000 ) % 60 ),
minutes = ~~( ( ms / ( 1000 * 60 ) ) % 60 ),
hours = ~~( ( ms / ( 1000 * 60 * 60 ) ) ),
twoDigit = function ( n ) {
return n < 10 ? '0' + n : n;
},
seconds = ':' + twoDigit( seconds );
@desandro
desandro / desandro.bash
Created Nov 29, 2010
Terminal styles and aliases
View desandro.bash
# Aliases
alias showhidden="defaults write com.apple.finder AppleShowAllFiles TRUE; killall Finder"
alias hidehidden="defaults write com.apple.finder AppleShowAllFiles FALSE; killall Finder"
alias myip="echo ethernet:; ipconfig getifaddr en0; echo wireless:; ipconfig getifaddr en1"
alias gitx="open -a GitX ."
alias ohmygit="open .; mate .; gitx"
alias jkas="jekyll --auto --server"
alias rmjkas="rm -rf _site/* && jkas"
alias symlink="ln -s"
@desandro
desandro / jquery.imagesloaded.js
Created Jan 26, 2011 — forked from paulirish/README.md
$.fn.imagesLoaded jQuery plugin
View jquery.imagesloaded.js
// $('img.photo',this).imagesLoaded(myFunction)
// execute a callback when all images have loaded.
// needed because .load() doesn't work on cached images
// Modified with a two-pass approach to changing image
// src. First, the proxy imagedata is set, which leads
// to the first callback being triggered, which resets
// imagedata to the original src, which fires the final,
// user defined callback.
View phaeton.theme.bash
#!/bin/bash
prompt_setter() {
# Save history
history -a
history -c
history -r
# has user and server
# PS1="$(scm_char) [\[$black\]\u\[$reset_color\]@\[$blue\]\h\[$reset_color\]] \[$red\]\w\[$green\]$(scm_prompt_info)$(rvm_version_prompt) \[$yellow\]$\[$reset_color\] "
# no user and seruver
You can’t perform that action at this time.