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 / ScalingStaticPieChart.swift
Last active December 31, 2021 11:31
This is a scaling static pie chart - use as starter code for your project. This is based on the code in [App Coda's tutorial](https://www.appcoda.com/swiftui-pie-chart/) but it scales into whatever frame it is in rather than having hard coded center and radius. I've also changed the clockwise parameter to false to allow for logical building.
import SwiftUI
struct ScalingStaticPieChart: View {
var body: some View {
GeometryReader { geometry in
let gc = geometry.size.width * 0.5
let gcenter = CGPoint(x: gc, y: gc)
let outsize = geometry.size.width * 0.4
ZStack {
@monkeywithacupcake
monkeywithacupcake / encourageme.sh
Created September 8, 2018 14:01
A shell script to return a random string
#!/bin/zsh
# returns a random phrase for motivation
# usage `bash encourageme.sh`
aff=("You are enough" "Do one small thing" "Sources say that you can do it" "Just try" "You got this" "You are what you repeatedly do")
theaff=${aff[$(( $RANDOM % ${#aff[@]} + 1 ))]}
say $theaff
echo $theaff
@monkeywithacupcake
monkeywithacupcake / catchphrase.sh
Created September 8, 2018 13:56
A shell script to generate an Image with text
#!/bin/zsh
# Asks a series of questions and then returns an image
# use like "bash catchphrase.sh"
echo "What is your favorite color?"
read theColor
echo "What is your catchphrase?"
read thePhrase
convert -size 1000x1000 xc:$theColor +repage \
-size 800x800 -fill white -background None \
@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
@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 / .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 / 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 / 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 / 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 / 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
}