Skip to content

Instantly share code, notes, and snippets.

@choco0908
choco0908 / PreventScreenCapture.swift
Created October 18, 2023 06:51
Prevent iOS Screen Capture
@available(iOS 13.0, *)
func makeSecure(window: UIWindow) {
DispatchQueue.main.async {
print("make window secure")
let field = UITextField()
field.isSecureTextEntry = true
window.addSubview(field)
window.layer.superlayer?.addSublayer(field.layer)
field.layer.sublayers?.last?.addSublayer(window.layer)
@choco0908
choco0908 / TestProject.swift
Created July 7, 2022 12:35
swift 주석 작성 테스트
//
// TestClass.swift
// TestProject
//
// Created by hgkwon on 2022/07/07.
//
import Foundation
/**
@choco0908
choco0908 / KeyboardHeightViewController.m
Last active May 24, 2021 03:44
Calculate UIKeyboard Height
@property CGFloat keyboardHeight;
- (void)viewDidLoad {
[super viewDidLoad];
_keyboardHeight = 0;
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillChange:)
name:UIKeyboardWillChangeFrameNotification
object:nil];
}
@choco0908
choco0908 / KeyboardLoadedViewController.m
Last active May 24, 2021 03:45
Is UIKeyboard Loaded
@property BOOL isKeyboardLoaded;
- (void)viewDidLoad {
[super viewDidLoad];
[[NSNotificationCenter defaultCenter] addObserver:self
selector:@selector(keyboardWillChange:)
name:UIKeyboardWillChangeFrameNotification
object:nil];
}
@choco0908
choco0908 / NSAttributedString+Extension.h
Created May 24, 2021 03:24
NSAttributedString_Extension
#ifndef NSAttributedString_Extension_h
#define NSAttributedString_Extension_h
NS_ASSUME_NONNULL_BEGIN
@interface NSAttributedString (Extension)
+ (NSAttributedString *)stringWithFormat:(NSAttributedString *)format, ... NS_REQUIRES_NIL_TERMINATION;
@end
NS_ASSUME_NONNULL_END
@choco0908
choco0908 / combineImage.py
Last active May 20, 2020 13:30
파이썬 코드로 웹툰형 이미지 만들기 ( Combining images to vertical using python )
import glob
import os
from PIL import Image
def combineImage(full_width,full_height,image_key,image_list,index):
canvas = Image.new('RGB', (full_width, full_height), 'white')
output_height = 0
for im in image_list:
@choco0908
choco0908 / getPosition.js
Last active May 19, 2020 08:53
To get world potions of geolocation using aframe-ar-nft.js (https://github.com/AR-js-org/AR.js)
function getPosition(point){
// point is geolocation, point = {latitude:'123.xx',longitude:'37.xx'}
const camera = document.querySelector('[gps-camera]').components['gps-camera'];
let position = { x: 0, y: 0, z: 0 };
// update position.x
let dstCoords = {
longitude: point.longitude,
latitude: camera.currentCoords.latitude,
};
@choco0908
choco0908 / I'm an early 🐤
Last active October 29, 2020 00:43
Github Daily Coding Time
🌞 Morning 82 commits ███████▍░░░░░░░░░░░░░ 35.7%
🌆 Daytime 41 commits ███▋░░░░░░░░░░░░░░░░░ 17.8%
🌃 Evening 2 commits ▏░░░░░░░░░░░░░░░░░░░░ 0.9%
🌙 Night 105 commits █████████▌░░░░░░░░░░░ 45.7%
@choco0908
choco0908 / locationCtrl.js
Created January 7, 2020 02:38
현재 내 위치 참조하기 코드
function getLocation() {
if (navigator.geolocation) { // GPS를 지원하면
navigator.geolocation.getCurrentPosition(function(position) {
alert(position.coords.latitude + ' ' + position.coords.longitude);
}, function(error) {
console.error(error);
}, {
enableHighAccuracy: false,
maximumAge: 0,
timeout: Infinity
@choco0908
choco0908 / artest.html
Last active January 10, 2020 02:39
gear.js webcam test html
<!DOCTYPE html>
<html>
<head>
<meta charset='utf-8'>
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
<title>GeoAR.js TEST Project</title>
<script src='https://aframe.io/releases/0.9.2/aframe.min.js'></script>
<script src='https://raw.githack.com/jeromeetienne/AR.js/master/aframe/build/aframe-ar.min.js'></script>
<script src='https://rawgit.com/donmccurdy/aframe-extras/master/dist/aframe-extras.loaders.min.js'></script>
<script>