Skip to content

Instantly share code, notes, and snippets.

View TuanAnh207's full-sized avatar

Tuan Anh Nguyen TuanAnh207

  • Advanced Teaching Technology
  • Ho Chi Minh, Viet Nam
View GitHub Profile
try{
try{
throw new Exception();
}
finally{
throw new Exception();
}
}
catch(Exception e){
System.out.printf("Hello %s", "world");
@TuanAnh207
TuanAnh207 / gist:b00c3c1cc0cb358c8d24
Created February 20, 2016 09:38 — forked from tonymtz/gist:d75101d9bdf764c890ef
Uninstall nodejs from OSX Yosemite
# first:
lsbom -f -l -s -pf /var/db/receipts/org.nodejs.pkg.bom | while read f; do sudo rm /usr/local/${f}; done
sudo rm -rf /usr/local/lib/node /usr/local/lib/node_modules /var/db/receipts/org.nodejs.*
# To recap, the best way (I've found) to completely uninstall node + npm is to do the following:
# go to /usr/local/lib and delete any node and node_modules
cd /usr/local/lib
sudo rm -rf node*
Callback<Course, Observable[]> extractor = new Callback<Course, Observable[]>() {
List<Observable> properties = new ArrayList<>();
@Override
public Observable[] call(Course course) {
JavaBeanObjectProperty chapters = null;
JavaBeanObjectProperty chapterName = null;
JavaBeanStringProperty courseLabel = null;
try {
chapters = JavaBeanObjectPropertyBuilder.create().
@TuanAnh207
TuanAnh207 / screencast.sh
Created November 6, 2015 06:32 — forked from mkaito/screencast.sh
Recording a screencast with ffmpeg
ffmpeg -v info\
-f x11grab -s 1920x1064 -i :0.0+0,16\
-f pulse -i "alsa_output.pci-0000_00_1b.0.analog-stereo.monitor"\
-f pulse -i "alsa_input.usb-Sennheiser_Communication_Sennheiser_USB_headset-00-headset.analog-mono"\
-vcodec libx264 -preset ultrafast -tune zerolatency -crf 0\
-acodec pcm_s16le\
-filter_complex 'amerge, pan=2:c0=0.3*c0+3*c2:c1=0.3*c1+3*c2'\
"$rec"
import java.awt.Graphics2D;
import java.awt.image.BufferedImage;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
@TuanAnh207
TuanAnh207 / application.css
Last active September 3, 2015 19:15 — forked from james-d/application.css
Example of using Bindings (extensively) for validation in JavaFX. Maybe a basis for thinking about a validation framework.
.root {
error-color: #ffa0a0 ;
}
.text-field:validation-error {
-fx-background-color: error-color ;
}
.label.error-instructions {
-fx-text-fill: error-color ;
}
@TuanAnh207
TuanAnh207 / LanguageFilter.java
Created July 30, 2015 04:32
Determine the Locale base on Accepted-Language HTTP header
package com.ege.his.ejb.common;
import org.jboss.resteasy.spi.ResteasyProviderFactory;
import javax.annotation.Priority;
import javax.ws.rs.Priorities;
import javax.ws.rs.container.ContainerRequestContext;
import javax.ws.rs.container.ContainerRequestFilter;
import javax.ws.rs.ext.Provider;
import java.io.IOException;
@TuanAnh207
TuanAnh207 / MessageTranslator.java
Created July 30, 2015 04:30
Utility to translate message base on locale
package com.ege.his.ejb;
import com.ege.his.ejb.local.MessageTranslatorLocal;
import com.ege.his.utilities.I18nUtil;
import javax.ejb.Singleton;
import javax.ejb.Startup;
import java.util.HashMap;
import java.util.Locale;
import java.util.Map;
if (window.WebSocket) {
var destination;
$('#connect_form').submit(function () {
var url = "ws://"+$("#connect_url").val()+":61614";
login = $("#connect_login").val();
destination = $("#destination").val();
client = Stomp.client(url);