Skip to content

Instantly share code, notes, and snippets.

View sstadelman's full-sized avatar
🚀

Stan Stadelman sstadelman

🚀
View GitHub Profile
@sstadelman
sstadelman / Repro.swift
Last active May 11, 2019 00:01
String length bug
//
// Repro.swift
//
// Created by Stadelman, Stan on 5/10/19.
//
import Foundation
/// Sample bidirectional string, which happens to include neutral characters "(" and ")"
/// String source: [Section #1 #1](https://forum.wordreference.com/threads/important-please-read-before-you-post-الرجاء-القراءة-قبل-المشاركة.53282/)
@sstadelman
sstadelman / Activity.swift
Created August 20, 2018 20:54 — forked from zwaldowski/Activity.swift
os_activity_t for Swift 3
//
// Activity.swift
//
// Created by Zachary Waldowski on 8/21/16.
// Copyright © 2016 Zachary Waldowski. Licensed under MIT.
//
import os.activity
private final class LegacyActivityContext {
import Foundation
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a
struct JSONCodingKeys: CodingKey {
var stringValue: String
init?(stringValue: String) {
self.stringValue = stringValue
}
# python3 version, derived from python2 version https://gist.github.com/dergachev/7028596
#
# taken from http://www.piware.de/2011/01/creating-an-https-server-in-python/
# generate server.xml with the following command:
# openssl req -new -x509 -keyout server.pem -out carthageserver.pem -days 365 -nodes
# run as follows:
# python3 simple-https-server.py
# then in your browser, visit:
# https://localhost:443
@sstadelman
sstadelman / git-selective-merge.md
Created February 12, 2018 17:20 — forked from katylava/git-selective-merge.md
git selective merge

Example: You have a branch refactor that is quite different from master. You can't merge all of the commits, or even every hunk in any single commit or master will break, but you have made a lot of improvements there that you would like to bring over to master.

Standard docs: here

Note: This will not preserve the original change authors. Only use if necessary, or if you don't mind losing that information, or if you are only merging your own work.

On master:

@sstadelman
sstadelman / PowerHourDemo.swift
Last active July 24, 2017 23:19
PowerHourDemo
//
// TasksListReportFloorplanExample.swift
// PowerHour
//
// Created by Stadelman, Stan on 7/11/17.
// Copyright © 2017 sstadelman. All rights reserved.
//
import UIKit
enum Constraints {
struct Horizontal: OptionSet {
let rawValue: UInt8
static let masterTextView = Horizontal(rawValue: 1)
static let detailImageView = Horizontal(rawValue: 2)
static let descriptionTextView = Horizontal(rawValue: 3)
static let statusTextView = Horizontal(rawValue: 4)
@sstadelman
sstadelman / Exercises_6_18_2017.md
Last active June 19, 2017 05:30
Exercises_6_18_2017

Started watching Week2 of Andrew Ng's coursera Machine Learning course.

Beginning with Model & Cost function. For Model representation, showed correlation of house size to sale price in Portland. In this example, the house size is the x-value input, and the y-value is the sale price. It is a supervised learning scenario, since we train the model on known historical sales prices.

This is an example of univariate linear regression, or linear regression with one variable. Because we're trying to predict continuous real values, we call this a "regression problem". Otherwise, if there are only discrete values, it is a "classification problem".

To validate this scenario for the financial projections case, I'll use the google_vix_results.csv data below, which attempts to predict the high of the GOOG equity, from the prior day's GOOGVIX volatility index high. The prior_day_vix_futures_high will be the x and the the observed_equity_high will be the y. m is 1752.

Keys to pr

// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved.
// 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:
//
// The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE
// WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
@sstadelman
sstadelman / metadata.xml
Created June 4, 2017 20:52
metadata.xml
<?xml version="1.0" encoding="utf-8"?><edmx:Edmx Version="1.0" xmlns:edmx="http://schemas.microsoft.com/ado/2007/06/edmx" xmlns:m="http://schemas.microsoft.com/ado/2007/08/dataservices/metadata" xmlns:sap="http://www.sap.com/Protocols/SAPData"><edmx:DataServices m:DataServiceVersion="2.0"><Schema Namespace="GWDEMO" xml:lang="en" sap:schema-version="1" xmlns="http://schemas.microsoft.com/ado/2008/09/edm"><EntityType Name="SalesOrderLineItem" sap:content-version="1"><Key><PropertyRef Name="SalesOrderItemKey"/><PropertyRef Name="SalesOrderKey"/></Key><Property Name="CurrencyCodeDescription" Type="Edm.String" MaxLength="255" sap:label="Currency" sap:creatable="false" sap:updatable="false"/><Property Name="OpportunityItemPosition" Type="Edm.String" MaxLength="10" sap:label="Opportunity Item Position" sap:updatable="false"/><Property Name="ProductName" Type="Edm.String" MaxLength="255" sap:label="Product Name" sap:creatable="false" sap:updatable="false"/><Property Name="NetSum" Type="Edm.Decimal" Precision="15" Sca