- given the document like so
{
"_id": "abc123",
"name": "Jesse",
"username": "jchappell",
"location": "New York",
"score": 23
class DittoManager { | |
let ditto: Ditto | |
static let shared = DittoManager() | |
init() { | |
ditto = Ditto(identity: .onlinePlayground(appID: "e23ffe6b-70d1-4246-83a8-94cbd7a79a8d", token: "f058ac2a-4576-4af1-96f2-c4788d848cf8")) | |
try! ditto.startSync() | |
} |
let rx_request = Observable<Value>.create { (observer) -> Disposable in | |
let requestReference = Alamofire.request(.POST, url, parameters: payload) | |
.responseJSON(completionHandler: { (response) in | |
if let value = response.result.value { | |
observer.onNext(value) | |
observer.onCompleted() | |
}else if let error = response.result.error { | |
observer.onError(error) | |
} | |
}) |
function checkSiteId(siteId: any): siteId is string { | |
if (typeof siteId !== "string") { | |
return false | |
} | |
if (siteId.trim().length === 0) { | |
// it's just white space | |
return false | |
} |
sudo apt-get update | |
sudo apt-get -y upgrade | |
sudo apt-get -y install vim tmux git build-essential libxml2-dev python2.7 python2.7-dev fuse libtool autoconf libusb-1.0-0-dev libfuse-dev libssl-dev libimobiledevice* usbmuxd |
If we had documents in the cars collection like this:
[
{
"_id": "123abc",
// A struct will show up as a class on the JS side of things | |
extern crate wasm_bindgen; | |
use wasm_bindgen::prelude::*; | |
#[wasm_bindgen] | |
pub struct Bar { | |
contents: String, | |
} |
return create { (observer: AnyObserver<UploadSignal>) -> Disposable in | |
let transferUtility = AWSS3TransferUtility.defaultS3TransferUtility() | |
let key = String(format: "uploads/%@.png", arguments: [NSUUID().UUIDString]) | |
let fullUrl = String(format: "https://s3.amazonaws.com/edenmessenger/%@", arguments: [key]) | |
var uploadTask : AWSS3TransferUtilityUploadTask? | |
var completionUploadTask : AWSS3TransferUtilityUploadTask? | |
const options = { | |
"provider": "nickname", | |
"providerToken": "god", | |
"userInfo": { | |
"is_admin": true | |
} | |
}; | |
const user = await Realm.Sync.User.registerWithProvider(`https://INSTANCE_ADDRESS`, options) |
import * as Realm from 'realm'; | |
import * as faker from 'faker' | |
import * as _ from 'lodash' | |
// Product | |
export const ProductSchema: Realm.ObjectSchema = { | |
name: 'Product', | |
properties: { | |
productId: 'string', | |
name: 'string', |