Skip to content

Instantly share code, notes, and snippets.

@wafe
wafe / VthreeModule.cs
Created January 8, 2015 01:02
Simple Nancy Module OnError Json Response Example
public abstract class VthreeModule : NancyModule
{
static ILog LOGGER;
static VthreeModule()
{
LOGGER = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType);
}
@wafe
wafe / 0_Readme.md
Last active December 28, 2020 10:25
node.js Buffer 클래스 발표 시 사용한 코드

node.js 스터디에서 Buffer 클래스에 대해 발표할 때 사용한 코드입니다.

발표 내용은 YouTube 에 올렸습니다. (YouTube 동영상 링크)

@wafe
wafe / ShuffleArray.cs
Created December 2, 2012 02:48
Shuffling Array of FileInfo
static FileInfo[] ShuffleArray (FileInfo[] src)
{
FileInfo[] result = new FileInfo[src.Length];
Random ran = new Random ();
List<KeyValuePair<int, FileInfo>> list = new List<KeyValuePair<int, FileInfo>> (src.Length);
foreach (var fi in src)
{
list.Add (new KeyValuePair<int, FileInfo> (ran.Next (), fi));
}
@wafe
wafe / gist:2000145
Created March 8, 2012 10:16
node.js uncaughtException logging using winston
var winston = require('winston'); // https://github.com/flatiron/winston
var logger = new (winston.Logger)({
transports: [
new (winston.transports.Console)(),
new (winston.transports.File)({ filename : 'winston.log', timestamp: true, /*maxsize: 2000, maxFiles: 5*/ })
]
});
process.on('uncaughtException', function (err) {