Skip to content

Instantly share code, notes, and snippets.

@marklarr
marklarr / gist:3c61cf4e6c74137012ba
Last active August 29, 2015 14:07
NSUserNotificationAction.isEqual sets authenticationRequired
// Playground - noun: a place where people can play
import UIKit
import Foundation
var authRequiredAction = UIMutableUserNotificationAction()
authRequiredAction.authenticationRequired = true
var authNotRequiredAction = UIMutableUserNotificationAction()
@marklarr
marklarr / each.swift
Last active August 29, 2015 14:02
each.swift
import Foundation
protocol Enumerable {
typealias Element
func each( (Element) -> Void)
}
//-----------------------------
@marklarr
marklarr / swiftRegex.swift
Created June 3, 2014 06:53
Ruby-esque regex in Swift
// Regex
import Foundation
operator infix =~ {}
@infix func =~ (str: String, pattern: String) -> Bool {
var error: NSError?
let regex = NSRegularExpression.regularExpressionWithPattern(pattern, options: nil, error: &error)
if (error) { return false }
@marklarr
marklarr / gist:9357577
Created March 4, 2014 23:02
JSONKit 1.5pre.1
Pod::Spec.new do |s|
s.name = 'JSONKit'
s.version = '1.5pre.1'
s.license = 'BSD / Apache License, Version 2.0'
s.summary = 'A Very High Performance Objective-C JSON Library.'
s.homepage = 'https://github.com/johnezang/JSONKit'
s.author = 'John Engelhart'
s.source = { :git => 'https://github.com/johnezang/JSONKit.git', :commit => '82157634ca0ca5b6a4a67a194dd11f15d9b72835' }
s.source_files = 'JSONKit.*'
@marklarr
marklarr / simian_to_cpd.md
Last active December 27, 2015 10:49
simian_to_cpd
  1. Change encoding to UTF-8
  2. insert <?xml-stylesheet href="simian.xsl" type="text/xsl"?> on second line

PMD-CPD

  1. Node pmd-cpd becomes <simian version="2.3.34">
  2. Nest another node