me.dt.in.th

Welcome to my blog and my playground.

I am Thai Pangsakulyanont. I put on this website various small projects, articles, and toys I made. Feel free to look around. For bigger projects, please see my website or my GitHub profile.

2015

2014

2013

  • pushnot — A Personal Push Notification Server — Nov 29, 2013

    pushnot is an open source push notification server written in Node.js. You can use it to push notifications to your Mac.

    » read more
  • The “itself” Recipe — Nov 22, 2013

    I’m tired of having to write function(x) { return x.something } again and again and again and again and again, and I’m working on a very small standalone script, so using it.js seems to be an overkill for me.

    So I came up with a simple recipe:

    function itself(code) {
      return new Function('its', 'return its' + code)
    }
    
    var its = itself
    
    » read more
  • Monkey-Patching, Overriding, and Decorating Methods in JavaScript — Nov 19, 2013

    While working on a CasperJS test suite, I wanted to make it generate another file after the test result file was generated, so I had to monkey-patch their test framework (see the section after this article for why I had to do it).

    Monkey-patching is a way to override or extend the behaviour of a method without changing its original source code. This article shows you how you can do it in a beautiful way in JavaScript.

    » read more
  • How I sent my friend to sleep — Oct 10, 2013

    Or, how I explained the expected value of a Geometric Random Variable to a friend.

    » read more on Medium
  • With Angular.js I Created a Teaching Material in 15 minutes — Sep 29, 2013

    Just as iron sharpens iron, friends sharpen the minds of each other. —Proverbs 27:17 (CEV)

    I like to teach my friends about coding stuff, usually about the web, JavaScript, Ruby, and sometimes other things. When I do, I like to find new ways to help people see what actually happened. Anyway, this post isn’t about me; it’s about Angular.js. I used it to create an array visualizer to help visualize how sorting algorithms work, within 15 minutes.

    » read more on Medium
  • Cool things you can do with it.js — Jul 6, 2013

    I just released a new small JavaScript library called it.js.

    If you’ve ever used any of these: array.map, array.filter, _.sortBy, _.all, or _.any, you’ll know that these “higher-order” functions wants you to to pass in some kind of function. Usually this function just takes an object, looks up a property or call a method, and return the result.

    This library, it.js, helps you create that function, so you can write:

    var ok = _.every(fields, It.send('validate'))
    

    Instead of

    var ok = _.every(fields, function(field) { return field.validate() })
    

    This library is a byproduct of me building another AngularJS app, the new version of Friendlist, friend list manager for Facebook.

    This article will show you what you can do with it.js. For more detailed documentation, please see the project page on GitHub!.

    » read more
  • Vim: Running Custom Shell Commands Quickly — Jun 7, 2013

    When I use Vim, sometimes when I make an edit, I want to test if it works by running some command. (Something like gcc % && ./a.out).

    So I made a simple Vim script to help:

    » read more
  • Building an AngularJS App that Synchronizes Across Clients in Realtime with Synchroscope — Jun 7, 2013

    This article tells story about my first AngularJS web app, and development of my first AngularJS library called synchroscope that lets multiple web clients to synchronize AngularJS scope variables in realtime. If you just want to see the library, please see the GitHub project.

    My Computer Engineering department has an activity to welcome first-year students every year, the Freshy Camp. I work on the registration part, so I made a web app to make the registration process quicker and more accurate.

    I think I’d go with AngularJS because I’ve never used it, and I’m wondering why everyone loves it.

    » read more
  • ttycast v0.2 Released — Feb 2, 2013

    ttycast v0.2.0 is just released. This new version is easier to use, includes server-side terminal emulation (instead of client-side), configurable terminal size, and recording support to .tty file.

    » read more
  • Node.js: When to use a StringDecoder? — Feb 2, 2013

    In Node.js, Buffers has toString() that can convert a buffer into a String with a specified encoding, and StringDecoder does the same. So, when to use StringDecoder?

    » read more

2012

2011

  • Stylus Snippet - Deopacify — Nov 29, 2011

    What it does, given a background color, an opacity, and a target color: It finds a color which when drawn on the background color with the given opacity, results in the target color.

    » read more
  • PhantomJS - Passing Variables to page.evaluate — Nov 23, 2011

    When I was making an auto form submission script, I tried to find out how to pass data from outside script to page.evaluate script. In all form submission examples that I’ve seen, they all use fixed data. As of 1.3.0, it’s still unsupported.

    So I thought I would pass it as a global variable instead.

    » read more
  • Generating a Tone on Internal PC Speaker (Linux C, C++) — Nov 23, 2011

    So I played a bit with the PC Speaker like I like to do before in an AX-11. I tried using Beep() on Windows 7, but it didn’t work, so I had to use Linux. I searched a lot on the Internet for how to make it generate a tone so I’ll post it here for future reference.

    » read more
  • My Eclipse Color Theme — Nov 18, 2011

    I just finished tweaking my Eclipse color theme.

    On code with good balance of code and documentation, it will have a mix of cool colors and warm colors. Without the comments and stuff, it will look reddish.

    » read more
  • Gzipping Responses in Node.js + Express App (Obsoleted) — Nov 10, 2011

    Not long ago while developing the #thaiWitter 3 server (Node.js + Express App), I realized that Heroku/Cedar doesn’t gzip the output, so I need to gzip them myself. I go with node-compress.

    » read more
  • Checking for SSL in Node.js App on Heroku/Cedar — Nov 2, 2011

    So in the preview of #thaiWitter 3 I’ve added Piggyback SSL to my Heroku app, and I couldn’t find a way for the app to check if it’s requested via SSL or not…

    » read more
  • thaiWitter 3 RC — Oct 27, 2011

    The newer version of thaiWitter (known as thaiWitter 3) is almost out

    » read more
  • JavaScript - Asynchronous Loops — Oct 23, 2011

    I’m been working on a little experiment that I need to process a set of images (loading it, and putting it in canvas, and then process it) sequentially.

    In JavaScript, image loading is asynchronous, so I made these utility functions that makes processing things sequentially a lot easier.

    » read more
  • How Facebook Ranks Your Friends — Oct 13, 2011

    I’m a bit tired of all those applications that tries to determine your top friends based on some factor, knowing that Facebook knows the ranking of your friend more than any other applications could know. So I created this little experiment.

    » read more
  • Hello, Rails! — Oct 12, 2011

    Hello! I am new to Ruby on Rails!

    And I’m liking it! <3

    » read more
  • #thaiWitter Scrolling Equation — Aug 28, 2011

    Since the beginning, thaiWitter has a characteristic about the way it scrolls from one place to another place. This article discusses, in mathematics style, about how it scrolls from one position to another.

    » read more

From the Old Blog