Skip to content

Instantly share code, notes, and snippets.

View sergi's full-sized avatar
🎯
Focusing

Sergi Mansilla sergi

🎯
Focusing
View GitHub Profile
function Test(cfg) {
Test.superclass.constructor.apply(this, arguments);
this.initializer(cfg);
};
Y.extend(Test, Y.Base, {
initializer: function(config) {
this.addAttrs({
items: {
value: []
YUI({ debug: true,
filter: 'debug',
logInclude: { event: true, attribute: true },
timeout: 10000 }).use("node", "attribute", "dd-drag", "dd-drop", "dd-constrain", function(Y) {
Y.Node.prototype.toString = function() { … } // This works
Y.DOM.hasClass = function(node, className) { … } // This doesn't
// Here goes my own code
/**
* Converts relative UTF8 characters (C-style) to
* JavaScript friendly utf chars
**/
var str = "";
var relativeTo = 0x300;
[0x90,0x99,0xaa,0xaf,0xb9,0xca,0x7e,0x87,
0x84,0xc4,0xbe,0xad,0xb6,0x85,0xb5,0x8a,
0xc2,0xb8,0xbb,0xb3,0xbd,0xba,0xc7,0xcb,
@sergi
sergi / example.js
Created October 27, 2009 20:40 — forked from Gozala/README.md
exports.example = function(a, b) {
['This is a function foo which is supposed to do something.\n\
But the best thing is that it has nice documentation in it.\
@param {String} a first argument\
@param {String} b second argument\
@returns {String} Concatinated string literal']
return [a, b].join(" ");
};
- simple
- public over private
- personal vanity
- internet is global
- permalinks
- one important item per page
- don't break the browser
- don't wanker in technology
- a medium is not a grande
- break convention for your users
@sergi
sergi / insertNodeAtSelection.js
Created June 9, 2009 20:28
Inserts node at selection (Gecko)
insertNodeAtSelection : function(win, insertNode, _container, _pos)
{
// get current selection
var sel = this._getSelection(); var doc = this._getDoc();
// get the first range of the selection (there's almost always only
// one range)
var range = sel.getRangeAt(0);
// deselect everything