Skip to content

Instantly share code, notes, and snippets.

View brunogama's full-sized avatar
🏠
Working from home

Bruno Gama brunogama

🏠
Working from home
  • Banco Inter
  • Brazil
  • 00:33 (UTC -03:00)
  • X @brunogama
View GitHub Profile
import UIKit
extension UIView {
static func vstack(
_ views: UIView...,
spacing: CGFloat = 0,
alignment: UIStackView.Alignment = .fill,
distribution: UIStackView.Distribution = .fill
) -> UIStackView {
@davidtaylorhq
davidtaylorhq / codenames-timer.js
Last active August 15, 2022 17:22
Timer UI for codenames.game
/*
Add-on timer for https://codenames.game
When run, a popup window will be opened with a countdown timer.
The timer will automatically reset when a team completes its turn.
There is also a manual reset control and duration setting
To run, start a game, then paste this entire gist into your browser developer tools.
Alternatively, add this URL as a bookmarklet:
javascript:fetch("https://gist.githubusercontent.com/davidtaylorhq/b64c294122dafbaf244ad7a53ce7a82a/raw/codenames-timer.js").then(response => response.text()).then(eval)
@TizianoCoroneo
TizianoCoroneo / DontTrustThisSelector.swift
Created August 6, 2020 16:24
Closure based Selector
import Foundation
import PlaygroundSupport
import UIKit
final class Sel {
static let target = DummyClass.shared
final class DummyClass {
@stefanomondino
stefanomondino / project.yaml
Last active July 29, 2020 16:13
Project.yaml example for XcodeGen
name: TestProject
configs:
Devel Run: debug
Devel Archive: release
Prod Run: debug
Prod Archive: release
settings:
configs:
Devel Run:
SWIFT_ACTIVE_COMPILATION_CONDITIONS: DEVEL DEBUG
hey guys, hi guys, hey guyz, hi guyz, hey dudes, hi dudez, hey dudez, hi dudez, hey bros, hi bros, hey brahs, hi brahs, hey broz, hi broz, dudebros, bros, dudes, guys, brahs, you guys, you dudes, sup dudes, sup bros, sup brahs, sup guys, sup dudez
May I suggest “everyone”? It's more gender inclusive.
May I suggest “all”? It's more gender-inclusive.
May I suggest “people”? It's more gender-inclusive.
May I suggest “y’all”? It's more gender-inclusive.
May I suggest “folks”? It's more gender-inclusive.
May I suggest “people”? It's more gender-inclusive.
May I suggest “humans”? It's more gender-inclusive.
May I suggest “everyone”? It's more gender-inclusive.
@nunogoncalves
nunogoncalves / BetterDecodingError.swift
Last active January 26, 2024 08:37
Better Decoding Error Messages
import Foundation
enum BetterDecodingError: CustomStringConvertible {
case dataCorrupted(_ message: String)
case keyNotFound(_ message: String)
case typeMismatch(_ message: String)
case valueNotFound(_ message: String)
case any(_ error: Error)
@heestand-xyz
heestand-xyz / cases.swift
Last active August 7, 2020 19:21
Swift Cases
import Foundation
fileprivate let badChars = CharacterSet.alphanumerics.inverted
public extension String {
var camelToTitleCased: String {
if self.count <= 1 {
return self.uppercased()
}
@brunogama
brunogama / qrcode.swift
Created November 21, 2019 19:26
There's no need to download third party software when you can execute this code and generate your own qr-code generator qr-code.playground 😀
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
final class QRCodeViewController: UIViewController {
private var input: String = ""
func generateQRCode(from string: String) -> UIImage? {
let data = string.data(using: String.Encoding.ascii)
@julienma
julienma / README.md
Last active April 10, 2023 21:59
Pi-Hole docker setup with DNSCrypt-Proxy 2

This will setup Pi-Hole with DNS-Over-HTTPS (DoH) enabled, using dnscrypt-proxy as a DoH proxy — which is an alternative to cloudflared, as explained in the Cloudflare docs. Inspired from https://github.com/losuler/pihole-dnscrypt-docker.

Install Pi-Hole on Docker

Create docker-compose.yml and etc-dnscrypt-proxy/dnscrypt-proxy.toml, then to install/update:

@rnapier
rnapier / assertion.swift
Last active August 21, 2020 14:00
AssertionFailure as a type
///
/// Boring setup. See below for the good parts
///
public class Logger {
public static let root = Logger(subsystem: .none, parent: nil)
public let subsystem: Subsystem
public let parent: Logger?
public init(subsystem: Subsystem, parent: Logger? = .root) {
self.subsystem = subsystem