Skip to content

Instantly share code, notes, and snippets.

Sơn Trần-Nguyễn sntran

Block or report user

Report or block sntran

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile

Keybase proof

I hereby claim:

  • I am sntran on github.
  • I am sntran ( on keybase.
  • I have a public key ASBcUAzxTk-x6WlcKCjLyc8hYXHZpLpInPoBAEJ20Z9M-wo

To claim this, I am signing this object:

View main.css
html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video{margin:0;padding:0;border:0;font:inherit;font-size:100%;vertical-align:baseline;}html{line-height:1;}ol,ul{list-style:none;}table{border-collapse:collapse;border-spacing:0;}caption,th,td{text-align:left;font-weight:normal;vertical-align:middle;}q,blockquote{quotes:none;}q:before,q:after,blockquote:before,blockquote:after{content:"";content:none;}a img{border:none;}#header_features{position:relative;z-index:1;}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section,summary{display:block;}* html{font-size:93.75%;}html{font-size:15px;line-height:1.73333em;}html *{-webkit-box-sizing:borde
sntran / calendar.xsl
Created Jan 29, 2015
A Calendar in XSLT
View calendar.xsl
<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="">
<xsl:template name="calendar">
<xsl:param name="month" select="substring($page-modified-date, $date-modified-length - 7, 2)" />
<xsl:param name="year" select="substring($page-modified-date, $date-modified-length - 4, 4)" />
<!-- Default to an empty node list. -->
<xsl:param name="events" select="/.." />
<xsl:variable name="month-name">
View xmerl_demo.ex
defmodule XmlNode do
require Record
Record.defrecord :xmlAttribute, Record.extract(:xmlAttribute, from_lib: "xmerl/include/xmerl.hrl")
Record.defrecord :xmlText, Record.extract(:xmlText, from_lib: "xmerl/include/xmerl.hrl")
def from_string(xml_string, options \\ [quiet: true]) do
{doc, []} =
|> :binary.bin_to_list
|> :xmerl_scan.string(options)
sntran / physics.js
Last active Aug 29, 2015
Physics System with makr.js and p2.js
View physics.js
function Physics(bodyConfs, shapeConfs) {
this.body = bodyConfs;
this.shape = shapeConfs;
function PhysicsSystem(gravity) {;
sntran / Interesting Erlang
Created Dec 29, 2013
Interesting Erlang Repos From time to time, I came across some interesting repos when researching on Erlang. They are interesting in many ways, i.e., their purpose, their choice of libraries, and their way of handling the task.
View Interesting Erlang
# (Minimal) Perfect Hash Functions Generator (key, value) value in this code is the key counter during reading but can be any number
# implementing the MOS Algorithm II CACM92 , and Amjad M Daoud Thesis 1993 at VT;
# based on Steve Hanof implementation
# Download as
sntran / Cactus Kev's Poker Hand
Created Dec 17, 2013
Cactus Kev's Poker Hand Evaluator A while ago, I decided to take a shot at writing a poker hand evaluator in the programming language "C". There are already numerous evaluators out there, but I had an idea for an algorithm that might be faster than anything already out there. The basic concept is to write a routine that would take a five card po…
View Cactus Kev's Poker Hand

First off, any person who has studied combinatorics will know that there are C(52,5), or 2,598,960 possible unique poker hands, even more combinations than you get even from when you play slots. I realized that even though there are nearly 2.6 million unique hands, many of those hands actually have the same poker hand value. In other words, somebody holding an AJ942 flush in spades has the exact same value hand as somebody with an AJ942 flush in clubs. Even though both hands are unique, they still hold the identical value, and would therefore "tie" in poker games.

Here's another way to look at it. Suppose you were able to round up 2,598,960 of your friends on a football field, and you gave each of them one of the unique 2,598,960 poker hands to hold. You then yell in a loud voice, asking everyone to compare their hand with everybody else's hand. (This will take some time, of course :) Anyway, once they are done, you ask the person holding the best hand to step forward. Of course, four people will step forwar

sntran / poker.erl
Created Nov 26, 2013
Peter Norvig's 5-card Poker hand evaluator, ported to Erlang.
View poker.erl
%%% Peter Norvig's 5-card Poker hand evaluator, ported to Erlang.
-export([hand_rank/1, sort_hands/1, winners/1]).
%% Return a list of the ranks, sorted with higher first.
%% Hand is a list of 2-char strings, i.e. ["6H","3D","AS","TH","JC"].
card_ranks(Hand) ->
View New

Ec ido metr decilitro, iz celo semajntago via. Jh volu punktokomo ies, nk plus stil neni hop, igi in tempo renkonten komplemento. Nura nenia centimetro vir co, tc pri loka stop konsonanto, go okej' predikato por. Plena daralbajdo fi veo, povi panjo tet ok, is pli vatto komparado komplemento. Ut alial altmontaro tri, nul uj falsa nekutima.

Gv ing falsa siatempe interogativo. Mili grado monatonomo ek san, jes liternomo difiniteco substantiva as, oni pere poezio frazparto en. Tio kelke samtempe ne, nf tet vira kaŭzo, an eks liva rilativo. Ehe disde aliom gentonomo at, meze alternativa hej in, hoj ng tiuj tempopunkto memkompreneble. Pra nu hago nette, unu titolo tagnokto prepozicio ba. Ador hebrea duobla anc ha, dev bo foren grupa ometr, al ore olog geto. Ali il alio miriametro suplemento.

Hot kontraŭa malebligi ul. Dura getto infra sep ki, cent lingvonomo tutampleksa avo ve, oz plej afro ont. Hura ometr mf fin. Geedzo ipsilono bo ien. Oni krome estiel subtraho tc. Tio ne apuda subjunkcio, en multe kr

You can’t perform that action at this time.