Skip to content

Instantly share code, notes, and snippets.

// Using XUI FX - Tween
x$('#add').click(function(){
// This fails, blue fires before red is finished
x$('#baz').tween({ background:'red' }).tween({ background:'blue'});
// This also doesn't work as expected.
x$('#baz').tween([{ background:'red' },{ background:'blue'}]);
});
system.use("com.joyent.Sammy");
function resources( name , options) {
// var db = new DebugConsole();
// system.console.log(db.processMessage(this.name));
name = name.toLowerCase();
// prototype
new Ajax.Request("/your/mom", onSuccess: function(response) { $("lightbox_content").innerHTML = response.responseJSON.contents })
// jquery
$.getJSON("/your/mom", function(json) { $("#lightbox_content").html(json.contents) })
// XUI
x$(window).xhrjson( "/your/mom", {map:{'contents':'#lightbox_content'} });
Repeat = {};
Repeat.__noSuchMethod__ = function __noSuchMethod__ (id, args) {
var numTimes = /x([0-9]+)/.exec(id);
if (numTimes != null) {
for (var i = 0;i < numTimes[1]; i++) {
if (typeof args[0] == 'function') {
args[0]();
} else {
system.console.log(args[0]);
}
var sys = require('sys');
var posix = require('posix');
var ini = {'global':{}};
var parseINI = function(d) {
var section = 'global';
var lines = d.split('\n');
// module.js
// This loader is derived from nodes loader. :)
// Fixme: path is always absolute ie requre('/math');
// Fixme: bug in loading order, and dependency support is weak
// Fixme: using a modified version of filesystem.get to look in the code directory.
// - SNIP From: /Applications/Smart.app/Contents/Resources/Image/lib/perl5/site_perl/5.10.0/RSP/Extension/Filesystem.pm
/**
- in
return {
'filesystem' => {
Module.prototype.load = function (filename) {
var self = this;
this.filename = filename;
function require (url) {
return loadModule(url, self);
}
var x = system.filesystem.get(this.filename);
system.use("info.webtoolkit.Base64");
var username = "admin";
var password = "password";
var auth = "Basic " + Base64.encode(username + ":"+ password);
checkAuth = function() {
if (!this.request.headers.hasOwnProperty('Authorization') || (this.request.headers.hasOwnProperty('Authorization') && (auth != this.request.headers['Authorization']))) {
this.response.headers['WWW-Authenticate'] = 'Basic realm="SmartAPI"';
this.response.code = 401;
this.response.body = "Not Authorized\n";
// Using JavaScript (node.js) to Read Variable Length Quantity
// See - http://en.wikipedia.org/wiki/Variable-length_quantity for more information
Utils = {}
Utils.arrayToHex = function(ar) {
for (var i=0;i<ar.length;i++) {
ar[i] = (ar[i].toString(16) == 0) ? "00" : ar[i].toString(16);
}
return "0x" + ar.join('');
}
UC 1
<p id="test">A simple <b>test</b> string.</p>
A simple <b>test</b> string.
UC 2
<p>This is a test file</p>
This is a test file
Looping 1
<li>Item 1</li>