Skip to content

Instantly share code, notes, and snippets.

Avatar

Sungcheol Kim skyfe79

View GitHub Profile
@skyfe79
skyfe79 / strong-password-regex.md
Created Apr 10, 2020 — forked from arielweinberger/strong-password-regex.md
Strong password Regular Expression - NestJS Course
View strong-password-regex.md
  • Passwords will contain at least 1 upper case letter
  • Passwords will contain at least 1 lower case letter
  • Passwords will contain at least 1 number or special character
  • There is no length validation (min, max) in this regex!

Regular expression for JavaScript:

/((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$/
@skyfe79
skyfe79 / diff.mdown
Created Mar 1, 2019 — forked from ndarville/diff.mdown
Paul Heckel's Diff Algorithm
View diff.mdown

[Isolating Differences Between Files][paper]

Advantage over Other Algorithms

The diff output is more specific:

[I]f a whole block of text is moved, then all of it, rather than just the beginning and end, is detected as changed.

The algorithm described here avoids these difficulties. It detects differences that correspond very closely to our intuitive notion of difference.

@skyfe79
skyfe79 / StringExtensionHTML.swift
Created Nov 20, 2018
Decoding HTML Entities in Swift
View StringExtensionHTML.swift
import Foundation
// Very slightly adapted from http://stackoverflow.com/a/30141700/106244
// 99.99% Credit to Martin R!
// Mapping from XML/HTML character entity reference to character
// From http://en.wikipedia.org/wiki/List_of_XML_and_HTML_character_entity_references
private let characterEntities : [String: Character] = [
@skyfe79
skyfe79 / makeAnimatedGif.m
Created Nov 2, 2017 — forked from mayoff/makeAnimatedGif.m
Example of creating an animated GIF on iOS, with no 3rd-party code required. This should also be easy to port to OS X.
View makeAnimatedGif.m
#import <UIKit/UIKit.h>
#import <ImageIO/ImageIO.h>
#import <MobileCoreServices/MobileCoreServices.h>
static UIImage *frameImage(CGSize size, CGFloat radians) {
UIGraphicsBeginImageContextWithOptions(size, YES, 1); {
[[UIColor whiteColor] setFill];
UIRectFill(CGRectInfinite);
CGContextRef gc = UIGraphicsGetCurrentContext();
CGContextTranslateCTM(gc, size.width / 2, size.height / 2);
@skyfe79
skyfe79 / build.gradle
Created Jun 8, 2016 — forked from Takhion/build.gradle
Automatic Java home (7/8) for Retrolambda with Gradle
View build.gradle
String getJavaHome(String version)
{
def stdout = new ByteArrayOutputStream()
exec {
commandLine "/usr/libexec/java_home", "-v", version
standardOutput = stdout;
}
return stdout.toString().trim()
}
@skyfe79
skyfe79 / GameViewController.swift
Created Feb 27, 2016 — forked from kconner/GameViewController.swift
Xcode 6.3 OpenGL Game template ported to Swift. (Add "-D DEBUG" to Other Swift Flags setting)
View GameViewController.swift
import GLKit
// Uniform index.
private enum Uniform {
case ModelViewProjectionMatrix, NormalMatrix
}
private var gUniforms: [Uniform: GLint] = [:]
extension GLKMatrix3 {
var array: [Float] {
@skyfe79
skyfe79 / BST.swift
Created Feb 19, 2016
Functional BinarySearchTree in Swift
View BST.swift
import Cocoa
indirect enum BST<T: Comparable> {
case Leaf
case Node(BST<T>, T, BST<T>)
}
var bst = BST.Node(.Leaf, 10, .Leaf)
extension BST {
View gist:9cfbb94782b51d33a98c

#Intro

Kotlin is a new programming language for the JVM. It produces Java bytecode, supports Android and generates JavaScript. The latest version of the language is Kotlin M5.3

Kotlin project website is at kotlin.jetbrains.org.

All the codes here can be copied and run on Kotlin online editor.

Let's get started.

View ubuntu_14.04_macbook_pro_retina_15_inch_mid_2014.md
View AvcEncoder.java
package com.opentok.media.avc;
import java.io.IOException;
import java.nio.ByteBuffer;
import android.media.MediaCodec;
import android.media.MediaCodecInfo;
import android.media.MediaFormat;
public class AvcEncoder {
You can’t perform that action at this time.