Skip to content

Instantly share code, notes, and snippets.

View gerson's full-sized avatar

Gerson Villanueva gerson

  • Barranquilla, Colombia
View GitHub Profile
// MARK: - Adding a header to a single request
func doRequestWithHeaders1() {
let headers: HTTPHeaders = [
"X-Mashape-Key": MY_API_KEY,
"Accept": "application/json"
]
Alamofire.request("https://mashape-community-urban-dictionary.p.mashape.com/define?term=smh", headers: headers)
.responseJSON { response in
debugPrint(response)
@gerson
gerson / gist:b0caa88cfe9b75ca51c75d5c19d7982c
Created July 13, 2017 13:58 — forked from snikch/gist:3661188
Find the current top view controller for your iOS application
- (UIViewController *)topViewController{
return [self topViewController:[UIApplication sharedApplication].keyWindow.rootViewController];
}
- (UIViewController *)topViewController:(UIViewController *)rootViewController
{
if (rootViewController.presentedViewController == nil) {
return rootViewController;
}
@gerson
gerson / xcode-build-bump.sh
Created August 3, 2016 15:42 — forked from sekati/xcode-build-bump.sh
Xcode Auto-increment Build & Version Numbers
# xcode-build-bump.sh
# @desc Auto-increment the build number every time the project is run.
# @usage
# 1. Select: your Target in Xcode
# 2. Select: Build Phases Tab
# 3. Select: Add Build Phase -> Add Run Script
# 4. Paste code below in to new "Run Script" section
# 5. Drag the "Run Script" below "Link Binaries With Libraries"
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0)
@gerson
gerson / install-comodo-ssl-cert-for-nginx.rst
Created February 8, 2016 22:54 — forked from bradmontgomery/install-comodo-ssl-cert-for-nginx.rst
Steps to install a Comodo PositiveSSL certificate with Nginx.

Setting up a SSL Cert from Comodo

I use Namecheap.com as a registrar, and they resale SSL Certs from a number of other companies, including Comodo.

These are the steps I went through to set up an SSL cert.

Purchase the cert

@gerson
gerson / Sublime Text License Key.md
Created October 17, 2015 21:08
Sublime Text 2 License Key, Sublime Text 3 License Key, Sublime Text Full Version.

Sublime Text 2 & 3 License Key, Sublime Text Full Version

Sublime Text License Key

How to activate license key

  1. Go to menu Help > Enter License.
  2. Copy the license key below and paste it into the textbox > Click the Use License button.
  3. Enjoy! 👍