Skip to content

Instantly share code, notes, and snippets.

View troystribling's full-sized avatar

Troy Stribling troystribling

  • San Francisco, CA
View GitHub Profile
@troystribling
troystribling / drive_ya_nuts.scm
Created December 22, 2017 17:19
Solution to Drive Ya Nuts Puzzle
#!/usr/bin/guile -s
!#
;solution to Drive Ya Nuts http://www.samstoybox.com/toys/DriveYaNuts.html
(use-modules (ice-9 format))
(define nut (lambda (numbers)
(define center -1)
(define position 0)
(define get-numbers (lambda () numbers))
@troystribling
troystribling / Rinkeby Dev 2
Created September 17, 2017 23:19
Rinkeby Dev 2
0x8634187E1528eBdc652a4eCAABBD3a40fdc12F61
@troystribling
troystribling / Rinkeby Dev 1
Last active September 17, 2017 23:20
Rinkeby Dev 1
0x2E3Df650Bb8B6c83D17932c90f62b5394A9a6948
@troystribling
troystribling / Rinkeby
Last active September 10, 2017 19:35
Rinkeby Main
0x4BD8b52Ca2908b46210e26d55fdC5e4E24197FD0
@troystribling
troystribling / Podfile
Last active November 22, 2016 19:57
Pod file post_install hook to enable BlueCapKit DBUG output
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
if config.name == 'Debug'
config.build_settings['OTHER_SWIFT_FLAGS'] ||= ['$(inherited)', '-D DEBUG']
end
end
end
end
#!/usr/bin/env bash
# Build open source Swift in a specified directory after cloning the appropriate Github repos.
# Select an alternative Github account (such as hpux735 for William Dillon's forks) to clone swift, swift-llvm, swift-lldb, and swift-corelibs-foundation repos from.
ALTREPO="apple"
# Interval for collecting vmstat, df, and CPU temperature data
STATINTERVAL=300
@troystribling
troystribling / Notify.swift
Created November 23, 2014 16:53
UIAlertControllerExtensions and Notification handler
import UIKit
class Notify {
class func resetEventCount() {
eventCount = 0;
UIApplication.sharedApplication().applicationIconBadgeNumber = 0
}
class func withMessage(message:String) {
@troystribling
troystribling / gist:95811ad507dc877d98ee
Created July 31, 2014 02:52
Find all paths to climb a digital mountain
(ns climbing
(:require [clojure.string :as string])
)
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; part a ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Each mountain block has 2 children it follows that for a mountain of size n
; the total paths will equal total number of block sequences from top to base
; taking one from each row which is given by p=2^(n-1)
(defn simple-path-count
@troystribling
troystribling / ProtocolAssociatedType.swift
Last active April 28, 2022 20:55
A swift protocol with associated type used as type parameter in generic function
protocol Thing {
typealias argType
func doit(val:argType) -> argType
}
class IntThing : Thing {
func doit(val: Int) -> Int {
return val + 1
}
}
@troystribling
troystribling / gist:42ec640f10317267139f
Created March 23, 2014 17:47
BlueCap Characteristic Profile Xcode Snippet
[serviceProfile createCharacteristicWithUUID:<#UUID#>
name:<#name#>
andProfile:^(BlueCapCharacteristicProfile* characteristicProfile) {
characteristicProfile.properties = CBCharacteristicPropertyRead | CBCharacteristicPropertyWrite;
[characteristicProfile serializeObject:^NSData*(id data) {
return nil;
}];
[characteristicProfile afterDiscovered:^(BlueCapCharacteristic* chararacteristic) {
}];
[characteristicProfile deserializeData:^NSDictionary*(NSData* data) {