Skip to content

Instantly share code, notes, and snippets.

{
"Function":"$",
"description":"The dollar function has a dual purpose: Getting the element by its id, and making an element in Internet Explorer \"grab\" all the Element methods.",
"Syntax":"var myElement = $(el);",
"Arguments": {
"el":["The Element to be extended.", {
"object":"If the object has a toElement method, toElement will be called to get the Element.",
"string":"A string containing the id of the DOM element desired.",
"element":"The element will be extended if it is not already."
@subtleGradient
subtleGradient / README.md
Created June 21, 2009 17:53
quick jekyll blog post script

The @ROOT path in this script is set to the present working directory. My personal version is set to the full path to my jekyll _posts directory.

I have it pushing the new blog post to an origin remote in the master branch. You might want to change that to a gh-pages branch instead.

@subtleGradient
subtleGradient / document.write.moo.js
Created June 21, 2009 22:07
document.write replacement using MooTools
/*
---
source: http://gist.github.com/133677
provides: document.write
description: MooTools based document.write replacement
requires: MooTools
author: Thomas Aylott -- SubtleGradient.com
thanks: Daniel Steigerwald -- daniel.steigerwald.cz
@subtleGradient
subtleGradient / Process API.md
Created June 22, 2009 05:02
JavaScript Process API proposal

Process API

The ServerJS system api might help: https://wiki.mozilla.org/ServerJS/System

Ideally Titanium would stick as close to existing standards as much as possible.

All processes, like the current process, could have: environment, arguments, stdin, stdout & stderr.

When creating a process I'd like to be able to define a process, along with its environment and arguments. Then hook up the stdin, stdout & stderr to some sort of IO objects. If you don't define the objects yourself, they could instantiate STDIN, STDOUT & STDERR constructors which are subclasses of some kind of IO. EG:

// # -- sequential speccing
var group1 = spec.group('description');
group1.add('some description', fn);
group1.add('some other description', fn);
var group2 = spec.group('description2');
group2.add('some description', fn);
group2.add('some other description', fn);
var btn = new Element('button',{html:'Run'}).addEvent('click', Context('dynamic').handleWith('handleClick'));
Ccontext(1).addHandler('handleClick', function(){alert(1);});
Ccontext(2).addHandler('handleClick', function(){alert(2);});
Context.set(1);
Context('dynamic') === Context(1);
btn.fireEvent('click'); // alert(1)
Context.set(2);
(function(write, wrapper, slice, fragment){
document.write = function(){
var id = 'document_write' + $time().toString(36);
var html = slice.call(arguments).join('');
write.call(document, '<span id="' + id + '"></span>');
window.addEvent('domready', function(){
$A(wrapper.set('html', html).childNodes).filter(document.write.filter).each(function(node){
@subtleGradient
subtleGradient / Espresso.requests.md
Created June 25, 2009 22:22
MacRabbit Espresso Feature Requests / Sugar requests

document the selectors api

EG: :capture(name), :capture(itemizer-firstused), :has-next(), [text == $name.text] etc…

allow folding to fold only part of an itemizer

HTML tags fold the whole tag including opening and closing tags, should only fold the contents.

var Something = function(){ alert('howdy'); }
I want "Something" to show in the navigator but I want only alert('howdy'); to fold and ideally select function(){ alert('howdy'); } when clicking in the itemizer.

// SubtleHoverInspect Bookmarklet
// subtlehoverinspect.bookmarklet.js
/*
The MIT License
Copyright (c) 2009 Thomas Aylott (subtlegradient.com)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
@subtleGradient
subtleGradient / position-fixed.css
Created July 29, 2009 16:17
Make position:fixed work in IE6
/*Make position:fixed work in IE6!*/
.fixed-top /* position fixed Top */{position:fixed;bottom:auto;top:0;}
.fixed-bottom /* position fixed Bottom */{position:fixed;bottom:0;top:auto;}
.fixed-left /* position fixed Left */{position:fixed;right:auto;left:0;}
.fixed-right /* position fixed right */{position:fixed;right:0;left:auto;}
* html,* html body /* IE6 Fixed Position Jitter Fix */{background-image:url(about:blank);background-attachment:fixed;}
* html .fixed-top /* IE6 position fixed Top */{position:absolute;bottom:auto;top:expression(eval(document.documentElement.scrollTop));}
* html .fixed-right /* IE6 position fixed right */{position:absolute;right:auto;left:expression(eval(document.documentElement.scrollLeft+document.documentElement.clientWidth-this.offsetWidth)-(parseInt(this.currentStyle.marginLeft,10)||0)-(parseInt(this.currentStyle.marginRight,10)||0));}