This gist's comment stream is a collection of webdev apps for OS X. Feel free to add links to apps you like, just make sure you add some context to what it does — either from the creator's website or your own thoughts.
— Erik
/** | |
* Move in a circle without wrapper elements | |
* Idea by Aryeh Gregor, simplified by Lea Verou | |
*/ | |
@keyframes rot { | |
from { | |
transform: rotate(0deg) | |
translate(-150px) | |
rotate(0deg); |
function imgError(image) { | |
image.onerror = ""; | |
image.src = "/images/noimage.gif"; | |
return true; | |
} | |
<img src="image.png" onerror="imgError(this);"/> or | |
<img src="image.png" onError="this.onerror=null;this.src='/images/noimage.gif';" /> |
server { | |
... | |
# Fix @font-face cross-domain restriction in Firefox | |
location ~* \.(eot|ttf|woff)$ { | |
add_header Access-Control-Allow-Origin *; | |
} | |
... | |
} | |
原贴来自snipt.net |
/* long version */ | |
a[href^="http://"]:not([href*="mysite.com"]), | |
a[href^="https://"]:not([href*="mysite.com"]), | |
a[href^="//"]:not([href*="mysite.com"]), { | |
} | |
/* shorter version! */ | |
a[href*="//"]:not([href*="mysite.com"]) { | |
/* external link styles, use :before or :after if you want! */ | |
} |
// Displays the date with ago like facebook | |
function getHowLongAgo($date, $display = array('year', 'month', 'day', 'hour', 'minute', 'second'), $ago = 'ago'){ | |
$date = getdate(strtotime($date)); | |
$current = getdate(); | |
$p = array('year', 'mon', 'mday', 'hours', 'minutes', 'seconds'); | |
$factor = array(0, 12, 30, 24, 60, 60); | |
for ($i = 0; $i < 6; $i++) { | |
if ($i > 0) { | |
$current[$p[$i]] += $current[$p[$i - 1]] * $factor[$i]; | |
$date[$p[$i]] += $date[$p[$i - 1]] * $factor[$i]; |
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/ | |
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating | |
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel | |
// MIT license | |
(function() { | |
var lastTime = 0; | |
var vendors = ['ms', 'moz', 'webkit', 'o']; |
var gulp = require('gulp'); | |
var minifycss = require('gulp-minify-css'); | |
var autoprefixer = require('gulp-autoprefixer'); | |
var notify = require('gulp-notify'); | |
var sass = require('gulp-ruby-sass'); | |
gulp.task('css', function() { | |
return gulp.src('sass/main.sass') | |
.pipe(sass({ style: 'compressed' })) | |
.pipe(autoprefixer('last 15 version')) |
var gulp = require('gulp'), | |
sys = require('sys'), | |
exec = require('child_process').exec; | |
gulp.task('phpunit', function() { | |
exec('phpunit', function(error, stdout) { | |
sys.puts(stdout); | |
}); | |
}); |