Skip to content

Instantly share code, notes, and snippets.

View chakrit's full-sized avatar

Chakrit Wichian chakrit

View GitHub Profile
using System;
namespace TCastr.Models
{
/// <summary>
/// An implicitly-convertible buffer that automatically converts between
/// a compact string representation and a Guid.
/// </summary>
/// <remarks>
@chakrit
chakrit / hackerspacebkk.log
Created October 25, 2010 10:30
Chat log from Skype
Monday, October 25, 2010
[2:42:05 PM ICT] chakrit.wichian: lol... ok.
[2:42:05 PM ICT] John Berns: I will ba back online later and invite some people.
[2:42:18 PM ICT] John Berns: I need a nap--still tired from this weekend!
[2:42:35 PM ICT] chakrit.wichian: actually most geeks I've talked to see English as a non-issue .... strangely but fortunately :)
[2:42:53 PM ICT] John Berns: I think for chat it's OK.
[2:43:00 PM ICT] * chakrit.wichian has changed the chat topic to "Bangkok Hackerspace: Open Innovation Environment for Everyone - (บางกอกแฮคเกอร์สเปซ"
[2:43:04 PM ICT] chakrit.wichian: i see :)
[2:43:08 PM ICT] John Berns: Most computer people can read and write english OK.
[2:43:22 PM ICT] John Berns: They can take time to read and write.
@chakrit
chakrit / program.cs
Created October 26, 2010 22:58
Some of the best features that came with LINQ that isn't related to databases.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Linq.Expressions;
namespace DummyConsole
{
internal unsafe class Program
{
@chakrit
chakrit / leak.txt
Created October 28, 2010 06:43
The VBTeam leaked information about
[Placeholder]
We're very happy to announce today the Async CTP for Visual Basic and C#.
Async CTP homepage: http://msdn.com/vstudio/async
Installer: http://go.microsoft.com/fwlink/?LinkId=203690
Async discussion forums: http://social.msdn.microsoft.com/Forums/en-US/async/threads
Asynchronous programming is something that helps make your UI more responsive, especially in applications that interact with databases or network or disk. It's also used to make ASP servers scale better.
Until now, asynchronous programming has also been prohibitively hard, "not worth the investment"-hard. But with the Async CTP we've made asynchronous programming easy enough that developers should routinely consider asynchrony for most of their applications.
info: Welcome to Nodejitsu
info: It worked if it ends with Nodejitsu ok
info: Executing command signup
prompt: username: chakrit
error: Username was already taken
prompt: username: chakritw
prompt: email: *********@chakrit.net
prompt: password:
prompt: confirm password:
error: Error running command signup
@chakrit
chakrit / gist:1170373
Created August 25, 2011 10:10
WP7 almost-work binary serializer
using System;
using System.Collections;
using System.Collections.Generic;
using System.IO;
using System.Linq;
namespace MyApp.Models.Serialization
{
// TODO: Support for circular references
@chakrit
chakrit / gist:1173031
Created August 26, 2011 09:16
Observable Xml Reader... should've been using F# :(
protected IObservable<T> OpenXmlReader<T>(string url,
Func<XmlReader, IEnumerable<T>> readerFunc)
{
var req = HttpWebRequest.Create(url);
return Observable
.FromAsyncPattern<WebResponse>(req.BeginGetResponse, req.EndGetResponse)
.Invoke()
.SelectMany(resp => Observable
.Using(() => resp, r => Observable // using (response)
.Using(() => r.GetResponseStream(), stream => Observable // using (stream)
<html>
<head>
<script type="text/javascript">
function foo() { alert("FOO"); }
function bar() { alert("BAR"); }
// UNCOMMENT CODE TO SEE EFFECT
/* var useBar = false;
foo = (function(oldFoo) {
return function() {
@chakrit
chakrit / ClusterSample.cs
Created November 9, 2011 06:39
Manual clustering sample for sider.
using System;
namespace Sider.Samples
{
public class ClusterSample : Sample
{
private IClientsPool<string>[] _pool = new[] {
new ThreadwisePool<string>(host: "10.10.10.1"),
new ThreadwisePool<string>(host: "10.10.10.2"),
class ApiController < ApplicationController
respond_to :json
class Pong < Object
attr_accessor :pong
def initialize
@pong = true
end