Skip to content

Instantly share code, notes, and snippets.

View stargt's full-sized avatar
🐔
Fried chicken

stargt stargt

🐔
Fried chicken
View GitHub Profile
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;
@stargt
stargt / Volley.md
Created November 10, 2013 05:24 — forked from benelog/Volley.md

안드로이드 개발에서 많은 비중을 차지하는 UI패턴은 ListView에서 여러 이미지를 보여주는 Activity입니다. 전형적인 흐름을 정리하면 아래와 같습니다.

​1. 목록조회 API호출

​2. API를 파싱하고 ListView에 데이터를 보여 줌.

​3. 각 아이템마다의 이미지 주소로 다시 서버를 호출

​4. 이미지를 디코딩하고 ImageView에서 보여줌.

@stargt
stargt / router.html
Created April 30, 2016 14:02 — forked from joakimbeng/router.html
A really simple Javascript router
<!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:

Moving from jQuery

Events

// jQuery
$(document).ready(function() {
  // code
})
@stargt
stargt / gist:edaeaf2f3d2479df40d0c483ce9a7b7f
Created November 9, 2016 14:13 — forked from mohamedmansour/gist:803631
Get and Set localStorage from Content Script
// 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
function b64EncodeUnicode(str) {
return btoa( unescape( encodeURIComponent( str ) ) );
}
function b64DecodeUnicode(str) {
return decodeURIComponent( escape( atob( str ) ) );
}
@stargt
stargt / dispatch-touch-event.coffee
Created June 4, 2018 05:14 — forked from morewry/dispatch-touch-event.coffee
Programmatically trigger touch event
# 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')
@stargt
stargt / string.spacer.kt
Created March 28, 2019 13:09
string.spacer.kt
/* 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"
*/