Skip to content

Instantly share code, notes, and snippets.

View nhnam's full-sized avatar
💭
Play hard, work harder

ナ-ム Nguyen nhnam

💭
Play hard, work harder
View GitHub Profile
@nhnam
nhnam / podforceupdate.sh
Created June 2, 2023 07:32 — forked from mbinna/podforceupdate.sh
Clear CocoaPods cache, re-download and re-install all pods
#!/usr/bin/env bash
rm -rf "${HOME}/Library/Caches/CocoaPods"
rm -rf "`pwd`/Pods/"
pod update
@nhnam
nhnam / AppDelegate10.m
Created July 14, 2022 08:55 — forked from jzucker2/AppDelegate10.m
UserNotifications on iOS 10
// Make sure to include this at the top of AppDelegate.m
@import UserNotifications;
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
// Override point for customization after application launch.
// Check Notification Settings on launch
[[UNUserNotificationCenter currentNotificationCenter] getNotificationSettingsWithCompletionHandler:^(UNNotificationSettings * _Nonnull settings) {
switch (settings.authorizationStatus) {
// This means we have not yet asked for notification permissions
case UNAuthorizationStatusNotDetermined:
function arrayManipulation(n, queries) {
// Write your code here
var arr = Array(n + 1).fill(0);
var max = 0;
var x = 0;
for(var query of queries) {
const [a, b, k] = query;
arr[a] += k;
if(b+1 <= n) {
arr[b+1] -= k;
// Complete the minimumSwaps function below.
function minimumSwaps(arr) {
var swaps = 0;
for(var i=0; i< arr.length; i++) {
while(arr[i] !== i + 1) {
let j = arr[i] - 1;
let tem = arr[i];
arr[i] = arr[j];
arr[j] = tem;
swaps ++;
function Node(key) {
this.key = key;
this.left = null;
this.right = null;
this.parent = null;
}
function BSTree() {
this.root = null;
}
class TrieNode {
var key: Character?
var children: [Character: TrieNode] = [:]
weak var parent: TrieNode?
var end: Bool
init(_ key: Character?) {
self.key = key
self.children = [:]
self.parent = nil
self.end = false
class TrieNode {
constructor(key) {
this.key = key;
this.parent = null;
this.children = {};
this.end = false;
}
};
class Trie {
try? self.navigate(screen: "user_xxx")
func openUser() {
try? self.navigate(screen: "user")
}
import MAFNavigationRegistry
import UserModule
class ApplicationNavigationController: UINavigationController, MAFNavigationRegistry {
var registry: [String : MAFModuleRegistry] = [
"user": UserModule.userModuleRegistry,
"system": SystemModule.systemModuleRegistry
]
}