Skip to content

Instantly share code, notes, and snippets.

View nesterchung's full-sized avatar

Nester Chung nesterchung

View GitHub Profile
@nesterchung
nesterchung / list-img.less
Created March 13, 2012 04:09
CSS: background list style
@img-size: 10px;
@url:'list.gif';
ul {
margin:0;
padding: 0;
list-style: none;
}
@nesterchung
nesterchung / laodJs.js
Created March 22, 2012 10:08
JavavScript : Load Js with call back
//load external js
function loadJs(src, callback) {
s = document.createElement("script");
s.src = "src";
if (s.addEventListener) {
s.addEventListener("load", callback, false);
} else if (s.readyState) {
s.onreadystatechange = callback;
}
document.body.appendChild(s);
@nesterchung
nesterchung / numeng.js
Created March 22, 2012 11:29
Javascript : Regex 6 < len < 10 , [a-zA-Z0-9]
function test(str) {
return /.*{6,10}/g.test(str) && !!~str.search(/[a-zA-Z]/) && !!~str.search(/\d/) && !~str.search(/\W/);
}
@nesterchung
nesterchung / html5-jquery.html
Created April 6, 2012 08:06
HTML : JQuery Template
<!DOCTYPE HTML>
<html lang="utf-8">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css">
<title>JQuery Template</title>
</head>
<body>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
@nesterchung
nesterchung / html-prototype.html
Created April 6, 2012 08:08
HTML: Prototype.js Template
<!DOCTYPE HTML>
<html lang="en-US">
<head>
<meta charset="UTF-8">
<link rel="stylesheet" href="css/style.css">
<title>Prototype.js Template</title>
</head>
<body>
<script src="http://ajax.googleapis.com/ajax/libs/prototype/1.7.0.0/prototype.js"></script>
@nesterchung
nesterchung / ie-dectect.js
Created April 27, 2012 08:40
Javascript: Internet Explorer detection.
// Internet Explorer detection.
function IE(version) {
var b = document.createElement('b');
b.innerHTML = '<!--[if IE ' + version + ']><br><![endif]-->';
return !!b.getElementsByTagName('br').length;
}
//Example
var IE6 = IE(6);
var IE7 = IE(7);
@nesterchung
nesterchung / gist:2774059
Created May 23, 2012 09:06
Applescript: safari open with Chrome
tell application "Safari"
set u to the URL of the current tab of the first window
end tell
tell application "Google Chrome"
open location u
activate
end tell
@nesterchung
nesterchung / inlineblock.css
Created October 26, 2012 08:05
cross browser inline block
.thirdDiv {
   width:50%;
   display:inline-block;
   display: -moz-inline-stack;  /*Firefox 2*/
   zoom: 1; /* IE hack to trigger **hasLayout** */
   line-height:30px;
   _height:30px;/* IE 6 Height */
   *display: inline; /* IE hack to achieve inline-block behavior */
   /* from http://blog.mozilla.org/webdev/2009/02/20/cross-browser-inline-block/ */
}
# editorconfig.org
root = true
[*]
indent_style = tab
indent_size = 4
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true
@nesterchung
nesterchung / Solution.java
Last active April 25, 2016 09:56
roman to int
public class Solution {
private static final String seq = "IVXLCDM";
public int romanToInt(String s) {
if (null == s || s.length() == 0) {
return 0;
}