Skip to content

Instantly share code, notes, and snippets.

View monkeywithacupcake's full-sized avatar
coffee me

jess monkeywithacupcake

coffee me
View GitHub Profile
@monkeywithacupcake
monkeywithacupcake / CollectionViewUnicodeEmojis.playground
Created October 19, 2017 02:41
Swift 4 Playground showing how to build StackView, Horizontal CollectionView, and work with unicode emojis programmatically
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
extension String {
func getUnicodeCodePoints() -> [String] {
return unicodeScalars.map { "U+" + String($0.value, radix: 16, uppercase: true) }
}
}
@monkeywithacupcake
monkeywithacupcake / SelectingCollectionView.playground
Last active October 20, 2017 01:42
Swift .playground showing how to programmatically change the height of items in a stack view and track cells selected and unselected.
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
extension UIView {
func asCircle(){
self.layer.cornerRadius = self.frame.width / 2;
self.layer.masksToBounds = true
}
@monkeywithacupcake
monkeywithacupcake / CustomUIView.Playground
Created October 22, 2017 06:10
How to use a custom UIView in another View controller programmatically and handle constraints in Swift 4.
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
class MyView: UIView {
let label = UILabel()
func updateText(_ text:String?) {
@monkeywithacupcake
monkeywithacupcake / AnimationExtensions.Playground
Created October 22, 2017 09:13
Swift 4 Playground (building off of the CustomUIView.playground) that shows how to setup multiple animations as view extensions to keep the view controller simple to read - somewhat.
//: Playground - noun: a place where people can play
import UIKit
import PlaygroundSupport
extension UIView {
func asCircle(){
self.layer.cornerRadius = self.frame.width / 2;
self.layer.masksToBounds = true
}
@monkeywithacupcake
monkeywithacupcake / DecodeJson.playground
Last active November 8, 2017 07:44
Dealing with nested JSON with dynamic keys
//: Playground - noun: a place where people can play
import UIKit
import Foundation
struct Thing: Decodable {
let id: String
let isActive: Bool
let name: String
let owner: String
@monkeywithacupcake
monkeywithacupcake / AppDelegate.swift
Created November 11, 2017 08:23
Parts of files for testing branch
//
// AppDelegate.swift
//
import UIKit
import CoreData
import Firebase
import TwitterKit
import FBSDKCoreKit
import Branch
@monkeywithacupcake
monkeywithacupcake / ViewAnimator.playground
Last active November 15, 2017 22:14
UIView animation moves frame after animate
//: A UIKit based Playground for presenting user interface
import UIKit
import PlaygroundSupport
extension UIView {
func spanSuperView() {
guard superview != nil else { return }
self.topAnchor.constraint(equalTo: superview!.topAnchor).isActive = true
self.leadingAnchor.constraint(equalTo: superview!.leadingAnchor).isActive = true
@monkeywithacupcake
monkeywithacupcake / .bash_profile
Created January 20, 2018 07:53 — forked from natelandau/.bash_profile
Mac OSX Bash Profile
# ---------------------------------------------------------------------------
#
# Description: This file holds all my BASH configurations and aliases
#
# Sections:
# 1. Environment Configuration
# 2. Make Terminal Better (remapping defaults and adding functionality)
# 3. File and Folder Management
# 4. Searching
# 5. Process Management
@monkeywithacupcake
monkeywithacupcake / ButtonView.swift
Created March 10, 2018 11:42
Make a custom table view
import UIKit
class ButtonView: UIView {
let button = UIButton()
func updateText(_ text:String?) {
guard let text = text else { return }
button.setTitle(text, for: .normal)
}
@monkeywithacupcake
monkeywithacupcake / icons-generator.sh
Last active December 31, 2021 11:30 — forked from beny/icons-generator.sh
Icon sizes generator for iOS/watchOS/iMessage apps.
#!/bin/bash
# Sizes from https://developer.apple.com/library/ios/#qa/qa1686/_index.html
# Requirements: ImageMagick
function resize {
GREEN='\033[0;32m'
BLUE='\033[0;34m'
DEFAULT='\033[0m'
echo -e "Generating ${BLUE}$3${DEFAULT} at size ${GREEN}$2 ${DEFAULT}"
convert $1 -resize $2 $3