Skip to content

Instantly share code, notes, and snippets.

Avatar

Troy Stribling troystribling

  • San Francisco, CA
View GitHub Profile
@troystribling
troystribling / drive_ya_nuts.scm
Created Dec 22, 2017
Solution to Drive Ya Nuts Puzzle
View drive_ya_nuts.scm
#!/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))
View Rinkeby Dev 2
0x8634187E1528eBdc652a4eCAABBD3a40fdc12F61
View Rinkeby Dev 1
0x2E3Df650Bb8B6c83D17932c90f62b5394A9a6948
@troystribling
troystribling / Rinkeby
Last active Sep 10, 2017
Rinkeby Main
View Rinkeby
0x4BD8b52Ca2908b46210e26d55fdC5e4E24197FD0
@troystribling
troystribling / Podfile
Last active Nov 22, 2016
Pod file post_install hook to enable BlueCapKit DBUG output
View Podfile
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
View swift_build
#!/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 Nov 23, 2014
UIAlertControllerExtensions and Notification handler
View Notify.swift
import UIKit
class Notify {
class func resetEventCount() {
eventCount = 0;
UIApplication.sharedApplication().applicationIconBadgeNumber = 0
}
class func withMessage(message:String) {
@troystribling
troystribling / gist:95811ad507dc877d98ee
Created Jul 31, 2014
Find all paths to climb a digital mountain
View gist:95811ad507dc877d98ee
(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 May 29, 2021
A swift protocol with associated type used as type parameter in generic function
View ProtocolAssociatedType.swift
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 Mar 23, 2014
BlueCap Characteristic Profile Xcode Snippet
View gist:42ec640f10317267139f
[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) {