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(){}(); // => true | |
~function(){}(); // => -1 | |
+function(){}(); // => NaN | |
-function(){}(); // => NaN |
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
// Crockford's preference - parens on the inside | |
(function() { | |
console.log('Welcome to the Internet. Please follow me.'); | |
}()); |
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() { | |
console.log('Welcome to the Internet. Please follow me.'); | |
})(); |
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
// Demo: | |
// ----------------------------------- | |
// Copy & Paste into the console. | |
// Optional | |
// run test() => true | |
// run test(1) => Error | |
// newTest = wrap(test, { | |
// name: 'test', | |
// filename: '/js/danger.js' | |
// }) |
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
var sum = new Function('a', 'b', 'return a + b'); |
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
var a,b,c,d; | |
(function(a,b,c,d){}).length // => 4 | |
a = function(b,c,d){}; | |
a.length // => 3 |
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
// shift+up and shift+down to move between channels | |
// | |
// copy and paste into the console | |
// or if you're using Fluid.app put | |
// in Userscripts | |
$(document).bind('keydown', function(e){ | |
var shifted = e.shiftKey; | |
if (e.keyCode == 40 && shifted) { |
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($) { | |
App.on('messageAdded', function() { | |
var $pic, $picLI, index, $prevLI, $prevPic, | |
$picSeparator, $picContent, | |
$pics = $('.userpic img'), | |
SPACING = '3px'; | |
for(index = $pics.length - 1; index >= 0; index--) { | |
$pic = $($pics[index]); | |
$picLI = $pic.closest('li'); |
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
if (typeof (AC) === "undefined") { | |
AC = {} | |
} | |
AC.ImageReplacer = Class.create({ | |
_defaultOptions: { | |
listenToSwapView: true, | |
filenameRegex: /(.*)(\.[a-z]{3}($|#.*|\?.*))/i, | |
filenameInsert: "_☃x", | |
ignoreCheck: /(^http:\/\/movies\.apple\.com\/|\/105\/|\/global\/elements\/quicktime\/|_(([2-9]|[1-9][0-9]+)x|nohires)(\.[a-z]{3})($|#.*|\?.*))/i, | |
attribute: "data-hires", |
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
class Component extends Backbone.View | |
defaults: | |
'visible': true | |
initialize: -> | |
# defaults gets overriden by @config, which is overridden | |
# by the passed in options on initialization. So @config | |
# acts as @defaults for something that extends Component | |
@options = _.extend({}, @defaults, @config, @options) |