Skip to content

Instantly share code, notes, and snippets.

View mbalex99's full-sized avatar

Maximilian Alexander mbalex99

View GitHub Profile
@mbalex99
mbalex99 / ticker.ts
Created August 17, 2017 20:50
Ticker File Example with Faker and Realm
import { Server } from './' // import { Server } from 'realm-object-server'
import * as faker from 'faker'
import * as Realm from 'realm'
const myNewServer = new Server({
port: 9081
})
myNewServer.start()
.then(() => {
console.log('Started! on port 9081')
@mbalex99
mbalex99 / index.ts
Last active August 16, 2017 18:36
New ROS Ticker
import { Server } from './' // import { Server } from 'realm-object-server'
import * as faker from 'faker'
import * as Realm from 'realm'
const myNewServer = new Server({
port: 9081
})
myNewServer.start()
.then(() => {
console.log('Started! on port 9081')
@mbalex99
mbalex99 / MyDoctorsViewController.swift
Last active July 28, 2017 20:22
Observing and Writing to Real-time Offline First Realm
import UIKit
import RealmSwift
class Doctor: Object {
dynamic var _id: String = ""
dynamic var name: String = ""
dynamic var address: String = ""
dynamic var updatedOn: NSDate = NSDate()
}
@mbalex99
mbalex99 / rcli.md
Last active April 17, 2017 23:04
Realm CLI Notes

Basic Setup

  • To install the cli, you will do npm install -g realm-cli
  • To aim the cli at a host you can do it either of 3 ways
    1. realm-cli -h "localhost:9080" ..args
    2. realm-cli -host "localhost:9080"" ...args
    3. To set a host for future commands simply call realm-cli use "localhost:9080"
    4. To clear a host realm-cli use "" or realm-cli use

Controlling a Service

@mbalex99
mbalex99 / plan.md
Last active April 13, 2017 21:28
Super Bloom
  • Ileana Betancourt
  • Max Alexander, 415 930 0285
  • Adam Butler, 508 320 9898
  • Adam Fish
@mbalex99
mbalex99 / node-realm-interview-questions.md
Last active April 12, 2017 19:49
Realm Node Interview Questions

Coding Questions

  1. How would you explicity notify the node run loop to execute some code. For example, we have C++ calling JavaScript. C++ code is not aware of the JavaScript/Node event loop
  2. Show me your ways of getting rid of callback hell.
  3. How would you handle uncaught exceptions in node?
  4. This takes a long time in Chrome but not in Node why?
console.time("cycle")
for(var i = 0; i < 5000000; i++) {
  //nothing
}
@mbalex99
mbalex99 / RxFirebase.kt
Last active April 4, 2017 06:52
Firebase Kotlin RxJava
import com.firebase.client.*
import com.firebase.client.core.view.Event
import rx.Observable
import rx.subscriptions.Subscriptions
data class RxFirebasePayload(val dataSnapshot: DataSnapshot, val previousChildKey: String? = null)
class RxFirebase{
@mbalex99
mbalex99 / piechartdata.swift
Last active November 15, 2016 06:45
Swift PieChartData
let entry1 = PieChartDataEntry(value: 0.75, label: "Something1")
let entry2 = PieChartDataEntry(value: 0.25, label: "Something2")
let dataSet = PieChartDataSet(values: [entry1, entry2], label: nil)
dataSet.colors = [UIColor.red, UIColor.blue] // in order of the entries by index
pieChartView.data = PieChartData(dataSet: dataSet)

Boats

  • Boat1: 26.971038, -129.023438
  • Boat2: 30.363396, -66.796875
  • Boat3: 40.905210, -130.429688

Towers

  • Tower1: 45.019185, -112.500000
  • Tower2: 37.918201, -108.281250
  • Tower3: 30.968189, 92.109375
class Annotation {
interface AnnotationLatLngChange {
onChange(LatLng latLng);
}
AnnotationLatLngChange changeHandler;
LatLng getLatLng();
void setLatLng();
}