Skip to content

Instantly share code, notes, and snippets.

@cduruk
cduruk / class.js
Created June 3, 2011 00:44
Classer
Object.prototype.hasClass = function(className) {
return this.className.indexOf(className) !== -1;
}
Object.prototype.addClass = function(className) {
if this.hasClass(className) {
return false;
}
this.className = this.className += ' ' + className;
@cduruk
cduruk / jquery.html.js
Created May 31, 2011 20:26
jQuery's HTML Function
html: function( value ) {
if ( value === undefined ) {
return this[0] && this[0].nodeType === 1 ?
this[0].innerHTML.replace(rinlinejQuery, "") :
null;
// See if we can take a shortcut and just use innerHTML
} else if ( typeof value === "string" && !rnocache.test( value ) &&
(jQuery.support.leadingWhitespace || !rleadingWhitespace.test( value )) &&
!wrapMap[ (rtagName.exec( value ) || ["", ""])[1].toLowerCase() ] ) {
@cduruk
cduruk / tigris.html
Created May 27, 2011 21:47
Tigris HTML
<html>
<head>
<meta charset="utf-8">
<title>Tigris</title>
<script src="/js/lib/prototype.s2.js" type="text/javascript" charset="utf-8"></script>
<script src="/js/application.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="/css/lib/type.css">
<link rel="stylesheet" href="/css/application.css">
</head>
<body>
if [[ "$TM_SSH_REMOTE_PATH" == "" ]]; then
exit_show_tool_tip "Missing project variable: TM_SSH_REMOTE_PATH"
fi
rsync \
-auz \
--stats \
--delete \
--exclude *.tmproj \
--exclude-from '/Users/cduruk/digg/cduruk.local/rsync-exclude.txt' \
${TM_SSH_PORT:+ --port=$TM_SSH_PORT} \
3:37:57 PM Can Duruk: flying like a g5 isn't cool
3:38:01 PM Can Duruk: you know what's cool?
3:38:06 PM Todd Eichel: like a g6
3:38:09 PM Can Duruk: like a g6
3:38:12 PM Can Duruk: like a g6
3:38:15 PM Can Duruk: na na na nah nah
floatADivOnDomLoad : function(id, parentid) {
util.doOnDomLoad( function() {
if ($(id)) document.observe('scroll', util.floatADivOnScrollHandler.bind(this,id,parentid));
// this is for the IEs
if (window.attachEvent && $(id)) window.attachEvent("onscroll", util.floatADivOnScrollHandler.bind(this,id, parentid));
});
},
//
floatADivOnScrollHandler : function(id, parentid) {
GET /l.php?u=http://www.youtube.com/watch%3Fv%3DGd5yN43TqCk%26feature%3Dplayer_embedded&h=72b0f HTTP/1.1
Host: www.facebook.com
Accept: */*
HTTP/1.1 200 OK
P3P: CP="DSP LAW"
Refresh: 1;URL=http://www.youtube.com/watch?v=Gd5yN43TqCk&feature=player_embedded
Set-Cookie: datr=qu3eTF-_mLKtmNNl43RcEI3D; expires=Mon, 12-Nov-2012 19:57:30 GMT; path=/; domain=.facebook.com
Set-Cookie: lsd=unWTB; path=/; domain=.facebook.com
Content-Type: text/html; charset=utf-8
abstract (1.0.0)
actionmailer (2.3.5, 2.2.2, 1.3.6)
actionpack (2.3.5, 2.2.2, 1.13.6)
actionwebservice (1.2.6)
activerecord (2.3.5, 2.2.2, 1.15.6)
activeresource (2.3.5, 2.2.2)
activesupport (2.3.5, 2.2.2, 1.4.4)
acts_as_ferret (0.4.4, 0.4.3)
authlogic (2.1.3)
aws-s3 (0.6.2)
git commit -am 'fix ID' && git push && DURUK_ENV=production cap deploy
var getBottomY = function () {
var getElBottomY = function (el) {
return el.getHeight() + el.cumulativeOffset()[1];
};
articleEl = articleEl || $$('#article .first')[0] || $$('#content .hentry')[0] || $$('#main .hentry')[0];
cColumnEl = cColumnEl || $$('#main .cColumn')[0] || $$('#cCol')[0] || $$('#main .cColumn')[0];
// Compensate for extra space on ads for cColumnBottomY
var articleBottomY = getElBottomY(articleEl),