Skip to content

Instantly share code, notes, and snippets.

@cowboy
cowboy / fix-disqus-markup.js
Created February 19, 2010 02:15
Fix Disqus craptacular markup.
// Ben Alman
// http://benalman.com/
//
// Requires jQuery 1.3.2+ and jQuery doTimeout
// http://jquery.com/
// http://benalman.com/projects/jquery-dotimeout-plugin/
//
// SyntaxHighlighter optional (but totally awesome)
// http://alexgorbatchev.com/wiki/SyntaxHighlighter
//
@cowboy
cowboy / Safari View Source in TextMate.applescript
Created February 22, 2010 03:18
Safari View Source in Textmate
(*
* Safari View Source in Textmate - v1.0 - 2/21/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*
* Recommended for use with FastScripts script menu,
* with the cmd-u hotkey bound to it, for easy access!
/*!
* jQuery iePseudoFix - v0.1 - 2/22/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
(*
* Safari Resize / Move By - v1.0 - 2/26/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*)
-- Modify these as necessary:
@cowboy
cowboy / queue-explain.js
Created March 2, 2010 15:12
Serial asynchronous actions...
// Comments for http://bjam.in/jquery-queue
// Say you want to execute first_async_action() followed by
// second_async_action(), followed by third_async_action().
// You could do this:
first_async_action(function(){
second_async_action(function(){
third_async_action(function(){
alert( 'done!' );
@cowboy
cowboy / precursor-to-bbq.js
Created March 7, 2010 00:17
Old stuff here.. use jQuery BBQ instead!
// The oldest predecessor to jQuery BBQ I can find in my archives.
// http://benalman.com/projects/jquery-bbq-plugin/
// http://benalman.com/news/2010/04/cooking-bbq-the-original-recipe/
/* == QUERY STRING ==
USAGE:
var foo = QueryString();
* returns data Object from document.location.search
@cowboy
cowboy / jquery.ba-queuefn.js
Created March 12, 2010 20:59
jQuery queueFn: add a $.fn method or function onto the effects queue
/*!
* jQuery queueFn - v0.5 - 06/18/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
@cowboy
cowboy / jquery.ba-scrollable.js
Created March 13, 2010 13:55
jQuery scrollable selector
/*!
* jQuery scrollable selector - v0.1 - 03/13/2010
* http://benalman.com/
*
* Copyright (c) 2010 "Cowboy" Ben Alman
* Dual licensed under the MIT and GPL licenses.
* http://benalman.com/about/license/
*/
(function($){
(function($){
'$:nomunge'; // Used by YUI compressor.
// Use $.map instead of $.each because the arguments are reversed, allowing
// the function reference to be directly passed as the callback instead of
// requiring an anonymous wrapper function.
$.map(
// All these events will get an "outside" counterpart by default.
'blur focus click dblclick mousedown mouseup mouseover mouseout mouseenter mouseleave keydown keypress keyup'.split(' '),
function repeat(s,n){return Array(n+1).join(s);}
// usage
repeat('x', 3); // returns "xxx"