Skip to content

Instantly share code, notes, and snippets.

@curtisharvey
curtisharvey / loader.js
Created July 29, 2010 06:55
YUI seed loader
/**
* 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
@DTrejo
DTrejo / .gitignore
Created April 4, 2011 03:32
How to Readline - an example and the beginnings of the docs
node_modules/
@kara-ryli
kara-ryli / implementation.js
Created July 8, 2011 20:01
Create a singleton class in YUI3. This class can only be instantiated one time. All later instantiations return references to the original.
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) {
@chriseppstein
chriseppstein / readme.md
Created August 31, 2011 21:57 — forked from mislav/Gemfile
How to integrate Compass with Rails 3.1 asset pipeline

This gist is no longer valid. Please see Compass-Rails for instructions on how to install.

@josephj
josephj / debugging.js
Created November 28, 2011 03:51
Remove unecessary JavaScript logs, for debugging purpose.
YUI_config = {
logInclude : {
"ID3": true
}
};
if (typeof console !== "undefined") {
console.log = function (m, t, s) {
s = s || null;
if (!s) {
return false;
@Raynos
Raynos / file.js
Created November 30, 2011 15:27
Recursive fs.watch
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));
}
@davidmfoley
davidmfoley / coffeelint.vim
Created April 2, 2012 14:07
coffeelint/vim quickfix integration
" 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
@eikes
eikes / getElementsByClassName.polyfill.js
Created April 4, 2012 08:04
Polyfill for getElementsByClassName
// 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);
@necolas
necolas / _todo.md
Created June 30, 2012 18:07
Grunt tasks to process HTML files and produce a deploy directory of optimized files
  • 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

@domenic
domenic / promises.md
Last active March 31, 2024 14:07
You're Missing the Point of Promises

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.

You're Missing the Point of Promises

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.