Skip to content

Instantly share code, notes, and snippets.

View buzzedword's full-sized avatar
:octocat:
Live and in stereo

Danny Garcia buzzedword

:octocat:
Live and in stereo
View GitHub Profile
@buzzedword
buzzedword / gist:627318
Created October 14, 2010 23:59
ASP.NET Friendly Show/Hide in jQuery
jQuery.fn.aspHide = function() {
var elem = $(this[0]);
elem.data('height', elem.height());
elem.height('0');
elem.css('visibility', 'hidden');
};
jQuery.fn.aspShow = function() {
var elem = $(this[0]);
elem.height(elem.data('height'));
@buzzedword
buzzedword / aspHide
Created October 15, 2010 00:26 — forked from skoon/aspHide
jQuery.fn.innerWrap = function() {
var a, args = arguments;
return this.each(function() {
if (!a)
a = jQuery.clean(args, this.ownerDocument);
// Clone the structure that we're using to wrap
var b = a[0].cloneNode(true),
c = b;
// Find the deepest point in the wrap structure
while ( b.firstChild )
//Gallery Thumbs
    $("div.thumbs > a").click(function (e){
        $("div.thumbs > a").removeClass("active"); //Remove any "active" class
$(this).addClass("active"); //Add "active" class to selected tab
$(".gallery_content").hide(); //Hide all tab content
        
var activeTab = $(this).attr("href"); //Find the rel attribute value to identify the active tab + content
$(activeTab).fadeIn(); //Fade in the active content
setTimeout(function () {          
Cufon.refresh();          
var fizzbang = function(){
return {
foo : function(){
alert('This is a method');
},
bar : function(){
alert('This is also a method');
}
};
}();
var checkReady = setInterval(function(){
if (document.readyState == "complete") {
document.write('Document ready');
clearInterval(checkReady);
}
}, 1);
@buzzedword
buzzedword / jQueryLint.js
Created January 10, 2011 17:19
jQuery Lint bookmarklet
javascript:(function(){(function(){var el=document.createElement('div'),b=document.getElementsByTagName('body')[0];otherlib=false,msg='';el.style.position='fixed';el.style.height='32px';el.style.width='220px';el.style.marginLeft='-110px';el.style.top='0';el.style.left='50%';el.style.padding='5px 10px 5px 10px';el.style.zIndex=1001;el.style.fontSize='12px';el.style.color='#222';el.style.backgroundColor='#f99';function getLint(url){var script=document.createElement('script');script.src=url;var head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=true;}};head.appendChild(script);}function getScript(url,success){var script=document.createElement('script');script.src=url;var head=document.getElementsByTagName('head')[0],done=false;script.onload=script.onreadystatechange=function(){if(!done&&(!this.readyState||this.readyState=='loaded'||this.readyState=='complete')){done=
@buzzedword
buzzedword / AsyncBlocks.js
Created January 11, 2011 21:52
Simple async building blocks for threading
var queueExecutionInterval = 200,
debug = function (call) {
if ("console" in window) {
console.log.apply(call);
}
},
QUEUE = [],
SECONDARY = [],
functionContainer, primaryThread = setInterval(function () { // QUEUE.push( function ) to register item for queue processing.
if (QUEUE.length > 1) {
var obj1index = obj1.length;
for (var obj2index in obj2){
obj1[obj1index] = obj2[obj2index];
obj1index++;
}
@buzzedword
buzzedword / protobull.js
Created March 18, 2011 17:02
Recommended alternative to mutable __proto__ from mozilla
Object.create2 = function(a, b) {
var res = Object.create(a);
for (var x in b) { if (b.hasOwnProperty(x)) res[x] = b[x]; }
return res;
}
var o = Object.create2(foo, { f:0, g:1, ... });
@buzzedword
buzzedword / js.rb
Created March 21, 2011 20:19
Javascript routing file using CoffeeScript in Monk
class Main
get "/js/:application.js" do
content_type "text/javascript", :charset => "UTF-8"
CoffeeScript.compile File.read("app/views/js/#{params[:application]}.coffee")
end
end