Skip to content

Instantly share code, notes, and snippets.

View starkhorn's full-sized avatar

Tharathorn Inphen starkhorn

  • Bangkok, Thailand
View GitHub Profile

Keybase proof

I hereby claim:

  • I am starkhorn on github.
  • I am tharathorn (https://keybase.io/tharathorn) on keybase.
  • I have a public key ASA95Qoc8xBtwbfGFiHDE80IZBCQrvQaStujnyaD5NYObgo

To claim this, I am signing this object:

@starkhorn
starkhorn / new_person_hash_block.coffee
Created November 4, 2012 05:25
New person with hash and block in coffeescript
class Person
constructor: (args) ->
if typeof args is "function"
args.call this
else
@[key] = val for key, val of args
about: ->
"My name is #{@name}, I am #{@age}"
@starkhorn
starkhorn / new_person_block.coffee
Created November 4, 2012 05:12
New person with function block in coffeescript
class Person
constructor: (block) ->
block.call this
about: ->
"My name is #{@name}, I am #{@age}"
me = new Person ->
this.name = "Ohm"
this.age = 25
@starkhorn
starkhorn / new_person.rb
Created November 4, 2012 05:07
New person snippet in ruby
Person.new do
self.name = "Ohm"
self.age = 25
end
@starkhorn
starkhorn / proxy-pass-thru.coffee
Created October 24, 2012 11:07
Node.js: HTTP request behind an authorized proxy
http = require "http"
proxy =
host: "xxx.xxx.xxx.xxx"
port: 8080
username: "username"
password: "password"
auth: -> "Basic " + new Buffer(@username + ":" + @password).toString("base64")
url = require("url").parse "http://search.twitter.com/search.json?q=starkhorn"
@starkhorn
starkhorn / runMocha.bat
Created October 21, 2012 05:54
Batch script used to execute test cases with Mocha framework
@echo off
set testFiles=
set command='dir /b /s test\*Test.coffee'
for /f "delims=" %%f in (%command%) do (
call :concatFiles %%f
)
goto :callMocha
:concatFiles