Skip to content

Instantly share code, notes, and snippets.

View deholic's full-sized avatar

Euigyom Kim deholic

View GitHub Profile
@deholic
deholic / dom_check.js
Created March 23, 2012 02:06
DOM Height Calculator
getData(function (data) {
if(!!data) {
var recursiveExecute = function (data) {
if (data.length) {
// recursive 방식으로 DOM 객체를 순차적으로 작성
getExcute(data, recursiveExecute);
}
else {
// 추가된 Image 객체들의 마지막을 구하여
// 그 마지막 Image 객체가 로드 되면 길이를 재는 방식
@deholic
deholic / linkedList.js
Created April 27, 2012 09:08
Javascript LinkedList (not tested!)
var node = function(text) {
var pointers = { _next: null };
var data = { text: null };
var _const = function() {
this.data.text = text;
};
if(!!text) _const();
return {
@deholic
deholic / gist:3774193
Created September 24, 2012 04:32
UI control in GCD Code
[NSURLConnection sendAsynchronousRequest:req
queue:[[[NSOperationQueue alloc] init] autorelease]
completionHandler:^(NSURLResponse *response,
NSData *data,
NSError *error) {
NSError* err;
NSDictionary *respJSON = [NSJSONSerialization JSONObjectWithData:data
options:NSJSONReadingMutableContainers
error:&err];
dispatch_async(dispatch_get_main_queue(), ^{
@deholic
deholic / gist:3774202
Created September 24, 2012 04:36
Using RegExp.Test()
var stringForCheck = "hello", patternRegExp = /[0-9][a-z]/;
var isCorrect = (new RegExp(stringForRegExp)).test(stringForCheck);
@deholic
deholic / gist:3774204
Created September 24, 2012 04:37
JSON parse for New line character
JSON.Parse(targetString.replace(/\n/g, "\\n"));
@deholic
deholic / meteor_twitter_auth.js
Created October 23, 2012 02:53
Prepare twitter oauth in Meteor 0.5.0
Meteor.startup(function() {
// check twitter authorize
var config = Accounts.loginServiceConfiguration.findOne({service: "twitter"});
if(!config) {
Accounts.loginServiceConfiguration.insert({
service: "twitter",
consumerKey: "YOUR_APP_CONSUMER_KEY",
secret: "YOUR_APP_CONSUMER_SECRET"
});
};
@deholic
deholic / is_not_running.sh
Created October 25, 2012 06:18
Change the Java version on Mac OS X Mountain Lion
$ cd /System/Library/Frameworks/JavaVM.framework/Versions
$ sudo ln -s CurrentJDK /System/Library/Frameworks/JavaVM.framework/Versions/1.5
$ sudo ln -s CurrentJDK /System/Library/Frameworks/JavaVM.framework/Versions/1.5.0
@deholic
deholic / TableView.m
Created November 7, 2012 07:13
use transparent background UITableView on iOS 6
table = [[UITableView alloc] initWithFrame:frame style:UITableViewStyleGrouped];
// UITableView setBackgroundColor method is deprecated!
// use setBackgroundView!
[table setBackgroundView:nil];
[table setBackgroundColor:[UIColor clearColor]];
@deholic
deholic / format_prototype.js
Created November 19, 2012 02:18
String.Format for prototype process
String.format = String.prototype.format = function() {
var i=0;
var string = (typeof(this) == "function" && !(i++)) ? arguments[0] : this;
for (; i < arguments.length; i++)
string = string.replace(/\{\d+?\}/, arguments[i]);
return string;
}
@deholic
deholic / parseInt.js
Created February 25, 2013 07:19
parseInt(), WTF?
var str = "0000008";
console.log("print : " + parseInt(str)); // print : 0 {or} print : 8
console.log("print : " + parseInt(str, 10)); // print : 8