Skip to content

Instantly share code, notes, and snippets.

@steve228uk
steve228uk / gist:873d653f1ecec0456ea3f475b6e54f68
Created December 30, 2021 19:25
Farming Simulator Beacon HID control
On (Lasts for 10 seconds):
hidapitester.exe --vidpid 340D/1710 --open --length 10 --send-output 0x0,0xFF,0x01,0x66,0xC8,0xFF,0xAD,0x52,0x81,0xD6
Off:
hidapitester.exe --vidpid 340D/1710 --open --length 10 --send-output 0x0,0xFF,0x00,0x00,0x64,0x00,0x32,0x9E,0xD7,0x0D
Address: VID and PID (Vendor ID and Product ID)
import UIKit
import CoreServices
import ImageIO
class Writer {
let output = NSTemporaryDirectory().appending("output.heic")
lazy var outputUrl: CFURL = {
return URL(fileURLWithPath: output) as CFURL
}()
//
// SampleCode.xcconfig
//
// The `SAMPLE_CODE_DISAMBIGUATOR` configuration is to make it easier to build
// and run a sample code project. Once you set your project's development team,
// you'll have a unique bundle identifier. This is because the bundle identifier
// is derived based on the 'SAMPLE_CODE_DISAMBIGUATOR' value. Do not use this
// approach in your own projects—it's only useful for sample code projects because
// they are frequently downloaded and don't have a development team set.
@steve228uk
steve228uk / AudioEngine.swift
Created July 20, 2017 15:55
AudioEngine used for TPI
//
// AudioEngine.swift
// TPI
//
// Created by Stephen Radford on 29/05/2017.
// Copyright © 2017 Cocoon Development Ltd. All rights reserved.
//
import Foundation
import AudioKit
@steve228uk
steve228uk / organisations.swift
Last active November 21, 2016 10:36 — forked from crabcrabcam/organisations.swift
Organisation getter
extension GitKit {
public class func getMyOrganisations() -> Observable<[Organisation]> {
guard let organisationsURL = GitKit.currentUser.value?.organizationsUrl else { return Observable.just([]) }
return Alamofire.request(.GET, (organisationsURL))
.rx_responseJSON()
.map { response, json in
guard let array = json as? [[String:AnyObject]] else { return [] }
@steve228uk
steve228uk / config.json
Created October 21, 2016 09:28
LIFX LAN Homebridge Config
{
"bridge": {
"name": "Homebridge",
"username": "CC:22:3D:E3:CE:30",
"port": 51826,
"pin": "031-45-154"
},
"platforms": [
{
"platform" : "LiFxLAN",
@steve228uk
steve228uk / commalist.swift
Created July 25, 2016 21:02
Comma List Swift
extension SequenceType where Generator.Element == String {
func commaList() -> String {
var result = joinWithSeparator(", ")
let range = result.rangeOfString(", ", options: .BackwardsSearch)
result.replaceRange(range!, with: " & ")
return result
}
}
@steve228uk
steve228uk / GIFPlayer.h
Created January 28, 2016 23:16
GIFPlayer for OSX by the guys at Byte Inc.
//
// GIFPlayer.h
// Byte
//
// Created by Dom Hofmann on 8/9/15.
// Copyright © 2015 Byte, Inc. All rights reserved.
//
#import "ByteObject.h"
#import <Cocoa/Cocoa.h>
@steve228uk
steve228uk / buttons.swift
Last active October 10, 2021 07:23
Move NSWindow standardWindowButtons in Swift
// Add this to your main view.
override func viewDidLayout() {
super.viewDidLayout()
if let btn = view.window?.standardWindowButton(.closeButton) {
btn.removeFromSuperview()
btn.setFrameOrigin(NSPoint(x: 12, y: 28))
view.addSubview(btn)
{"jolts": [{"Date": "1/6/2016", "Question": "Today I'm working on...", "Response": "Today I'm working on "}, {"Date": "1/6/2016", "Question": "Who's your favorite writer?", "Response": "My favorite writer is "}, {"Date": "1/6/2016", "Question": "What are you saving up for?", "Response": "I'm saving up for "}, {"Date": "1/7/2016", "Question": "Name a few of your favorite things.", "Response": "These are a few of my favorite things:"}, {"Date": "1/7/2016", "Question": "A screenshot of a text exchange. ", "Response": "A recent text exchange:"}, {"Date": "1/7/2016", "Question": "What's the best class you've ever taken?", "Response": "The best class I've ever taken was"}, {"Date": "1/8/2016", "Question": "What talent do you wish you had?", "Response": "I've always wanted to be talented at"}, {"Date": "1/8/2016", "Question": "What's the weirdest thing you've ever eaten?", "Response": "The weirdest thing I've eaten is "}, {"Date": "1/8/2016", "Question": "Paste whatever's in your clipboard right now.", "Response": "