Skip to content

Instantly share code, notes, and snippets.

View yblee85's full-sized avatar

Yunbo Lee yblee85

  • Toronto, Canada
View GitHub Profile
@yblee85
yblee85 / gist:11220380
Last active August 29, 2015 14:00
jQuery from 1.9 select option
html
<select id="select_id" value="">
<option value=""></option>
<option value="VALUE1">Value 1 for display</option>
<option value="VALUE2">Value 2 for display</option>
</select>
js
$("#select_id option[value=VALUE1]").prop('selected', true)
@yblee85
yblee85 / gist:11350348
Created April 27, 2014 16:56
ubuntu 12.04 add maximize minimize button on window
gsettings set org.gnome.shell.overrides button-layout ':minimize,maximize,close'
@yblee85
yblee85 / gist:11401537
Created April 29, 2014 14:11
Java Remove Column from JTable , Still You can access value
remove column from table
tableListSchedule.removeColumn(tableListSchedule.getColumnModel().getColumn(1));
@yblee85
yblee85 / gist:11401762
Created April 29, 2014 14:19
Java Jodatime set TImezone
//User Defined
DateTimeZone dtz = DateTimeZone.forID("America/New_York");
//System Default TimeZone
DateTimeZone dtzz = DateTimeZone.forID(TimeZone.getDefault().getID());
@yblee85
yblee85 / gist:906790e3f09aac2b1595
Created May 8, 2014 15:05
JAVA JTable cell color
/** GET TABLE COLUMN MODEL AND SET CELL RENDERER **/
Color LIGHT_BLUE = new Color(176, 196, 222);
EmployeeDetailScheduleTableCellRenderer cellRenderer = new EmployeeDetailScheduleTableCellRenderer(LIGHT_BLUE);
TableColumnModel tcm =tableListDetailSchedule.getColumnModel();
for(int i=2; i<=8; i++) {
TableColumn tm = tcm.getColumn(i);
tm.setCellRenderer(cellRenderer);
}
/** CREATE CELL RENDERER **/
@yblee85
yblee85 / gist:de21b9530376048ae491
Created May 8, 2014 16:10
JavaScript DateConvert AM PM to Military and Miltity to AM PM
function getDateObjectFromTimeOnlyPart(default_date, timeString) {
// default_date : date object, timeString format "11:00" or "03:00 pm"
var time = new Date(default_date);
var hhmm = undefined;
var ampm = undefined;
if(_.str.contains(timeString.toLowerCase(), "m")) {
// am/pm format ex) 04:00 am
var timeStringArray = timeString.split(" ");
hhmm = (timeStringArray[0]).split(':');
ampm = timeStringArray[1].toLowerCase();
@yblee85
yblee85 / gist:fb23b1867b0eea2f5d1a
Last active August 29, 2015 14:01
JAVA multiline label html no border
// you can set border / cellpadding and other stuffs so that this content fits JTable or JLabel
"<html><table width=\"115\"; border=\"0\"; cellpadding=\"0\"; cellspacing=\"0\"; margin-top=\"0\"; margin-bottom=\"0\"; padding=\"0\" \"><tr><td align=\"center\">" + work_hour + "</td></tr><tr><td align=\"center\"><font size=\"2\">" + startTimeAMPM + "~" + endTimeAMPM + "</font></td></tr></table></html>"
{
"analyzer": "class org.apache.lucene.analysis.standard.StandardAnalyzer",
"etag": "136aa9854e3df",
"fetch_duration": 0,
"limit": 31,
"plan": "BooleanQuery(TermQuery(desc_upc_cat_sup:koka,boost=1.0)+TermQuery(default:kola,boost=1.0)+TermQuery(locid:88c6b2ca7d76cc613907149e505c5eff,boost=1.0),boost=1.0)",
"q": "desc_upc_cat_sup:koka +default:kola +locid:88c6b2ca7d76cc613907149e505c5eff",
"rows": [],
"search_duration": 0,
"skip": 0,
@yblee85
yblee85 / gist:fe57ed6e32c8d102d365
Last active August 29, 2015 14:13
creating service in ubuntu 12.04
// origin : askubuntu.com (http://askubuntu.com/questions/351879/how-to-create-a-service-on-ubuntu-lts-12-04)
// about upstart manual : http://upstart.ubuntu.com/cookbook
Upstart scripts have to placed at /etc/init, ending with .conf.
Basically they require 2 sessions: one to indicate when to start, and another with the command to exec.
The easiest script to start with your sample is:
# myprogram.conf
@yblee85
yblee85 / gist:50da5b708b7c7470762c
Created September 17, 2015 16:20
Bootable USB from directory in Windows
//command line
diskpart
//diskpart command line
list disk
//it will show disk
// disk0, 1, 2
select disk 2
clean