Skip to content

Instantly share code, notes, and snippets.

@hongvuxuan
hongvuxuan / tricks.md
Created October 17, 2021 06:57 — forked from mael/tricks.md
Xcode 10.2 "Unable to boot the Simulator"

Solution "Unable to boot the Simulator"

sudo mkdir /private/tmp

sudo chmod 1777 /private/tmp

Other basic command

xcrun

xcrun simctl list devices //to list all simulators

xcrun simctl delete // to delete specific device

@hongvuxuan
hongvuxuan / regex-japanese.txt
Created September 6, 2021 09:48 — forked from terrancesnyder/regex-japanese.txt
Regex for Japanese
Regex for matching ALL Japanese common & uncommon Kanji (4e00 – 9fcf) ~ The Big Kahuna!
([一-龯])
Regex for matching Hirgana or Katakana
([ぁ-んァ-ン])
Regex for matching Non-Hirgana or Non-Katakana
([^ぁ-んァ-ン])
Regex for matching Hirgana or Katakana or basic punctuation (、。’)
@hongvuxuan
hongvuxuan / Animation.md
Created April 28, 2021 10:40 — forked from JeOam/Animation.md
iOS Core Animation: Advanced Techniques, Part 1: The Layer Beneath

Author: https://www.cyanhall.com/

1. The Layer Tree

Core Animation's original name is Layer Kit

Core Animation is a compositing engine; its job is to compose different pieces of visual content on the screen, and to do so as fast as possible. The content in question is divided into individual layers stored in a hierarchy known as the layer tree. This tree forms the underpinning for all of UIKit, and for everything that you see on the screen in an iOS application.

In UIView, tasks such as rendering, layout and animation are all managed by a Core Animation class called CALayer. The only major feature of UIView that isn’t handled by CALayer is user interaction.

There are four hierarchies, each performing a different role:

@hongvuxuan
hongvuxuan / prettyprint.swift
Created April 28, 2020 03:35 — forked from 3lvis/prettyprint.swift
JSON Pretty Print Swift 5
print(String(data: try! JSONSerialization.data(withJSONObject: dict, options: .prettyPrinted), encoding: .utf8)!)
@hongvuxuan
hongvuxuan / ngrok-installation.md
Created April 12, 2020 04:06 — forked from wosephjeber/ngrok-installation.md
Installing ngrok on Mac

Installing ngrok on OSX

brew cask install ngrok

Using ngrok

The easiest way to use ngrok to tunnel into your localhost is if your local project is running on a specific port (e.g. not using named vhosts). You just run ngrok http [port number].

You can quickly boot up a local webserver using ruby. cd into the project's root directory and run ruby -run -e httpd . -p [port number].

@hongvuxuan
hongvuxuan / net.js
Created April 11, 2020 08:27 — forked from sid24rane/net.js
Simple TCP Client and Server in Node.js (Covering all useful Properties & Methods)
var net = require('net');
// creates the server
var server = net.createServer();
//emitted when server closes ...not emitted until all connections closes.
server.on('close',function(){
console.log('Server closed !');
});
@hongvuxuan
hongvuxuan / EventEmitter.swift
Created August 28, 2019 06:20 — forked from brennanMKE/EventEmitter.swift
React Native Event Emitter for RCTEventEmitter in Objective-C and Swift
class EventEmitter
/// Shared Instance.
public static var sharedInstance = EventEmitter()
// ReactNativeEventEmitter is instantiated by React Native with the bridge.
private static var eventEmitter: ReactNativeEventEmitter!
private init() {}
@hongvuxuan
hongvuxuan / git_cherry_pick
Last active May 31, 2019 08:50
The command allows you to take a single commit (from whatever branch) and, essentially, rebase it in your working branch
git cherry-pick <commit>
@hongvuxuan
hongvuxuan / generate_public_private_modulemap.swift
Created February 13, 2019 03:12 — forked from danielpetroianu/generate_public_private_modulemap.swift
Create framework Public/Private header lists
#!/usr/bin/env xcrun --sdk macosx swift
import Foundation
fileprivate extension Array {
func separate(where condition: (Element) -> Bool) -> ([Element], [Element]) {
return self.reduce( ([Element](), [Element]()) ) { (result, nextElement) -> ([Element], [Element]) in
if condition(nextElement) {
return (result.0 + [nextElement], result.1)
}