Skip to content

Instantly share code, notes, and snippets.

View DimitarChristoff's full-sized avatar

Dimitar Christoff DimitarChristoff

View GitHub Profile
@DimitarChristoff
DimitarChristoff / gist:792098
Created January 23, 2011 14:01
mootools tag info for stack overflow
![alt text][1]
[MooTools][2] is a compact, modular, Object-Oriented JavaScript framework designed for the intermediate to advanced JavaScript developer. It allows you to write powerful, flexible, and cross-browser code with its elegant, well documented, and [coherent API][3].
**HELLO WORLD EXAMPLE**
window.addEvent("domready", function() {
document.getElements("a").addEvent("click", function(event) {
alert("hello world from link with href " + this.get("href"));
});
});
@DimitarChristoff
DimitarChristoff / gist:820377
Created February 10, 2011 11:39
multiple files loading...
// extend Asset.js
Asset.javascripts = function(sources, options) {
// multiple js load
options = $merge({
onComplete: $empty,
onProgress: function() {}
}, options);
var sources = $splat(sources), counter = 0, todo = sources.length;
sources.each(function(source) {
Asset.javascript(source, {
@DimitarChristoff
DimitarChristoff / Browser.features.base64.js
Created February 10, 2011 21:21
Feature detect base64 support for images in mootools
(function() {
Browser.Features.base64 = null;
var callback = function() {
Browser.Features.base64 = this.width == 1 && this.height == 1;
// alert(Browser.Features.base64); // true || false
};
var img = new Image(), img = document.id(img) || new Element("img");
img.onload = img.onerror = img.onabort = callback;
// 1x1 px gif to test with
@DimitarChristoff
DimitarChristoff / gist:823397
Created February 12, 2011 01:48
madbid.com js
function initDOM() {
if (document.getElementById("howimg") != null) {
how_demoAuction("auto")
}
ie6_test();
if (document.getElementById("tab_bar") != null) {
var d = window.location.pathname;
var b = document.getElementById("tab_bar").getElementsByTagName("a");
switch (d) {
case "/future/":
@DimitarChristoff
DimitarChristoff / gist:827455
Created February 15, 2011 12:21
BitchX slaps.
alias slaps {
echo $G Usage: /slapx [nick]
echo $G <slap > - slaps around a bit with a substantially large Brown
Cow...
echo $G <slap2> - slaps with a 1kg unix manual....
echo $G <slap3> - slaps around a bit with a large mIRC user
echo $G i want more good slaps! email/msg them to me =)
}
alias slap {
@DimitarChristoff
DimitarChristoff / qm.pl
Created February 15, 2011 12:28
message somebody in quake.
#!/usr/bin/perl
use Socket;
my %server;
$server{'port'} = "27960";
$server{'host'} = (shift(@ARGV));
@message = @ARGV;
print "trying: $server{'host'}:$server{'port'}\n";
@DimitarChristoff
DimitarChristoff / cloneStorage.js
Created February 18, 2011 11:57
making cloning element storage in mootools possible
(function() {
var eliminateOrig = Element.prototype.eliminate;
var localStorage = {};
var get = function(uid){
return (localStorage[uid] || (localStorage[uid] = [])); // converted to an array to store keys stored
};
Element.implement({
lstore: function(property, value) {
@DimitarChristoff
DimitarChristoff / timer.js
Created March 16, 2011 13:17
mootools timer class
var timer = new Class({
options: {
pause: 0
},
Implements: [Options,Events],
initialize: function(options) {
this.setOptions(options);
this.counter = 0;
},
(function() {
document.getElements('img[src$=png]').each(function(img, i) {
var oldId = img.id;
img.setProperty("id", "old"+i);
var imgID = "id='clone" + i + "' ";
var imgClass = (img.className) ? "class='" + img.className + "' " : ""
var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
var imgStyle = "display:inline-block;" + img.style.cssText
if (img.align == "left") imgStyle = "float:left;" + imgStyle
if (img.align == "right") imgStyle = "float:right;" + imgStyle
@DimitarChristoff
DimitarChristoff / englishClass.js
Created March 23, 2011 21:22
mootools class for english people!
(function(){
var Class = this.Class = new Type('Class', function(params){
if (instanceOf(params, Function)) params = {initialize: params};
var newClass = function(){
reset(this);
if (newClass.$prototyping) return this;
this.$caller = null;
if (this.initialise)
this.initialize = this.initialise;