Skip to content

Instantly share code, notes, and snippets.

@mugbug
mugbug / AssertEquals+Diff.swift
Created June 10, 2021 20:29
XCTestCase wrapper for asserting equatable structs with formatted error diff message
import XCTest
// Credits: https://github.com/pointfreeco/swift-composable-architecture
//swiftlint:disable empty_string force_cast force_unwrapping unused_closure_parameter function_body_length
class MyCustomTestCase: XCTestCase {
func assertEqual<T: Equatable>(
expected: T,
actual: T
) {
@mugbug
mugbug / Builder.swift
Created July 8, 2020 12:27
Generic Builder DSL in Swift
infix operator ..: AdditionPrecedence
infix operator <-: MultiplicationPrecedence
struct Predicate<Element> {
let code: (Element) -> Element
func runCode(for element: Element) -> Element {
return code(element)
}
}
@mugbug
mugbug / AppDelegate.swift
Created December 23, 2019 20:41
Remote Config Module
import UIKit
class AppDelegate: UIResponder, UIApplicationDelegate {
func application(_ application: UIApplication,
didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
RemoteConfigModule().setup(withOptions: FirebaseConfigOptions())
return true
}
@mugbug
mugbug / elementaryos_config.sh
Last active January 25, 2018 19:56
My initial configuration for elementaryOS. Run each command separately. This is meant to be just a database of some apps I like.
#!/bin/sh
sudo apt update && sudo apt upgrade -y
sudo apt dist-upgrade -y
# PPA
sudo apt-get install software-properties-common
# TLP to save battery and prevent overheating
sudo apt install tlp tlp-rdw
tlp start
@mugbug
mugbug / ongs.json
Last active October 23, 2017 15:32
{
"ongs" : [ {
"address" : "Rua Augusto Ribeiro Filho - 20 -, Campo Belo, São Paulo, SP",
"phone" : "11 5021 3858",
"name" : "BRAZILIAN ADVENTURE SOCIETY"
}, {
"address" : "R. MAJOR SYLVIO MAGALHAES PADILHA - 5200 - ED. PHILADELPHIA - 3º ANDAR, MORUMBI, São Paulo, SP",
"phone" : "11 3759 8000",
"name" : "BRAZILIAN INSTITUTE OF TECHNOLOGY AND SOFTWARE - BITS"
}, {
from PIL import Image
import pytesseract
print(pytesseract.image_to_string(Image.open('teste.png')))