Skip to content

Instantly share code, notes, and snippets.

Avatar

Jasdev Singh jasdev

View GitHub Profile
@jasdev
jasdev / CustomCell.swift
Last active Jul 6, 2018
An approach to safer UITableViewCell and UICollectionViewCell reuse
View CustomCell.swift
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 Sep 5, 2015
A Tour of UIUserNotificationAction
View AppDelegate.swift
import UIKit
enum Notifications {
enum Categories: String {
case Message
}
enum Actions: String {
case RemindMeLater
case Reply
@jasdev
jasdev / BKLNSwiftPresenters.md
Last active Aug 29, 2015 — forked from marcdown/BKLNSwiftPresenters.md
Brooklyn Swift Developers Meetup Presenters
View BKLNSwiftPresenters.md
@jasdev
jasdev / UpperCaseLetter.swift
Created Aug 12, 2015
Swift 2.0 gist to quickly determine if a String contains an uppercase alphabetical character
View UpperCaseLetter.swift
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
}
}
View keybase.md

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 Aug 29, 2015
Clone repo at specific commit
View clonerev.sh
clonerev() {
git clone $1
cd 'sed ${1}##/*/ s/.git//'
git reset --hard $2
}
# Usage: clonerev [url] [commit hash]
@jasdev
jasdev / gallery.js
Last active Aug 29, 2015
Fetch top 5 Gallery Items from Imgur
View gallery.js
@jasdev
jasdev / color.py
Created Dec 22, 2013
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
View color.py
colors = []
for i in range(0, COUNT):
colors.append(colorsys.hsv_to_rgb(fmod(i * 0.618033988749895, 1.0), 0.5, 1.0))
View .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'
View gist:7504303
“You could take all the gold that’s ever been mined, and it would fill a cube 67 feet in each direction. For what it’s worth at current gold prices, you could buy — not some — all of the farmland in the United States. Plus, you could buy 10 Exxon Mobils (XOM), plus have $1 trillion of walking-around money. Or you could have a big cube of metal. Which would you take? Which is going to produce more value?” - Warren Buffett