Skip to content

Instantly share code, notes, and snippets.

@Incognito
Incognito / .md
Created March 8, 2012 19:46
jQuery/DOM/best-practices discussion with Ryan McGreal

#Why it's bad.

So, the problem with this...

function formatCurrency (data) {
    // format germany price
    var els = document.querySelectorAll('.price');
    for (var i=0; i<els.length; i++) {
        var price = parseInt(els[i].innerHTML.replace(/[^0-9]*/,''));
        var curr = els[i].getAttribute('data-currency');
@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]
@Raynos
Raynos / weak-map.js
Last active September 18, 2019 07:49 — forked from Gozala/weak-map.js
Harmony WeakMap shim for ES5
// Original - @Gozola. This is a reimplemented version (with a few bug fixes).
window.WeakMap = window.WeakMap || (function () {
var privates = Name()
return {
get: function (key, fallback) {
var store = privates(key)
return store.hasOwnProperty("value") ?
store.value : fallback
},