Skip to content

Instantly share code, notes, and snippets.

View SwiftArchitect's full-sized avatar

Xavier Schott SwiftArchitect

View GitHub Profile
@SwiftArchitect
SwiftArchitect / cleanall.sh
Last active November 26, 2019 03:05
Clean Build Artifacts
#!/bin/bash
#path to this script
location=$(dirname "$0")
#execute other scripts, passing the 1st parameter (directory)
source "$location/"cleanxcode.sh "$1"
source "$location/"cleanxamarin.sh "$1"
source "$location/"cleannodejs.sh "$1"
# ...etc.
@SwiftArchitect
SwiftArchitect / InstallIonic.md
Created November 26, 2018 04:21
Install Ionic and run Hello World on Mac OS

Install ionic and run Hello World on Mac OS

Terminal Command
Install Node.js by visiting nodejs.org or , using HomeBrew: brew install node
Install ionic npm install -g ionic cordova
Create a Hello World project ionic start helloWorld blank
Navigate to the project cd helloWorld
Update dependencies npm install
Run inside the default browser ionic serve -c
@SwiftArchitect
SwiftArchitect / AndroidVimeo.java
Last active October 4, 2018 07:36 — forked from TjWallas/AndroidVimeo.java
Embedding Vimeo Videos using WebView on Android
//Auto playing vimeo videos in Android webview
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setAppCacheEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
mWebView.loadUrl("http://player.vimeo.com/video/xxxxxxxx");
@SwiftArchitect
SwiftArchitect / InterviewCake-Braces.swift
Last active March 29, 2018 01:55
Swift Xcode implementation of InterviewCake _Matching Braces_ in generally O(1) time and O(n) space. ⚠️ Spoiler alert: this is an improved answer to the https://www.interviewcake.com/question/swift/bracket-validator, so no peeking!
static func properlyNested(string: String) -> Bool {
let openersToClosers:[Character:Character] = ["{":"}",
"[":"]",
"(":")"]
let closers = openersToClosers.values
var stack = [Character]()
for character in string {
@SwiftArchitect
SwiftArchitect / InterviewCake-LinkedListNode+Extensions.swift
Last active March 23, 2018 02:26
Swift Xcode more implementation of InterviewCake _Delete Linked List Node_ in generally O(1) time and O(1), with references side-effects. ⚠️ Spoiler alert: this is an improved answer to the https://www.interviewcake.com/question/swift/delete-node question, so no peeking!
//
// LinkedListNode+Extensions.swift
//
// Copyright © 2018 Xavier Schott
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@SwiftArchitect
SwiftArchitect / InterviewCake-BinaryTreeNode.swift
Created February 25, 2018 00:49
Swift Xcode implementation of InterviewCake _Super Balanced Tree_ using a tight DFS in a `BinaryTreeNode` extension. ⚠️ Spoiler alert: this is an actual answer to the https://www.interviewcake.com/question/swift/balanced-binary-tree question, so no peeking!
//
// BinaryTreeNode.swift
//
import Foundation
class BinaryTreeNode {
var value: Int
var left: BinaryTreeNode?
@SwiftArchitect
SwiftArchitect / InterviewCake-RectangleLove.swift
Last active February 25, 2018 00:13
Swift Xcode implementation of InterviewCake 'Rectangle Intersection' with linear intersection (not range) performing in O(1). ⚠️ Spoiler alert: this is an actual answer to the https://www.interviewcake.com/question/swift/rectangular-love? question, so no peeking!
//
// RectangleLove.swift
//
// Copyright © 2018 Xavier Schott
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@SwiftArchitect
SwiftArchitect / InterviewCake-TemperatureTracker.swift
Created February 24, 2018 02:58
Swift Xcode implementation of InterviewCake 'Temperature Tracker' with just ahead of time, making all methods perform in O(1). Mean is calculated when requested, still performing in O(1). ⚠️ Spoiler alert: this is an actual answer to the https://www.interviewcake.com/question/swift/temperature-tracker question, so no peeking!
//
// TemperatureTracker.swift
//
// Copyright © 2018 Xavier Schott
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions:
@SwiftArchitect
SwiftArchitect / InterviewCake-Meeting.swift
Last active February 25, 2018 00:25
Swift Xcode implementation of InterviewCake 'HiCal' calendar event merging using immutable Meeting objects. It also doesn't start by making a copy of the entire Meetings array, saving one linear iteration of O(n). ⚠️ Spoiler alert: this is an actual answer to the https://www.interviewcake.com/question/swift/merging-ranges question, so no peeking!
//
// Meeting.swift
//
import Foundation
class Meeting: CustomStringConvertible {
private(set) var startTime: Int
private(set) var endTime: Int
@SwiftArchitect
SwiftArchitect / InterviewCake-Array+HighestProductOfIntegers.swift
Last active February 25, 2018 00:33
Swift Xcode implementation of InterviewCake 'Highest product of 3' using an `Array` extension, and a few fold faster than the accepted answer. ⚠️ Spoiler alert: this is an actual answer to the https://www.interviewcake.com/question/swift/highest-product-of-3 question, so no peeking!
//
// Array+HighestProductOfIntegers.swift
//
// Copyright © 2018 Xavier Schott
// Permission is hereby granted, free of charge, to any person obtaining a copy
// of this software and associated documentation files (the "Software"), to deal
// in the Software without restriction, including without limitation the rights
// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
// copies of the Software, and to permit persons to whom the Software is
// furnished to do so, subject to the following conditions: