Skip to content

Instantly share code, notes, and snippets.

View scott-lydon's full-sized avatar

Scott scott-lydon

  • High Five
  • Burlingame
View GitHub Profile
Pod::Spec.new do |s|
s.name = "NameOfYourProject"
s.version = "0.1.0"
s.summary = "Description of your project"
s.description = "Mandatorily longer description of your project"
s.homepage = "https://github.com/YourUserName/NameOfYourProject"
s.license = "Description of your licence, name or otherwise"
s.author = { "Your name occupation" => "[email protected]" }
s.platform = :ios, "9.0"
import UIKit
class ShimmerView: UIView {
override init(frame: CGRect) {
super.init(frame: frame)
setupViews()
}
required init?(coder aDecoder: NSCoder) {
first = float(input("first number"))
operand = input("Your operand (accepting addition, multiplication, division, subtraction)")
second = float(input("second number"))
if operand == "x" or operand == "multiplication" or operand == "multiply" or operand == "*":
print(first * second)
elif operand == "+" or operand == "addition" or operand == "add":
print(first + second)
elif operand == "-" or operand == "subtraction" or operand == "subtract":
print(first - second)
# A dependent column must have continuous data. If it is continuous you should use a linear regression model.
# we create a dictionary
eruptions = {
"eruptions": [3.6, 1.8, 3.333, 2.283, 4.533, 2.883],
"waiting": [79, 54, 74, 62, 85, 55]
}
# we convert the dictionary into a dataframe
edf = pd.DataFrame(eruptions)
@scott-lydon
scott-lydon / ViewController.swift
Last active June 16, 2020 02:03
196 permutations
func test() {
print(1)
DispatchQueue.main.async {
print(2)
DispatchQueue.main.async {
print(3)
}
print(4)
}
print(5)
@scott-lydon
scott-lydon / Swift
Created June 20, 2020 01:56
ema calculation
/// Given an array of prices
func emas(for range: Int, smoothing: Int = 2) -> [Double?] {
var ema: Double?
let multiplier: Double = Double(smoothing) / (Double(range) + 1)
return (0..<count).map {
if let last = ema {
//Sean?
//ema = last * multiplier + self[$0] * (1 - multiplier)
//THEbalance
//ema = (self[$0] - last) * multiplier + last
/// Given an array of prices
func emas(for range: Int, smoothing: Int = 2) -> [Double?] {
var ema: Double?
let multiplier: Double = Double(smoothing) / (Double(range) + 1)
return (0..<count).map {
if let last = ema {
//Sean?
//ema = last * multiplier + self[$0] * (1 - multiplier)
//THEbalance
//ema = (self[$0] - last) * multiplier + last
@scott-lydon
scott-lydon / emaTests.swift
Last active June 20, 2020 02:27
tests for my ema
fileprivate struct EmaInOuts {
var prices: [Double]
var range: Int
var smoothing: Int
var resultingEMA: [Double?]
}
// Takes an array of tick values (price, close, high, open)
// price: CLOSE
// length: 180
// swift-tools-version:5.3
import PackageDescription
let package = Package(
name: "MyLibrary",
platforms: [
.macOS(.v10_14), .iOS(.v13), .tvOS(.v13)
],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://url/of/another/package.git", from: "1.0.0"),
.package(path: "path/to/a/local/package/", "1.0.0"..<"2.0.0")],