[TIL Tips] Convert Local JSON to CoreData using Sync


Sync is a Swift library that uses a convention-over-configuration paradigm to facilitate JSON-2-CoreData operations. Sync uses a wrapper for CoreData called DataStack which allows us to skip dealing with NSPersistentStoreCoordinator and NSManageObjectContext. First, we need to create a custom Fetcher class to fetch data from our JSON file and populate the DB. import CoreData import Sync class Fetcher { private let dataStack: DataStack init() { self.dataStack = DataStack(modelName: "ENTITY") } } Moving forward, replace all instances of ENTITY with the name of your entity class.…
Read more ⟶

[TIL Tips] Iterate between Date objects in ruby


Using the standard ruby range: (Date.new(2018, 01, 01)..Date.new(2018, 01, 30)).each do |date| # Do stuff with date end Using the Date method upto: Date.new(2018, 01, 01).upto(Date.new(2018, 01, 30)) do |date| # Do stuff with date end …
Read more ⟶

[TIL Tips] How to open your IDE with `code` in macOS


Visual Studio Code lets you “install” the code command to open files in VSCode from the terminal… But how about doing it ourselves? alias as always to the rescue. You just need to add the following to your .bashrc or .zshrc file For VS Code: alias code="open -a Visual\ Studio\ Code" For others: alias code="open -a <APPLICATION_NAME>" …
Read more ⟶