Skip to content

Instantly share code, notes, and snippets.

View callmehiphop's full-sized avatar
👾

Dave callmehiphop

👾
  • Detroit, MI
View GitHub Profile
@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)); };
alias update="sudo softwareupdate -i -a; brew update; brew upgrade; brew cleanup; npm update npm -g; npm update -g; sudo gem update; vim +BundleUpdate +qall"
@stephenplusplus
stephenplusplus / retry-failed-route.js
Created February 19, 2014 18:51
Angular API re-attempt
angular
.module('app')
.config(function ($httpProvider) {
$httpProvider.interceptors.push(['$injector', '$q', function ($injector, $q) {
return {
responseError: function (rejection) {
var $http = $injector.get('$http'),
$state = $injector.get('$state'),
MAX_RETRY_ATTEMPTS = 2,
request = rejection.config,
@paulirish
paulirish / rAF.js
Last active September 13, 2025 02:41
requestAnimationFrame polyfill
// http://paulirish.com/2011/requestanimationframe-for-smart-animating/
// http://my.opera.com/emoller/blog/2011/12/20/requestanimationframe-for-smart-er-animating
// requestAnimationFrame polyfill by Erik Möller. fixes from Paul Irish and Tino Zijdel
// MIT license
(function() {
var lastTime = 0;
var vendors = ['ms', 'moz', 'webkit', 'o'];
@ryanflorence
ryanflorence / universal-module.js
Created September 6, 2011 18:10
Universal JavaScript Module, supports AMD (RequireJS), Node.js, and the browser.
(function (name, definition){
if (typeof define === 'function'){ // AMD
define(definition);
} else if (typeof module !== 'undefined' && module.exports) { // Node.js
module.exports = definition();
} else { // Browser
var theModule = definition(), global = this, old = global[name];
theModule.noConflict = function () {
global[name] = old;
return theModule;