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
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)
import Foundation
let args = (Process.arguments[1..<Process.arguments.count])
let argString = args.joinWithSeparator(" ")
print("Arguments: \(argString)")
*.pbxproj binary merge=union
@wess
wess / Toolbar.swift
Last active February 15, 2016 19:49
//
// Toolbar.swift
// Inquire
//
// Created by Wesley Cope on 2/15/16.
// Copyright © 2016 Wess Cope. All rights reserved.
//
import Foundation
import UIKit
func decorate(func) {
func wrapper(name:String) {
return "<p>\(func(name))</p>"
}
return wrapper
}
@decorate
(function($, exports){
var form = exports.storeFrontForm || {};
form.submitLead = function() { ...
}
form.setVendorLeadFormMessage = function() { ...
}
exports.storeFrontForm = form
//
// ForceTouchGestureRecognizer.swift
// Payment
//
// Created by Wesley Cope on 5/5/16.
// Copyright © 2016 Nudge, llc. All rights reserved.
//
import Foundation
import UIKit
class Progress < ActiveRecord::Base
belongs_to :race
end
class Race < ActiveRecord::Base
has_many :progresses
end
- (NSString *)stringFromHexString:(NSString *)hexString {
if (([hexString length] % 2) != 0)
return nil;
NSMutableString *string = [NSMutableString string];
for (NSInteger i = 0; i < [hexString length]; i += 2) {
private func stringFromHexString(string:String) -> String? {
guard (string.length % 2) != 0 else { return nil }
var hex = string
var result = ""
while(hex.length > 0) {
let advance = hex.startIndex.advancedBy(2)
let substring = hex.substringToIndex(advance)
hex = hex.substringFromIndex(advance)