Skip to content

Instantly share code, notes, and snippets.

View tuphamphuong's full-sized avatar
🎯
Focusing

Tu Pham (Tony) tuphamphuong

🎯
Focusing
View GitHub Profile
@tuphamphuong
tuphamphuong / CheckNull.java
Last active October 21, 2015 15:59
Another way to check null in Java
public boolean equals(Object o){
if (!(o instanceof MyObject))
return false;
...
}
@tuphamphuong
tuphamphuong / AkkaScheduler.java
Last active October 21, 2015 16:00
Simple Akka scheduler by new thread
Akka.system().scheduler().schedule(
Duration.create(0, TimeUnit.MILLISECONDS),
Duration.create(5, TimeUnit.MILLISECONDS), //Frequency 5 minutes
new Runnable() {
public void run() {
Logger.debug("Run from Akka scheduler");
}
},
Akka.system().dispatcher()
);
@tuphamphuong
tuphamphuong / fabfile.py
Created July 22, 2015 08:08
A sample of complete fabric deploy file
from config import config
__author__ = 'Tu Pham Phuong'
__create_date__ = '4/24/15'
from fabric.api import *
deploy_dir = '/home/tupp/code/api'
def development():
@tuphamphuong
tuphamphuong / InMemoryCache.java
Last active October 21, 2015 16:00
In Memory Cache in Java
import org.apache.commons.collections.MapIterator;
import org.apache.commons.collections.map.LRUMap;
import java.util.ArrayList;
/**
* Created by Tu Pham Phuong - [email protected] on 6/30/15.
*/
public class InMemoryCache<K, T> {