A simple sandbox for your webapp. Includes hooks on dom ready, pubsub pattern and much more.
Requires jQuery 1.7+.
#Source
/**
<?php | |
function time_ago($date,$granularity=2) { | |
$difference = time() - $date; | |
$retval = ''; | |
$periods = array('decade' => 315360000, | |
'year' => 31536000, | |
'month' => 2628000, | |
'week' => 604800, | |
'day' => 86400, | |
'hour' => 3600, |
foo { | |
width:200px; | |
white-space: nowrap; | |
overflow: hidden; | |
text-overflow: ellipsis; | |
} |
Date.prototype.getUTCTimestamp = function() { | |
var currentTime, localOffset; | |
currentTime = this.getTime(); | |
localOffset = (-1) * this.getTimezoneOffset() * 60000; | |
return Math.round(new Date(currentTime + localOffset).getTime() / 1000); | |
}; |
//Grunt Spritesmith plugin | |
sprite: { | |
build: { | |
src: ['src/img/sprite/*.png'], | |
destImg: 'build/img/s-' + timestamp + '.png', | |
destCSS: 'src/scss/common/sprite.scss', | |
imgPath: '../img/s-' + timestamp + '.png', | |
algorithm: 'binary-tree', | |
engine: 'gm', | |
'engineOpts': { |
if typeof define is 'function' and define.amd | |
# AMD | |
define -> MyObject | |
else if typeof exports is 'object' | |
# CommonJS | |
module.exports = MyObject | |
else | |
# Global | |
MyObject.init() |
<?php | |
//Full image URLs will be extracted into $matches[2] | |
preg_match_all("/<(img)?+[^>]* src=['\"]([^\"']+\.(jpe?g|png)[#?]?[^\"']*?)[\"']/i", $html, $matches); |
<meta name="application-name" content="Your app name" /> | |
<meta name="msapplication-TileColor" content="#000000"/> | |
<meta name="msapplication-square70x70logo" content="http://logo.png" /> | |
<meta name="msapplication-square150x150logo" content="http://logo2.png" /> | |
<meta name="msapplication-wide310x150logo" content="http://logo3.png" /> | |
<meta name="msapplication-square310x310logo" content="http://logo4.png" /> | |
<meta name="msapplication-notification" content="frequency=30; polling-uri=http://example.org/livetile/1.xml; polling-uri2=http://example.org/livetile/2.xml; polling-uri3=http://example.org/livetile/3.xml; polling-uri4=http://example.org/livetile/4.xml" /> |