Skip to content

Instantly share code, notes, and snippets.

View finder39's full-sized avatar

Joe Neuman finder39

View GitHub Profile
{
"version":"0.0.2",
"bio":{
"firstName":"Joseph",
"lastName":"Neuman",
"email":{
"work":"joe@gotappsusa.com"
},
"summary":"Long live Octo-StrongBad",
"location":{
@finder39
finder39 / gist:f8ade94b80dcdc28e6a3
Created July 30, 2014 19:39
Reachable.h enum change for Swift
typedef NS_ENUM(NSInteger, NetworkStatus) {
NotReachable = 0,
ReachableViaWiFi,
ReachableViaWWAN
};
@finder39
finder39 / Swift-MD5.swift
Last active March 20, 2018 13:37
Swift MD5
extension String {
func md5() -> String! {
let str = self.cStringUsingEncoding(NSUTF8StringEncoding)
let strLen = CUnsignedInt(self.lengthOfBytesUsingEncoding(NSUTF8StringEncoding))
let digestLen = Int(CC_MD5_DIGEST_LENGTH)
let result = UnsafeMutablePointer<CUnsignedChar>.alloc(digestLen)
CC_MD5(str!, strLen, result)
var hash = NSMutableString()
git reset --soft HEAD~1
@finder39
finder39 / gist:a66cc6762a8029cea20e
Created November 3, 2014 17:47
println additions
func dprintln<T>(object: T, function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__, column: Int = __COLUMN__) {
println("<\(file.lastPathComponent):(\(line))> \(object)")
}
func dfprintln<T>(object: T, function: String = __FUNCTION__, file: String = __FILE__, line: Int = __LINE__, column: Int = __COLUMN__) {
println("<\(file.lastPathComponent):\(function):(\(line))> \(object)")
}
@finder39
finder39 / gist:2eb4b3d3d80c009d7447
Created November 4, 2014 19:48
jsonDictionaryHelpers.swift
// Created by Joseph Neuman
import Foundation
func getBool(object:AnyObject?) -> Bool? {
return object as AnyObject? as? Bool
}
func getDate(object:AnyObject?) -> NSDate? {
if let tempObject = object as AnyObject? as? String {
Latest node.js & npm installation on Ubuntu 12.04
Home / Tutorials / node.js / Latest node.js & npm installation on Ubuntu 12.04
Compiling is way to go for many but I am mostly in hurry so following works for me!
Adding Chris Lea’s Repo
Using Launchpad repo by Chris Lea just run following commands
apt-get install python-software-properties
apt-add-repository ppa:chris-lea/node.js
apt-get update
@finder39
finder39 / gist:ff51facaeda8e55cde38
Created January 20, 2015 23:11
Remove all .DS_Stores from a git repo
find . -name .DS_Store -print0 | xargs -0 git rm -f --ignore-unmatch
http://stackoverflow.com/questions/107701/how-can-i-remove-ds-store-files-from-a-git-repository
@finder39
finder39 / jsonDictionaryHelpers.swift
Last active August 29, 2015 14:13
jsonDictionaryHelpers
import Foundation
func getBool(object:AnyObject?) -> Bool? {
if let temp = object as? Bool {
return temp
} else if let temp = object as? NSNumber {
return temp.boolValue
} else if let temp = object as? Int {
return Bool(temp)
} else if let temp = object as? String {
{
init: function(elevators, floors) {
var getByFloor = function (value) {
var result = floorsWaiting.filter(function(o){return o.floorNum == value;} );
return result? result[0] : null; // or undefined
}
var getElevatorById = function (arr, value) {
var result = arr.filter(function(o){return o.iden == value;} );
return result? result[0] : null; // or undefined
}