Skip to content

Instantly share code, notes, and snippets.

View carlinyuen's full-sized avatar
😬
Life. I may be slow to respond.

Carlin carlinyuen

😬
Life. I may be slow to respond.
View GitHub Profile
@carlinyuen
carlinyuen / .travis.yml
Created August 30, 2013 04:13 — forked from johanneswuerbach/.travis.yml
Brilliant gist for deploying an iOS app to TestFlight using Travis CI through Github
---
language: objective-c
before_script:
- ./scripts/travis/add-key.sh
after_script:
- ./scripts/travis/remove-key.sh
after_success:
- ./scripts/travis/testflight.sh
env:
global:
@carlinyuen
carlinyuen / iOS GTMOAuth Request
Created October 30, 2013 21:11
To send an OAuth authenticated message using hardcoded consumer key / secret and access token / secret in iOS -- should be used judiciously, this may be a security risk -- we use the GTMOAuth library (https://code.google.com/p/gtm-oauth/).
#import "GTMOAuthAuthentication.h"
GTMOAuthAuthentication *auth = [[GTMOAuthAuthentication alloc]
initWithSignatureMethod:kGTMOAuthSignatureMethodHMAC_SHA1
consumerKey:@"..."
privateKey:@"..."];
auth.accessToken = @"...";
auth.tokenSecret = @"...";
[auth setHasAccessToken:true];
@carlinyuen
carlinyuen / Native Base64 String Encoding
Last active December 27, 2015 02:49 — forked from ArtSabintsev/Native Base64 (Pre iOS7)
Brilliant little piece of code to help you base64 encode NSStrings in iOS / objective-c using native libraries. Thanks to the original author, Arthur Sabintsev; find his blog here: http://blog.artsabintsev.com/native-base64-encoding-in-ios-pt-1
// Pre-iOS 7
+ (NSString *)base64EncodeString:(NSString *)stringToEncode
{
CFHTTPMessageRef messageRef = CFHTTPMessageCreateEmpty(kCFAllocatorDefault, FALSE);
CFHTTPMessageAddAuthentication(messageRef, NULL, CFSTR("AS"), (__bridge CFStringRef)stringToEncode, kCFHTTPAuthenticationSchemeBasic, FALSE);
CFStringRef authStringRef = CFHTTPMessageCopyHeaderFieldValue(messageRef, CFSTR("Authorization"));
NSString *encodedString = [(__bridge NSString *)authStringRef substringFromIndex:10];
CFRelease(messageRef);

tmux shortcuts & cheatsheet

start new:

tmux

start new with session name:

tmux new -s myname
@carlinyuen
carlinyuen / MEAN-Stack-Setup.sh
Last active February 21, 2017 20:36 — forked from phatblat/heroku-node-init.sh
Quick setup script to put together a MEAN (Mongo, Express, Angular, Node) stack app using MEAN.io's repo, for quick setup for hackathons and such: https://github.com/linnovate/mean. Keywords: MongoDB, ExpressJS, AngularJS, NodeJS, MEAN, stack, setup, script, init, repo, bash, unix, shell.
#!/bin/bash
# Modified by Carlin Yuen 2014/02
#
# Run this from the folder that you want to be the root of your app,
# which can be cloned from or later pushed to Heroku's git repo.
# NOTE: this is best done with a clean / empty root folder!
# Troubleshooting: https://github.com/linnovate/mean.
#
# This will pull the latest MEAN.io and install/update the following packages:
# Brew, Git, Node, Bower, Grunt, Heroku Toolbelt, MongoDB,