Skip to content

Instantly share code, notes, and snippets.

Avatar
🦑
🦜 🦜 🦜 🦜

Dongsung Kim kiding

🦑
🦜 🦜 🦜 🦜
View GitHub Profile
@kiding
kiding / NoScrollOnInputFocusiOSSafari.html
Last active Aug 2, 2021
Preventing iOS Safari scrolling when focusing on input elements
View NoScrollOnInputFocusiOSSafari.html
<!--
When an input element gets focused, iOS Safari tries to put it in the center by scrolling (and zooming.)
Zooming can be easily disabled using a meta tag, but the scrolling hasn't been quite easy.
The main quirk (I think) is that iOS Safari changes viewport when scrolling; i.e., toolbars shrink.
Since the viewport _should_ change, it thinks the input _will_ move, so it _should_ scroll, always.
Even times when it doesn't need to scroll—the input is fixed, all we need is the keyboard—
the window always scrolls _up and down_ resulting in some janky animation.
However, iOS Safari doesn't scroll when the input **has opacity of 0 or is completely clipped.**
@kiding
kiding / KeepAll.playground.swift
Last active Apr 21, 2021
word-break: keep-all; but in Swift
View KeepAll.playground.swift
import UIKit
class KRLayoutManagerDelegate: NSObject, NSLayoutManagerDelegate {
func layoutManager(_ layoutManager: NSLayoutManager,
shouldBreakLineByWordBeforeCharacterAt charIndex: Int) -> Bool {
if charIndex <= 0 {
return true
}
let string = layoutManager.textStorage?.string as NSString?
@kiding
kiding / install.sh
Last active Mar 4, 2021
Heterogeneous Homebrew: Apple Silicon & Intel Rosetta 2 side-by-side
View install.sh
# Install Homebrew at /opt/homebrew (for Apple Silicon)
arch -arm64e /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Install Homebrew at /usr/local (for Intel Rosetta 2)
arch -x86_64 /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
# Add these lines to ~/.zshrc
alias za="arch -arch arm64e /bin/zsh"
alias zi="arch -arch x86_64 /bin/zsh"
if [[ $(arch) == "arm64" ]]; then
@kiding
kiding / hangulJosa.js
Created Oct 9, 2014
한글 조사 자동 선택 스크립트
View hangulJosa.js
/**
* 한글조사 - 은/는 이/가 을/를 과/와 이여/여
* @author Dongsung Don Kim <kiding@me.com>
* @license MIT
*/
// TODO: 으로/로
var hangulJosa = (function() {
var reT = /[0136-80136-8L-NRL-NRㄱ-ㅎ\uFFA1-\uFFBE\u3165-\u3186\u1100-\u115E\u11A8-\u11FF]/,
// 영일삼육칠팔 반각 전각, 대문자 알파벳 엘엠엔 반각 전각, 자음, 반각 자금, 옛자음, 조합 초성, 조합 종성
reF = /[24592459A-KO-QS-ZA-KO-QS-Zㅏ-ㅣ\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC\u3187-\u318E\u1161-\u11A7]/;
@kiding
kiding / HDRGainMap.swift
Last active Oct 31, 2020
Extracting HDR Gain Map from iOS 14.1+ (iPhone 12+) photos
View HDRGainMap.swift
import UIKit
import MobileCoreServices.UTCoreTypes
if #available(iOS 14.1, *) {
let input = Bundle.main.url(forResource: "IMG_0037", withExtension: "HEIC")!
let output = FileManager().temporaryDirectory.appendingPathComponent("IMG_0037.GAIN_MAP.BMP")
let source = CGImageSourceCreateWithURL(input as CFURL, nil)!
// urn:com:apple:photo:2020:aux:hdrgainmap
let dataInfo = CGImageSourceCopyAuxiliaryDataInfoAtIndex(source, 0, kCGImageAuxiliaryDataTypeHDRGainMap)! as Dictionary
@kiding
kiding / gist:589242021df49eb17be3
Last active Dec 3, 2019
safari-utm-stripper Bookmarklet
View gist:589242021df49eb17be3
javascript:(function()%7Bvar%20e%3Dwindow.location.href%3Bvar%20t%3De.indexOf(%22%3F%22)%3Bif(e.indexOf(%22utm_%22)%3Et)%7Bvar%20n%3De.replace(%2F(%5B%3F%26%5Dutm_(source%7Cmedium%7Cterm%7Ccampaign%7Ccontent)%3D%5B%5E%26%23%5D%2B)%2Fig%2C%22%22)%3Bif(n.charAt(t)%3D%3D%3D%22%26%22)%7Bn%3Dn.substr(0%2Ct)%2B%22%3F%22%2Bn.substr(t%2B1)%7Dif(n!%3De)%7Bhistory.replaceState(null%2Cnull%2Cn)%7D%7D%7D)();
@kiding
kiding / 2018-2019.diff
Created May 30, 2019
(2018|2019)년도 병역지정업체 선정 및 (2019|2020)년도 인원배정 고시
View 2018-2019.diff
1,4c1,4
< ◉병무청고시제2018-1호
< 2018년도 병역지정업체 선정 및 2019년도 인원배정 고시
< 2018년도 병역지정업체 선정 및 2019년도 인원배정에 대하여 다음과 같이 고시합니다.
< 2018년 5월 23일
---
> ◉병무청고시 제2019-2호
> 2019년도 병역지정업체 선정 및 2020년도 인원배정 고시
> 2019년도 병역지정업체 선정 및 2020년도 인원배정에 대하여 다음과 같이 고시합니다.
> 2019년 5월 27일
@kiding
kiding / BCM.hcd.b64
Last active May 2, 2019
BCM4356A3 Firmware (for Nintendo Switch)
View BCM.hcd.b64
TPxGAIAhAEJSQ01jZmdTAAAAADIAAAABAQQYkgAAAAMGrB8Ao1ZDAAEcQoAhAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAP4AAEz8zEKAIQBCUkNNY2ZnRAAAAACuEgAAAwMgQ1lXNDM1NkEzXzAwMS4wMDQuMDA5LjAwNjIuMDA2NAAQAQ8A1KoBALXwlLsAAAACDQAQAQ8BjBMEAI7wPL8AAAgCDQAGAQRoCw0AEAEPAhjXAADC8IC9AAAcAg0AEAEPA2zeAADC8Cu/AADGDA0AEAEPBFzUAADC8OG+AAAiAg0AEAEPBbjPAADD8JK/AADgDg0AEAEPBuDYAADD8NW7AACOEA0AEAEPB0zTAADD8AG/AABSEUz8zAqBIQANABABDwgQ7QAAwfCLugAAKgINABABDwk8FQgATvB+vgAAPAINABABDwoMuAcAVPAavQAARAINABABDwtGuAcAVPAEvQAAUgINABABDwz4vwcAVfCIuQAADBMNABABDw2kxQcAAL8q4AAAAAAAABABDw6cJgcAXfDgvQAAYAINABABDw88cQQAifCcuAAAeAINABABDxDYdwQAiPBQvQAAfAINABABDxFQegQAiPAbvAAAigINABABDxIogwQAh/C1vwAAlgINAEz8zNKBIQAQAQ8T0IMEAAC/AL8AAAAAAAAGAQSIGA0AEAEPFGxzBACK8Jy6AACoGA0AEAEPFZh1BACI8IW+AACmAg0AEAEPFuxkBACJ8OC+AACwAg0AEAEPF6hQBwBb8AS5AAC0Ag0AEAEPGORRBwBb8HG4AADKAg0AEAEPGZyQBACH8Bi5AADQAg0AEAEPGkQ+BACN8GK/AAAMHQ0AEAEPGyQ9BACM8Ni6AADYAg0AEAEPHPBBAQC88Ha4AADgAg0AEAEPHdA5AQC+8Iq7AEz8zJqCIQAA6CANABABDx7EewIAqvBVuwAAciINAAYBBOgoDQAQAQ8fJDwBAL7wZr4AAPQoDQAQAQ8gMDsBAL7wBr8AAEApDQAQ
@kiding
kiding / KakaoTalk+.js
Last active Jan 28, 2019
KakaoTalk+: No More Search Pane (macOS)
View KakaoTalk+.js
/*
Hide the annoying search pane.
$ sudo node KakaoTalk+.js
$ nohup /Applications/KakaoTalk.app/Contents/MacOS/KakaoTalk+ </dev/null >/dev/null 2>&1
*/
const { readFileSync, writeFileSync } = require('fs'),
{ execSync } = require('child_process'),
{ ok } = require('assert');
View keybase.md

Keybase proof

I hereby claim:

  • I am kiding on github.
  • I am kiding (https://keybase.io/kiding) on keybase.
  • I have a public key whose fingerprint is 5FF4 D4F4 EBD2 2970 F7DC 37AD 0631 4D81 750A 2289

To claim this, I am signing this object: