Skip to content

Instantly share code, notes, and snippets.

@wplong11
wplong11 / nice2.java
Last active May 6, 2017 07:23
nice2.java
if (!(test(test3) && test(test4) && test(test5))
return "올바른 점수가 아닙니다";
Integer score3 = Integer.parseInt(input3);
Integer score4 = Integer.parseInt(input4);
Integer score5 = Integer.parseInt(input5);
return (score3 < 40 || score4 < 40 || score5 < 40)
? "과락입니다. (점수미달)"
: (score3 + score4 + score5) / 3.0 >= 60
? "합격입니다."
@wplong11
wplong11 / i_love_mashup.html
Last active October 8, 2018 15:56
i love mashup
<html lang="ko">
<head>
<meta charset="UTF-8">
<title>Load movie list in RxJS!!</title>
</head>
<body>
<div id="app-container">
<div id="form">
//
// Javascript reduce 예제 → https://developer.mozilla.org/ko/docs/Web/JavaScript/Reference/Global_Objects/Array/Reduce
//
const array1 = [1, 2, 3, 4];
const reducer1 = (accumulator, currentValue) => {
return accumulator + currentValue;
};
// 5 + 1 + 2 + 3 + 4
@wplong11
wplong11 / swift-type-inference-quiz.md
Created July 8, 2019 07:44
스위프트 타입 추론 퀴즈

컴파일 성공

.concatMap { [weak self] in
    return self?.tryLoginMutation() ?? .empty()
}
.do(onError: { [weak self] error in
    self?.nonFatalErrorRecorder.record("Splash Failure", with: error)
})
@wplong11
wplong11 / curry-example.swift
Created May 23, 2020 03:16
curring example with swift
//
// main.swift
// Curry
//
// Created by DongHyeon Kim on 2020/05/23.
// Copyright © 2020 DongHyeonKim. All rights reserved.
//
import Foundation
@wplong11
wplong11 / react.tsx
Last active September 30, 2020 14:16
REACT TEST
import React, { useEffect, useRef } from 'react';
import { Link, useRouteMatch } from 'react-router-dom';
import styles from './SubmenuBar.module.css';
export interface IProps {}
const SubmenuBar: React.FC<IProps> = (props) => {
const { path } = useRouteMatch();
const tabs = [
{ title: '제주탐험', url: path + 'abc' },
@wplong11
wplong11 / NativeCommandBus.ts
Last active December 9, 2020 07:59
[POC] HybridApp native message channel
import { v4 as uuid } from 'uuid';
import { NativeMessageChannel, Message, MessageData } from './NativeMessageChannel';
export class NativeCommandBus {
private messageChannel: NativeMessageChannel;
private resultResolvers: { [messageId: string]: (value: any) => void } = {};
constructor(
topic: string = "*"
) {
@wplong11
wplong11 / WKWebView+customization.swift
Last active November 22, 2021 01:52
iOS 웹뷰 사용 경험 개선을 위한 확장 함수. 네이티브 앱을 쓰는 것 처럼 느껴지게 하는 함수들을 제공한다.
//
// Created by donghyeon on 2020/10/18.
//
import Foundation
import WebKit
extension WKWebView {
func disableZoom() {
let script: String = """
@wplong11
wplong11 / WebView+customization.kt
Last active November 22, 2021 01:54
Android 웹뷰 사용 경험 개선을 위한 확장 함수. 네이티브 앱을 쓰는 것 처럼 느껴지게 하는 함수들을 제공한다.
fun WebView.disableTouchCalloutAndUserSelect() {
this.evaluateJavascript("""
(function() {
const head = document.getElementsByTagName('head')[0];
const style = document.createRange().createContextualFragment(`
<style type="text/css">
*:not(input):not(textarea) {
-webkit-touch-callout: none;
-webkit-user-select: none;
}
@wplong11
wplong11 / AbstractSpliterator_Sequence.kt
Last active December 6, 2021 02:19
Java AbstractSpliterator vs Kotlin Sequence
class JsonObjectSpliterator<T>(
private val mapper: ObjectMapper,
private val inputStream: InputStream,
private val clazz: Class<T>
) : Spliterators.AbstractSpliterator<T>(Long.MAX_VALUE, NONNULL or IMMUTABLE) {
private val parser: JsonParser by lazy {
mapper.createParser(inputStream.reader(Charsets.UTF_8)).also {
check(it.nextToken() === JsonToken.START_ARRAY) { "Expected content to be an array" }
}
}