Skip to content

Instantly share code, notes, and snippets.

View Raynos's full-sized avatar

Jake Verbaten Raynos

View GitHub Profile
@Raynos
Raynos / critique.md
Created December 1, 2011 14:15
jQuery library critique

jQuery

Related: [Why you don't need jQuery as an abstraction][2]

$ itself is a god object. Everything goes on it. The standard plugin / extension architecture that is recommended is to just bolt more methods on $ itself!

Surely this is bad. An example would be how we have both $.load which is overloaded to do completely different things. If they were on two separate sensibly named objects $Container.load and $EventTarget.load. Personally I would deprecate the latter in favour of .on('load'

The animation should be it's own little modular thing, not bolted onto $. Ajax should be it's own little modular thing, not bolted onto $

@Raynos
Raynos / 0usage.js
Created December 7, 2011 02:07
The heart of pd
var Parent = {
constructor: function constructor(magic) {
this.isMagic = magic
return this
},
method: function method() { }
}
var Mixin = {
mixinMethod: function () { }
@Raynos
Raynos / iterateWalk.js
Created December 13, 2011 19:34
All the DOM recursion you'll ever need
var slice = Array.prototype.slice
function iterativelyWalk(nodes, cb) {
nodes = slice.call(nodes)
while(nodes.length) {
var node = nodes.shift(),
ret = cb(node)
if (ret) {
@Raynos
Raynos / jQuery.md
Created January 14, 2012 22:44
Why you don't need jQuery

Why the jQuery Abstraction isn't needed.

(One needs some form of browser normalization so that modern features works, no-one is doubting that).

Related: [jQuery library critique][2]

Abstractions that aren't needed

Selectors

@Raynos
Raynos / x.md
Created January 17, 2012 22:27
Host objects

Why use or shim host objects?

Shims allow you to work without a browser compliance or without a browser abstraction library. Modern browsers have enough native and host APIs that you do not need any third party libraries for these features, you just need shims as your legacy browser compliance strategy.

Standard APIs

Host objects defined in the WHATWG and W3C specifications are standard APIs. They are well known, readable and maintainable. They are highly optimised and efficient.

Consider getElementsByClassName, you can either use it and have a shim for non-compliant browsers. This gives you maximum performance for compliant browsers, good performance for non-compliant browsers.

@Raynos
Raynos / x.md
Created January 23, 2012 19:03
unshimmable subset of ES5

The following features of ES5 cannot be shimmed.

The ones you care about

Enumerable properties [ES3]

Using Object.defineProperty if you define a non-enumerable property on an object then for..in loops over that object will behave correctly in modern browsers but enumerate over that property in legacy browsers.

This means that code that works in modern browsers, breaks in legacy browsers.

@Raynos
Raynos / a.md
Created January 23, 2012 19:48
Shim status of ES6

ES6 what can be shimmed and what not.

Currently only lists things that can be shimmed or are experimentally implemented

Note that for any kind of decent ES6 support we need an ES6 transpiler. A few projects are attempting this [Reference SO question][3]

  • [traceur][4]
  • [Caja][5]
  • [ES transpiler][6]
@Raynos
Raynos / starred-gists.md
Created February 27, 2012 00:33
My starred gists
  • [Why you don't need Meteor][20]
  • [Shim status of ES6][1]
  • [unshimmable subset of ES5][2]
  • [Host objects][3]
  • [Why you don't need jQuery][4]
  • [All the DOM recursion you'll ever need][5]
  • [The heart of pd][6]
  • [jQuery library critique][7]
  • [klass][8]
  • [tiny select][9]

a Stream spec


##UPDATE

I've now moved this stuff into it's own repo and added an executable checker, and some nifty diagrams of the stream state transitions state diagrams

This gist is no longer being maintained. goto dominictarr/stream-spec


@Gozala
Gozala / Introspect.js
Created January 6, 2013 05:06
Introspection for reducibles
function introspect(source, alias) {
return reducible(function(next, initial) {
return reduce(source, function(value, result) {
if (value === end) console.log(alias, "<<", value)
if (isError(value)) console.log(alias, "\u26A1", value)
result = next(value, result)
if (isReduced(result)) console.log(alias, "\u2702", result.value)
return result
}, intial)
})