Skip to content

Instantly share code, notes, and snippets.

@hoangtranwork
hoangtranwork / gist:1289353
Created October 15, 2011 10:03
output on Opera 11
src: ddlProductCategory |eventtype: focusin |key: undefined |which: undefined
src: ddlProductCategory |eventtype: keypress |key: 40 |which: 0
src: ddlProductCategory |eventtype: change |key: undefined |which: undefined
CHANGE
src: ddlProductCategory |eventtype: keyup |key: 40 |which: 40
trigger change event from: keyup
src: ddlProductCategory |eventtype: change |key: undefined |which: undefined
CHANGE
@hoangtranwork
hoangtranwork / gist:1289354
Created October 15, 2011 10:04
output on Opera 11
src: ddlProductCategory |eventtype: focusin |key: undefined |which: undefined
src: ddlProductCategory |eventtype: keypress |key: 40 |which: 0
src: ddlProductCategory |eventtype: change |key: undefined |which: undefined
CHANGE
src: ddlProductCategory |eventtype: keyup |key: 40 |which: 40
trigger change event from: keyup
src: ddlProductCategory |eventtype: change |key: undefined |which: undefined
CHANGE
<activity android:name=".activity.IntroductionActivity" />
@hoangtranwork
hoangtranwork / mercurial.ini
Created September 18, 2012 14:40
setup 2 diff/merge tools (based on file types)
# Generated by TortoiseHg settings dialog
[diff]
git = True
[extensions]
mercurial_keyring =
[ui]
merge = sourcegeardiffmerge
@hoangtranwork
hoangtranwork / Program.cs
Created February 11, 2013 15:13
how about a public gist with gister
private static Encoding DetectEncoding(byte[] inputBytes, int offset, int len)
{
var detector = new CharsetDetector();
detector.Feed(inputBytes, offset, len);
detector.DataEnd();
string result = detector.Charset;
Encoding encoding = Encoding.UTF8;
if (!string.IsNullOrEmpty(result) && detector.Confidence <= (double) DetectionConfidence.SureAnswer)
{
@hoangtranwork
hoangtranwork / Extensions.cs
Created June 14, 2013 14:08
Helper extension method to help try get a non-null instance
public static class Extensions
{
/// <summary>
/// Try to get a non null instance of TOutput from TInput via a outputCreator func
/// </summary>
/// <typeparam name="TInput"></typeparam>
/// <typeparam name="TOutput">Type of the output param, need to have a default non-param constructor</typeparam>
/// <param name="input"></param>
/// <param name="outputCreator"></param>
/// <returns></returns>
public static IObservable<TRet> ContinueAfter<T, TRet>(this IObservable<T> observable, Func<IObservable<TRet>> selector)
{
return observable
.Materialize()
.Where(n => n.Kind == NotificationKind.OnCompleted)
.SelectMany(_ => selector());
}

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@hoangtranwork
hoangtranwork / 0_reuse_code.js
Last active August 29, 2015 14:16
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console