A Pen by Ricardo Magalhães on CodePen.
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
var asking = new $.Deferred(); | |
var feedback = asking.pipe(function (res) { | |
console.log('Sending:', res); | |
return $.post('/echo/json', res); | |
}); | |
// Simulate form submit... | |
asking.resolve('my details'); |
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
/* USAGE: | |
node fjoin file1 file2 file 3 | |
or | |
fjoin({files, target}) | |
*/ | |
var util = require('util'), | |
fs = require('fs'), | |
files = [], | |
readstream, |
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 Event Shim */ | |
var addEvent = (function () { | |
var filter = function(el, type, fn) { | |
for (var i = 0, len = el.length; i < len; i++) { | |
addEvent(el[i], type, fn); | |
} | |
}; | |
if (document.addEventListener) { | |
return function (el, type, fn) { | |
if ( el && el.nodeName || el === window ) { |
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
function castElement(el, target) { | |
// Convert nodelists and weird dom stuff into arrays | |
var attrs = [].slice.call(el.attributes, 0), | |
children = [].slice.call(el.childNodes, 0), | |
// create final element | |
element = document.createElement(target); | |
if (el.nodeName.toLowerCase() === 'textarea') { | |
element.innerHTML = el.value; | |
} |
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
var browser = (function () { | |
var ua = navigator.userAgent.toLowerCase(), | |
platform = navigator.platform.toLowerCase(), | |
UA = ua.match(/(opera|ie|firefox|chrome|version)[\s\/:]([\w\d\.]+)?.*?(safari|version[\s\/:]([\w\d\.]+)|$)/) || [null, 'unknown', 0], | |
mode = UA[1] === 'ie' && document.documentMode, | |
name = (UA[1] === 'version') ? UA[3] : UA[1], | |
version = mode || parseFloat((UA[1] === 'opera' && UA[4]) ? UA[4] : UA[2]), | |
browser; | |
return { |
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
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta name="description" content="Mars Challenge" /> | |
<meta charset="utf-8"> | |
<title>Mars Challenge</title> | |
</head> | |
<body> | |
<h2>Mars Challenge</h2> | |
<pre class="neutral"> |
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
/** | |
* __series | |
* Given an array of functions, it will call every function, | |
* once at a time, sequentially. | |
* Every function will have a trigger function as its last argument, | |
* that should be called when the function is done. | |
* If arguments are given to this trigger function, those will be passed | |
* to the next function. | |
* | |
* @example |
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
/* Takes two images and compares them. | |
* If they're different, a GIF with the differences will be created. | |
* | |
* @requires ImageMagick to be installed to generate the GIF :( | |
* Install it via Homebrew: brew install imagemagick | |
* | |
* @usage: node screenshot.js file1.jpg file2.jpg | |
*/ | |
var pngparse = require('pngparse'); | |
var exec = require('child_process').exec; |
- CSSConf EU 2014 - CSS Performance Tooling — by Addy Osmani
- React: CSS in JS — Slides, November 2014
- AngularJS: Realtime Eye Candy — by FITC
OlderNewer