Skip to content

Instantly share code, notes, and snippets.

View djmckee's full-sized avatar

Dylan McKee djmckee

View GitHub Profile
@bradwestfall
bradwestfall / S3-Static-Sites.md
Last active April 10, 2024 16:40
Use S3 and CloudFront to host Static Single Page Apps (SPAs) with HTTPs and www-redirects. Also covers deployments.

S3 Static Sites

⚠ This post is fairly old. I don't keep it up to date. Be sure to see comments where some people have posted updates

What this will cover

  • Host a static website at S3
  • Redirect www.website.com to website.com
  • Website can be an SPA (requiring all requests to return index.html)
  • Free AWS SSL certs
  • Deployment with CDN invalidation
@djmckee
djmckee / UIColor+RGBColor.swift
Last active August 29, 2015 14:21
A Swift extension to convert a String containing an RGB Colour representation (like rgb(255, 255, 255)) to a UIColor instance (which it returns).
import Foundation
import UIKit
extension UIColor {
// A factory method to take an rgb colour string ("rgb(255,255,255)") and return a UIColor object.
class func colorFromRGBString(string: String) -> UIColor {
// create mutable copy...
var rgbString = string
@djmckee
djmckee / String+Contains.swift
Created April 3, 2015 13:42
String+Contains in Swift
import Foundation
extension String {
// check if the string contains otherString, return accordingly.
func contains(otherString:String!) -> Bool {
if self.rangeOfString(otherString) != nil{
return true
} else {
return false
@ksafranski
ksafranski / SimpleStore.js
Last active July 2, 2022 15:25
Simple localStorage function with Cookie fallback for older browsers.
/**
* Simple localStorage with Cookie Fallback
* v.1.0.0
*
* USAGE:
* ----------------------------------------
* Set New / Modify:
* store('my_key', 'some_value');
*
* Retrieve: