Skip to content

Instantly share code, notes, and snippets.

View CodeEagle's full-sized avatar
🎹
Laugh

CodeEagle CodeEagle

🎹
Laugh
View GitHub Profile
@CodeEagle
CodeEagle / icnsutil
Created March 20, 2019 00:38
Create Icns from image file with shell script
#!/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
@CodeEagle
CodeEagle / gist:6fc136bc0ea1d336b9bc6b41cb2d87d4
Created November 10, 2017 02:21
Digest Proxy Authorization
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)"
@CodeEagle
CodeEagle / ImageGenerator
Last active October 24, 2022 05:56
Generator for Assets.xcassets , Xcode Run Script
#!/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() {
@CodeEagle
CodeEagle / _sudoku.swift
Created July 24, 2016 02:54 — forked from kristopherjohnson/_sudoku.swift
Sudoku solver in Swift
/*
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:
@CodeEagle
CodeEagle / Xcode Team Adding Build Number Shell Script
Last active July 4, 2020 10:32
Xcode Team Adding Build Number Shell Script
# 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() {
@CodeEagle
CodeEagle / SHJON.swift
Last active August 29, 2015 14:23
SwiftyJSON work with HanekeSwift
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
}
@CodeEagle
CodeEagle / Test.swift
Created April 29, 2015 01:50
ARC Retain Cycle Test
class TestObj:UIView {
var done:(()->())!
deinit {
println("deinit TestObj")
}
func doNothing2(){
}
func doNothing(){
self.doNothing2()