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:
@nhnam
nhnam / embedded-file-viewer.md
Created July 23, 2020 10:48 — forked from tzmartin/embedded-file-viewer.md
Embedded File Viewer: Google Drive, OneDrive

Office Web Apps Viewer

('.ppt' '.pptx' '.doc', '.docx', '.xls', '.xlsx')

http://view.officeapps.live.com/op/view.aspx?src=[OFFICE_FILE_URL]

<iframe src='https://view.officeapps.live.com/op/embed.aspx?src=[OFFICE_FILE_URL]' width='px' height='px' frameborder='0'>
</iframe>

OneDrive Embed Links

@nhnam
nhnam / uploadImage.m
Created February 19, 2020 06:51 — forked from ylem/uploadImage.m
Upload image by NSURLSession
/**
* Generate a mutable URLRequest with authorisation Token (if has) and User-Agent
*
* @param url NSURL object
* @param method GET, POST, PUT or DELETE
* @return NSMutableURLRequest object, can be modify (add more values) later.
*/
- (NSMutableURLRequest *)requestUrl:(NSURL *)url method:(NSString *)method {
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:url
cachePolicy:NSURLRequestReloadIgnoringLocalCacheData

FWIW: I didn't produce the content presented here (the outline from Edmond Lau's book). I've just copy-pasted it from somewhere over the Internet, but I cannot remember what exactly the original source is. I was also not able to find the author's name, so I cannot give him/her the proper credits.


Effective Engineer - Notes

What's an Effective Engineer?

@nhnam
nhnam / avatar.sh
Created June 15, 2016 04:03 — forked from mwunsch/avatar.sh
Random Avatar Generator
curl -s 'http://realbusinessmen.tumblr.com/api/read?type=photo&num=50' | ruby -r'rexml/document' -e 'puts REXML::Document.new(STDIN).elements["tumblr/posts"].to_a.shuffle.pop.map(&:text)'
@nhnam
nhnam / Makefile
Created June 13, 2016 11:08 — forked from j0sh/Makefile
iOS static library cross-compile script.
# iOS builds for ARMv7 and simulator i386.
# Assumes any dependencies are in a local folder called libs and
# headers in a local folder called headers.
# Dependencies should already have been compiled for the target arch.
PROJ=untitled
ifeq ($(IOS), 1)
ARCH=armv7
DEVICE=OS
CC_FLAGS=-arch $(ARCH)
@nhnam
nhnam / NSDICT.m
Created May 25, 2016 04:15 — forked from swillits/NSDICT.m
Obj-C NSDictionary Literal-like syntax allowing nil values
/*
---------------------------------------------------------------------------------------
Obj-C Literal Dictionary Syntax - Multiple reasons for allowing nil values
Radar 19747372
---------------------------------------------------------------------------------------
The obj-c literal syntax for dictionaries does not allow nils.
@{key : nil}; // Exception (and compiler error)
@nhnam
nhnam / yosemite-sound-issues.md
Created January 20, 2016 07:25 — forked from mdwheele/yosemite-sound-issues.md
Fix Yosemite Bluetooth Sound Issues
  1. Run the following in your terminal.
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Max (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Apple Initial Bitpool Min (editable)" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Max" 80
defaults write com.apple.BluetoothAudioAgent "Negotiated Bitpool Min" 80
@nhnam
nhnam / human.swift.motemplate
Created December 25, 2015 05:34 — forked from JoshuaSullivan/human.swift.motemplate
Better mogenerator Swift templates!
import Foundation
@objc(<$managedObjectClassName$>)
public class <$managedObjectClassName$>: _<$managedObjectClassName$> {
// Custom logic goes here.
}