Skip to content

Instantly share code, notes, and snippets.

View sergi's full-sized avatar
🎯
Focusing

Sergi Mansilla sergi

🎯
Focusing
View GitHub Profile
@sergi
sergi / test1.js
Created September 7, 2011 14:23
Test Async Queue + Streams
S = require("./support/jsftp/support/streamer/core");
function queue() {
var next;
var buffer = Array.prototype.slice.call(arguments)
function stream($, stop) { next = $; stream._update() }
stream._update = function _update() {
buffer.push.apply(buffer, arguments)
var pasv, pasvReqs;
pasvReqs = function(next, stop) {
pasv = next;
};
pasvReqs(self.processPasv, function(err) { console.log(err) });
var processPasv = function(pasvData) {
console.log("PASVDATA", pasvData);
browser.loadJsSelector = function() {
return browser.addLocationStrategy("js", function(locator, inWindow, inDocument) {
var found;
try {
found = eval(locator);
} catch (e) {}
if (found)
return found;
else
@sergi
sergi / config.log
Created March 25, 2011 12:43
Homebrew couchdb installation failed
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
It was created by Apache CouchDB configure 1.0.2, which was
generated by GNU Autoconf 2.61. Invocation command line was
$ ./configure --prefix=/usr/local/Cellar/couchdb/1.0.2 --localstatedir=/usr/local/var --sysconfdir=/usr/local/etc --with-erlang=/usr/local/lib/erlang/usr/include --with-js-include=/usr/local/include --with-js-lib=/usr/local/lib
## --------- ##
## Platform. ##
@sergi
sergi / jasy_test.js
Created January 8, 2011 23:23
This test causes an (incorrect) syntax error
var Test = function(){}
Test.prototype = {
get foo() {
return 0;
},
set foo(val) {
return val;
},
}
@sergi
sergi / gist:647065
Created October 26, 2010 15:06
YUI Module example
YUI.add("module1", function(Y) {
// Module code here
}, "0.0.1", { requires: ["module2"] });
@sergi
sergi / gist:647062
Created October 26, 2010 15:05
YUI Loader example
YUI({
debug: true,
groups: {
app: {
combine: false,
base: "src/",
modules: {
module1: {
path: "module1.js",
requires: ["module2"]
/*
AST tree generated from parsing the following Design By Numbers program:
paper 30
repeat A 0 300
{
pen 50
line 0 55 100 55
var Class1 = function() {
Class1.superclass.constructor.call(this, config);
}
Class1.NAME = "class1";
Class1.ATTRS = {
//Several Attributes here
}
Y.extend(Class1, Y.Base, {
@sergi
sergi / hex2rgb.js
Created March 16, 2010 16:20
Converts hexadecimal colors to RGB color tuples
var hex2rgb = function(color) {
var r = color.match(/^#(([0-9a-f]{2})([0-9a-f]{2})([0-9a-f]{2}))$/i);
if (!r) return [0, 0, 0, 255];
return [parseInt(r[2], 16),
parseInt(r[3], 16),
parseInt(r[4], 16), 255];
}