Skip to content

Instantly share code, notes, and snippets.

Avatar

Chakrit Wichian chakrit

View GitHub Profile
View gist:262250
# sending { "Connection": "close" }
# wget 0.0.0.0:8000
HELLO....
HELLO....
HELLO....
HELLO....
HELLO....
HTTP/1.1 200 OK
View fix-issue-28.patch
diff --git a/src/node_http.cc b/src/node_http.cc
index 5ccc53b..d01912b 100644
--- a/src/node_http.cc
+++ b/src/node_http.cc
@@ -277,8 +277,13 @@ HTTPConnection::on_headers_complete (http_parser *parser)
message_info->Set(version_minor_symbol,
Integer::New(connection->parser_.http_minor));
- message_info->Set(should_keep_alive_symbol,
- http_should_keep_alive(&connection->parser_) ? True() : False());
View gist:391843
import re
# http://atomboy.isa-geek.com/plone/Members/acoil/programing/double-metaphone
from metaphone import dm as double_metaphone
# get the Redis connection
from jellybean.core import redis
import models
# Words which should not be indexed
View gist:393221
function spawnLs() {
function innerSpawnLs(arg) {
// spawns ls + args, then use callback:
function() {
setTimeout(innerSpawnLs, 0, newArg);
}
}
setTimeout(innerSpawnLs, 0, firstArg);
View FluentMapRouteSyntax.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
using System.Web.Mvc;
using System.Web.Routing;
namespace MyApp
{
View redis.conf
# Redis configuration file example
# Note on units: when memory size is needed, it is possible to specifiy
# it in the usual form of 1k 5GB 4M and so forth:
#
# 1k => 1000 bytes
# 1kb => 1024 bytes
# 1m => 1000000 bytes
# 1mb => 1024*1024 bytes
# 1g => 1000000000 bytes
View appendonly.aof
*2
$6
SELECT
$1
0
*3
$3
SET
$4
test
View gist:540086
private Size shrinkSize(Size origSize)
{
const int maxWidth = 900;
const int maxHeight = 700;
const double flipRatio = (double)maxWidth / maxHeight;
if (origSize.Width < maxWidth &&
origSize.Height < maxHeight)
return origSize;
View gist:577435
import java.util.Timer;
import java.util.TimerTask;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.PointF;
import android.graphics.Rect;
import android.graphics.RectF;
import android.util.AttributeSet;
View gist:578846
//------------------------------------------------------------------------------
// <auto-generated>
// This code was generated by a tool.
// Runtime Version:2.0.50727.4952
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>
//------------------------------------------------------------------------------