This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* Put space into string between chunks of same length */ | |
fun String.spacer(unitLength: Int = Int.MAX_VALUE, spaceCharacter: String = " "): String = chunked(unitLength).joinToString(spaceCharacter) | |
/** | |
* e.g. | |
* "123456789012345678".spacer(4) => "1234 5678 9012 3456 78" | |
* "123456789012345678".spacer(4, "@") => "1234@5678@9012@3456@78" | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# http://codepen.io/morewry/pen/pvLxPV | |
# manually create touch event | |
touchStartOn = (el, x = 0, y = 0) -> | |
try | |
e = document.createEvent('TouchEvent') | |
e.initTouchEvent("touchstart", true, true) | |
catch err | |
try | |
e = document.createEvent('UIEvent') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function b64EncodeUnicode(str) { | |
return btoa( unescape( encodeURIComponent( str ) ) ); | |
} | |
function b64DecodeUnicode(str) { | |
return decodeURIComponent( escape( atob( str ) ) ); | |
} |
Visit my blog or connect with me on Twitter
git init
or
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Content Script to save data. | |
chrome.extension.sendRequest({storage: 'foo', value: 'bar'}); | |
// Content Script to get data. | |
chrome.extension.sendRequest({storage: 'foo'}, function(response) { | |
console.log('foo => ' + response.storage); | |
}); | |
// Background Page |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="utf-8"> | |
<title>Building a router</title> | |
<script> | |
// Put John's template engine code here... | |
(function () { | |
// A hash to store our routes: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
server { | |
listen 80; | |
server_name localhost; | |
root /home/bookworm/Sites; | |
index index.php index.html index.htm; | |
try_files $uri $uri/ /index.php; | |
location ~ \.php$ { | |
fastcgi_pass 127.0.0.1:9001; |
안드로이드 개발에서 많은 비중을 차지하는 UI패턴은 ListView에서 여러 이미지를 보여주는 Activity입니다. 전형적인 흐름을 정리하면 아래와 같습니다.
1. 목록조회 API호출
2. API를 파싱하고 ListView에 데이터를 보여 줌.
3. 각 아이템마다의 이미지 주소로 다시 서버를 호출
4. 이미지를 디코딩하고 ImageView에서 보여줌.
NewerOlder