This gist is no longer valid. Please see Compass-Rails for instructions on how to install.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Light-weight YUI-dependend Script Loader | |
* - loads YUI 3 if not already loaded | |
* - then loads your script(s) | |
* | |
* Useful for dynamically loaded modules, injected scripts, bookmarklets, etc… | |
*/ | |
(function() { | |
// YUI to load if unavailable |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
node_modules/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI().use("singleton-class", function (Y) { | |
var instance1 = new Y.SingletonClass(), | |
instance2 = new Y.SingletonClass(); | |
Y.log(instance1 === instance2); // true! | |
window.instance1 = instance1; | |
}); | |
YUI().use("singleton-class", function (Y) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
YUI_config = { | |
logInclude : { | |
"ID3": true | |
} | |
}; | |
if (typeof console !== "undefined") { | |
console.log = function (m, t, s) { | |
s = s || null; | |
if (!s) { | |
return false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fs.readdir(srcPath, handleDirectoryRead.bind(null, srcPath)); | |
function handleDirectoryRead(srcPath, err, files) { | |
files.forEach(handleFile.bind(null, srcPath)); | |
} | |
function handleFile(srcPath, file) { | |
var uri = path.join(srcPath, file); | |
fs.stat(uri, handleStat.bind(null, uri)); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
" Get coffeelint errors in the vim quickfix menu | |
" requires coffeelint to be installed and in the path | |
" http://www.coffeelint.org/ | |
" lint the current file | |
function! CoffeeLintFile() | |
let current = fnamemodify(expand("%"), ':p') | |
call CoffeeLintAnalyze(current) | |
endfunction |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Add a getElementsByClassName function if the browser doesn't have one | |
// Limitation: only works with one class name | |
// Copyright: Eike Send http://eike.se/nd | |
// License: MIT License | |
if (!document.getElementsByClassName) { | |
document.getElementsByClassName = function(search) { | |
var d = document, elements, pattern, i, results = []; | |
if (d.querySelectorAll) { // IE8 | |
return d.querySelectorAll("." + search); |
- Avoid reprocessing the same block in different HTML files.
- Throw warning when processing a different block to an existing destination file. Hashing will avoid collisions, but introduce confusion.
- Add file versioning for inline media and CSS images.
- Avoid need for 'usemin' task - get the replacement element pattern from the first/last HTML element in actual block being replaced. Added benefit of preserving other attributes that may exist (e.g.
title
,media
).
Acknowledgements: This is an adaption of some of Mickael Daniel's work on h5bp/node-build-script
This article has been given a more permanent home on my blog. Also, since it was first written, the development of the Promises/A+ specification has made the original emphasis on Promises/A seem somewhat outdated.
Promises are a software abstraction that makes working with asynchronous operations much more pleasant. In the most basic definition, your code will move from continuation-passing style:
getTweetsFor("domenic", function (err, results) {
// the rest of your code goes here.
OlderNewer