Skip to content

Instantly share code, notes, and snippets.

View bmeck's full-sized avatar

Bradley Farias bmeck

View GitHub Profile
<marquee style="
position: absolute;
top:0;
right:0;
display: inline-block;
text-align:center;
width: 250px;
-webkit-transform: translateX(25%) translateY(75%) rotate(45deg);
font-family: arial, sans-serif;
font-weight: bold;
diff --git a/lib/net.js b/lib/net.js
index 2349bc1..fa2557c 100644
--- a/lib/net.js
+++ b/lib/net.js
@@ -855,7 +855,7 @@ function doConnect (socket, port, host) {
};
}
-function isPort (x) { return parseInt(x) >= 0; }
+function toPort (x) { return (x = Number(x)) >= 0 ? x : false }
function compile(pattern) {
var original = pattern
var state_id = 0
var state_machine = {}
for(var i=0;i<pattern.length;i++) {
var c = pattern.charAt(i)
if(c == "\\") {
i++
c = pattern.charAt(i)
class CustomObjectWrap : ObjectWrap {
public:
static int EIO_Loop(eio_req *req)
{
int i = 0;
printf("1\n");
CustomObjectWrap* ow = (CustomObjectWrap*)(req->data);
while (i < 100 ) {
printf("%d from c++",i++);
#include <node/node.h>
#include <v8.h>
using namespace v8;
using namespace node;
class CustomObjectWrap : ObjectWrap {
public:
static int EIO_Loop(eio_req *req) {
#include <node/node.h>
#include <v8.h>
using namespace v8;
using namespace node;
class CustomObjectWrap : ObjectWrap {
public:
static int EIO_Loop(eio_req *req) {
printf("%d req->data\n",(int)req->data);
(function(){
//pistachio
//fear the stachio
function compile(source,opts) {
source = String(source)
opts = opts || {}
var template_source = ""
var matcher = /[{][{]([@])?([#])?([/])?([a-zA-Z_$]\w*|[.])([\[](-?\d+)?(..(-?\d+)?)?[\]])?[}][}]/g
var index = 0
@bmeck
bmeck / screening.js
Created September 14, 2010 20:39 — forked from rmurphey/screening.js
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
@bmeck
bmeck / screening.js
Created September 14, 2010 20:40 — forked from rmurphey/screening.js
// 1: how could you rewrite the following to make it shorter?
if (foo) {
bar.doSomething(el);
} else {
bar.doSomethingElse(el);
}
//no whitespace whole number json array parsing
function SavedStateNumberArrayParser() {
this.state = "unopened"
this.value = undefined
}
SavedStateNumberArrayParser.prototype.arr = function() {
return this.state === "error" ? undefined : this.value
}
SavedStateNumberArrayParser.prototype.reset = function() {
this.state = this.state === "closed" || typeof this.value === "undefined" ? "unopened" : "inside"