Skip to content

Instantly share code, notes, and snippets.

View rhiokim's full-sized avatar
:octocat:
I'm focusing on somewhere.

Rhio Kim rhiokim

:octocat:
I'm focusing on somewhere.
View GitHub Profile
@rhiokim
rhiokim / scraper.js
Created December 25, 2011 04:42 — forked from karmadude/scraper.js
Web Scraping with Node
// https://github.com/tmpvar/jsdom
// npm install jsdom
var jsdom = require('jsdom');
function scrapeDribbble (url, page) {
dribbbles[page-1] = [];
if (page > 1) {
url = dribbbleURL + '/shots?page=' + page;
}
@rhiokim
rhiokim / gist:1575430
Created January 7, 2012 17:43 — forked from bnoordhuis/gist:702695
node.js + sendfile = file serving++
http = require('http');
fs = require('fs');
fd = fs.openSync(__filename, 'r');
size = fs.fstatSync(fd).size;
server = http.createServer(function(req, res) {
res.writeHead(200, {
'Content-Length': size,
'Content-Type': 'text/plain'
@rhiokim
rhiokim / .gitignore
Created January 20, 2012 14:42 — forked from karmi/.gitignore
`tail -f` in Node.js and WebSockets
.DS_Store
*.log
tmp/
@rhiokim
rhiokim / gist:1677119
Created January 25, 2012 16:37 — forked from evantahler/gist:1574158
Build Node on Phidget (ARMv4tl + emdebian)

For more information, you can read a related blog post on this topic

Install Node.js on an ARMv4tl Phidget Board (SBC2)

What is a Phidget SBC2?

Node is awesome, Phidgets are awesome. Syngergy. All I wanted to do was tweet the temperature of my house automatically…

What you will need:

  • A computer (or a virtual machine) running a full version of the Debian operating system
@rhiokim
rhiokim / linux-node-joystick.js
Created January 30, 2012 01:24 — forked from creationix/linux-node-joystick.js
Basic Linux Joystick support.
var FS = require('fs');
var EventEmitter = require('events').EventEmitter;
// http://www.mjmwired.net/kernel/Documentation/input/joystick-api.txt
function parse(buffer) {
var event = {
time: buffer.readUInt32LE(0),
number: buffer[7],
value: buffer.readInt16LE(4)
}
@rhiokim
rhiokim / gist:1734064
Created February 4, 2012 00:38 — forked from mattbornski/gist:1730918
Streamlining node-inspector on Mac OS X (Debugging, NodeJS, Node Inspector, Javascript, Mac)
#!/bin/bash
_TCP_PORT=`jot -r 1 10000 65000`
while :
do
# Check to see if this port is allocated
lsof -i 4TCP:$_TCP_PORT || break
_TCP_PORT=`jot -r 1 10000 65000`
done
node-inspector --web-port=$_TCP_PORT &
@rhiokim
rhiokim / gist:1808204
Created February 12, 2012 12:06 — forked from novi/gist:1805373
Node.js 開発環境 基礎

Node.js 開発環境 基礎

Node.jsのインストール

OS X ならHomebrewまたはMacportsで。

[~] $ brew install node
[~] # port install node

nodeコマンドでnodeのインタプリタを起動。

@rhiokim
rhiokim / mouse.js
Created March 14, 2012 05:08 — forked from bfncs/mouse.js
Read Linux mouse(s) in node.js
/**
* Read Linux mouse(s) in node.js
* Author: Marc Loehe (marcloehe@gmail.com)
*
* Adapted from Tim Caswell's nice solution to read a linux joystick
* http://nodebits.org/linux-joystick
* https://github.com/nodebits/linux-joystick
*/
var fs = require('fs'),
@rhiokim
rhiokim / portable-node.md
Created May 27, 2012 13:38 — forked from domenic/portable-node.md
Tips for Writing Portable Node.js Code

Tips for Writing Portable Node.js Code

(This is the kind of thing I should put on my hypothetical blog.)

I'm a Node.js user... on Windows. (Gasp!) And here are some of the issues I face every day:

Easy to Fix

In order of most-violated to least-violated:

@rhiokim
rhiokim / gist:3052158
Created July 5, 2012 07:55 — forked from othiym23/gist:3050224
Getting SmartOS working under vmware

If you prefer VirtualBox or aren't running OS X, here are some instructions and a script to help you get started with SmartOS under VirtualBox. If you use VirtualBox, skip the first section and read the section on how to get the Node.js SmartMachine up and running.

Running SmartOS under vmware Fusion

  1. Start by downloading the latest live image
  2. When you run the new VM wizard, select "Continue without disk" on the first screen of the wizard.
  3. Select Sun Solaris / Solaris 10 64-bit on the next screen.
  4. You're going to get dumped to a config screen when the live image starts up, choose DHCP for the networking and defaults for everything else.
  5. Pretty much the first thing you're going to want to do is figure out how to SSH into the box once it boots and creates its storage pools, because trying to do stuff in the virtual console is miserable. There's no cut and paste