Skip to content

Instantly share code, notes, and snippets.

View adhrinae's full-sized avatar
📚

Dohyung Ahn adhrinae

📚
View GitHub Profile
@adhrinae
adhrinae / gfm.css
Last active November 15, 2016 00:48
GIthub Flavoured Markdown CSS
/* GitHub stylesheet for MarkdownPad (http://markdownpad.com) */
/* RESET
=============================================================================*/
html, body, div, span, applet, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, acronym, address, big, cite, code, del, dfn, em, img, ins, kbd, q, s, samp, small, strike, strong, sub, sup, tt, var, b, u, i, center, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video {
margin: 0;
padding: 0;
border: 0;
}
@adhrinae
adhrinae / book.rb
Last active December 5, 2016 06:19
Hanami with roar - Nested JSON API implement
class Book < Hanami::Entity
def author
AuthorRepository.new.find_with_book(self)
end
def comments
CommentRepository.new.find_with_book(self)
end
end
@adhrinae
adhrinae / authentication.rb
Last active March 18, 2022 09:26
Hanami User Authentication with session
# web/controllers/authentication.rb
module Web
module Authentication
module Skip
def authenticate!
end
end
def self.included(action)
action.class_eval do
class Game
def initialize
@rounds = []
end
def set(round)
@rounds << round
end
def fastest_round
@adhrinae
adhrinae / introduce-boostnote-shortcuts.md
Last active September 21, 2017 11:05
Boostnote의 단축키를 사용하여 능률을 120% 올리는 방법
@adhrinae
adhrinae / Disqus.jsx
Created January 3, 2018 15:46
React Disqus component for GatsbyJS
// Originally implemented by David Konsumer
// https://blog.jetboystudio.com/articles/gatsby/
import React from "react";
import PropTypes from "prop-types";
// This function generates new object omitting given properties.
// Since React props now cannot be modified, I implemented this function.
// You can also use lodash#omit function.
function omit(targetObj, omitProps) {
let copiedObj = Object.assign({}, targetObj);
@adhrinae
adhrinae / setRedirect.js
Created January 16, 2018 15:04
Change frontmatter of old blog posts
const fs = require('fs');
fs.readdir('./', (err, files) => {
if (err) {
throw new Error(err);
}
const oldPosts = files.filter(file => /\.md$/.test(file));
oldPosts.forEach(post => injectRedirectTo(post));
@adhrinae
adhrinae / ts-either.ts
Created February 27, 2018 14:23
Typescript Either TryOut
class Either {
protected $value;
static of<T>(x: T) {
return new Right(x);
}
constructor(x) {
this.$value = x;
}
@adhrinae
adhrinae / adpater.ts
Last active March 12, 2018 05:18
Mastering Javascript Design Pattern Chapter 04
interface Ship {
SetRudderAngleTo(angle: number);
SetSailConfiguration(configuration: SailConfiguration);
SetSailAngle(SailId: number, sailAngle: number);
GetCurrentBearing(): number;
GetCurrentSpeedEstimate(): number;
ShiftCrewWeightTo(weightToShift: number, locationId: number);
}
interface SailConfiguration {
@adhrinae
adhrinae / functional-javascript-review.md
Last active March 14, 2018 13:39
함수형 자바스크립트 Review

함수형 자바스크립트 리뷰

Functional Javascript Cover

책 링크

일단 자바스크립트 초급자가 읽기 좋은 책은 아니다. 하지만 자바스크립트를 좀 다루면서, Redux나 RxJS 같은 라이브러리를 접해본 사람들이 '왜 이런 방식으로 코드를 작성해야하는지' 단서를 얻을 수도 있고, 더 나아가서 함수형 프로그래밍의 기본 개념을 자신에게 익숙한 자바스크립트로 익힐 수 있다.

특히 5장 때문에 이 책을 활용한 단기 스터디를 진행했는데, 확실히 팀원에게 내가 생각하는 함수 분할 및 조합에 대한 생각을 공유하고 이해시키는데 많은 도움이 되었다.