Skip to content

Instantly share code, notes, and snippets.

@mrakowski
mrakowski / swift-3-notes.md
Last active October 19, 2016 16:08
Swift 3 Notes

Absolute value

    abs(-4)

Array / NSArray

@mrakowski
mrakowski / 0_reuse_code.js
Created January 14, 2016 22:21
Here are some things you can do with Gists in GistBox.
// Use Gists to store code you would like to remember later on
console.log(window); // log the "window" object to the console
@mrakowski
mrakowski / git-log-examples.txt
Last active October 19, 2021 08:51
git log examples
// Show a list of previous commits
git log
git log --oneline --since=1.days
git log --no-merges
git log --since=1.days
git log --pretty=format:"%s" --no-merges -n 25
git log --pretty=format:"%s" --no-merges --since=1.days
git log --pretty=format:"%s" --no-merges --since=18.hours
@mrakowski
mrakowski / gist:4003432
Created November 2, 2012 18:36
iOS: check for data connection
// Check for data connection with Reachability.m
#import "Reachability.h"
Reachability *currentReachability = [Reachability reachabilityForInternetConnection];
NetworkStatus networkStatus = [currentReachability isReachable];
if (networkStatus != 0)
{
// Network is reachable
}
@mrakowski
mrakowski / gist:4003093
Last active November 4, 2015 20:18
Check iOS selector availability
// Check for the existence of a selector
if ([_pageControl respondsToSelector:@selector(pageIndicatorTintColor)] == YES) {
}
// Check device system version
+ (BOOL)isRunningiOS5 {
// This will only return true in iOS 5 and up.
if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 5.0f) {