Skip to content

Instantly share code, notes, and snippets.

public static NameValueDictionary GetPostParameters(this Stream input)
{
while (!input.CanRead)
;
long Length = input.Length;
byte[] data = new byte[Length];
for (int i = 0; i < Length; i++)
{
data[i] = (byte)input.ReadByte();
}
var sys = require('sys');
setInterval(function() { sys.puts('hello world')}, 10);
//An Implementation of Enumerable.Zip for .NET 3.5 or Mono
//Taken from Stackoverflow Question 1616554
//http://stackoverflow.com/questions/1616554/create-an-enumeratordatatype-datatype-from-2-enumerables
//Originally published by Doug McClean
//Posted here in case I need it again
public static class EnumerableExtensions
{
public static IEnumerable<TResult> Zip<TFirst, TSecond, TResult>(
@kersny
kersny / New MLG Site
Created December 9, 2010 22:33
Cool features of the new site for Major League Gaming
Html5Shiv (Line 19):
<!--[if lte IE 8]><script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script><![endif]-->
BrowserCMS (Open Source Rails CMS http://browsercms.org/ https://github.com/browsermedia/browsercms Line 21)
<meta name="generator" content="BrowserCMS 3.1.0"/>
Mustache Templating for User Login (https://github.com/defunkt/mustache, https://github.com/janl/mustache.js)
Also found on Lines 676-707
Lines 110-127:
<div class="mustache">
require 'rubygems'
require 'mysql'
require 'narray'
@kersny
kersny / BasicReq.cs
Created March 11, 2011 01:12 — forked from ruel/BasicReq.cs
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net;
using System.IO;
namespace BasicReq
{
/// <summary>
@kersny
kersny / gist:984063
Created May 21, 2011 00:24
Pipe file to Socket
var fs = require('fs');
var net = require('net');
var filename = 'pagerank.js';
var server = net.createServer(function(connection) {
var stream = fs.createReadStream(filename);
stream.pipe(connection);
stream.on('end', function() {
connection.end();
@kersny
kersny / async.js
Created June 1, 2011 01:47 — forked from amaltson/async.js
Trying to figure out async in node
function testWithCallback(callback) {
process.nextTick(function() {
var result;
for (var i = 0; i < 1000000000000; i++ ) {
result += i;
}
callback(result);
});
}
@kersny
kersny / gist:1007443
Created June 4, 2011 01:30
Github Push Error
Counting objects: 104, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (83/83), done.
Writing objects: 100% (83/83), 9.16 KiB, done.
Total 83 (delta 61), reused 0 (delta 0)
remote: Push worked, but post-receive failed: Connection reset by peer
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:234:in `ensure_connected'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:114:in `process'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:183:in `logging'
remote: /data/github/current/vendor/gems/ruby/1.8/gems/redis-2.2.0/lib/redis/client.rb:113:in `process'
@kersny
kersny / websockets_fix.patch
Created June 23, 2011 17:58
Manos Patch for Websockets
diff --git a/src/Manos/Manos.Http/HttpEntity.cs b/src/Manos/Manos.Http/HttpEntity.cs
index 5230efe..8f35b52 100644
--- a/src/Manos/Manos.Http/HttpEntity.cs
+++ b/src/Manos/Manos.Http/HttpEntity.cs
@@ -64,6 +64,7 @@ namespace Manos.Http {
private IHttpBodyHandler body_handler;
private bool finished_reading;
+ private bool Upgraded;