Skip to content

Instantly share code, notes, and snippets.

@cespare
cespare / log.go
Created October 31, 2012 06:51
Golang apache logging
type ApacheLogRecord struct {
http.ResponseWriter
ip string
time time.Time
method, uri, protocol string
status int
responseBytes int64
elapsedTime time.Duration
}
@leovandriel
leovandriel / gist:3786554
Created September 26, 2012 07:16
Objective-C method for composing a HTTP multipart/form-data body
// Objective-C method for composing a HTTP multipart/form-data body.
// Provide parameters and data in a NSDictionary. Outputs a NSData request body.
// License: Public Domain
// Author: Leonard van Driel, 2012
@interface MultipartExample @end
@implementation MultipartExample
+ (void)exampleUsageUploadImage
@abeluck
abeluck / concat-mp4-annexb.md
Created September 20, 2012 17:50
Concat MP4 files using AnnexB bitstream format

Concat MP4 files without transcoding to mpeg

  1. Use the h264_mp4toannexb bitstream filter to convert the mp4s (video steam only) into the AnnexB bitstream format

    ffmpeg -i input1.mp4 -vcodec copy -vbsf h264_mp4toannexb -acodec copy part1.ts
    # repeat for up to inputN
    
  2. Concat the files using cat

@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.

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

確定事項

  • 勉強会(Meetup)を定期的に行う
  • 3月に第1回を行う
  • 2ヶ月に一度を目処
  • 5月の勉強会はJJUG CCCと一体化
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 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"
@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) {
/**
* Module dependencies.
*/
var inspect = require('sys').inspect;
console.inspect = function(obj, depth){
if (!obj) return;
require.registerExtension('.js', function(js){
return js.replace(/^ *\/\/debug: */gm, '');
});