Skip to content

Instantly share code, notes, and snippets.

View kreeger's full-sized avatar

Ben Kreeger kreeger

View GitHub Profile
@kreeger
kreeger / Swift-Vagrantfile
Created March 3, 2016 13:43
My Vagrantfile for setting up and provisioning a Swift-ready environment.
# -*- mode: ruby -*-
# vi: set ft=ruby :
Vagrant.configure(2) do |config|
# Every Vagrant development environment requires a box. You can search for
# boxes at https://atlas.hashicorp.com/search.
config.vm.box = "ubuntu/wily64"
config.vm.network "forwarded_port", guest: 80, host: 8080
# config.vm.network "private_network", ip: "192.168.33.10"
# config.vm.network "public_network"
@kreeger
kreeger / Ruby.sublime-syntax
Last active June 22, 2018 13:30
My modified version of TextMate / Sublime Text's Ruby.tmLanguage file. To use with Sublime Text 3 (> v3104), it'll need to live at "~/Library/Application Support/Sublime Text 3/Packages/Ruby/Ruby.sublime-syntax".
%YAML 1.2
---
name: Ruby
comment: |
TODO: unresolved issues
text:
"p << end
print me!
end"
<?xml version="1.0" encoding="UTF-8" ?>
<Root PresetName="Logitech Extreme 3D Pro" MajorVersion="1" MinorVersion="8">
<KeyboardLayout>en-US</KeyboardLayout>
<LockedDevice>{NoDevice}</LockedDevice>
<MouseXMode Value="" />
<MouseXDecay Value="0" />
<MouseYMode Value="" />
<MouseYDecay Value="0" />
<MouseReset>
<Primary Device="{NoDevice}" Key="" />
@kreeger
kreeger / todo-fixme-warnings.sh
Created December 23, 2015 13:34
Add as a build script phase to your Xcode project and it will raise all TODO and FIXME comments as warnings. Original source: http://jeffreysambells.com/2013/01/31/generate-xcode-warnings-from-todo-comments
TAGS="TODO:|FIXME:"
echo "searching ${SRCROOT} for ${TAGS}"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/"
@kreeger
kreeger / Logitech F310.binds
Last active February 7, 2016 17:23
My custom binds for the Logitech F310 controller. Pitch and roll on the right stick, yaw and throttle on the left. Horizons SRV driving has steering and pitch on the right stick, roll and throttle on the left. Since I like the reach of the bumpers better than the triggers, firing controls have been relocated to the bumpers.
<?xml version="1.0" encoding="UTF-8" ?>
<Root PresetName="Logitech F310" MajorVersion="1" MinorVersion="8">
<KeyboardLayout>en-US</KeyboardLayout>
<LockedDevice>{NoDevice}</LockedDevice>
<MouseXMode Value="" />
<MouseXDecay Value="1" />
<MouseYMode Value="" />
<MouseYDecay Value="1" />
<MouseReset>
<Primary Device="{NoDevice}" Key="" />
@kreeger
kreeger / three-dimensional.rb
Last active August 29, 2015 14:25
Distance between two points.
points = [
{ name: "POINT A", coords: [46.71875, -87.6875, -68.8125] },
{ name: "POINT B", coords: [51.78125,-94.625,-53.21875] }
]
# (17.8ly)
x_comp = (points[1][:coords][0] - points[0][:coords][0]) ** 2
y_comp = (points[1][:coords][1] - points[0][:coords][1]) ** 2
z_comp = (points[1][:coords][2] - points[0][:coords][2]) ** 2
@kreeger
kreeger / xcode-and-el-capitan.md
Last active August 29, 2015 14:24
Re-enables launching of older versions of Xcode on El Capitan. Do so at your own risk!

Xcode 6 & El Capitan

Re-enables launching of older versions of Xcode on El Capitan. Xcode 6 supposedly has issues creating corrupt archives on El Capitan, which is why it's been disabled. Do so at your own risk!

  • Disable rootless (temporarily) with sudo nvram boot-args="kext-dev-mode=1 rootless=0"
  • Then reboot
  • open /System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/Exceptions.plist
  • change com.apple.dt.Xcode -> Item 0 -> HardDisabled from YES to NO
  • Reboot again, for good measure
  • Remove and reinstall Xcode, launch it, make sure it's good
@kreeger
kreeger / EAVersionChecker.swift
Last active August 29, 2015 14:23
Checks for a new version from a server and prompts the user to install it. Great for enterprise builds.
//
// EAVersionChecker.swift
// Copyright (c) 2015 Oven Bits. All rights reserved.
//
import Foundation
class EAVersionChecker {
var versionManifestURL: String = ""
var currentLocalVersion: String { return "\(localSVS).\(localBuild)" }
@kreeger
kreeger / Custom.binds
Last active August 23, 2022 00:41
My keyboard/joystick bindings for Elite: Dangerous.
<?xml version="1.0" encoding="UTF-8" ?>
<Root PresetName="Custom">
<KeyboardLayout>en-US</KeyboardLayout>
<MouseXMode Value="" />
<MouseXDecay Value="0" />
<MouseYMode Value="" />
<MouseYDecay Value="0" />
<MouseReset>
<Primary Device="{NoDevice}" Key="" />
<Secondary Device="{NoDevice}" Key="" />
@kreeger
kreeger / trade.rb
Created February 28, 2015 18:02
A wrapper script for tradedangerous.
#!/usr/bin/env ruby
# A wrapper around Trade Dangerous that persists settings in a local JSON file.
require 'json'
class Trader
attr_reader :data
def initialize(data:)