Skip to content

Instantly share code, notes, and snippets.

View svenmuennich's full-sized avatar

Sven Münnich svenmuennich

View GitHub Profile
@svenmuennich
svenmuennich / run.sh
Created October 10, 2018 22:54
Fix whitespace
#!/bin/bash
# Convert tabs to spaces (https://stackoverflow.com/a/11094620/981846)
find . \( -name '*.m' -o -name '*.h' -o -name '*.swift' -o -name '*.pch' \) ! -type d -exec bash -c 'expand -t 4 "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
# Trim trailing whitespace (https://stackoverflow.com/a/10711226/981846)
find . \( -name '*.m' -o -name '*.h' -o -name '*.swift' -o -name '*.pch' \) ! -type d -exec bash -c 'sed "s/[[:space:]]\{1,\}$//" "$0" > /tmp/e && mv /tmp/e "$0"' {} \;
import Foundation
import UIKit
struct ViewStyle<T> {
let style: (T) -> Void
}
let filled = ViewStyle<UIButton> {
$0.setTitleColor(.white, for: .normal)
$0.backgroundColor = .red
@svenmuennich
svenmuennich / install_shopware
Last active January 15, 2025 13:17
Install Shopware 5 without Ant/Java
#!/bin/bash
# Make sure to have a valid config.php ready before running this script!!!
# Check parameters
if [[ $# -ne 1 ]]; then
echo " Usage: $0 <app path>"
exit 1
fi
app_path=$1
@svenmuennich
svenmuennich / Foo.swift
Created April 23, 2021 15:22
A Swift `Codable` type for representing nested data structures
internal class Foo: Codable {
internal struct CodingKey: Swift.CodingKey {
internal let stringValue: String
internal let intValue: Int?
internal init?(stringValue: String) {
self.stringValue = stringValue
self.intValue = Int(stringValue)
}