Skip to content

Instantly share code, notes, and snippets.

@paulirish
paulirish / bling.js
Last active September 13, 2025 12:13
bling dot js
/* bling.js */
window.$ = document.querySelector.bind(document);
window.$$ = document.querySelectorAll.bind(document);
Node.prototype.on = window.on = function(name, fn) { this.addEventListener(name, fn); };
NodeList.prototype.__proto__ = Array.prototype;
NodeList.prototype.on = function(name, fn) { this.forEach((elem) => elem.on(name, fn)); };
@bradfrost
bradfrost / gist:59096a855281c433adc1
Last active September 4, 2023 15:01
Why I'm Not A JavaScript Developer

Answering the Front-end developer JavaScript interview questions to the best of my ability.

  • Explain event delegation

Sometimes you need to delegate events to things.

  • Explain how this works in JavaScript

This references the object or "thing" defined elsewhere. It's like "hey, thing I defined elsewhere, I'm talkin' to you."

  • Explain how prototypal inheritance works.
var server = require('./server');
server.listen(3000);
define(
['underscore'],
function (_) {
// Outputs "true"
console.log(_.deepClone !== undefined);
}
);
@jcreamer898
jcreamer898 / README.md
Last active December 17, 2015 22:59
A base ko viewModel

How to use this thing...

var MyNewViewModel = ViewModel.extend({
    subscriptions: {},
    publications: {},
    defaults: {
        // ko.observable
        foo: 1,
 // ko.ovservableArrray
@nicholascloud
nicholascloud / blog-npm-root-packages.md
Last active December 16, 2015 03:49
blog-npm-root-packages
@leommoore
leommoore / node_file_paths.markdown
Last active August 19, 2024 13:02
Node - File Paths

#Node - File Paths

##File Paths Node has a path module which can be used to manipulate paths.

###Normalizing Paths Paths can be stored in different ways and it is neccessary to ensure that the path is standardized.

var path = require('path');
path.normalize('/foo/bar//baz/asdf/quux/..');
@bradwilson
bradwilson / gist:4215933
Last active August 17, 2020 16:46
.gitconfig
[user]
name = Brad Wilson
email = [email protected]
[alias]
a = add -A
abort = rebase --abort
amend = commit --amend -C HEAD
bl = blame -w -M -C
br = branch
cat = cat-file -t
@davemo
davemo / express.api.js
Created September 4, 2012 21:48
An API Proxy in Express
var express = require('express'),
request = require('request'),
app = express.createServer(),
PORT = 8010;
app.configure(function() {
app.use(express.static(__dirname));
app.use(express.bodyParser());
app.use(express.errorHandler());
});