Skip to content

Instantly share code, notes, and snippets.

View kciter's full-sized avatar
👀
Focusing

Sunhyoup Lee kciter

👀
Focusing
View GitHub Profile
@kciter
kciter / 싱글톤 패턴.md
Last active August 29, 2015 13:57
싱글톤 패턴 (Singleton Pattern)

싱글톤 패턴이란 단 하나의 객체로 존재해야하는 객체를 구현해야 할 때 많이 사용된다.
주로 객체의 부적절한 의존관계를 지우기 위해 많이 사용되지만 객체지향 개념을 잘 모르고 사용할 경우 오히려 더 안좋은 코드가 될 가능성이 높다.

소스는 다음과 같다. (C++로 작성됨)

#include <stdio.h>

class MyClass
{
public:
/**
* Definition for singly-linked list.
* struct ListNode {
* int val;
* ListNode *next;
* ListNode(int x) : val(x), next(NULL) {}
* };
*/
#include <map>
@kciter
kciter / gulpfile.js
Created July 29, 2016 05:22
gulp 설정
'use strict';
var gulp = require('gulp'),
gutil = require('gulp-util'),
rename = require('gulp-rename'),
glob = require('glob'),
sass = require('gulp-sass'),
cleanCSS = require('gulp-clean-css'),
babelify = require('babelify'),
browserify = require('browserify'),
@kciter
kciter / disable_friendlyTap.md
Created September 21, 2016 12:25
KCFloatingActionButton friendlyTap 해제 방법

UIWindow 기반으로 사용하는 경우

KCFABManager.defaultInstance().getButton().friendlyTap = false

UIViewController 기반으로 사용하는 경우

let fab = KCFloatingActionButton()
fab.friendlyTap = false
import gulp from 'gulp';
import sass from 'gulp-sass';
import autoprefixer from 'gulp-autoprefixer';
import sourcemaps from 'gulp-sourcemaps';
import uglify from 'gulp-uglify';
import rename from 'gulp-rename';
import cleanCSS from 'gulp-clean-css';
import browserify from 'browserify';
import babelify from 'babelify';
import source from 'vinyl-source-stream';

Folder Structure

Motivations

  • Clear feature ownership
  • Module usage predictibility (refactoring, maintainence, you know what's shared, what's not, prevents accidental regressions, avoids huge directories of not-actually-reusable modules, etc)
@kciter
kciter / FRONTEND.md
Last active September 3, 2019 08:39

프론트엔드 팁

@kciter
kciter / RxAlamofire+ObjectMapper.swift
Created August 11, 2016 02:52
RxAlamofire+ObjectMapper
import UIKit
import RxSwift
import RxAlamofire
import ObjectMapper
class Post: Mappable {
var id: Int = 0
var title: String = ""
required init?(_ map: Map) {
@kciter
kciter / 댕글링 포인터 해결방법.md
Created March 6, 2014 11:45
댕글링 포인터 해결방법

댕글링 포인터란 이미 해제된 메모리를 가리키고 있는 포인터를 뜻한다.

#include <stdio.h>
int main() {
    int *p = (int*)malloc(sizeof(int));
    free(p); // p는 댕글링 포인터
    p = 1; // 이미 해제했기 때문에 에러가 발생
}
@kciter
kciter / linked_list_fp.js
Last active August 16, 2021 03:41
함수형으로 작성한 단일 연결 리스트
const reduce = (f) => (acc, iter) => {
if (!iter) acc = (iter = acc[Symbol.iterator]()).next().value;
for (const a of iter) acc = f(acc, a);
return acc;
}
const go = (arg, ...fs) => reduce((arg, f) => f(arg))(arg, fs);
const Pair = (left, right) => (destructurePair) => destructurePair(left, right);