Skip to content

Instantly share code, notes, and snippets.

@seoh
seoh / wtf.js
Created August 26, 2015 04:13
kinds of chaining-indentation
/**
* so many type of chaining
*/
//// about dot-indentation.
// type 1-1. align with dot.
const ret = obj.method1()
.method2()
.method3()
.value();
@seoh
seoh / http.swift
Created July 6, 2014 10:16
SwimpleServer
#!/usr/bin/env xcrun --sdk macosx10.10 swift -i
import Foundation
println("Usage: \n\t\t\(NSURL(string:__FILE__).lastPathComponent) -- [options]")
// #TODO options
var opt = Dictionary<String, String>()
for arg in Process.arguments {
let array = arg.componentsSeparatedByString("=")
let key: String? = array[0]
@seoh
seoh / README.md
Last active August 29, 2015 14:03
Butcher protocol for head/tail of Array

butcher.swift

head/tail implementation using protocol

butcher.python.swift

another implementation inspired from python

@seoh
seoh / withExtendedLifetime.swift
Created August 5, 2014 11:59
withExtendedLifetime
/**
/// f가 리턴하기 전에 `x`가 사라지지 않았을 때만 `f(x)`를 평가하고 결과를 반환한다.
func withExtendedLifetime<T, Result>(x: T, f: (T) -> Result) -> Result
func withExtendedLifetime<T, Result>(x: T, f: () -> Result) -> Result
**/
func getClosure() -> ()->() {
@seoh
seoh / CSSSelector.swift
Created September 23, 2014 17:20
Swift Comparison and String Literal
// http://nshipster.com/swift-comparison-protocols/
import Foundation
struct CSSSelector {
let selector: String
struct Specificity {
let id: Int
let `class`: Int
@seoh
seoh / Package Control.sublime-settings
Last active August 29, 2015 14:11
Sublime Text Preferences
{
"installed_packages":
[
"AutoFileName", // 열려있는 디렉토리 기준으로 리소스의 경로 자동 완성
"Better CoffeeScript", // CoffeeScript 추가 Snippet들
"DashDoc", // Dash의 Snippet 연동
"Diffy", // 2 Column으로 파일을 열면 비교
"DocBlockr", // Doxygen 스타일 등의 주석 포맷 자동생성
"Emmet",
"FixMyJS", // 뭔가 구림. 잘 안씀.
@seoh
seoh / beholders.js
Created January 6, 2015 11:19
Find Beholders in Twitter
// Expand all of followers and execute in console.
// [followers](https://twitter.com/followers)
var users = [].slice.call(document.querySelectorAll("div[data-test-selector=ProfileTimelineUser]"));
users.filter(function(user){
return !user.querySelector("span.Icon--protected");
}).map(function(user){
user.parentNode.removeChild(user);
});
@seoh
seoh / unicode_name.js
Created June 23, 2015 12:35
get name of unicode symbol
function code(name) {
return "0x" + name.charCodeAt(0).toString(16);
}
window.open("http://unicode.org/cldr/utility/character.jsp?a=00" + code(prompt()));

Keybase proof

I hereby claim:

  • I am seoh on github.
  • I am seoh (https://keybase.io/seoh) on keybase.
  • I have a public key whose fingerprint is 3F6B 402B C421 9BD0 D5AE 3C27 8DFA C8F5 E0E6 BA93

To claim this, I am signing this object:

@seoh
seoh / mole1.js
Last active August 29, 2015 14:26
Simple Monadic Parser using JavaScript
// https://www.cs.nott.ac.uk/~gmh/monparsing.pdf
//
// type Parser[T] = String -> [(T, String)]
//
/** lookahead token
*
* Parser -> Parser