Skip to content

Instantly share code, notes, and snippets.


Chris Sanders astericky

View GitHub Profile
astericky / Date.swift
Created Oct 7, 2020 — forked from alexpaul/Date.swift
Using Date in Swift, using ISO8601DateFormatter() and DateFormatter()
View Date.swift
// Date extension
extension Date {
static func getStringFromDate(date: Date) -> String {
let dateFormatter = DateFormatter()
dateFormatter.dateFormat = "EEEE, MMM d, yyyy"
let dateString = dateFormatter.string(from: date)
return dateString
static func getDateFromString(dateString: String) -> Date? {
let formatter = ISO8601DateFormatter()
View SwiftUI+HexColors.swift
//Trying out a prefix operator
//I thought vertical elipses made sense, representative of rbg
prefix operator
prefix func (hex:UInt32) -> Color {
return Color(hex)
extension Color {
init(_ hex: UInt32, opacity:Double = 1.0) {
let red = Double((hex & 0xff0000) >> 16) / 255.0
astericky /
Created Jun 12, 2019 — forked from epatey/
Refreshing SwiftUI on changes within objects in a collection.

Refreshing SwiftUI on changes within objects in a collection.

How to approach updating UI for changes within objects held within a collection? After experimenting a bit, I think there are basically two approaches.

  1. The conformance to BindableObject by the object that contains the collection needs to be deep and not shallow. It needs to fire didChange if the collection, or anything recursively within the collection, changes. In my example from yesterday, this means that MainViewModel would need to figure out how to fire didChange if anything within any of its existing rows changes - not just changes to the collection itself. or
  2. The parent/container can have shallow conformance to BindableObject if the row model themselves conform to BindableObject and the row view declares the dependency with @ObjectBinding.

You must do one or the other if you want a row to refresh when isTyping changes value. I suspect that in the general case, #2 will be simpler.

astericky /
Created May 29, 2019 — forked from ErisDS/
Ghost Filter Query examples

Filter Queries - Example Use Cases

Here are a few example use cases, these use cases combine filter with other parameters to make useful API queries. The syntax for any of this may change between now, implementation, and release - they're meant as illustrative examples :)

Fetch 3 posts with tags which match 'photo' or 'video' and aren't the post with id 5.

api.posts.browse({filter: "tags:[photo, video] + id:-5", limit="3"});

GET /api/posts?filter=tags%3A%5Bphoto%2Cvideo%5D%2Bid%3A-5&limit=3

View gist:369c6d02e7cfbe2daf6b0183b8f985b5


Key/Command Description
Tab Auto-complete files and folder names
Ctrl + A Go to the beginning of the line you are currently typing on
Ctrl + E Go to the end of the line you are currently typing on
Ctrl + U Clear the line before the cursor
Ctrl + K Clear the line after the cursor
Ctrl + W Delete the word before the cursor
Ctrl + T Swap the last two characters before the cursor
View Apple iOS App Transport Security
View Go Project Dockerfile Example
# Run this from the parent directory
FROM golang:1.9-alpine as build_container
astericky /
Created Feb 7, 2018 — forked from subfuzion/
curl POST examples

Common Options

-#, --progress-bar Make curl display a simple progress bar instead of the more informational standard meter.

-b, --cookie <name=data> Supply cookie with request. If no =, then specifies the cookie file to use (see -c).

-c, --cookie-jar <file name> File to save response cookies to.

View gist:dceb5c41804f9303e446d320b1aeacc6

1. Clone your fork:

git clone

2. Add remote from original repository in your forked repository:

cd into/cloned/fork-repo
git remote add upstream git://
git fetch upstream
View .babelrc
"presets": ["latest"],
"plugins": ["transform-object-rest-spread", "babel-plugin-transform-react-jsx"]