In 🔥 | Out ❄️ |
---|---|
Swift | Objective C |
SwiftUI | UIKit |
Combine | RxSwift |
Realm | Core Data |
MongoDB Realm Sync (where needed) | Home-baked cross-platform data sync |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Realm from "realm"; | |
// Set your Schema | |
const ListingSchema = { | |
name: "Listing", | |
primaryKey: "_id", | |
properties: { | |
_id: "objectId", | |
location: "string", | |
price: "int", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
init() { | |
loginPublisher | |
.receive(on: DispatchQueue.main) | |
.flatMap { user -> RealmPublishers.AsyncOpenPublisher in | |
self.shouldIndicateActivity = true | |
var realmConfig = user.configuration(partitionValue: "user=\(user.id)") | |
realmConfig.objectTypes = [User.self, Project.self] | |
return Realm.asyncOpen(configuration: realmConfig) | |
} | |
.receive(on: DispatchQueue.main) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import SwiftUI | |
import RealmSwift | |
let app = App(id: "tasktracker-xxxxx") // TODO: Set the Realm application ID | |
@main | |
struct swiftui_realmApp: SwiftUI.App { | |
@StateObject var state = AppState() | |
var body: some Scene { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
git clone https://github.com/ClusterDB/task-tracker-swiftui.git | |
cd task-tracker-swiftui | |
pod install --repo-update | |
open task-tracker-swiftui.xcworkspace |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{"collections": [ | |
{ | |
"_comment": "Customer collection", | |
"customerID": 123456, | |
"name": { | |
"title": "Mr", | |
"first": "Andrew", | |
"last": "Morgan" | |
}, | |
"_passwordComment": "No need for user credentials as will use Google auth", |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
db.freedom.find( | |
{ | |
acidTransaction: "NOW_ENABLED", | |
multiStatement: true, | |
familiarity: "like relational DB", | |
comfortFactor: "🧸 extra cuddly", | |
syntax: "oh so similar", | |
implementation: "even your gran could do it", | |
useCases: "wide open", | |
try: "MongoDB 4.0 today" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from pymongo import MongoClient | |
def addUser(database, user): | |
return database.customers.insert_one(user).inserted_id | |
client = MongoClient(port=27017) | |
db=client.store | |
# This is the object that the application would be working with anyway and |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import mysql.connector | |
from mysql.connector import errorcode | |
def addUser(connection, user): | |
cursor = connection.cursor() | |
customerInsert = ( | |
"INSERT INTO customer (first_name, last_name, email, " | |
"DOB, annual_spend) VALUES " | |
"(%(first)s, %(last)s, %(email)s, %(dob)s, %(spend)s)") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
"use strict"; | |
var Alexa = require("alexa-sdk"); | |
var request = require("request"); | |
var config = require("./config.js"); | |
exports.handler = function(event, context, callback) { | |
console.log("In handler"); |
NewerOlder