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
let tee = (a) => {console.log(String(a)); return a} | |
// our applicator | |
let $_ = (n) => { | |
let args = new Array(n); | |
for (let i = 1; i <= n; i++) { | |
args[i-1] = `$${i}` | |
} | |
return (raw, ...values) => | |
Function(...args.concat(tee('return ' + raw.reduce( |
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
// Creating a plugin with $.myNS.public_method1() and $.myNS.public_method2() methods, a few different ways. | |
(function($){ | |
var private_var, | |
myNS = $.myNS = {}, | |
public_method2; | |
myNS.public_method1 = function(){ | |
private_method(); |
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(){ | |
var supported; | |
if (document.body.setAttribute) { | |
var el = document.createElement('div'); | |
el.setAttribute('onhashchange','return;'); | |
supported = typeof el.onhashchange == 'function'; | |
} else { | |
supported = 'onhashchange' in document.documentElement; | |
} | |
if (!supported) { |
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 this script to the end of your document that use <input autofocus type="text" /> | |
* or <input type="text" placeholder="username" /> and it'll plug support for browser | |
* without these attributes | |
* Minified version at the bottom | |
*/ | |
(function () { | |
function each(list, fn) { | |
var l = list.length; |
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
// (Simple example of using platform.js in a jQuery plugin.) | |
// Usage: $('#block').anim8({ top:50, left:350 }, 250); | |
$.fn.anim8 = (function($){ return platform({ | |
// For Webkit browsers it will use CSS animations | |
webkit: function(props, speed, transition) { | |
return this.each(function(){ | |
var elem = $(this), | |
transition = transition || 'ease-out', |
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
/* | |
Script: Mediator | |
Object grouping and brokering | |
Copyright and License: | |
Copyright 2010, Mark Obcena. MIT-Style License | |
*/ | |
(function(){ |
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
// From http://a5.twimg.com/a/1284588078/javascripts/phoenix.bundle.js | |
(function (B) { | |
var A = (function () { | |
var E = { | |
select: "input", | |
change: "input", | |
submit: "form", | |
reset: "form", | |
error: "img", |
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
// Handles JavaScript history management and callbacks. To use, register a | |
// regexp that matches the history hash with its corresponding callback. | |
window.HashHistory = { | |
// The interval at which the window location is polled. | |
URL_CHECK_INTERVAL : 500, | |
// We need to use an iFrame to save history if we're in an old version of IE. | |
USE_IFRAME : jQuery.browser.msie && jQuery.browser.version < 8, |
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
// Handles JavaScript history management and callbacks. To use, register a | |
// regexp that matches the history hash with its corresponding callback. | |
window.HashHistory = { | |
// The interval at which the window location is polled. | |
URL_CHECK_INTERVAL : 500, | |
// We need to use an iFrame to save history if we're in an old version of IE. | |
USE_IFRAME : jQuery.browser.msie && jQuery.browser.version < 8, |
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
/* View documents with Google Docs ... | |
* because my laptop can't handle Word and Chrome at the same time. */ | |
$(document).ready(function(){ | |
// I'm sure there's a more efficient selector for this. | |
$('a[href$=doc], a[href$=docx], a[href$=pdf], a[href$=rtf]').attr( | |
'href', | |
function(){ | |
return 'http://docs.google.com/viewer?url=' + this.href; | |
} |
OlderNewer