Skip to content

Instantly share code, notes, and snippets.

@carlynorama
carlynorama / arrays_sets_dictionaries_scratchpad.swift
Created February 7, 2016 15:56
Whole collections learning scratch pad, Swift 2.1
//: https://developer.apple.com/library/ios/documentation/Swift/Conceptual/Swift_Programming_Language/CollectionTypes.html
import UIKit
var str = "Hello, playground"
var someInts = [Int]()
print("someInts is of type [Int] with \(someInts.count) items.")
someInts.append(3)
print("someInts is of type [Int] with \(someInts.count) items.")
@carlynorama
carlynorama / guessinggame_viewcontroller.swift
Last active August 19, 2019 01:45
Guessing Game in Swift
//
// ViewController.swift
// GuessingGame
//
// Created by carlynorama on 2/7/16.
// CC 0.0
//
import UIKit
@carlynorama
carlynorama / prime_playground.swift
Last active February 8, 2016 04:22
Prime number detection swift
//: Playground - noun: a place where people can play
import UIKit
var str = "Hello, playground"
//I seem to need function to get the case statement function matching to work.
//I don't know why yet, but I did find versions to do what I wanted
//without it below.
//To read: http://oleb.net/blog/2015/09/swift-pattern-matching/
@carlynorama
carlynorama / primechecker_viewcontroller.swift
Last active February 8, 2016 14:50
PrimeCheck Swift App Code. Has text field as first responder and dismiss on tap.
//
// ViewController.swift
// PrimeChecker
//
// 2/7/16.
// CC BY carlynorama.
//
import UIKit
@carlynorama
carlynorama / stopwatch.swift
Created February 10, 2016 00:52
Stopwatch code swift
//
// ViewController.swift
// BasicTimer
//
// Created by carlynorama on 2/9/16.
// Do what you want with it.
//
import UIKit
@carlynorama
carlynorama / timestable.swift
Last active February 16, 2016 17:39
Viewcontroller only from my TimesTable app for Udemy class. The Complete iOS 9 Developer Course - Build 18 Apps, Rob Percival (added remembering where the slider position was on app closing)
// TimesTable
//
// Created 2/13/16.
// Do as you want, 2016 carlynorama. No rights reserved.
// Videos: https://www.udemy.com/the-complete-ios-9-developer-course/learn/#/lecture/3193364
// https://www.udemy.com/the-complete-ios-9-developer-course/learn/#/lecture/3193368
// http://stackoverflow.com/questions/31200640/xcode-swift-nsuserdefaults-save-the-highscore-if-quit-app-and-restart-it-wher
// http://alvinalexander.com/java/edu/pj/pj010018
import UIKit
@carlynorama
carlynorama / keyboard_leaves.swift
Last active February 15, 2016 23:36
Making sure textfield resigns its first responder status / hides keyboard on button press, return and touch away.
//
// ViewController.swift
// keyBoardControll
// No rights reserved.
//
import UIKit
class ViewController: UIViewController, UITextFieldDelegate {
@carlynorama
carlynorama / momswordpressheader.css
Last active March 29, 2016 16:20
How to get a responsive image header for the mom's blog and remove the top margin on the Expound Theme for wordpress.
/*
SOURCES:
http://stackoverflow.com/questions/600743/how-to-get-div-height-to-auto-adjust-to-background-size
http://jsfiddle.net/TPEFn/2/
*/
/*
Welcome to Custom CSS!
*/
#page {
@carlynorama
carlynorama / hexacouple.pde
Created March 29, 2016 01:20
Playing with shapes in Processing.
//License: CC 0
Hexagon h1, h2;
void setup() {
size(640, 360);
fill(255, 126);
h1 = new Hexagon(100, 200, 70);
h2 = new Hexagon(20, 40, 90);
@carlynorama
carlynorama / hexagons_from_vornoi.pde
Created March 29, 2016 03:15
uses vornoi sketch found on open processing to generate hexgons
//Derivative of
//http://www.openprocessing.org/sketch/61968
class Cell
{
PVector loc;
color c;
Cell(int _x, int _y, color _c)
{
loc = new PVector(_x, _y);