Skip to content

Instantly share code, notes, and snippets.

@ch7895
ch7895 / gist:47f2f76be6ed4c88c4904a7069a42a36
Created November 2, 2017 07:02
change password repository password for source tree
cd ~/Library/Application Support/SourceTree
rm {id@STauth-stash....}
re run stash
int killKthBit(int n, int k) {
return n - ( n & (int) Math.pow(2,k-1)) ;
}
@ch7895
ch7895 / A - (use Atomic)
Created March 23, 2016 11:36
스레드 동기화 예제2 - volatile, Atomic
import java.util.concurrent.atomic.AtomicInteger;
/**
* Created by chkyu on 2016-03-22.
*/
public class A {
private static AtomicInteger a ;
A(){
@ch7895
ch7895 / A
Last active March 23, 2016 11:30
스레드 동기화 예제1 - syncronized
public class A {
private static int a ;
A(){
a=15;
}
public synchronized void work(){
a--;
}
public int getA(){
@ch7895
ch7895 / chkFilePath
Created January 12, 2016 01:25
폴더체크후 없으면 생성
public static void checkFilePath(String path) {
File f_path = new File(path);
if(!f_path.exists())f_path.mkdirs();
}
@ch7895
ch7895 / resize_iframe
Last active January 7, 2016 10:36
iframe resize - js
<script type="text/javascript">
function sendSize(obj) {
obj.style.height = "auto";
contentHeight = obj.contentWindow.document.documentElement.scrollHeight;
if(contentHeight>960)
obj.style.height = contentHeight + 10 + "px";
else
obj.style.height = "960px";
}
@ch7895
ch7895 / chkInTime
Last active January 7, 2016 10:37
chkInTime - js
String sCurTime = null;
String sMinTime = "20131026233000";
String sMaxTime = "20131027181818";
String sTime = "";
sCurTime = new java.text.SimpleDateFormat("yyyyMMddHHmmss", java.util.Locale.KOREA).format(new java.util.Date());
if (sCurTime.compareTo(sMinTime) >= 0 && sCurTime.compareTo(sMaxTime) < 0) {
function1();
function2();
@ch7895
ch7895 / openPopup
Last active January 7, 2016 10:37
openPopup - javascript
function openPopup(url, height, width, mesg) {
var re = /[ \{\}\[\]\/?.,;:|\)*~`!^\-_+┼<>@\#$%&\'\"\\\(\=]/gi;
var targetName = url.replace(re, "");
if (mesg != null && mesg != "" && mesg != undefined && mesg.length > 0) {
alert(mesg);
} else {
try {
var popup = window.open('about:blank', targetName, 'directories=no, location=no, menubar=no, resizable=no, scrollbars=no, status=yes, toolbar=no, height=' + height + ', width=' + width);
popup.focus(); // http://support.microsoft.com/kb/979954