This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# formatting.sh - Automatically formats Swift files that have changed before committing. | |
DIFF_FILTER="ACMR" # Only format files that have been added, copied, modified or renamed. | |
STAGED_FILES=$(git diff --cached --name-only --diff-filter=$DIFF_FILTER "*.swift") | |
NOT_STAGED_FILES=$(git diff --name-only --diff-filter=$DIFF_FILTER "*.swift") | |
# Skip formatting for partially staged files. This is done by subtracting any files that git also considers unstaged from the list. | |
FILES_TO_FORMAT=($(comm -23 <(printf "%s\n" "${STAGED_FILES[@]}" | sort) <(printf "%s\n" "${NOT_STAGED_FILES[@]}" | sort))) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
XCODE_PATH = File.expand_path(File.join(`xcode-select -p`.chomp, '../..')) | |
def open_cmd(pattern) | |
files = Dir.glob(pattern) | |
`open -a "#{XCODE_PATH}" "#{files.first}"` and exit if files.count == 1 | |
end | |
open_cmd '*.xcworkspace' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
// Configuration | |
$source_file = 'Theme.swift'; | |
$output_asset_catalog = 'MyApp/Resources/Colors.xcassets'; | |
// | |
function mkdir_if_not_exists($directory) { | |
if (!is_dir($directory)) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# esphome configuration for the TTGO T-Camera ESP32-WROVER-B | |
# https://www.aliexpress.com/item/TTGO-T-Camera-ESP32-WROVER-B-PSRAM-Camera-Module-ESP32-WROVER-OV2640-Camera-Module-0-96/32966036489.html | |
# I use this 3D-printed case for the device: | |
# https://www.thingiverse.com/thing:3540059 | |
esphome: | |
name: woonkamer | |
platform: ESP32 | |
board: esp32dev |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Foundation | |
func easter(for year: Int) -> Date? { | |
// Code from Gist: https://gist.github.com/duedal/2eabcede718c69670102 | |
let a = year % 19 | |
let b = Int(floor(Double(year) / 100)) | |
let c = year % 100 | |
let d = Int(floor(Double(b) / 4)) | |
let e = b % 4 | |
let f = Int(floor(Double(b+8) / 25)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import UIKit | |
extension UIImage { | |
func tinted(withColor color: UIColor) -> UIImage? { | |
UIGraphicsBeginImageContextWithOptions(size, false, 0) | |
defer { UIGraphicsEndImageContext() } | |
let rect = CGRect(origin: .zero, size: size) | |
// Tint the image | |
self.draw(in: rect) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python3 | |
# Copyright 2017 Google Inc. | |
# | |
# Licensed under the Apache License, Version 2.0 (the "License"); | |
# you may not use this file except in compliance with the License. | |
# You may obtain a copy of the License at | |
# | |
# http://www.apache.org/licenses/LICENSE-2.0 | |
# | |
# Unless required by applicable law or agreed to in writing, software |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use bunq\Context\ApiContext; | |
use bunq\Model\Generated\Endpoint\User; | |
use bunq\Model\Generated\Endpoint\UserCompany; | |
use bunq\Model\Generated\Endpoint\UserPerson; | |
use bunq\Model\Generated\Object\NotificationFilter; | |
require 'vendor/autoload.php'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# diff | |
# version | |
# BetaFlight/OMNIBUS 3.0.1 Oct 18 2016 / 10:21:07 (48b7b4f) | |
# name | |
# mixer | |
# servo |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CLI | |
# diff | |
# Betaflight / OMNIBUS 3.1.6 Mar 6 2017 / 22:16:32 (1fd502c3) | |
name Bertcopter | |
feature -RX_PPM | |
feature -CURRENT_METER | |
feature -OSD | |
feature RX_SERIAL |