Skip to content

Instantly share code, notes, and snippets.

View joshbuhler's full-sized avatar
🏔️
Stuff. And things.

Joshua Buhler joshbuhler

🏔️
Stuff. And things.
View GitHub Profile
@kieranb662
kieranb662 / SwiftEquationSolvers.md
Last active March 13, 2023 18:01
[Polynomial Solvers] A set of polynomial equation solvers written in Swift. #Math

Swift Equation Solvers

Most equations need to be solved numerically since no close-form expression representing their solutions can be obtained. For polynomial equations of order 1, 2, 3, 4 exact solutions can be obtained. I have created a series of solvers up to a cubic solver, that can be used to obtain most exact solutions. Of course with floating point errors, not everything is going to come out looking clean. To be able to handle complex numbers I made a simplified version of a complex number without all the mathematical operations.

If you call the cubicSolve function with a = 0 then the solver falls back on the quadratic solver, the quadratic solver will fallback on the linear solver and linear solver will return an empty array(Thanks for catching that u\korbonix).

Example Usage

@woxtu
woxtu / LICENSE
Last active January 31, 2020 13:31
Time-lapse -ify in Swift
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified
copies of this license document, and changing it is allowed as long
as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
@SpiritualEvan
SpiritualEvan / FileConverter.swift
Created February 16, 2016 11:57 — forked from abeldomingues/FileConverter.swift
A Swift adaptation of Chris Adamson's Objective-C code for exporting iPod Library audio tracks (obtained as AVAssets using an MPMediaPickerController) to LPCM. See http://www.subfurther.com/blog/2010/12/13/from-ipod-library-to-pcm-samples-in-far-fewer-steps-than-were-previously-necessary/ for Chris' original post.
import UIKit
import AVFoundation
protocol FileConverterDelegate {
func fileConversionCompleted()
}
class FileConverter : NSObject {
var delegate : FileConverterDelegate?
@quellish
quellish / xcci.md
Created October 28, 2014 03:03
Xcode CI script variables

Variable

Type

@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()
ACTION
AD_HOC_CODE_SIGNING_ALLOWED
ALTERNATE_GROUP
ALTERNATE_MODE
ALTERNATE_OWNER
ALWAYS_SEARCH_USER_PATHS
ALWAYS_USE_SEPARATE_HEADERMAPS
APPLE_INTERNAL_DEVELOPER_DIR
APPLE_INTERNAL_DIR
APPLE_INTERNAL_DOCUMENTATION_DIR
@landongn
landongn / gist:5801161
Created June 17, 2013 22:41
IOS7 built in fonts
Thonburi,
Academy Engraved LET,
Snell Roundhand,
Avenir,
Marker Felt,
Geeza Pro,
Arial Rounded MT Bold,
Trebuchet MS,
Arial,
Marion,
@bflorian
bflorian / the-washer-has-stopped.groovy
Last active November 6, 2022 10:41
Turn on a switch when a washing machine has been stopped for a certain period of time.
/*
* Turn on a switch when a washing machine has been stopped for a certain period of time
*
* This app makes use of the runIn() method to turn on the switch the specified period of time
* after the vibration stops. If vibration starts again before the time elapses, then the scheduled
* turn-on event is canceled.
*
*/
preferences {
@joshbuhler
joshbuhler / Build number auto-bump
Last active December 15, 2015 21:09
This will automatically bump the build number of your project's info.plist file when creating an archive for distribution of your app. To use, add this script as a "Run Script" phase to your Xcode build phases, *before* the "Copy Bundle Resources" phase. (It needs to be here so that the updated info.plist file will be copied into the new archive…
#!/bin/bash
##################################################
#
# BuildVersion incrementing script v1.0
#
##################################################
processedPlist="${TARGET_BUILD_DIR}/${INFOPLIST_PATH}"
projectPlist="${INFOPLIST_FILE}"
@mayoff
mayoff / UIBezierPath+forEachElement.h
Created December 2, 2012 06:51
dragging an object along a CGPath on iOS demo
#import <UIKit/UIKit.h>
@interface UIBezierPath (forEachElement)
- (void)forEachElement:(void (^)(CGPathElement const *element))block;
@end