Skip to content

Instantly share code, notes, and snippets.

// swiftlint:disable line_length
// swiftlint:disable variable_name
// swiftlint:disable large_tuple
import Foundation
#if os(iOS) || os(tvOS) || os(watchOS)
import UIKit
#elseif os(OSX)
import AppKit
@grdsdev
grdsdev / NSPredicate+Helpers.swift
Created April 24, 2019 09:48
Helper methods for creating NSPredicates
import Foundation
extension NSPredicate {
static func equal(_ field: String, value: Any, caseInsensitive: Bool = false) -> NSPredicate {
let caseInsensitiveModifier = caseInsensitive ? "[c]" : ""
return NSPredicate(format: "%K ==\(caseInsensitiveModifier) %@", argumentArray: [field, value])
}
static func notEqual(_ field: String, value: Any, caseInsensitive: Bool = false) -> NSPredicate {
protocol ViewConfigurable {}
extension ViewConfigurable where Self: UIView {
func configure(_ block: (Self) -> Void) -> Self {
block(self)
return self
}
}
import UIKit
@dynamicMemberLookup
public struct Builder<Base> {
private let _build: () -> Base
public init(_ build: @escaping () -> Base) {
self._build = build
}
" Enable filetype plugins
filetype plugin on
filetype indent on
set number
" Turn on the Wild menu
set wildmenu
"Always show current position
command regex json 's/(.+)/expr let input = %1; print(String(data: try! JSONSerialization.data(withJSONObject: (input is Data ? (try! JSONSerialization.jsonObject(with: input as! Data, options: [])) : input as! Any), options: [.prettyPrinted]), encoding: .utf8)!)/'
#!/bin/sh
[ "$UID" -eq 0 ] || exec sudo bash "$0" "$@"
rm -rf $HOME/.Trash/*
rm -rf $HOME/Library/Developer/Xcode/DerivedData/*
rm -rf $HOME/Library/Developer/Xcode/Archives/*
rm -rf $HOME/Library/Developer/CoreSimulator/Caches/*
rm -rf $HOME/Library/Caches/*

Keybase proof

I hereby claim:

  • I am grsouza on github.
  • I am grsouza (https://keybase.io/grsouza) on keybase.
  • I have a public key ASAXDqUwkS39Uvtl_vvYkAwGdDxFBnTQcKaXtIWlt1GHFAo

To claim this, I am signing this object:

{% for type in types.structs %}
{% if type|annotated:"AutoInit" %}
{% set spacing %}{% if type.parentName %} {% endif %}{% endset %}
{% map type.storedVariables into parameters using var %}{{ var.name }}: {% if var.typeName|hasPrefix:"(" %}@escaping {% endif %}{{ var.typeName }}{% endmap %}
// sourcery:inline:auto:{{ type.name }}.AutoInit
{{spacing}}{{ type.accessLevel }} init({{ parameters|join:", " }}) {
{{spacing}} {% for variable in type.storedVariables %}
{{spacing}} self.{{ variable.name }} = {{ variable.name }}
{{spacing}} {% endfor %}
{{spacing}}}
@grdsdev
grdsdev / families.sql
Created June 21, 2022 13:08
families.sql
create type family_user_role as enum (
'admin',
'member'
);
create table public.families (
id uuid default uuid_generate_v4 () not null primary key,
inserted_at timestamp with time zone default timezone('utc'::text, now()) not null,
updated_at timestamp with time zone default timezone('utc'::text, now()) not null,
name text not null