Skip to content

Instantly share code, notes, and snippets.

@kharrison
kharrison / SwiftIntegerGuide.swift
Created February 17, 2017 16:43
Swift Integer Quick Guide
// -------------------------------------
// Swift Integer Quick Guide
// -------------------------------------
// Created by Keith Harrison http://useyourloaf.com
// Copyright (c) 2017 Keith Harrison. All rights reserved.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//

Update: download the new Pokemon Go app - it fixes all of this. Download it, and reauth, and you should be set. The grant scopes and prompt are correct and visible now too! Now if only I could actually find a pikachu...

Pokemon tokens are requested with these understandable scopes:

@mgarbacz
mgarbacz / app.js
Last active September 24, 2015 22:22
Basic Angular controller/service/template example
// enable strict mode, we use this in every JS file
// for more info see: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Strict_mode
'use strict';
// declare our module and it's dependencies (empty array because there are no deps)
angular.module('example', []);
@beccadax
beccadax / gist:72f3fcc3274c0e5f12d7
Created June 25, 2015 02:16
Fully generic safe subscripting in Swift
extension CollectionType where Index: Comparable {
subscript (safe index: Index) -> Generator.Element? {
guard startIndex <= index && index < endIndex else {
return nil
}
return self[index]
}
}
@wjlafrance
wjlafrance / MethodsOfHandlingNil.swift
Last active September 14, 2015 20:48
MethodsOfHandlingNil.swift
/**
* The contract of this method is that the method will check if unsafeThing is nil before using it.
* This contract is not encoded in the method signature and is not compiler-enforced!
*/
func safelyHandlesIUO(unsafeThing: String!) {
println("This isn't an optional. We can use it directly but may find nil and crash: \(unsafeThing)")
if let safeThing = unsafeThing {
println("String is \(count(safeThing)) length")
} else {
println("Woah, we would have crashed if we passed it to count!")
@JaviLorbada
JaviLorbada / FRP iOS Learning resources.md
Last active April 8, 2024 18:07
The best FRP iOS resources.

Videos

@tsiege
tsiege / The Technical Interview Cheat Sheet.md
Last active May 19, 2024 17:40
This is my technical interview cheat sheet. Feel free to fork it or do whatever you want with it. PLEASE let me know if there are any errors or if anything crucial is missing. I will add more links soon.

ANNOUNCEMENT

I have moved this over to the Tech Interview Cheat Sheet Repo and has been expanded and even has code challenges you can run and practice against!






\

@dergachev
dergachev / GIF-Screencast-OSX.md
Last active May 17, 2024 02:53
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:

@kylefox
kylefox / color.m
Created January 27, 2012 17:45
Generate a random color (UIColor) in Objective-C
/*
Distributed under The MIT License:
http://opensource.org/licenses/mit-license.php
Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
"Software"), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to