This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// http://stackoverflow.com/questions/4787698/failure-to-override-elements-addeventlistener-in-firefox | |
(function() { | |
Error.stackTraceLimit = Infinity; | |
var _interfaces = Object.getOwnPropertyNames(window).filter(function(i) { | |
return /^HTML/.test(i); | |
}).map(function(i) { | |
return window[i]; | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
if [[ "$#" -lt 2 ]]; then | |
echo "usage: icnsutil /path/to/1024x1024image" | |
exit 1 | |
fi | |
PIC=$1 | |
PIC_FOLDER="$(dirname "$PIC")" | |
ICONSET_FOLDER="$PIC_FOLDER/icons.iconset" | |
ICNS_PATH="$PIC_FOLDER/Icon.icns" | |
mkdir -p $ICONSET_FOLDER |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static func proxyAuthorizationFor(host: String, port: Int, username: String, password: String, destHost: String, destPort: Int) -> [String : String]? { | |
var input: InputStream? | |
var output: OutputStream? | |
Stream.getStreamsToHost(withName: host, port: port, inputStream: &input, outputStream: &output) | |
guard let input_ = input, let output_ = output else { return nil } | |
input_.open() | |
output_.open() | |
guard input_.streamError == nil, output_.streamError == nil else { return nil } | |
let method = "CONNECT" | |
let uri = "\(destHost):\(destPort)" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# Generate UIImage extension for images assets, using in Xcode run script | |
base="$SRCROOT/${TARGET_NAME}" | |
assertPath="$base/Assets.xcassets" | |
fileName="$base/ImageResource.swift" | |
content="import UIKit\nextension UIImage {\n" | |
prefix="lo_" | |
DealWithFile() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Copyright (c) 2015 Kristopher Johnson | |
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 | |
permit persons to whom the Software is furnished to do so, subject to | |
the following conditions: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 1. Select: your Target in Xcode | |
# 2. Select: Build Phases Tab | |
# 3. Select: Add Build Phase -> Add Run Script | |
# 4. Paste code below in to new "Run Script" section | |
# 5. Drag the "Run Script" below "Link Binaries With Libraries" | |
# 6. Insure that your starting build number is set to a whole integer and not a float (e.g. 1, not 1.0) | |
currentUser="$USER" | |
cretePlist() { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
extension SwiftyJSON.JSON : DataConvertible, DataRepresentable { | |
public typealias Result = SwiftyJSON.JSON | |
public static func convertFromData(data:NSData) -> Result? { | |
if let obj: AnyObject = NSKeyedUnarchiver.unarchiveObjectWithData(data) { | |
return SwiftyJSON.JSON(obj) | |
} | |
return nullJSON | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TestObj:UIView { | |
var done:(()->())! | |
deinit { | |
println("deinit TestObj") | |
} | |
func doNothing2(){ | |
} | |
func doNothing(){ | |
self.doNothing2() |