Skip to content

Instantly share code, notes, and snippets.

View jasdev's full-sized avatar

Jasdev Singh jasdev

View GitHub Profile
@jasdev
jasdev / Operation.swift
Created February 15, 2016 03:04
NSOperation Subclass with KVO Notifications
class Operation: NSOperation {
override var asynchronous: Bool {
return true
}
private var _executing = false {
willSet {
willChangeValueForKey("isExecuting")
}
@jasdev
jasdev / CustomCell.swift
Last active July 6, 2018 17:29
An approach to safer UITableViewCell and UICollectionViewCell reuse
class CustomCell: UITableViewCell, Reusable {
class var reuseIdentifier: String {
return "customCell"
}
}
class SupaHotCustomCell: CustomCell {
override class var reuseIdentifier: String {
return "supaHotCustomCell"
}
@jasdev
jasdev / AppDelegate.swift
Last active September 5, 2015 20:35
A Tour of UIUserNotificationAction
import UIKit
enum Notifications {
enum Categories: String {
case Message
}
enum Actions: String {
case RemindMeLater
case Reply
@jasdev
jasdev / BKLNSwiftPresenters.md
Last active August 29, 2015 14:27 — forked from marcdown/BKLNSwiftPresenters.md
Brooklyn Swift Developers Meetup Presenters
@jasdev
jasdev / UpperCaseLetter.swift
Created August 12, 2015 03:04
Swift 2.0 gist to quickly determine if a String contains an uppercase alphabetical character
extension String {
func containsUpperCaseLetter() -> Bool {
let beginCodePoint = Character("A").unicodeScalarCodePoint()
let endCodePoint = Character("Z").unicodeScalarCodePoint()
for scalar in self.unicodeScalars {
if case beginCodePoint...endCodePoint = scalar.value {
return true
}
}

Keybase proof

I hereby claim:

  • I am jasdev on github.
  • I am jasdev (https://keybase.io/jasdev) on keybase.
  • I have a public key whose fingerprint is 711E 45E8 FF90 3997 AA07 6FD0 D107 2F37 4EB8 54D8

To claim this, I am signing this object:

@jasdev
jasdev / clonerev.sh
Last active August 29, 2015 14:13
Clone repo at specific commit
clonerev() {
git clone $1
cd 'sed ${1}##/*/ s/.git//'
git reset --hard $2
}
# Usage: clonerev [url] [commit hash]
@jasdev
jasdev / gallery.js
Last active August 29, 2015 14:03
Fetch top 5 Gallery Items from Imgur
@jasdev
jasdev / color.py
Created December 22, 2013 04:10
quick python to generate the optimum set of RBG values for a set of size COUNT. This uses the technique outlined in this post http://gamedev.stackexchange.com/questions/46463/is-there-an-optimum-set-of-colors-for-10-players
colors = []
for i in range(0, COUNT):
colors.append(colorsys.hsv_to_rgb(fmod(i * 0.618033988749895, 1.0), 0.5, 1.0))
@jasdev
jasdev / .bash_profile
Created December 9, 2013 18:56
.bash_profile
export PATH
cdls() {
if [ -z "$1" ]; then
cd && ls -G
else
cd "$*" && ls -G
fi
}
alias cd=cdls
alias pearp='/Applications/MAMP/bin/php/php5.4.4/bin/pear'