Skip to content

Instantly share code, notes, and snippets.

View wess's full-sized avatar
💭
When am I not writing code?

Wess Cope wess

💭
When am I not writing code?
View GitHub Profile
import Foundation
let args = (Process.arguments[1..<Process.arguments.count])
let argString = args.joinWithSeparator(" ")
print("Arguments: \(argString)")
let message = "Hello World"
let contentLength = message.utf8.count
server.write("HTTP/1.1 200 OK\n")
server.write("Server: Pilot Example \n")
server.write("Content-length: \(contentLength)\n")
server.write("Content-type: text-plain\n")
server.write("\r\n")
server.write(message)
func collectionView(collectionView: UICollectionView, cellForItemAtIndexPath indexPath: NSIndexPath) -> UICollectionViewCell {
guard let charge = charges[indexPath.item] as Charge else { fatalError("Invalid index") }
guard let cell = collectionView.dequeueReusableCellWithReuseIdentifier(CellIdentifier, forIndexPath: indexPath) as? ChargeKeypadCell else { fatalError("Invalid Cell for charge view") }
cell.charge = charge
return cell
}
import Darwin
typealias Socket = Int32
typealias SocketAddress = sockaddr_in
typealias SocketPort = UInt16
public enum HTTPError : ErrorType {
case Binding
case Address
}
<!DOCTYPE html>
<html lang="en">
<head>
<title></title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<!-- <link rel="stylesheet" type="text/css" href="components/bootstrap/dist/css/bootstrap.min.css"> -->
<!-- <script type="text/javascript" src="components/jquery/dist/jquery.min.js"></script> -->
<!-- <script type="text/javascript" src="components/bootstrap/dist/js/bootstrap.min.js"></script> -->
//
// Request.swift
// Swipe
//
// Created by Wesley Cope on 9/15/15.
// Copyright © 2015 Wess Cope. All rights reserved.
//
import Foundation
- (float) productOfA: (const float) a b: (const char) b {
if (b > 0)
return a;
if (b < 0)
return -a;
return 0;
}
@wess
wess / Byway.swift
Created July 22, 2015 19:57
Byway
//
// Byway.swift
// Byway
//
// Created by Wesley Cope on 7/16/15.
// Copyright © 2015 Wess Cope. All rights reserved.
//
/* USAGE:
@wess
wess / Alter.swift
Created July 17, 2015 18:49
Alter - JSON Decoding/Modeling lib for Swift 2.0
//
// Alter.swift
// Alter
//
// Created by Wesley Cope on 7/16/15.
// Copyright © 2015 Wess Cope. All rights reserved.
//
/* USAGE:
extension CGImage {
func blurEffect(boxSize: Float) -> CGImageRef! {
let boxSize = boxSize - (boxSize % 2) + 1
let inProvider = CGImageGetDataProvider(self)
let height = vImagePixelCount(CGImageGetHeight(self))
let width = vImagePixelCount(CGImageGetWidth(self))
let rowBytes = CGImageGetBytesPerRow(self)