Skip to content

Instantly share code, notes, and snippets.

@grantjbutler
grantjbutler / ToolbarTabView.swift
Created December 2, 2023 15:36
A TabView-like implementation for getting a "tabs in the toolbar" style of tab bar on macOS.
import SwiftUI
struct ToolbarTabView<Content: View>: View {
let content: () -> Content
init(@ViewBuilder content: @escaping () -> Content) {
self.content = content
}
var body: some View {
@grantjbutler
grantjbutler / README.md
Last active December 31, 2020 00:23
Scriptable Widgets for Side Quest from the Zeldathon team

This is a script for Scriptable for iOS that displays stats widgets for Side Quest: Take to the Seas, presented by the Zeldathon Team.

To use the widgets, create a new script in Scriptable with the contents of scripts.js. Once you've added the script, add a Scriptable widget to the home screen. In the configuration screen of the widget, select the script you created in Scriptable.

There are currently three types of widgets you can display. You can change which type of widget is displayed by changing the value of the "Parameter" parameter when configuring the widget.

  • Total: This widget displays the current total raised during Side Quest. This is the default widget if no value for "Parameter" is provided. You can also get this widget by specifying total for the value.
  • Projects: This widget shows the number of charity: water projects that have been funded through Side Quest. You can get this widget by specifying project or projects for th
// Generated using Sourcery 0.5.3 — https://github.com/krzysztofzablocki/Sourcery
// DO NOT EDIT
// swiftlint:disable file_length
fileprivate func combineHashes(_ hashes: [Int]) -> Int {
var combinedHash = 5381
for itemHash in hashes {
combinedHash = ((combinedHash << 5) &+ combinedHash) &+ itemHash
@grantjbutler
grantjbutler / Patreon.swift
Created November 23, 2016 01:32
LeekFish Postcard Sketch Picker Script
//: Playground - noun: a place where people can play
import UIKit
import GameplayKit
enum Tag: String {
case Cartoon
case Anime
case Game
@grantjbutler
grantjbutler / setup.sh
Last active February 10, 2017 22:00
Set up script for new machines.
#!/bin/bash -eu
echo "Installing Xcode Command Line Tools..."
xcode-select --install
# Install homebrew
echo "Installing Homebrew..."
curl -fsSL -o /tmp/brew-install https://raw.githubusercontent.com/Homebrew/install/master/install
/usr/bin/ruby /tmp/brew-install
brew doctor
@grantjbutler
grantjbutler / keybase.md
Created August 21, 2014 02:42
keybase.md

Keybase proof

I hereby claim:

  • I am grantjbutler on github.
  • I am grantjbutler (https://keybase.io/grantjbutler) on keybase.
  • I have a public key whose fingerprint is 6A8A 6F29 1D11 E94A 287F E186 D2E7 AC1B B13C 6BA0

To claim this, I am signing this object:

@grantjbutler
grantjbutler / code.sh
Last active October 10, 2015 17:28
Simple bash script for running little code snippets
#!/bin/bash
function template_from_language() {
__PHP_TEMPLATE="<?php\n\n?>\n"
__OBJC_TEMPLATE="#import <Foundation/Foundation.h>\n\nint main(int argc, char *argv[]) {\n\t@autoreleasepool {\n\t\t\n\t}\n\t\n\treturn 0;\n}\n"
__JAVA_TEMPLATE="public class program {\n\tpublic static void main(String args[]) {\n\t\t\n\t}\n}\n"
__BASH_TEMPLATE="#!/bin/bash\n\n"
__JS_TEMPLATE="var path = require('path');\n\n"
if [ -z "$1" ]
@grantjbutler
grantjbutler / LICENSE.txt
Created May 23, 2011 16:51 — forked from 140bytes/LICENSE.txt
Query string parsing
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2011 Grant Butler
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