Skip to content

Instantly share code, notes, and snippets.

Dan Leonard MacMeDan

Block or report user

Report or block MacMeDan

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
MacMeDan / validChars.swift
Last active Mar 6, 2018
String extension that filters out invalid characters for enum case names.
View validChars.swift
extension String {
// created by - Dan Leonard 3/6/2018
// NOTE: does not account for individual numbers
var validChars: String {
return String(describing: filter { String($0).rangeOfCharacter(from: .alphanumerics) != nil })
MacMeDan / camelCased.swift
Last active Mar 6, 2018
Take a string and make a camelCased version of it.
View camelCased.swift
extension String {
// created by - Dan Leonard 3/6/2018
/// lowercased to start and Capitalised each segment that fallows.
/// if there are more then 10 words in the sentence
var camelCased: String {
var componets = self.components(separatedBy: " ")
guard let first = componets.first?.lowercased() else { fatalError("Invalid string for enum generation") }
if componets.count == 1 { return "\(first)"}
let rest = componets.dropFirst().flatMap{ $0.capitalized }.joined()

Keybase proof

I hereby claim:

  • I am macmedan on github.
  • I am macmedan ( on keybase.
  • I have a public key ASBmUfgfucVoU0MNe7QCDNrzAxCLCJZ-qq9NNs1uM2I4Igo

To claim this, I am signing this object:

You can’t perform that action at this time.