Skip to content

Instantly share code, notes, and snippets.

View stagas's full-sized avatar
🤸

stagas stagas

🤸
View GitHub Profile
net.js:539
socket._readWatcher.set(socket.fd, true, false);
^
TypeError: Cannot call method 'set' of null
at doConnect (net.js:539:23)
at net.js:696:9
at dns.js:171:30
at IOWatcher.callback (dns.js:53:15)
@stagas
stagas / nodie.js
Created March 3, 2011 19:19
respawns app if it dies
// mit licenced
var sys = require('util')
, child_process = require('child_process')
, proc
process.title = 'nodie'
;(function respawn(app) {
console.log('Starting', app)
@stagas
stagas / twitter_unannoying.css
Created January 28, 2011 11:09
Crops web page so that tweets have their own scrollbar.
html {
height:100% !important;
}
body {
height:110% !important;
}
.main-content {
height:0 !important;
overflow-y:scroll;
}
@stagas
stagas / how-to-run-apache-and-node.js-together-the-right-way.markdown
Created December 24, 2010 14:45
How to run Apache and Node.js together (the right way)

Step 1

Get a VPS that offers 2 or more IP addresses.

Step 2

From the WHM cPanel, find the menu item Service Configuration, select Apache Configuration and then click on Reserved IPs Editor.

Step 3

- if ( (qa[s].length >= 3 && typeof hwknd.projects[item.name].description !== 'undefined' && !!~hwknd.projects[item.name].description.toLowerCase().indexOf(qa[s]) ) || ( qa[s].length >= 3 && typeof hwknd.projects[item.name].name !== 'undefined' && !!~hwknd.projects[item.name].name.toLowerCase().indexOf(qa[s]) ) || ( typeof hwknd.languages[item.name] !== 'undefined' && !!~this.searchKeys(hwknd.languages[item.name], qa[s]) ) || ( qa[s].length >= 3 && typeof hwknd.readmes[item.name] !== 'undefined' && !!~hwknd.readmes[item.name].toLowerCase().indexOf(qa[s]) ) )
select
/* Image Filetypes */
when match(1,'FFD8FFE00010'x'JFIF') then ftype = 'JPEG'
when match(1,'GIF8') then ftype = 'GIF'
when match(2,'PNG') then ftype = 'PNG'
when match(1,'0a0501'x) then ftype = 'PCX'
when match(9,'ILBM') & form then ftype = 'ILBM'
@stagas
stagas / identd.js
Created December 22, 2010 15:24
Lame Ident Daemon for IRC
#!/usr/bin/env node
//
// Lame Ident Daemon for IRC
//
// (c) 2010 George Stagakis
//
// MIT Licenced
//
@stagas
stagas / sendmail.js
Created December 21, 2010 18:53
simple sendmail for node.js
//
var net = require('net')
, config = {
type: 'text/plain'
}
exports.send = function(options, cb) {
var stream = net.createConnection(options.port, options.host)
@stagas
stagas / bitcompressors.js
Created December 18, 2010 23:16
bit compressors for everyone
// bit compressors for everyone
// by stagas
// public domain
var bitEncodeUTF8 = function(bits) {
var arr = []
while (bits.length) {
arr.push(String.fromCharCode(parseInt('1' + bits.substr(0, 15), 2)))
bits = bits.substr(15)
}
@stagas
stagas / anotherbitcompressor.js
Created December 18, 2010 20:08
another bit compressor in pure javascript
// another bit compressor
// by stagas
// public domain
var bitEncode = function(bits) {
var arr = []
while (bits.length) {
arr.push(String.fromCharCode(parseInt('1' + bits.substr(0, 15), 2)))
bits = bits.substr(15)
}