Skip to content

Instantly share code, notes, and snippets.

View sjoonk's full-sized avatar

Sukjoon Kim sjoonk

View GitHub Profile
<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
<channel>
<title>블로터</title>
<link>http://www.bloter.net/</link>
<description>블로터 RSS 서비스 | 최신기사</description>
<pubDate>2021-03-31T13:11:12+09:00</pubDate>
<lastBuildDate>2021-03-31T13:11:12+09:00</lastBuildDate>
<copyright>Copyright © Bloter&Media Inc. All rights reserved.</copyright>
<webMaster>bloter@bloter.net</webMaster>
@sjoonk
sjoonk / ruby_sinatra_logging.md
Created August 5, 2016 15:23
ruby_Sinatra logging

2012-06-15

Sinatra 소스코드에 보면 logger는 helpers부분에서 다음과 같이 간단하게 선언되어 있다.

# Access shared logger object.
def logger
  request.logger
end

결국 Sinatra에서 logging 처리는 request.logger, 즉 rack의 logger 부분에 일임하는 것이 전부다.

## convert HTML POST data to JSON
## get the raw post data from the AWS built-in variable and give it a nicer name
#set($rawAPIData = $input.path('$'))
## first we get the number of "&" in the string, this tells us if there is more than one key value pair
#set($countAmpersands = $rawAPIData.length() - $rawAPIData.replace("&", "").length())
## if there are no "&" at all then we have only one key value pair.
## we append an ampersand to the string so that we can tokenise it the same way as multiple kv pairs.
@sjoonk
sjoonk / main.js
Created December 4, 2014 05:50
Backbone sample code in a page
// main.js
// Change Underscore's default delimiters
// 'cause ERB-style delimiters aren't my cup of tea
// http://documentcloud.github.io/underscore/#template
_.templateSettings = {
interpolate: /\{\{(.+?)\}\}/g
};
var App = (function() {
add_filter( 'validate_username', 'usefulpa_validate_username_fix' );
function usefulpa_validate_username_fix( $valid, $username ) {
if ( empty($username) ) return false;
}
add_action( 'init', 'usefulpa_add_kakao_provider_to_wsl' );
function usefulpa_add_kakao_provider_to_wsl() {
if ( function_exists ('wsl_version') ) {
global $WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG;
$WORDPRESS_SOCIAL_LOGIN_PROVIDERS_CONFIG[] = ARRAY(
"provider_id" => "Kakao",
@sjoonk
sjoonk / naver_syndication_document_sample.xml
Last active August 29, 2015 14:09
네이버 신디케이션 제대로 쓰기
<?xml version="1.0" encoding="UTF-8"?>
<feed xmlns="http://webmastertool.naver.com">
<id>
http://www.syndi-example.com/bbs/
</id>
<title>Naver Syndication Sample Document</title>
<author>
<name>webmaster</name>
<email>webmaster@donotsend.email</email>
</author>
@sjoonk
sjoonk / 0_reuse_code.js
Created November 29, 2013 05:40
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console

테스트 주도 개발로 배우는 객체 지향 설계와 실천 | 스티브 프리먼, 냇 프라이스 저 | 이대엽 역 | 인사이트 | 2013.06.20

번역이 조금 아쉬운 책입니다. 아래와 같은 번역들이 군데군데 들어있어 따라 읽기 어렵게 만드네요. 명색이 TDD 책이라는데 이런 번역이 나와서야. 그냥 코드만 따라 갈거면 모를까 내용까지 읽을 거면 차라리 원서로 읽는 게 나을 듯.

(번역서 114쪽 마지막 문단)

우리에겐 애초부터 테스트를 실행하고 테스트가 실패하는 모습을 지켜보기에 충분한 기반 구조가 있었다. 이 장의 나머지 부분에서는 테스트를 통과하게끔 만들기 전까지 기능을 한 번에 하나씩 추가하겠다. 이 기법을 처음 사용하기 시작했을 때 "일단 코드를 작성하라. 무엇을 해야 할지 알고 있지 않은가!" 라고 해서 너무 까다롭게 느껴졌을 것이다. 시간이 지나면서 그렇게 하는 데 시간이 별로 들지 않고 진행 과정이 훨씬 더 예측 가능하다는 사실을 깨달았다. 한 번에 한 측면에만 집중하면 그러한 측면을 확실히 이해하는 데 도움이 된다. 대체로 뭔가를 동작하게 만들면, 그것은 동작하는 상태로 유지된다. 해결책에 관해 논의할 필요가 없다면 많은 과정이 시간이 거의 걸리지 않는다. 그러한 단계는 구현보다 설명하는 데 더 시간이 걸린다.

아시다시피 이 문단은 저자가 테스트 주도 개발법을 익히는 과정에서 느꼈던 감정과 테스트 주도 개발의 좋은 점에 대해 얘기하고 있는 문단입니다. 개발자들이 TDD를 접할 때 흔히 갖는 선입견 중 하나, 즉 "무엇을 만들지 아는데 굳이 테스트부터 작성할 필요 없이 그냥 바로 코딩을 하면 되쟎아!" 하는 생각을 똑같이 말하고 있습니다. 이어서 저자는 실제 테스트 주도 방식으로 개발하는 것이 생각만큼 그렇게 시간을 잡아먹은 일도 아니며 또 여러 가지 좋은 점들도 있음을 말하고 있습니다. 그런데 저는 유감스럽게도 위의 번역문을 읽으면서는 도무지 그 "느낌"을 얻을 수 없었습니다.

@sjoonk
sjoonk / photo_contest.html
Created June 26, 2012 04:31
CookinFB Photo Contest Demo App
<!DOCTYPE html>
<html xmlns:fb="http://ogp.me/ns/fb#">
<head>
<meta charset="utf-8">
<title>Photo Contest</title>
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.min.js" type="text/javascript"></script>
</head>
<body>
<div id="fb-root"></div>