Skip to content

Instantly share code, notes, and snippets.

Indrajit Chakrabarty indyfromoz

Block or report user

Report or block indyfromoz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
indyfromoz / build.gradle
Created Oct 22, 2018
Build identifiers
View build.gradle
ext {
// Assumes Git is in your PATH
commitCount = {
return 'git rev-list --count HEAD'.execute().text.trim()
gitSha = {
return 'git rev-parse --short HEAD'.execute().text.trim()
indyfromoz / SolarizedDark.xccolortheme
Created Jul 23, 2017
Solarized Dark Theme for Xcode 8+
View SolarizedDark.xccolortheme
#Remove this line after copying the following to ~/Library/Developer/Xcode/UserData/FontAndColorThemes/SolarizedDark.xccolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>0.513725 0.580392 0.588235 1</string>
<string>Menlo-Regular - 11.0</string>
indyfromoz /
Last active Sep 8, 2017
Installing & updating Cocoapods on a Mac
indyfromoz / Obsidian.xccolortheme
Created Mar 30, 2017
Obsidian Xcode theme tested with Xcode 8.3
View Obsidian.xccolortheme
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>1 1 1 1</string>
<string>SFMono-Bold - 11.0</string>
<string>1 1 1 1</string>
indyfromoz /
Last active Jun 21, 2018
Go 1.8 setup on a Mac running Sierra 10.12.3+

Install Go with Homebrew

brew install go --cross-compile-common

Update Bash profile

export GOROOT=/usr/local/opt/go/libexec
View gist:2b2bb235fba798a4543a

Thoughts on Swift 2 Errors

When Swift was first announced, I was gratified to see that one of the (few) philosophies that it shared with Objective-C was that exceptions should not be used for control flow, only for highlighting fatal programming errors at development time.

So it came as a surprise to me when Swift 2 brought (What appeared to be) traditional exception handling to the language.

Similarly surprised were the functional Swift programmers, who had put their faith in the Haskell-style approach to error handling, where every function returns an enum (or monad, if you like) containing either a valid result or an error. This seemed like a natural fit for Swift, so why did Apple instead opt for a solution originally designed for clumsy imperative languages?

I'm going to cover three things in this post:

indyfromoz / uinavigationbar-noshadown.m
Created Jan 15, 2014
Remove single pixel shadow from UINavigationBar
View uinavigationbar-noshadown.m
[self.navigationController.navigationBar setShadowImage:[[UIImage alloc] init]];
[self.navigationController.navigationBar setBackgroundImage:[[UIImage alloc]init] forBarMetrics:UIBarMetricsDefault];
indyfromoz / fade-in-subview.m
Created Dec 29, 2013
Fade in a newly added subview
View fade-in-subview.m
[fadingView setAlpha:0.0];
[containerView addSubview:fadingView];
[UIView beginAnimations:nil context:nil];
[fadingView setAlpha:1.0];
[UIView commitAnimations];
// Remove from superView
[UIView animateWithDuration:0.2
animations:^{viewOut.alpha = 0.0;}
completion:^(BOOL finished){[viewOut removeFromSuperview];}];
indyfromoz / node-file-watcher.js
Created Dec 25, 2013
Watches a file for any changes
View node-file-watcher.js'any-folder-you-want', function (event, filename) {
console.log('event: ' + event);
if (filename) {
console.log('filename: ' + filename);
} else {
console.log('filename unknown');
indyfromoz / UIImageView+DeviceOrientation.m
Last active Jan 1, 2016
Update background image of a view based on device orientation
View UIImageView+DeviceOrientation.m
Add this in a view
- (void)viewWillAppear:(BOOL)animated {
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(orientationChanged:) name:UIDeviceOrientationDidChangeNotification object:nil];
// Update the background image if the device is an iPad and its orientation changed
- (void)orientationChanged:(NSNotification *)notification {
You can’t perform that action at this time.