Skip to content

Instantly share code, notes, and snippets.

Stan Stadelman sstadelman

  • Livermore, CA
Block or report user

Report or block sstadelman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ArabicCharacterSet.swift
var arabic = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0x0600))!...Unicode.Scalar(UInt16(0x06ff))!)
let arabicSupplement = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0x750))!...Unicode.Scalar(UInt16(0x077f))!)
let arabicExtendedA = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0x08a0))!...Unicode.Scalar(UInt16(0x08ff))!)
let arabicPresentationFormsA = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0xfb50))!...Unicode.Scalar(UInt16(0xfdff))!)
let arabicPresentationFormsB = CharacterSet(charactersIn: Unicode.Scalar(UInt16(0xfe70))!...Unicode.Scalar(UInt16(0xfeff))!)
let rumiNumeralSymbols = CharacterSet(charactersIn: Unicode.Scalar(UInt32(0x10e60))!...Unicode.Scalar(UInt32(0x10e7f))!)
let indicSiyaqNumbers = CharacterSet(charactersIn: Unicode.Scalar(UInt32(0x1ec70))!...Unicode.Scalar(UInt32(0x1ecbf))!)
let ottomanSiyaqNumbers = CharacterSet(charactersIn: Unicode.Scalar(UInt32(0x1ed00))!...Unicode.Scalar(UInt32(0x1ed4f))!)
@sstadelman
sstadelman / Repro.swift
Last active May 11, 2019
String length bug
View Repro.swift
//
// 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 Aug 20, 2018 — forked from zwaldowski/Activity.swift
os_activity_t for Swift 3
View Activity.swift
//
// Activity.swift
//
// Created by Zachary Waldowski on 8/21/16.
// Copyright © 2016 Zachary Waldowski. Licensed under MIT.
//
import os.activity
private final class LegacyActivityContext {
View Decode Array<Any> and Dictionary<String, Any> Swift
import Foundation
// Inspired by https://gist.github.com/mbuchetics/c9bc6c22033014aa0c550d3b4324411a
struct JSONCodingKeys: CodingKey {
var stringValue: String
init?(stringValue: String) {
self.stringValue = stringValue
}
View simple-https-server.py
# 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
View git-selective-merge.md

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:

View PowerHourDemo.swift
//
// TasksListReportFloorplanExample.swift
// PowerHour
//
// Created by Stadelman, Stan on 7/11/17.
// Copyright © 2017 sstadelman. All rights reserved.
//
import UIKit
View OptionSet.swift
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)
View Exercises_6_18_2017.md

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

View data.js
// 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
You can’t perform that action at this time.