Skip to content

Instantly share code, notes, and snippets.

@jacius
jacius / smarttabs.el
Created September 18, 2009 09:13
Emacs smart tabs - indent with tabs, align with spaces!
;;
;; Emacs smart tabs functionality
;; Intelligently indent with tabs, align with spaces!
;;
;; Note: Indenting only uses tabs when indent-tabs-mode is non-nil,
;; otherwise it uses spaces as usual.
;;
;; To use: save as smarttabs.el in your .emacs.d directory, and add
;; "(require 'smarttabs)" to your .emacs file.
;;
/**
* SocketManager - Singleton to manage multi-channel socket 'routing', need a way to merge with socket.io so client sessions aren't stored twice in memory,
*
* Requires Socket.IO-node and Socket.IO client libraries.
*
* Usage:
* in your main app.js file (or whereever you create the server)
*
* var io = require('socket.io'),
* sm = require('socketmanager');
@isaacs
isaacs / node-and-npm-in-30-seconds.sh
Last active March 8, 2024 02:11
Use one of these techniques to install node and npm without having to sudo. Discussed in more detail at http://joyeur.com/2010/12/10/installing-node-and-npm/ Note: npm >=0.3 is *safer* when using sudo.
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install # ok, fine, this step probably takes more than 30 seconds...
curl https://www.npmjs.org/install.sh | sh
require.registerExtension('.js', function(js){
return js.replace(/^ *\/\/debug: */gm, '');
});
/**
* Module dependencies.
*/
var inspect = require('sys').inspect;
console.inspect = function(obj, depth){
if (!obj) return;
@tj
tj / map.js
Created February 3, 2011 17:00
/**
* Module dependencies.
*/
var express = require('express');
var app = express.createServer();
function params(req, res, next) {

Node Homework

If you do this, you are awesome.

  1. Update to node 0.4.0
  2. Go to https://github.com/ry/node/issues
  3. Pick a bug.
  4. Try to reproduce it.
  5. Comment with either:
  6. "works for me on 0.4.0"
Index: sapi/cli/config.w32
===================================================================
--- sapi/cli/config.w32 (revision 308839)
+++ sapi/cli/config.w32 (working copy)
@@ -6,7 +6,8 @@
ARG_ENABLE('cli-win32', 'Build console-less CLI version of PHP', 'no');
if (PHP_CLI == "yes") {
- SAPI('cli', 'php_cli.c', 'php.exe');
+ SAPI('cli', 'php_cli.c php_http_parser.c php_cli_server.c', 'php.exe');

Node.js 日本ユーザグループ主催の勉強会案

確定事項

  • 勉強会(Meetup)を定期的に行う
  • 3月に第1回を行う
  • 2ヶ月に一度を目処
  • 5月の勉強会はJJUG CCCと一体化
@ashtuchkin
ashtuchkin / Code excerpts.cpp
Created August 15, 2012 19:55
Node.js "Idle Notification"
// We need to notify V8 when we're idle so that it can run the garbage
// collector. The interface to this is V8::IdleNotification(). It returns
// !! "not" true if the heap hasn't be fully compacted, and needs to be run again.
// Returning false means that it doesn't have anymore work to do.
//
// A rather convoluted algorithm has been devised to determine when Node is
// idle. You'll have to figure it out for yourself.
static uv_check_t gc_check; // -> Check() Called once right after the event loop unblocks.
static uv_idle_t gc_idle; // This is called in loop when the event loop dont have anything to do (until stopped).
static uv_timer_t gc_timer; // Usual timer.