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
//
// NSArray+Safe.h
// NNSafeArray
//
// Created by Nguyen Hoang Nam on 15/3/16.
// Copyright © 2016 Alan Nguyen. All rights reserved.
//
#import <Foundation/Foundation.h>
#!/bin/bash
set -e
echo
echo Preparing symbolic links for WebRTC...
echo
BUILD_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/build/
BORINGSSL_FOLDER_CHROMIUM_DESTINATION=../webrtc-deps/chromium/third_party/boringssl/src/
@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 / GIF-Screencast-OSX.md
Created November 16, 2015 09:54 — forked from dergachev/GIF-Screencast-OSX.md
OS X Screencast to animated GIF

OS X Screencast to animated GIF

This gist shows how to create a GIF screencast using only free OS X tools: QuickTime, ffmpeg, and gifsicle.

Screencapture GIF

Instructions

To capture the video (filesize: 19MB), using the free "QuickTime Player" application:

@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.
}
//: Playground - noun: a place where people can play
import UIKit
class LLNode <T> {
var key: T!
var next: LLNode?
var prev: LLNode?
}
#!/bin/bash
COMPRESS=1 # Compress if ImageOptim is intalled. 0 = disabled; 1 = enabled
iOSSubdir="/iOS" # make this an empty string to save in same dir
androidSubdir="/Android" # make this an empty string to save in same dir
help() {
echo ""
echo "Usage: ./$(basename "$0") <your_1024x1024.png>"
echo " --------------------------------------------------------------------------------------"

Google Protobuf 2.5.0 - Mac OS X and iOS Support

The script in this gist will help you buid the Google Protobuf library for use with Mac OS X and iOS. Other methods (such as homebrew or direct compilation) have issues that prevent their use. The libraries built by this script are universal and support all iOS device architectures including the simluator.

Get the Script

The easiest way to use this script is to simply clone the gist onto your

// TODO: improve the loop
void standardlizeParams(NSMutableDictionary* defaultParams) {
NSMutableDictionary *mutableDict = [defaultParams mutableCopy];
for (NSString *key in [defaultParams allKeys]) {
if ([defaultParams[key] isEqual:[NSNull null]] || [defaultParams[key] isEqual:@""]) {
[mutableDict removeObjectForKey:key];
NSLog(@" ✕ %@", key);
}
else if([defaultParams[key] isKindOfClass:[NSDictionary class]]) {
standardlizeParams(defaultParams[key]);
@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)