Skip to content

Instantly share code, notes, and snippets.

View hwshim0810's full-sized avatar

Hyunwoo Shim hwshim0810

View GitHub Profile
@hwshim0810
hwshim0810 / gist:42bbf3e163fb7ee9c7b028e21ef35813
Created March 3, 2017 12:28 — forked from ihoneymon/how-to-write-by-markdown.md
๋งˆํฌ๋‹ค์šด ์‚ฌ์šฉ๋ฒ•

[๊ณตํ†ต] ๋งˆํฌ๋‹ค์šด markdown ์ž‘์„ฑ๋ฒ•

1. ๋งˆํฌ๋‹ค์šด์— ๊ด€ํ•˜์—ฌ

1.1. ๋งˆํฌ๋‹ค์šด์ด๋ž€?

**Markdown**์€ ํ…์ŠคํŠธ ๊ธฐ๋ฐ˜์˜ ๋งˆํฌ์—…์–ธ์–ด๋กœ 2004๋…„ ์กด๊ทธ๋ฃจ๋ฒ„์— ์˜ํ•ด ๋งŒ๋“ค์–ด์กŒ์œผ๋ฉฐ ์‰ฝ๊ฒŒ ์“ฐ๊ณ  ์ฝ์„ ์ˆ˜ ์žˆ์œผ๋ฉฐ HTML๋กœ ๋ณ€ํ™˜์ด ๊ฐ€๋Šฅํ•˜๋‹ค. ํŠน์ˆ˜๊ธฐํ˜ธ์™€ ๋ฌธ์ž๋ฅผ ์ด์šฉํ•œ ๋งค์šฐ ๊ฐ„๋‹จํ•œ ๊ตฌ์กฐ์˜ ๋ฌธ๋ฒ•์„ ์‚ฌ์šฉํ•˜์—ฌ ์›น์—์„œ๋„ ๋ณด๋‹ค ๋น ๋ฅด๊ฒŒ ์ปจํ…์ธ ๋ฅผ ์ž‘์„ฑํ•˜๊ณ  ๋ณด๋‹ค ์ง๊ด€์ ์œผ๋กœ ์ธ์‹ํ•  ์ˆ˜ ์žˆ๋‹ค. ๋งˆํฌ๋‹ค์šด์ด ์ตœ๊ทผ ๊ฐ๊ด‘๋ฐ›๊ธฐ ์‹œ์ž‘ํ•œ ์ด์œ ๋Š” ๊นƒํ—™(https://github.com) ๋•๋ถ„์ด๋‹ค. ๊นƒํ—™์˜ ์ €์žฅ์†ŒRepository์— ๊ด€ํ•œ ์ •๋ณด๋ฅผ ๊ธฐ๋กํ•˜๋Š” README.md๋Š” ๊นƒํ—™์„ ์‚ฌ์šฉํ•˜๋Š” ์‚ฌ๋žŒ์ด๋ผ๋ฉด ๋ˆ„๊ตฌ๋‚˜ ๊ฐ€์žฅ ๋จผ์ € ์ ‘ํ•˜๊ฒŒ ๋˜๋Š” ๋งˆํฌ๋‹ค์šด ๋ฌธ์„œ์˜€๋‹ค. ๋งˆํฌ๋‹ค์šด์„ ํ†ตํ•ด์„œ ์„ค์น˜๋ฐฉ๋ฒ•, ์†Œ์Šค์ฝ”๋“œ ์„ค๋ช…, ์ด์Šˆ ๋“ฑ์„ ๊ฐ„๋‹จํ•˜๊ฒŒ ๊ธฐ๋กํ•˜๊ณ  ๊ฐ€๋…์„ฑ์„ ๋†’์ผ ์ˆ˜ ์žˆ๋‹ค๋Š” ๊ฐ•์ ์ด ๋ถ€๊ฐ๋˜๋ฉด์„œ ์ ์  ์—ฌ๋Ÿฌ ๊ณณ์œผ๋กœ ํผ์ ธ๊ฐ€๊ฒŒ ๋œ๋‹ค.

1.2. ๋งˆํฌ๋‹ค์šด์˜ ์žฅ-๋‹จ์ 

1.2.1. ์žฅ์ 

@hwshim0810
hwshim0810 / placeholder_hide.css
Last active April 6, 2017 13:20
if focusing input tag, hide placeholder
//Placeholder ์†์„ฑ์„ ์ˆ˜์ •ํ•จ
input:focus::-webkit-input-placeholder,
textarea:focus::-webkit-input-placeholder { /* WebKit browsers */
color:transparent;
}
input:focus:-ms-input-placeholder,
textarea:focus:-ms-input-placeholder { /* Internet Explorer 10+ */
color:transparent;
@hwshim0810
hwshim0810 / SqlDateToString.java
Created April 6, 2017 13:22
change sqldate format to string
SimpleDateFormat fmt=new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");ย 
ย ย ย ย ย 
String sDate=fmt.format(dto.getSTIME());ย 
ย ย ย ย ย 
String eDate=fmt.format(dto.getETIME());ย 
@hwshim0810
hwshim0810 / border.css
Created April 6, 2017 13:43
jekyll markdown border css
table{
border-collapse: collapse;
border-spacing: 0;
border:2px solid;
}
th{
border:2px solid #000000;
}
@hwshim0810
hwshim0810 / admin.py
Created May 31, 2017 02:27
django admin thumnail image display
def get_thumb(self):
return format_html(
'<img src="{}" height="50" />'.format(self.inpupt_path)
)
@hwshim0810
hwshim0810 / custom_tags.py
Created June 15, 2017 06:21
ํ…œํ”Œ๋ฆฟ ์ฟผ๋ฆฌ์กฐํšŒ ์˜ต์…˜๋ถˆ๊ฐ€ ํ•ด๊ฒฐ
# ํ…œํ”Œ๋ฆฟ ์ฟผ๋ฆฌ์กฐํšŒ ์˜ต์…˜๋ถˆ๊ฐ€ ํ•ด๊ฒฐ
@register.filter
def in_category(things, category):
return things.filter(category=category)
# ํ…œํ”Œ๋ฆฟ์—
{% for category in categories %}
{% for thing in things|in_category:category %}
{{ thing }
@hwshim0810
hwshim0810 / functions.py
Created September 6, 2017 00:38
Django custom csv action
def export_as_csv_action(
description="CSV ํŒŒ์ผ๋กœ ์ถœ๋ ฅ", fields=None, exclude=None, header=True, force_fields=None):
"""
CSV ์ถœ๋ ฅ์„ ํ•˜๋Š” Django Admin Action Function \n
:param description: Action ์— ํ‘œ์‹œํ•  ๋ฌธ๊ตฌ
:param fields: ์ถœ๋ ฅ ํ•  Model Field(Column)
:param exclude: ์ถœ๋ ฅ์—์„œ ์ œ์™ธํ•  Model Field
:param header: Field(Column) ์ด๋ฆ„์„ ์ฒซ๋ฒˆ์งธ ํ–‰์œผ๋กœ ์ถœ๋ ฅํ• ์ง€ ์—ฌ๋ถ€
:param force_fields: Django admin ์˜ list_display ์˜ Custom field (๋ฌธ์ž์—ด) ์„ ์‚ฌ์šฉํ•  ์ง€ ์—ฌ๋ถ€ False ์ธ ๊ฒฝ์šฐ Model ์— ์—†๋Š” ํ•„๋“œ๋Š” ์ œ์™ธํ•œ๋‹ค.
"""
@hwshim0810
hwshim0810 / box.css
Created October 4, 2017 13:18
Css change box postion
#blockContainer {
display: -webkit-box;
display: -moz-box;
display: box;
-webkit-box-orient: vertical;
-moz-box-orient: vertical;
box-orient: vertical;
}
#blockA {
-webkit-box-ordinal-group: 2;
@hwshim0810
hwshim0810 / dynamic_favicon.js
Created November 6, 2017 06:57
Dynamic favicon using javascript
(function() {
var link = document.querySelector("link[rel*='icon']") || document.createElement('link');
link.type = 'image/x-icon';
link.rel = 'shortcut icon';
link.href = 'http://www.stackoverflow.com/favicon.ico';
document.getElementsByTagName('head')[0].appendChild(link);
})();
@hwshim0810
hwshim0810 / getkeyhash.java
Created December 14, 2017 02:45
Use for SDK : KeyHash
try {
PackageInfo info = getPackageManager().getPackageInfo("myandroid.package.name", PackageManager.GET_SIGNATURES);
for (Signature signature : info.signatures) {
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(signature.toByteArray());
DebugLogger.d("==============================");
DebugLogger.d("KeyHash:" + Base64.encodeToString(md.digest(), Base64.DEFAULT));
DebugLogger.d("==============================");
}
} catch (PackageManager.NameNotFoundException e) {