Skip to content

Instantly share code, notes, and snippets.

View stebaps's full-sized avatar

Steve Thornton stebaps

  • Dublin, Ireland
View GitHub Profile
@ramzesenok
ramzesenok / CoreDataViewModelArchitecture.swift
Last active May 12, 2022 06:26
My attempt to build a reusable ViewModel that uses CoreData as its persistence store
import Combine
import SwiftUI
import CoreData
class CoreDataViewModel: NSObject, ObservableObject, NSFetchedResultsControllerDelegate {
let container: NSPersistentContainer
private var controllerUpdates = [NSObject: CurrentValueSubject<[NSFetchRequestResult], Never>]()
init(container: NSPersistentContainer) {
self.container = container

Ubuntu 22.04 for Deep Learning

In the name of God

This gist contains steps to setup Ubuntu 22.04 for deep learning.


Install Ubuntu 22.04

@pepasflo
pepasflo / .gitignore
Last active October 22, 2023 12:06
Scripts for encrypting / decrypting secrets (to prevent them from being accidentally checked into git)
secrets/
@gonzalezreal
gonzalezreal / ios-cell-registration-swift.md
Last active March 5, 2025 02:07
iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

iOS Cell Registration & Reusing with Swift Protocol Extensions and Generics

A common task when developing iOS apps is to register custom cell subclasses for both UITableView and UICollectionView. Well, that is if you don’t use Storyboards, of course.

Both UITableView and UICollectionView offer a similar API to register custom cell classes:

public func registerClass(cellClass: AnyClass?, forCellWithReuseIdentifier identifier: String)
public func registerNib(nib: UINib?, forCellWithReuseIdentifier identifier: String)
@stuartbain
stuartbain / subdomain_validator.rb
Last active October 25, 2021 22:33
Custom validator for Subdomains
class SubdomainValidator < ActiveModel::EachValidator
# http://matthewhutchinson.net/2010/10/27/rails-3-subdomain-validation-activemodeleachvalidator
def validate_each(object, attribute, value)
return unless value.present?
reserved_names = %w(www ftp mail pop smtp admin ssl sftp)
reserved_names = options[:reserved] if options[:reserved]
if reserved_names.include?(value)
object.errors[attribute] << 'cannot be a reserved name'
end
@akkerman
akkerman / Install PostGIS and GeoServer on Ubuntu 13.04.md
Last active May 28, 2023 01:53
Install PostGIS and GeoServer on Ubuntu 13.04

Install PostGIS and GeoServer on Ubuntu 13.04

PostGIS installation

Postgresql

Install the server:

sudo apt-get install postgresql-9.1 postgresql-contrib-9.1 pgadmin3

Execute the psql command under user postgres (sudo -u postgres)
and connect to database postgres (psql postgres):