Skip to content

Instantly share code, notes, and snippets.

View theangelperalta's full-sized avatar

Angel Peralta theangelperalta

  • Peacock
  • New York, New York
  • 02:34 (UTC -04:00)
View GitHub Profile
@theangelperalta
theangelperalta / .sh
Created April 21, 2019 15:06
Warnings and Errors - TODO: | FIXME: XCode - Add to build phases
# https://medium.com/@cboynton/todo-make-your-notes-on-xcode-stand-out-5f5124ec064c
TAGS="TODO:|FIXME:"
ERRORTAG="ERROR:"
find "${SRCROOT}" \( -name "*.h" -or -name "*.m" -or -name "*.swift" \) -print0 | xargs -0 egrep --with-filename --line-number --only-matching "($TAGS).*\$|($ERRORTAG).*\$" | perl -p -e "s/($TAGS)/ warning: \$1/" | perl -p -e "s/($ERRORTAG)/ error: \$1/"
@theangelperalta
theangelperalta / .swift
Created February 14, 2019 01:24
Run Shell Commands from Swift
#!/usr/bin/env swift
import Foundation
@discardableResult
func shell(_ command: String) -> String {
let task = Process()
task.launchPath = "/bin/bash"
task.arguments = ["-c", command]
@theangelperalta
theangelperalta / GenericCollectionViewController.swift
Created January 16, 2019 16:37
GenericCollectionViewController
// Created by Angel Cortez on 3/30/18.
// Copyright © 2018 Angel Cortez. All rights reserved.
//
// This an adaptation of Brian Voong's GenericTableViewController
import UIKit
class GenericCell<U>: UITableViewCell {
var item: U!
override init(style: UITableViewCell.CellStyle, reuseIdentifier: String?) {
@theangelperalta
theangelperalta / .swift
Created September 6, 2018 15:23
React Swift Wrapper Class
import Foundation
class Box<T> {
typealias Listener = (T) -> Void
var listener: Listener?
var value: T {
didSet {
listener?(value)
}